@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
@@ -0,0 +1,144 @@
1
+ use std::fs::OpenOptions;
2
+ use std::io::Write;
3
+ use std::path::{Path, PathBuf};
4
+ use std::process::{Command, Stdio};
5
+ use std::time::{Duration, Instant};
6
+
7
+ const CHILD_FLAG: &str = "--team-agent-models-timeout-child";
8
+ const LIST_MODELS_FLAG: &str = "--list-models";
9
+ const RECEIPT_ENV: &str = "TEAM_AGENT_MODELS_TIMEOUT_RECEIPT";
10
+ const STAGE_RECEIPT_ENV: &str = "TEAM_AGENT_MODELS_TIMEOUT_STAGE_RECEIPT";
11
+ const MODE_ENV: &str = "TEAM_AGENT_MODELS_TIMEOUT_MODE";
12
+ const STDOUT_MARKER: &[u8] = b"__team_agent_models_timeout_descendant_stdout_v1__\n";
13
+ const PARENT_HANDOFF_TIMEOUT: Duration = Duration::from_secs(1);
14
+
15
+ // Stage values are UNIX epoch milliseconds so the test process and helper use
16
+ // one directly comparable clock. Stage writes are best-effort diagnostics and
17
+ // never change the fixture's production-facing exit semantics.
18
+ fn append_stage(key: &str) {
19
+ let Some(path) = std::env::var_os(STAGE_RECEIPT_ENV) else {
20
+ return;
21
+ };
22
+ let Some(milliseconds) = std::time::SystemTime::now()
23
+ .duration_since(std::time::UNIX_EPOCH)
24
+ .ok()
25
+ .map(|duration| duration.as_millis())
26
+ else {
27
+ return;
28
+ };
29
+ let _ = append_receipt(Path::new(&path), key, milliseconds);
30
+ }
31
+
32
+ fn receipt_path() -> PathBuf {
33
+ std::env::var_os(RECEIPT_ENV)
34
+ .map(PathBuf::from)
35
+ .unwrap_or_else(|| std::process::exit(4))
36
+ }
37
+
38
+ fn append_receipt(path: &Path, key: &str, value: impl std::fmt::Display) -> Result<(), ()> {
39
+ let mut receipt = OpenOptions::new()
40
+ .create(true)
41
+ .append(true)
42
+ .open(path)
43
+ .map_err(|_| ())?;
44
+ writeln!(receipt, "{key}={value}").map_err(|_| ())
45
+ }
46
+
47
+ fn wait_for_parent_handoff(receipt: &Path) {
48
+ let expected = format!("child_pid={}", std::process::id());
49
+ let deadline = Instant::now() + PARENT_HANDOFF_TIMEOUT;
50
+ loop {
51
+ if std::fs::read_to_string(receipt)
52
+ .ok()
53
+ .is_some_and(|text| text.lines().any(|line| line == expected))
54
+ {
55
+ return;
56
+ }
57
+ if Instant::now() >= deadline {
58
+ std::process::exit(5);
59
+ }
60
+ std::thread::sleep(Duration::from_millis(1));
61
+ }
62
+ }
63
+
64
+ fn child_main(args: &[String]) {
65
+ if args.len() != 1 || args[0] != CHILD_FLAG {
66
+ std::process::exit(5);
67
+ }
68
+ let receipt = receipt_path();
69
+ wait_for_parent_handoff(&receipt);
70
+
71
+ let mut stdout = std::io::stdout();
72
+ if stdout.write_all(STDOUT_MARKER).is_err() || stdout.flush().is_err() {
73
+ std::process::exit(5);
74
+ }
75
+ if append_receipt(&receipt, "child_argv_exact", 1).is_err()
76
+ || append_receipt(&receipt, "descendant_pid", std::process::id()).is_err()
77
+ || append_receipt(&receipt, "descendant_started", 1).is_err()
78
+ || append_receipt(&receipt, "descendant_stdout_inherited", 1).is_err()
79
+ {
80
+ std::process::exit(5);
81
+ }
82
+
83
+ std::thread::sleep(Duration::from_secs(2));
84
+ }
85
+
86
+ fn main() {
87
+ let args: Vec<String> = std::env::args().skip(1).collect();
88
+ if args.first().is_some_and(|arg| arg == CHILD_FLAG) {
89
+ child_main(&args);
90
+ return;
91
+ }
92
+ if args.len() != 1 || args[0] != LIST_MODELS_FLAG {
93
+ std::process::exit(2);
94
+ }
95
+
96
+ match std::env::var(MODE_ENV) {
97
+ Ok(mode) if mode == "exit7" => {
98
+ eprintln!("sensitive-token");
99
+ std::process::exit(7);
100
+ }
101
+ Ok(mode) if mode == "oversize" => {
102
+ let mut stdout = std::io::stdout();
103
+ let bytes = [b'x'; 64];
104
+ let _ = stdout.write_all(&bytes);
105
+ let _ = stdout.flush();
106
+ return;
107
+ }
108
+ Ok(mode) if mode == "sleep" => {
109
+ std::thread::sleep(Duration::from_secs(2));
110
+ return;
111
+ }
112
+ Ok(mode) if mode == "descendant" => {}
113
+ Err(std::env::VarError::NotPresent) => {}
114
+ Ok(_) | Err(std::env::VarError::NotUnicode(_)) => std::process::exit(2),
115
+ }
116
+
117
+ append_stage("parent_entry_ms");
118
+ let receipt = receipt_path();
119
+ if append_receipt(&receipt, "parent_started_once", 1).is_err()
120
+ || append_receipt(&receipt, "parent_argv_exact", 1).is_err()
121
+ || append_receipt(&receipt, "parent_pid", std::process::id()).is_err()
122
+ || append_receipt(&receipt, "child_spawn_attempts", 1).is_err()
123
+ {
124
+ std::process::exit(4);
125
+ }
126
+
127
+ let executable = std::env::current_exe().unwrap_or_else(|_| std::process::exit(4));
128
+ append_stage("parent_before_child_spawn_ms");
129
+ let child = Command::new(executable)
130
+ .arg(CHILD_FLAG)
131
+ .env(RECEIPT_ENV, &receipt)
132
+ .stdin(Stdio::null())
133
+ .stdout(Stdio::inherit())
134
+ .stderr(Stdio::null())
135
+ .spawn()
136
+ .unwrap_or_else(|_| std::process::exit(4));
137
+ append_stage("parent_after_child_spawn_ms");
138
+ if append_receipt(&receipt, "child_pid", child.id()).is_err() {
139
+ std::process::exit(4);
140
+ }
141
+ append_stage("parent_before_exit_ms");
142
+ // The parent exits successfully without waiting; the child retains the
143
+ // inherited stdout pipe and self-exits after the real reader deadline.
144
+ }
@@ -4101,154 +4101,3 @@ fn wrap_gap_true_on_joined_token_a_cannot_see() {
4101
4101
  "B must still cover the wrap gap A cannot see"
4102
4102
  );
