@team-agent/installer 0.5.124 → 0.5.126
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 -8
- package/Cargo.toml +1 -1
- package/README.md +2 -2
- package/README.zh.md +2 -2
- package/crates/team-agent/Cargo.toml +0 -1
- package/crates/team-agent/src/cli/diagnose.rs +39 -69
- package/crates/team-agent/src/cli/emit.rs +45 -15
- package/crates/team-agent/src/cli/intent/runtime.rs +5 -53
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +10 -130
- package/crates/team-agent/src/cli/leader.rs +2 -3
- package/crates/team-agent/src/cli/leader_prompt.rs +1 -1
- package/crates/team-agent/src/cli/mod.rs +28 -33
- package/crates/team-agent/src/cli/models.rs +44 -880
- package/crates/team-agent/src/cli/route.rs +1 -1
- package/crates/team-agent/src/cli/send/persist.rs +36 -0
- package/crates/team-agent/src/cli/send/presentation.rs +7 -1
- package/crates/team-agent/src/cli/send.rs +3 -1
- package/crates/team-agent/src/cli/spec.rs +1 -2
- package/crates/team-agent/src/cli/status_port/brief.rs +66 -0
- package/crates/team-agent/src/cli/tests/base.rs +4 -11
- package/crates/team-agent/src/cli/tests/mod.rs +1 -1
- package/crates/team-agent/src/cli/tests/run_delegation.rs +5 -4
- package/crates/team-agent/src/cli/tests/status_send.rs +17 -0
- package/crates/team-agent/src/compiler/tests.rs +39 -8
- package/crates/team-agent/src/compiler.rs +28 -204
- package/crates/team-agent/src/contract_runtime/backend.rs +79 -40
- package/crates/team-agent/src/contract_runtime/config.rs +37 -24
- package/crates/team-agent/src/contract_runtime/discovery.rs +33 -0
- package/crates/team-agent/src/contract_runtime/fork.rs +368 -0
- package/crates/team-agent/src/contract_runtime/framework.rs +87 -34
- package/crates/team-agent/src/contract_runtime/mod.rs +1 -0
- package/crates/team-agent/src/contract_runtime/registry.rs +299 -21
- package/crates/team-agent/src/coordinator/runtime_detectors.rs +0 -1
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +29 -8
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +0 -42
- package/crates/team-agent/src/coordinator/tick.rs +89 -1
- package/crates/team-agent/src/db/message_store.rs +78 -3
- package/crates/team-agent/src/layout/worker_window_helpers.rs +0 -1
- package/crates/team-agent/src/leader/prompt.rs +1 -2
- package/crates/team-agent/src/leader/provider_attribution.rs +0 -52
- package/crates/team-agent/src/leader/start.rs +1 -2
- package/crates/team-agent/src/leader/tests/prompt_contract.rs +2 -3
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +91 -0
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +15 -195
- package/crates/team-agent/src/lifecycle/launch/agent_state.rs +0 -9
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +11 -27
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +18 -29
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +6 -87
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +3 -11
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +74 -244
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +0 -24
- package/crates/team-agent/src/lifecycle/launch/role_source.rs +5 -0
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +21 -61
- package/crates/team-agent/src/lifecycle/launch/spec_state.rs +0 -1
- package/crates/team-agent/src/lifecycle/launch/worker_env.rs +0 -108
- package/crates/team-agent/src/lifecycle/launch.rs +2 -43
- package/crates/team-agent/src/lifecycle/profile_launch.rs +21 -348
- package/crates/team-agent/src/lifecycle/profile_smoke.rs +1 -2
- package/crates/team-agent/src/lifecycle/restart/common.rs +43 -378
- package/crates/team-agent/src/lifecycle/restart/selection.rs +5 -5
- package/crates/team-agent/src/lifecycle/restart.rs +0 -2
- package/crates/team-agent/src/lifecycle/role_config.rs +42 -3
- package/crates/team-agent/src/lifecycle/tests/behavioral_diff_264_red.rs +11 -6
- package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +8 -320
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +60 -145
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +8 -334
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +30 -11
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests/core.rs +17 -16
- package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +12 -12
- package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +3 -51
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +26 -28
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +6 -18
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +52 -70
- package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +4 -157
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +10 -302
- package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +1 -68
- package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +1 -19
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +2 -100
- package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +11 -10
- package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +0 -1
- package/crates/team-agent/src/lifecycle/tests/restart_session_capture_red.rs +2 -106
- package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests/swallow_batch4_semantics_red.rs +2 -254
- package/crates/team-agent/src/lifecycle/tests/upgrade_compat_0211_red.rs +4 -4
- package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +6 -5
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +7 -153
- package/crates/team-agent/src/lifecycle/tests.rs +0 -6
- package/crates/team-agent/src/lifecycle/types.rs +2 -18
- package/crates/team-agent/src/lifecycle/worker_command_context.rs +2 -4
- package/crates/team-agent/src/mcp_server/readiness.rs +148 -97
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +115 -16
- package/crates/team-agent/src/messaging/delivery.rs +185 -168
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +5 -5
- package/crates/team-agent/src/messaging/enter_rescue_tests.rs +1 -1
- package/crates/team-agent/src/messaging/helpers.rs +19 -0
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +67 -5
- package/crates/team-agent/src/messaging/tests/runtime.rs +110 -4
- package/crates/team-agent/src/messaging/tests/spine.rs +46 -36
- package/crates/team-agent/src/model/enums.rs +1 -8
- package/crates/team-agent/src/provider/adapter.rs +33 -302
- package/crates/team-agent/src/provider/adapters/mod.rs +4 -5
- package/crates/team-agent/src/provider/argv_route.rs +1 -5
- package/crates/team-agent/src/provider/bypass_flags.rs +3 -11
- package/crates/team-agent/src/provider/classify.rs +68 -3
- package/crates/team-agent/src/provider/faults.rs +1 -1
- package/crates/team-agent/src/provider/model_catalog.rs +14 -273
- package/crates/team-agent/src/provider/session/capture.rs +7 -107
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +0 -4
- package/crates/team-agent/src/provider/session/context_fork.rs +17 -109
- package/crates/team-agent/src/provider/session_scan/common.rs +11 -36
- package/crates/team-agent/src/provider/session_scan/pi.rs +1 -34
- package/crates/team-agent/src/provider/session_scan.rs +4 -14
- package/crates/team-agent/src/provider/submit_now.rs +5 -28
- package/crates/team-agent/src/provider/tests/adapter.rs +39 -275
- package/crates/team-agent/src/provider/tests/classify.rs +53 -0
- package/crates/team-agent/src/provider/tests/command_helpers.rs +3 -15
- package/crates/team-agent/src/provider/tests/idle.rs +0 -25
- package/crates/team-agent/src/provider/types.rs +1 -1
- package/crates/team-agent/src/provider/wire.rs +79 -11
- package/crates/team-agent/src/state/abnormal_watch/tests/mod.rs +1 -1
- package/crates/team-agent/src/state/persist.rs +6 -6
- package/crates/team-agent/src/state/repository/tests.rs +2 -2
- package/crates/team-agent/src/tmux_backend/native_input_tests.rs +2 -178
- package/crates/team-agent/src/tmux_backend/tests.rs +151 -0
- package/crates/team-agent/src/tmux_backend.rs +43 -8
- package/crates/team-agent/src/transport/native_input.rs +2 -231
- package/package.json +4 -4
- package/skills/team-agent/SKILL.md +7 -5
- package/skills/team-agent/command-coverage.json +15 -1
- package/skills/team-agent/docs/reference/team-agent-operator.md +5 -3
- package/skills/team-agent/references/team-agent-operator.md +5 -3
- package/crates/team-agent/src/lifecycle/launch/cursor_create_chat.rs +0 -229
- package/crates/team-agent/src/lifecycle/launch/cursor_mcp.rs +0 -522
- package/crates/team-agent/src/lifecycle/launch/cursor_mcp_iso.rs +0 -282
- package/crates/team-agent/src/lifecycle/restart/avatar.rs +0 -1805
- package/crates/team-agent/src/lifecycle/tests/claude_compatible_config_red.rs +0 -325
- package/crates/team-agent/src/lifecycle/tests/cursor_mcp_overlay.rs +0 -576
- package/crates/team-agent/src/lifecycle/tests/cursor_require_explicit_model_red.rs +0 -222
- package/crates/team-agent/src/lifecycle/tests/cursor_restart_resume_red.rs +0 -511
- package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +0 -210
- package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +0 -1409
- package/crates/team-agent/src/provider/adapters/claude.rs +0 -78
- package/crates/team-agent/src/provider/adapters/claude_fork.rs +0 -131
- package/crates/team-agent/src/provider/adapters/cursor_agent.rs +0 -44
- package/crates/team-agent/src/provider/adapters/pi.rs +0 -100
- package/crates/team-agent/src/provider/session/context_fork/claude.rs +0 -123
- package/crates/team-agent/src/provider/session_scan/claude.rs +0 -523
- package/crates/team-agent/src/provider/session_scan/cursor.rs +0 -538
- package/crates/team-agent/src/provider/testdata/cursor-list-models-native.stdout +0 -250
- package/crates/team-agent/src/test_support/models_timeout_fixture.rs +0 -144
|
@@ -5,7 +5,7 @@ use crate::provider::argv_route::{self, Config, Mutation, Override, RouteError};
|
|
|
5
5
|
use crate::provider::Provider;
|
|
6
6
|
use serde_json::{json, Value};
|
|
7
7
|
|
|
8
|
-
pub(crate) const HELP: &str = "Purpose:\nConfigure additional provider launch arguments. Disabled by default.\nUsage: team-agent route [status|enable|disable|show [TOOL]|set TOOL -- ARG...|add TOOL -- ARG...|clear TOOL] [--json]\n\nOptions:\nstatus reports the switch; enable/disable change it; show lists all or one provider's arguments.\nset replaces arguments; add appends; clear removes a provider's arguments. Use --json for structured output.\nTOOL is a supported provider name, such as pi/codex/claude/copilot/grok
|
|
8
|
+
pub(crate) const HELP: &str = "Purpose:\nConfigure additional provider launch arguments. Disabled by default.\nUsage: team-agent route [status|enable|disable|show [TOOL]|set TOOL -- ARG...|add TOOL -- ARG...|clear TOOL] [--json]\n\nOptions:\nstatus reports the switch; enable/disable change it; show lists all or one provider's arguments.\nset replaces arguments; add appends; clear removes a provider's arguments. Use --json for structured output.\nTOOL is a supported provider name, such as pi/codex/claude/copilot/grok.\nEverything after the first -- is a literal provider argument, including --help and --json.\nConfiguration: ~/.team-agent/argv-routing.json. This is host-global, not isolated by workspace or team.\nTEAM_AGENT_CLI_ARGV_ROUTING overrides the persisted switch.\nExamples:\nteam-agent route status\nteam-agent route set pi -- --mode text\nteam-agent route enable\n\nNext Action:\nVerify arguments with route show pi. Changes apply to the next launch, not an existing session.\nWithout an enabled configuration, providers retain their original arguments. Leave routing disabled unless the arguments are understood.";
|
|
9
9
|
|
|
10
10
|
struct Request {
|
|
11
11
|
operation: String,
|
|
@@ -56,10 +56,46 @@ pub(super) fn persist_resolved_target(
|
|
|
56
56
|
};
|
|
57
57
|
let outcome = messaging::send_message(&selected.run_workspace, target, content, &opts)?;
|
|
58
58
|
let mut value = delivery_outcome_json(&outcome, target, content, &opts);
|
|
59
|
+
attach_mcp_handshake_wait(&mut value, &selected, target, &outcome);
|
|
59
60
|
append_loud_ensure_fields(&mut value, coordinator_ensure.as_ref());
|
|
60
61
|
Ok(value)
|
|
61
62
|
}
|
|
62
63
|
|
|
64
|
+
/// #372: name the readiness gate a queued worker message is waiting on.
|
|
65
|
+
/// Observation only; the coordinator owns retry, parking, and notice.
|
|
66
|
+
pub(super) fn attach_mcp_handshake_wait(
|
|
67
|
+
value: &mut Value,
|
|
68
|
+
selected: &crate::state::selector::SelectedTeam,
|
|
69
|
+
target: &MessageTarget,
|
|
70
|
+
outcome: &DeliveryOutcome,
|
|
71
|
+
) {
|
|
72
|
+
#[cfg(unix)]
|
|
73
|
+
if let (MessageTarget::Single(agent), DeliveryStatus::Queued, Some(object)) =
|
|
74
|
+
(target, outcome.status, value.as_object_mut())
|
|
75
|
+
{
|
|
76
|
+
// A contract seat's MCP binding is the framework's own; the legacy
|
|
77
|
+
// handshake gate does not apply and must not report a wait.
|
|
78
|
+
let contract = selected
|
|
79
|
+
.state
|
|
80
|
+
.get("agents")
|
|
81
|
+
.and_then(|agents| agents.get(agent.as_str()))
|
|
82
|
+
.is_some_and(crate::contract_runtime::framework::is_contract);
|
|
83
|
+
if contract {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if let Err(reason) = crate::mcp_server::readiness::preflight(
|
|
87
|
+
&selected.run_workspace,
|
|
88
|
+
Some(selected.team_key.as_str()),
|
|
89
|
+
agent,
|
|
90
|
+
&selected.state,
|
|
91
|
+
) {
|
|
92
|
+
object.insert("deferred_reason".to_string(), json!(reason));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
#[cfg(not(unix))]
|
|
96
|
+
let _ = (value, selected, target, outcome);
|
|
97
|
+
}
|
|
98
|
+
|
|
63
99
|
pub(super) fn routing_ambiguous_value(
|
|
64
100
|
workspace: &Path,
|
|
65
101
|
args: &SendArgs,
|
|
@@ -232,7 +232,13 @@ pub(super) fn send_human_output(value: &Value) -> String {
|
|
|
232
232
|
if value.get("delivered").and_then(Value::as_bool) == Some(true) {
|
|
233
233
|
format!("Delivered to {agent}. {}", crate::cli::SEND_REMINDER)
|
|
234
234
|
} else {
|
|
235
|
-
|
|
235
|
+
let waiting = value
|
|
236
|
+
.get("deferred_reason")
|
|
237
|
+
.and_then(Value::as_str)
|
|
238
|
+
.filter(|reason| reason.starts_with("mcp_handshake_"))
|
|
239
|
+
.map(|reason| format!(": {agent}'s MCP server has not completed its handshake ({reason}); after 5 minutes the message is parked and the leader is notified"))
|
|
240
|
+
.unwrap_or_default();
|
|
241
|
+
format!("Task accepted, but delivery to the agent's conversation is still pending{waiting}.\nNext: check team-agent status or team-agent doctor --workspace .; wait for an actual reply without repeated sends.")
|
|
236
242
|
}
|
|
237
243
|
}
|
|
238
244
|
|
|
@@ -17,7 +17,8 @@ use coordinator::{
|
|
|
17
17
|
};
|
|
18
18
|
pub use persist::send_options_from_args;
|
|
19
19
|
use persist::{
|
|
20
|
-
initial_delivery_allows_watch, observe_initial_delivery_for_watch,
|
|
20
|
+
attach_mcp_handshake_wait, initial_delivery_allows_watch, observe_initial_delivery_for_watch,
|
|
21
|
+
routing_ambiguous_value,
|
|
21
22
|
};
|
|
22
23
|
use presentation::{
|
|
23
24
|
add_send_reminder_if_ok, attach_positional_typo_suggestions, cmd_send_result,
|
|
@@ -123,6 +124,7 @@ pub fn cmd_send(args: &SendArgs) -> Result<CmdResult, CliError> {
|
|
|
123
124
|
outcome = observe_initial_delivery_for_watch(&selected, &target, &outcome, &opts)?;
|
|
124
125
|
}
|
|
125
126
|
let mut value = delivery_outcome_json(&outcome, &target, &content, &opts);
|
|
127
|
+
attach_mcp_handshake_wait(&mut value, &selected, &target, &outcome);
|
|
126
128
|
// 0.5.45 naming-addressing (design §3.5, RED-2/RED-3 positional):
|
|
127
129
|
// when the refusal reason is `target_not_in_team` AND the target
|
|
128
130
|
// was a Single non-special short id, attach scope-safe
|
|
@@ -125,7 +125,7 @@ pub(crate) const COMMAND_SPECS: &[CommandSpec] = &[
|
|
|
125
125
|
CommandSpec { name: "quick-start", tier: CommandTier::Core, category: CommandCategory::Start, kind: CommandKind::Dispatch(DispatchKind::QuickStart), summary: "Compatibility creation bridge; prefer start for daily activation", usage: "team-agent quick-start [TEAMDIR] [--workspace WORKSPACE] [--team TEAM] [--name NAME] [--team-id TEAM] [--yes] [--backend tmux|conpty] [--json] [--detail]", default_help: true, command_help: true, suggestion_index: true, token_usage: TokenUsage::Conditional, sunset: None, action: None, governance: None },
|
|
126
126
|
CommandSpec { name: "send", tier: CommandTier::Core, category: CommandCategory::Start, kind: CommandKind::Dispatch(DispatchKind::Send), summary: "Send a task to a specified agent", usage: "team-agent send <agent> MESSAGE... [--workspace WORKSPACE] [--team TEAM] [--mailbox] [--json]", default_help: true, command_help: true, suggestion_index: true, token_usage: TokenUsage::Conditional, sunset: Some("a future compatibility release"), action: Some("Use team-agent send <agent> 'task message'; select scope with --workspace and --team"), governance: None },
|
|
127
127
|
CommandSpec { name: "status", tier: CommandTier::Core, category: CommandCategory::Start, kind: CommandKind::Dispatch(DispatchKind::Status), summary: "Check agent status without reading conversation content", usage: "team-agent status [<agent>] [--workspace WORKSPACE] [--team TEAM] [--json] [--summary|--detail]", default_help: true, command_help: true, suggestion_index: true, token_usage: TokenUsage::No, sunset: None, action: None, governance: None },
|
|
128
|
-
CommandSpec { name: "models", tier: CommandTier::Core, category: CommandCategory::Start, kind: CommandKind::Dispatch(DispatchKind::Models), summary: "Discover model names supported by the native provider", usage: "team-agent models [--provider pi|cursor|
|
|
128
|
+
CommandSpec { name: "models", tier: CommandTier::Core, category: CommandCategory::Start, kind: CommandKind::Dispatch(DispatchKind::Models), summary: "Discover model names supported by the native provider", usage: "team-agent models [--provider pi|cursor|codex|claude|claude_code|grok|kiro] [QUERY|--search TEXT] [--json]", default_help: true, command_help: true, suggestion_index: true, token_usage: TokenUsage::No, sunset: None, action: None, governance: None },
|
|
129
129
|
CommandSpec { name: "inbox", tier: CommandTier::Core, category: CommandCategory::Start, kind: CommandKind::Dispatch(DispatchKind::Inbox), summary: "Read agent replies", usage: "team-agent inbox <agent> [-n N|--limit N] [--workspace WORKSPACE] [--team TEAM] [--json]", default_help: true, command_help: true, suggestion_index: true, token_usage: TokenUsage::No, sunset: None, action: None, governance: None },
|
|
130
130
|
CommandSpec { name: "restart", tier: CommandTier::Core, category: CommandCategory::TeamLifecycle, kind: CommandKind::Dispatch(DispatchKind::Restart), summary: "Restart one agent, or use the frozen bare/path team bridge", usage: "team-agent restart [AGENT|./WORKSPACE] [--workspace WORKSPACE] [--team TEAM] [--session auto|preserve] [--dry-run] [--allow-fresh] [--session-converge-deadline SECONDS] [--json] [--detail]", default_help: true, command_help: true, suggestion_index: true, token_usage: TokenUsage::Conditional, sunset: None, action: None, governance: None },
|
|
131
131
|
CommandSpec { name: "shutdown", tier: CommandTier::Core, category: CommandCategory::TeamLifecycle, kind: CommandKind::Dispatch(DispatchKind::Shutdown), summary: "Compatibility: shut down the selected team; prefer stop", usage: "team-agent shutdown [--workspace WORKSPACE] [--team TEAM] [--keep-logs] [--json]", default_help: true, command_help: true, suggestion_index: true, token_usage: TokenUsage::No, sunset: None, action: None, governance: None },
|
|
@@ -152,7 +152,6 @@ pub(crate) const COMMAND_SPECS: &[CommandSpec] = &[
|
|
|
152
152
|
CommandSpec { name: "claude", tier: CommandTier::Core, category: CommandCategory::Start, kind: CommandKind::LeaderPassthrough { provider: "claude" }, summary: "Open a leader session with Claude Code", usage: "team-agent claude [--attach-existing] [--confirm] [--attach-session SESSION] [--external-leader] [--allow-nested-attach] [--json] [-- TOOL_ARGS...]", default_help: true, command_help: true, suggestion_index: true, token_usage: TokenUsage::Conditional, sunset: None, action: None, governance: None },
|
|
153
153
|
CommandSpec { name: "copilot", tier: CommandTier::Core, category: CommandCategory::Start, kind: CommandKind::LeaderPassthrough { provider: "copilot" }, summary: "Open a leader session with Copilot", usage: "team-agent copilot [--attach-existing] [--confirm] [--attach-session SESSION] [--external-leader] [--allow-nested-attach] [--json] [-- TOOL_ARGS...]", default_help: true, command_help: true, suggestion_index: true, token_usage: TokenUsage::Conditional, sunset: None, action: None, governance: None },
|
|
154
154
|
CommandSpec { name: "grok", tier: CommandTier::Core, category: CommandCategory::Start, kind: CommandKind::LeaderPassthrough { provider: "grok" }, summary: "Open a leader session with Grok", usage: "team-agent grok [--attach-existing] [--confirm] [--attach-session SESSION] [--external-leader] [--allow-nested-attach] [--json] [-- TOOL_ARGS...]", default_help: true, command_help: true, suggestion_index: true, token_usage: TokenUsage::Conditional, sunset: None, action: None, governance: None },
|
|
155
|
-
CommandSpec { name: "cursor", tier: CommandTier::Core, category: CommandCategory::Start, kind: CommandKind::LeaderPassthrough { provider: "cursor_agent" }, summary: "Open a leader session with Cursor agent", usage: "team-agent cursor [--attach-existing] [--confirm] [--attach-session SESSION] [--external-leader] [--allow-nested-attach] [--json] [-- TOOL_ARGS...]", default_help: true, command_help: true, suggestion_index: true, token_usage: TokenUsage::Conditional, sunset: None, action: None, governance: None },
|
|
156
155
|
];
|
|
157
156
|
|
|
158
157
|
pub(crate) fn command_spec(name: &str) -> Option<&'static CommandSpec> {
|
|
@@ -89,6 +89,7 @@ struct RegisteredNode {
|
|
|
89
89
|
window: Option<String>,
|
|
90
90
|
pane: Option<String>,
|
|
91
91
|
lifecycle: Option<String>,
|
|
92
|
+
claude_registry: Option<(std::path::PathBuf, String)>,
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
@@ -534,6 +535,7 @@ fn registered_node(name: &str, value: &Value, state: &Value) -> RegisteredNode {
|
|
|
534
535
|
.or_else(|| first_string(display, &["pane_id"]))
|
|
535
536
|
.or_else(|| first_string(target, &["pane_id"])),
|
|
536
537
|
lifecycle: string_at(value, &["status"]).map(|status| status.to_ascii_lowercase()),
|
|
538
|
+
claude_registry: crate::provider::claude_registry_key(value),
|
|
537
539
|
}
|
|
538
540
|
}
|
|
539
541
|
|
|
@@ -1325,6 +1327,8 @@ fn project_node_with_attach(
|
|
|
1325
1327
|
let native_tmux = observed.evidence_method.as_deref() == Some("native_tmux");
|
|
1326
1328
|
let activity = if observed.provider.eq_ignore_ascii_case("pi") && !pi_channel && !native_tmux {
|
|
1327
1329
|
"unknown"
|
|
1330
|
+
} else if native_tmux && claude_node(node) {
|
|
1331
|
+
claude_registry_activity(node)
|
|
1328
1332
|
} else {
|
|
1329
1333
|
valid_activity(&observed.activity)
|
|
1330
1334
|
};
|
|
@@ -1395,6 +1399,24 @@ fn matches_registered(node: &RegisteredNode, observed: &ProbeNode) -> bool {
|
|
|
1395
1399
|
&& node.pane.as_deref() == Some(observed.pane.as_str())
|
|
1396
1400
|
}
|
|
1397
1401
|
|
|
1402
|
+
fn claude_node(node: &RegisteredNode) -> bool {
|
|
1403
|
+
crate::provider::wire::parse_provider(&node.provider)
|
|
1404
|
+
.is_some_and(crate::provider::wire::is_claude_family)
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
/// #379: a live Claude pane always runs the Claude process, so its command
|
|
1408
|
+
/// name says nothing about the turn; Claude's own session registry does.
|
|
1409
|
+
fn claude_registry_activity(node: &RegisteredNode) -> &'static str {
|
|
1410
|
+
let state = node.claude_registry.as_ref().and_then(|(sessions, session_id)| {
|
|
1411
|
+
crate::provider::claude_registry_turn_state(sessions, session_id, node.pane.as_deref())
|
|
1412
|
+
});
|
|
1413
|
+
match state {
|
|
1414
|
+
Some(crate::provider::TurnState::Working) => "working",
|
|
1415
|
+
Some(crate::provider::TurnState::Idle) => "idle",
|
|
1416
|
+
_ => "unknown",
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1398
1420
|
fn valid_activity(value: &str) -> &str {
|
|
1399
1421
|
match value {
|
|
1400
1422
|
"working" | "idle" => value,
|
|
@@ -1506,6 +1528,7 @@ mod native_ps_batch_regressions {
|
|
|
1506
1528
|
window: Some("w".into()),
|
|
1507
1529
|
pane: Some(pane.into()),
|
|
1508
1530
|
lifecycle: None,
|
|
1531
|
+
claude_registry: None,
|
|
1509
1532
|
}
|
|
1510
1533
|
}
|
|
1511
1534
|
|
|
@@ -1770,6 +1793,7 @@ mod tests {
|
|
|
1770
1793
|
window: Some("win".to_string()),
|
|
1771
1794
|
pane: Some("%7".to_string()),
|
|
1772
1795
|
lifecycle: None,
|
|
1796
|
+
claude_registry: None,
|
|
1773
1797
|
}
|
|
1774
1798
|
}
|
|
1775
1799
|
|
|
@@ -1878,6 +1902,48 @@ mod tests {
|
|
|
1878
1902
|
);
|
|
1879
1903
|
}
|
|
1880
1904
|
|
|
1905
|
+
// #379: a live Claude pane always runs Claude; its registry names the turn.
|
|
1906
|
+
#[cfg(unix)]
|
|
1907
|
+
#[test]
|
|
1908
|
+
fn issue379_claude_activity_comes_from_its_session_registry_not_the_pane_command() {
|
|
1909
|
+
let config = std::env::temp_dir().join(format!("ta-379-brief-{}", std::process::id()));
|
|
1910
|
+
let _ = std::fs::remove_dir_all(&config);
|
|
1911
|
+
let sid = "33333333-4444-4555-8666-777777777777";
|
|
1912
|
+
let projects = config.join("projects").join("-owned-cwd");
|
|
1913
|
+
std::fs::create_dir_all(&projects).unwrap();
|
|
1914
|
+
std::fs::create_dir_all(config.join("sessions")).unwrap();
|
|
1915
|
+
let rollout = projects.join(format!("{sid}.jsonl"));
|
|
1916
|
+
std::fs::write(&rollout, "").unwrap();
|
|
1917
|
+
let record = config.join("sessions").join(format!("{}.json", std::process::id()));
|
|
1918
|
+
let mut node = registered();
|
|
1919
|
+
node.provider = "claude".to_string();
|
|
1920
|
+
node.claude_registry = crate::provider::claude_registry_key(&json!({"rollout_path": rollout}));
|
|
1921
|
+
let mut observed = probe("native_tmux");
|
|
1922
|
+
observed.provider = "claude".to_string();
|
|
1923
|
+
observed.activity = "working".to_string();
|
|
1924
|
+
let sample = Some(ProbeResult { nodes: vec![observed], ..Default::default() });
|
|
1925
|
+
for (status, expected) in [("busy", "working"), ("idle", "idle"), ("waiting", "unknown")] {
|
|
1926
|
+
let body = json!({"pid": std::process::id(), "sessionId": sid, "tmux": "sess:@1.%7", "status": status});
|
|
1927
|
+
std::fs::write(&record, body.to_string()).unwrap();
|
|
1928
|
+
assert_eq!(project_node(&node, Some(&sample)).activity, expected, "{status}");
|
|
1929
|
+
}
|
|
1930
|
+
// Cold start: the ready prompt before any transcript is captured.
|
|
1931
|
+
let body = json!({"pid": std::process::id(), "sessionId": sid, "tmux": "sess:@1.%7", "status": "idle"});
|
|
1932
|
+
std::fs::write(&record, body.to_string()).unwrap();
|
|
1933
|
+
let cold = registered_node(
|
|
1934
|
+
"worker",
|
|
1935
|
+
&json!({"provider": "claude", "_pending_session_id": sid, "claude_projects_root": config.join("projects")}),
|
|
1936
|
+
&json!({}),
|
|
1937
|
+
);
|
|
1938
|
+
node.claude_registry = cold.claude_registry;
|
|
1939
|
+
assert_eq!(project_node(&node, Some(&sample)).activity, "idle");
|
|
1940
|
+
std::fs::remove_file(&record).unwrap();
|
|
1941
|
+
let projected = project_node(&node, Some(&sample));
|
|
1942
|
+
assert_eq!(projected.activity, "unknown", "the process name is not a turn state");
|
|
1943
|
+
assert_eq!(projected.observation_reason, Some("activity_or_health_not_observed"));
|
|
1944
|
+
let _ = std::fs::remove_dir_all(&config);
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1881
1947
|
#[test]
|
|
1882
1948
|
fn stopped_registration_is_retained_without_sample() {
|
|
1883
1949
|
let mut node = registered();
|
|
@@ -730,7 +730,7 @@ fn cmd_leader_passthrough_help_is_pure_human_guidance() {
|
|
|
730
730
|
let env = crate::cli::hermetic_test_support::HermeticTestEnv::enter("launcher-help-unit");
|
|
731
731
|
let cwd = env.workspace("empty");
|
|
732
732
|
let tools = [
|
|
733
|
-
"pi", "codex", "claude", "copilot", "grok",
|
|
733
|
+
"pi", "codex", "claude", "copilot", "grok",
|
|
734
734
|
];
|
|
735
735
|
let bin = env.root().join("canaries");
|
|
736
736
|
std::fs::create_dir(&bin).unwrap();
|
|
@@ -744,7 +744,7 @@ fn cmd_leader_passthrough_help_is_pure_human_guidance() {
|
|
|
744
744
|
}
|
|
745
745
|
env.with_env("PATH", &bin.to_string_lossy())
|
|
746
746
|
};
|
|
747
|
-
for provider in ["pi", "codex", "claude", "copilot", "grok"
|
|
747
|
+
for provider in ["pi", "codex", "claude", "copilot", "grok"] {
|
|
748
748
|
for alias in ["-h", "--help"] {
|
|
749
749
|
let result = cmd_leader_passthrough(provider, &[alias.into()], &cwd).unwrap();
|
|
750
750
|
assert_eq!(result.exit, ExitCode::Ok);
|
|
@@ -780,19 +780,12 @@ fn cmd_leader_passthrough_maps_copilot_provider() {
|
|
|
780
780
|
}
|
|
781
781
|
|
|
782
782
|
#[test]
|
|
783
|
-
fn
|
|
783
|
+
fn cmd_leader_passthrough_maps_grok_and_rejects_retired_cursor_names() {
|
|
784
784
|
assert_eq!(
|
|
785
785
|
leader_passthrough_provider("grok"),
|
|
786
786
|
Some(crate::model::enums::Provider::Grok)
|
|
787
787
|
);
|
|
788
|
-
assert_eq!(
|
|
789
|
-
leader_passthrough_provider("cursor"),
|
|
790
|
-
Some(crate::model::enums::Provider::CursorAgent)
|
|
791
|
-
);
|
|
792
|
-
assert_ne!(
|
|
793
|
-
leader_passthrough_provider("cursor"),
|
|
794
|
-
Some(crate::model::enums::Provider::ClaudeCode)
|
|
795
|
-
);
|
|
788
|
+
assert_eq!(leader_passthrough_provider("cursor"), None);
|
|
796
789
|
assert_eq!(leader_passthrough_provider("agent"), None);
|
|
797
790
|
assert_eq!(leader_passthrough_provider("cursor_agent"), None);
|
|
798
791
|
assert_eq!(leader_passthrough_provider("not-a-passthrough"), None);
|
|
@@ -74,7 +74,7 @@ fn seed_send_workspace() -> std::path::PathBuf {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
const DELEG_VALID_ROLE: &str = "---\nname: implementer\nrole: Implementation Engineer\nprovider: fake\nmodel: fake\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nImplement bounded tasks.\n";
|
|
77
|
-
const DELEG_INVALID_ROLE: &str = "---\nname: broken\nrole: Broken Worker\nmodel: gpt-5.5\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\
|
|
77
|
+
const DELEG_INVALID_ROLE: &str = "---\nname: broken\nrole: Broken Worker\nprovider: not-a-provider\nmodel: gpt-5.5\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nUnknown provider.\n";
|
|
78
78
|
const DELEG_TEAM_MD: &str =
|
|
79
79
|
"---\nname: clidelegteam\nobjective: Delegation probe.\nprovider: fake\n---\n\nteam.\n";
|
|
80
80
|
|
|
@@ -252,9 +252,10 @@ fn cli_quick_start_invokes_real_lifecycle_admission_before_runtime_effects() {
|
|
|
252
252
|
);
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
-
// 2 [P0] — cmd_quick_start over an INVALID role doc surfaces the REAL compiler error (
|
|
256
|
-
// `provider
|
|
257
|
-
// placeholder returns a canned {ok:true} with no error
|
|
255
|
+
// 2 [P0] — cmd_quick_start over an INVALID role doc surfaces the REAL compiler error (unknown
|
|
256
|
+
// `provider`; an omitted one is the default Pi leaf), proving delegation to crate::lifecycle
|
|
257
|
+
// (compile fails before any spawn). The placeholder returns a canned {ok:true} with no error
|
|
258
|
+
// -> RED. OS-safe (compile fails early).
|
|
258
259
|
#[test]
|
|
259
260
|
fn cli_quick_start_invalid_spec_surfaces_real_compile_error() {
|
|
260
261
|
let team = deleg_uniq_dir("qsbad");
|
|
@@ -274,7 +275,7 @@ fn cli_quick_start_invalid_spec_surfaces_real_compile_error() {
|
|
|
274
275
|
let text = outcome_text(cmd_quick_start(&args));
|
|
275
276
|
assert!(
|
|
276
277
|
text.contains("provider"),
|
|
277
|
-
"cmd_quick_start must surface the REAL compiler error for a role doc
|
|
278
|
+
"cmd_quick_start must surface the REAL compiler error for a role doc with an unknown `provider` \
|
|
278
279
|
(proving delegation to crate::lifecycle, not the placeholder's canned ok:true); got {text}"
|
|
279
280
|
);
|
|
280
281
|
}
|
|
@@ -705,6 +705,23 @@ fn cmd_send_default_human_output_is_brief_without_false_delivered() {
|
|
|
705
705
|
}
|
|
706
706
|
}
|
|
707
707
|
|
|
708
|
+
#[test]
|
|
709
|
+
#[cfg(unix)]
|
|
710
|
+
fn issue372_queued_send_names_the_mcp_handshake_it_waits_on() {
|
|
711
|
+
let r = cmd_send(&queued_send_args_fixture(true)).expect("cmd_send returns CmdResult");
|
|
712
|
+
let CmdOutput::Json(v) = r.output else {
|
|
713
|
+
panic!("--json send must emit Json");
|
|
714
|
+
};
|
|
715
|
+
assert_eq!(v["deferred_reason"], json!("mcp_handshake_config_missing"), "{v}");
|
|
716
|
+
let r = cmd_send(&queued_send_args_fixture(false)).expect("cmd_send returns CmdResult");
|
|
717
|
+
let text = emit(&r.output, r.as_json).expect("send should render human text");
|
|
718
|
+
assert!(
|
|
719
|
+
text.contains("w1's MCP server has not completed its handshake (mcp_handshake_config_missing)")
|
|
720
|
+
&& text.contains("after 5 minutes the message is parked"),
|
|
721
|
+
"{text}"
|
|
722
|
+
);
|
|
723
|
+
}
|
|
724
|
+
|
|
708
725
|
#[test]
|
|
709
726
|
fn cmd_send_json_shape_keeps_056_fields() {
|
|
710
727
|
let args = queued_send_args_fixture(true);
|
|
@@ -7,14 +7,30 @@ use std::sync::atomic::{AtomicU32, Ordering};
|
|
|
7
7
|
|
|
8
8
|
static COUNTER: AtomicU32 = AtomicU32::new(0);
|
|
9
9
|
|
|
10
|
+
#[cfg(unix)]
|
|
10
11
|
#[test]
|
|
11
|
-
fn
|
|
12
|
-
for
|
|
13
|
-
let role = write_tmp(
|
|
12
|
+
fn every_cursor_provider_name_compiles_to_the_contract_leaf() {
|
|
13
|
+
for provider in ["cursor", "cursor_agent", "cursor-agent", "agent"] {
|
|
14
|
+
let role = write_tmp(
|
|
15
|
+
"cursor.md",
|
|
16
|
+
&format!("---\nprovider: {provider}\nmodel: gpt-5.6-luna-xhigh\n---\nRole\n"),
|
|
17
|
+
);
|
|
18
|
+
let compiled = compile_role_agent(&role, &Value::Map(Vec::new()), "/workspace").unwrap();
|
|
19
|
+
assert_eq!(
|
|
20
|
+
compiled.agent.get("provider").and_then(Value::as_str),
|
|
21
|
+
Some("cursor"),
|
|
22
|
+
"{provider}"
|
|
23
|
+
);
|
|
24
|
+
fs::remove_dir_all(role.parent().unwrap()).unwrap();
|
|
25
|
+
// The leaf's effort admission applies, not a legacy warning-and-ignore.
|
|
26
|
+
let role = write_tmp(
|
|
27
|
+
"cursor.md",
|
|
28
|
+
&format!("---\nprovider: {provider}\nmodel: gpt-5.6-luna-xhigh\neffort: high\n---\nRole\n"),
|
|
29
|
+
);
|
|
14
30
|
let error = compile_role_agent(&role, &Value::Map(Vec::new()), "/workspace")
|
|
15
31
|
.err()
|
|
16
|
-
.expect("Cursor
|
|
17
|
-
assert!(error.to_string().contains("
|
|
32
|
+
.expect("Cursor effort is a model ID, never a separate flag");
|
|
33
|
+
assert!(error.to_string().contains("exact catalog model ID"), "{provider}: {error}");
|
|
18
34
|
fs::remove_dir_all(role.parent().unwrap()).unwrap();
|
|
19
35
|
}
|
|
20
36
|
}
|
|
@@ -299,7 +315,13 @@ const ALIAS_JSON: &str = r#"{"version":1,"team":{"name":"debate-team","mode":"su
|
|
|
299
315
|
fn compile_provider_models_do_not_fill_claude_code_role_model() {
|
|
300
316
|
let team = build_team(ALIAS_TEAM, &[("implementer.md", ALIAS_ROLE)], &[]);
|
|
301
317
|
let spec = compile_team(&team).unwrap();
|
|
302
|
-
|
|
318
|
+
// On unix a `claude_code` role compiles to the Claude Code contract leaf's id.
|
|
319
|
+
let expected = if cfg!(unix) {
|
|
320
|
+
ALIAS_JSON.replace(r#""provider":"claude_code""#, r#""provider":"claude_tui""#)
|
|
321
|
+
} else {
|
|
322
|
+
ALIAS_JSON.to_string()
|
|
323
|
+
};
|
|
324
|
+
assert_eq!(templated_compact_json(&spec), expected);
|
|
303
325
|
}
|
|
304
326
|
|
|
305
327
|
// Omitted role model remains null; the provider supplies its native default.
|
|
@@ -403,7 +425,9 @@ fn compile_missing_provider_defaults_to_pi() {
|
|
|
403
425
|
let team = build_team(TEAM_BASE, &[("implementer.md", ROLE_MISSING_PROVIDER)], &[]);
|
|
404
426
|
let spec = compile_team(&team).expect("an omitted provider defaults to Pi");
|
|
405
427
|
let agent = agent0(&spec);
|
|
406
|
-
|
|
428
|
+
// On unix the default `pi` compiles to the Pi contract leaf's id.
|
|
429
|
+
let expected = if cfg!(unix) { "pi_tui" } else { "pi" };
|
|
430
|
+
assert_eq!(agent.get("provider"), Some(&Value::Str(expected.to_string())));
|
|
407
431
|
assert_eq!(
|
|
408
432
|
agent.get("model"),
|
|
409
433
|
Some(&Value::Str("team-agent/qwen3.8-27b".to_string()))
|
|
@@ -520,7 +544,8 @@ fn team_provider_model_aliases_do_not_fill_role_model() {
|
|
|
520
544
|
|
|
521
545
|
#[test]
|
|
522
546
|
fn claude_role_without_model_keeps_provider_native_default() {
|
|
523
|
-
// A missing explicit model stays null for both Claude provider names
|
|
547
|
+
// A missing explicit model stays null for both Claude provider names, each
|
|
548
|
+
// of which compiles to the Claude Code contract leaf on unix.
|
|
524
549
|
for prov in ["claude", "claude_code"] {
|
|
525
550
|
let team = build_team(TM_CODEX, &[("w.md", &role_nomodel(prov))], &[]);
|
|
526
551
|
let spec = compile_team(&team).unwrap();
|
|
@@ -529,6 +554,12 @@ fn claude_role_without_model_keeps_provider_native_default() {
|
|
|
529
554
|
Some(&Value::Null),
|
|
530
555
|
"provider {prov}"
|
|
531
556
|
);
|
|
557
|
+
let expected = if cfg!(unix) { "claude_tui" } else { prov };
|
|
558
|
+
assert_eq!(
|
|
559
|
+
agent0(&spec).get("provider").and_then(Value::as_str),
|
|
560
|
+
Some(expected),
|
|
561
|
+
"provider {prov}"
|
|
562
|
+
);
|
|
532
563
|
}
|
|
533
564
|
}
|
|
534
565
|
|