@team-agent/installer 0.5.112 → 0.5.113
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 +100 -44
- package/crates/team-agent/src/cli/emit.rs +127 -98
- package/crates/team-agent/src/cli/leaders.rs +32 -32
- package/crates/team-agent/src/cli/mod.rs +6 -6
- package/crates/team-agent/src/cli/named_address.rs +17 -16
- package/crates/team-agent/src/cli/route.rs +4 -4
- package/crates/team-agent/src/cli/send/presentation.rs +19 -18
- package/crates/team-agent/src/cli/send/resolve.rs +11 -11
- package/crates/team-agent/src/cli/send.rs +4 -4
- package/crates/team-agent/src/cli/spec.rs +29 -29
- package/crates/team-agent/src/cli/status.rs +7 -7
- package/crates/team-agent/src/cli/tests/base.rs +6 -6
- package/crates/team-agent/src/cli/tests/divergence.rs +3 -2
- package/crates/team-agent/src/cli/tests/lane_c.rs +1 -1
- package/crates/team-agent/src/cli/tests/named_address.rs +3 -3
- package/crates/team-agent/src/cli/tests/status_send.rs +7 -7
- package/crates/team-agent/src/cli/triage.rs +53 -2
- package/crates/team-agent/src/cli/types.rs +8 -8
- package/crates/team-agent/src/compiler/tests.rs +12 -0
- package/crates/team-agent/src/compiler.rs +0 -9
- package/crates/team-agent/src/leader/start.rs +5 -0
- package/crates/team-agent/src/leader/tests/identity.rs +21 -0
- package/crates/team-agent/src/lifecycle/launch/identity.rs +172 -13
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +325 -14
- package/crates/team-agent/src/lifecycle/launch.rs +2 -2
- package/crates/team-agent/src/lifecycle/profile_launch.rs +58 -46
- package/crates/team-agent/src/lifecycle/restart/rebuild.rs +97 -52
- package/crates/team-agent/src/lifecycle/restart.rs +1 -1
- package/crates/team-agent/src/lifecycle/tests/stale_team_saveconflict_contract.rs +3 -2
- package/crates/team-agent/src/provider/adapter.rs +8 -59
- package/crates/team-agent/src/provider/adapters/claude.rs +6 -14
- package/crates/team-agent/src/provider/adapters/codex.rs +8 -18
- package/crates/team-agent/src/provider/adapters/copilot.rs +5 -22
- package/crates/team-agent/src/provider/adapters/cursor_agent.rs +8 -45
- package/crates/team-agent/src/provider/adapters/grok.rs +7 -31
- package/crates/team-agent/src/provider/adapters/pi.rs +7 -18
- package/crates/team-agent/src/provider/command_helpers.rs +45 -0
- package/crates/team-agent/src/provider/mod.rs +1 -0
- package/crates/team-agent/src/provider/model_catalog.rs +21 -28
- package/crates/team-agent/src/provider/tests/adapter.rs +70 -0
- package/crates/team-agent/src/provider/tests/command_helpers.rs +55 -0
- package/package.json +4 -4
|
@@ -110,25 +110,25 @@ fn emit_cli_error_for_command(
|
|
|
110
110
|
cwd: &Path,
|
|
111
111
|
error: &CliError,
|
|
112
112
|
) -> ExitCode {
|
|
113
|
-
let missing_input = matches!(error, CliError::Usage(message) if message.starts_with("missing ") || message.starts_with("
|
|
113
|
+
let missing_input = matches!(error, CliError::Usage(message) if message.starts_with("missing ") || message.starts_with("Provide ") || matches!(message.as_str(), "add-agent requires --provider <name>" | "add-agent requires --bypass <true|false>" | "--source is required unless --uninstall"));
|
|
114
114
|
if command_spec(command).is_some() && missing_input {
|
|
115
115
|
let help = command_help(Some(command));
|
|
116
116
|
let explanation = match error {
|
|
117
117
|
CliError::Usage(message) => match message.as_str() {
|
|
118
|
-
"missing agent" | "missing source_agent" => "
|
|
118
|
+
"missing agent" | "missing source_agent" => "Provide an agent name.".to_string(),
|
|
119
119
|
"missing profile command" => {
|
|
120
|
-
"
|
|
120
|
+
"Provide a profile operation: init, doctor or show.".to_string()
|
|
121
121
|
}
|
|
122
|
-
"missing profile name" => "
|
|
122
|
+
"missing profile name" => "Provide an authentication/proxy profile name.".to_string(),
|
|
123
123
|
"add-agent requires --provider <name>" => {
|
|
124
|
-
"
|
|
124
|
+
"Select a provider with --provider, or supply a role file with --role-file.".to_string()
|
|
125
125
|
}
|
|
126
126
|
"add-agent requires --bypass <true|false>" => {
|
|
127
|
-
"
|
|
127
|
+
"Explicitly retain permission prompts with --bypass false, or declare bypass in the role file.".to_string()
|
|
128
128
|
}
|
|
129
129
|
other => other
|
|
130
130
|
.strip_prefix("missing ")
|
|
131
|
-
.map(|field| format!("
|
|
131
|
+
.map(|field| format!("Provide the required argument: {field}."))
|
|
132
132
|
.unwrap_or_else(|| other.to_string()),
|
|
133
133
|
},
|
|
134
134
|
_ => error.to_string(),
|
|
@@ -140,7 +140,7 @@ fn emit_cli_error_for_command(
|
|
|
140
140
|
value["error"] = serde_json::json!(explanation);
|
|
141
141
|
value["action"] = serde_json::json!(format!("team-agent {command} --help"));
|
|
142
142
|
value["next_actions"] = serde_json::json!([format!(
|
|
143
|
-
"
|
|
143
|
+
"Complete the required arguments using the Examples in team-agent {command} --help"
|
|
144
144
|
)]);
|
|
145
145
|
println!("{}", python_compact_json(&value));
|
|
146
146
|
} else {
|
|
@@ -179,7 +179,7 @@ pub(super) fn emit_result(r: CmdResult) -> ExitCode {
|
|
|
179
179
|
let mut stderr = stderr.lock();
|
|
180
180
|
let _ = writeln!(
|
|
181
181
|
stderr,
|
|
182
|
-
"
|
|
182
|
+
"Output unavailable; the message was persisted with message_id={message_id}. Use team-agent inbox leader -n 3 for replies; do not resend."
|
|
183
183
|
);
|
|
184
184
|
}
|
|
185
185
|
return if error.kind() == ErrorKind::BrokenPipe {
|
|
@@ -255,7 +255,7 @@ fn dispatch(command: &str, args: &[String], cwd: &Path) -> Result<ExitCode, CliE
|
|
|
255
255
|
)
|
|
256
256
|
{
|
|
257
257
|
return Err(CliError::Usage(
|
|
258
|
-
"
|
|
258
|
+
"Provide the agent name, task message or required command settings; see Usage and Examples below".to_string(),
|
|
259
259
|
));
|
|
260
260
|
}
|
|
261
261
|
match command {
|
|
@@ -340,16 +340,16 @@ fn is_known_subcommand(command: &str) -> bool {
|
|
|
340
340
|
}
|
|
341
341
|
|
|
342
342
|
pub(crate) fn default_help() -> String {
|
|
343
|
-
let mut out = String::from("Team Agent
|
|
343
|
+
let mut out = String::from("Team Agent: create a team, send tasks, read replies and shut down safely.\n\n1. Prepare agents\n Run team-agent quick-start in the project directory. An empty directory receives TEAM.md and agents/worker.md templates to create manually.\n2. Open a leader and create the team\n With Pi installed and signed in, run team-agent pi.\n Run team-agent quick-start in that leader's tool context.\n To recover an existing team, see team-agent restart --help; do not take over or delete it.\n3. Send tasks and read replies\n team-agent send worker 'Calculate 245 * 37 and reply to the leader.'\n team-agent inbox leader -n 3\n team-agent status\n Sending is not completion; wait for an actual reply.\n4. Diagnose and shut down\n team-agent doctor --workspace .\n team-agent shutdown --workspace . --json\n Verify this team's residual resources are empty, then diagnose the selected workspace.\n\nSelect workspace/team scope with --workspace/--team. Discover model names with models.\nWindows ConPTY requires a Windows host and an installed shim; tmux commands are not a generic Windows path.\n");
|
|
344
344
|
append_help_section(
|
|
345
345
|
&mut out,
|
|
346
|
-
"
|
|
346
|
+
"Getting started",
|
|
347
347
|
&["quick-start", "send", "status", "models", "inbox"],
|
|
348
348
|
);
|
|
349
|
-
append_help_section(&mut out, "
|
|
349
|
+
append_help_section(&mut out, "Team lifecycle", &["restart", "shutdown"]);
|
|
350
350
|
append_help_section(
|
|
351
351
|
&mut out,
|
|
352
|
-
"
|
|
352
|
+
"Agent lifecycle",
|
|
353
353
|
&[
|
|
354
354
|
"add-agent",
|
|
355
355
|
"start-agent",
|
|
@@ -362,21 +362,21 @@ pub(crate) fn default_help() -> String {
|
|
|
362
362
|
);
|
|
363
363
|
append_help_section(
|
|
364
364
|
&mut out,
|
|
365
|
-
"
|
|
365
|
+
"Observation and collaboration",
|
|
366
366
|
&["leaders", "doctor", "approvals"],
|
|
367
367
|
);
|
|
368
|
-
append_help_section(&mut out, "
|
|
368
|
+
append_help_section(&mut out, "Configuration", &["route", "profile", "install-skill"]);
|
|
369
369
|
append_help_section(
|
|
370
370
|
&mut out,
|
|
371
|
-
"
|
|
371
|
+
"Guided recovery",
|
|
372
372
|
&["claim-leader", "takeover", "attach-leader"],
|
|
373
373
|
);
|
|
374
374
|
append_help_section(
|
|
375
375
|
&mut out,
|
|
376
|
-
"
|
|
376
|
+
"Leader launch",
|
|
377
377
|
&["pi", "codex", "claude", "copilot", "grok", "cursor"],
|
|
378
378
|
);
|
|
379
|
-
out.push_str("\
|
|
379
|
+
out.push_str("\nCommand arguments and examples: team-agent <command> --help");
|
|
380
380
|
out
|
|
381
381
|
}
|
|
382
382
|
|
|
@@ -411,9 +411,9 @@ pub fn __test_quick_start_args(
|
|
|
411
411
|
}
|
|
412
412
|
|
|
413
413
|
pub(super) const TEAM_TEMPLATE: &str =
|
|
414
|
-
"---\nname:
|
|
415
|
-
pub(super) const WORKER_TEMPLATE: &str = "---\nname: worker\nrole: assistant\nprovider: pi\nmodel: openai-codex/gpt-6-luna\nauth_mode: subscription\ndangerously_skip_permissions: false\n---\
|
|
416
|
-
const HUMAN_NAVIGATION: &str = "
|
|
414
|
+
"---\nname: current\n---\nA small team for a command-line example.\n";
|
|
415
|
+
pub(super) const WORKER_TEMPLATE: &str = "---\nname: worker\nrole: assistant\nprovider: pi\nmodel: openai-codex/gpt-6-luna\nauth_mode: subscription\ndangerously_skip_permissions: false\n---\nComplete the task and send a concise reply to the leader.\n";
|
|
416
|
+
const HUMAN_NAVIGATION: &str = "Use team-agent --help to list available commands.";
|
|
417
417
|
|
|
418
418
|
pub(super) fn command_help(command: Option<&str>) -> String {
|
|
419
419
|
let Some(name) = command else {
|
|
@@ -427,54 +427,54 @@ pub(super) fn command_help(command: Option<&str>) -> String {
|
|
|
427
427
|
}
|
|
428
428
|
let (details, examples, next) = match name {
|
|
429
429
|
"quick-start" => (
|
|
430
|
-
"TEAMDIR
|
|
430
|
+
"TEAMDIR contains TEAM.md and agents/; --workspace selects the runtime project.\n--name sets the team name; --team/--team-id selects the team; --yes retains compatibility; --detail includes full diagnostics.\nProviders must be installed and signed in. Declare provider/model/effort in role files; permission bypass defaults to false.\n--backend tmux is for POSIX; conpty requires a Windows host and an installed ConPTY shim.",
|
|
431
431
|
"team-agent quick-start\nteam-agent quick-start ./roles --workspace ./project\nteam-agent quick-start . --json",
|
|
432
|
-
"
|
|
433
|
-
"send" => ("<agent>
|
|
434
|
-
"team-agent send worker '
|
|
435
|
-
"
|
|
436
|
-
"inbox" => ("<agent>
|
|
437
|
-
"team-agent inbox leader -n 3\nteam-agent inbox worker --limit 5\nteam-agent inbox leader --workspace . --team help-demo --json", "
|
|
438
|
-
"status" => ("
|
|
439
|
-
"team-agent status\nteam-agent status worker\nteam-agent status --workspace . --team help-demo --json", "
|
|
440
|
-
"models" => ("--provider
|
|
441
|
-
"team-agent models --provider pi\nteam-agent models --provider pi --search luna\nteam-agent models --provider cursor_agent --json", "
|
|
442
|
-
"restart" => ("WORKSPACE
|
|
443
|
-
"team-agent restart .\nteam-agent restart . --team help-demo --json", "
|
|
444
|
-
"shutdown" => ("
|
|
445
|
-
"team-agent shutdown --workspace .\nteam-agent shutdown --workspace . --team help-demo --json", "
|
|
446
|
-
"add-agent" => ("<agent>
|
|
447
|
-
"team-agent add-agent reviewer --provider pi --model openai-codex/gpt-6-luna --bypass false --prompt '
|
|
448
|
-
"start-agent" => ("
|
|
449
|
-
"team-agent start-agent worker\nteam-agent start-agent worker --model openai-codex/gpt-6-luna", "
|
|
450
|
-
"stop-agent" => ("<agent>
|
|
451
|
-
"team-agent stop-agent worker\nteam-agent stop-agent worker --workspace . --team help-demo --json", "
|
|
452
|
-
"reset-agent" => ("
|
|
453
|
-
"team-agent reset-agent worker --discard-session\nteam-agent reset-agent worker --discard-session --workspace . --team help-demo --json", "
|
|
454
|
-
"clone-agent" => ("<agent>
|
|
455
|
-
"team-agent clone-agent worker --as reviewer\nteam-agent clone-agent worker --as reviewer --label '
|
|
456
|
-
"fork-agent" => ("<agent>
|
|
457
|
-
"team-agent fork-agent worker --as experiment\nteam-agent fork-agent worker --as experiment --workspace . --team help-demo --json", "
|
|
458
|
-
"remove-agent" => ("
|
|
459
|
-
"team-agent remove-agent reviewer --confirm\nteam-agent remove-agent reviewer --from-spec --confirm --workspace . --team help-demo --json", "
|
|
460
|
-
"leaders" => ("
|
|
461
|
-
"team-agent leaders\nteam-agent leaders --all --json\nteam-agent leaders --prune --dry-run", "
|
|
462
|
-
"doctor" => ("
|
|
463
|
-
"team-agent doctor --workspace .\nteam-agent doctor --workspace . --team help-demo --json", "
|
|
464
|
-
"approvals" => ("
|
|
465
|
-
"team-agent approvals\nteam-agent approvals worker --json", "
|
|
466
|
-
"profile" => ("init
|
|
467
|
-
"team-agent profile init local --auth-mode subscription\nteam-agent profile doctor local\nteam-agent profile show local", "
|
|
468
|
-
"install-skill" => ("--source
|
|
469
|
-
"team-agent install-skill --source \"$SKILL_DIR\" --target codex --dry-run\nteam-agent install-skill --source \"$SKILL_DIR\" --target codex", "
|
|
470
|
-
"claim-leader" => ("
|
|
471
|
-
"team-agent claim-leader --workspace . --json\nteam-agent claim-leader --workspace . --team help-demo --confirm --json", "
|
|
472
|
-
"takeover" => ("
|
|
473
|
-
"team-agent takeover --workspace . --team help-demo --confirm\nteam-agent takeover --workspace . --team help-demo --confirm --json", "
|
|
474
|
-
"attach-leader" => ("PANE
|
|
475
|
-
"team-agent attach-leader --pane \"$PANE\" --provider pi --workspace .\nteam-agent attach-leader --pane \"$PANE\" --provider pi --workspace . --team help-demo --confirm --json", "
|
|
476
|
-
_ => ("
|
|
477
|
-
"", "
|
|
432
|
+
"Check Pi installation and sign-in; verify models with team-agent models --provider pi.\nRun team-agent pi, then quick-start in that leader's tool context. For an existing team, see restart --help."),
|
|
433
|
+
"send" => ("<agent> is an agent name from status; MESSAGE is the task text.\n--mailbox stores a message without injecting it into the current conversation; default delivery targets the agent conversation.",
|
|
434
|
+
"team-agent send worker 'Calculate 245 * 37 and reply to the leader.'\nteam-agent send worker 'Review the changes' --workspace . --team help-demo\nteam-agent send worker 'Read this when next available' --mailbox",
|
|
435
|
+
"Acceptance is not delivery or completion. Wait for an actual reply; use team-agent inbox leader -n 3. Diagnose with status/doctor rather than repeated sends."),
|
|
436
|
+
"inbox" => ("<agent> is the recipient name; -n/--limit bounds the message count. Reading replies does not resend messages.",
|
|
437
|
+
"team-agent inbox leader -n 3\nteam-agent inbox worker --limit 5\nteam-agent inbox leader --workspace . --team help-demo --json", "Wait for a natural reply, then check team-agent status if needed. Do not inspect worker terminal content."),
|
|
438
|
+
"status" => ("Optional <agent> selects one agent. --summary/--detail retain compatibility and do not add fields.\nNine fields: name/provider/model/effort/runtime_status/activity/health/session_name/tmux_command.\nRuntime, activity and health are distinct. unknown means insufficient evidence; null means unset. No default model is guessed.",
|
|
439
|
+
"team-agent status\nteam-agent status worker\nteam-agent status --workspace . --team help-demo --json", "Read replies with team-agent inbox leader -n 3; diagnose problems with team-agent doctor --workspace ."),
|
|
440
|
+
"models" => ("--provider selects the provider, default pi. QUERY or --search performs keyword search; they are mutually exclusive.\nUse cursor_agent for Cursor. Copilot has no model discovery entrypoint here. Results come from the native catalog, not guesses.",
|
|
441
|
+
"team-agent models --provider pi\nteam-agent models --provider pi --search luna\nteam-agent models --provider cursor_agent --json", "Use the exact returned model name in a role file or add-agent --model before launch."),
|
|
442
|
+
"restart" => ("WORKSPACE defaults to the current project; saved sessions are preferred.\nUse --allow-fresh only after explicit authorization to lose saved context. --session-converge-deadline sets the wait in seconds.",
|
|
443
|
+
"team-agent restart .\nteam-agent restart . --team help-demo --json", "Check status after restart. Obtain authorization before creating a fresh session; takeover is not a substitute for restart."),
|
|
444
|
+
"shutdown" => ("Shuts down only the selected workspace/team. Logs are retained by default; --keep-logs remains compatible.\n--json reports scope, degradation and owned residuals. Success does not mean other teams were shut down.",
|
|
445
|
+
"team-agent shutdown --workspace .\nteam-agent shutdown --workspace . --team help-demo --json", "Verify this team's owned residuals are empty, then run team-agent doctor --workspace . Do not clean up other teams."),
|
|
446
|
+
"add-agent" => ("<agent> names the new agent. --provider selects the provider; --model sets the model; --effort sets reasoning effort.\n--bypass controls permission bypass (example: false); --prompt sets responsibilities; --profile selects authentication/proxy settings.\nProvider and bypass must be explicit in arguments or --role-file. Conflicting settings are refused, not guessed. Use --force to replace an agent only after explicit authorization.",
|
|
447
|
+
"team-agent add-agent reviewer --provider pi --model openai-codex/gpt-6-luna --bypass false --prompt 'Review tasks'\nteam-agent add-agent reviewer --role-file ./agents/reviewer.md", "Verify the agent with status, then run team-agent send reviewer 'Review the changes'."),
|
|
448
|
+
"start-agent" => ("Starts an existing agent only; stop-agent first if it is running.\n--provider selects the provider; --model sets the model; --effort sets reasoning effort; --bypass controls permission bypass.\n--prompt/--profile changes responsibilities/authentication. Use --allow-fresh only after explicit authorization to lose saved context.",
|
|
449
|
+
"team-agent start-agent worker\nteam-agent start-agent worker --model openai-codex/gpt-6-luna", "Use add-agent for a new agent. Check status after starting, then send a task."),
|
|
450
|
+
"stop-agent" => ("<agent> names the agent to stop. This is not removal; configuration and session history are retained.",
|
|
451
|
+
"team-agent stop-agent worker\nteam-agent stop-agent worker --workspace . --team help-demo --json", "Verify stopped status; resume with team-agent start-agent worker."),
|
|
452
|
+
"reset-agent" => ("Requires explicit --discard-session. Stops the old process, clears the saved session association and attempts a fresh restart. Paused agents stay paused. This does not delete all native provider history.",
|
|
453
|
+
"team-agent reset-agent worker --discard-session\nteam-agent reset-agent worker --discard-session --workspace . --team help-demo --json", "Verify with team-agent status. After a normal reset, send a new task; another start-agent is unnecessary."),
|
|
454
|
+
"clone-agent" => ("<agent> is the source; --as names the new agent; --label sets a readable label.\nCreates an agent from copied configuration, not a complete conversation copy.",
|
|
455
|
+
"team-agent clone-agent worker --as reviewer\nteam-agent clone-agent worker --as reviewer --label 'Review agent' --workspace .", "Check the new agent with status, then send reviewer an independent task."),
|
|
456
|
+
"fork-agent" => ("<agent> is the source; --as names the new agent; --label sets a readable label.\nRequires a captured source session and supported fork behavior. Unsupported cases are refused; not all providers support the same kind of fork.",
|
|
457
|
+
"team-agent fork-agent worker --as experiment\nteam-agent fork-agent worker --as experiment --workspace . --team help-demo --json", "Inspect status after success, then send a task to the resulting agent. Stop or remove a new seat when finished."),
|
|
458
|
+
"remove-agent" => ("Requires --confirm. Spec-defined agents also require --from-spec; dynamic agents do not.\nDeletes only the managed role copy, not an external user role file. Stop a running agent first.\n--force stops and removes a running agent; use only after understanding the risk and receiving explicit authorization.",
|
|
459
|
+
"team-agent remove-agent reviewer --confirm\nteam-agent remove-agent reviewer --from-spec --confirm --workspace . --team help-demo --json", "Save required replies first; verify status and configuration scope after removal. Do not force-clean other agents."),
|
|
460
|
+
"leaders" => ("Lists live leaders by default; --all includes stale registrations and --stale selects stale entries.\nQUERY/--search filters workspace/team/name. --prune removes verified retired registrations; preview with --dry-run.",
|
|
461
|
+
"team-agent leaders\nteam-agent leaders --all --json\nteam-agent leaders --prune --dry-run", "Select --workspace/--team from the reported scope. Registry cleanup is not process shutdown."),
|
|
462
|
+
"doctor" => ("Read-only diagnosis by default; SPEC is an optional configuration path.\n--comms/--gate comms checks channels, not actual replies; --gate orphans checks residual resources.\nUse --fix/--fix-schema/--cleanup-orphans only within authorized scope. Dangerous repairs require --confirm.",
|
|
463
|
+
"team-agent doctor --workspace .\nteam-agent doctor --workspace . --team help-demo --json", "Follow the actual issue and selected-team scope. A suggested repair is not an executed repair."),
|
|
464
|
+
"approvals" => ("Optional <agent> selects one agent. Observes permission prompts without granting approval.",
|
|
465
|
+
"team-agent approvals\nteam-agent approvals worker --json", "Verify the requested permission, handle it in the actual provider prompt, then check status."),
|
|
466
|
+
"profile" => ("init creates a profile; doctor checks it; show displays settings. NAME is the profile name.\n--auth-mode selects authentication; --proxy-mode direct bypasses proxies and inherit uses the environment proxy.\nProfiles belong to the selected workspace, not automatically to an isolated --team. Do not expose credentials.",
|
|
467
|
+
"team-agent profile init local --auth-mode subscription\nteam-agent profile doctor local\nteam-agent profile show local", "After validation, select --profile local with add-agent/start-agent. Use native provider sign-in when needed."),
|
|
468
|
+
"install-skill" => ("--source must be a verified skill directory; --target selects codex/claude/copilot/all.\n--dest overrides the destination; --dry-run previews; --uninstall removes the target skill. Installation is not required to create a team.",
|
|
469
|
+
"team-agent install-skill --source \"$SKILL_DIR\" --target codex --dry-run\nteam-agent install-skill --source \"$SKILL_DIR\" --target codex", "Set SKILL_DIR to a verified directory and inspect the preview before installation. Do not overwrite unknown user files."),
|
|
470
|
+
"claim-leader" => ("Use only when doctor recommends leader registration and this terminal is the actual leader.\n--confirm authorizes registration; it does not open a new provider.",
|
|
471
|
+
"team-agent claim-leader --workspace . --json\nteam-agent claim-leader --workspace . --team help-demo --confirm --json", "Verify doctor findings and terminal ownership first. A refusal without confirmation is not successful registration."),
|
|
472
|
+
"takeover" => ("Use only when doctor recommends takeover and the user has authorized it. This changes leader ownership.\nWith a usable team terminal, takeover may execute even without --confirm; it is not a read-only preview. Use restart for normal recovery.",
|
|
473
|
+
"team-agent takeover --workspace . --team help-demo --confirm\nteam-agent takeover --workspace . --team help-demo --confirm --json", "Verify leader/team ownership before confirmation. Check status/doctor afterwards; do not take over someone else's team."),
|
|
474
|
+
"attach-leader" => ("PANE must be a verified leader terminal, not a guessed pane id.\n--provider selects the actual provider; --confirm authorizes attachment to an existing leader. Use only when doctor recommends it.",
|
|
475
|
+
"team-agent attach-leader --pane \"$PANE\" --provider pi --workspace .\nteam-agent attach-leader --pane \"$PANE\" --provider pi --workspace . --team help-demo --confirm --json", "Set PANE to the verified terminal. Confirm attachment with doctor before sending a task."),
|
|
476
|
+
_ => ("Install the provider and complete native sign-in first. The current directory is the workspace.\nUse --attach-existing/--confirm only after verifying leader ownership and receiving authorization; --attach-session selects a verified session.\n--external-leader selects an external leader; --allow-nested-attach requires explicit authorization for nested terminals.\nArguments after -- pass through unchanged. Bare --help/-h displays this help without starting the provider.",
|
|
477
|
+
"", "Run team-agent quick-start in the opened leader's tool context, not in an ordinary worker conversation."),
|
|
478
478
|
};
|
|
479
479
|
let examples = if matches!(spec.kind, CommandKind::LeaderPassthrough { .. }) {
|
|
480
480
|
let native = if name == "cursor" { "agent" } else { name };
|
|
@@ -487,30 +487,30 @@ pub(super) fn command_help(command: Option<&str>) -> String {
|
|
|
487
487
|
examples.to_string()
|
|
488
488
|
};
|
|
489
489
|
let scope = if matches!(spec.kind, CommandKind::LeaderPassthrough { .. }) {
|
|
490
|
-
"--json
|
|
490
|
+
"Use --json for structured output. --workspace/--team are not launcher options here; they pass to the native provider."
|
|
491
491
|
} else {
|
|
492
|
-
"--json
|
|
492
|
+
"Use --json for structured output. --workspace selects the project; supported commands use --team to select the team."
|
|
493
493
|
};
|
|
494
|
-
let mut out = format!("
|
|
494
|
+
let mut out = format!("Purpose:\n{}.\nUsage: {}\n\nOptions:\n{}\n{}\nExamples:\n{}\n\nNext Action:\n{}", spec.summary, spec.usage, details, scope, examples, next);
|
|
495
495
|
if name == "quick-start" {
|
|
496
|
-
out.push_str(&format!("\n\
|
|
496
|
+
out.push_str(&format!("\n\nMinimal two-file configuration (create manually; not written automatically):\nTEAM.md:\n{TEAM_TEMPLATE}\nagents/worker.md:\n{WORKER_TEMPLATE}"));
|
|
497
497
|
}
|
|
498
498
|
if name == "cursor" {
|
|
499
|
-
out.push_str("\
|
|
499
|
+
out.push_str("\nDiscover models with team-agent models --provider cursor_agent.");
|
|
500
500
|
}
|
|
501
501
|
if name == "copilot" {
|
|
502
|
-
out.push_str("\nCopilot
|
|
502
|
+
out.push_str("\nCopilot has no team-agent models entrypoint; consult native provider help.");
|
|
503
503
|
}
|
|
504
504
|
out
|
|
505
505
|
}
|
|
506
506
|
|
|
507
507
|
fn emit_unknown_subcommand_usage(command: &str) -> ExitCode {
|
|
508
508
|
emit_usage_error(&format!(
|
|
509
|
-
"
|
|
509
|
+
"Unknown command: '{command}'. Use team-agent --help to list available commands."
|
|
510
510
|
));
|
|
511
511
|
// E8 (N38): 错路引导 —— 拼写近似时建议最接近的真子命令(additive,不改既有 golden 行)。
|
|
512
512
|
if let Some(suggestion) = nearest_subcommand(command) {
|
|
513
|
-
eprintln!("
|
|
513
|
+
eprintln!("Did you mean `{suggestion}`? See team-agent {suggestion} --help for examples.");
|
|
514
514
|
}
|
|
515
515
|
// 0.5.45 naming-addressing (RED-6): unknown subcommand exits 1
|
|
516
516
|
// (Error), aligned with the family of typo refusals throughout
|
|
@@ -542,8 +542,8 @@ fn nearest_subcommand(input: &str) -> Option<&'static str> {
|
|
|
542
542
|
}
|
|
543
543
|
|
|
544
544
|
fn emit_usage_error(message: &str) {
|
|
545
|
-
eprintln!("
|
|
546
|
-
eprintln!("
|
|
545
|
+
eprintln!("Usage: team-agent <command>; list commands with team-agent --help");
|
|
546
|
+
eprintln!("Error: {message}");
|
|
547
547
|
}
|
|
548
548
|
|
|
549
549
|
/// `install-skill` 参数(RED-1 根治:把 skill 安装单源收敛到二进制,install.mjs 调它)。
|
|
@@ -692,12 +692,12 @@ fn emit_cli_error(command: &str, args: &[String], cwd: &Path, error: &CliError)
|
|
|
692
692
|
{
|
|
693
693
|
if let Some(message) = super::named_address::human_address_reason(reason) {
|
|
694
694
|
payload.error = message.to_string();
|
|
695
|
-
payload.action = "
|
|
695
|
+
payload.action = "Run team-agent status and use an agent name from the list. Select scope with --workspace/--team; diagnose channel issues with doctor.".to_string();
|
|
696
696
|
}
|
|
697
697
|
}
|
|
698
698
|
if command_spec(command).is_some()
|
|
699
699
|
&& payload.action
|
|
700
|
-
== "
|
|
700
|
+
== "Run team-agent doctor --workspace . for the selected team, or inspect the error log shown here."
|
|
701
701
|
{
|
|
702
702
|
let mut doctor = format!(
|
|
703
703
|
"team-agent doctor --workspace {}",
|
|
@@ -706,7 +706,7 @@ fn emit_cli_error(command: &str, args: &[String], cwd: &Path, error: &CliError)
|
|
|
706
706
|
if let Some(team) = parsed.team.as_deref() {
|
|
707
707
|
doctor.push_str(&format!(" --team {}", super::adapters::shell_quote(team)));
|
|
708
708
|
}
|
|
709
|
-
payload.action = format!("
|
|
709
|
+
payload.action = format!("Run {doctor} for the selected team, or inspect the error log shown here.");
|
|
710
710
|
}
|
|
711
711
|
payload.action = crate::redaction::redact_external_text(&payload.action);
|
|
712
712
|
payload.log = crate::redaction::redact_external_text(&payload.log);
|
|
@@ -1083,7 +1083,7 @@ fn quick_start_args(args: &[String], cwd: &Path) -> Result<QuickStartArgs, CliEr
|
|
|
1083
1083
|
let normalized = literal.trim().to_ascii_lowercase();
|
|
1084
1084
|
if normalized != "tmux" && normalized != "conpty" {
|
|
1085
1085
|
return Err(CliError::Usage(format!(
|
|
1086
|
-
"--backend
|
|
1086
|
+
"--backend must be tmux or conpty; received {literal:?}. Use tmux on POSIX. ConPTY requires a Windows host and an installed shim."
|
|
1087
1087
|
)));
|
|
1088
1088
|
}
|
|
1089
1089
|
}
|
|
@@ -1137,7 +1137,7 @@ fn send_args(args: &[String], cwd: &Path) -> Result<SendArgs, CliError> {
|
|
|
1137
1137
|
&& parsed.positionals.len() < 2
|
|
1138
1138
|
{
|
|
1139
1139
|
return Err(CliError::Usage(
|
|
1140
|
-
"
|
|
1140
|
+
"Provide a recipient agent name and task message, such as team-agent send worker 'Review the changes'".to_string(),
|
|
1141
1141
|
));
|
|
1142
1142
|
}
|
|
1143
1143
|
let target = if parsed.targets.is_some()
|
|
@@ -1171,7 +1171,7 @@ fn send_args(args: &[String], cwd: &Path) -> Result<SendArgs, CliError> {
|
|
|
1171
1171
|
)
|
|
1172
1172
|
.map_err(|error| CliError::Usage(format!("invalid send routing: {error}")))?;
|
|
1173
1173
|
if normalized.deprecation.is_some() {
|
|
1174
|
-
eprintln!("
|
|
1174
|
+
eprintln!("Warning: legacy send settings are deprecated. Use team-agent send <agent> 'task message'; add --mailbox for storage without injection.");
|
|
1175
1175
|
}
|
|
1176
1176
|
Ok(SendArgs {
|
|
1177
1177
|
target,
|
|
@@ -1250,16 +1250,16 @@ fn warn_send_legacy_delivery_flags(args: &[String]) {
|
|
|
1250
1250
|
"--message-id",
|
|
1251
1251
|
];
|
|
1252
1252
|
let spec = command_spec("send");
|
|
1253
|
-
let sunset = spec.and_then(|spec| spec.sunset).unwrap_or("
|
|
1253
|
+
let sunset = spec.and_then(|spec| spec.sunset).unwrap_or("a future compatibility release");
|
|
1254
1254
|
let action = spec
|
|
1255
1255
|
.and_then(|spec| spec.action)
|
|
1256
|
-
.unwrap_or("
|
|
1256
|
+
.unwrap_or("Use team-agent send <agent> 'task message'; select scope with --workspace/--team");
|
|
1257
1257
|
for flag in FLAGS {
|
|
1258
1258
|
if args
|
|
1259
1259
|
.iter()
|
|
1260
1260
|
.any(|arg| arg == flag || arg.starts_with(&format!("{flag}=")))
|
|
1261
1261
|
{
|
|
1262
|
-
eprintln!("
|
|
1262
|
+
eprintln!("Warning: {flag} is deprecated and will be removed in {sunset}. Next: {action}");
|
|
1263
1263
|
}
|
|
1264
1264
|
}
|
|
1265
1265
|
}
|
|
@@ -1673,7 +1673,7 @@ fn reset_agent_args(args: &[String], cwd: &Path) -> Result<ResetAgentArgs, CliEr
|
|
|
1673
1673
|
let agent = required_pos(&parsed, 0, "agent")?;
|
|
1674
1674
|
if !parsed.discard_session {
|
|
1675
1675
|
return Err(CliError::Usage(
|
|
1676
|
-
"missing --discard-session
|
|
1676
|
+
"missing --discard-session; add this option only after explicit authorization to discard the saved session association".to_string(),
|
|
1677
1677
|
));
|
|
1678
1678
|
}
|
|
1679
1679
|
let workspace = workspace(&parsed, cwd);
|
|
@@ -2317,13 +2317,42 @@ mod tests {
|
|
|
2317
2317
|
);
|
|
2318
2318
|
}
|
|
2319
2319
|
|
|
2320
|
+
#[test]
|
|
2321
|
+
fn public_help_templates_and_cli_guidance_are_english() {
|
|
2322
|
+
fn assert_english(text: &str) {
|
|
2323
|
+
assert!(
|
|
2324
|
+
!text.chars().any(|ch| matches!(ch, '\u{3400}'..='\u{9fff}')),
|
|
2325
|
+
"unauthorized CJK CLI guidance: {text}"
|
|
2326
|
+
);
|
|
2327
|
+
}
|
|
2328
|
+
assert_english(&default_help());
|
|
2329
|
+
assert_eq!(TEAM_TEMPLATE.lines().nth(1), Some("name: current"));
|
|
2330
|
+
for spec in COMMAND_SPECS {
|
|
2331
|
+
assert_english(spec.summary);
|
|
2332
|
+
assert_english(&command_help(Some(spec.name)));
|
|
2333
|
+
}
|
|
2334
|
+
for text in [
|
|
2335
|
+
TEAM_TEMPLATE, WORKER_TEMPLATE, HUMAN_NAVIGATION,
|
|
2336
|
+
crate::cli::route::HELP, crate::cli::COMMS_BOUNDARY_TEXT,
|
|
2337
|
+
crate::cli::QUICK_START_REMINDER, crate::cli::SEND_REMINDER,
|
|
2338
|
+
crate::cli::STATUS_REMINDER,
|
|
2339
|
+
] {
|
|
2340
|
+
assert_english(text);
|
|
2341
|
+
}
|
|
2342
|
+
for command in ["quick-start", "restart", "send"] {
|
|
2343
|
+
let payload = CliError::Runtime("fixture failure".to_string())
|
|
2344
|
+
.to_payload(Path::new("/tmp/fixture.log"), command);
|
|
2345
|
+
assert_english(&payload.action);
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2348
|
+
|
|
2320
2349
|
#[test]
|
|
2321
2350
|
fn worker_lifecycle_help_uses_authoritative_spec_usage_and_summary() {
|
|
2322
2351
|
for name in ["start-agent", "add-agent"] {
|
|
2323
2352
|
let spec = command_spec(name).expect("registered worker lifecycle command");
|
|
2324
2353
|
let help = command_help(Some(name));
|
|
2325
2354
|
assert!(help.contains(spec.usage));
|
|
2326
|
-
assert!(help.contains("
|
|
2355
|
+
assert!(help.contains("Purpose:"));
|
|
2327
2356
|
for flag in [
|
|
2328
2357
|
"--model MODEL",
|
|
2329
2358
|
"--effort LEVEL",
|
|
@@ -2334,13 +2363,13 @@ mod tests {
|
|
|
2334
2363
|
] {
|
|
2335
2364
|
assert!(help.contains(flag), "{name} help missing {flag}: {help}");
|
|
2336
2365
|
}
|
|
2337
|
-
assert!(help.contains("
|
|
2366
|
+
assert!(help.contains("Next Action") && help.contains("send"));
|
|
2338
2367
|
}
|
|
2339
2368
|
assert!(!command_help(Some("start-agent")).contains("--force"));
|
|
2340
2369
|
let add = command_help(Some("add-agent"));
|
|
2341
2370
|
assert!(add.contains("[--role-file FILE]"));
|
|
2342
2371
|
assert!(add.contains("provider") && add.contains("bypass") && add.contains("--role-file"));
|
|
2343
|
-
assert!(add.contains("
|
|
2372
|
+
assert!(add.contains("Conflicting") && add.contains("refused"));
|
|
2344
2373
|
}
|
|
2345
2374
|
|
|
2346
2375
|
#[test]
|
|
@@ -2348,17 +2377,17 @@ mod tests {
|
|
|
2348
2377
|
let help = command_help(Some("status"));
|
|
2349
2378
|
for marker in [
|
|
2350
2379
|
"name/provider/model/effort/runtime_status/activity/health/session_name/tmux_command",
|
|
2351
|
-
"--json
|
|
2352
|
-
"unknown
|
|
2380
|
+
"Use --json for structured output",
|
|
2381
|
+
"unknown means insufficient evidence",
|
|
2353
2382
|
"tmux_command",
|
|
2354
|
-
"
|
|
2383
|
+
"do not add fields",
|
|
2355
2384
|
] {
|
|
2356
2385
|
assert!(
|
|
2357
2386
|
help.contains(marker),
|
|
2358
2387
|
"status help missing {marker}: {help}"
|
|
2359
2388
|
);
|
|
2360
2389
|
}
|
|
2361
|
-
assert!(!help.contains("
|
|
2390
|
+
assert!(!help.contains("error breakdown via status --summary"));
|
|
2362
2391
|
}
|
|
2363
2392
|
|
|
2364
2393
|
#[test]
|
|
@@ -2497,14 +2526,14 @@ mod tests {
|
|
|
2497
2526
|
.unwrap();
|
|
2498
2527
|
let err = cmd_send(&args).unwrap_err();
|
|
2499
2528
|
assert!(
|
|
2500
|
-
matches!(err, CliError::Usage(ref message) if message.contains("--pane") && message.contains("--to") && message.contains("
|
|
2529
|
+
matches!(err, CliError::Usage(ref message) if message.contains("--pane") && message.contains("--to") && message.contains("cannot") && message.contains("combined")),
|
|
2501
2530
|
"expected --pane/--to mutual-exclusion usage error, got {err:?}"
|
|
2502
2531
|
);
|
|
2503
2532
|
|
|
2504
2533
|
let args = send_args(&cli_argv(&["--pane", "%1596"]), &cwd).unwrap();
|
|
2505
2534
|
let err = cmd_send(&args).unwrap_err();
|
|
2506
2535
|
assert!(
|
|
2507
|
-
matches!(err, CliError::Usage(ref message) if message.contains("--pane") && message.contains("
|
|
2536
|
+
matches!(err, CliError::Usage(ref message) if message.contains("--pane") && message.contains("cannot send an empty message")),
|
|
2508
2537
|
"expected empty-message usage error, got {err:?}"
|
|
2509
2538
|
);
|
|
2510
2539
|
|