@team-agent/installer 0.5.98 → 0.5.100
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 -163
- package/crates/team-agent/src/cli/diagnose.rs +3 -19
- package/crates/team-agent/src/cli/emit.rs +20 -204
- package/crates/team-agent/src/cli/mod.rs +138 -205
- package/crates/team-agent/src/cli/send/coordinator.rs +2 -2
- package/crates/team-agent/src/cli/spec.rs +41 -67
- package/crates/team-agent/src/cli/tests/main_preserved.rs +2 -186
- package/crates/team-agent/src/cli/tests/missing_subcommands.rs +9 -10
- package/crates/team-agent/src/cli/tests/run_delegation.rs +0 -3
- package/crates/team-agent/src/cli/tests/verb_validate.rs +0 -1
- package/crates/team-agent/src/cli/triage.rs +1 -1
- package/crates/team-agent/src/cli/types.rs +0 -55
- package/crates/team-agent/src/compiler/tests.rs +5 -8
- package/crates/team-agent/src/compiler.rs +6 -14
- package/crates/team-agent/src/leader/lease.rs +1 -1
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +1 -1
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +1 -1
- package/crates/team-agent/src/lifecycle/launch/agent_state.rs +5 -25
- package/crates/team-agent/src/lifecycle/launch/identity.rs +2 -18
- package/crates/team-agent/src/lifecycle/launch/layout.rs +7 -29
- package/crates/team-agent/src/lifecycle/launch/leader_context.rs +1 -1
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +1 -1
- package/crates/team-agent/src/lifecycle/launch/ownership.rs +1 -1
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +7 -7
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +12 -49
- package/crates/team-agent/src/lifecycle/launch/quick_start_transport.rs +3 -9
- package/crates/team-agent/src/lifecycle/launch/readiness.rs +1 -1
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +2 -61
- package/crates/team-agent/src/lifecycle/launch/spec_state.rs +2 -15
- package/crates/team-agent/src/lifecycle/launch/state_projection.rs +3 -7
- package/crates/team-agent/src/lifecycle/launch/worker_env.rs +1 -1
- package/crates/team-agent/src/lifecycle/launch.rs +3 -4
- package/crates/team-agent/src/lifecycle/mod.rs +0 -8
- package/crates/team-agent/src/lifecycle/restart/agent.rs +62 -8
- package/crates/team-agent/src/lifecycle/restart/common.rs +0 -32
- package/crates/team-agent/src/lifecycle/restart/rebuild.rs +6 -15
- package/crates/team-agent/src/lifecycle/tests/b0_reader_hideone_audit_contract.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +1 -1
- package/crates/team-agent/src/lifecycle/tests/clone_agent_preserves_source_tools.rs +1 -2
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +0 -1
- package/crates/team-agent/src/lifecycle/tests/core.rs +0 -213
- package/crates/team-agent/src/lifecycle/tests/issue238_codex_effort_contract.rs +96 -0
- package/crates/team-agent/src/lifecycle/tests/lane_ops.rs +1 -0
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +31 -77
- package/crates/team-agent/src/lifecycle/tests/main_preserved.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests/phase_b_contracts.rs +4 -8
- package/crates/team-agent/src/lifecycle/tests/phase_golden.rs +16 -9
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +1 -1
- package/crates/team-agent/src/lifecycle/tests/realmachine_clusters_1_6_red.rs +0 -60
- package/crates/team-agent/src/lifecycle/tests/startup_latency_contract.rs +3 -4
- package/crates/team-agent/src/lifecycle/tests/team_in_team_identity_scope_red.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests.rs +1 -2
- package/crates/team-agent/src/lifecycle/types.rs +3 -133
- package/crates/team-agent/src/messaging/send.rs +2 -2
- package/crates/team-agent/src/model/enums.rs +21 -71
- package/crates/team-agent/src/model/spec.rs +5 -20
- package/crates/team-agent/src/provider/adapters/codex.rs +2 -2
- package/crates/team-agent/src/provider/types.rs +7 -6
- package/crates/team-agent/src/state/repository.rs +0 -5
- package/examples/team.spec.yaml +0 -1
- package/package.json +4 -4
- package/schemas/team.schema.json +2 -2
- package/skills/team-agent/SKILL.md +1 -1
- package/skills/team-agent/references/recovery-runbook.md +2 -2
- package/skills/team-agent/references/team-agent-operator.md +3 -10
- package/skills/team-agent/references/team-in-team.md +0 -6
- package/crates/team-agent/src/lifecycle/display.rs +0 -550
- package/crates/team-agent/src/lifecycle/tests/core_034_real_red.rs +0 -884
- package/crates/team-agent/src/lifecycle/tests/display_adaptive_red.rs +0 -481
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
//! cli · emit — `emit`(--json vs 人读 dict 逐键)+ 顶层 `run` 调度(parser.py `main`)+
|
|
3
3
|
//! 人读标量/集合渲染(`human_value` / `json_dumps_like`)。
|
|
4
4
|
|
|
5
|
-
use super::spec::{command_spec, CommandKind, CommandTier, ALL_DISPATCH_KINDS, COMMAND_SPECS};
|
|
6
5
|
use super::models::cmd_models;
|
|
6
|
+
use super::spec::{command_spec, CommandKind, COMMAND_SPECS};
|
|
7
|
+
#[cfg(test)]
|
|
8
|
+
use super::spec::{CommandTier, ALL_DISPATCH_KINDS};
|
|
7
9
|
use super::*;
|
|
8
10
|
use std::io::{ErrorKind, Write as _};
|
|
9
11
|
|
|
@@ -158,21 +160,24 @@ pub(crate) fn __test_dispatch(
|
|
|
158
160
|
}
|
|
159
161
|
|
|
160
162
|
fn dispatch(command: &str, args: &[String], cwd: &Path) -> Result<ExitCode, CliError> {
|
|
163
|
+
// Keep the removed flag harmless for older scripts and persisted command
|
|
164
|
+
// lines; the default tmux backend is already the only runtime path.
|
|
165
|
+
let filtered_args: Vec<String> = args
|
|
166
|
+
.iter()
|
|
167
|
+
.filter(|arg| arg.as_str() != "--no-display")
|
|
168
|
+
.cloned()
|
|
169
|
+
.collect();
|
|
170
|
+
let args = filtered_args.as_slice();
|
|
161
171
|
let Some(spec) = command_spec(command) else {
|
|
162
172
|
return Ok(emit_unknown_subcommand_usage(command));
|
|
163
173
|
};
|
|
164
174
|
match spec.kind {
|
|
165
175
|
CommandKind::Dispatch(_) => {}
|
|
166
|
-
CommandKind::SpecOnlyAlias { .. } => {
|
|
167
|
-
eprintln!("{}", command_help(Some(command)));
|
|
168
|
-
return Ok(ExitCode::Usage);
|
|
169
|
-
}
|
|
170
176
|
CommandKind::LeaderPassthrough { .. } => {
|
|
171
177
|
return Ok(emit_unknown_subcommand_usage(command));
|
|
172
178
|
}
|
|
173
179
|
}
|
|
174
180
|
match command {
|
|
175
|
-
"init" => cmd_init(&init_args(args, cwd)).map(emit_result),
|
|
176
181
|
"quick-start" => cmd_quick_start(&quick_start_args(args, cwd)?).map(emit_result),
|
|
177
182
|
"send" => cmd_send(&send_args(args, cwd)?).map(emit_result),
|
|
178
183
|
"allow-peer-talk" => {
|
|
@@ -180,10 +185,8 @@ fn dispatch(command: &str, args: &[String], cwd: &Path) -> Result<ExitCode, CliE
|
|
|
180
185
|
}
|
|
181
186
|
"status" => cmd_status_for_team(&status_args(args, cwd), parse_args(args).team.as_deref())
|
|
182
187
|
.map(emit_result),
|
|
183
|
-
"stop" => cmd_shutdown(&shutdown_args(args, cwd)?).map(emit_result),
|
|
184
188
|
"shutdown" => cmd_shutdown(&shutdown_args(args, cwd)?).map(emit_result),
|
|
185
189
|
"restart" => cmd_restart(&restart_args(args, cwd)?).map(emit_result),
|
|
186
|
-
"restart-agent" => cmd_reset_agent(&reset_agent_args(args, cwd)?).map(emit_result),
|
|
187
190
|
"start-agent" => cmd_start_agent(&start_agent_args(args, cwd)?).map(emit_result),
|
|
188
191
|
"stop-agent" => cmd_stop_agent(&stop_agent_args(args, cwd)?).map(emit_result),
|
|
189
192
|
"reset-agent" => cmd_reset_agent(&reset_agent_args(args, cwd)?).map(emit_result),
|
|
@@ -191,11 +194,6 @@ fn dispatch(command: &str, args: &[String], cwd: &Path) -> Result<ExitCode, CliE
|
|
|
191
194
|
"clone-agent" => cmd_clone_agent(&clone_agent_args(args, cwd)?).map(emit_result),
|
|
192
195
|
"fork-agent" => cmd_fork_agent(&fork_agent_args(args, cwd)?).map(emit_result),
|
|
193
196
|
"remove-agent" => cmd_remove_agent(&remove_agent_args(args, cwd)?).map(emit_result),
|
|
194
|
-
"stuck-list" => cmd_stuck_list(&stuck_list_args(args, cwd)).map(emit_result),
|
|
195
|
-
"stuck-cancel" => cmd_stuck_cancel(&stuck_cancel_args(args, cwd)?).map(emit_result),
|
|
196
|
-
"acknowledge-idle" => {
|
|
197
|
-
cmd_acknowledge_idle(&acknowledge_idle_args(args, cwd)).map(emit_result)
|
|
198
|
-
}
|
|
199
197
|
"takeover" => cmd_takeover(&takeover_args(args, cwd)).map(emit_result),
|
|
200
198
|
"claim-leader" => cmd_claim_leader(&claim_leader_args(args, cwd)).map(emit_result),
|
|
201
199
|
// Real dispatch: `cmd_attach_leader` writes the `leader_receiver` binding.
|
|
@@ -224,8 +222,6 @@ fn dispatch(command: &str, args: &[String], cwd: &Path) -> Result<ExitCode, CliE
|
|
|
224
222
|
"profile" => cmd_profile(&profile_args(args, cwd)?).map(emit_result),
|
|
225
223
|
"results" => cmd_results(&results_args(args, cwd)?).map(emit_result),
|
|
226
224
|
"wait" => cmd_wait(&wait_args(args, cwd)?).map(emit_result),
|
|
227
|
-
// Compatibility spelling: parse and execute the exact doctor contract.
|
|
228
|
-
"diagnose" => cmd_doctor(&doctor_args(args, cwd)).map(emit_result),
|
|
229
225
|
"preflight" => cmd_preflight(&preflight_args(args, cwd)).map(emit_result),
|
|
230
226
|
"wait-ready" => cmd_wait_ready(&wait_ready_args(args, cwd)).map(emit_result),
|
|
231
227
|
"e2e" => cmd_e2e(&e2e_args(args, cwd)).map(emit_result),
|
|
@@ -235,58 +231,6 @@ fn dispatch(command: &str, args: &[String], cwd: &Path) -> Result<ExitCode, CliE
|
|
|
235
231
|
}
|
|
236
232
|
}
|
|
237
233
|
|
|
238
|
-
const DISPATCH_COMMANDS: &[&str] = &[
|
|
239
|
-
"init",
|
|
240
|
-
"quick-start",
|
|
241
|
-
"send",
|
|
242
|
-
"allow-peer-talk",
|
|
243
|
-
"status",
|
|
244
|
-
"stop",
|
|
245
|
-
"shutdown",
|
|
246
|
-
"restart",
|
|
247
|
-
"restart-agent",
|
|
248
|
-
"start-agent",
|
|
249
|
-
"stop-agent",
|
|
250
|
-
"reset-agent",
|
|
251
|
-
"add-agent",
|
|
252
|
-
"fork-agent",
|
|
253
|
-
"remove-agent",
|
|
254
|
-
"stuck-list",
|
|
255
|
-
"stuck-cancel",
|
|
256
|
-
"acknowledge-idle",
|
|
257
|
-
"takeover",
|
|
258
|
-
"claim-leader",
|
|
259
|
-
"attach-leader",
|
|
260
|
-
"attach-app-server-leader",
|
|
261
|
-
"identity",
|
|
262
|
-
"approvals",
|
|
263
|
-
"inbox",
|
|
264
|
-
"doctor",
|
|
265
|
-
"watch",
|
|
266
|
-
"sessions",
|
|
267
|
-
// 0.5.9 E7: host leader discovery command surface.
|
|
268
|
-
"leaders",
|
|
269
|
-
"models",
|
|
270
|
-
"validate",
|
|
271
|
-
"install-skill",
|
|
272
|
-
"profile",
|
|
273
|
-
"results",
|
|
274
|
-
"wait",
|
|
275
|
-
"diagnose",
|
|
276
|
-
"preflight",
|
|
277
|
-
"wait-ready",
|
|
278
|
-
"e2e",
|
|
279
|
-
"peek",
|
|
280
|
-
"coordinator",
|
|
281
|
-
];
|
|
282
|
-
|
|
283
|
-
// 0.5.26 (`.team/artifacts/stale-team-saveconflict-locate.md` §7.6):
|
|
284
|
-
// `purge-agent` was previously listed in help but had no dispatch arm,
|
|
285
|
-
// so it read as a supported recovery command while actually failing with
|
|
286
|
-
// "invalid choice". The dispatch registration remains out of scope for
|
|
287
|
-
// 0.5.26 (destructive semantics deserve their own CR); keep the help
|
|
288
|
-
// consistent with the dispatch table so it is no longer advertised.
|
|
289
|
-
const SPEC_ONLY_HELP_COMMANDS: &[&str] = &["start"];
|
|
290
234
|
// Command grammar, not provider identity parsing: these are top-level CLI
|
|
291
235
|
// passthrough verbs for starting a leader under a provider executable.
|
|
292
236
|
const LEADER_PASSTHROUGH_COMMANDS: &[&str] =
|
|
@@ -362,18 +306,6 @@ fn append_help_section(out: &mut String, title: &str, names: &[&str]) {
|
|
|
362
306
|
}
|
|
363
307
|
}
|
|
364
308
|
|
|
365
|
-
fn compat_hidden_help(command: &str, usage: &str) -> String {
|
|
366
|
-
let Some(spec) = command_spec(command) else {
|
|
367
|
-
return usage.to_string();
|
|
368
|
-
};
|
|
369
|
-
if spec.tier != CommandTier::CompatHidden {
|
|
370
|
-
return usage.to_string();
|
|
371
|
-
}
|
|
372
|
-
let sunset = spec.sunset.unwrap_or("C2");
|
|
373
|
-
let action = spec.action.unwrap_or("use a supported command");
|
|
374
|
-
format!("{usage}\n\nstatus: hidden compatibility command\nsunset: {sunset}\naction: {action}")
|
|
375
|
-
}
|
|
376
|
-
|
|
377
309
|
///
|
|
378
310
|
/// Test-only public accessor for `command_help` — allows integration
|
|
379
311
|
/// tests to grep the help copy without depending on internal parser
|
|
@@ -396,9 +328,7 @@ pub fn __test_quick_start_args(
|
|
|
396
328
|
fn command_help(command: Option<&str>) -> String {
|
|
397
329
|
match command {
|
|
398
330
|
None => default_help(),
|
|
399
|
-
Some("
|
|
400
|
-
Some("quick-start") => "usage: team-agent quick-start [TEAMDIR] [--workspace WORKSPACE] [--name NAME] [--team-id TEAM|--team TEAM] [--yes] [--no-display] [--backend tmux|conpty] [--json] [--detail]\n\ndefaults: display_backend=adaptive; set display_backend: none in TEAM.md or pass --no-display to use one worker window per agent.\n\n--backend selects the worker transport (Phase 1d Batch 2): tmux (default on POSIX; unchanged behavior), conpty (Windows-native ConPTY worker transport; requires the shim binary and Windows host).\n\n--detail includes internal receiver/topology diagnostics in JSON output.\n\nAfter a successful start, use the returned `send_commands` (or choose an agent explicitly) with `team-agent send AGENT MESSAGE`.".to_string(),
|
|
401
|
-
Some("start") => compat_hidden_help("start", "usage: team-agent start [TEAMDIR] [--yes] [--fresh] [--json]"),
|
|
331
|
+
Some("quick-start") => "usage: team-agent quick-start [TEAMDIR] [--workspace WORKSPACE] [--name NAME] [--team-id TEAM|--team TEAM] [--yes] [--backend tmux|conpty] [--json] [--detail]\n\n--backend selects the worker transport: tmux (default on POSIX) or conpty (Windows-native ConPTY worker transport; requires the shim binary and Windows host).\n\n--detail includes internal receiver/topology diagnostics in JSON output.\n\nAfter a successful start, use the returned `send_commands` (or choose an agent explicitly) with `team-agent send AGENT MESSAGE`.".to_string(),
|
|
402
332
|
Some("send") => concat!(
|
|
403
333
|
"usage: team-agent send TO MESSAGE... ",
|
|
404
334
|
"[--workspace WORKSPACE] [--team TEAM] ",
|
|
@@ -412,21 +342,16 @@ fn command_help(command: Option<&str>) -> String {
|
|
|
412
342
|
Some("status") => "usage: team-agent status [AGENT] [--workspace WORKSPACE] [--team TEAM] [--summary|--json] [--detail]\n\n输出七字段:name/provider/runtime_status/activity/health/session_name/tmux_command;人读与 --json 使用同一投影。缺少可靠定位或原生 tmux/process 采样时显示 unknown;tmux_command 可复制到对应目标。--summary/--detail 仅保留兼容性,不增加诊断字段。".to_string(),
|
|
413
343
|
Some("models") => "usage: team-agent models [--provider pi|cursor_agent] [QUERY|--search TEXT] [--json]\n\nLists exact provider model ids with case-insensitive multi-word search across provider, vendor, id, and display name. Cursor uses the local `agent --list-models` catalog.".to_string(),
|
|
414
344
|
Some("leaders") => "usage: team-agent leaders [QUERY|--search TEXT] [--all|--stale] [--json] | --prune [--dry-run] [--json]\n\nLists LIVE leaders by default. Use --all to include retained STALE entries, --stale to inspect only STALE entries, QUERY or --search TEXT to match workspace/team/name fields, and --prune to remove only entries proven terminal by canonical state. --dry-run is valid only with --prune.".to_string(),
|
|
415
|
-
Some("stop") => compat_hidden_help("stop", "usage: team-agent stop [--workspace WORKSPACE] [--team TEAM] [--keep-logs] [--json]"),
|
|
416
345
|
Some("shutdown") => "usage: team-agent shutdown [--workspace WORKSPACE] [--team TEAM] [--keep-logs] [--json]".to_string(),
|
|
417
346
|
Some("restart") => "usage: team-agent restart [WORKSPACE] [--team TEAM] [--allow-fresh] [--session-converge-deadline SECONDS] [--json] [--detail]".to_string(),
|
|
418
|
-
Some("
|
|
419
|
-
Some("
|
|
420
|
-
Some("start-agent") => "usage: team-agent start-agent AGENT [--workspace WORKSPACE] [--team TEAM] [--force] [--allow-fresh] [--no-display] [--json]\n\nAfter a successful start, use the returned `send_commands` with `team-agent send AGENT MESSAGE`.".to_string(),
|
|
347
|
+
Some("reset-agent") => "usage: team-agent reset-agent AGENT [--workspace WORKSPACE] [--team TEAM] [--discard-session] [--json]".to_string(),
|
|
348
|
+
Some("start-agent") => "usage: team-agent start-agent AGENT [--workspace WORKSPACE] [--team TEAM] [--force] [--allow-fresh] [--json]\n\nAfter a successful start, use the returned `send_commands` with `team-agent send AGENT MESSAGE`.".to_string(),
|
|
421
349
|
Some("stop-agent") => "usage: team-agent stop-agent AGENT [--workspace WORKSPACE] [--team TEAM] [--json]".to_string(),
|
|
422
|
-
Some("add-agent") => "usage: team-agent add-agent AGENT --role-file FILE [--force] [--workspace WORKSPACE] [--team TEAM] [--
|
|
423
|
-
Some("clone-agent") => "usage: team-agent clone-agent SOURCE_AGENT --as AGENT [--label LABEL] [--workspace WORKSPACE] [--team TEAM] [--
|
|
424
|
-
Some("fork-agent") => "usage: team-agent fork-agent SOURCE_AGENT --as AGENT [--label LABEL] [--workspace WORKSPACE] [--team TEAM] [--
|
|
350
|
+
Some("add-agent") => "usage: team-agent add-agent AGENT --role-file FILE [--force] [--workspace WORKSPACE] [--team TEAM] [--json]\n\nAfter a successful add, use the returned `send_commands` with `team-agent send AGENT MESSAGE`.".to_string(),
|
|
351
|
+
Some("clone-agent") => "usage: team-agent clone-agent SOURCE_AGENT --as AGENT [--label LABEL] [--workspace WORKSPACE] [--team TEAM] [--json]".to_string(),
|
|
352
|
+
Some("fork-agent") => "usage: team-agent fork-agent SOURCE_AGENT --as AGENT [--label LABEL] [--workspace WORKSPACE] [--team TEAM] [--json]".to_string(),
|
|
425
353
|
Some("remove-agent") => "usage: team-agent remove-agent AGENT [--workspace WORKSPACE] [--team TEAM] [--from-spec] [--confirm] [--force] [--json]".to_string(),
|
|
426
354
|
// 0.5.26 (§7.6): removed from help; dispatch was never wired.
|
|
427
|
-
Some("stuck-list") => "usage: team-agent stuck-list [--workspace WORKSPACE] [--team TEAM] [--json]".to_string(),
|
|
428
|
-
Some("stuck-cancel") => "usage: team-agent stuck-cancel AGENT [--workspace WORKSPACE] [--alert-type stuck|idle_fallback|cross_worker_deadlock|all] [--json]".to_string(),
|
|
429
|
-
Some("acknowledge-idle") => "usage: team-agent acknowledge-idle [--workspace WORKSPACE] [--team TEAM] [--json]".to_string(),
|
|
430
355
|
Some("takeover") => "usage: team-agent takeover [--workspace WORKSPACE] [--team TEAM] [--confirm] [--json]".to_string(),
|
|
431
356
|
Some("claim-leader") => "usage: team-agent claim-leader [--workspace WORKSPACE] [--team TEAM] [--confirm] [--json] [--detail]".to_string(),
|
|
432
357
|
Some("attach-leader") => "usage: team-agent attach-leader [--workspace WORKSPACE] [--team TEAM] [--pane PANE] [--provider PROVIDER] [--confirm] [--json]".to_string(),
|
|
@@ -442,7 +367,6 @@ fn command_help(command: Option<&str>) -> String {
|
|
|
442
367
|
Some("profile") => "usage: team-agent profile COMMAND NAME [--workspace WORKSPACE] [--team TEAM] [--auth-mode MODE] [--proxy-mode direct|inherit] [--json]".to_string(),
|
|
443
368
|
Some("results") => "usage: team-agent results --case CASE_ID [--workspace WORKSPACE] [--team TEAM] [--json]".to_string(),
|
|
444
369
|
Some("wait") => "usage: team-agent wait --task TASK [--workspace WORKSPACE] [--json]".to_string(),
|
|
445
|
-
Some("diagnose") => "usage: team-agent doctor [SPEC] [--workspace WORKSPACE] [--team TEAM] [--gate orphans|comms] [--comms] [--fix] [--fix-schema] [--cleanup-orphans] [--confirm] [--json]".to_string(),
|
|
446
370
|
Some("preflight") => "usage: team-agent preflight [TEAMDIR] [--json]".to_string(),
|
|
447
371
|
Some("wait-ready") => "usage: team-agent wait-ready [--workspace WORKSPACE] [--team TEAM] [--timeout SECONDS] [--json]".to_string(),
|
|
448
372
|
Some("e2e") => "usage: team-agent e2e [--workspace WORKSPACE] [--providers LIST] [--real] [--json]".to_string(),
|
|
@@ -824,14 +748,12 @@ struct ParsedArgs {
|
|
|
824
748
|
allow_fresh: bool,
|
|
825
749
|
session_converge_deadline_ms: Option<u64>,
|
|
826
750
|
force: bool,
|
|
827
|
-
no_display: bool,
|
|
828
751
|
discard_session: bool,
|
|
829
752
|
role_file: Option<String>,
|
|
830
753
|
as_agent: Option<String>,
|
|
831
754
|
label: Option<String>,
|
|
832
755
|
from_spec: bool,
|
|
833
756
|
confirm: bool,
|
|
834
|
-
alert_type: Option<String>,
|
|
835
757
|
limit: Option<usize>,
|
|
836
758
|
gate: Option<String>,
|
|
837
759
|
comms: bool,
|
|
@@ -915,7 +837,6 @@ fn parse_args(args: &[String]) -> ParsedArgs {
|
|
|
915
837
|
next_arg(args, &mut i).and_then(|v| parse_seconds_ms(&v));
|
|
916
838
|
}
|
|
917
839
|
"--force" => parsed.force = true,
|
|
918
|
-
"--no-display" => parsed.no_display = true,
|
|
919
840
|
"--backend" => parsed.backend = next_arg(args, &mut i),
|
|
920
841
|
"--discard-session" => parsed.discard_session = true,
|
|
921
842
|
"--role-file" => parsed.role_file = next_arg(args, &mut i),
|
|
@@ -923,7 +844,6 @@ fn parse_args(args: &[String]) -> ParsedArgs {
|
|
|
923
844
|
"--label" => parsed.label = next_arg(args, &mut i),
|
|
924
845
|
"--from-spec" => parsed.from_spec = true,
|
|
925
846
|
"--confirm" => parsed.confirm = true,
|
|
926
|
-
"--alert-type" => parsed.alert_type = next_arg(args, &mut i),
|
|
927
847
|
"-n" | "--limit" => {
|
|
928
848
|
parsed.limit = next_arg(args, &mut i).and_then(|v| v.parse::<usize>().ok())
|
|
929
849
|
}
|
|
@@ -1105,7 +1025,6 @@ fn quick_start_args(args: &[String], cwd: &Path) -> Result<QuickStartArgs, CliEr
|
|
|
1105
1025
|
name: parsed.name,
|
|
1106
1026
|
team_id: parsed.team_id.or(parsed.team),
|
|
1107
1027
|
yes: parsed.yes,
|
|
1108
|
-
no_display: parsed.no_display,
|
|
1109
1028
|
json: parsed.json,
|
|
1110
1029
|
detail: parsed.detail,
|
|
1111
1030
|
backend: parsed.backend,
|
|
@@ -1131,15 +1050,6 @@ fn models_args(args: &[String]) -> Result<ModelsArgs, CliError> {
|
|
|
1131
1050
|
})
|
|
1132
1051
|
}
|
|
1133
1052
|
|
|
1134
|
-
fn init_args(args: &[String], cwd: &Path) -> InitArgs {
|
|
1135
|
-
let parsed = parse_args(args);
|
|
1136
|
-
InitArgs {
|
|
1137
|
-
workspace: workspace(&parsed, cwd),
|
|
1138
|
-
force: parsed.force,
|
|
1139
|
-
json: parsed.json,
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
1053
|
fn resolve_cli_path(cwd: &Path, path: &Path) -> PathBuf {
|
|
1144
1054
|
if path.is_absolute() {
|
|
1145
1055
|
path.to_path_buf()
|
|
@@ -1527,7 +1437,6 @@ fn start_agent_args(args: &[String], cwd: &Path) -> Result<StartAgentArgs, CliEr
|
|
|
1527
1437
|
team: parsed.team,
|
|
1528
1438
|
force: parsed.force,
|
|
1529
1439
|
allow_fresh: parsed.allow_fresh,
|
|
1530
|
-
no_display: parsed.no_display,
|
|
1531
1440
|
json: parsed.json,
|
|
1532
1441
|
})
|
|
1533
1442
|
}
|
|
@@ -1551,7 +1460,6 @@ fn reset_agent_args(args: &[String], cwd: &Path) -> Result<ResetAgentArgs, CliEr
|
|
|
1551
1460
|
workspace,
|
|
1552
1461
|
team: parsed.team,
|
|
1553
1462
|
discard_session: parsed.discard_session,
|
|
1554
|
-
no_display: parsed.no_display,
|
|
1555
1463
|
json: parsed.json,
|
|
1556
1464
|
})
|
|
1557
1465
|
}
|
|
@@ -1566,7 +1474,6 @@ fn add_agent_args(args: &[String], cwd: &Path) -> Result<AddAgentArgs, CliError>
|
|
|
1566
1474
|
.role_file
|
|
1567
1475
|
.ok_or_else(|| CliError::Usage("missing --role-file".to_string()))?,
|
|
1568
1476
|
force: parsed.force,
|
|
1569
|
-
no_display: parsed.no_display,
|
|
1570
1477
|
json: parsed.json,
|
|
1571
1478
|
})
|
|
1572
1479
|
}
|
|
@@ -1581,7 +1488,6 @@ fn fork_agent_args(args: &[String], cwd: &Path) -> Result<ForkAgentArgs, CliErro
|
|
|
1581
1488
|
.as_agent
|
|
1582
1489
|
.ok_or_else(|| CliError::Usage("missing --as".to_string()))?,
|
|
1583
1490
|
label: parsed.label,
|
|
1584
|
-
no_display: parsed.no_display,
|
|
1585
1491
|
json: parsed.json,
|
|
1586
1492
|
})
|
|
1587
1493
|
}
|
|
@@ -1596,7 +1502,6 @@ fn clone_agent_args(args: &[String], cwd: &Path) -> Result<CloneAgentArgs, CliEr
|
|
|
1596
1502
|
.as_agent
|
|
1597
1503
|
.ok_or_else(|| CliError::Usage("missing --as".to_string()))?,
|
|
1598
1504
|
label: parsed.label,
|
|
1599
|
-
no_display: parsed.no_display,
|
|
1600
1505
|
json: parsed.json,
|
|
1601
1506
|
})
|
|
1602
1507
|
}
|
|
@@ -1616,48 +1521,6 @@ fn remove_agent_args(args: &[String], cwd: &Path) -> Result<RemoveAgentArgs, Cli
|
|
|
1616
1521
|
})
|
|
1617
1522
|
}
|
|
1618
1523
|
|
|
1619
|
-
fn stuck_list_args(args: &[String], cwd: &Path) -> StuckListArgs {
|
|
1620
|
-
let parsed = parse_args(args);
|
|
1621
|
-
StuckListArgs {
|
|
1622
|
-
workspace: workspace(&parsed, cwd),
|
|
1623
|
-
json: parsed.json,
|
|
1624
|
-
team: parsed.team,
|
|
1625
|
-
}
|
|
1626
|
-
}
|
|
1627
|
-
|
|
1628
|
-
fn stuck_cancel_args(args: &[String], cwd: &Path) -> Result<StuckCancelArgs, CliError> {
|
|
1629
|
-
let parsed = parse_args(args);
|
|
1630
|
-
let workspace = workspace(&parsed, cwd);
|
|
1631
|
-
refuse_if_multi_alive_team_missing_scope("stuck-cancel", &workspace, parsed.team.as_deref())?;
|
|
1632
|
-
Ok(StuckCancelArgs {
|
|
1633
|
-
agent: required_pos(&parsed, 0, "agent")?,
|
|
1634
|
-
workspace,
|
|
1635
|
-
alert_type: alert_type(parsed.alert_type.as_deref())?,
|
|
1636
|
-
json: parsed.json,
|
|
1637
|
-
team: parsed.team,
|
|
1638
|
-
})
|
|
1639
|
-
}
|
|
1640
|
-
|
|
1641
|
-
fn alert_type(raw: Option<&str>) -> Result<Option<AlertType>, CliError> {
|
|
1642
|
-
match raw {
|
|
1643
|
-
Some("stuck") => Ok(Some(AlertType::Stuck)),
|
|
1644
|
-
Some("idle_fallback") => Ok(Some(AlertType::IdleFallback)),
|
|
1645
|
-
Some("cross_worker_deadlock") => Ok(Some(AlertType::CrossWorkerDeadlock)),
|
|
1646
|
-
Some("all") | None => Ok(None),
|
|
1647
|
-
Some(other) => Err(CliError::Usage(format!("invalid --alert-type: {other}"))),
|
|
1648
|
-
}
|
|
1649
|
-
}
|
|
1650
|
-
|
|
1651
|
-
fn acknowledge_idle_args(args: &[String], cwd: &Path) -> AcknowledgeIdleArgs {
|
|
1652
|
-
let parsed = parse_args(args);
|
|
1653
|
-
let workspace = workspace(&parsed, cwd);
|
|
1654
|
-
AcknowledgeIdleArgs {
|
|
1655
|
-
team: parsed.team,
|
|
1656
|
-
workspace,
|
|
1657
|
-
json: parsed.json,
|
|
1658
|
-
}
|
|
1659
|
-
}
|
|
1660
|
-
|
|
1661
1524
|
fn doctor_args(args: &[String], cwd: &Path) -> DoctorArgs {
|
|
1662
1525
|
let parsed = parse_args(args);
|
|
1663
1526
|
DoctorArgs {
|
|
@@ -1863,15 +1726,6 @@ fn option_value(args: &[String], flag: &str) -> Option<String> {
|
|
|
1863
1726
|
None
|
|
1864
1727
|
}
|
|
1865
1728
|
|
|
1866
|
-
fn diagnose_args(args: &[String], cwd: &Path) -> DiagnoseArgs {
|
|
1867
|
-
let parsed = parse_args(args);
|
|
1868
|
-
DiagnoseArgs {
|
|
1869
|
-
workspace: workspace(&parsed, cwd),
|
|
1870
|
-
json: parsed.json,
|
|
1871
|
-
team: parsed.team,
|
|
1872
|
-
}
|
|
1873
|
-
}
|
|
1874
|
-
|
|
1875
1729
|
fn preflight_args(args: &[String], cwd: &Path) -> PreflightArgs {
|
|
1876
1730
|
let parsed = parse_args(args);
|
|
1877
1731
|
let team = parsed
|
|
@@ -2064,7 +1918,7 @@ mod tests {
|
|
|
2064
1918
|
}
|
|
2065
1919
|
|
|
2066
1920
|
#[test]
|
|
2067
|
-
fn
|
|
1921
|
+
fn command_specs_have_unique_names() {
|
|
2068
1922
|
let mut names = std::collections::BTreeSet::new();
|
|
2069
1923
|
for spec in COMMAND_SPECS {
|
|
2070
1924
|
assert!(
|
|
@@ -2073,15 +1927,6 @@ mod tests {
|
|
|
2073
1927
|
spec.name
|
|
2074
1928
|
);
|
|
2075
1929
|
}
|
|
2076
|
-
for spec in COMMAND_SPECS {
|
|
2077
|
-
if let Some(alias_of) = spec.alias_of {
|
|
2078
|
-
assert!(
|
|
2079
|
-
names.contains(alias_of),
|
|
2080
|
-
"`{}` aliases missing command `{alias_of}`",
|
|
2081
|
-
spec.name
|
|
2082
|
-
);
|
|
2083
|
-
}
|
|
2084
|
-
}
|
|
2085
1930
|
}
|
|
2086
1931
|
|
|
2087
1932
|
#[test]
|
|
@@ -2152,7 +1997,7 @@ mod tests {
|
|
|
2152
1997
|
let top_help = command_help(None);
|
|
2153
1998
|
let visible = visible_help_commands(&top_help);
|
|
2154
1999
|
assert!(visible.iter().any(|command| command == "doctor"));
|
|
2155
|
-
for command in ["leaders", "
|
|
2000
|
+
for command in ["leaders", "e2e", "peek", "coordinator"] {
|
|
2156
2001
|
assert!(
|
|
2157
2002
|
!visible.iter().any(|visible| visible == command),
|
|
2158
2003
|
"`{command}` must stay hidden from default help"
|
|
@@ -2170,16 +2015,6 @@ mod tests {
|
|
|
2170
2015
|
assert!(help.contains("--dry-run"));
|
|
2171
2016
|
}
|
|
2172
2017
|
|
|
2173
|
-
#[test]
|
|
2174
|
-
fn compat_hidden_help_has_sunset_action() {
|
|
2175
|
-
for command in ["stop", "restart-agent", "start", "init"] {
|
|
2176
|
-
let help = command_help(Some(command)).to_lowercase();
|
|
2177
|
-
assert!(help.contains("status: hidden compatibility command"));
|
|
2178
|
-
assert!(help.contains("sunset: c2"));
|
|
2179
|
-
assert!(help.contains("action:"));
|
|
2180
|
-
}
|
|
2181
|
-
}
|
|
2182
|
-
|
|
2183
2018
|
#[test]
|
|
2184
2019
|
fn observation_a_commands_have_terminal_tiers() {
|
|
2185
2020
|
for (command, tier) in [
|
|
@@ -2187,7 +2022,6 @@ mod tests {
|
|
|
2187
2022
|
("approvals", CommandTier::Secondary),
|
|
2188
2023
|
("profile", CommandTier::Secondary),
|
|
2189
2024
|
("install-skill", CommandTier::Secondary),
|
|
2190
|
-
("init", CommandTier::CompatHidden),
|
|
2191
2025
|
] {
|
|
2192
2026
|
assert_eq!(command_spec(command).map(|spec| spec.tier), Some(tier));
|
|
2193
2027
|
}
|
|
@@ -2245,7 +2079,6 @@ mod tests {
|
|
|
2245
2079
|
"--team",
|
|
2246
2080
|
"--force",
|
|
2247
2081
|
"--allow-fresh",
|
|
2248
|
-
"--no-display",
|
|
2249
2082
|
"--json",
|
|
2250
2083
|
][..],
|
|
2251
2084
|
),
|
|
@@ -2255,7 +2088,6 @@ mod tests {
|
|
|
2255
2088
|
"--workspace",
|
|
2256
2089
|
"--team",
|
|
2257
2090
|
"--discard-session",
|
|
2258
|
-
"--no-display",
|
|
2259
2091
|
"--json",
|
|
2260
2092
|
][..],
|
|
2261
2093
|
),
|
|
@@ -2265,7 +2097,6 @@ mod tests {
|
|
|
2265
2097
|
"--role-file",
|
|
2266
2098
|
"--workspace",
|
|
2267
2099
|
"--team",
|
|
2268
|
-
"--no-display",
|
|
2269
2100
|
"--json",
|
|
2270
2101
|
][..],
|
|
2271
2102
|
),
|
|
@@ -2276,7 +2107,6 @@ mod tests {
|
|
|
2276
2107
|
"--label",
|
|
2277
2108
|
"--workspace",
|
|
2278
2109
|
"--team",
|
|
2279
|
-
"--no-display",
|
|
2280
2110
|
"--json",
|
|
2281
2111
|
][..],
|
|
2282
2112
|
),
|
|
@@ -2313,14 +2143,13 @@ mod tests {
|
|
|
2313
2143
|
"--json",
|
|
2314
2144
|
][..],
|
|
2315
2145
|
),
|
|
2316
|
-
("
|
|
2146
|
+
("stop-agent", &["--workspace", "--team", "--json"][..]),
|
|
2317
2147
|
("approvals", &["--workspace", "--team", "--json"][..]),
|
|
2318
2148
|
(
|
|
2319
2149
|
"inbox",
|
|
2320
2150
|
&["--workspace", "--team", "-n", "--limit", "--json"][..],
|
|
2321
2151
|
),
|
|
2322
2152
|
("sessions", &["--workspace", "--team", "--json"][..]),
|
|
2323
|
-
("diagnose", &["--workspace", "--team", "--json"][..]),
|
|
2324
2153
|
(
|
|
2325
2154
|
"wait-ready",
|
|
2326
2155
|
&["--workspace", "--team", "--timeout", "--json"][..],
|
|
@@ -2625,18 +2454,6 @@ mod tests {
|
|
|
2625
2454
|
);
|
|
2626
2455
|
}
|
|
2627
2456
|
|
|
2628
|
-
#[test]
|
|
2629
|
-
fn stuck_cancel_args_builder_refuses_on_multi_alive_team() {
|
|
2630
|
-
let ws = tmp_workspace();
|
|
2631
|
-
seed_two_alive_teams_in(&ws);
|
|
2632
|
-
let argv = cli_argv(&["worker_a", "--workspace", &ws.to_string_lossy()]);
|
|
2633
|
-
let err = stuck_cancel_args(&argv, &ws).expect_err("must refuse");
|
|
2634
|
-
assert!(
|
|
2635
|
-
err.to_string().contains("multiple alive teams"),
|
|
2636
|
-
"stuck-cancel args builder must surface the refusal; got: {err}"
|
|
2637
|
-
);
|
|
2638
|
-
}
|
|
2639
|
-
|
|
2640
2457
|
#[test]
|
|
2641
2458
|
fn shutdown_args_builder_refuses_on_multi_alive_team() {
|
|
2642
2459
|
let ws = tmp_workspace();
|
|
@@ -2716,6 +2533,5 @@ mod tests {
|
|
|
2716
2533
|
assert_eq!(args.workspace, ws);
|
|
2717
2534
|
// No `fresh` field anymore — the struct must compile and round-trip
|
|
2718
2535
|
// without it.
|
|
2719
|
-
let _ = args.no_display;
|
|
2720
2536
|
}
|
|
2721
2537
|
}
|