4103
4103
  }
4104
-
4105
- // ═════════════════════════════════════════════════════════════════════════
4106
- // #379: Claude Code echoes the submitted turn right above its composer box
4107
- // ═════════════════════════════════════════════════════════════════════════
4108
-
4109
- const CLAUDE_379_MARKER: &str = "[team-agent-token:msg_claude379]";
4110
-
4111
- /// A 56-column Claude Code 2.1.309 pane as tmux captures it: history, the rows
4112
- /// above the box, the composer between two rules (`❯` + U+00A0), then the footer.
4113
- fn claude_379_frame(history: &str, above: &str, composer: &str) -> String {
4114
- let rule = "─".repeat(56);
4115
- format!(
4116
- "{history}\n\n{above}\n ◐ medium · /effort\n{rule}\n❯\u{a0}{composer}\n{rule}\n ⏵⏵ bypass permissions on (shift+tab to cycle)\n"
4117
- )
4118
- }
4119
-
4120
- fn claude_379_payload() -> String {
4121
- format!("Team Agent message from leader:\n\nline1\nline2\n\n{CLAUDE_379_MARKER}")
4122
- }
4123
-
4124
- /// The submitted turn as Claude draws it in history: `❯` then indented rows.
4125
- fn claude_379_echo() -> String {
4126
- claude_379_payload()
4127
- .lines()
4128
- .enumerate()
4129
- .map(|(i, line)| match (i, line.is_empty()) {
4130
- (0, _) => format!("❯ {line}"),
4131
- (_, true) => String::new(),
4132
- _ => format!(" {line}"),
4133
- })
4134
- .collect::<Vec<_>>()
4135
- .join("\n")
4136
- }
4137
-
4138
- #[test]
4139
- fn issue379_history_echo_above_the_claude_box_is_not_composer() {
4140
- let text = normalize_capture(&claude_379_frame(&claude_379_echo(), "· Waddling…", ""));
4141
- assert!(
4142
- super::token_in_bottom_n(&text, CLAUDE_379_MARKER, 15),
4143
- "fixture: the echo sits inside the legacy bottom-15 window"
4144
- );
4145
- assert!(!super::should_resubmit_enter(&text, CLAUDE_379_MARKER, None));
4146
- assert_eq!(
4147
- super::consumption_from_capture(&text, CLAUDE_379_MARKER, true, None),
4148
- Some(true)
4149
- );
4150
- assert_eq!(
4151
- super::consumption_from_capture(
4152
- &text,
4153
- CLAUDE_379_MARKER,
4154
- false,
4155
- Some(super::PasteLatch::HashId(1))
4156
- ),
4157
- Some(true)
4158
- );
4159
- // The token still between the rules is still composer.
4160
- let pending = normalize_capture(&claude_379_frame("", "", &format!("ping {CLAUDE_379_MARKER}")));
4161
- assert!(super::should_resubmit_enter(&pending, CLAUDE_379_MARKER, None));
4162
- assert_eq!(
4163
- super::consumption_from_capture(&pending, CLAUDE_379_MARKER, true, None),
4164
- Some(false)
4165
- );
4166
- }
4167
-
4168
- #[test]
4169
- fn issue379_claude_busy_is_the_live_spinner_row_not_a_glyph_scan() {
4170
- for spinner in ["· Waddling…", "✻ Baking… (3s · thinking)", "✽ Beboppin'…"] {
4171
- let text = normalize_capture(&claude_379_frame("❯ question", spinner, ""));
4172
- let busy = super::provider_busy_signal_match(&text);
4173
- assert_eq!(
4174
- busy.map(|signal| signal.kind),
4175
- Some(BusySignalKind::SpinnerGlyph),
4176
- "{spinner}"
4177
- );
4178
- assert_eq!(
4179
- observe_turn_from_capture(&text, Some(CLAUDE_379_MARKER)),
4180
- TurnVerification::LeaderNewTurnBoundaryVerified
4181
- );
4182
- }
4183
- // Todo rows under the spinner push it past the bottom window; still busy.
4184
- let todos = "✶ Sprouting…\n ⎿ ☐ one\n ☐ two\n ☐ three\n ☐ four\n ☐ five\n ☐ six";
4185
- let text = normalize_capture(&claude_379_frame("❯ question", todos, ""));
4186
- assert!(super::provider_busy_signal_match(&text).is_some());
4187
- // A finished turn's summary and transcript prose are not a live turn.
4188
- let done = normalize_capture(&claude_379_frame(
4189
- "❯ question\n\n⏺ Still working on thinking about it.",
4190
- "✻ Worked for 3s",
4191
- "",
4192
- ));
4193
- assert!(super::provider_busy_signal_match(&done).is_none());
4194
- // Queued input is native custody: busy, and not composer text.
4195
- let queued = normalize_capture(&claude_379_frame(
4196
- &claude_379_echo(),
4197
- "",
4198
- "Press up to edit queued messages",
4199
- ));
4200
- assert!(super::provider_busy_signal_match(&queued).is_some());
4201
- assert!(!super::should_resubmit_enter(&queued, CLAUDE_379_MARKER, None));
4202
- }
4203
-
4204
- #[test]
4205
- fn issue379_claude_submit_verifies_on_the_first_enter() {
4206
- let folded = claude_379_frame("⏺ earlier reply", "", "[Pasted text #1 +5 lines]");
4207
- let submitted = claude_379_frame(&claude_379_echo(), "· Waddling… (1s · thinking)", "");
4208
- let (be, rec) = backend_folded(&folded, &submitted);
4209
- let report = be
4210
- .inject(
4211
- &Target::Pane(PaneId::new("%7")),
4212
- &InjectPayload::Text(claude_379_payload()),
4213
- Key::Enter,
4214
- true,
4215
- )
4216
- .expect("inject");
4217
- assert_eq!(
4218
- report.submit_verification,
4219
- SubmitVerification::EnterSentWithoutPlaceholderCheck
4220
- );
4221
- let calls = rec.lock().unwrap().clone();
4222
- assert_eq!(count_submit_enters(&calls), 1, "no extra Enter into an empty composer; calls={calls:?}");
4223
- // Enter not taken: the folded paste stays between the rules.
4224
- let (be, _rec) = backend_folded(&folded, &folded);
4225
- let report = be
4226
- .inject(
4227
- &Target::Pane(PaneId::new("%7")),
4228
- &InjectPayload::Text(claude_379_payload()),
4229
- Key::Enter,
4230
- true,
4231
- )
4232
- .expect("inject");
4233
- assert_eq!(
4234
- report.submit_verification,
4235
- SubmitVerification::SubmitConsumptionUnverified
4236
- );
4237
- }
4238
-
4239
- #[test]
4240
- fn issue379_busy_seen_in_any_post_enter_sample_survives_a_quiet_final_frame() {
4241
- let mut diagnostics = super::ConsumptionDiagnostics::default();
4242
- let busy = normalize_capture(&claude_379_frame("❯ question", "✳ Moseying…", ""));
4243
- let quiet = normalize_capture(&claude_379_frame("❯ question", "⏺ Streaming reply", ""));
4244
- for text in [&busy, &quiet] {
4245
- diagnostics.record(super::consumption_capture_observation(
4246
- text,
4247
- Some(CLAUDE_379_MARKER),
4248
- false,
4249
- None,
4250
- ));
4251
- }
4252
- assert!(diagnostics.busy_seen);
4253
- assert!(diagnostics.busy_signal_kind.is_none(), "latest sample stays as observed");
4254
- }
@@ -1892,16 +1892,6 @@ fn token_in_bottom_n(text: &str, marker: &str, n: usize) -> bool {
1892
1892
  .any(|line| line.contains(marker))
1893
1893
  }
