@team-agent/installer 0.5.126 → 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.
- package/Cargo.lock +1 -1
- package/Cargo.toml +1 -1
- package/README.md +11 -0
- package/crates/team-agent/src/cli/adapters.rs +3 -13
- package/crates/team-agent/src/cli/arguments.rs +4 -0
- package/crates/team-agent/src/cli/diagnose.rs +68 -91
- package/crates/team-agent/src/cli/emit.rs +61 -28
- package/crates/team-agent/src/cli/grok_slot.rs +88 -3
- package/crates/team-agent/src/cli/intent/runtime.rs +38 -9
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +147 -11
- package/crates/team-agent/src/cli/intent/tests.rs +10 -12
- package/crates/team-agent/src/cli/intent.rs +1 -1
- package/crates/team-agent/src/cli/mod.rs +38 -9
- package/crates/team-agent/src/cli/models.rs +789 -186
- package/crates/team-agent/src/cli/schedule.rs +175 -0
- package/crates/team-agent/src/cli/send/persist.rs +0 -36
- package/crates/team-agent/src/cli/send/presentation.rs +1 -1
- package/crates/team-agent/src/cli/send.rs +108 -110
- package/crates/team-agent/src/cli/spec.rs +6 -0
- package/crates/team-agent/src/cli/status_port/brief.rs +5 -67
- package/crates/team-agent/src/cli/tests/leader_watch.rs +12 -62
- package/crates/team-agent/src/cli/tests/mod.rs +3 -3
- package/crates/team-agent/src/cli/tests/named_address.rs +11 -10
- package/crates/team-agent/src/cli/tests/run_delegation.rs +12 -9
- package/crates/team-agent/src/cli/tests/status_send.rs +70 -273
- package/crates/team-agent/src/compiler/tests.rs +39 -27
- package/crates/team-agent/src/compiler.rs +206 -6
- package/crates/team-agent/src/contract_runtime/backend.rs +181 -11
- package/crates/team-agent/src/contract_runtime/commands.rs +338 -7
- package/crates/team-agent/src/contract_runtime/config.rs +30 -19
- package/crates/team-agent/src/contract_runtime/config_tests.rs +24 -4
- package/crates/team-agent/src/contract_runtime/discovery.rs +12 -1
- package/crates/team-agent/src/contract_runtime/fork.rs +3 -10
- package/crates/team-agent/src/contract_runtime/framework.rs +28 -14
- package/crates/team-agent/src/contract_runtime/mcp.rs +19 -24
- package/crates/team-agent/src/contract_runtime/prompt.rs +2 -2
- package/crates/team-agent/src/contract_runtime/registry.rs +93 -130
- package/crates/team-agent/src/coordinator/steps/abnormal.rs +45 -5
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +8 -29
- package/crates/team-agent/src/coordinator/tests/energy.rs +4 -4
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +44 -2
- package/crates/team-agent/src/coordinator/tests/main_preserved.rs +2 -2
- package/crates/team-agent/src/coordinator/tests/spine.rs +1 -1
- package/crates/team-agent/src/coordinator/tests/takeover.rs +3 -3
- package/crates/team-agent/src/coordinator/tick.rs +1 -89
- package/crates/team-agent/src/db/message_store.rs +7 -65
- package/crates/team-agent/src/direct_delivery.rs +368 -0
- package/crates/team-agent/src/inbox_store.rs +169 -0
- package/crates/team-agent/src/leader/registry.rs +5 -0
- package/crates/team-agent/src/leader/start.rs +2 -1
- package/crates/team-agent/src/leader/tests/lease_api.rs +2 -2
- package/crates/team-agent/src/leader/tests/prompt_contract.rs +1 -0
- package/crates/team-agent/src/lib.rs +2 -0
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +33 -0
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +206 -1
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +28 -2
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +36 -179
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +87 -6
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +13 -488
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +351 -81
- package/crates/team-agent/src/lifecycle/launch/pi_mcp_extension.js +3 -4
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +26 -2
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +41 -31
- package/crates/team-agent/src/lifecycle/launch.rs +27 -12
- package/crates/team-agent/src/lifecycle/profile_launch.rs +318 -64
- package/crates/team-agent/src/lifecycle/restart/agent.rs +1 -0
- package/crates/team-agent/src/lifecycle/restart/avatar.rs +1798 -0
- package/crates/team-agent/src/lifecycle/restart/claude_fork.rs +163 -0
- package/crates/team-agent/src/lifecycle/restart/common.rs +298 -133
- package/crates/team-agent/src/lifecycle/restart/remove.rs +129 -0
- package/crates/team-agent/src/lifecycle/restart/selection.rs +5 -5
- package/crates/team-agent/src/lifecycle/restart.rs +4 -0
- package/crates/team-agent/src/lifecycle/role_config.rs +79 -27
- package/crates/team-agent/src/lifecycle/tests/acceptance_b_batch_red.rs +1 -1
- package/crates/team-agent/src/lifecycle/tests/agent_ops.rs +8 -12
- package/crates/team-agent/src/lifecycle/tests/behavioral_diff_264_red.rs +37 -240
- package/crates/team-agent/src/lifecycle/tests/claude_compatible_config_red.rs +325 -0
- package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +320 -8
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +329 -70
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +378 -4
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +25 -39
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +7 -11
- package/crates/team-agent/src/lifecycle/tests/core.rs +39 -36
- package/crates/team-agent/src/lifecycle/tests/f032_startup_prompt_best_effort_red.rs +22 -8
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_native_mcp_host.mjs +2 -1
- package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +15 -133
- package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +60 -20
- package/crates/team-agent/src/lifecycle/tests/host_cotenant_death_p0_contract.rs +30 -67
- package/crates/team-agent/src/lifecycle/tests/issue238_codex_effort_contract.rs +3 -31
- package/crates/team-agent/src/lifecycle/tests/lane_ops.rs +194 -169
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +164 -282
- package/crates/team-agent/src/lifecycle/tests/lifecycle_rollback_red.rs +15 -78
- package/crates/team-agent/src/lifecycle/tests/main_preserved.rs +7 -7
- package/crates/team-agent/src/lifecycle/tests/mcp_tool_name_format_red.rs +6 -6
- package/crates/team-agent/src/lifecycle/tests/phase_b_contracts.rs +75 -69
- package/crates/team-agent/src/lifecycle/tests/phase_golden.rs +2 -10
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +18 -6
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +70 -52
- package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +210 -0
- package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +157 -4
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +526 -10
- package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +1419 -0
- package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +68 -1
- package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +34 -12
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +94 -2
- package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +14 -15
- package/crates/team-agent/src/lifecycle/tests/restart.rs +12 -153
- package/crates/team-agent/src/lifecycle/tests/restart_build_before_destroy_0540_contract.rs +27 -5
- package/crates/team-agent/src/lifecycle/tests/restart_liveness_red.rs +59 -10
- package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +47 -6
- package/crates/team-agent/src/lifecycle/tests/restart_session_capture_red.rs +3 -1374
- package/crates/team-agent/src/lifecycle/tests/resume_recover_red.rs +27 -10
- package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +7 -7
- package/crates/team-agent/src/lifecycle/tests/subprep_codex_trust_roundtrip_red.rs +67 -313
- package/crates/team-agent/src/lifecycle/tests/swallow_batch4_semantics_red.rs +254 -2
- package/crates/team-agent/src/lifecycle/tests/team_in_team_identity_scope_red.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests/team_in_team_sibling_quick_start_red.rs +1 -1
- package/crates/team-agent/src/lifecycle/tests/team_in_team_state_scope_red.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_txn_red.rs +4 -4
- package/crates/team-agent/src/lifecycle/tests/upgrade_compat_0211_red.rs +74 -19
- package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +38 -39
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +51 -88
- package/crates/team-agent/src/lifecycle/tests.rs +3 -4
- package/crates/team-agent/src/lifecycle/types.rs +18 -5
- package/crates/team-agent/src/lifecycle/worker_command_context.rs +43 -50
- package/crates/team-agent/src/mcp_server/readiness.rs +130 -149
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +86 -109
- package/crates/team-agent/src/mcp_server/tests/scoped.rs +21 -31
- package/crates/team-agent/src/mcp_server/tests/send.rs +72 -107
- package/crates/team-agent/src/mcp_server/tests/tools.rs +10 -12
- package/crates/team-agent/src/mcp_server/tools.rs +70 -196
- package/crates/team-agent/src/messaging/delivery.rs +143 -253
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +5 -5
- package/crates/team-agent/src/messaging/helpers.rs +1 -19
- package/crates/team-agent/src/messaging/mod.rs +1 -0
- package/crates/team-agent/src/messaging/reminders.rs +316 -0
- package/crates/team-agent/src/messaging/scheduler.rs +7 -1
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +255 -150
- package/crates/team-agent/src/messaging/tests/main_preserved.rs +2 -2
- package/crates/team-agent/src/messaging/tests/runtime.rs +9 -115
- package/crates/team-agent/src/messaging/tests/spine.rs +44 -24
- package/crates/team-agent/src/messaging/tests/wave2.rs +13 -20
- package/crates/team-agent/src/messaging/types.rs +1 -0
- package/crates/team-agent/src/provider/adapter.rs +208 -254
- package/crates/team-agent/src/provider/adapters/claude.rs +78 -0
- package/crates/team-agent/src/provider/adapters/claude_fork.rs +131 -0
- package/crates/team-agent/src/provider/adapters/mod.rs +7 -7
- package/crates/team-agent/src/provider/adapters/pi.rs +106 -0
- package/crates/team-agent/src/provider/classify.rs +1 -66
- package/crates/team-agent/src/provider/model_catalog.rs +201 -13
- package/crates/team-agent/src/provider/session/capture.rs +111 -111
- package/crates/team-agent/src/provider/session/context_fork/claude.rs +123 -0
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +10 -18
- package/crates/team-agent/src/provider/session/context_fork.rs +87 -74
- package/crates/team-agent/src/provider/session/mod.rs +2 -3
- package/crates/team-agent/src/provider/session_scan/claude.rs +523 -0
- package/crates/team-agent/src/provider/session_scan/common.rs +47 -47
- package/crates/team-agent/src/provider/session_scan/pi.rs +34 -1
- package/crates/team-agent/src/provider/session_scan.rs +13 -13
- package/crates/team-agent/src/provider/tests/adapter.rs +127 -121
- package/crates/team-agent/src/provider/tests/classify.rs +0 -53
- package/crates/team-agent/src/provider/tests/command_helpers.rs +11 -19
- package/crates/team-agent/src/provider/tests/idle.rs +13 -19
- package/crates/team-agent/src/provider/types.rs +0 -4
- package/crates/team-agent/src/provider/wire.rs +34 -20
- package/crates/team-agent/src/state/abnormal_watch/tests/mod.rs +1 -1
- package/crates/team-agent/src/state/persist.rs +6 -6
- package/crates/team-agent/src/state/projection.rs +1 -1
- package/crates/team-agent/src/state/repository/tests.rs +2 -2
- package/crates/team-agent/src/test_support/models_timeout_fixture.rs +144 -0
- package/crates/team-agent/src/tmux_backend/tests.rs +0 -151
- package/crates/team-agent/src/tmux_backend.rs +9 -43
- package/package.json +4 -4
- package/skills/team-agent/SKILL.md +7 -8
- package/skills/team-agent/command-coverage.json +15 -1
- package/skills/team-agent/docs/reference/team-agent-operator.md +5 -3
- package/skills/team-agent/references/team-agent-operator.md +5 -3
- package/crates/team-agent/src/lifecycle/launch/grok_per_seat.rs +0 -260
- package/crates/team-agent/src/lifecycle/tests/codex_weak_window_attribution_red.rs +0 -683
- package/crates/team-agent/src/lifecycle/tests/grok_effort_argv_red.rs +0 -247
- package/crates/team-agent/src/lifecycle/tests/grok_mcp_overlay_red.rs +0 -507
- package/crates/team-agent/src/lifecycle/tests/grok_restart_resume_red.rs +0 -300
- package/crates/team-agent/src/provider/adapters/codex.rs +0 -101
- package/crates/team-agent/src/provider/adapters/grok.rs +0 -67
- package/crates/team-agent/src/provider/session/context_fork/codex.rs +0 -514
- package/crates/team-agent/src/provider/session_scan/codex.rs +0 -326
- package/crates/team-agent/src/provider/session_scan/grok.rs +0 -288
|
@@ -102,7 +102,7 @@ fn observation_identity_separates_same_name_team_path_and_spawn_generation() {
|
|
|
102
102
|
("/active_team_key", json!("b")),
|
|
103
103
|
("/agents/w/rollout_path", json!("/fixture/other.jsonl")),
|
|
104
104
|
("/agents/w/spawn_epoch", json!(2)),
|
|
105
|
-
("/agents/w/provider", json!("
|
|
105
|
+
("/agents/w/provider", json!("claude")),
|
|
106
106
|
("/agents/w/spawned_at", json!("new-incarnation")),
|
|
107
107
|
] {
|
|
108
108
|
let mut changed = initial.clone();
|
|
@@ -2730,7 +2730,7 @@ mod tests {
|
|
|
2730
2730
|
&json!({
|
|
2731
2731
|
"session_name": "team-a",
|
|
2732
2732
|
"active_team_key": "team-a",
|
|
2733
|
-
"agents": {"f1": {"provider": "
|
|
2733
|
+
"agents": {"f1": {"provider": "claude", "status": "starting"}}
|
|
2734
2734
|
}),
|
|
2735
2735
|
);
|
|
2736
2736
|
// f2 loaded before f1's reservation. Persist carries the still-unspawned
|
|
@@ -2738,7 +2738,7 @@ mod tests {
|
|
|
2738
2738
|
let incoming = json!({
|
|
2739
2739
|
"session_name": "team-a",
|
|
2740
2740
|
"active_team_key": "team-a",
|
|
2741
|
-
"agents": {"f2": {"provider": "
|
|
2741
|
+
"agents": {"f2": {"provider": "claude", "status": "starting"}}
|
|
2742
2742
|
});
|
|
2743
2743
|
save_runtime_state_with_lifecycle_topology_authority(&ws, &incoming, "team-a", &["f2"])
|
|
2744
2744
|
.unwrap();
|
|
@@ -2749,7 +2749,7 @@ mod tests {
|
|
|
2749
2749
|
// f1 starts after f2 takes its snapshot; capture is not complete yet.
|
|
2750
2750
|
let mut started = stale.clone();
|
|
2751
2751
|
started["agents"]["f1"] = json!({
|
|
2752
|
-
"provider": "
|
|
2752
|
+
"provider": "claude",
|
|
2753
2753
|
"status": "running",
|
|
2754
2754
|
"pane_id": "%1",
|
|
2755
2755
|
"pane_pid": 101,
|
|
@@ -2763,7 +2763,7 @@ mod tests {
|
|
|
2763
2763
|
.unwrap();
|
|
2764
2764
|
let latest = read_state(&ws);
|
|
2765
2765
|
stale["agents"]["f2"] = json!({
|
|
2766
|
-
"provider": "
|
|
2766
|
+
"provider": "claude",
|
|
2767
2767
|
"status": "running",
|
|
2768
2768
|
"pane_id": "%2",
|
|
2769
2769
|
"pane_pid": 102,
|
|
@@ -3410,7 +3410,7 @@ mod tests {
|
|
|
3410
3410
|
"agents": {
|
|
3411
3411
|
"alpha": {
|
|
3412
3412
|
"status": "stopped",
|
|
3413
|
-
"provider": "
|
|
3413
|
+
"provider": "claude",
|
|
3414
3414
|
"session_id": "stale-poisoned-uuid",
|
|
3415
3415
|
"rollout_path": Value::Null,
|
|
3416
3416
|
"captured_at": Value::Null,
|
|
@@ -3427,7 +3427,7 @@ mod tests {
|
|
|
3427
3427
|
"agents": {
|
|
3428
3428
|
"alpha": {
|
|
3429
3429
|
"status": "running",
|
|
3430
|
-
"provider": "
|
|
3430
|
+
"provider": "claude",
|
|
3431
3431
|
"session_id": Value::Null,
|
|
3432
3432
|
"rollout_path": Value::Null,
|
|
3433
3433
|
"captured_at": Value::Null,
|
|
@@ -712,7 +712,7 @@ pub fn select_runtime_state(workspace: &Path, team: Option<&str>) -> Result<Valu
|
|
|
712
712
|
resolve_runtime_team_scope(workspace, team).map(|resolved| resolved.state)
|
|
713
713
|
}
|
|
714
714
|
|
|
715
|
-
fn team_selector_matches(team: &str, key: &str, value: &Value) -> bool {
|
|
715
|
+
pub(crate) fn team_selector_matches(team: &str, key: &str, value: &Value) -> bool {
|
|
716
716
|
if team == key {
|
|
717
717
|
return true;
|
|
718
718
|
}
|
|
@@ -123,9 +123,9 @@ fn stopped_start_commit_updates_exact_target_and_both_mirrors()
|
|
|
123
123
|
let held = json!({"agent_id":"worker","provider":"grok_build","runtime_family":"contract",
|
|
124
124
|
"status":"stopped","explicit_stop":true,"generation":1,"contract_instance":"instance-one",
|
|
125
125
|
"session_id":"same-session","native_endpoint":"old-endpoint"});
|
|
126
|
-
let peer = json!({"agent_id":"peer","provider":"
|
|
126
|
+
let peer = json!({"agent_id":"peer","provider":"pi","status":"stopped","explicit_stop":true,
|
|
127
127
|
"session_id":"peer-session","generation":1});
|
|
128
|
-
let control = json!({"agent_id":"control","provider":"
|
|
128
|
+
let control = json!({"agent_id":"control","provider":"pi","status":"running","session_id":"control-session"});
|
|
129
129
|
let agents = json!({"worker":held,"peer":peer,"control":control});
|
|
130
130
|
let initial = json!({"session_name":"team-a","active_team_key":"team-a","agents":agents,
|
|
131
131
|
"teams":{"team-a":{"session_name":"team-a","status":"alive","agents":agents},
|
|
@@ -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
|
-
}
|
|
@@ -1694,7 +1694,8 @@ fn inject_verification_for_payload(payload: &InjectPayload) -> InjectVerificatio
|
|
|
1694
1694
|
/// scrollback token cannot verify a new message.
|
|
1695
1695
|
/// Measured cursor-agent 2026.08.11 floor: text and first Enter ≥1s apart
|
|
1696
1696
|
/// (phase0 M2-5/M2-6; `.team/scripts/cursor_send.sh`).
|
|
1697
|
-
/// Grok
|
|
1697
|
+
/// The legacy Grok worker used the same 1s floor (悬案B:零地板时 Enter 落在折叠窗口内被吞);
|
|
1698
|
+
/// contract leaves own their own paste timing.
|
|
1698
1699
|
pub const CURSOR_PASTE_TO_SUBMIT_FLOOR: Duration = Duration::from_secs(1);
|
|
1699
1700
|
|
|
1700
1701
|
thread_local! {
|
|
@@ -1702,7 +1703,7 @@ thread_local! {
|
|
|
1702
1703
|
static CURSOR_SINGLE_ENTER: Cell<bool> = const { Cell::new(false) };
|
|
1703
1704
|
}
|
|
1704
1705
|
|
|
1705
|
-
/// Run `f` with a paste→Enter floor.
|
|
1706
|
+
/// Run `f` with a paste→Enter floor. No legacy recipient sets one now.
|
|
1706
1707
|
/// Tests pass a small non-zero Duration to cover the sleep branch.
|
|
1707
1708
|
/// Default is ZERO — claude/codex and unset callers pay nothing.
|
|
1708
1709
|
/// This is not TEAM_AGENT_TEST_TMP (that var is a path, always set in seats).
|
|
@@ -1712,7 +1713,7 @@ thread_local! {
|
|
|
1712
1713
|
/// floor: 本次生效的最小间隔;ZERO 表示不等
|
|
1713
1714
|
/// f: 在该地板下执行的闭包
|
|
1714
1715
|
/// returns: 原样返回 f 的返回值
|
|
1715
|
-
/// boundary: thread_local 作用域,不跨线程;只设阈值,真正的等待发生在 sleep_remaining_paste_to_submit_floor;默认 ZERO
|
|
1716
|
+
/// boundary: thread_local 作用域,不跨线程;只设阈值,真正的等待发生在 sleep_remaining_paste_to_submit_floor;默认 ZERO(legacy grok worker 退役后 delivery 不再设地板)
|
|
1716
1717
|
/// ---
|
|
1717
1718
|
pub fn with_paste_to_submit_floor<R>(floor: Duration, f: impl FnOnce() -> R) -> R {
|
|
1718
1719
|
PASTE_TO_SUBMIT_FLOOR.with(|cell| {
|
|
@@ -1891,16 +1892,6 @@ fn token_in_bottom_n(text: &str, marker: &str, n: usize) -> bool {
|
|
|
1891
1892
|
.any(|line| line.contains(marker))
|
|
1892
1893
|
}
|
|
1893
1894
|
|
|
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
|
-
|
|
1904
1895
|
/// purpose: token 在本轮注入中的三态观测
|
|
1905
1896
|
/// contract:
|
|
1906
1897
|
/// - Visible: 当前 capture 可见
|
|
@@ -2020,7 +2011,7 @@ fn latch_paste(text: &str, current: Option<PasteLatch>) -> Option<PasteLatch> {
|
|
|
2020
2011
|
if current.is_some() {
|
|
2021
2012
|
return current;
|
|
2022
2013
|
}
|
|
2023
|
-
let prompt = pasted_prompt_in_composer(
|
|
2014
|
+
let prompt = pasted_prompt_in_composer(text, 15)?;
|
|
2024
2015
|
if let Some(id) = prompt.id {
|
|
2025
2016
|
return Some(PasteLatch::HashId(id));
|
|
2026
2017
|
}
|
|
@@ -2063,7 +2054,6 @@ fn consumption_from_placeholder(text: &str, tracked: Option<PasteLatch>) -> Opti
|
|
|
2063
2054
|
/// boundary: 不重粘文本;不把不同 grok 行数当成可重按的同一次;tracked 为 None 时占位符路径一律不重按(token 仍在底 15 非空行的重按与 tracked 无关)
|
|
2064
2055
|
/// ---
|
|
2065
2056
|
pub(crate) fn should_resubmit_enter(text: &str, marker: &str, tracked: Option<PasteLatch>) -> bool {
|
|
2066
|
-
let text = &*composer_view(text);
|
|
2067
2057
|
if token_in_bottom_n(text, marker, 15) {
|
|
2068
2058
|
return true;
|
|
2069
2059
|
}
|
|
@@ -2098,8 +2088,7 @@ pub(crate) fn this_paste_identity_in_composer(
|
|
|
2098
2088
|
marker: &str,
|
|
2099
2089
|
tracked: Option<PasteLatch>,
|
|
2100
2090
|
) -> bool {
|
|
2101
|
-
should_resubmit_enter(text, marker, tracked)
|
|
2102
|
-
|| composer_joined(&composer_view(text), 15).contains(marker)
|
|
2091
|
+
should_resubmit_enter(text, marker, tracked) || composer_joined(text, 15).contains(marker)
|
|
2103
2092
|
}
|
|
2104
2093
|
|
|
2105
2094
|
/// ---
|
|
@@ -2161,7 +2150,6 @@ pub(crate) fn should_resubmit_enter_cursor(text: &str, marker: &str) -> bool {
|
|
|
2161
2150
|
/// boundary: token 出现在未折叠的高块里不算完成(按早了);只判「能不能按」,不判「按了有没有成」
|
|
2162
2151
|
/// ---
|
|
2163
2152
|
pub(crate) fn paste_ready_for_enter(text: &str, marker: &str) -> bool {
|
|
2164
|
-
let text = &*composer_view(text);
|
|
2165
2153
|
if pasted_prompt_in_composer(text, 15).is_some() {
|
|
2166
2154
|
return true;
|
|
2167
2155
|
}
|
|
@@ -2198,7 +2186,6 @@ pub(crate) fn consumption_from_capture(
|
|
|
2198
2186
|
token_ever_visible: bool,
|
|
2199
2187
|
tracked: Option<PasteLatch>,
|
|
2200
2188
|
) -> Option<bool> {
|
|
2201
|
-
let text = &*composer_view(text);
|
|
2202
2189
|
let token_now = token_in_bottom_n(text, marker, 15);
|
|
2203
2190
|
match token_sighting(token_now, token_ever_visible) {
|
|
2204
2191
|
TokenSighting::Visible => Some(false),
|
|
@@ -2245,13 +2232,10 @@ struct ConsumptionDiagnostics {
|
|
|
2245
2232
|
current_marker_in_bottom_15: Option<bool>,
|
|
2246
2233
|
paste_identity_in_composer: Option<bool>,
|
|
2247
2234
|
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,
|
|
2250
2235
|
}
|
|
2251
2236
|
|
|
2252
2237
|
impl ConsumptionDiagnostics {
|
|
2253
2238
|
fn record(&mut self, observation: ConsumptionCaptureObservation) {
|
|
2254
|
-
self.busy_seen |= observation.busy.is_some();
|
|
2255
2239
|
self.busy_signal_kind = observation.busy.map(|match_| match_.kind);
|
|
2256
2240
|
self.busy_line_from_bottom = observation.busy.map(|match_| match_.line_from_bottom);
|
|
2257
2241
|
self.current_marker_in_bottom_15 = observation.marker_in_bottom_15;
|
|
@@ -2333,22 +2317,6 @@ fn busy_signal_kind_in_line(line: &str) -> Option<BusySignalKind> {
|
|
|
2333
2317
|
}
|
|
2334
2318
|
|
|
2335
2319
|
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
|
-
}
|
|
2352
2320
|
text.lines()
|
|
2353
2321
|
.rev()
|
|
2354
2322
|
.filter(|line| !line.trim().is_empty())
|
|
@@ -2384,7 +2352,6 @@ pub(crate) fn observe_turn_from_capture(text: &str, marker: Option<&str>) -> Tur
|
|
|
2384
2352
|
if provider_busy_signal_in_tail(text) {
|
|
2385
2353
|
return TurnVerification::LeaderNewTurnBoundaryVerified;
|
|
2386
2354
|
}
|
|
2387
|
-
let text = &*composer_view(text);
|
|
2388
2355
|
let paste_still = pasted_prompt_in_composer(text, 15).is_some();
|
|
2389
2356
|
let token_still = marker
|
|
2390
2357
|
.map(|m| token_in_bottom_n(text, m, 15))
|
|
@@ -2416,9 +2383,8 @@ fn submit_attempt_observation(
|
|
|
2416
2383
|
let marker_position = marker.and_then(|m| marker_position_from_bottom(&captured.text, m));
|
|
2417
2384
|
// marker 在时也走 pasted_prompt_match:折叠占位符是编排长粘贴的正信号,
|
|
2418
2385
|
// 不能只在无 token 载荷上才认。matched 仍表示「composer 里还有待提交信号」。
|
|
2419
|
-
let composer = composer_view(&captured.text);
|
|
2420
2386
|
let (matched, matched_literal, where_in_tail) = if let Some(marker) = marker {
|
|
2421
|
-
if token_in_bottom_n(&
|
|
2387
|
+
if token_in_bottom_n(&captured.text, marker, 15) {
|
|
2422
2388
|
(
|
|
2423
2389
|
true,
|
|
2424
2390
|
marker_position.map(|_| marker.to_string()),
|
|
@@ -2426,7 +2392,7 @@ fn submit_attempt_observation(
|
|
|
2426
2392
|
)
|
|
2427
2393
|
} else if let Some((literal, where_in_tail)) = pasted_prompt_match(&captured.text) {
|
|
2428
2394
|
(
|
|
2429
|
-
pasted_prompt_in_composer(&
|
|
2395
|
+
pasted_prompt_in_composer(&captured.text, 15).is_some(),
|
|
2430
2396
|
Some(literal.to_string()),
|
|
2431
2397
|
Some(where_in_tail),
|
|
2432
2398
|
)
|
|
@@ -3708,7 +3674,7 @@ impl Transport for TmuxBackend {
|
|
|
3708
3674
|
marker,
|
|
3709
3675
|
inject_start.elapsed().as_millis() as u64,
|
|
3710
3676
|
));
|
|
3711
|
-
if
|
|
3677
|
+
if observation.busy.is_some() {
|
|
3712
3678
|
consumption_reason = SubmitConsumptionReason::FallbackBusy;
|
|
3713
3679
|
SubmitVerification::EnterSentWithoutPlaceholderCheck
|
|
3714
3680
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@team-agent/installer",
|
|
3
|
-
"version": "0.5.
|
|
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.
|
|
24
|
-
"@team-agent/cli-darwin-x64": "0.5.
|
|
25
|
-
"@team-agent/cli-linux-x64": "0.5.
|
|
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,15 +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
|
-
**
|
|
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;
|
|
23
|
-
|
|
|
24
|
-
|
|
|
22
|
+
| Pi | Several model catalogs; an explicit model needs a qualified ID such as `openai-codex/gpt-6-luna` |
|
|
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 |
|
|
24
|
+
| Claude / other native CLIs | The user's existing workflow, native permissions, model catalog and supported session capabilities |
|
|
25
25
|
| Bypass `true` | Fewer interruptions, broader automatic authority |
|
|
26
26
|
| Bypass `false` | Native permissions remain; human confirmation may interrupt unattended work |
|
|
27
27
|
|
|
@@ -37,12 +37,11 @@ Keep the goal in `TEAM.md` and each worker's instructions in `agents/*.md`. The
|
|
|
37
37
|
agents/reviewer.md
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
Record provider
|
|
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:
|
|
41
41
|
|
|
42
42
|
```markdown
|
|
43
43
|
---
|
|
44
44
|
provider: pi
|
|
45
|
-
model: openai-codex/gpt-6-luna
|
|
46
45
|
dangerously_skip_permissions: false
|
|
47
46
|
---
|
|
48
47
|
Review the change and report concrete regression risks.
|
|
@@ -90,14 +89,14 @@ With the user's provider/bypass choices, `start` unifies adding an absent seat a
|
|
|
90
89
|
|
|
91
90
|
```sh
|
|
92
91
|
team-agent start auditor --role-file /absolute/path/to/auditor.md
|
|
93
|
-
team-agent start analyst --provider pi --
|
|
92
|
+
team-agent start analyst --provider pi --bypass false --prompt "Analyze the proposed change"
|
|
94
93
|
team-agent stop reviewer
|
|
95
94
|
team-agent start reviewer --effort high --bypass false
|
|
96
95
|
```
|
|
97
96
|
|
|
98
97
|
The Pi/false example above still requires the user's explicit choices. File/CLI conflicts are rejected before writing or startup. Omitted settings/body are preserved; `--prompt` replaces the permanent role body, not a one-time task. Stop a running worker before changing settings or instructions. Provider changes are refused. Startup failure restores role/spec bytes and reports failure, not an applied update.
|
|
99
98
|
|
|
100
|
-
Use `agent add/remove/reset/clone/fork` only for those explicit operations. Reset needs intentional approval and `--discard-session
|
|
99
|
+
Use `agent add/remove/reset/clone/fork` only for those explicit operations. Reset needs intentional approval and `--discard-session`. Remove and reset refuse a seat that is still working: wait for it or `stop` it first (remove also needs `--force` for a running idle seat). Fork requires `--as NEW_ID`, and `--in-place` is not supported. See [the operator reference](references/team-agent-operator.md) for capability, profile, force and import boundaries. Never put secrets in role text or copy authentication from another directory.
|
|
101
100
|
|
|
102
101
|
## Optional native CLI argv routing
|
|
103
102
|
|
|
@@ -497,6 +497,20 @@
|
|
|
497
497
|
"owner": "runtime-owner:public-cli",
|
|
498
498
|
"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."
|
|
499
499
|
},
|
|
500
|
+
{
|
|
501
|
+
"command": "team-agent models --provider codex",
|
|
502
|
+
"bucket": "declared_gap",
|
|
503
|
+
"covered": false,
|
|
504
|
+
"owner": "runtime-owner:public-cli",
|
|
505
|
+
"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."
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
"command": "team-agent models --provider grok",
|
|
509
|
+
"bucket": "declared_gap",
|
|
510
|
+
"covered": false,
|
|
511
|
+
"owner": "runtime-owner:public-cli",
|
|
512
|
+
"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."
|
|
513
|
+
},
|
|
500
514
|
{
|
|
501
515
|
"command": "team-agent models --provider pi",
|
|
502
516
|
"bucket": "declared_gap",
|
|
@@ -610,7 +624,7 @@
|
|
|
610
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."
|
|
611
625
|
},
|
|
612
626
|
{
|
|
613
|
-
"command": "team-agent start analyst --provider pi --
|
|
627
|
+
"command": "team-agent start analyst --provider pi --bypass false --prompt \"Analyze the proposed change\"",
|
|
614
628
|
"bucket": "declared_gap",
|
|
615
629
|
"covered": false,
|
|
616
630
|
"owner": "runtime-owner:public-cli",
|