@team-agent/installer 0.5.124 → 0.5.125

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.
Files changed (97) hide show
  1. package/Cargo.lock +1 -8
  2. package/Cargo.toml +1 -1
  3. package/README.md +2 -2
  4. package/README.zh.md +2 -2
  5. package/crates/team-agent/Cargo.toml +0 -1
  6. package/crates/team-agent/src/cli/diagnose.rs +39 -1
  7. package/crates/team-agent/src/cli/emit.rs +41 -15
  8. package/crates/team-agent/src/cli/intent/runtime.rs +5 -53
  9. package/crates/team-agent/src/cli/intent/runtime_tests.rs +0 -120
  10. package/crates/team-agent/src/cli/leader.rs +2 -3
  11. package/crates/team-agent/src/cli/leader_prompt.rs +1 -1
  12. package/crates/team-agent/src/cli/mod.rs +6 -5
  13. package/crates/team-agent/src/cli/models.rs +40 -119
  14. package/crates/team-agent/src/cli/route.rs +1 -1
  15. package/crates/team-agent/src/cli/send/persist.rs +36 -0
  16. package/crates/team-agent/src/cli/send/presentation.rs +7 -1
  17. package/crates/team-agent/src/cli/send.rs +3 -1
  18. package/crates/team-agent/src/cli/spec.rs +1 -2
  19. package/crates/team-agent/src/cli/status_port/brief.rs +66 -0
  20. package/crates/team-agent/src/cli/tests/base.rs +4 -11
  21. package/crates/team-agent/src/cli/tests/status_send.rs +17 -0
  22. package/crates/team-agent/src/compiler/tests.rs +21 -5
  23. package/crates/team-agent/src/compiler.rs +24 -1
  24. package/crates/team-agent/src/contract_runtime/backend.rs +22 -6
  25. package/crates/team-agent/src/contract_runtime/config.rs +34 -24
  26. package/crates/team-agent/src/contract_runtime/discovery.rs +33 -0
  27. package/crates/team-agent/src/contract_runtime/framework.rs +89 -34
  28. package/crates/team-agent/src/contract_runtime/registry.rs +258 -21
  29. package/crates/team-agent/src/coordinator/runtime_detectors.rs +0 -1
  30. package/crates/team-agent/src/coordinator/tick.rs +89 -1
  31. package/crates/team-agent/src/db/message_store.rs +78 -3
  32. package/crates/team-agent/src/layout/worker_window_helpers.rs +0 -1
  33. package/crates/team-agent/src/leader/prompt.rs +1 -2
  34. package/crates/team-agent/src/leader/provider_attribution.rs +0 -52
  35. package/crates/team-agent/src/leader/start.rs +0 -1
  36. package/crates/team-agent/src/leader/tests/prompt_contract.rs +2 -3
  37. package/crates/team-agent/src/lifecycle/launch/add_agent.rs +91 -0
  38. package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +14 -1
  39. package/crates/team-agent/src/lifecycle/launch/agent_state.rs +0 -9
  40. package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +0 -1
  41. package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +2 -2
  42. package/crates/team-agent/src/lifecycle/launch/spawn.rs +0 -28
  43. package/crates/team-agent/src/lifecycle/launch/spec_state.rs +0 -1
  44. package/crates/team-agent/src/lifecycle/launch/worker_env.rs +0 -108
  45. package/crates/team-agent/src/lifecycle/launch.rs +2 -20
  46. package/crates/team-agent/src/lifecycle/profile_launch.rs +11 -39
  47. package/crates/team-agent/src/lifecycle/profile_smoke.rs +1 -2
  48. package/crates/team-agent/src/lifecycle/restart/common.rs +1 -63
  49. package/crates/team-agent/src/lifecycle/role_config.rs +42 -3
  50. package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +38 -7
  51. package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +6 -2
  52. package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +0 -1
  53. package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +0 -137
  54. package/crates/team-agent/src/lifecycle/tests.rs +0 -3
  55. package/crates/team-agent/src/lifecycle/worker_command_context.rs +2 -4
  56. package/crates/team-agent/src/mcp_server/readiness.rs +148 -97
  57. package/crates/team-agent/src/mcp_server/readiness_tests.rs +115 -16
  58. package/crates/team-agent/src/messaging/delivery.rs +181 -35
  59. package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +4 -4
  60. package/crates/team-agent/src/messaging/enter_rescue_tests.rs +1 -1
  61. package/crates/team-agent/src/messaging/helpers.rs +19 -0
  62. package/crates/team-agent/src/messaging/tests/dup_inject.rs +66 -4
  63. package/crates/team-agent/src/messaging/tests/runtime.rs +110 -4
  64. package/crates/team-agent/src/messaging/tests/spine.rs +22 -6
  65. package/crates/team-agent/src/model/enums.rs +1 -8
  66. package/crates/team-agent/src/provider/adapter.rs +1 -67
  67. package/crates/team-agent/src/provider/adapters/mod.rs +0 -1
  68. package/crates/team-agent/src/provider/argv_route.rs +1 -5
  69. package/crates/team-agent/src/provider/bypass_flags.rs +3 -11
  70. package/crates/team-agent/src/provider/classify.rs +68 -3
  71. package/crates/team-agent/src/provider/faults.rs +1 -1
  72. package/crates/team-agent/src/provider/model_catalog.rs +2 -73
  73. package/crates/team-agent/src/provider/session/capture.rs +1 -1
  74. package/crates/team-agent/src/provider/session/context_fork.rs +4 -4
  75. package/crates/team-agent/src/provider/session_scan/common.rs +1 -2
  76. package/crates/team-agent/src/provider/session_scan.rs +0 -4
  77. package/crates/team-agent/src/provider/submit_now.rs +5 -28
  78. package/crates/team-agent/src/provider/tests/adapter.rs +5 -184
  79. package/crates/team-agent/src/provider/tests/classify.rs +53 -0
  80. package/crates/team-agent/src/provider/tests/command_helpers.rs +1 -4
  81. package/crates/team-agent/src/provider/types.rs +1 -1
  82. package/crates/team-agent/src/provider/wire.rs +48 -8
  83. package/crates/team-agent/src/tmux_backend/native_input_tests.rs +2 -178
  84. package/crates/team-agent/src/tmux_backend/tests.rs +151 -0
  85. package/crates/team-agent/src/tmux_backend.rs +43 -8
  86. package/crates/team-agent/src/transport/native_input.rs +2 -231
  87. package/package.json +4 -4
  88. package/skills/team-agent/SKILL.md +1 -1
  89. package/crates/team-agent/src/lifecycle/launch/cursor_create_chat.rs +0 -229
  90. package/crates/team-agent/src/lifecycle/launch/cursor_mcp.rs +0 -522
  91. package/crates/team-agent/src/lifecycle/launch/cursor_mcp_iso.rs +0 -282
  92. package/crates/team-agent/src/lifecycle/tests/cursor_mcp_overlay.rs +0 -576
  93. package/crates/team-agent/src/lifecycle/tests/cursor_require_explicit_model_red.rs +0 -222
  94. package/crates/team-agent/src/lifecycle/tests/cursor_restart_resume_red.rs +0 -511
  95. package/crates/team-agent/src/provider/adapters/cursor_agent.rs +0 -44
  96. package/crates/team-agent/src/provider/session_scan/cursor.rs +0 -538
  97. package/crates/team-agent/src/provider/testdata/cursor-list-models-native.stdout +0 -250
