@team-agent/installer 0.5.127 → 0.5.128

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 (145) hide show
  1. package/Cargo.lock +1 -1
  2. package/Cargo.toml +1 -1
  3. package/README.md +11 -0
  4. package/crates/team-agent/src/cli/adapters.rs +3 -13
  5. package/crates/team-agent/src/cli/arguments.rs +4 -0
  6. package/crates/team-agent/src/cli/diagnose.rs +68 -22
  7. package/crates/team-agent/src/cli/emit.rs +58 -26
  8. package/crates/team-agent/src/cli/intent/runtime.rs +32 -5
  9. package/crates/team-agent/src/cli/intent/runtime_tests.rs +102 -11
  10. package/crates/team-agent/src/cli/intent/tests.rs +10 -12
  11. package/crates/team-agent/src/cli/intent.rs +1 -1
  12. package/crates/team-agent/src/cli/mod.rs +25 -8
  13. package/crates/team-agent/src/cli/models.rs +764 -7
  14. package/crates/team-agent/src/cli/schedule.rs +175 -0
  15. package/crates/team-agent/src/cli/send/persist.rs +0 -36
  16. package/crates/team-agent/src/cli/send/presentation.rs +1 -1
  17. package/crates/team-agent/src/cli/send.rs +108 -110
  18. package/crates/team-agent/src/cli/spec.rs +6 -0
  19. package/crates/team-agent/src/cli/status_port/brief.rs +5 -67
  20. package/crates/team-agent/src/cli/tests/leader_watch.rs +12 -62
  21. package/crates/team-agent/src/cli/tests/mod.rs +1 -1
  22. package/crates/team-agent/src/cli/tests/named_address.rs +11 -10
  23. package/crates/team-agent/src/cli/tests/run_delegation.rs +9 -6
  24. package/crates/team-agent/src/cli/tests/status_send.rs +68 -271
  25. package/crates/team-agent/src/compiler/tests.rs +3 -18
  26. package/crates/team-agent/src/compiler.rs +205 -6
  27. package/crates/team-agent/src/contract_runtime/backend.rs +145 -11
  28. package/crates/team-agent/src/contract_runtime/commands.rs +7 -7
  29. package/crates/team-agent/src/contract_runtime/config.rs +26 -16
  30. package/crates/team-agent/src/contract_runtime/config_tests.rs +24 -4
  31. package/crates/team-agent/src/contract_runtime/discovery.rs +12 -1
  32. package/crates/team-agent/src/contract_runtime/fork.rs +3 -10
  33. package/crates/team-agent/src/contract_runtime/framework.rs +28 -11
  34. package/crates/team-agent/src/contract_runtime/mcp.rs +19 -24
  35. package/crates/team-agent/src/contract_runtime/prompt.rs +2 -2
  36. package/crates/team-agent/src/contract_runtime/registry.rs +56 -92
  37. package/crates/team-agent/src/coordinator/steps/abnormal.rs +11 -11
  38. package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +16 -54
  39. package/crates/team-agent/src/coordinator/tests/health_sync.rs +42 -0
  40. package/crates/team-agent/src/coordinator/tick.rs +1 -89
  41. package/crates/team-agent/src/db/message_store.rs +7 -65
  42. package/crates/team-agent/src/direct_delivery.rs +368 -0
  43. package/crates/team-agent/src/inbox_store.rs +169 -0
  44. package/crates/team-agent/src/leader/registry.rs +5 -0
  45. package/crates/team-agent/src/leader/start.rs +2 -1
  46. package/crates/team-agent/src/leader/tests/lease_api.rs +2 -2
  47. package/crates/team-agent/src/leader/tests/prompt_contract.rs +1 -0
  48. package/crates/team-agent/src/lib.rs +2 -0
  49. package/crates/team-agent/src/lifecycle/launch/add_agent.rs +33 -0
  50. package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +206 -1
  51. package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +28 -2
  52. package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +38 -13
  53. package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +87 -6
  54. package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +9 -1
  55. package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +351 -81
  56. package/crates/team-agent/src/lifecycle/launch/pi_mcp_extension.js +3 -4
  57. package/crates/team-agent/src/lifecycle/launch/quick_start.rs +24 -0
  58. package/crates/team-agent/src/lifecycle/launch/spawn.rs +36 -13
  59. package/crates/team-agent/src/lifecycle/launch.rs +24 -1
  60. package/crates/team-agent/src/lifecycle/profile_launch.rs +321 -11
  61. package/crates/team-agent/src/lifecycle/restart/agent.rs +1 -0
  62. package/crates/team-agent/src/lifecycle/restart/avatar.rs +1798 -0
  63. package/crates/team-agent/src/lifecycle/restart/claude_fork.rs +163 -0
  64. package/crates/team-agent/src/lifecycle/restart/common.rs +345 -35
  65. package/crates/team-agent/src/lifecycle/restart/selection.rs +5 -5
  66. package/crates/team-agent/src/lifecycle/restart.rs +4 -0
  67. package/crates/team-agent/src/lifecycle/role_config.rs +39 -14
  68. package/crates/team-agent/src/lifecycle/tests/claude_compatible_config_red.rs +325 -0
  69. package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +320 -8
  70. package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +236 -13
  71. package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +378 -4
  72. package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +5 -4
  73. package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +7 -11
  74. package/crates/team-agent/src/lifecycle/tests/core.rs +47 -18
  75. package/crates/team-agent/src/lifecycle/tests/fixtures/pi_native_mcp_host.mjs +2 -1
  76. package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +14 -14
  77. package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +60 -20
  78. package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +28 -26
  79. package/crates/team-agent/src/lifecycle/tests/mcp_tool_name_format_red.rs +6 -6
  80. package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +18 -6
  81. package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +70 -52
  82. package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +210 -0
  83. package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +157 -4
  84. package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +526 -10
  85. package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +1419 -0
  86. package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +68 -1
  87. package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +34 -12
  88. package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +94 -2
  89. package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +10 -11
  90. package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +2 -2
  91. package/crates/team-agent/src/lifecycle/tests/swallow_batch4_semantics_red.rs +254 -2
  92. package/crates/team-agent/src/lifecycle/tests/upgrade_compat_0211_red.rs +4 -4
  93. package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +5 -6
  94. package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +16 -7
  95. package/crates/team-agent/src/lifecycle/tests.rs +3 -0
  96. package/crates/team-agent/src/lifecycle/types.rs +18 -2
  97. package/crates/team-agent/src/lifecycle/worker_command_context.rs +43 -50
  98. package/crates/team-agent/src/mcp_server/readiness.rs +130 -149
  99. package/crates/team-agent/src/mcp_server/readiness_tests.rs +98 -119
  100. package/crates/team-agent/src/mcp_server/tests/scoped.rs +21 -31
  101. package/crates/team-agent/src/mcp_server/tests/send.rs +72 -107
  102. package/crates/team-agent/src/mcp_server/tests/tools.rs +10 -12
  103. package/crates/team-agent/src/mcp_server/tools.rs +70 -196
  104. package/crates/team-agent/src/messaging/delivery.rs +160 -218
  105. package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +5 -5
  106. package/crates/team-agent/src/messaging/helpers.rs +1 -19
  107. package/crates/team-agent/src/messaging/mod.rs +1 -0
  108. package/crates/team-agent/src/messaging/reminders.rs +316 -0
  109. package/crates/team-agent/src/messaging/scheduler.rs +7 -1
  110. package/crates/team-agent/src/messaging/tests/dup_inject.rs +191 -85
  111. package/crates/team-agent/src/messaging/tests/runtime.rs +4 -110
  112. package/crates/team-agent/src/messaging/tests/spine.rs +40 -24
  113. package/crates/team-agent/src/messaging/types.rs +1 -0
  114. package/crates/team-agent/src/provider/adapter.rs +303 -51
  115. package/crates/team-agent/src/provider/adapters/claude.rs +78 -0
  116. package/crates/team-agent/src/provider/adapters/claude_fork.rs +131 -0
  117. package/crates/team-agent/src/provider/adapters/mod.rs +7 -5
  118. package/crates/team-agent/src/provider/adapters/pi.rs +106 -0
  119. package/crates/team-agent/src/provider/classify.rs +1 -66
  120. package/crates/team-agent/src/provider/model_catalog.rs +201 -13
  121. package/crates/team-agent/src/provider/session/capture.rs +106 -6
  122. package/crates/team-agent/src/provider/session/context_fork/claude.rs +123 -0
  123. package/crates/team-agent/src/provider/session/context_fork/outcome.rs +4 -0
  124. package/crates/team-agent/src/provider/session/context_fork.rs +150 -18
  125. package/crates/team-agent/src/provider/session_scan/claude.rs +523 -0
  126. package/crates/team-agent/src/provider/session_scan/common.rs +44 -8
  127. package/crates/team-agent/src/provider/session_scan/pi.rs +34 -1
  128. package/crates/team-agent/src/provider/session_scan.rs +16 -6
  129. package/crates/team-agent/src/provider/tests/adapter.rs +104 -17
  130. package/crates/team-agent/src/provider/tests/classify.rs +0 -53
  131. package/crates/team-agent/src/provider/tests/command_helpers.rs +12 -3
  132. package/crates/team-agent/src/provider/tests/idle.rs +37 -0
  133. package/crates/team-agent/src/provider/wire.rs +22 -34
  134. package/crates/team-agent/src/state/abnormal_watch/tests/mod.rs +1 -1
  135. package/crates/team-agent/src/state/persist.rs +6 -6
  136. package/crates/team-agent/src/state/projection.rs +1 -1
  137. package/crates/team-agent/src/state/repository/tests.rs +2 -2
  138. package/crates/team-agent/src/test_support/models_timeout_fixture.rs +144 -0
  139. package/crates/team-agent/src/tmux_backend/tests.rs +0 -151
  140. package/crates/team-agent/src/tmux_backend.rs +5 -40
  141. package/package.json +4 -4
  142. package/skills/team-agent/SKILL.md +5 -7
  143. package/skills/team-agent/command-coverage.json +1 -1
  144. package/skills/team-agent/docs/reference/team-agent-operator.md +3 -3
  145. package/skills/team-agent/references/team-agent-operator.md +3 -3
