@team-agent/installer 0.5.124 → 0.5.126
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 -69
- package/crates/team-agent/src/cli/emit.rs +45 -15
- package/crates/team-agent/src/cli/intent/runtime.rs +5 -53
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +10 -130
- 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 +28 -33
- package/crates/team-agent/src/cli/models.rs +44 -880
- 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/mod.rs +1 -1
- package/crates/team-agent/src/cli/tests/run_delegation.rs +5 -4
- package/crates/team-agent/src/cli/tests/status_send.rs +17 -0
- package/crates/team-agent/src/compiler/tests.rs +39 -8
- package/crates/team-agent/src/compiler.rs +28 -204
- package/crates/team-agent/src/contract_runtime/backend.rs +79 -40
- package/crates/team-agent/src/contract_runtime/config.rs +37 -24
- package/crates/team-agent/src/contract_runtime/discovery.rs +33 -0
- package/crates/team-agent/src/contract_runtime/fork.rs +368 -0
- package/crates/team-agent/src/contract_runtime/framework.rs +87 -34
- package/crates/team-agent/src/contract_runtime/mod.rs +1 -0
- package/crates/team-agent/src/contract_runtime/registry.rs +299 -21
- package/crates/team-agent/src/coordinator/runtime_detectors.rs +0 -1
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +29 -8
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +0 -42
- 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 +1 -2
- 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 +15 -195
- package/crates/team-agent/src/lifecycle/launch/agent_state.rs +0 -9
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +11 -27
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +18 -29
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +6 -87
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +3 -11
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +74 -244
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +0 -24
- package/crates/team-agent/src/lifecycle/launch/role_source.rs +5 -0
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +21 -61
- 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 -43
- package/crates/team-agent/src/lifecycle/profile_launch.rs +21 -348
- package/crates/team-agent/src/lifecycle/profile_smoke.rs +1 -2
- package/crates/team-agent/src/lifecycle/restart/common.rs +43 -378
- package/crates/team-agent/src/lifecycle/restart/selection.rs +5 -5
- package/crates/team-agent/src/lifecycle/restart.rs +0 -2
- package/crates/team-agent/src/lifecycle/role_config.rs +42 -3
- package/crates/team-agent/src/lifecycle/tests/behavioral_diff_264_red.rs +11 -6
- package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +8 -320
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +60 -145
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +8 -334
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +30 -11
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests/core.rs +17 -16
- package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +12 -12
- package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +3 -51
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +26 -28
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +6 -18
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +52 -70
- package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +4 -157
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +10 -302
- package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +1 -68
- package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +1 -19
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +2 -100
- package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +11 -10
- package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +0 -1
- package/crates/team-agent/src/lifecycle/tests/restart_session_capture_red.rs +2 -106
- package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests/swallow_batch4_semantics_red.rs +2 -254
- package/crates/team-agent/src/lifecycle/tests/upgrade_compat_0211_red.rs +4 -4
- package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +6 -5
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +7 -153
- package/crates/team-agent/src/lifecycle/tests.rs +0 -6
- package/crates/team-agent/src/lifecycle/types.rs +2 -18
- 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 +185 -168
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +5 -5
- 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 +67 -5
- package/crates/team-agent/src/messaging/tests/runtime.rs +110 -4
- package/crates/team-agent/src/messaging/tests/spine.rs +46 -36
- package/crates/team-agent/src/model/enums.rs +1 -8
- package/crates/team-agent/src/provider/adapter.rs +33 -302
- package/crates/team-agent/src/provider/adapters/mod.rs +4 -5
- 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 +14 -273
- package/crates/team-agent/src/provider/session/capture.rs +7 -107
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +0 -4
- package/crates/team-agent/src/provider/session/context_fork.rs +17 -109
- package/crates/team-agent/src/provider/session_scan/common.rs +11 -36
- package/crates/team-agent/src/provider/session_scan/pi.rs +1 -34
- package/crates/team-agent/src/provider/session_scan.rs +4 -14
- package/crates/team-agent/src/provider/submit_now.rs +5 -28
- package/crates/team-agent/src/provider/tests/adapter.rs +39 -275
- package/crates/team-agent/src/provider/tests/classify.rs +53 -0
- package/crates/team-agent/src/provider/tests/command_helpers.rs +3 -15
- package/crates/team-agent/src/provider/tests/idle.rs +0 -25
- package/crates/team-agent/src/provider/types.rs +1 -1
- package/crates/team-agent/src/provider/wire.rs +79 -11
- 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/repository/tests.rs +2 -2
- 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/package.json +4 -4
- package/skills/team-agent/SKILL.md +7 -5
- 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/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/restart/avatar.rs +0 -1805
- package/crates/team-agent/src/lifecycle/tests/claude_compatible_config_red.rs +0 -325
- 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/lifecycle/tests/pi_compiler_red.rs +0 -210
- package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +0 -1409
- package/crates/team-agent/src/provider/adapters/claude.rs +0 -78
- package/crates/team-agent/src/provider/adapters/claude_fork.rs +0 -131
- package/crates/team-agent/src/provider/adapters/cursor_agent.rs +0 -44
- package/crates/team-agent/src/provider/adapters/pi.rs +0 -100
- package/crates/team-agent/src/provider/session/context_fork/claude.rs +0 -123
- package/crates/team-agent/src/provider/session_scan/claude.rs +0 -523
- 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
- package/crates/team-agent/src/test_support/models_timeout_fixture.rs +0 -144
|
@@ -39,7 +39,7 @@ impl Case {
|
|
|
39
39
|
assert!(carrier > 1);
|
|
40
40
|
let started = Utc::now();
|
|
41
41
|
let state = json!({"agents": {"worker": {
|
|
42
|
-
"provider": "
|
|
42
|
+
"provider": "grok", "mcp_config": config,
|
|
43
43
|
"spawned_at": (started - chrono::Duration::seconds(10)).to_rfc3339(),
|
|
44
44
|
"pane_id": "%1", "pane_pid": carrier
|
|
45
45
|
}}});
|
|
@@ -66,9 +66,27 @@ impl Case {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
fn path(&self) -> PathBuf {
|
|
69
|
-
self.
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
self.sibling(&std::process::id().to_string())
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/// `<key>.<suffix>.json`; an empty suffix names the pre-#372 single slot.
|
|
73
|
+
fn sibling(&self, suffix: &str) -> PathBuf {
|
|
74
|
+
let name = key("owner", "worker");
|
|
75
|
+
let file = if suffix.is_empty() {
|
|
76
|
+
format!("{name}.json")
|
|
77
|
+
} else {
|
|
78
|
+
format!("{name}.{suffix}.json")
|
|
79
|
+
};
|
|
80
|
+
self.ws.join(".team/runtime/mcp-handshakes").join(file)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
fn write_private(&self, path: &Path, value: &Value) {
|
|
84
|
+
std::fs::write(path, serde_json::to_vec(value).unwrap()).unwrap();
|
|
85
|
+
std::fs::set_permissions(path, std::fs::Permissions::from_mode(0o600)).unwrap();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
fn receipt(&self) -> Value {
|
|
89
|
+
serde_json::from_slice(&std::fs::read(self.path()).unwrap()).unwrap()
|
|
72
90
|
}
|
|
73
91
|
|
|
74
92
|
fn publish(&self) {
|
|
@@ -96,7 +114,7 @@ impl Drop for Case {
|
|
|
96
114
|
|
|
97
115
|
#[test]
|
|
98
116
|
fn issue345_missing_mcp_config_does_not_disable_eager_admission() {
|
|
99
|
-
for provider in ["
|
|
117
|
+
for provider in ["grok", "codex", "copilot"] {
|
|
100
118
|
let mut case = Case::new();
|
|
101
119
|
case.state["agents"]["worker"]["provider"] = json!(provider);
|
|
102
120
|
case.state["agents"]["worker"]
|
|
@@ -193,19 +211,100 @@ fn changed_current_target_and_new_spawn_do_not_reuse_a_handshake() {
|
|
|
193
211
|
assert!(case.admission().is_err());
|
|
194
212
|
}
|
|
195
213
|
|
|
214
|
+
// Receipt pids beyond any real pid_max, so they never collide with this test.
|
|
215
|
+
const EXITED: &str = "4000000001";
|
|
216
|
+
const FOREIGN: &str = "4000000002";
|
|
217
|
+
|
|
218
|
+
/// A server outside the seat pane (inherited TEAM_AGENT_ID) or an exited one
|
|
219
|
+
/// may hold a newer receipt; neither can mask the seat's live server (#372).
|
|
220
|
+
fn foreign_and_exited(case: &Case) -> (Value, Value) {
|
|
221
|
+
let newer = (case.started + chrono::Duration::seconds(5)).to_rfc3339();
|
|
222
|
+
let mut foreign = case.receipt();
|
|
223
|
+
foreign["started_at"] = json!(newer);
|
|
224
|
+
foreign["flushed_at"] = json!(newer);
|
|
225
|
+
foreign["ancestors"] = json!([{"pid": 1_000_000_001_u32, "birth": "fixture-tmux"}]);
|
|
226
|
+
let mut exited = case.receipt();
|
|
227
|
+
exited["started_at"] = json!(newer);
|
|
228
|
+
exited["flushed_at"] = json!(newer);
|
|
229
|
+
exited["server"]["identity"]["birth_identity"] = json!("exited-server");
|
|
230
|
+
(foreign, exited)
|
|
231
|
+
}
|
|
232
|
+
|
|
196
233
|
#[test]
|
|
197
|
-
fn
|
|
234
|
+
fn issue372_foreign_or_exited_receipts_cannot_mask_the_live_seat_server() {
|
|
198
235
|
let case = Case::new();
|
|
199
236
|
case.publish();
|
|
200
|
-
let
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
.unwrap();
|
|
208
|
-
assert_eq!(
|
|
237
|
+
let (foreign, exited) = foreign_and_exited(&case);
|
|
238
|
+
case.write_private(&case.sibling(EXITED), &exited);
|
|
239
|
+
case.write_private(&case.sibling(FOREIGN), &foreign);
|
|
240
|
+
let admission = case.admission().unwrap().expect("live seat receipt admits");
|
|
241
|
+
assert_eq!(admission.server.identity.pid, std::process::id());
|
|
242
|
+
revalidate(&admission, &case.target, &case.panes).unwrap();
|
|
243
|
+
|
|
244
|
+
std::fs::remove_file(case.path()).unwrap();
|
|
245
|
+
assert_eq!(case.admission().unwrap_err(), "mcp_handshake_server_not_live");
|
|
246
|
+
std::fs::remove_file(case.sibling(EXITED)).unwrap();
|
|
247
|
+
assert_eq!(case.admission().unwrap_err(), "mcp_handshake_ancestry");
|
|
248
|
+
std::fs::remove_file(case.sibling(FOREIGN)).unwrap();
|
|
249
|
+
assert_eq!(case.admission().unwrap_err(), "mcp_handshake_missing");
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
#[test]
|
|
253
|
+
fn issue372_pre_upgrade_single_slot_receipt_still_admits() {
|
|
254
|
+
let case = Case::new();
|
|
255
|
+
case.publish();
|
|
256
|
+
std::fs::rename(case.path(), case.sibling("")).unwrap();
|
|
257
|
+
assert!(case.admission().unwrap().is_some());
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
#[test]
|
|
261
|
+
fn issue372_publish_prunes_exited_receipts_and_keeps_live_ones() {
|
|
262
|
+
let case = Case::new();
|
|
263
|
+
case.publish();
|
|
264
|
+
let (foreign, exited) = foreign_and_exited(&case);
|
|
265
|
+
case.write_private(&case.sibling(""), &exited);
|
|
266
|
+
case.write_private(&case.sibling(EXITED), &exited);
|
|
267
|
+
case.write_private(&case.sibling(FOREIGN), &foreign);
|
|
268
|
+
case.publish();
|
|
269
|
+
assert!(!case.sibling("").exists());
|
|
270
|
+
assert!(!case.sibling(EXITED).exists());
|
|
271
|
+
assert!(case.sibling(FOREIGN).exists(), "a live foreign receipt is only ignored");
|
|
272
|
+
assert!(case.admission().unwrap().is_some());
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
#[test]
|
|
276
|
+
fn issue372_publish_resumes_only_this_seats_parked_messages() {
|
|
277
|
+
let case = Case::new();
|
|
278
|
+
let store = crate::message_store::MessageStore::open(&case.ws).unwrap();
|
|
279
|
+
let parked = store
|
|
280
|
+
.create_message(None, "leader", "worker", "parked", None, false, Some("owner"))
|
|
281
|
+
.unwrap();
|
|
282
|
+
let other = store
|
|
283
|
+
.create_message(None, "leader", "worker", "other team", None, false, Some("other"))
|
|
284
|
+
.unwrap();
|
|
285
|
+
for id in [&parked, &other] {
|
|
286
|
+
assert!(store.claim_for_delivery(id).unwrap());
|
|
287
|
+
assert!(store.park_delivery_before_input(id, 1).unwrap());
|
|
288
|
+
}
|
|
289
|
+
case.publish();
|
|
290
|
+
let row = |id: &str| -> (String, Option<String>) {
|
|
291
|
+
rusqlite::Connection::open(store.db_path())
|
|
292
|
+
.unwrap()
|
|
293
|
+
.query_row(
|
|
294
|
+
"select status, error from messages where message_id = ?1",
|
|
295
|
+
[id],
|
|
296
|
+
|r| Ok((r.get(0)?, r.get(1)?)),
|
|
297
|
+
)
|
|
298
|
+
.unwrap()
|
|
299
|
+
};
|
|
300
|
+
assert_eq!(row(parked.as_str()), ("accepted".to_string(), None));
|
|
301
|
+
assert_eq!(
|
|
302
|
+
row(other.as_str()),
|
|
303
|
+
(
|
|
304
|
+
"queued_until_start".to_string(),
|
|
305
|
+
Some("mcp_handshake_timeout".to_string())
|
|
306
|
+
)
|
|
307
|
+
);
|
|
209
308
|
}
|
|
210
309
|
|
|
211
310
|
#[test]
|
|
@@ -253,7 +352,7 @@ fn config_scope_and_authorized_executable_cannot_be_substituted() {
|
|
|
253
352
|
fn fake_and_pi_keep_their_existing_non_eager_or_runtime_registry_admission() {
|
|
254
353
|
assert!(!crate::provider::get_adapter(Provider::Fake).requires_worker_mcp_handshake());
|
|
255
354
|
assert!(!crate::provider::get_adapter(Provider::Pi).requires_worker_mcp_handshake());
|
|
256
|
-
assert!(crate::provider::get_adapter(Provider::
|
|
355
|
+
assert!(crate::provider::get_adapter(Provider::Grok).requires_worker_mcp_handshake());
|
|
257
356
|
let case = Case::new();
|
|
258
357
|
for provider in ["fake", "pi"] {
|
|
259
358
|
let mut state = case.state.clone();
|