@team-agent/installer 0.3.13 → 0.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.lock +1 -1
- package/Cargo.toml +1 -1
- package/crates/team-agent/src/cli/adapters.rs +1 -0
- package/crates/team-agent/src/cli/emit.rs +92 -11
- package/crates/team-agent/src/cli/mod.rs +228 -85
- package/crates/team-agent/src/cli/send.rs +252 -0
- package/crates/team-agent/src/cli/tests/run_delegation.rs +15 -3
- package/crates/team-agent/src/cli/tests/shutdown_kill_plan.rs +159 -2
- package/crates/team-agent/src/cli/types.rs +30 -1
- package/crates/team-agent/src/compiler/tests.rs +2 -2
- package/crates/team-agent/src/compiler.rs +1 -1
- package/crates/team-agent/src/fake_worker.rs +32 -145
- package/crates/team-agent/src/leader/start.rs +279 -4
- package/crates/team-agent/src/lifecycle/display.rs +3 -3
- package/crates/team-agent/src/lifecycle/launch.rs +692 -92
- package/crates/team-agent/src/lifecycle/restart/agent.rs +137 -17
- package/crates/team-agent/src/lifecycle/restart/common.rs +88 -42
- package/crates/team-agent/src/lifecycle/restart/rebuild.rs +197 -33
- package/crates/team-agent/src/lifecycle/restart/selection.rs +9 -6
- package/crates/team-agent/src/lifecycle/tests/core.rs +195 -50
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +934 -72
- package/crates/team-agent/src/lifecycle/types.rs +5 -0
- package/crates/team-agent/src/lifecycle/worker_command_context.rs +8 -0
- package/crates/team-agent/src/mcp_server/wire.rs +153 -3
- package/crates/team-agent/src/messaging/leader_receiver.rs +276 -43
- package/crates/team-agent/src/messaging/mod.rs +6 -3
- package/crates/team-agent/src/messaging/results.rs +240 -158
- package/crates/team-agent/src/messaging/send.rs +3 -2
- package/crates/team-agent/src/messaging/tests/e23.rs +35 -0
- package/crates/team-agent/src/messaging/tests/mod.rs +6 -2
- package/crates/team-agent/src/messaging/tests/runtime.rs +9 -9
- package/crates/team-agent/src/os_probe.rs +11 -0
- package/crates/team-agent/src/state/persist.rs +6 -0
- package/crates/team-agent/src/tmux_backend.rs +90 -0
- package/crates/team-agent/src/transport/test_support.rs +46 -1
- package/crates/team-agent/src/transport.rs +31 -0
- package/package.json +4 -4
- package/skills/team-agent/references/recovery-runbook.md +277 -0
package/Cargo.lock
CHANGED
package/Cargo.toml
CHANGED
|
@@ -107,6 +107,7 @@ pub fn cmd_quick_start(args: &QuickStartArgs) -> Result<CmdResult, CliError> {
|
|
|
107
107
|
args.team_id.as_deref(),
|
|
108
108
|
args.yes,
|
|
109
109
|
args.fresh,
|
|
110
|
+
!args.no_display,
|
|
110
111
|
)?;
|
|
111
112
|
let readiness = value.get("readiness").and_then(Value::as_object);
|
|
112
113
|
let all_resumable_have_session = readiness
|
|
@@ -77,6 +77,12 @@ fn dispatch(command: &str, args: &[String], cwd: &Path) -> Result<ExitCode, CliE
|
|
|
77
77
|
"quick-start" => cmd_quick_start(&quick_start_args(args, cwd)?).map(emit_result),
|
|
78
78
|
"compile" => cmd_compile(&compile_args(args, cwd)?).map(emit_result),
|
|
79
79
|
"send" => cmd_send(&send_args(args, cwd)?).map(emit_result),
|
|
80
|
+
"fallback-send-leader" => {
|
|
81
|
+
cmd_fallback_send_leader(&fallback_send_leader_args(args, cwd)?).map(emit_result)
|
|
82
|
+
}
|
|
83
|
+
"fallback-report-result" => {
|
|
84
|
+
cmd_fallback_report_result(&fallback_report_result_args(args, cwd)?).map(emit_result)
|
|
85
|
+
}
|
|
80
86
|
"allow-peer-talk" => {
|
|
81
87
|
cmd_allow_peer_talk(&allow_peer_talk_args(args, cwd)?).map(emit_result)
|
|
82
88
|
}
|
|
@@ -136,6 +142,8 @@ const DISPATCH_COMMANDS: &[&str] = &[
|
|
|
136
142
|
"quick-start",
|
|
137
143
|
"compile",
|
|
138
144
|
"send",
|
|
145
|
+
"fallback-send-leader",
|
|
146
|
+
"fallback-report-result",
|
|
139
147
|
"allow-peer-talk",
|
|
140
148
|
"status",
|
|
141
149
|
"stop",
|
|
@@ -202,10 +210,12 @@ fn command_help(command: Option<&str>) -> String {
|
|
|
202
210
|
)
|
|
203
211
|
}
|
|
204
212
|
Some("init") => "usage: team-agent init [--workspace WORKSPACE] [--force] [--json]".to_string(),
|
|
205
|
-
Some("quick-start") => "usage: team-agent quick-start [TEAMDIR] [--workspace WORKSPACE] [--name NAME] [--team-id TEAM|--team TEAM] [--yes] [--fresh] [--json]\n\ndefaults: display_backend=
|
|
213
|
+
Some("quick-start") => "usage: team-agent quick-start [TEAMDIR] [--workspace WORKSPACE] [--name NAME] [--team-id TEAM|--team TEAM] [--yes] [--fresh] [--no-display] [--json]\n\ndefaults: display_backend=adaptive; set display_backend: none in TEAM.md or pass --no-display to use one worker window per agent.".to_string(),
|
|
206
214
|
Some("start") => "usage: team-agent start [TEAMDIR] [--yes] [--fresh] [--json]".to_string(),
|
|
207
215
|
Some("compile") => "usage: team-agent compile --team TEAM [--out FILE] [--json]".to_string(),
|
|
208
216
|
Some("send") => "usage: team-agent send TARGET MESSAGE... [--workspace WORKSPACE] [--team TEAM] [--targets AGENTS] [--task TASK] [--sender SENDER] [--watch-result] [--requires-ack|--no-ack] [--no-wait] [--timeout SECONDS] [--confirm-human] [--message-id ID] [--json]".to_string(),
|
|
217
|
+
Some("fallback-send-leader") => "usage: team-agent fallback-send-leader --workspace WORKSPACE --team TEAM --sender AGENT --message-id ID --content TEXT --primary-error ERROR [--task TASK] [--json]\n\nEmergency one-shot fallback only after a leader-bound MCP send transport failure; restart-agent after use.".to_string(),
|
|
218
|
+
Some("fallback-report-result") => "usage: team-agent fallback-report-result --workspace WORKSPACE --team TEAM --agent-id AGENT --task-id TASK --result-json JSON --primary-error ERROR [--json]\n\nEmergency one-shot fallback only after a report_result MCP transport failure; persists the result DB row, then restart-agent after use.".to_string(),
|
|
209
219
|
Some("allow-peer-talk") => "usage: team-agent allow-peer-talk A B [--workspace WORKSPACE] [--json]".to_string(),
|
|
210
220
|
Some("status") => "usage: team-agent status [AGENT] [--workspace WORKSPACE] [--team TEAM] [--summary|--json] [--detail]".to_string(),
|
|
211
221
|
Some("stop") => "usage: team-agent stop [--workspace WORKSPACE] [--team TEAM] [--keep-logs] [--json]".to_string(),
|
|
@@ -347,7 +357,9 @@ fn install_skill_args(args: &[String]) -> Result<InstallSkillArgs, CliError> {
|
|
|
347
357
|
|
|
348
358
|
/// 取 `--flag <value>` 的值(用于 install-skill 的 --source/--dest,parse_args 不覆盖的旗标)。
|
|
349
359
|
fn flag_value(args: &[String], flag: &str) -> Option<String> {
|
|
350
|
-
args.iter()
|
|
360
|
+
args.iter()
|
|
361
|
+
.position(|a| a == flag)
|
|
362
|
+
.and_then(|i| args.get(i + 1).cloned())
|
|
351
363
|
}
|
|
352
364
|
|
|
353
365
|
/// `team-agent install-skill`(RED-1 单源):repo `skills/team-agent` → `~/.codex|.claude|.copilot`。
|
|
@@ -355,7 +367,9 @@ fn flag_value(args: &[String], flag: &str) -> Option<String> {
|
|
|
355
367
|
fn cmd_install_skill(args: &InstallSkillArgs) -> Result<CmdResult, CliError> {
|
|
356
368
|
// 卸载分支(单源:走同一 SkillTarget 表的 dest_dir;all → SINGLE_TARGETS 全集)。
|
|
357
369
|
if args.uninstall {
|
|
358
|
-
let home = std::env::var_os("HOME")
|
|
370
|
+
let home = std::env::var_os("HOME")
|
|
371
|
+
.map(PathBuf::from)
|
|
372
|
+
.unwrap_or_else(|| PathBuf::from("."));
|
|
359
373
|
let targets: Vec<crate::packaging::SkillTarget> = match args.target {
|
|
360
374
|
crate::packaging::SkillTarget::All => {
|
|
361
375
|
crate::packaging::SkillTarget::SINGLE_TARGETS.to_vec()
|
|
@@ -367,7 +381,8 @@ fn cmd_install_skill(args: &InstallSkillArgs) -> Result<CmdResult, CliError> {
|
|
|
367
381
|
if let Some(dest) = t.dest_dir(&home) {
|
|
368
382
|
let existed = dest.0.exists();
|
|
369
383
|
if existed && !args.dry_run {
|
|
370
|
-
std::fs::remove_dir_all(&dest.0)
|
|
384
|
+
std::fs::remove_dir_all(&dest.0)
|
|
385
|
+
.map_err(|e| CliError::Runtime(e.to_string()))?;
|
|
371
386
|
}
|
|
372
387
|
removed.push(serde_json::json!({
|
|
373
388
|
"target": t,
|
|
@@ -386,13 +401,14 @@ fn cmd_install_skill(args: &InstallSkillArgs) -> Result<CmdResult, CliError> {
|
|
|
386
401
|
.source
|
|
387
402
|
.clone()
|
|
388
403
|
.ok_or_else(|| CliError::Usage("missing --source <skill dir>".to_string()))?;
|
|
389
|
-
let outcomes =
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
404
|
+
let outcomes =
|
|
405
|
+
crate::packaging::install::install_skill(&crate::packaging::SkillInstallOptions {
|
|
406
|
+
target: args.target,
|
|
407
|
+
dest: args.dest.clone(),
|
|
408
|
+
dry_run: args.dry_run,
|
|
409
|
+
source,
|
|
410
|
+
})
|
|
411
|
+
.map_err(|e| CliError::Runtime(e.to_string()))?;
|
|
396
412
|
let installed: Vec<serde_json::Value> = outcomes
|
|
397
413
|
.iter()
|
|
398
414
|
.map(|o| {
|
|
@@ -643,6 +659,11 @@ struct ParsedArgs {
|
|
|
643
659
|
pane: Option<String>,
|
|
644
660
|
provider: Option<String>,
|
|
645
661
|
message_id: Option<String>,
|
|
662
|
+
content: Option<String>,
|
|
663
|
+
primary_error: Option<String>,
|
|
664
|
+
agent_id: Option<String>,
|
|
665
|
+
task_id: Option<String>,
|
|
666
|
+
result_json: Option<String>,
|
|
646
667
|
}
|
|
647
668
|
|
|
648
669
|
fn parse_args(args: &[String]) -> ParsedArgs {
|
|
@@ -664,7 +685,9 @@ fn parse_args(args: &[String]) -> ParsedArgs {
|
|
|
664
685
|
"--team-id" => parsed.team_id = next_arg(args, &mut i),
|
|
665
686
|
"--targets" | "--target" | "--to" => parsed.targets = next_arg(args, &mut i),
|
|
666
687
|
"--task" => parsed.task = next_arg(args, &mut i),
|
|
688
|
+
"--task-id" => parsed.task_id = next_arg(args, &mut i),
|
|
667
689
|
"--sender" => parsed.sender = next_arg(args, &mut i),
|
|
690
|
+
"--agent-id" => parsed.agent_id = next_arg(args, &mut i),
|
|
668
691
|
"--watch-result" => parsed.watch_result = true,
|
|
669
692
|
"--requires-ack" => parsed.requires_ack = true,
|
|
670
693
|
"--no-ack" => parsed.no_ack = true,
|
|
@@ -719,6 +742,9 @@ fn parse_args(args: &[String]) -> ParsedArgs {
|
|
|
719
742
|
"--pane" => parsed.pane = next_arg(args, &mut i),
|
|
720
743
|
"--provider" => parsed.provider = next_arg(args, &mut i),
|
|
721
744
|
"--message-id" => parsed.message_id = next_arg(args, &mut i),
|
|
745
|
+
"--content" => parsed.content = next_arg(args, &mut i),
|
|
746
|
+
"--primary-error" => parsed.primary_error = next_arg(args, &mut i),
|
|
747
|
+
"--result-json" => parsed.result_json = next_arg(args, &mut i),
|
|
722
748
|
"-h" | "--help" => {}
|
|
723
749
|
other if other.starts_with("--team=") => {
|
|
724
750
|
parsed.team = Some(other.trim_start_matches("--team=").to_string());
|
|
@@ -792,6 +818,7 @@ fn quick_start_args(args: &[String], cwd: &Path) -> Result<QuickStartArgs, CliEr
|
|
|
792
818
|
team_id: parsed.team_id.or(parsed.team),
|
|
793
819
|
yes: parsed.yes,
|
|
794
820
|
fresh: parsed.fresh,
|
|
821
|
+
no_display: parsed.no_display,
|
|
795
822
|
json: parsed.json,
|
|
796
823
|
})
|
|
797
824
|
}
|
|
@@ -862,6 +889,60 @@ fn send_args(args: &[String], cwd: &Path) -> Result<SendArgs, CliError> {
|
|
|
862
889
|
})
|
|
863
890
|
}
|
|
864
891
|
|
|
892
|
+
fn fallback_send_leader_args(
|
|
893
|
+
args: &[String],
|
|
894
|
+
cwd: &Path,
|
|
895
|
+
) -> Result<FallbackSendLeaderArgs, CliError> {
|
|
896
|
+
let parsed = parse_args(args);
|
|
897
|
+
Ok(FallbackSendLeaderArgs {
|
|
898
|
+
workspace: workspace(&parsed, cwd),
|
|
899
|
+
team: parsed.team,
|
|
900
|
+
sender: parsed
|
|
901
|
+
.sender
|
|
902
|
+
.or(parsed.agent_id)
|
|
903
|
+
.ok_or_else(|| CliError::Usage("missing --sender <agent>".to_string()))?,
|
|
904
|
+
task: parsed.task.or(parsed.task_id),
|
|
905
|
+
message_id: parsed
|
|
906
|
+
.message_id
|
|
907
|
+
.ok_or_else(|| CliError::Usage("missing --message-id <id>".to_string()))?,
|
|
908
|
+
content: parsed
|
|
909
|
+
.content
|
|
910
|
+
.or_else(|| (!parsed.positionals.is_empty()).then(|| parsed.positionals.join(" ")))
|
|
911
|
+
.ok_or_else(|| CliError::Usage("missing --content <text>".to_string()))?,
|
|
912
|
+
primary_error: parsed
|
|
913
|
+
.primary_error
|
|
914
|
+
.ok_or_else(|| CliError::Usage("missing --primary-error <error>".to_string()))?,
|
|
915
|
+
json: parsed.json,
|
|
916
|
+
})
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
fn fallback_report_result_args(
|
|
920
|
+
args: &[String],
|
|
921
|
+
cwd: &Path,
|
|
922
|
+
) -> Result<FallbackReportResultArgs, CliError> {
|
|
923
|
+
let parsed = parse_args(args);
|
|
924
|
+
Ok(FallbackReportResultArgs {
|
|
925
|
+
workspace: workspace(&parsed, cwd),
|
|
926
|
+
team: parsed.team,
|
|
927
|
+
agent_id: parsed
|
|
928
|
+
.agent_id
|
|
929
|
+
.or(parsed.sender)
|
|
930
|
+
.ok_or_else(|| CliError::Usage("missing --agent-id <agent>".to_string()))?,
|
|
931
|
+
task_id: parsed
|
|
932
|
+
.task_id
|
|
933
|
+
.or(parsed.task)
|
|
934
|
+
.ok_or_else(|| CliError::Usage("missing --task-id <task>".to_string()))?,
|
|
935
|
+
result_json: parsed
|
|
936
|
+
.result_json
|
|
937
|
+
.or_else(|| parsed.result)
|
|
938
|
+
.ok_or_else(|| CliError::Usage("missing --result-json <json>".to_string()))?,
|
|
939
|
+
primary_error: parsed
|
|
940
|
+
.primary_error
|
|
941
|
+
.ok_or_else(|| CliError::Usage("missing --primary-error <error>".to_string()))?,
|
|
942
|
+
json: parsed.json,
|
|
943
|
+
})
|
|
944
|
+
}
|
|
945
|
+
|
|
865
946
|
fn allow_peer_talk_args(args: &[String], cwd: &Path) -> Result<AllowPeerTalkArgs, CliError> {
|
|
866
947
|
let parsed = parse_args(args);
|
|
867
948
|
Ok(AllowPeerTalkArgs {
|