@@ -14,17 +14,12 @@ const CATALOG_TIMEOUT: Duration = Duration::from_secs(10);
14
14
  const MAX_CATALOG_BYTES: u64 = 1024 * 1024;
15
15
  type ModelRecord = crate::provider::model_catalog::ModelRecord;
16
16
 
17
- #[cfg(test)]
18
- #[derive(Clone, Copy, Debug, Eq, PartialEq)]
19
- enum CatalogFormat {
20
- Pi,
21
- CursorAgent,
22
- }
23
-
24
17
  pub fn cmd_models(args: &ModelsArgs) -> Result<CmdResult, CliError> {
25
18
  #[cfg(unix)]
26
- if crate::contract_runtime::registry::descriptor(&args.provider).is_some() {
27
- return crate::contract_runtime::discovery::models(args);
19
+ if let Some(descriptor) = crate::contract_runtime::registry::declared(&args.provider, false) {
20
+ // A role's provider names its catalog: `agent` or `cursor-agent` is the Cursor leaf.
21
+ let args = ModelsArgs { provider: descriptor.identity.id.into(), ..args.clone() };
22
+ return crate::contract_runtime::discovery::models(&args);
28
23
  }
29
24
  let records = match crate::provider::model_catalog::discover_model_catalog(&args.provider) {
30
25
  Ok(records) => records,
@@ -107,80 +102,35 @@ fn render_catalog(args: &ModelsArgs, all: Vec<ModelRecord>) -> Result<CmdResult,
107
102
  }
108
103
  }
109
104
 
110
- /// Existing injectable Pi boundary retained for deterministic command/timeout tests.
111
105
  #[cfg(test)]
112
106
  fn cmd_models_with(
113
107
  args: &ModelsArgs,
114
108
  program: &Path,
115
109
  timeout: Duration,
116
110
  max_bytes: u64,
117
- ) -> Result<CmdResult, CliError> {
118
- cmd_models_with_format(args, program, CatalogFormat::Pi, timeout, max_bytes)
119
- }
120
-
121
- #[cfg(test)]
122
- fn cmd_models_with_format(
123
- args: &ModelsArgs,
124
- program: &Path,
125
- format: CatalogFormat,
126
- timeout: Duration,
127
- max_bytes: u64,
128
111
  ) -> Result<CmdResult, CliError> {
129
112
  let bytes = match run_catalog(program, timeout, max_bytes) {
130
113
  Ok(bytes) => bytes,
131
114
  Err(message) => return Ok(failure(args, &message)),
132
115
  };
133
- let all = match parse_catalog(&bytes, format) {
116
+ let all = match crate::provider::model_catalog::parse_pi_catalog(&bytes).map_err(|error| error.message("pi")) {
134
117
  Ok(models) => models,
135
118
  Err(message) => return Ok(failure(args, &message)),
136
119
  };
137
120
  render_catalog(args, all)
138
121
  }
139
122
 
140
- #[cfg(test)]
141
- fn parse_catalog(bytes: &[u8], format: CatalogFormat) -> Result<Vec<ModelRecord>, String> {
142
- let provider = match format {
143
- CatalogFormat::Pi => "pi",
144
- CatalogFormat::CursorAgent => "cursor_agent",
145
- };
146
- let result = match format {
147
- CatalogFormat::Pi => crate::provider::model_catalog::parse_pi_catalog(bytes),
148
- CatalogFormat::CursorAgent => crate::provider::model_catalog::parse_cursor_catalog(bytes),
149
- };
150
- result.map_err(|error| error.message(provider))
151
- }
152
-
153
- #[cfg(test)]
154
- fn parse_cursor_catalog(bytes: &[u8]) -> Result<Vec<ModelRecord>, String> {
155
- crate::provider::model_catalog::parse_cursor_catalog(bytes)
156
- .map_err(|error| error.message("cursor_agent"))
157
- }
158
-
159
123
  #[cfg(test)]
160
124
  fn model_matches(model: &ModelRecord, search: &str) -> bool {
161
125
  crate::provider::model_catalog::model_matches(model, search)
162
126
  }
163
127
 
164
- #[cfg(test)]
165
- fn current_model_for(format: CatalogFormat, models: &[ModelRecord]) -> Option<String> {
166
- match format {
167
- CatalogFormat::Pi => current_role_model(
168
- &models
169
- .iter()
170
- .map(|model| model.id.clone())
171
- .collect::<Vec<_>>(),
172
- ),
173
- CatalogFormat::CursorAgent => None,
174
- }
175
- }
176
-
177
128
  #[cfg(test)]
178
129
  fn failure(args: &ModelsArgs, message: &str) -> CmdResult {
179
130
  let action = if message.starts_with("unsupported model provider") {
180
- "choose a supported provider: pi, cursor_agent, codex, claude, or claude_code".to_string()
131
+ "choose a supported provider: pi, codex, claude, or claude_code".to_string()
181
132
  } else {
182
133
  let executable = match args.provider.as_str() {
183
- "cursor_agent" => "agent",
184
134
  "codex" => "codex",
185
135
  "claude" | "claude_code" => "claude",
186
136
  _ => "pi",
@@ -377,67 +327,6 @@ mod tests {
377
327
  assert_eq!(models[1]["role_model"], "team-agent/gpt-5.6-luna");
378
328
  }
379
329
 
380
- #[cfg(unix)]
381
- #[test]
382
- fn cursor_catalog_parses_copyable_ids_and_multiword_search() {
383
- let path = fixture(
384
- "printf 'Available models\\ngpt-5.6-luna-high - GPT-5.6 Luna 1M High\\ncursor-grok-4.6-high - Cursor Grok 4.6\\nauto - Auto (default)\\n'",
385
- );
386
- let result = cmd_models_with_format(
387
- &ModelsArgs {
388
- provider: "cursor_agent".into(),
389
- search: Some("GPT luna".into()),
390
- json: true,
391
- },
392
- &path,
393
- CatalogFormat::CursorAgent,
394
- Duration::from_secs(1),
395
- MAX_CATALOG_BYTES,
396
- )
397
- .unwrap();
398
- let CmdOutput::Human(text) = result.output else {
399
- panic!("expected JSON projection")
400
- };
401
- let value: Value = serde_json::from_str(&text).unwrap();
402
- assert_eq!(value["ok"], true, "{text}");
403
- assert_eq!(value["provider"], "cursor_agent");
404
- assert_eq!(value["models"].as_array().unwrap().len(), 1);
405
- assert_eq!(value["models"][0]["role_model"], "gpt-5.6-luna-high");
406
- assert_eq!(value["models"][0]["model_id"], "gpt-5.6-luna-high");
407
- assert_eq!(value["models"][0]["display_name"], "GPT-5.6 Luna 1M High");
408
- assert_eq!(value["models"][0]["current"], Value::Null);
409
- cleanup_fixture(&path);
410
- }
411
-
412
- #[cfg(unix)]
413
- #[test]
414
- fn cursor_native_tip_fixture_works_through_public_cli_once() {
415
- let agent = native_cli_fixture(
416
- "agent",
417
- include_bytes!("../provider/testdata/cursor-list-models-native.stdout"),
418
- );
419
- let output = run_public_models_cli(
420
- &agent.program,
421
- agent.response.as_deref(),
422
- &["models", "--provider", "cursor_agent", "--json"],
423
- );
424
- let text = public_cli_text(&output);
425
- let calls =
426
- std::fs::read_to_string(agent.program.with_extension("count")).unwrap_or_default();
427
- drop(agent);
428
- assert!(output.status.success(), "{text}");
429
- assert_eq!(calls, "1:--list-models\n");
430
- let value: Value = serde_json::from_str(text.trim()).unwrap();
431
- assert_eq!(value["schema_version"], "models.v1");
432
- assert_eq!(value["provider"], "cursor_agent");
433
- let models = value["models"].as_array().unwrap();
434
- for exact in ["gpt-5.6-luna-low", "gpt-5.6-luna-xhigh"] {
435
- assert!(models.iter().any(|model| model["model_id"] == exact));
436
- }
437
- assert_eq!(models[0]["model_id"], "auto");
438
- assert_eq!(models[0]["default"], true);
439
- }
440
-
441
330
  #[cfg(unix)]
442
331
  #[test]
443
332
  fn cursor_contract_catalog_uses_public_launcher_metadata_then_exact_ids() {
@@ -450,7 +339,7 @@ case "$1" in
450
339
  esac"#);
451
340
  let mut cursor = CliFixture::new(program);
452
341
  let response = cursor.program.with_extension("stdout");
453
- std::fs::write(&response, include_bytes!("../provider/testdata/cursor-list-models-native.stdout")).unwrap();
342
+ std::fs::write(&response, include_bytes!("../../../team-agent-contract/tests/fixtures/cursor-2026.10.01-models.txt")).unwrap();
454
343
  cursor.response = Some(response);
455
344
  let output = run_public_models_cli(&cursor.program, cursor.response.as_deref(),
456
345
  &["models", "--provider", "cursor", "--search", "gpt-5.6-luna-xhigh", "--json"]);
@@ -495,6 +384,38 @@ esac"#);
495
384
  assert!(value["models"].as_array().unwrap().iter().any(|row| row["model_id"] == "grok-4.7-build-fast"));
496
385
  }
497
386
 
387
+ #[cfg(unix)]
388
+ #[test]
389
+ fn every_cursor_provider_name_reads_the_contract_catalog_through_cursor_agent() {
390
+ use std::os::unix::fs::PermissionsExt;
391
+ for name in ["cursor_agent", "cursor-agent", "agent"] {
392
+ let mut cursor = CliFixture::new(fixture_program("cursor-agent", r#"
393
+ test "$#" = 1 || exit 9
394
+ case "$1" in
395
+ --version) printf '%s\n' '2026.10.01-a1b2c3' ;;
396
+ --list-models) exec /bin/cat "$TEAM_AGENT_MODELS_FIXTURE" ;;
397
+ *) exit 9 ;;
398
+ esac"#));
399
+ let response = cursor.program.with_extension("stdout");
400
+ std::fs::write(&response, include_bytes!("../../../team-agent-contract/tests/fixtures/cursor-2026.10.01-models.txt")).unwrap();
401
+ cursor.response = Some(response);
402
+ // The legacy binary name on PATH is never what runs.
403
+ let legacy = cursor.program.parent().unwrap().join("agent");
404
+ std::fs::write(&legacy, "#!/bin/sh\nprintf 'called' > \"$0.called\"\nexit 9\n").unwrap();
405
+ std::fs::set_permissions(&legacy, std::fs::Permissions::from_mode(0o700)).unwrap();
406
+ let output = run_public_models_cli(&cursor.program, cursor.response.as_deref(),
407
+ &["models", "--provider", name, "--json"]);
408
+ let text = public_cli_text(&output);
409
+ assert!(output.status.success(), "{name}: {text}");
410
+ assert_eq!(std::fs::read_to_string(cursor.program.with_extension("count")).unwrap(),
411
+ "1:--version\n1:--list-models\n", "{name}");
412
+ assert!(!legacy.with_extension("called").exists(), "{name}");
413
+ let value: Value = serde_json::from_str(text.trim()).unwrap();
414
+ assert_eq!(value["provider"], "cursor", "{name}");
415
+ assert!(value["models"].as_array().unwrap().iter().any(|row| row["model_id"] == "gpt-5.6-luna-xhigh"), "{name}");
416
+ }
417
+ }
418
+
498
419
  #[cfg(unix)]
499
420
  #[test]
500
421
  fn cursor_contract_bad_version_has_no_legacy_entrypoint_fallback() {
@@ -1417,7 +1338,7 @@ esac"#);
1417
1338
  ),
1418
1339
  ExitCode::Error
1419
1340
  );
1420
- let usage = "team-agent models [--provider pi|cursor|cursor_agent|codex|claude|claude_code|grok|kiro] [QUERY|--search TEXT] [--json]";
1341
+ let usage = "team-agent models [--provider pi|cursor|codex|claude|claude_code|grok|kiro] [QUERY|--search TEXT] [--json]";
1421
1342
  assert_eq!(crate::cli::spec::command_spec("models").unwrap().usage, usage);
1422
1343
  assert!(crate::cli::emit::command_help(Some("models")).contains(usage));
1423
1344
  }
@@ -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/cursor_agent.\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.";
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
- "Task accepted, but delivery to the agent's conversation is still pending.\nNext: check team-agent status or team-agent doctor --workspace .; wait for an actual reply without repeated sends.".to_string()
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, routing_ambiguous_value,
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|cursor_agent|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 },
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", "agent", "cursor",
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", "cursor"] {
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 cmd_leader_passthrough_maps_grok_and_cursor_not_claude() {
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);
@@ -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 cursor_effort_is_rejected_by_shared_admission_for_every_level() {
12
- for effort in ["low", "medium", "high", "xhigh", "max", "ultra"] {
13
- let role = write_tmp("cursor.md", &format!("---\nprovider: cursor_agent\neffort: {effort}\n---\nRole\n"));
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 must reject effort before command construction");
17
- assert!(error.to_string().contains("cursor_agent does not support effort; the Cursor CLI has no --effort flag"));
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
  }
@@ -495,8 +495,31 @@ fn compile_role_agent_with_mode(
495
495
  .filter(|provider| !provider.trim().is_empty())
496
496
  .unwrap_or_else(|| "pi".to_string());
497
497
  let is_pi = parse_canonical_provider(&provider) == Some(Provider::Pi);
498
+ // An exact boolean opt-in; a bare shared key (codex) keeps its legacy meaning.
499
+ let contract_runtime = match meta.get("contract_runtime") {
500
+ None => false,
501
+ Some(Value::Bool(value)) => *value,
502
+ Some(_) => {
503
+ return Err(ModelError::Validation(format!(
504
+ "{}: contract_runtime must be a boolean",
505
+ role_path.display()
506
+ )))
507
+ }
508
+ };
509
+ #[cfg(unix)]
510
+ let contract = crate::contract_runtime::registry::declared(&provider, contract_runtime);
511
+ #[cfg(not(unix))]
512
+ let contract: Option<()> = None;
513
+ if contract_runtime && contract.is_none() {
514
+ return Err(ModelError::Validation(format!(
515
+ "{}: contract_runtime: true requires a contract provider (got {provider})",
516
+ role_path.display()
517
+ )));
518
+ }
519
+ // The compiled spec and state carry the leaf's canonical id, so legacy
520
+ // readers of a shared key never mistake this seat for a legacy one.
498
521
  #[cfg(unix)]
499
- let contract = crate::contract_runtime::registry::descriptor(&provider);
522
+ let provider = contract.map_or(provider, |descriptor| descriptor.identity.id.to_string());
500
523
  #[cfg(unix)]
501
524
  let contract_role = contract.is_some();
502
525
  #[cfg(not(unix))]
@@ -470,7 +470,7 @@ fn preflight_request(
470
470
  discovered: &Discovery,
471
471
  ) -> Result<LaunchRequest, BackendError> {
472
472
  let mut request = request(binding, role, identity, discovered)?;
473
- if registry::provider(role.provider.as_str())? == registry::NativeProvider::GrokBuild {
473
+ if matches!(registry::provider(role.provider.as_str())?, registry::NativeProvider::GrokBuild | registry::NativeProvider::Codex | registry::NativeProvider::Pi | registry::NativeProvider::Claude) {
474
474
  // Pure H2 only: this is a proposed private path, not a filesystem receipt.
475
475
  request.paths.cwd = team_agent_contract::contract::session::CwdIdentity {
476
476
  path: binding.transport_root.join("workspaces").join(role.id.as_str()),
@@ -480,6 +480,22 @@ fn preflight_request(
480
480
  Ok(request)
481
481
  }
482
482
 
483
+ /// Providers whose native config search would otherwise inherit a Git or
484
+ /// project configuration ancestor. Metadata only; no body is read.
485
+ fn require_private_primary(
486
+ selected: registry::NativeProvider,
487
+ cwd: &team_agent_contract::contract::session::CwdIdentity,
488
+ ) -> Result<(), BackendError> {
489
+ match selected {
490
+ registry::NativeProvider::GrokBuild => team_agent_contract::providers::grok_build::native::require_private_primary(cwd)?,
491
+ registry::NativeProvider::Codex => team_agent_contract::providers::codex::launcher::require_private_primary(cwd)?,
492
+ registry::NativeProvider::Pi => team_agent_contract::providers::pi::launcher::require_private_primary(cwd)?,
493
+ registry::NativeProvider::Claude => team_agent_contract::providers::claude::launcher::require_private_primary(cwd)?,
494
+ registry::NativeProvider::Kiro | registry::NativeProvider::Cursor => {}
495
+ }
496
+ Ok(())
497
+ }
498
+
483
499
  /// Team-wide native discovery/admission before the shared launcher creates any
484
500
  /// seats (including legacy peers). Bounded read-only native commands run; no
485
501
  /// runtime store, worker config, private socket, or worker process is created.
@@ -793,8 +809,10 @@ pub fn start(
793
809
  if !descriptor.workspace.shared_cwd {
794
810
  request.paths.cwd = super::workspace::prepare(&backend.binding, &role.id)?;
795
811
  }
796
- if selected == registry::NativeProvider::GrokBuild {
797
- team_agent_contract::providers::grok_build::native::require_private_primary(&request.paths.cwd)?;
812
+ require_private_primary(selected, &request.paths.cwd)?;
813
+ if selected == registry::NativeProvider::Claude {
814
+ // `--session-id` names the fresh session; derived from this proposed instance.
815
+ request.preassigned_session = Some(team_agent_contract::providers::claude::session_id(&request.identity));
798
816
  }
799
817
  if let Some(registry::NativeRuntime::Cursor(runtime)) = &discovered.runtime {
800
818
  request.preassigned_session = Some(
@@ -942,9 +960,7 @@ pub fn prepare_resume(
942
960
  binding: source, expected_source: parent.identity,
943
961
  });
944
962
  let selected = registry::provider(role.provider.as_str())?;
945
- if selected == registry::NativeProvider::GrokBuild {
946
- team_agent_contract::providers::grok_build::native::require_private_primary(&request.paths.cwd)?;
947
- }
963
+ require_private_primary(selected, &request.paths.cwd)?;
948
964
  let resolved = resolve_launch(selected.descriptor(), &hooks, &request, Some(&discovered.catalog))?;
949
965
  validate_launch_plan(selected.descriptor(), &resolved, &adapter.plan(&resolved)?)?;
950
966
  Ok(PreparedResume { binding: backend.binding, role, discovered, request })