1894
1894
 
1895
- /// #379: Claude Code echoes the submitted turn right above its composer box,
1896
- /// well inside the bottom-15 window. When that box is recognized only the text
1897
- /// between its rules is composer; otherwise the whole tail stays in charge.
1898
- fn composer_view(text: &str) -> std::borrow::Cow<'_, str> {
1899
- match team_agent_contract::providers::claude::interaction::inspect_legacy_composer(text) {
1900
- Some((_, current)) => std::borrow::Cow::Owned(current),
1901
- None => std::borrow::Cow::Borrowed(text),
1902
- }
1903
- }
1904
-
1905
1895
  /// purpose: token 在本轮注入中的三态观测
1906
1896
  /// contract:
1907
1897
  /// - Visible: 当前 capture 可见
@@ -2021,7 +2011,7 @@ fn latch_paste(text: &str, current: Option<PasteLatch>) -> Option<PasteLatch> {
2021
2011
  if current.is_some() {
2022
2012
  return current;
2023
2013
  }
2024
- let prompt = pasted_prompt_in_composer(&composer_view(text), 15)?;
2014
+ let prompt = pasted_prompt_in_composer(text, 15)?;
2025
2015
  if let Some(id) = prompt.id {
2026
2016
  return Some(PasteLatch::HashId(id));
2027
2017
  }
@@ -2064,7 +2054,6 @@ fn consumption_from_placeholder(text: &str, tracked: Option<PasteLatch>) -> Opti
2064
2054
  /// boundary: 不重粘文本;不把不同 grok 行数当成可重按的同一次;tracked 为 None 时占位符路径一律不重按(token 仍在底 15 非空行的重按与 tracked 无关)
2065
2055
  /// ---
2066
2056
  pub(crate) fn should_resubmit_enter(text: &str, marker: &str, tracked: Option<PasteLatch>) -> bool {
2067
- let text = &*composer_view(text);
2068
2057
  if token_in_bottom_n(text, marker, 15) {
2069
2058
  return true;
2070
2059
  }
@@ -2099,8 +2088,7 @@ pub(crate) fn this_paste_identity_in_composer(
2099
2088
  marker: &str,
2100
2089
  tracked: Option<PasteLatch>,
2101
2090
  ) -> bool {
2102
- should_resubmit_enter(text, marker, tracked)
2103
- || composer_joined(&composer_view(text), 15).contains(marker)
2091
+ should_resubmit_enter(text, marker, tracked) || composer_joined(text, 15).contains(marker)
2104
2092
  }
2105
2093
 
2106
2094
  /// ---
@@ -2162,7 +2150,6 @@ pub(crate) fn should_resubmit_enter_cursor(text: &str, marker: &str) -> bool {
2162
2150
  /// boundary: token 出现在未折叠的高块里不算完成(按早了);只判「能不能按」,不判「按了有没有成」
2163
2151
  /// ---
2164
2152
  pub(crate) fn paste_ready_for_enter(text: &str, marker: &str) -> bool {
2165
- let text = &*composer_view(text);
2166
2153
  if pasted_prompt_in_composer(text, 15).is_some() {
2167
2154
  return true;
2168
2155
  }
@@ -2199,7 +2186,6 @@ pub(crate) fn consumption_from_capture(
2199
2186
  token_ever_visible: bool,
2200
2187
  tracked: Option<PasteLatch>,
2201
2188
  ) -> Option<bool> {
2202
- let text = &*composer_view(text);
2203
2189
  let token_now = token_in_bottom_n(text, marker, 15);
2204
2190
  match token_sighting(token_now, token_ever_visible) {
2205
2191
  TokenSighting::Visible => Some(false),
@@ -2246,13 +2232,10 @@ struct ConsumptionDiagnostics {
2246
2232
  current_marker_in_bottom_15: Option<bool>,
2247
2233
  paste_identity_in_composer: Option<bool>,
2248
2234
  consumption_from_capture_result: Option<bool>,
2249
- /// Busy in any post-Enter sample: one final frame lands on a random spinner phase.
2250
- busy_seen: bool,
2251
2235
  }
2252
2236
 
2253
2237
  impl ConsumptionDiagnostics {
2254
2238
  fn record(&mut self, observation: ConsumptionCaptureObservation) {
2255
- self.busy_seen |= observation.busy.is_some();
2256
2239
  self.busy_signal_kind = observation.busy.map(|match_| match_.kind);
2257
2240
  self.busy_line_from_bottom = observation.busy.map(|match_| match_.line_from_bottom);
2258
2241
  self.current_marker_in_bottom_15 = observation.marker_in_bottom_15;
@@ -2334,22 +2317,6 @@ fn busy_signal_kind_in_line(line: &str) -> Option<BusySignalKind> {
2334
2317
  }
2335
2318
 
2336
2319
  fn provider_busy_signal_match(text: &str) -> Option<BusySignalMatch> {
2337
- use team_agent_contract::{contract::delivery::InputSurface, providers::claude::interaction};
2338
- // #379: Claude Code's box decides alone. Its spinner glyph animates through
2339
- // `·` and a finished turn leaves `✻ Worked for 3s` in the window, so a
2340
- // per-line glyph scan is neither stable nor live.
2341
- if let Some((surface, _)) = interaction::inspect_legacy_composer(text) {
2342
- let row = text
2343
- .lines()
2344
- .rev()
2345
- .filter(|line| !line.trim().is_empty())
2346
- .position(interaction::spinner_row)
2347
- .unwrap_or(0);
2348
- return (surface == InputSurface::Busy).then_some(BusySignalMatch {
2349
- kind: BusySignalKind::SpinnerGlyph,
2350
- line_from_bottom: u8::try_from(row).unwrap_or(u8::MAX),
2351
- });
2352
- }
2353
2320
  text.lines()
2354
2321
  .rev()
2355
2322
  .filter(|line| !line.trim().is_empty())
@@ -2385,7 +2352,6 @@ pub(crate) fn observe_turn_from_capture(text: &str, marker: Option<&str>) -> Tur
2385
2352
  if provider_busy_signal_in_tail(text) {
2386
2353
  return TurnVerification::LeaderNewTurnBoundaryVerified;
2387
2354
  }
2388
- let text = &*composer_view(text);
2389
2355
  let paste_still = pasted_prompt_in_composer(text, 15).is_some();
2390
2356
  let token_still = marker
2391
2357
  .map(|m| token_in_bottom_n(text, m, 15))
@@ -2417,9 +2383,8 @@ fn submit_attempt_observation(
2417
2383
  let marker_position = marker.and_then(|m| marker_position_from_bottom(&captured.text, m));
2418
2384
  // marker 在时也走 pasted_prompt_match:折叠占位符是编排长粘贴的正信号,
2419
2385
  // 不能只在无 token 载荷上才认。matched 仍表示「composer 里还有待提交信号」。
2420
- let composer = composer_view(&captured.text);
2421
2386
  let (matched, matched_literal, where_in_tail) = if let Some(marker) = marker {
2422
- if token_in_bottom_n(&composer, marker, 15) {
2387
+ if token_in_bottom_n(&captured.text, marker, 15) {
2423
2388
  (
2424
2389
  true,
2425
2390
  marker_position.map(|_| marker.to_string()),
@@ -2427,7 +2392,7 @@ fn submit_attempt_observation(
2427
2392
  )
2428
2393
  } else if let Some((literal, where_in_tail)) = pasted_prompt_match(&captured.text) {
2429
2394
  (
2430
- pasted_prompt_in_composer(&composer, 15).is_some(),
2395
+ pasted_prompt_in_composer(&captured.text, 15).is_some(),
2431
2396
  Some(literal.to_string()),
2432
2397
  Some(where_in_tail),
2433
2398
  )
@@ -3709,7 +3674,7 @@ impl Transport for TmuxBackend {
3709
3674
  marker,
3710
3675
  inject_start.elapsed().as_millis() as u64,
3711
3676
  ));
3712
- if consumption_diagnostics.busy_seen {
3677
+ if observation.busy.is_some() {
3713
3678
  consumption_reason = SubmitConsumptionReason::FallbackBusy;
3714
3679
  SubmitVerification::EnterSentWithoutPlaceholderCheck
3715
3680
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-agent/installer",
3
- "version": "0.5.127",
3
+ "version": "0.5.128",
4
4
  "description": "npx installer for Team Agent",
5
5
  "keywords": [
6
6
  "codex",
@@ -20,9 +20,9 @@
20
20
  "team-agent-installer": "npm/install.mjs"
21
21
  },
22
22
  "optionalDependencies": {
23
- "@team-agent/cli-darwin-arm64": "0.5.127",
24
- "@team-agent/cli-darwin-x64": "0.5.127",
25
- "@team-agent/cli-linux-x64": "0.5.127"
23
+ "@team-agent/cli-darwin-arm64": "0.5.128",
24
+ "@team-agent/cli-darwin-x64": "0.5.128",
25
+ "@team-agent/cli-linux-x64": "0.5.128"
26
26
  },
27
27
  "scripts": {
28
28
  "postinstall": "node npm/bincheck.mjs",
@@ -13,16 +13,15 @@ Check `team-agent --version`, `team-agent start --help` and `team-agent team --h
13
13
 
14
14
  ## User decisions come first
15
15
 
16
- **The user decides each worker's provider and permission bypass. Do not silently choose Pi, true, or false.** Reuse an explicit user policy when it covers the worker; otherwise explain the choices and ask before starting.
16
+ **Honor the user's provider and permission-bypass choices.** Reuse an explicit user policy when it covers the worker. Omitted bypass retains the role or native default; it does not require another permission decision. Pi has no built-in tool approval gate, so `--bypass true` is accepted without inventing a native flag.
17
17
 
18
18
  Use existing resources rather than establishing accounts. `team-agent doctor --workspace . --json` reports discovered tools; installed is not authenticated, and an unknown probe is not proof of unavailability. Use `team-agent models --provider NAME` where supported for exact model IDs. Do not inspect credentials, automatically log in, or silently substitute providers.
19
19
 
20
20
  | Choice | Explain |
21
21
  |---|---|
22
- | Pi | Several model catalogs; every Pi worker needs an exact qualified model ID such as `openai-codex/gpt-6-luna` from `team-agent models --provider pi`; Pi has no permission prompt to bypass, so keep bypass `false` |
23
- | Claude | Every Claude worker needs an exact model ID from `team-agent models --provider claude`; existing subscription login only |
22
+ | Pi | Several model catalogs; an explicit model needs a qualified ID such as `openai-codex/gpt-6-luna` |
24
23
  | Codex / Grok | Every Codex or Grok worker needs an exact model ID from `team-agent models --provider codex` or `team-agent models --provider grok`; existing subscription login only |
25
- | Other native CLIs | The user's existing workflow, native permissions, model catalog and supported session capabilities |
24
+ | Claude / other native CLIs | The user's existing workflow, native permissions, model catalog and supported session capabilities |
26
25
  | Bypass `true` | Fewer interruptions, broader automatic authority |
27
26
  | Bypass `false` | Native permissions remain; human confirmation may interrupt unattended work |
28
27
 
@@ -38,12 +37,11 @@ Keep the goal in `TEAM.md` and each worker's instructions in `agents/*.md`. The
38
37
  agents/reviewer.md
39
38
  ```
40
39
 
41
- Record provider, model and boolean bypass in every new role. This example assumes the user explicitly chose Pi, a model copied from `team-agent models --provider pi`, and bypass false; it is not a default:
40
+ Record provider and boolean bypass in every new role. This example assumes the user explicitly chose Pi and bypass false; it is not a default:
42
41
 
43
42
  ```markdown
44
43
  ---
45
44
  provider: pi
46
- model: openai-codex/gpt-6-luna
47
45
  dangerously_skip_permissions: false
48
46
  ---
49
47
  Review the change and report concrete regression risks.
@@ -91,7 +89,7 @@ With the user's provider/bypass choices, `start` unifies adding an absent seat a
91
89
 
92
90
  ```sh
93
91
  team-agent start auditor --role-file /absolute/path/to/auditor.md
94
- team-agent start analyst --provider pi --model openai-codex/gpt-6-luna --bypass false --prompt "Analyze the proposed change"
92
+ team-agent start analyst --provider pi --bypass false --prompt "Analyze the proposed change"
95
93
  team-agent stop reviewer
96
94
  team-agent start reviewer --effort high --bypass false
97
95
  ```
@@ -624,7 +624,7 @@
624
624
  "plan": "Bind this exact documented argv to an isolated HermeticTestEnv result and an assertion/negative-twin pair before promotion. For lifecycle use an authorized owned team and verify scope, identity, outcome and cleanup; help or readonly plans alone do not establish lifecycle coverage."
625
625
  },
626
626
  {
627
- "command": "team-agent start analyst --provider pi --model openai-codex/gpt-6-luna --bypass false --prompt \"Analyze the proposed change\"",
627
+ "command": "team-agent start analyst --provider pi --bypass false --prompt \"Analyze the proposed change\"",
628
628
  "bucket": "declared_gap",
629
629
  "covered": false,
630
630
  "owner": "runtime-owner:public-cli",
@@ -37,7 +37,7 @@ team-agent start --from ./my-team --workspace . --team project-team
37
37
  team-agent start --from .team/current --workspace . --team project-team
38
38
  team-agent start --help
39
39
  team-agent start --workspace . --team project-team
40
- team-agent start analyst --provider pi --model openai-codex/gpt-6-luna --bypass false --prompt "Analyze the proposed change"
40
+ team-agent start analyst --provider pi --bypass false --prompt "Analyze the proposed change"
41
41
  team-agent start auditor --role-file /absolute/path/to/auditor.md
42
42
  team-agent start reviewer --effort high --bypass false
43
43
  team-agent start reviewer --effort high --bypass false --workspace . --team project-team
@@ -144,7 +144,7 @@ Creation needs complete configuration; start is not automatic template generatio
144
144
 
145
145
  Do not silently pick provider, model, effort or bypass. False preserves native permissions; it is not a read-only or sandbox guarantee. Use supported `models --provider NAME` discovery and retain exact model IDs.
146
146
 
147
- Traditional minimal Markdown remains accepted by the original compiler. Its compatibility interpretation is **not a default for a new user plan**: provider defaults to Pi, bypass to false, and unset effort is left to the provider. Claude, Codex, Grok and Pi workers run only through their contract leaves, which require an exact model ID from `team-agent models --provider claude|codex|grok|pi`; an unset model is refused, never guessed. Team Agent does not infer a role model from TEAM defaults. Contract leaves use only an explicit role effort; legacy explicit TEAM provider_effort remains supported for the remaining legacy roles (Copilot, Gemini); do not invent an effort for unspecified roles.
147
+ Traditional minimal Markdown remains accepted by the original compiler. Its compatibility interpretation is **not a default for a new user plan**: provider defaults to Pi, bypass to false, and unset model/effort are left to the provider. Codex and Grok workers run only through their contract leaves, which require an exact model ID from `team-agent models --provider codex|grok`; an unset model is refused, never guessed. Team Agent does not infer a role model from TEAM defaults. Contract leaves use only an explicit role effort; legacy explicit TEAM provider_effort remains supported for non-Pi legacy roles (Claude, Copilot, Gemini); do not invent an effort for unspecified roles.
148
148
 
149
149
  Supported role metadata:
150
150
  - `agent_id` (legacy `name`) and `role` identify the seat.
@@ -159,7 +159,7 @@ A RoleOnly seat can be registered from its complete role file. A genuinely absen
159
159
 
160
160
  ```sh
161
161
  team-agent start auditor --role-file /absolute/path/to/auditor.md
162
- team-agent start analyst --provider pi --model openai-codex/gpt-6-luna --bypass false --prompt "Analyze the proposed change"
162
+ team-agent start analyst --provider pi --bypass false --prompt "Analyze the proposed change"
163
163
  ```
164
164
 
165
165
  An imported external role goes into this team's `agents/ID.md`; the original stays untouched. A file already at that destination is used in place. Equal file/CLI definitions are accepted; conflicting provider/model/effort/bypass/prompt/profile values refuse before writes/startup. Omitted model, effort, profile and role body remain unchanged.
@@ -37,7 +37,7 @@ team-agent start --from ./my-team --workspace . --team project-team
37
37
  team-agent start --from .team/current --workspace . --team project-team
38
38
  team-agent start --help
39
39
  team-agent start --workspace . --team project-team
40
- team-agent start analyst --provider pi --model openai-codex/gpt-6-luna --bypass false --prompt "Analyze the proposed change"
40
+ team-agent start analyst --provider pi --bypass false --prompt "Analyze the proposed change"
41
41
  team-agent start auditor --role-file /absolute/path/to/auditor.md
42
42
  team-agent start reviewer --effort high --bypass false
43
43
  team-agent start reviewer --effort high --bypass false --workspace . --team project-team
@@ -144,7 +144,7 @@ Creation needs complete configuration; start is not automatic template generatio
144
144
 
145
145
  Do not silently pick provider, model, effort or bypass. False preserves native permissions; it is not a read-only or sandbox guarantee. Use supported `models --provider NAME` discovery and retain exact model IDs.
146
146
 
147
- Traditional minimal Markdown remains accepted by the original compiler. Its compatibility interpretation is **not a default for a new user plan**: provider defaults to Pi, bypass to false, and unset effort is left to the provider. Claude, Codex, Grok and Pi workers run only through their contract leaves, which require an exact model ID from `team-agent models --provider claude|codex|grok|pi`; an unset model is refused, never guessed. Team Agent does not infer a role model from TEAM defaults. Contract leaves use only an explicit role effort; legacy explicit TEAM provider_effort remains supported for the remaining legacy roles (Copilot, Gemini); do not invent an effort for unspecified roles.
147
+ Traditional minimal Markdown remains accepted by the original compiler. Its compatibility interpretation is **not a default for a new user plan**: provider defaults to Pi, bypass to false, and unset model/effort are left to the provider. Codex and Grok workers run only through their contract leaves, which require an exact model ID from `team-agent models --provider codex|grok`; an unset model is refused, never guessed. Team Agent does not infer a role model from TEAM defaults. Contract leaves use only an explicit role effort; legacy explicit TEAM provider_effort remains supported for non-Pi legacy roles (Claude, Copilot, Gemini); do not invent an effort for unspecified roles.
148
148
 
149
149
  Supported role metadata:
150
150
  - `agent_id` (legacy `name`) and `role` identify the seat.
@@ -159,7 +159,7 @@ A RoleOnly seat can be registered from its complete role file. A genuinely absen
159
159
 
160
160
  ```sh
161
161
  team-agent start auditor --role-file /absolute/path/to/auditor.md
162
- team-agent start analyst --provider pi --model openai-codex/gpt-6-luna --bypass false --prompt "Analyze the proposed change"
162
+ team-agent start analyst --provider pi --bypass false --prompt "Analyze the proposed change"
163
163
  ```
164
164
 
165
165
  An imported external role goes into this team's `agents/ID.md`; the original stays untouched. A file already at that destination is used in place. Equal file/CLI definitions are accepted; conflicting provider/model/effort/bypass/prompt/profile values refuse before writes/startup. Omitted model, effort, profile and role body remain unchanged.