@team-agent/installer 0.5.123 → 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.
- package/Cargo.lock +1 -8
- package/Cargo.toml +1 -1
- package/README.md +2 -2
- package/README.zh.md +2 -2
- package/crates/team-agent/Cargo.toml +0 -1
- package/crates/team-agent/src/cli/diagnose.rs +39 -1
- package/crates/team-agent/src/cli/emit.rs +41 -15
- package/crates/team-agent/src/cli/intent/runtime.rs +30 -54
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +59 -118
- package/crates/team-agent/src/cli/leader.rs +2 -3
- package/crates/team-agent/src/cli/leader_prompt.rs +1 -1
- package/crates/team-agent/src/cli/mod.rs +6 -5
- package/crates/team-agent/src/cli/models.rs +93 -128
- package/crates/team-agent/src/cli/route.rs +1 -1
- package/crates/team-agent/src/cli/send/persist.rs +36 -0
- package/crates/team-agent/src/cli/send/presentation.rs +7 -1
- package/crates/team-agent/src/cli/send.rs +3 -1
- package/crates/team-agent/src/cli/spec.rs +1 -2
- package/crates/team-agent/src/cli/status_port/brief.rs +66 -0
- package/crates/team-agent/src/cli/tests/base.rs +4 -11
- package/crates/team-agent/src/cli/tests/status_send.rs +17 -0
- package/crates/team-agent/src/compiler/tests.rs +21 -5
- package/crates/team-agent/src/compiler.rs +24 -1
- package/crates/team-agent/src/contract_runtime/backend.rs +30 -6
- package/crates/team-agent/src/contract_runtime/config.rs +34 -24
- package/crates/team-agent/src/contract_runtime/discovery.rs +79 -56
- package/crates/team-agent/src/contract_runtime/framework.rs +89 -34
- package/crates/team-agent/src/contract_runtime/registry.rs +299 -24
- package/crates/team-agent/src/coordinator/runtime_detectors.rs +0 -1
- package/crates/team-agent/src/coordinator/tick.rs +89 -1
- package/crates/team-agent/src/db/message_store.rs +78 -3
- package/crates/team-agent/src/layout/worker_window_helpers.rs +0 -1
- package/crates/team-agent/src/leader/prompt.rs +1 -2
- package/crates/team-agent/src/leader/provider_attribution.rs +0 -52
- package/crates/team-agent/src/leader/start.rs +0 -1
- package/crates/team-agent/src/leader/tests/prompt_contract.rs +2 -3
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +91 -0
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +14 -1
- package/crates/team-agent/src/lifecycle/launch/agent_state.rs +0 -9
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +0 -1
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +2 -2
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +19 -101
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +0 -28
- package/crates/team-agent/src/lifecycle/launch/spec_state.rs +0 -1
- package/crates/team-agent/src/lifecycle/launch/worker_env.rs +0 -108
- package/crates/team-agent/src/lifecycle/launch.rs +2 -20
- package/crates/team-agent/src/lifecycle/profile_launch.rs +11 -39
- package/crates/team-agent/src/lifecycle/profile_smoke.rs +1 -2
- package/crates/team-agent/src/lifecycle/restart/common.rs +1 -63
- package/crates/team-agent/src/lifecycle/role_config.rs +42 -3
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +43 -13
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +6 -2
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +1 -3
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +4 -16
- package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +1 -3
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +84 -53
- package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +19 -1
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +21 -0
- package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +0 -1
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +0 -137
- package/crates/team-agent/src/lifecycle/tests.rs +0 -3
- package/crates/team-agent/src/lifecycle/worker_command_context.rs +2 -4
- package/crates/team-agent/src/mcp_server/readiness.rs +148 -97
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +115 -16
- package/crates/team-agent/src/messaging/delivery.rs +186 -38
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +4 -4
- package/crates/team-agent/src/messaging/enter_rescue_tests.rs +1 -1
- package/crates/team-agent/src/messaging/helpers.rs +19 -0
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +66 -4
- package/crates/team-agent/src/messaging/tests/runtime.rs +110 -4
- package/crates/team-agent/src/messaging/tests/spine.rs +22 -6
- package/crates/team-agent/src/model/enums.rs +1 -8
- package/crates/team-agent/src/provider/adapter.rs +1 -67
- package/crates/team-agent/src/provider/adapters/mod.rs +0 -1
- package/crates/team-agent/src/provider/adapters/pi.rs +4 -4
- package/crates/team-agent/src/provider/argv_route.rs +1 -5
- package/crates/team-agent/src/provider/bypass_flags.rs +3 -11
- package/crates/team-agent/src/provider/classify.rs +68 -3
- package/crates/team-agent/src/provider/faults.rs +1 -1
- package/crates/team-agent/src/provider/model_catalog.rs +2 -73
- package/crates/team-agent/src/provider/session/capture.rs +1 -1
- package/crates/team-agent/src/provider/session/context_fork.rs +4 -4
- package/crates/team-agent/src/provider/session_scan/common.rs +1 -2
- package/crates/team-agent/src/provider/session_scan/pi.rs +32 -19
- package/crates/team-agent/src/provider/session_scan.rs +0 -4
- package/crates/team-agent/src/provider/submit_now.rs +5 -28
- package/crates/team-agent/src/provider/tests/adapter.rs +5 -184
- package/crates/team-agent/src/provider/tests/classify.rs +53 -0
- package/crates/team-agent/src/provider/tests/command_helpers.rs +3 -6
- package/crates/team-agent/src/provider/types.rs +1 -1
- package/crates/team-agent/src/provider/wire.rs +48 -8
- package/crates/team-agent/src/tmux_backend/native_input_tests.rs +2 -178
- package/crates/team-agent/src/tmux_backend/tests.rs +151 -0
- package/crates/team-agent/src/tmux_backend.rs +43 -8
- package/crates/team-agent/src/transport/native_input.rs +2 -231
- package/npm/install.mjs +40 -3
- package/package.json +4 -4
- package/skills/team-agent/SKILL.md +1 -1
- package/crates/team-agent/src/lifecycle/launch/cursor_create_chat.rs +0 -229
- package/crates/team-agent/src/lifecycle/launch/cursor_mcp.rs +0 -522
- package/crates/team-agent/src/lifecycle/launch/cursor_mcp_iso.rs +0 -282
- package/crates/team-agent/src/lifecycle/tests/cursor_mcp_overlay.rs +0 -576
- package/crates/team-agent/src/lifecycle/tests/cursor_require_explicit_model_red.rs +0 -222
- package/crates/team-agent/src/lifecycle/tests/cursor_restart_resume_red.rs +0 -511
- package/crates/team-agent/src/provider/adapters/cursor_agent.rs +0 -44
- package/crates/team-agent/src/provider/session_scan/cursor.rs +0 -538
- package/crates/team-agent/src/provider/testdata/cursor-list-models-native.stdout +0 -250
|
@@ -1702,7 +1702,7 @@ thread_local! {
|
|
|
1702
1702
|
static CURSOR_SINGLE_ENTER: Cell<bool> = const { Cell::new(false) };
|
|
1703
1703
|
}
|
|
1704
1704
|
|
|
1705
|
-
/// Run `f` with a paste→Enter floor. Delivery sets 1s for
|
|
1705
|
+
/// Run `f` with a paste→Enter floor. Delivery sets 1s for Grok.
|
|
1706
1706
|
/// Tests pass a small non-zero Duration to cover the sleep branch.
|
|
1707
1707
|
/// Default is ZERO — claude/codex and unset callers pay nothing.
|
|
1708
1708
|
/// This is not TEAM_AGENT_TEST_TMP (that var is a path, always set in seats).
|
|
@@ -1712,7 +1712,7 @@ thread_local! {
|
|
|
1712
1712
|
/// floor: 本次生效的最小间隔;ZERO 表示不等
|
|
1713
1713
|
/// f: 在该地板下执行的闭包
|
|
1714
1714
|
/// returns: 原样返回 f 的返回值
|
|
1715
|
-
/// boundary: thread_local 作用域,不跨线程;只设阈值,真正的等待发生在 sleep_remaining_paste_to_submit_floor;默认 ZERO,只有 delivery 对
|
|
1715
|
+
/// boundary: thread_local 作用域,不跨线程;只设阈值,真正的等待发生在 sleep_remaining_paste_to_submit_floor;默认 ZERO,只有 delivery 对 Grok 才设 1s
|
|
1716
1716
|
/// ---
|
|
1717
1717
|
pub fn with_paste_to_submit_floor<R>(floor: Duration, f: impl FnOnce() -> R) -> R {
|
|
1718
1718
|
PASTE_TO_SUBMIT_FLOOR.with(|cell| {
|
|
@@ -1733,7 +1733,7 @@ pub(crate) fn current_paste_to_submit_floor() -> Duration {
|
|
|
1733
1733
|
}
|
|
1734
1734
|
|
|
1735
1735
|
/// ---
|
|
1736
|
-
/// purpose:
|
|
1736
|
+
/// purpose: 单回车闸(delivery 仅对 Pi 打开;最初为 Cursor 实测)
|
|
1737
1737
|
/// contract: 默认关;打开后重试 Enter 仅当 token 仍在输入区且无 busy
|
|
1738
1738
|
/// boundary: 不改 claude/grok/codex 默认重试;测试隔离下默认关
|
|
1739
1739
|
/// ---
|
|
@@ -1891,6 +1891,16 @@ fn token_in_bottom_n(text: &str, marker: &str, n: usize) -> bool {
|
|
|
1891
1891
|
.any(|line| line.contains(marker))
|
|
1892
1892
|
}
|
|
1893
1893
|
|
|
1894
|
+
/// #379: Claude Code echoes the submitted turn right above its composer box,
|
|
1895
|
+
/// well inside the bottom-15 window. When that box is recognized only the text
|
|
1896
|
+
/// between its rules is composer; otherwise the whole tail stays in charge.
|
|
1897
|
+
fn composer_view(text: &str) -> std::borrow::Cow<'_, str> {
|
|
1898
|
+
match team_agent_contract::providers::claude::interaction::inspect_legacy_composer(text) {
|
|
1899
|
+
Some((_, current)) => std::borrow::Cow::Owned(current),
|
|
1900
|
+
None => std::borrow::Cow::Borrowed(text),
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1894
1904
|
/// purpose: token 在本轮注入中的三态观测
|
|
1895
1905
|
/// contract:
|
|
1896
1906
|
/// - Visible: 当前 capture 可见
|
|
@@ -2010,7 +2020,7 @@ fn latch_paste(text: &str, current: Option<PasteLatch>) -> Option<PasteLatch> {
|
|
|
2010
2020
|
if current.is_some() {
|
|
2011
2021
|
return current;
|
|
2012
2022
|
}
|
|
2013
|
-
let prompt = pasted_prompt_in_composer(text, 15)?;
|
|
2023
|
+
let prompt = pasted_prompt_in_composer(&composer_view(text), 15)?;
|
|
2014
2024
|
if let Some(id) = prompt.id {
|
|
2015
2025
|
return Some(PasteLatch::HashId(id));
|
|
2016
2026
|
}
|
|
@@ -2053,6 +2063,7 @@ fn consumption_from_placeholder(text: &str, tracked: Option<PasteLatch>) -> Opti
|
|
|
2053
2063
|
/// boundary: 不重粘文本;不把不同 grok 行数当成可重按的同一次;tracked 为 None 时占位符路径一律不重按(token 仍在底 15 非空行的重按与 tracked 无关)
|
|
2054
2064
|
/// ---
|
|
2055
2065
|
pub(crate) fn should_resubmit_enter(text: &str, marker: &str, tracked: Option<PasteLatch>) -> bool {
|
|
2066
|
+
let text = &*composer_view(text);
|
|
2056
2067
|
if token_in_bottom_n(text, marker, 15) {
|
|
2057
2068
|
return true;
|
|
2058
2069
|
}
|
|
@@ -2087,7 +2098,8 @@ pub(crate) fn this_paste_identity_in_composer(
|
|
|
2087
2098
|
marker: &str,
|
|
2088
2099
|
tracked: Option<PasteLatch>,
|
|
2089
2100
|
) -> bool {
|
|
2090
|
-
should_resubmit_enter(text, marker, tracked)
|
|
2101
|
+
should_resubmit_enter(text, marker, tracked)
|
|
2102
|
+
|| composer_joined(&composer_view(text), 15).contains(marker)
|
|
2091
2103
|
}
|
|
2092
2104
|
|
|
2093
2105
|
/// ---
|
|
@@ -2149,6 +2161,7 @@ pub(crate) fn should_resubmit_enter_cursor(text: &str, marker: &str) -> bool {
|
|
|
2149
2161
|
/// boundary: token 出现在未折叠的高块里不算完成(按早了);只判「能不能按」,不判「按了有没有成」
|
|
2150
2162
|
/// ---
|
|
2151
2163
|
pub(crate) fn paste_ready_for_enter(text: &str, marker: &str) -> bool {
|
|
2164
|
+
let text = &*composer_view(text);
|
|
2152
2165
|
if pasted_prompt_in_composer(text, 15).is_some() {
|
|
2153
2166
|
return true;
|
|
2154
2167
|
}
|
|
@@ -2185,6 +2198,7 @@ pub(crate) fn consumption_from_capture(
|
|
|
2185
2198
|
token_ever_visible: bool,
|
|
2186
2199
|
tracked: Option<PasteLatch>,
|
|
2187
2200
|
) -> Option<bool> {
|
|
2201
|
+
let text = &*composer_view(text);
|
|
2188
2202
|
let token_now = token_in_bottom_n(text, marker, 15);
|
|
2189
2203
|
match token_sighting(token_now, token_ever_visible) {
|
|
2190
2204
|
TokenSighting::Visible => Some(false),
|
|
@@ -2231,10 +2245,13 @@ struct ConsumptionDiagnostics {
|
|
|
2231
2245
|
current_marker_in_bottom_15: Option<bool>,
|
|
2232
2246
|
paste_identity_in_composer: Option<bool>,
|
|
2233
2247
|
consumption_from_capture_result: Option<bool>,
|
|
2248
|
+
/// Busy in any post-Enter sample: one final frame lands on a random spinner phase.
|
|
2249
|
+
busy_seen: bool,
|
|
2234
2250
|
}
|
|
2235
2251
|
|
|
2236
2252
|
impl ConsumptionDiagnostics {
|
|
2237
2253
|
fn record(&mut self, observation: ConsumptionCaptureObservation) {
|
|
2254
|
+
self.busy_seen |= observation.busy.is_some();
|
|
2238
2255
|
self.busy_signal_kind = observation.busy.map(|match_| match_.kind);
|
|
2239
2256
|
self.busy_line_from_bottom = observation.busy.map(|match_| match_.line_from_bottom);
|
|
2240
2257
|
self.current_marker_in_bottom_15 = observation.marker_in_bottom_15;
|
|
@@ -2316,6 +2333,22 @@ fn busy_signal_kind_in_line(line: &str) -> Option<BusySignalKind> {
|
|
|
2316
2333
|
}
|
|
2317
2334
|
|
|
2318
2335
|
fn provider_busy_signal_match(text: &str) -> Option<BusySignalMatch> {
|
|
2336
|
+
use team_agent_contract::{contract::delivery::InputSurface, providers::claude::interaction};
|
|
2337
|
+
// #379: Claude Code's box decides alone. Its spinner glyph animates through
|
|
2338
|
+
// `·` and a finished turn leaves `✻ Worked for 3s` in the window, so a
|
|
2339
|
+
// per-line glyph scan is neither stable nor live.
|
|
2340
|
+
if let Some((surface, _)) = interaction::inspect_legacy_composer(text) {
|
|
2341
|
+
let row = text
|
|
2342
|
+
.lines()
|
|
2343
|
+
.rev()
|
|
2344
|
+
.filter(|line| !line.trim().is_empty())
|
|
2345
|
+
.position(interaction::spinner_row)
|
|
2346
|
+
.unwrap_or(0);
|
|
2347
|
+
return (surface == InputSurface::Busy).then_some(BusySignalMatch {
|
|
2348
|
+
kind: BusySignalKind::SpinnerGlyph,
|
|
2349
|
+
line_from_bottom: u8::try_from(row).unwrap_or(u8::MAX),
|
|
2350
|
+
});
|
|
2351
|
+
}
|
|
2319
2352
|
text.lines()
|
|
2320
2353
|
.rev()
|
|
2321
2354
|
.filter(|line| !line.trim().is_empty())
|
|
@@ -2351,6 +2384,7 @@ pub(crate) fn observe_turn_from_capture(text: &str, marker: Option<&str>) -> Tur
|
|
|
2351
2384
|
if provider_busy_signal_in_tail(text) {
|
|
2352
2385
|
return TurnVerification::LeaderNewTurnBoundaryVerified;
|
|
2353
2386
|
}
|
|
2387
|
+
let text = &*composer_view(text);
|
|
2354
2388
|
let paste_still = pasted_prompt_in_composer(text, 15).is_some();
|
|
2355
2389
|
let token_still = marker
|
|
2356
2390
|
.map(|m| token_in_bottom_n(text, m, 15))
|
|
@@ -2382,8 +2416,9 @@ fn submit_attempt_observation(
|
|
|
2382
2416
|
let marker_position = marker.and_then(|m| marker_position_from_bottom(&captured.text, m));
|
|
2383
2417
|
// marker 在时也走 pasted_prompt_match:折叠占位符是编排长粘贴的正信号,
|
|
2384
2418
|
// 不能只在无 token 载荷上才认。matched 仍表示「composer 里还有待提交信号」。
|
|
2419
|
+
let composer = composer_view(&captured.text);
|
|
2385
2420
|
let (matched, matched_literal, where_in_tail) = if let Some(marker) = marker {
|
|
2386
|
-
if token_in_bottom_n(&
|
|
2421
|
+
if token_in_bottom_n(&composer, marker, 15) {
|
|
2387
2422
|
(
|
|
2388
2423
|
true,
|
|
2389
2424
|
marker_position.map(|_| marker.to_string()),
|
|
@@ -2391,7 +2426,7 @@ fn submit_attempt_observation(
|
|
|
2391
2426
|
)
|
|
2392
2427
|
} else if let Some((literal, where_in_tail)) = pasted_prompt_match(&captured.text) {
|
|
2393
2428
|
(
|
|
2394
|
-
pasted_prompt_in_composer(&
|
|
2429
|
+
pasted_prompt_in_composer(&composer, 15).is_some(),
|
|
2395
2430
|
Some(literal.to_string()),
|
|
2396
2431
|
Some(where_in_tail),
|
|
2397
2432
|
)
|
|
@@ -3673,7 +3708,7 @@ impl Transport for TmuxBackend {
|
|
|
3673
3708
|
marker,
|
|
3674
3709
|
inject_start.elapsed().as_millis() as u64,
|
|
3675
3710
|
));
|
|
3676
|
-
if
|
|
3711
|
+
if consumption_diagnostics.busy_seen {
|
|
3677
3712
|
consumption_reason = SubmitConsumptionReason::FallbackBusy;
|
|
3678
3713
|
SubmitVerification::EnterSentWithoutPlaceholderCheck
|
|
3679
3714
|
} else {
|
|
@@ -24,7 +24,7 @@ impl NativeInputRequest {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
pub fn supported(&self) -> bool {
|
|
27
|
-
|
|
27
|
+
self.provider == Provider::Pi
|
|
28
28
|
&& self.message_id.starts_with("msg_")
|
|
29
29
|
&& self
|
|
30
30
|
.message_id
|
|
@@ -196,7 +196,7 @@ fn input_digest(text: &str) -> String {
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
pub(crate) fn supports_input_observation(provider: Provider) -> bool {
|
|
199
|
-
|
|
199
|
+
provider == Provider::Pi
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
pub(crate) fn inspect_input(
|
|
@@ -206,79 +206,10 @@ pub(crate) fn inspect_input(
|
|
|
206
206
|
) -> Option<InputFrame> {
|
|
207
207
|
match provider {
|
|
208
208
|
Provider::Pi => pi_input(text, pane_height),
|
|
209
|
-
Provider::CursorAgent => cursor_input(text, pane_height),
|
|
210
209
|
_ => None,
|
|
211
210
|
}
|
|
212
211
|
}
|
|
213
212
|
|
|
214
|
-
fn cursor_input(text: &str, pane_height: u32) -> Option<InputFrame> {
|
|
215
|
-
use team_agent_contract::contract::delivery::InputSurface;
|
|
216
|
-
if pane_height == 0 {
|
|
217
|
-
return None;
|
|
218
|
-
}
|
|
219
|
-
let text_rows: Vec<_> = text.lines().collect();
|
|
220
|
-
// Only the current viewport authorizes input; retain full history below
|
|
221
|
-
// solely for same-message transcript correlation.
|
|
222
|
-
let viewport_start = text_rows.len().saturating_sub(pane_height as usize);
|
|
223
|
-
let viewport = text_rows[viewport_start..].join("\n");
|
|
224
|
-
let (surface, rows, capsule, busy) =
|
|
225
|
-
team_agent_contract::providers::cursor::interaction::inspect_legacy_composer(&viewport)?;
|
|
226
|
-
let first = match *rows.first()? {
|
|
227
|
-
"→" => "",
|
|
228
|
-
row => row.strip_prefix("→ ")?,
|
|
229
|
-
};
|
|
230
|
-
let footer = rows.iter().rposition(|row| {
|
|
231
|
-
row.strip_suffix("Run Everything").is_some_and(|prefix| {
|
|
232
|
-
!prefix.trim().is_empty() && !prefix.trim_start().starts_with("→ ")
|
|
233
|
-
})
|
|
234
|
-
})?;
|
|
235
|
-
if footer == 0 {
|
|
236
|
-
return None;
|
|
237
|
-
}
|
|
238
|
-
let tail: Vec<_> = rows[footer + 1..]
|
|
239
|
-
.iter()
|
|
240
|
-
.filter(|row| !row.is_empty())
|
|
241
|
-
.copied()
|
|
242
|
-
.collect();
|
|
243
|
-
if tail.is_empty() {
|
|
244
|
-
return None;
|
|
245
|
-
}
|
|
246
|
-
// Startup history can leave Tail(200) between Ready/Pasted/Accepted. The
|
|
247
|
-
// immutable carrier birth/nonce remains in NativeInputBinding; this UI
|
|
248
|
-
// context is the current native cwd/footer tail, not a version attestation.
|
|
249
|
-
let identity = format!(
|
|
250
|
-
"cursor-current-composer-v1:{}",
|
|
251
|
-
input_digest(&tail.join("\n"))
|
|
252
|
-
);
|
|
253
|
-
let footer_row = rows[footer]
|
|
254
|
-
.split_whitespace()
|
|
255
|
-
.collect::<Vec<_>>()
|
|
256
|
-
.join(" ");
|
|
257
|
-
let ready = matches!(surface, InputSurface::ComposerReady | InputSurface::Busy);
|
|
258
|
-
if (ready || capsule.is_some()) && rows[1..footer].iter().any(|row| !row.trim().is_empty()) {
|
|
259
|
-
return None;
|
|
260
|
-
}
|
|
261
|
-
let composer = if ready {
|
|
262
|
-
String::new()
|
|
263
|
-
} else {
|
|
264
|
-
std::iter::once(first)
|
|
265
|
-
.chain(rows[1..footer].iter().copied())
|
|
266
|
-
.collect::<Vec<_>>()
|
|
267
|
-
.join("\n")
|
|
268
|
-
};
|
|
269
|
-
let arrow = text_rows
|
|
270
|
-
.iter()
|
|
271
|
-
.rposition(|line| line.trim() == "→" || line.trim().starts_with("→ "))?;
|
|
272
|
-
Some(InputFrame {
|
|
273
|
-
composer,
|
|
274
|
-
transcript: text.lines().take(arrow).collect::<Vec<_>>().join("\n"),
|
|
275
|
-
identity,
|
|
276
|
-
footer: footer_row,
|
|
277
|
-
busy,
|
|
278
|
-
capsule: capsule.map(str::to_owned),
|
|
279
|
-
})
|
|
280
|
-
}
|
|
281
|
-
|
|
282
213
|
fn border(line: &str) -> bool {
|
|
283
214
|
line.chars().filter(|character| *character == '─').count() >= 8
|
|
284
215
|
&& line.trim_start().starts_with('─')
|
|
@@ -400,10 +331,6 @@ mod tests {
|
|
|
400
331
|
#![allow(clippy::unwrap_used, clippy::panic)]
|
|
401
332
|
use super::*;
|
|
402
333
|
|
|
403
|
-
fn cursor(composer: &str, transcript: &str) -> String {
|
|
404
|
-
format!("Cursor Agent\nv2026.10.01-e373342\n{transcript}\n→ {composer}\nGrok 4.7 High Run Everything\n/owned/project\n")
|
|
405
|
-
}
|
|
406
|
-
|
|
407
334
|
fn pi(composer: &str, transcript: &str) -> String {
|
|
408
335
|
format!("{transcript}\n──────────────── ↑ 20 more ─ runner-luna ─\n{composer}\n────────────────────────\ngpt-6-luna · max · 0%/272k · 0% · $0.00\n")
|
|
409
336
|
}
|
|
@@ -561,160 +488,4 @@ mod tests {
|
|
|
561
488
|
assert_eq!(pi_paste_capsule(label), None, "{label}");
|
|
562
489
|
}
|
|
563
490
|
}
|
|
564
|
-
|
|
565
|
-
// Native Issue #328 current-composer rows; transcript removed and private
|
|
566
|
-
// cwd replaced with /owned/project. Startup banner is genuinely absent
|
|
567
|
-
// from the owned pane's Tail(200), not a fabricated invalid version.
|
|
568
|
-
const CURSOR_FOLLOWUP: &str =
|
|
569
|
-
include_str!("../../tests/fixtures/cursor-followup-headerless.txt");
|
|
570
|
-
|
|
571
|
-
#[test]
|
|
572
|
-
fn native_input_cursor_clean_followup_does_not_require_scrolled_startup_banner() {
|
|
573
|
-
let ready = inspect_input(Provider::CursorAgent, CURSOR_FOLLOWUP).unwrap();
|
|
574
|
-
assert!(ready.empty());
|
|
575
|
-
assert!(!ready.busy);
|
|
576
|
-
assert!(ready.capsule.is_none());
|
|
577
|
-
let header = format!("Cursor Agent\nv2026.10.14-0f9edde\n{CURSOR_FOLLOWUP}");
|
|
578
|
-
let with_header = inspect_input(Provider::CursorAgent, &header).unwrap();
|
|
579
|
-
assert!(with_header.empty() && !with_header.busy);
|
|
580
|
-
assert_eq!(ready.footer, with_header.footer);
|
|
581
|
-
assert_eq!(
|
|
582
|
-
ready.identity, with_header.identity,
|
|
583
|
-
"startup history is not a new UI identity"
|
|
584
|
-
);
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
#[test]
|
|
588
|
-
fn native_input_cursor_headerless_followup_retains_draft_busy_and_footer_fences() {
|
|
589
|
-
let label = "[Pasted text #2 +25 lines]";
|
|
590
|
-
let folded = CURSOR_FOLLOWUP.replace("Add a follow-up", label);
|
|
591
|
-
let draft = inspect_input(Provider::CursorAgent, &folded).unwrap();
|
|
592
|
-
assert!(!draft.empty());
|
|
593
|
-
assert_eq!(draft.capsule.as_deref(), Some(label));
|
|
594
|
-
let dirty = CURSOR_FOLLOWUP.replace("Add a follow-up", "Add a follow-up draft");
|
|
595
|
-
assert!(!inspect_input(Provider::CursorAgent, &dirty)
|
|
596
|
-
.unwrap()
|
|
597
|
-
.empty());
|
|
598
|
-
for dirty in [
|
|
599
|
-
CURSOR_FOLLOWUP.replace("Add a follow-up", "Add a follow-up\nforeign draft"),
|
|
600
|
-
CURSOR_FOLLOWUP.replace("Add a follow-up", &format!("{label}\nforeign draft")),
|
|
601
|
-
] {
|
|
602
|
-
assert!(inspect_input(Provider::CursorAgent, &dirty).is_none());
|
|
603
|
-
}
|
|
604
|
-
let busy = CURSOR_FOLLOWUP.replace("Add a follow-up", "Add a follow-up ctrl+c to stop");
|
|
605
|
-
assert!(inspect_input(Provider::CursorAgent, &busy).unwrap().busy);
|
|
606
|
-
let working = format!("⠘⠆ Working\n{CURSOR_FOLLOWUP}");
|
|
607
|
-
assert!(inspect_input(Provider::CursorAgent, &working).unwrap().busy);
|
|
608
|
-
for unknown in [
|
|
609
|
-
"→ Add a follow-up\n".to_string(),
|
|
610
|
-
CURSOR_FOLLOWUP.replace("Run Everything", "unknown footer"),
|
|
611
|
-
CURSOR_FOLLOWUP.replace(" /owned/project\n", ""),
|
|
612
|
-
] {
|
|
613
|
-
assert!(inspect_input(Provider::CursorAgent, &unknown).is_none());
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
#[test]
|
|
618
|
-
fn native_input_cursor_real_expanded_followup_is_nonempty_current_marker_not_capsule() {
|
|
619
|
-
let expanded = include_str!("../../tests/fixtures/cursor-followup-expanded.txt");
|
|
620
|
-
let marker = "[team-agent-token:msg_one]";
|
|
621
|
-
for prefix in [
|
|
622
|
-
"".to_string(),
|
|
623
|
-
format!("Cursor Agent\nv2026.10.14-0f9edde\n{CURSOR_FOLLOWUP}"),
|
|
624
|
-
] {
|
|
625
|
-
let text = format!("{prefix}{expanded}");
|
|
626
|
-
let frame = inspect_input(Provider::CursorAgent, &text).unwrap();
|
|
627
|
-
assert!(!frame.empty() && !frame.busy);
|
|
628
|
-
assert!(frame.has_marker(marker));
|
|
629
|
-
assert!(frame.capsule.is_none());
|
|
630
|
-
assert!(!frame.transcript.contains(marker));
|
|
631
|
-
let changed = text.replace("/owned/project", "/different/project");
|
|
632
|
-
assert_ne!(
|
|
633
|
-
frame.identity,
|
|
634
|
-
inspect_input(Provider::CursorAgent, &changed)
|
|
635
|
-
.unwrap()
|
|
636
|
-
.identity
|
|
637
|
-
);
|
|
638
|
-
}
|
|
639
|
-
let duplicate = expanded.replace(marker, &format!("{marker}\n{marker}"));
|
|
640
|
-
assert!(!inspect_input(Provider::CursorAgent, &duplicate)
|
|
641
|
-
.unwrap()
|
|
642
|
-
.has_marker(marker));
|
|
643
|
-
let busy = expanded.replace(" →", "⠘⠆ Working\n →");
|
|
644
|
-
assert!(inspect_input(Provider::CursorAgent, &busy).unwrap().busy);
|
|
645
|
-
for unknown in [
|
|
646
|
-
"→\nGrok 4.7 High Run Everything\n/owned/project\n".to_string(),
|
|
647
|
-
"→\nforeign draft\n→ Add a follow-up\nGrok 4.7 High Run Everything\n/owned/project\n"
|
|
648
|
-
.to_string(),
|
|
649
|
-
expanded.replace("Run Everything", "unknown footer"),
|
|
650
|
-
expanded.replace(" /owned/project\n", ""),
|
|
651
|
-
format!("{expanded}{}", "unknown current row\n".repeat(24)),
|
|
652
|
-
] {
|
|
653
|
-
assert!(super::inspect_input(Provider::CursorAgent, &unknown, 24).is_none());
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
#[test]
|
|
658
|
-
fn native_input_cursor_requires_composer_in_current_viewport_not_old_history() {
|
|
659
|
-
for header in ["", "Cursor Agent\nv2026.10.14-0f9edde\n"] {
|
|
660
|
-
let hidden = format!(
|
|
661
|
-
"{header}{CURSOR_FOLLOWUP}{}",
|
|
662
|
-
"unknown current row\n".repeat(24)
|
|
663
|
-
);
|
|
664
|
-
assert!(super::inspect_input(Provider::CursorAgent, &hidden, 24).is_none());
|
|
665
|
-
}
|
|
666
|
-
assert!(super::inspect_input(Provider::CursorAgent, CURSOR_FOLLOWUP, 0).is_none());
|
|
667
|
-
let current = super::inspect_input(Provider::CursorAgent, CURSOR_FOLLOWUP, 24).unwrap();
|
|
668
|
-
let changed = CURSOR_FOLLOWUP.replace("/owned/project", "/different/project");
|
|
669
|
-
let changed = super::inspect_input(Provider::CursorAgent, &changed, 24).unwrap();
|
|
670
|
-
assert_ne!(current.identity, changed.identity);
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
#[test]
|
|
674
|
-
fn native_input_cursor_separates_folded_draft_from_history_and_busy() {
|
|
675
|
-
let capsule = "[Pasted text #1 +25 lines]";
|
|
676
|
-
let draft = inspect_input(Provider::CursorAgent, &cursor(capsule, "")).unwrap();
|
|
677
|
-
assert!(!draft.empty());
|
|
678
|
-
assert_eq!(draft.capsule.as_deref(), Some(capsule));
|
|
679
|
-
let ready = inspect_input(
|
|
680
|
-
Provider::CursorAgent,
|
|
681
|
-
&cursor("Plan, search, build anything", capsule),
|
|
682
|
-
)
|
|
683
|
-
.unwrap();
|
|
684
|
-
assert!(ready.empty());
|
|
685
|
-
assert!(ready.capsule.is_none());
|
|
686
|
-
let busy = inspect_input(
|
|
687
|
-
Provider::CursorAgent,
|
|
688
|
-
&cursor("Add a follow-up ctrl+c to stop", capsule),
|
|
689
|
-
)
|
|
690
|
-
.unwrap();
|
|
691
|
-
assert!(busy.busy);
|
|
692
|
-
assert!(
|
|
693
|
-
inspect_input(Provider::CursorAgent, &cursor(capsule, "⠘⠆ Working"))
|
|
694
|
-
.unwrap()
|
|
695
|
-
.busy
|
|
696
|
-
);
|
|
697
|
-
assert!(inspect_input(Provider::CursorAgent, "→ [Pasted text #1 +25 lines]").is_none());
|
|
698
|
-
assert!(inspect_input(
|
|
699
|
-
Provider::CursorAgent,
|
|
700
|
-
&cursor("Plan, search, build anything\nextra editable text", "")
|
|
701
|
-
)
|
|
702
|
-
.is_none());
|
|
703
|
-
assert!(inspect_input(
|
|
704
|
-
Provider::CursorAgent,
|
|
705
|
-
&cursor("[Pasted text #1 +25 lines]\nsecond block", "")
|
|
706
|
-
)
|
|
707
|
-
.is_none());
|
|
708
|
-
assert!(inspect_input(
|
|
709
|
-
Provider::CursorAgent,
|
|
710
|
-
"Cursor Agent\nv2026.10.01-e373342\n→ Run Everything\n"
|
|
711
|
-
)
|
|
712
|
-
.is_none());
|
|
713
|
-
let malformed = inspect_input(
|
|
714
|
-
Provider::CursorAgent,
|
|
715
|
-
&cursor("[Pasted text #0 +25 lines]", ""),
|
|
716
|
-
)
|
|
717
|
-
.unwrap();
|
|
718
|
-
assert!(malformed.capsule.is_none());
|
|
719
|
-
}
|
|
720
491
|
}
|
package/npm/install.mjs
CHANGED
|
@@ -168,7 +168,12 @@ function install(argv) {
|
|
|
168
168
|
if (pathCheck.status === "ready") {
|
|
169
169
|
console.log("Ready in this terminal. Run: team-agent --help");
|
|
170
170
|
} else {
|
|
171
|
-
console.log(
|
|
171
|
+
console.log(pathActivationGuidance({
|
|
172
|
+
binDir,
|
|
173
|
+
teamAgent,
|
|
174
|
+
rc: installTarget.rc,
|
|
175
|
+
shell: path.basename(process.env.SHELL || ""),
|
|
176
|
+
}));
|
|
172
177
|
}
|
|
173
178
|
}
|
|
174
179
|
|
|
@@ -561,7 +566,9 @@ function ensureBinDirOnShellRc(binDir, options = {}) {
|
|
|
561
566
|
|
|
562
567
|
function shellRcTargets(shell, home) {
|
|
563
568
|
if (shell === "zsh") {
|
|
564
|
-
|
|
569
|
+
// Login shells, including ssh and macOS Terminal, read .zprofile and do
|
|
570
|
+
// not read .zshrc unless they are also interactive. Write both.
|
|
571
|
+
return { files: [path.join(home, ".zprofile"), path.join(home, ".zshrc")], style: "posix" };
|
|
565
572
|
}
|
|
566
573
|
if (shell === "bash") {
|
|
567
574
|
return { files: [path.join(home, ".bashrc"), path.join(home, ".bash_profile")], style: "posix" };
|
|
@@ -571,13 +578,43 @@ function shellRcTargets(shell, home) {
|
|
|
571
578
|
}
|
|
572
579
|
if (!shell || shell === "sh") {
|
|
573
580
|
return {
|
|
574
|
-
files:
|
|
581
|
+
files: process.platform === "darwin"
|
|
582
|
+
? [path.join(home, ".zprofile"), path.join(home, ".zshrc")]
|
|
583
|
+
: [path.join(home, ".profile")],
|
|
575
584
|
style: "posix",
|
|
576
585
|
};
|
|
577
586
|
}
|
|
578
587
|
return null;
|
|
579
588
|
}
|
|
580
589
|
|
|
590
|
+
export function pathActivationGuidance(options = {}) {
|
|
591
|
+
const binDir = options.binDir;
|
|
592
|
+
const teamAgent = options.teamAgent;
|
|
593
|
+
const rc = options.rc || { files: [], skipped: [] };
|
|
594
|
+
const refresh = options.shell === "zsh" ? "rehash" : "hash -r";
|
|
595
|
+
const lines = [
|
|
596
|
+
"This shell cannot see team-agent yet. A child installer cannot change the shell that launched it.",
|
|
597
|
+
"Run this in the current shell:",
|
|
598
|
+
` export PATH="${binDir}:$PATH"`,
|
|
599
|
+
` ${refresh}`,
|
|
600
|
+
" team-agent --help",
|
|
601
|
+
"Or run the installed command directly:",
|
|
602
|
+
` ${teamAgent} --help`,
|
|
603
|
+
];
|
|
604
|
+
const written = rc.files || [];
|
|
605
|
+
const skipped = rc.skipped || [];
|
|
606
|
+
if (written.length > 0) {
|
|
607
|
+
lines.push(`New shells read: ${written.join(", ")}`);
|
|
608
|
+
} else if (skipped.length > 0) {
|
|
609
|
+
lines.push(`Shell startup already contains the PATH entry: ${skipped.join(", ")}`);
|
|
610
|
+
} else if (rc.unsupported) {
|
|
611
|
+
lines.push("This shell has no supported startup file. Keep the export above.");
|
|
612
|
+
} else {
|
|
613
|
+
lines.push("Could not update a shell startup file. Keep the export above.");
|
|
614
|
+
}
|
|
615
|
+
return lines.join("\n");
|
|
616
|
+
}
|
|
617
|
+
|
|
581
618
|
function installedBinDir(runtimeRoot, opts) {
|
|
582
619
|
const manifest = readInstallManifest(runtimeRoot);
|
|
583
620
|
if (typeof manifest?.binDir === "string" && manifest.binDir) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@team-agent/installer",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.125",
|
|
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.
|
|
24
|
-
"@team-agent/cli-darwin-x64": "0.5.
|
|
25
|
-
"@team-agent/cli-linux-x64": "0.5.
|
|
23
|
+
"@team-agent/cli-darwin-arm64": "0.5.125",
|
|
24
|
+
"@team-agent/cli-darwin-x64": "0.5.125",
|
|
25
|
+
"@team-agent/cli-linux-x64": "0.5.125"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"postinstall": "node npm/bincheck.mjs",
|
|
@@ -113,7 +113,7 @@ team-agent route disable
|
|
|
113
113
|
|
|
114
114
|
`set` replaces one mapping, `add` appends without deduplication, `clear` removes it; none changes the switch. `enable`/`disable` preserve mappings in `~/.team-agent/argv-routing.json`. `TEAM_AGENT_CLI_ARGV_ROUTING` overrides the switch: `1/true/on`, `0/false/off` (case-insensitive, trimmed); invalid values disable routing. Check `persisted_enabled`, `effective_enabled` and `override_status`.
|
|
115
115
|
|
|
116
|
-
Keys: `claude`, `codex`, `copilot`, `gemini_cli`, `grok`, `
|
|
116
|
+
Keys: `claude`, `codex`, `copilot`, `gemini_cli`, `grok`, `pi`. Claude/Claude Code share `claude`; aliases `claude_code/claude-code` are accepted. Everything after the first `--`, including `--help`, `--json`, empty strings and `{workspace}`, is literal argv. No shell expansion. Do not route secrets or override framework-managed session/MCP/permission flags.
|
|
117
117
|
|
|
118
118
|
Mappings affect the next actual native spawn, not running/attached processes, dry-run or helper probes. Invalid enabled configuration refuses spawn; an emergency environment OFF avoids reading it, while `route disable` will not overwrite a broken file. Pi `--mode rpc` does not provide an RPC host or replace Team Agent's transport.
|
|
119
119
|
|