@team-agent/installer 0.5.126 → 0.5.127
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/crates/team-agent/src/cli/diagnose.rs +0 -69
- package/crates/team-agent/src/cli/emit.rs +10 -9
- package/crates/team-agent/src/cli/grok_slot.rs +88 -3
- package/crates/team-agent/src/cli/intent/runtime.rs +6 -4
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +45 -0
- package/crates/team-agent/src/cli/mod.rs +13 -1
- package/crates/team-agent/src/cli/models.rs +27 -181
- package/crates/team-agent/src/cli/tests/leader_watch.rs +1 -1
- package/crates/team-agent/src/cli/tests/mod.rs +2 -2
- package/crates/team-agent/src/cli/tests/run_delegation.rs +3 -3
- package/crates/team-agent/src/cli/tests/status_send.rs +2 -2
- package/crates/team-agent/src/compiler/tests.rs +36 -9
- package/crates/team-agent/src/compiler.rs +3 -2
- package/crates/team-agent/src/contract_runtime/backend.rs +36 -0
- package/crates/team-agent/src/contract_runtime/commands.rs +335 -4
- package/crates/team-agent/src/contract_runtime/config.rs +6 -5
- package/crates/team-agent/src/contract_runtime/framework.rs +2 -5
- package/crates/team-agent/src/contract_runtime/registry.rs +66 -67
- package/crates/team-agent/src/coordinator/steps/abnormal.rs +45 -5
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +27 -10
- package/crates/team-agent/src/coordinator/tests/energy.rs +4 -4
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +2 -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/lifecycle/launch/fork_agent.rs +17 -185
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +4 -487
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +2 -2
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +8 -21
- package/crates/team-agent/src/lifecycle/launch.rs +3 -11
- package/crates/team-agent/src/lifecycle/profile_launch.rs +8 -64
- package/crates/team-agent/src/lifecycle/restart/common.rs +6 -151
- package/crates/team-agent/src/lifecycle/restart/remove.rs +129 -0
- package/crates/team-agent/src/lifecycle/role_config.rs +40 -13
- 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/cli_argv_routing_red.rs +95 -59
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +20 -35
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests/core.rs +22 -48
- package/crates/team-agent/src/lifecycle/tests/f032_startup_prompt_best_effort_red.rs +22 -8
- package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +6 -124
- 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 +136 -256
- 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/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/quick_start_worker_readiness_red.rs +7 -7
- 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 +5 -5
- package/crates/team-agent/src/lifecycle/tests/subprep_codex_trust_roundtrip_red.rs +67 -313
- 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 +70 -15
- package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +35 -35
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +36 -82
- package/crates/team-agent/src/lifecycle/tests.rs +0 -4
- package/crates/team-agent/src/lifecycle/types.rs +2 -5
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +15 -17
- package/crates/team-agent/src/messaging/delivery.rs +9 -61
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +67 -68
- package/crates/team-agent/src/messaging/tests/main_preserved.rs +2 -2
- package/crates/team-agent/src/messaging/tests/runtime.rs +5 -5
- package/crates/team-agent/src/messaging/tests/spine.rs +5 -1
- package/crates/team-agent/src/messaging/tests/wave2.rs +13 -20
- package/crates/team-agent/src/provider/adapter.rs +58 -356
- package/crates/team-agent/src/provider/adapters/mod.rs +5 -7
- package/crates/team-agent/src/provider/session/capture.rs +5 -105
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +8 -20
- package/crates/team-agent/src/provider/session/context_fork.rs +23 -142
- package/crates/team-agent/src/provider/session/mod.rs +2 -3
- package/crates/team-agent/src/provider/session_scan/common.rs +21 -57
- package/crates/team-agent/src/provider/session_scan.rs +6 -16
- package/crates/team-agent/src/provider/tests/adapter.rs +37 -118
- package/crates/team-agent/src/provider/tests/command_helpers.rs +1 -18
- package/crates/team-agent/src/provider/tests/idle.rs +0 -43
- package/crates/team-agent/src/provider/types.rs +0 -4
- package/crates/team-agent/src/provider/wire.rs +34 -8
- package/crates/team-agent/src/tmux_backend.rs +4 -3
- package/package.json +4 -4
- package/skills/team-agent/SKILL.md +3 -2
- package/skills/team-agent/command-coverage.json +14 -0
- package/skills/team-agent/docs/reference/team-agent-operator.md +3 -1
- package/skills/team-agent/references/team-agent-operator.md +3 -1
- 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
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
//! ---
|
|
2
|
-
//! purpose: grok 席位角色 effort 必须进入 argv;缺字段不发 flag
|
|
3
|
-
//! contract:
|
|
4
|
-
//! provides:
|
|
5
|
-
//! - name: grok-effort-medium-reaches-argv
|
|
6
|
-
//! what: effort: medium ⇒ 相邻 `--effort medium`
|
|
7
|
-
//! - name: grok-effort-absent-omits-flag
|
|
8
|
-
//! what: 角色无 effort 字段 ⇒ argv 中 `--effort` 次数为 0
|
|
9
|
-
//! - name: grok-effort-survives-restart
|
|
10
|
-
//! what: restart 后仍带同一档
|
|
11
|
-
//! - name: grok-effort-no-longer-silently-dropped
|
|
12
|
-
//! what: 已废除「grok effort 被静默丢弃 + effort_unsupported」
|
|
13
|
-
//! boundary: 只钉 Provider::Grok 的 effort 启动契约;不改 claude/codex/cursor
|
|
14
|
-
//! maturity: wired
|
|
15
|
-
//! ---
|
|
16
|
-
|
|
17
|
-
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
|
18
|
-
|
|
19
|
-
#[path = "../../../tests/support/hermetic.rs"]
|
|
20
|
-
mod hermetic_guard;
|
|
21
|
-
#[allow(dead_code)]
|
|
22
|
-
fn _hermetic_boundary_marker(_: &hermetic_guard::HermeticTestEnv) {}
|
|
23
|
-
|
|
24
|
-
fn enter_hermetic(tag: &str) -> hermetic_guard::HermeticTestEnv {
|
|
25
|
-
hermetic_guard::HermeticTestEnv::enter_with_leader(tag)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
use std::path::{Path, PathBuf};
|
|
29
|
-
use std::sync::atomic::{AtomicU64, Ordering};
|
|
30
|
-
|
|
31
|
-
use serial_test::serial;
|
|
32
|
-
use team_agent::lifecycle::{quick_start_with_transport_in_workspace, restart_with_transport};
|
|
33
|
-
use team_agent::transport::test_support::OfflineTransport;
|
|
34
|
-
|
|
35
|
-
#[test]
|
|
36
|
-
#[serial(env)]
|
|
37
|
-
fn grok_role_effort_medium_reaches_argv() {
|
|
38
|
-
let _hermetic = enter_hermetic("grok-effort-medium");
|
|
39
|
-
let (ws, _home, _guard, team) = seed_grok("effort-medium", Some("medium"));
|
|
40
|
-
let transport = OfflineTransport::new();
|
|
41
|
-
quick_start_with_transport_in_workspace(&ws, &team, None, true, Some("grokteam"), &transport)
|
|
42
|
-
.expect("grok role with effort: medium must start");
|
|
43
|
-
let argv = first_spawn_argv(&transport);
|
|
44
|
-
assert!(
|
|
45
|
-
argv_contains_adjacent(&argv, &["--effort", "medium"]),
|
|
46
|
-
"declared effort must appear as adjacent `--effort medium`; argv={argv:?}"
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
#[test]
|
|
51
|
-
#[serial(env)]
|
|
52
|
-
fn grok_role_without_effort_emits_zero_effort_flags() {
|
|
53
|
-
let _hermetic = enter_hermetic("grok-effort-absent");
|
|
54
|
-
let (ws, _home, _guard, team) = seed_grok("effort-absent", None);
|
|
55
|
-
let transport = OfflineTransport::new();
|
|
56
|
-
quick_start_with_transport_in_workspace(&ws, &team, None, true, Some("grokteam"), &transport)
|
|
57
|
-
.expect("grok role without effort must start");
|
|
58
|
-
let argv = first_spawn_argv(&transport);
|
|
59
|
-
let count = argv.iter().filter(|a| *a == "--effort").count();
|
|
60
|
-
assert_eq!(
|
|
61
|
-
count, 0,
|
|
62
|
-
"absent effort must not invent a default flag; argv={argv:?}"
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
#[test]
|
|
67
|
-
#[serial(env)]
|
|
68
|
-
fn grok_restart_keeps_declared_effort_medium() {
|
|
69
|
-
let _hermetic = enter_hermetic("grok-effort-restart");
|
|
70
|
-
let (ws, _home, _guard, team) = seed_grok("effort-restart", Some("medium"));
|
|
71
|
-
let first = OfflineTransport::new();
|
|
72
|
-
quick_start_with_transport_in_workspace(&ws, &team, None, true, Some("grokteam"), &first)
|
|
73
|
-
.expect("initial grok start");
|
|
74
|
-
assert!(
|
|
75
|
-
argv_contains_adjacent(&first_spawn_argv(&first), &["--effort", "medium"]),
|
|
76
|
-
"precondition: first start must carry medium; argv={:?}",
|
|
77
|
-
first_spawn_argv(&first)
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
seed_healthy_coordinator(&ws);
|
|
81
|
-
|
|
82
|
-
let restart = OfflineTransport::new();
|
|
83
|
-
restart_with_transport(&ws, true, Some("grokteam"), &restart)
|
|
84
|
-
.expect("restart --allow-fresh must start the grok seat");
|
|
85
|
-
let argv = first_spawn_argv(&restart);
|
|
86
|
-
assert!(
|
|
87
|
-
argv_contains_adjacent(&argv, &["--effort", "medium"]),
|
|
88
|
-
"restart must keep the persisted effort; argv={argv:?}"
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
#[test]
|
|
93
|
-
#[serial(env)]
|
|
94
|
-
fn grok_role_effort_max_is_rejected_at_compile() {
|
|
95
|
-
let (ws, _home, _guard, team) = seed_grok("effort-max", Some("max"));
|
|
96
|
-
let err =
|
|
97
|
-
team_agent::compiler::compile_team(&team).expect_err("grok + effort:max must not compile");
|
|
98
|
-
let text = err.to_string();
|
|
99
|
-
assert!(
|
|
100
|
-
text.contains("max") && (text.contains("claude") || text.contains("only supported")),
|
|
101
|
-
"max must stay claude-only at compile; err={text}"
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
#[test]
|
|
106
|
-
#[serial(env)]
|
|
107
|
-
fn grok_medium_effort_no_longer_emits_unsupported_event() {
|
|
108
|
-
// 已废除的行为:旧实现把 grok 的 effort 静默丢掉并写 provider.effort_unsupported,
|
|
109
|
-
// 此断言证明它确实没了。
|
|
110
|
-
let (ws, _home, _guard, team) = seed_grok("effort-tombstone", Some("medium"));
|
|
111
|
-
let transport = OfflineTransport::new();
|
|
112
|
-
quick_start_with_transport_in_workspace(&ws, &team, None, true, Some("grokteam"), &transport)
|
|
113
|
-
.expect("grok role with effort: medium must start");
|
|
114
|
-
let events = team_agent::event_log::EventLog::new(&ws)
|
|
115
|
-
.tail(0)
|
|
116
|
-
.expect("events");
|
|
117
|
-
let dropped = events.iter().any(|event| {
|
|
118
|
-
event.get("event").and_then(serde_json::Value::as_str)
|
|
119
|
-
== Some("provider.effort_unsupported")
|
|
120
|
-
});
|
|
121
|
-
assert!(
|
|
122
|
-
!dropped,
|
|
123
|
-
"grok medium must not emit provider.effort_unsupported; events={events:?}"
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/// restart 的就绪门要求 `coordinator_health().ok`,而单测里 `start_coordinator`
|
|
128
|
-
/// spawn 的是 `std::env::current_exe()` —— 也就是 libtest 测试二进制本身,它一启动
|
|
129
|
-
/// 就以 `Unrecognized option: 'workspace'` 退出并变成僵尸,`pid_is_running` 的
|
|
130
|
-
/// `ps stat=` 一看到 `Z` 就判 not running。于是就绪门只能靠「抢在死婴被看到之前
|
|
131
|
-
/// 探到它」这个竞态过关,慢机/高负载上必然超时。这里按本仓既有写法(见
|
|
132
|
-
/// `copilot_provider_red.rs` / `restart_build_before_destroy_0540_contract.rs`)
|
|
133
|
-
/// 预先把 pid 文件与 metadata 指向测试进程自己,让 `start_coordinator` 走
|
|
134
|
-
/// `AlreadyRunning` 早返回,竞态被删掉而不是被调宽。
|
|
135
|
-
fn seed_healthy_coordinator(workspace: &Path) {
|
|
136
|
-
let workspace = crate::coordinator::WorkspacePath::new(workspace.to_path_buf());
|
|
137
|
-
let pid = crate::coordinator::Pid::new(std::process::id());
|
|
138
|
-
std::fs::create_dir_all(
|
|
139
|
-
crate::coordinator::coordinator_pid_path(&workspace)
|
|
140
|
-
.parent()
|
|
141
|
-
.unwrap(),
|
|
142
|
-
)
|
|
143
|
-
.unwrap();
|
|
144
|
-
crate::coordinator::write_coordinator_metadata(
|
|
145
|
-
&workspace,
|
|
146
|
-
pid,
|
|
147
|
-
crate::coordinator::MetadataSource::Boot,
|
|
148
|
-
)
|
|
149
|
-
.expect("write coordinator metadata");
|
|
150
|
-
std::fs::write(
|
|
151
|
-
crate::coordinator::coordinator_pid_path(&workspace),
|
|
152
|
-
pid.to_string(),
|
|
153
|
-
)
|
|
154
|
-
.expect("write coordinator pid");
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
fn seed_grok(tag: &str, effort: Option<&str>) -> (PathBuf, PathBuf, HomeGuard, PathBuf) {
|
|
158
|
-
let ws = tmp_dir(tag);
|
|
159
|
-
super::launch_spawn::seed_healthy_coordinator(&ws);
|
|
160
|
-
let home = tmp_dir(&format!("{tag}-home"));
|
|
161
|
-
seed_grok_home(&home, Some(&ws));
|
|
162
|
-
let guard = HomeGuard::set(&home);
|
|
163
|
-
let team = write_grok_role(&ws, effort);
|
|
164
|
-
(ws, home, guard, team)
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
fn first_spawn_argv(transport: &OfflineTransport) -> Vec<String> {
|
|
168
|
-
let records = transport.spawn_records();
|
|
169
|
-
assert!(
|
|
170
|
-
!records.is_empty(),
|
|
171
|
-
"expected a worker spawn so argv can be inspected; records={records:?}"
|
|
172
|
-
);
|
|
173
|
-
records[0].1.clone()
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
fn argv_contains_adjacent(hay: &[String], needle: &[&str]) -> bool {
|
|
177
|
-
hay.windows(needle.len())
|
|
178
|
-
.any(|window| window.iter().map(String::as_str).eq(needle.iter().copied()))
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
fn write_grok_role(ws: &Path, effort: Option<&str>) -> PathBuf {
|
|
182
|
-
let team = ws.join("grokteam");
|
|
183
|
-
std::fs::create_dir_all(team.join("agents")).unwrap();
|
|
184
|
-
std::fs::write(
|
|
185
|
-
team.join("TEAM.md"),
|
|
186
|
-
"---\nname: grokteam\nobjective: grok effort argv.\nprovider: grok\ndangerously_skip_permissions: false\n---\n\nTeam.\n",
|
|
187
|
-
)
|
|
188
|
-
.unwrap();
|
|
189
|
-
let effort_line = match effort {
|
|
190
|
-
Some(value) => format!("effort: {value}\n"),
|
|
191
|
-
None => String::new(),
|
|
192
|
-
};
|
|
193
|
-
std::fs::write(
|
|
194
|
-
team.join("agents").join("grok_writer.md"),
|
|
195
|
-
format!(
|
|
196
|
-
"---\nname: grok_writer\nrole: Grok Writer\nprovider: grok\nmodel: grok-4.6\n{effort_line}auth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nWorker.\n"
|
|
197
|
-
),
|
|
198
|
-
)
|
|
199
|
-
.unwrap();
|
|
200
|
-
team
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
fn seed_grok_home(home: &Path, trusted_cwd: Option<&Path>) {
|
|
204
|
-
let grok = home.join(".grok");
|
|
205
|
-
std::fs::create_dir_all(&grok).unwrap();
|
|
206
|
-
std::fs::write(grok.join("auth.json"), r#"{"test":"ok"}"#).unwrap();
|
|
207
|
-
if let Some(cwd) = trusted_cwd {
|
|
208
|
-
std::fs::write(
|
|
209
|
-
grok.join("trusted_folders.toml"),
|
|
210
|
-
format!("[folders.\"{}\"]\ntrusted = true\n", cwd.display()),
|
|
211
|
-
)
|
|
212
|
-
.unwrap();
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
struct HomeGuard {
|
|
217
|
-
prev: Option<String>,
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
impl HomeGuard {
|
|
221
|
-
fn set(home: &Path) -> Self {
|
|
222
|
-
let prev = std::env::var("HOME").ok();
|
|
223
|
-
std::env::set_var("HOME", home);
|
|
224
|
-
Self { prev }
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
impl Drop for HomeGuard {
|
|
229
|
-
fn drop(&mut self) {
|
|
230
|
-
match &self.prev {
|
|
231
|
-
Some(value) => std::env::set_var("HOME", value),
|
|
232
|
-
None => std::env::remove_var("HOME"),
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
fn tmp_dir(tag: &str) -> PathBuf {
|
|
238
|
-
static N: AtomicU64 = AtomicU64::new(0);
|
|
239
|
-
let dir = std::env::temp_dir().join(format!(
|
|
240
|
-
"ta-rs-grok-effort-{tag}-{}-{}",
|
|
241
|
-
std::process::id(),
|
|
242
|
-
N.fetch_add(1, Ordering::Relaxed)
|
|
243
|
-
));
|
|
244
|
-
let _ = std::fs::remove_dir_all(&dir);
|
|
245
|
-
std::fs::create_dir_all(&dir).unwrap();
|
|
246
|
-
std::fs::canonicalize(dir).unwrap()
|
|
247
|
-
}
|