package/Cargo.lock CHANGED
@@ -721,7 +721,7 @@ dependencies = [
721
721
 
722
722
  [[package]]
723
723
  name = "team-agent"
724
- version = "0.5.127"
724
+ version = "0.5.128"
725
725
  dependencies = [
726
726
  "anyhow",
727
727
  "chrono",
package/Cargo.toml CHANGED
@@ -11,7 +11,7 @@ exclude = ["crates/team-agent-contract"]
11
11
 
12
12
  [workspace.package]
13
13
  edition = "2021"
14
- version = "0.5.127"
14
+ version = "0.5.128"
15
15
  license = "AGPL-3.0"
16
16
  rust-version = "1.95"
17
17
 
package/README.md CHANGED
@@ -36,6 +36,17 @@ team-agent claude
36
36
 
37
37
  Two steps. Everything else happens in the conversation.
38
38
 
39
+ ## Scheduled leader reminders
40
+
41
+ ```sh
42
+ team-agent schedule add --in 10m --text "Check progress"
43
+ team-agent schedule add --every 1h --text "Review status"
44
+ team-agent schedule list --json
45
+ team-agent schedule cancel sched_1
46
+ ```
47
+
48
+ Use `--workspace PATH --team KEY` to select the leader. Durations are positive integers followed by `ms`, `s`, `m`, `h`, or `d`. Reminders share the existing coordinator timer and durable queue; there is no extra daemon. Delivery has coordinator-tick granularity. After a coordinator restart, an overdue recurring reminder fires once and resumes its interval without replaying missed occurrences. Cancellation stops future occurrences, not reminders already firing or queued for delivery. `list` shows active reminders.
49
+
39
50
  ## Everyday CLI: start, stop, restart
40
51
 
41
52
  Check the selected binary with `team-agent start --help` and `team-agent team --help`. If these are missing, obtain an authorized supporting build; a version string alone is not a feature guarantee. Lifecycle commands run in the authorized native **Leader's tool context**, not an ordinary worker's pane.
@@ -371,18 +371,8 @@ pub fn cmd_approvals(args: &ApprovalsArgs) -> Result<CmdResult, CliError> {
371
371
 
372
372
  /// `cmd_inbox`(`commands.py:137`)。
373
373
  pub fn cmd_inbox(args: &InboxArgs) -> Result<CmdResult, CliError> {
374
- let selected = crate::state::selector::resolve_active_team(
375
- &args.workspace,
376
- args.team.as_deref(),
377
- crate::state::selector::SelectorMode::RuntimeOnly,
378
- )
379
- .map_err(|e| CliError::Runtime(e.to_string()))?;
380
- let value = status_port::inbox(
381
- &selected.run_workspace,
382
- &args.agent,
383
- args.limit,
384
- Some(&selected.team_key),
385
- )?;
374
+ let value = crate::inbox_store::read(&args.workspace, &args.agent, args.limit, args.team.as_deref())
375
+ .map_err(CliError::Usage)?;
386
376
  if args.json {
387
377
  Ok(CmdResult::from_json(value, true))
388
378
  } else {
@@ -447,7 +437,7 @@ fn format_inbox_human(agent: &str, value: &Value) -> String {
447
437
  .unwrap_or("-"),
448
438
  );
449
439
  let summary =
450
- clean_inbox_field(message.get("summary").and_then(Value::as_str).unwrap_or(""));
440
+ clean_inbox_field(message.get("summary").or_else(|| message.get("content")).and_then(Value::as_str).unwrap_or(""));
451
441
  truncate_inbox_line(&format!(
452
442
  "[{id}] [{sender} -> {recipient}] [{status}] [{time}] [{summary}]"
453
443
  ))
@@ -66,6 +66,8 @@ fn schema(command: &str) -> Option<Schema> {
66
66
  ),
67
67
  "send" => (
68
68
  &[
69
+ ("--socket", Token),
70
+ ("--dialect", Token),
69
71
  ("--targets", Token),
70
72
  ("--pane", Token),
71
73
  ("--to-name", Token),
@@ -88,9 +90,11 @@ fn schema(command: &str) -> Option<Schema> {
88
90
  ],
89
91
  usize::MAX,
90
92
  ),
93
+ "schedule" => (&[("--in", Token), ("--every", Token), ("--text", Payload)], 2),
91
94
  "status" => (&[("--detail", Switch), ("--summary", Switch)], 1),
92
95
  "models" => (&[("--provider", Token), ("--search", Query)], usize::MAX),
93
96
  "inbox" => (&[("--limit", Count)], 1),
97
+ "locate" => (&[], 0),
94
98
  "shutdown" => (&[("--keep-logs", Switch)], 0),
95
99
  "restart" => (
96
100
  &[
@@ -9,6 +9,74 @@ use crate::model::pane_authority_refusal::{
9
9
  use crate::provider::wire::{command_name, parse_provider, provider_wire};
10
10
  use crate::transport::Transport;
11
11
 
12
+ #[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize)]
13
+ #[serde(rename_all = "snake_case")]
14
+ pub(crate) enum PiBackingStatus {
15
+ Pending,
16
+ Captured,
17
+ Missing,
18
+ }
19
+
20
+ #[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize)]
21
+ #[serde(rename_all = "snake_case")]
22
+ pub(crate) enum PiMcpStatus {
23
+ Unavailable,
24
+ ConfiguredLazy,
25
+ RoundtripVerified,
26
+ }
27
+
28
+ pub(crate) struct PiDoctorInput {
29
+ pub executable_chain_verified: bool,
30
+ pub pi_version: Option<String>,
31
+ pub adapter_version: Option<String>,
32
+ pub catalog_sha256: Option<String>,
33
+ pub selected_model: Option<String>,
34
+ pub candidate_executable: Option<std::path::PathBuf>,
35
+ pub wrapper: Option<std::path::PathBuf>,
36
+ pub mcp_roundtrip_at: Option<String>,
37
+ pub backing: PiBackingStatus,
38
+ pub activity: crate::provider::TurnState,
39
+ pub activity_source: crate::provider::ClassifySource,
40
+ pub env_key_names: Vec<String>,
41
+ }
42
+
43
+ #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize)]
44
+ pub(crate) struct PiDoctorFacts {
45
+ pub mcp: PiMcpStatus,
46
+ pub mcp_connected: bool,
47
+ pub backing: PiBackingStatus,
48
+ pub activity: crate::provider::TurnState,
49
+ pub activity_source: crate::provider::ClassifySource,
50
+ pub auth_hint: crate::provider::AuthHintStatus,
51
+ }
52
+
53
+ pub(crate) fn pi_doctor_facts(input: PiDoctorInput) -> PiDoctorFacts {
54
+ let mcp = if input.mcp_roundtrip_at.is_some() {
55
+ PiMcpStatus::RoundtripVerified
56
+ } else if input.wrapper.is_some() {
57
+ PiMcpStatus::ConfiguredLazy
58
+ } else {
59
+ PiMcpStatus::Unavailable
60
+ };
61
+ let _ = (
62
+ input.executable_chain_verified,
63
+ input.pi_version,
64
+ input.adapter_version,
65
+ input.catalog_sha256,
66
+ input.selected_model,
67
+ input.candidate_executable,
68
+ input.env_key_names,
69
+ );
70
+ PiDoctorFacts {
71
+ mcp,
72
+ mcp_connected: mcp == PiMcpStatus::RoundtripVerified,
73
+ backing: input.backing,
74
+ activity: input.activity,
75
+ activity_source: input.activity_source,
76
+ auth_hint: crate::provider::AuthHintStatus::Unknown,
77
+ }
78
+ }
79
+
12
80
  /// 0.5.39 Slice 1 (tmux-server-death-locate §11.1 B): classify a tmux
13
81
  /// transport error string into a diagnose issue id. When the underlying
14
82
  /// tmux subprocess stderr contains `server exited unexpectedly`, the
@@ -58,14 +126,6 @@ fn is_public_window_name(provider: &str, window: &str) -> bool {
58
126
  if provider == "pi_tui" && matches!(window, "pi" | "node") {
59
127
  return true;
60
128
  }
61
- // tmux names a Claude pane after the image its `claude` route execs: an npm
62
- // `claude.exe`, or the native installer's version-named `<semver>` file.
63
- if provider == "claude_tui"
64
- && (matches!(window, "claude" | "claude.exe")
65
- || team_agent_contract::providers::claude::catalog::semver(window))
66
- {
67
- return true;
68
- }
69
129
  parse_provider(provider).is_some_and(|parsed| {
70
130
  command_name(parsed) == window
71
131
  || crate::layout::worker_window_helpers::provider_window_name(parsed) == window
@@ -1331,20 +1391,6 @@ mod tests {
1331
1391
  assert!(is_public_window_name("codex_tui", "node"));
1332
1392
  assert!(!is_public_window_name("codex_tui", "grok"));
1333
1393
  assert!(!is_public_window_name("grok_build", "node"));
1334
- assert!(is_public_window_name("pi_tui", "pi"));
1335
- assert!(is_public_window_name("pi_tui", "node"));
1336
- assert!(!is_public_window_name("pi_tui", "codex"));
1337
- }
1338
-
1339
- #[test]
1340
- fn claude_contract_window_may_carry_its_npm_or_version_named_image() {
1341
- for window in ["claude", "claude.exe", "2.1.309", "2.1.282"] {
1342
- assert!(is_public_window_name("claude_tui", window), "{window}");
1343
- }
1344
- for window in ["2.1", "claude-wrapper", "node", "grok"] {
1345
- assert!(!is_public_window_name("claude_tui", window), "{window}");
1346
- }
1347
- assert!(!is_public_window_name("grok_build", "2.1.309"));
1348
1394
  }
1349
1395
 
1350
1396
  #[test]
@@ -110,7 +110,7 @@ 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("Provide ") || matches!(message.as_str(), "add-agent requires --provider <name>" | "add-agent requires --bypass <true|false>" | "--source is required unless --uninstall"));
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>" | "--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 {
@@ -123,9 +123,6 @@ fn emit_cli_error_for_command(
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
- "add-agent requires --bypass <true|false>" => {
127
- "Explicitly retain permission prompts with --bypass false, or declare bypass in the role file.".to_string()
128
- }
129
126
  other => other
130
127
  .strip_prefix("missing ")
131
128
  .map(|field| format!("Provide the required argument: {field}."))
@@ -234,7 +231,8 @@ fn dispatch(command: &str, args: &[String], cwd: &Path) -> Result<ExitCode, CliE
234
231
 
235
232
  fn prepare_control_args(command: &str, args: &[String], cwd: &Path) -> Result<super::arguments::CheckedArgs, CliError> {
236
233
  let mut checked = super::arguments::parse(command, args)?;
237
- if !checked.help { checked.tokens = resolve_command_scope(command, checked.tokens, cwd)?; }
234
+ let raw_send = command == "send" && checked.tokens.iter().any(|token| token == "--socket");
235
+ if !checked.help && !raw_send { checked.tokens = resolve_command_scope(command, checked.tokens, cwd)?; }
238
236
  Ok(checked)
239
237
  }
240
238
 
@@ -271,7 +269,25 @@ fn dispatch_prepared(command: &str, checked: super::arguments::CheckedArgs, cwd:
271
269
  }
272
270
  match command {
273
271
  "quick-start" => cmd_quick_start(&quick_start_args(args, cwd)?).map(emit_result),
274
- "send" => cmd_send(&send_args(args, cwd)?).map(emit_result),
272
+ "send" => {
273
+ let parsed = parse_args(args);
274
+ if parsed.socket.is_some() || parsed.dialect.is_some() {
275
+ let socket = parsed.socket.as_deref().ok_or_else(|| CliError::Usage("raw send requires --socket".into()))?;
276
+ let pane = parsed.pane.as_deref().ok_or_else(|| CliError::Usage("raw send requires --pane".into()))?;
277
+ let dialect = parsed.dialect.as_deref().ok_or_else(|| CliError::Usage("raw send requires --dialect".into()))?;
278
+ if parsed.targets.is_some() || parsed.to_name.is_some() || parsed.to_leader.is_some() || parsed.mailbox {
279
+ return Err(CliError::Usage("raw send cannot be combined with semantic addressing or --mailbox".into()));
280
+ }
281
+ crate::direct_delivery::direct_send(socket, pane, dialect, &parsed.positionals.join(" ")).map_err(CliError::Runtime)?;
282
+ Ok(emit_result(CmdResult::from_json(serde_json::json!({"ok": true, "status": "sent", "delivery": "physical", "pane_id": pane, "accepted": null}), parsed.json)))
283
+ } else { cmd_send(&send_args(args, cwd)?).map(emit_result) }
284
+ },
285
+ "locate" => {
286
+ let parsed = parse_args(args);
287
+ let value = crate::direct_delivery::locate(&workspace(&parsed, cwd), parsed.team.as_deref()).map_err(CliError::Usage)?;
288
+ Ok(emit_result(CmdResult::from_json(value, parsed.json)))
289
+ },
290
+ "schedule" => super::schedule::run(args, cwd).map(emit_result),
275
291
  "status" => cmd_status_for_team(&status_args(args, cwd), parse_args(args).team.as_deref())
276
292
  .map(emit_result),
277
293
  "shutdown" => cmd_shutdown(&shutdown_args(args, cwd)?).map(emit_result),
@@ -353,7 +369,7 @@ pub(crate) fn default_help() -> String {
353
369
  append_help_section(
354
370
  &mut out,
355
371
  "Getting started",
356
- &["start", "quick-start", "send", "status", "models", "inbox"],
372
+ &["start", "quick-start", "send", "schedule", "status", "models", "inbox"],
357
373
  );
358
374
  append_help_section(&mut out, "Team lifecycle", &["stop", "team", "restart", "shutdown"]);
359
375
  append_help_section(
@@ -373,7 +389,7 @@ pub(crate) fn default_help() -> String {
373
389
  append_help_section(
374
390
  &mut out,
375
391
  "Observation and collaboration",
376
- &["leaders", "doctor", "approvals"],
392
+ &["locate", "leaders", "doctor", "approvals"],
377
393
  );
378
394
  append_help_section(
379
395
  &mut out,
@@ -450,9 +466,14 @@ pub(super) fn command_help(command: Option<&str>) -> String {
450
466
  "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.",
451
467
  "team-agent quick-start\nteam-agent quick-start ./roles --workspace ./project\nteam-agent quick-start . --json",
452
468
  "Compatibility bridge only. In the authorized Leader context, prefer team-agent start --from TEAMDIR for complete new configuration and team-agent start for later activation. Check models and native sign-in first; inspect status and actual replies after starting."),
453
- "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.",
469
+ "send" => ("<agent> is an agent name from the read-only endpoint snapshot; MESSAGE is the task text.\nPaste + Enter completes synchronously without coordinator queues or SQLite writes. Physical success is not provider acceptance.\n--socket SOCKET --pane %N --dialect PROVIDER sends directly without a workspace snapshot. Automatic snapshot provider aliases select the native sequence: Claude/Cursor 100ms, Grok 150ms, Pi/Codex no floor, then one Enter.\nExplicit double-enter submits twice; cursor-double-enter retains Cursor\'s 100ms floor. No automatic retry or third Enter.\n--mailbox appends to the independent inbox without injecting into the conversation.",
454
470
  "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",
455
471
  "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."),
472
+ "locate" => ("Read the endpoint snapshot and list live tmux panes without starting or contacting the coordinator.",
473
+ "team-agent locate --workspace . --json\nteam-agent locate --team help-demo", "Use the socket, pane_id and dialect for raw send, or the agent name for workspace-scoped send."),
474
+ "schedule" => ("add requires exactly one of --in or --every and non-empty --text. Durations are positive integers followed by ms, s, m, h or d.\nlist shows active reminders; cancel takes the sched_<hex> id returned by add.",
475
+ "team-agent schedule add --in 10m --text 'Check progress'\nteam-agent schedule add --every 1h --text 'Review status'\nteam-agent schedule list --json\nteam-agent schedule cancel sched_1",
476
+ "Uses the existing coordinator timer; schedules survive daemon restarts. Delivery has tick granularity. Cancellation stops future occurrences, not reminders already firing or queued. A stopped coordinator resumes timers when restarted, without replaying missed intervals."),
456
477
  "inbox" => ("<agent> is the recipient name; -n/--limit bounds the message count. Reading replies does not resend messages.",
457
478
  "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."),
458
479
  "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.",
@@ -904,6 +925,7 @@ struct ParsedArgs {
904
925
  to_leader: Option<String>,
905
926
  provider: Option<String>,
906
927
  socket: Option<String>,
928
+ dialect: Option<String>,
907
929
  thread_id: Option<String>,
908
930
  message_id: Option<String>,
909
931
  mailbox: bool,
@@ -1006,6 +1028,7 @@ fn parse_args(args: &[String]) -> ParsedArgs {
1006
1028
  "--to-leader" => parsed.to_leader = next_arg(args, &mut i),
1007
1029
  "--provider" => parsed.provider = next_arg(args, &mut i),
1008
1030
  "--socket" => parsed.socket = next_arg(args, &mut i),
1031
+ "--dialect" => parsed.dialect = next_arg(args, &mut i),
1009
1032
  "--thread-id" => parsed.thread_id = next_arg(args, &mut i),
1010
1033
  "--message-id" => parsed.message_id = next_arg(args, &mut i),
1011
1034
  "--mailbox" => parsed.mailbox = true,
@@ -1644,8 +1667,7 @@ fn role_agent_args(
1644
1667
  match flag {
1645
1668
  "--provider" => {
1646
1669
  // A contract name is written as the leaf's public name (`agent` →
1647
- // `cursor`, `claude_code` → `claude`, `codex_cli` → `codex`); it
1648
- // declares the same leaf.
1670
+ // `cursor`, `codex_cli` → `codex`); it declares the same leaf.
1649
1671
  #[cfg(unix)]
1650
1672
  let contract = crate::contract_runtime::registry::declared(&value)
1651
1673
  .map(crate::contract_runtime::registry::public_name);
@@ -1690,11 +1712,6 @@ fn role_agent_args(
1690
1712
  "add-agent requires --provider <name>".into(),
1691
1713
  ));
1692
1714
  }
1693
- if role.bypass.is_none() {
1694
- return Err(CliError::Usage(
1695
- "add-agent requires --bypass <true|false>".into(),
1696
- ));
1697
- }
1698
1715
  }
1699
1716
  if parsed.positionals.len() != 1 {
1700
1717
  return Err(CliError::Usage(
@@ -1717,10 +1734,9 @@ mod role_cli_tests {
1717
1734
  }
1718
1735
 
1719
1736
  #[test]
1720
- fn add_requires_decisions_without_a_template_but_accepts_file_input() {
1737
+ fn add_requires_provider_without_a_template_but_accepts_file_input() {
1721
1738
  for args in [
1722
1739
  vec!["w"],
1723
- vec!["w", "--provider", "pi"],
1724
1740
  vec!["w", "--bypass", "false"],
1725
1741
  ] {
1726
1742
  assert!(role_agent_args(&strings(&args), true).is_err());
@@ -1751,12 +1767,10 @@ mod role_cli_tests {
1751
1767
  for (name, leaf) in [
1752
1768
  ("cursor", "cursor"), ("cursor-agent", "cursor"), ("agent", "cursor"),
1753
1769
  ("cursor_agent", "cursor"), ("kiro", "kiro"),
1754
- // Claude Code, Codex, Grok Build and Pi keep their public command
1755
- // names, which declare the leaf.
1756
- ("claude", "claude"), ("claude_code", "claude"), ("claude-code", "claude"),
1757
- ("claude_tui", "claude"), ("codex", "codex"), ("codex_cli", "codex"),
1758
- ("codex-cli", "codex"), ("codex_tui", "codex"), ("grok", "grok"),
1759
- ("grok_build", "grok"), ("pi", "pi"), ("pi_tui", "pi"),
1770
+ // Codex and Grok Build keep their public command names, which
1771
+ // declare the leaf.
1772
+ ("codex", "codex"), ("codex_cli", "codex"), ("codex-cli", "codex"),
1773
+ ("codex_tui", "codex"), ("grok", "grok"), ("grok_build", "grok"),
1760
1774
  ] {
1761
1775
  let (_, patch) = role_agent_args(
1762
1776
  &strings(&["w", "--provider", name, "--bypass", "true"]), true,
@@ -1766,6 +1780,23 @@ mod role_cli_tests {
1766
1780
  assert!(role_agent_args(&strings(&["w", "--provider", "Cursor", "--bypass", "true"]), true).is_err());
1767
1781
  }
1768
1782
 
1783
+ #[test]
1784
+ fn add_accepts_bypass_true_false_or_omission_for_every_provider() {
1785
+ for &provider in crate::provider::wire::all_providers() {
1786
+ let provider = crate::provider::wire::provider_wire(provider);
1787
+ let (_, patch) = role_agent_args(&strings(&["w", "--provider", provider]), true).unwrap();
1788
+ assert_eq!(patch.bypass, None);
1789
+ for bypass in ["true", "false"] {
1790
+ let (_, patch) = role_agent_args(
1791
+ &strings(&["w", "--provider", provider, "--bypass", bypass]),
1792
+ true,
1793
+ )
1794
+ .unwrap();
1795
+ assert_eq!(patch.bypass, Some(bypass == "true"));
1796
+ }
1797
+ }
1798
+ }
1799
+
1769
1800
  #[test]
1770
1801
  fn strict_role_options_reject_ambiguous_values() {
1771
1802
  for args in [
@@ -2220,8 +2251,8 @@ mod tests {
2220
2251
  .collect();
2221
2252
  assert_eq!(
2222
2253
  expected.len(),
2223
- 34,
2224
- "the public catalog adds the four canonical lifecycle surfaces and retires the Cursor launcher"
2254
+ 36,
2255
+ "the public catalog includes endpoint discovery and scheduled leader reminders"
2225
2256
  );
2226
2257
  for spec_name in &expected {
2227
2258
  assert!(
@@ -2349,6 +2380,7 @@ mod tests {
2349
2380
  &["--workspace", "--team-id", "--yes", "--json"][..],
2350
2381
  ),
2351
2382
  ("send", &["--workspace", "--team", "--json"][..]),
2383
+ ("schedule", &["--in", "--every", "--text", "--workspace", "--team", "--json"][..]),
2352
2384
  (
2353
2385
  "status",
2354
2386
  &["--workspace", "--team", "--summary", "--json", "--detail"][..],
@@ -171,7 +171,7 @@ fn same_provider(left: &str, right: &str) -> bool {
171
171
  crate::provider::wire::parse_provider(right),
172
172
  ) {
173
173
  (Some(left), Some(right)) => left == right,
174
- _ => left == right,
174
+ _ => crate::contract_runtime::registry::same_provider(left, right),
175
175
  }
176
176
  }
177
177
  fn drift(row: &Value, compiled: &Value) -> bool {
@@ -231,6 +231,7 @@ fn check_native_noop_settings(
231
231
  &selected.run_workspace,
232
232
  &selected.team_dir,
233
233
  &selected.team_key,
234
+ Some(id),
234
235
  ))?
235
236
  .ok_or_else(|| refusal("missing native configuration"))?;
236
237
  let current = config
@@ -338,7 +339,7 @@ fn observe(selected: &SelectedTeam, id: &str, row: &Value) -> Result<Observation
338
339
  ))?;
339
340
  let seat = checked(backend.store.seat(&checked(SeatId::new(id))?))?
340
341
  .ok_or_else(|| refusal("missing canonical native seat"))?;
341
- if provider(row) != seat.provider.as_str()
342
+ if !same_provider(provider(row), seat.provider.as_str())
342
343
  || row.get("contract_scope").and_then(Value::as_str)
343
344
  != Some(seat.identity.scope.as_str())
344
345
  || row.get("contract_instance").and_then(Value::as_str)
@@ -425,7 +426,9 @@ fn observe(selected: &SelectedTeam, id: &str, row: &Value) -> Result<Observation
425
426
  let command = matches[0].current_command.as_deref().unwrap_or("");
426
427
  let positive_command = command == crate::provider::wire::command_name(native)
427
428
  || crate::leader::provider_attribution::command_matches_provider(native, command)
428
- || (!command.is_empty() && !shell_carrier(command) && launched_as_provider(pid, native));
429
+ // A shell-supervised worker retains its native argv[0] in this exact
430
+ // pane's live process tree; shell-only/stale-screen carriers still fail.
431
+ || (!command.is_empty() && launched_as_provider(pid, native));
429
432
  let positive_surface = if !positive_command && !command.is_empty() {
430
433
  let frame = checked(
431
434
  backend.observe_native_input(&Target::Pane(PaneId::new(pane.unwrap_or(""))), native),
@@ -494,6 +497,18 @@ fn check_incarnation_cwd(selected: &SelectedTeam, row: &Value) -> Result<(), Cli
494
497
  }
495
498
  Ok(())
496
499
  }
500
+ fn admit_seat_preflight(plan: &mut Plan, id: &str, team: bool, result: Result<(), CliError>) -> Result<bool, CliError> {
501
+ match result {
502
+ Ok(()) => Ok(true),
503
+ Err(error) if team && plan.intent.verb == Verb::Start => {
504
+ plan.skipped.push(json!({"agent":id,"reason":"preflight_blocked",
505
+ "error":crate::redaction::redact_external_text(&error.to_string())}));
506
+ Ok(false)
507
+ }
508
+ Err(error) => Err(error),
509
+ }
510
+ }
511
+
497
512
  fn preflight_start(
498
513
  selected: &SelectedTeam,
499
514
  id: &str,
@@ -506,6 +521,7 @@ fn preflight_start(
506
521
  &selected.run_workspace,
507
522
  &selected.team_dir,
508
523
  &selected.team_key,
524
+ Some(id),
509
525
  ))?
510
526
  .ok_or_else(|| refusal("missing native role config"))?;
511
527
  let role = config
@@ -937,6 +953,11 @@ fn plan_with_observer(
937
953
  let p = selected.team_dir.join("agents").join(format!("{id}.md"));
938
954
  p.is_file().then_some(p)
939
955
  });
956
+ let admission = checked(crate::contract_runtime::framework::team_config(
957
+ &selected.run_workspace, &selected.team_dir, &selected.team_key, Some(&id))).map(|_| ());
958
+ if !admit_seat_preflight(&mut plan, &id, team, admission)? {
959
+ continue;
960
+ }
940
961
  add(&mut plan, &selected, &id, source)?;
941
962
  continue;
942
963
  };
@@ -968,7 +989,10 @@ fn plan_with_observer(
968
989
  if actions.is_empty() {
969
990
  if obs == Observation::Live && plan.intent.verb == Verb::Start {
970
991
  let (_, compiled) = role(&mut plan, &selected, &id, None)?;
971
- check_native_noop_settings(&selected, &id, row)?;
992
+ let admission = check_native_noop_settings(&selected, &id, row);
993
+ if !admit_seat_preflight(&mut plan, &id, team, admission)? {
994
+ continue;
995
+ }
972
996
  if drift(row, &compiled) {
973
997
  return Err(refusal(format!(
974
998
  "known launch configuration drift for running {id}; stop before applying"
@@ -982,7 +1006,10 @@ fn plan_with_observer(
982
1006
  if !same_provider(provider(row), provider(&compiled)) {
983
1007
  return Err(refusal("registered provider cannot change"));
984
1008
  }
985
- preflight_start(&selected, &id, row, plan.intent.session)?;
1009
+ let admission = preflight_start(&selected, &id, row, plan.intent.session);
1010
+ if !admit_seat_preflight(&mut plan, &id, team, admission)? {
1011
+ continue;
1012
+ }
986
1013
  }
987
1014
  for action in actions {
988
1015
  match action {