@team-agent/installer 0.5.125 → 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 -137
- package/crates/team-agent/src/cli/emit.rs +13 -8
- 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 +55 -10
- package/crates/team-agent/src/cli/mod.rs +35 -29
- package/crates/team-agent/src/cli/models.rs +33 -944
- package/crates/team-agent/src/cli/tests/leader_watch.rs +1 -1
- package/crates/team-agent/src/cli/tests/mod.rs +3 -3
- package/crates/team-agent/src/cli/tests/run_delegation.rs +8 -7
- package/crates/team-agent/src/cli/tests/status_send.rs +2 -2
- package/crates/team-agent/src/compiler/tests.rs +54 -12
- package/crates/team-agent/src/compiler.rs +7 -205
- package/crates/team-agent/src/contract_runtime/backend.rs +97 -38
- package/crates/team-agent/src/contract_runtime/commands.rs +335 -4
- package/crates/team-agent/src/contract_runtime/config.rs +12 -8
- package/crates/team-agent/src/contract_runtime/fork.rs +368 -0
- package/crates/team-agent/src/contract_runtime/framework.rs +8 -13
- package/crates/team-agent/src/contract_runtime/mod.rs +1 -0
- package/crates/team-agent/src/contract_runtime/registry.rs +100 -60
- package/crates/team-agent/src/coordinator/steps/abnormal.rs +45 -5
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +54 -16
- package/crates/team-agent/src/coordinator/tests/energy.rs +4 -4
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +2 -44
- 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/leader/start.rs +1 -1
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +2 -195
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +11 -27
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +22 -200
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +6 -87
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +5 -496
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +74 -244
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +2 -26
- package/crates/team-agent/src/lifecycle/launch/role_source.rs +5 -0
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +26 -51
- package/crates/team-agent/src/lifecycle/launch.rs +3 -34
- package/crates/team-agent/src/lifecycle/profile_launch.rs +18 -373
- package/crates/team-agent/src/lifecycle/restart/common.rs +45 -463
- 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 +0 -2
- 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 +38 -236
- 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 +106 -186
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +4 -334
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +19 -15
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests/core.rs +33 -58
- 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 +15 -133
- package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +3 -51
- 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 +162 -284
- 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/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 +15 -14
- 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 -1478
- 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 +2 -254
- 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 +39 -38
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +42 -97
- package/crates/team-agent/src/lifecycle/tests.rs +0 -7
- package/crates/team-agent/src/lifecycle/types.rs +2 -21
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +15 -17
- package/crates/team-agent/src/messaging/delivery.rs +14 -195
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +5 -5
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +68 -69
- 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 +30 -32
- package/crates/team-agent/src/messaging/tests/wave2.rs +13 -20
- package/crates/team-agent/src/provider/adapter.rs +71 -572
- package/crates/team-agent/src/provider/adapters/mod.rs +6 -8
- package/crates/team-agent/src/provider/model_catalog.rs +13 -201
- package/crates/team-agent/src/provider/session/capture.rs +11 -211
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +8 -24
- package/crates/team-agent/src/provider/session/context_fork.rs +29 -240
- package/crates/team-agent/src/provider/session/mod.rs +2 -3
- package/crates/team-agent/src/provider/session_scan/common.rs +27 -87
- package/crates/team-agent/src/provider/session_scan/pi.rs +1 -34
- package/crates/team-agent/src/provider/session_scan.rs +7 -23
- package/crates/team-agent/src/provider/tests/adapter.rs +66 -204
- package/crates/team-agent/src/provider/tests/command_helpers.rs +3 -29
- package/crates/team-agent/src/provider/tests/idle.rs +0 -68
- package/crates/team-agent/src/provider/types.rs +0 -4
- package/crates/team-agent/src/provider/wire.rs +77 -23
- 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.rs +4 -3
- package/package.json +4 -4
- package/skills/team-agent/SKILL.md +8 -5
- package/skills/team-agent/command-coverage.json +29 -1
- package/skills/team-agent/docs/reference/team-agent-operator.md +7 -3
- package/skills/team-agent/references/team-agent-operator.md +7 -3
- package/crates/team-agent/src/lifecycle/launch/grok_per_seat.rs +0 -260
- 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/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/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/codex.rs +0 -101
- package/crates/team-agent/src/provider/adapters/grok.rs +0 -67
- 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/context_fork/codex.rs +0 -514
- package/crates/team-agent/src/provider/session_scan/claude.rs +0 -523
- package/crates/team-agent/src/provider/session_scan/codex.rs +0 -326
- package/crates/team-agent/src/provider/session_scan/grok.rs +0 -288
- package/crates/team-agent/src/test_support/models_timeout_fixture.rs +0 -144
package/Cargo.lock
CHANGED
package/Cargo.toml
CHANGED
|
@@ -9,74 +9,6 @@ use crate::model::pane_authority_refusal::{
|
|
|
9
9
|
use crate::provider::wire::{command_name, parse_provider, provider_wire};
|
|
10
10
|
use crate::transport::Transport;
|
|
11
11
|
|
|
12
|
-
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize)]
|
|
13
|
-
#[serde(rename_all = "snake_case")]
|
|
14
|
-
pub(crate) enum PiBackingStatus {
|
|
15
|
-
Pending,
|
|
16
|
-
Captured,
|
|
17
|
-
Missing,
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize)]
|
|
21
|
-
#[serde(rename_all = "snake_case")]
|
|
22
|
-
pub(crate) enum PiMcpStatus {
|
|
23
|
-
Unavailable,
|
|
24
|
-
ConfiguredLazy,
|
|
25
|
-
RoundtripVerified,
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
pub(crate) struct PiDoctorInput {
|
|
29
|
-
pub executable_chain_verified: bool,
|
|
30
|
-
pub pi_version: Option<String>,
|
|
31
|
-
pub adapter_version: Option<String>,
|
|
32
|
-
pub catalog_sha256: Option<String>,
|
|
33
|
-
pub selected_model: Option<String>,
|
|
34
|
-
pub candidate_executable: Option<std::path::PathBuf>,
|
|
35
|
-
pub wrapper: Option<std::path::PathBuf>,
|
|
36
|
-
pub mcp_roundtrip_at: Option<String>,
|
|
37
|
-
pub backing: PiBackingStatus,
|
|
38
|
-
pub activity: crate::provider::TurnState,
|
|
39
|
-
pub activity_source: crate::provider::ClassifySource,
|
|
40
|
-
pub env_key_names: Vec<String>,
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize)]
|
|
44
|
-
pub(crate) struct PiDoctorFacts {
|
|
45
|
-
pub mcp: PiMcpStatus,
|
|
46
|
-
pub mcp_connected: bool,
|
|
47
|
-
pub backing: PiBackingStatus,
|
|
48
|
-
pub activity: crate::provider::TurnState,
|
|
49
|
-
pub activity_source: crate::provider::ClassifySource,
|
|
50
|
-
pub auth_hint: crate::provider::AuthHintStatus,
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
pub(crate) fn pi_doctor_facts(input: PiDoctorInput) -> PiDoctorFacts {
|
|
54
|
-
let mcp = if input.mcp_roundtrip_at.is_some() {
|
|
55
|
-
PiMcpStatus::RoundtripVerified
|
|
56
|
-
} else if input.wrapper.is_some() {
|
|
57
|
-
PiMcpStatus::ConfiguredLazy
|
|
58
|
-
} else {
|
|
59
|
-
PiMcpStatus::Unavailable
|
|
60
|
-
};
|
|
61
|
-
let _ = (
|
|
62
|
-
input.executable_chain_verified,
|
|
63
|
-
input.pi_version,
|
|
64
|
-
input.adapter_version,
|
|
65
|
-
input.catalog_sha256,
|
|
66
|
-
input.selected_model,
|
|
67
|
-
input.candidate_executable,
|
|
68
|
-
input.env_key_names,
|
|
69
|
-
);
|
|
70
|
-
PiDoctorFacts {
|
|
71
|
-
mcp,
|
|
72
|
-
mcp_connected: mcp == PiMcpStatus::RoundtripVerified,
|
|
73
|
-
backing: input.backing,
|
|
74
|
-
activity: input.activity,
|
|
75
|
-
activity_source: input.activity_source,
|
|
76
|
-
auth_hint: crate::provider::AuthHintStatus::Unknown,
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
12
|
/// 0.5.39 Slice 1 (tmux-server-death-locate §11.1 B): classify a tmux
|
|
81
13
|
/// transport error string into a diagnose issue id. When the underlying
|
|
82
14
|
/// tmux subprocess stderr contains `server exited unexpectedly`, the
|
|
@@ -1248,22 +1180,6 @@ mod tests {
|
|
|
1248
1180
|
);
|
|
1249
1181
|
}
|
|
1250
1182
|
|
|
1251
|
-
fn write_codex_identity_rollout(
|
|
1252
|
-
workspace: &std::path::Path,
|
|
1253
|
-
session_id: &str,
|
|
1254
|
-
embedded_agent_id: &str,
|
|
1255
|
-
) -> std::path::PathBuf {
|
|
1256
|
-
let path = workspace.join("rollout-poison.jsonl");
|
|
1257
|
-
let text = format!(
|
|
1258
|
-
"{{\"session_meta\":{{\"payload\":{{\"id\":\"{session_id}\",\"cwd\":\"{}\"}}}}}}\n\
|
|
1259
|
-
{{\"type\":\"turn_context\",\"payload\":{{}}}}\n\
|
|
1260
|
-
{{\"type\":\"response_item\",\"payload\":{{\"content\":[{{\"type\":\"input_text\",\"text\":\"You are Team Agent worker `{embedded_agent_id}` with role `fixture`.\"}}]}}}}\n",
|
|
1261
|
-
workspace.to_string_lossy()
|
|
1262
|
-
);
|
|
1263
|
-
std::fs::write(&path, text).expect("write rollout");
|
|
1264
|
-
path
|
|
1265
|
-
}
|
|
1266
|
-
|
|
1267
1183
|
fn coordinator_health_fixture(
|
|
1268
1184
|
status: crate::coordinator::CoordinatorHealthStatus,
|
|
1269
1185
|
metadata_mismatch_reason: Option<&str>,
|
|
@@ -1339,59 +1255,6 @@ mod tests {
|
|
|
1339
1255
|
);
|
|
1340
1256
|
}
|
|
1341
1257
|
|
|
1342
|
-
#[test]
|
|
1343
|
-
fn diagnose_surfaces_codex_session_identity_mismatch() {
|
|
1344
|
-
let workspace =
|
|
1345
|
-
std::env::temp_dir().join(format!("ta-diagnose-crossbind-{}", std::process::id()));
|
|
1346
|
-
let _ = std::fs::remove_dir_all(&workspace);
|
|
1347
|
-
std::fs::create_dir_all(&workspace).unwrap();
|
|
1348
|
-
let rollout = write_codex_identity_rollout(
|
|
1349
|
-
&workspace,
|
|
1350
|
-
"019f3327-c35a-7023-b3cd-1bea93a7a157",
|
|
1351
|
-
"ios-dev",
|
|
1352
|
-
);
|
|
1353
|
-
let state = json!({
|
|
1354
|
-
"session_name": "team-fixture",
|
|
1355
|
-
"leader_receiver": {
|
|
1356
|
-
"mode": "direct_tmux",
|
|
1357
|
-
"status": "attached",
|
|
1358
|
-
"pane_id": "%leader",
|
|
1359
|
-
"provider": "codex"
|
|
1360
|
-
},
|
|
1361
|
-
"agents": {
|
|
1362
|
-
"frontend": {
|
|
1363
|
-
"provider": "codex",
|
|
1364
|
-
"status": "running",
|
|
1365
|
-
"session_id": "019f3327-c35a-7023-b3cd-1bea93a7a157",
|
|
1366
|
-
"rollout_path": rollout.to_string_lossy(),
|
|
1367
|
-
"captured_at": "2026-07-05T17:04:04Z",
|
|
1368
|
-
"captured_via": "fs_watch",
|
|
1369
|
-
"spawn_cwd": workspace.to_string_lossy(),
|
|
1370
|
-
"window": "frontend"
|
|
1371
|
-
}
|
|
1372
|
-
}
|
|
1373
|
-
});
|
|
1374
|
-
let backend = crate::transport::test_support::OfflineTransport::new()
|
|
1375
|
-
.with_session_present(true)
|
|
1376
|
-
.with_windows(vec![crate::transport::WindowName::new("frontend")]);
|
|
1377
|
-
let (issues, repairs) = diagnose_runtime(&state, &backend);
|
|
1378
|
-
assert!(
|
|
1379
|
-
issues
|
|
1380
|
-
.as_array()
|
|
1381
|
-
.is_some_and(|items| items.iter().any(|item| item.as_str()
|
|
1382
|
-
== Some("session_identity_mismatch:frontend"))),
|
|
1383
|
-
"diagnose must surface session_identity_mismatch for poisoned Codex tuples; issues={issues}"
|
|
1384
|
-
);
|
|
1385
|
-
assert!(
|
|
1386
|
-
repairs.as_array().is_some_and(|items| items.iter().any(|item| {
|
|
1387
|
-
item.get("issue").and_then(Value::as_str)
|
|
1388
|
-
== Some("session_identity_mismatch:frontend")
|
|
1389
|
-
})),
|
|
1390
|
-
"diagnose should include an explicit repair hint for the mismatched tuple; repairs={repairs}"
|
|
1391
|
-
);
|
|
1392
|
-
let _ = std::fs::remove_dir_all(&workspace);
|
|
1393
|
-
}
|
|
1394
|
-
|
|
1395
1258
|
fn pane(session: &str, pane_id: &str, window: &str) -> crate::transport::PaneInfo {
|
|
1396
1259
|
crate::transport::PaneInfo {
|
|
1397
1260
|
pane_id: crate::transport::PaneId::new(pane_id),
|
|
@@ -463,7 +463,7 @@ pub(super) fn command_help(command: Option<&str>) -> String {
|
|
|
463
463
|
"team-agent restart worker --dry-run --json\nteam-agent restart worker --session preserve --workspace . --dry-run --json", "Use team-agent team restart for deliberate team recovery; choose --session preserve when context must be retained. Team restart leaves explicitly stopped/paused seats alone; team-agent start intentionally activates the non-paused roster. Inspect partial/unknown outcomes with status/doctor, never blind reset or retry."),
|
|
464
464
|
"shutdown" => ("Compatibility bridge: stop only the selected workspace/team. Logs are retained by default; --keep-logs remains compatible.\n--json reports scope, degradation and owned residuals. Success does not mean other teams were shut down.",
|
|
465
465
|
"team-agent shutdown --workspace .\nteam-agent shutdown --workspace . --team help-demo --json", "Prefer team-agent stop --workspace . --team KEY --json. Verify this team's owned residuals are empty; use team-agent start for authorized later activation. Do not clean up other teams or shared servers."),
|
|
466
|
-
"add-agent" => ("Compatibility add-only entry. <agent> names the new seat; --provider/--model/--effort select intentional launch settings.\n--bypass requires true|false; --prompt sets responsibilities; --profile selects a local profile.\nProvider and bypass must be explicit in arguments or --role-file. Conflicting settings are refused before writes. --force requires explicit authorization, a positively dead old pane and no live cohort.",
|
|
466
|
+
"add-agent" => ("Compatibility add-only entry. <agent> names the new seat; --provider/--model/--effort select intentional launch settings.\n--bypass requires true|false; --prompt sets responsibilities; --profile selects a local profile.\nProvider and bypass must be explicit in arguments or --role-file. Conflicting settings are refused before writes. --force requires explicit authorization, a positively dead old pane and no live cohort;\nfor a removed seat, --force re-adopts the role file it left behind and CLI values override it.",
|
|
467
467
|
"team-agent add-agent reviewer --provider pi --model openai-codex/gpt-6-luna --bypass false --prompt 'Review tasks'\nteam-agent add-agent reviewer --role-file ./agents/reviewer.md", "Prefer team-agent start reviewer --role-file FILE for add-or-wake, or team-agent agent add reviewer for strict new-seat behavior. Keep provider/bypass explicit; check status and send a task after actual startup."),
|
|
468
468
|
"start-agent" => ("Compatibility entry starts an existing stopped seat only; a running seat is refused.\n--provider/--model/--effort/--bypass select intentional settings; --prompt replaces permanent instructions and --profile selects local authentication.\nA different provider is refused. Use --allow-fresh only after explicit authorization to lose saved context.",
|
|
469
469
|
"team-agent start-agent worker\nteam-agent start-agent worker --model openai-codex/gpt-6-luna", "Prefer team-agent start worker for daily add-or-wake or verified live no-op. Use team-agent stop worker before applying changed settings; inspect status and send a task afterward. A no-op is not role synchronization or business readiness."),
|
|
@@ -1643,10 +1643,12 @@ fn role_agent_args(
|
|
|
1643
1643
|
}
|
|
1644
1644
|
match flag {
|
|
1645
1645
|
"--provider" => {
|
|
1646
|
-
// A contract name
|
|
1646
|
+
// A contract name is written as the leaf's public name (`agent` →
|
|
1647
|
+
// `cursor`, `claude_code` → `claude`, `codex_cli` → `codex`); it
|
|
1648
|
+
// declares the same leaf.
|
|
1647
1649
|
#[cfg(unix)]
|
|
1648
|
-
let contract = crate::contract_runtime::registry::declared(&value
|
|
1649
|
-
.map(
|
|
1650
|
+
let contract = crate::contract_runtime::registry::declared(&value)
|
|
1651
|
+
.map(crate::contract_runtime::registry::public_name);
|
|
1650
1652
|
#[cfg(not(unix))]
|
|
1651
1653
|
let contract: Option<&str> = None;
|
|
1652
1654
|
let provider = match contract {
|
|
@@ -1748,16 +1750,19 @@ mod role_cli_tests {
|
|
|
1748
1750
|
fn provider_accepts_contract_names_as_their_leaf_id() {
|
|
1749
1751
|
for (name, leaf) in [
|
|
1750
1752
|
("cursor", "cursor"), ("cursor-agent", "cursor"), ("agent", "cursor"),
|
|
1751
|
-
("cursor_agent", "cursor"), ("kiro", "kiro"),
|
|
1753
|
+
("cursor_agent", "cursor"), ("kiro", "kiro"),
|
|
1754
|
+
// Claude Code, Codex, Grok Build and Pi keep their public command
|
|
1755
|
+
// names, which declare the leaf.
|
|
1756
|
+
("claude", "claude"), ("claude_code", "claude"), ("claude-code", "claude"),
|
|
1757
|
+
("claude_tui", "claude"), ("codex", "codex"), ("codex_cli", "codex"),
|
|
1758
|
+
("codex-cli", "codex"), ("codex_tui", "codex"), ("grok", "grok"),
|
|
1759
|
+
("grok_build", "grok"), ("pi", "pi"), ("pi_tui", "pi"),
|
|
1752
1760
|
] {
|
|
1753
1761
|
let (_, patch) = role_agent_args(
|
|
1754
1762
|
&strings(&["w", "--provider", name, "--bypass", "true"]), true,
|
|
1755
1763
|
).unwrap_or_else(|error| panic!("{name}: {error}"));
|
|
1756
1764
|
assert_eq!(patch.provider.as_deref(), Some(leaf), "{name}");
|
|
1757
1765
|
}
|
|
1758
|
-
let (_, patch) =
|
|
1759
|
-
role_agent_args(&strings(&["w", "--provider", "codex", "--bypass", "true"]), true).unwrap();
|
|
1760
|
-
assert_eq!(patch.provider.as_deref(), Some("codex"), "a bare shared key stays legacy");
|
|
1761
1766
|
assert!(role_agent_args(&strings(&["w", "--provider", "Cursor", "--bypass", "true"]), true).is_err());
|
|
1762
1767
|
}
|
|
1763
1768
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
//! ---
|
|
2
|
-
//! purpose: 对账 .grok/config.toml
|
|
2
|
+
//! purpose: 对账 .grok/config.toml 残余共享槽与升级前遗留的在役 grok 席,含未首 turn 危险窗
|
|
3
3
|
//! contract:
|
|
4
4
|
//! provides:
|
|
5
5
|
//! - name: grok_slot_report
|
|
6
6
|
//! what: 盘上 ID/OWNER/AUTH、在役 grok、pre_first_turn;读不出为 unjudgeable
|
|
7
7
|
//! boundary:
|
|
8
8
|
//! - 读不出不报一致
|
|
9
|
-
//! - 不写盘、不改 overlay
|
|
9
|
+
//! - 不写盘、不改 overlay;legacy grok worker 已退役,本文件只做观测,
|
|
10
|
+
//! 帮助清理升级前留下的席位与共享槽(grok_build 叶子不写这份 toml)
|
|
10
11
|
//! maturity: wired
|
|
11
12
|
//! ---
|
|
12
13
|
|
|
@@ -91,8 +92,50 @@ struct DiskSlot {
|
|
|
91
92
|
extras: Vec<(String, String)>,
|
|
92
93
|
}
|
|
93
94
|
|
|
95
|
+
/// Shared identity keys belong on pane env. The only TEAM_AGENT_* key
|
|
96
|
+
/// allowed in the directory-scoped grok toml is WORKSPACE (same cwd).
|
|
97
|
+
fn is_per_seat_env_key(key: &str) -> bool {
|
|
98
|
+
let key = key.trim();
|
|
99
|
+
key.starts_with("TEAM_AGENT_") && key != "TEAM_AGENT_WORKSPACE"
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/// Per-seat keys of every `*.env` table, first-seen order, values unquoted.
|
|
103
|
+
fn per_seat_keys_in_toml(text: &str) -> Vec<(String, String)> {
|
|
104
|
+
let mut in_env_table = false;
|
|
105
|
+
let mut out = Vec::new();
|
|
106
|
+
for line in text.lines() {
|
|
107
|
+
let trimmed = line.trim();
|
|
108
|
+
if trimmed.starts_with('[') && trimmed.ends_with(']') {
|
|
109
|
+
let name = &trimmed[1..trimmed.len() - 1];
|
|
110
|
+
in_env_table = name.ends_with(".env");
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
if !in_env_table {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
let Some((key, rest)) = trimmed.split_once('=') else {
|
|
117
|
+
continue;
|
|
118
|
+
};
|
|
119
|
+
let key = key.trim();
|
|
120
|
+
if !is_per_seat_env_key(key) {
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
let rest = rest.trim();
|
|
124
|
+
let value = rest
|
|
125
|
+
.strip_prefix('"')
|
|
126
|
+
.and_then(|s| s.strip_suffix('"'))
|
|
127
|
+
.or_else(|| rest.strip_prefix('\'').and_then(|s| s.strip_suffix('\'')))
|
|
128
|
+
.unwrap_or(rest);
|
|
129
|
+
if out.iter().any(|(existing, _)| existing == key) {
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
out.push((key.to_string(), value.to_string()));
|
|
133
|
+
}
|
|
134
|
+
out
|
|
135
|
+
}
|
|
136
|
+
|
|
94
137
|
fn parse_disk_slot(text: &str) -> DiskSlot {
|
|
95
|
-
let keys =
|
|
138
|
+
let keys = per_seat_keys_in_toml(text);
|
|
96
139
|
DiskSlot {
|
|
97
140
|
team_agent_id: find_key(&keys, "TEAM_AGENT_ID"),
|
|
98
141
|
owner_team_id: find_key(&keys, "TEAM_AGENT_OWNER_TEAM_ID"),
|
|
@@ -296,4 +339,46 @@ fn expected_auth_mode(live: &[LiveGrok]) -> Option<String> {
|
|
|
296
339
|
found
|
|
297
340
|
}
|
|
298
341
|
|
|
342
|
+
#[cfg(test)]
|
|
343
|
+
mod tests {
|
|
344
|
+
use super::*;
|
|
299
345
|
|
|
346
|
+
#[test]
|
|
347
|
+
fn workspace_is_shared_other_team_agent_keys_are_per_seat() {
|
|
348
|
+
assert!(!is_per_seat_env_key("TEAM_AGENT_WORKSPACE"));
|
|
349
|
+
assert!(is_per_seat_env_key("TEAM_AGENT_ID"));
|
|
350
|
+
assert!(is_per_seat_env_key("TEAM_AGENT_OWNER_TEAM_ID"));
|
|
351
|
+
assert!(is_per_seat_env_key("TEAM_AGENT_AUTH_MODE"));
|
|
352
|
+
assert!(is_per_seat_env_key("TEAM_AGENT_FUTURE_SEAT_KEY"));
|
|
353
|
+
assert!(!is_per_seat_env_key("GROK_FOLDER_TRUST"));
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
#[test]
|
|
357
|
+
fn scan_finds_per_seat_keys_in_env_table_only() {
|
|
358
|
+
let text = r#"
|
|
359
|
+
[mcp_servers.other.env]
|
|
360
|
+
TEAM_AGENT_ID = "ignore-other-server-still-counts"
|
|
361
|
+
|
|
362
|
+
[mcp_servers.team_orchestrator]
|
|
363
|
+
command = "/bin/x"
|
|
364
|
+
|
|
365
|
+
[mcp_servers.team_orchestrator.env]
|
|
366
|
+
TEAM_AGENT_WORKSPACE = "/ws"
|
|
367
|
+
TEAM_AGENT_AUTH_MODE = "impostor"
|
|
368
|
+
"#;
|
|
369
|
+
let keys = per_seat_keys_in_toml(text);
|
|
370
|
+
assert!(
|
|
371
|
+
keys.iter()
|
|
372
|
+
.any(|(k, v)| k == "TEAM_AGENT_AUTH_MODE" && v == "impostor"),
|
|
373
|
+
"must see AUTH; keys={keys:?}"
|
|
374
|
+
);
|
|
375
|
+
assert!(
|
|
376
|
+
keys.iter().any(|(k, _)| k == "TEAM_AGENT_ID"),
|
|
377
|
+
"any env table per-seat key counts; keys={keys:?}"
|
|
378
|
+
);
|
|
379
|
+
assert!(
|
|
380
|
+
!keys.iter().any(|(k, _)| k == "TEAM_AGENT_WORKSPACE"),
|
|
381
|
+
"WORKSPACE is shared; keys={keys:?}"
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
@@ -609,15 +609,17 @@ fn add(
|
|
|
609
609
|
id: &str,
|
|
610
610
|
source: Option<PathBuf>,
|
|
611
611
|
) -> Result<(), CliError> {
|
|
612
|
+
// An explicit start re-admits a removed seat: the add consumes its retired
|
|
613
|
+
// tombstone. Only lifecycle history this planner cannot classify is refused.
|
|
612
614
|
if selected
|
|
613
615
|
.state
|
|
614
616
|
.get("agent_lifecycle")
|
|
615
617
|
.and_then(|lifecycle| lifecycle.get(id))
|
|
616
|
-
.
|
|
618
|
+
.is_some_and(|entry| entry.get("state").and_then(Value::as_str) != Some("retired"))
|
|
617
619
|
{
|
|
618
|
-
return Err(refusal(
|
|
619
|
-
"agent
|
|
620
|
-
));
|
|
620
|
+
return Err(refusal(format!(
|
|
621
|
+
"agent {id} has unrecognized lifecycle history; refusing to re-admit it"
|
|
622
|
+
)));
|
|
621
623
|
}
|
|
622
624
|
let patch = plan.intent.patch.clone();
|
|
623
625
|
let role_file = match source {
|
|
@@ -20,10 +20,10 @@ fn fixture(ids: &[&str]) -> (Sandbox, Intent) {
|
|
|
20
20
|
(root, intent)
|
|
21
21
|
}
|
|
22
22
|
fn write_role(root: &Path, id: &str) {
|
|
23
|
-
std::fs::write(root.join("agents").join(format!("{id}.md")),format!("---\nname: {id}\nprovider:
|
|
23
|
+
std::fs::write(root.join("agents").join(format!("{id}.md")),format!("---\nname: {id}\nprovider: copilot\nmodel: gpt-6-luna\neffort: high\ndangerously_skip_permissions: true\n---\nFixture\n")).unwrap();
|
|
24
24
|
}
|
|
25
25
|
fn install(root: &Path, ids: &[(&str, &str, bool)]) {
|
|
26
|
-
let agents:serde_json::Map<String,Value>=ids.iter().map(|(id,status,explicit)|((*id).into(),json!({"provider":"
|
|
26
|
+
let agents:serde_json::Map<String,Value>=ids.iter().map(|(id,status,explicit)|((*id).into(),json!({"provider":"copilot","status":status,"explicit_stop":explicit,"pane_pid":std::process::id(),"pane_id":format!("%{id}"),"window":id}))).collect();
|
|
27
27
|
let entry = json!({"team_key":"fixture","team_dir":root,"status":"alive","session_name":"team-fixture","agents":agents,"tasks":{}});
|
|
28
28
|
let mut raw = entry.clone();
|
|
29
29
|
raw["active_team_key"] = json!("fixture");
|
|
@@ -336,6 +336,51 @@ fn role_only_add_and_absent_creation_need_explicit_decisions() {
|
|
|
336
336
|
}
|
|
337
337
|
#[test]
|
|
338
338
|
#[serial_test::serial(env)]
|
|
339
|
+
fn issue391_start_readmits_a_removed_seat_from_its_left_behind_role_file() {
|
|
340
|
+
let (root, mut intent) = fixture(&["one"]);
|
|
341
|
+
install(root.path(), &[("one", "stopped", false)]);
|
|
342
|
+
// remove-agent keeps the user's role file and leaves a retired tombstone.
|
|
343
|
+
write_role(root.path(), "two");
|
|
344
|
+
let state = crate::state::persist::runtime_state_path(root.path());
|
|
345
|
+
let mut raw: Value = serde_json::from_slice(&std::fs::read(&state).unwrap()).unwrap();
|
|
346
|
+
let tombstone = json!({"two": {"state": "retired", "changed_at": "2026-10-27T15:25:48Z", "reason": "remove-agent"}});
|
|
347
|
+
raw["agent_lifecycle"] = tombstone.clone();
|
|
348
|
+
raw["teams"]["fixture"]["agent_lifecycle"] = tombstone;
|
|
349
|
+
std::fs::write(&state, serde_json::to_vec(&raw).unwrap()).unwrap();
|
|
350
|
+
intent.subject = Subject::Agent(AgentId::new("two"));
|
|
351
|
+
let plan = plan_with_observer(intent.clone(), |_, _, _| panic!("unregistered probe")).unwrap();
|
|
352
|
+
assert_eq!(actions(&plan), [("add_agent", Some("two"))]);
|
|
353
|
+
let Step::AddAgent(args) = &plan.steps[0] else {
|
|
354
|
+
panic!()
|
|
355
|
+
};
|
|
356
|
+
assert_eq!(
|
|
357
|
+
Path::new(&args.role_file),
|
|
358
|
+
root.path().join("agents/two.md"),
|
|
359
|
+
"the left-behind role file is the seat's definition"
|
|
360
|
+
);
|
|
361
|
+
// Team start still leaves a removed seat retired.
|
|
362
|
+
let mut team = intent.clone();
|
|
363
|
+
team.subject = Subject::Team { source: None };
|
|
364
|
+
let plan = plan_with_observer(team, |_, _, _| Ok(Observation::StoppedVerified)).unwrap();
|
|
365
|
+
assert_eq!(actions(&plan), [("start_agent", Some("one"))]);
|
|
366
|
+
assert!(plan
|
|
367
|
+
.skipped
|
|
368
|
+
.iter()
|
|
369
|
+
.any(|entry| entry["agent"] == "two" && entry["reason"] == "retired"));
|
|
370
|
+
// History the planner cannot classify is refused without naming a phantom command.
|
|
371
|
+
raw["agent_lifecycle"]["two"]["state"] = json!("quarantined");
|
|
372
|
+
raw["teams"]["fixture"]["agent_lifecycle"]["two"]["state"] = json!("quarantined");
|
|
373
|
+
std::fs::write(&state, serde_json::to_vec(&raw).unwrap()).unwrap();
|
|
374
|
+
let error = plan_with_observer(intent, |_, _, _| panic!())
|
|
375
|
+
.unwrap_err()
|
|
376
|
+
.to_string();
|
|
377
|
+
assert!(
|
|
378
|
+
error.contains("unrecognized lifecycle history") && !error.contains("recovery"),
|
|
379
|
+
"{error}"
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
#[test]
|
|
383
|
+
#[serial_test::serial(env)]
|
|
339
384
|
fn spec_only_state_only_and_missing_spec_do_not_fallback_to_creation() {
|
|
340
385
|
let (root, mut intent) = fixture(&["one", "two"]);
|
|
341
386
|
install(root.path(), &[("one", "stopped", false)]);
|
|
@@ -427,14 +472,14 @@ fn preserve_rejects_known_missing_backing_before_stop_auto_uses_existing_decisio
|
|
|
427
472
|
let selected =
|
|
428
473
|
resolve_active_team_readonly(root.path(), Some("fixture"), SelectorMode::RuntimeOnly)
|
|
429
474
|
.unwrap();
|
|
430
|
-
let row = json!({"provider":"
|
|
475
|
+
let row = json!({"provider":"copilot","session_id":"missing-session","rollout_path":root.path().join("missing.jsonl"),"spawn_cwd":root.path()});
|
|
431
476
|
assert!(preflight_start(&selected, "one", &row, SessionPolicy::Preserve).is_err());
|
|
432
477
|
assert!(preflight_start(&selected, "one", &row, SessionPolicy::Auto).is_ok());
|
|
433
478
|
assert!(
|
|
434
479
|
preflight_start(
|
|
435
480
|
&selected,
|
|
436
481
|
"one",
|
|
437
|
-
&json!({"provider":"
|
|
482
|
+
&json!({"provider":"copilot"}),
|
|
438
483
|
SessionPolicy::Preserve
|
|
439
484
|
)
|
|
440
485
|
.is_ok(),
|
|
@@ -488,7 +533,7 @@ fn stopped_text_without_physical_identity_is_unknown_and_standalone_source_keeps
|
|
|
488
533
|
observe(
|
|
489
534
|
&selected,
|
|
490
535
|
"one",
|
|
491
|
-
&json!({"status":"stopped","provider":"
|
|
536
|
+
&json!({"status":"stopped","provider":"copilot"})
|
|
492
537
|
)
|
|
493
538
|
.unwrap(),
|
|
494
539
|
Observation::Unknown
|
|
@@ -497,7 +542,7 @@ fn stopped_text_without_physical_identity_is_unknown_and_standalone_source_keeps
|
|
|
497
542
|
observe(
|
|
498
543
|
&selected,
|
|
499
544
|
"one",
|
|
500
|
-
&json!({"status":"stopped","provider":"
|
|
545
|
+
&json!({"status":"stopped","provider":"copilot","pane_pid":std::process::id()})
|
|
501
546
|
)
|
|
502
547
|
.unwrap(),
|
|
503
548
|
Observation::Unknown
|
|
@@ -701,7 +746,7 @@ fn preserve_context_preflight_and_corrupt_metadata_refuse_before_stop() {
|
|
|
701
746
|
json!({"task_prompt_delivered":true}),
|
|
702
747
|
json!({"last_result_at":"2026-10-19T00:00:00Z"}),
|
|
703
748
|
] {
|
|
704
|
-
let mut row = json!({"provider":"
|
|
749
|
+
let mut row = json!({"provider":"copilot"});
|
|
705
750
|
row.as_object_mut()
|
|
706
751
|
.unwrap()
|
|
707
752
|
.extend(signal.as_object().unwrap().clone());
|
|
@@ -716,7 +761,7 @@ fn preserve_context_preflight_and_corrupt_metadata_refuse_before_stop() {
|
|
|
716
761
|
"first_send_at",
|
|
717
762
|
"task_prompt_delivered",
|
|
718
763
|
] {
|
|
719
|
-
let mut row = json!({"provider":"
|
|
764
|
+
let mut row = json!({"provider":"copilot"});
|
|
720
765
|
row[field] = json!([]);
|
|
721
766
|
for policy in [SessionPolicy::Auto, SessionPolicy::Preserve] {
|
|
722
767
|
assert!(
|
|
@@ -729,14 +774,14 @@ fn preserve_context_preflight_and_corrupt_metadata_refuse_before_stop() {
|
|
|
729
774
|
assert!(preflight_start(
|
|
730
775
|
&selected,
|
|
731
776
|
"one",
|
|
732
|
-
&json!({"provider":"
|
|
777
|
+
&json!({"provider":"copilot", "spawn_cwd":outside.path()}),
|
|
733
778
|
SessionPolicy::Auto
|
|
734
779
|
)
|
|
735
780
|
.is_err());
|
|
736
781
|
assert!(preflight_start(
|
|
737
782
|
&selected,
|
|
738
783
|
"one",
|
|
739
|
-
&json!({"provider":"
|
|
784
|
+
&json!({"provider":"copilot", "session_id":"captured"}),
|
|
740
785
|
SessionPolicy::Auto
|
|
741
786
|
)
|
|
742
787
|
.is_err());
|
|
@@ -3319,10 +3319,12 @@ pub mod lifecycle_port {
|
|
|
3319
3319
|
Some(agent),
|
|
3320
3320
|
"start-agent",
|
|
3321
3321
|
)?;
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
)
|
|
3322
|
+
// Only an explicit override can move this legacy seat onto a leaf.
|
|
3323
|
+
// An omitted provider keeps the existing role's provider; it is not
|
|
3324
|
+
// a new role defaulting to `pi`.
|
|
3325
|
+
if let Some(provider) = role_config.provider.as_deref() {
|
|
3326
|
+
crate::contract_runtime::framework::require_legacy_role(None, Some(provider))?;
|
|
3327
|
+
}
|
|
3326
3328
|
}
|
|
3327
3329
|
let _ = force; // Never grants authority to stop an already-running seat.
|
|
3328
3330
|
let agent_id = crate::model::ids::AgentId::new(agent);
|
|
@@ -3412,6 +3414,12 @@ pub mod lifecycle_port {
|
|
|
3412
3414
|
discard_session: bool,
|
|
3413
3415
|
team: Option<&str>,
|
|
3414
3416
|
) -> Result<Value, CliError> {
|
|
3417
|
+
#[cfg(unix)]
|
|
3418
|
+
if let Some(receipt) =
|
|
3419
|
+
crate::contract_runtime::commands::reset_agent(workspace, team, agent, discard_session)?
|
|
3420
|
+
{
|
|
3421
|
+
return Ok(receipt);
|
|
3422
|
+
}
|
|
3415
3423
|
let agent_id = crate::model::ids::AgentId::new(agent);
|
|
3416
3424
|
#[cfg(unix)]
|
|
3417
3425
|
crate::contract_runtime::framework::require_legacy_lifecycle(
|
|
@@ -3533,6 +3541,14 @@ pub mod lifecycle_port {
|
|
|
3533
3541
|
) -> Result<Value, CliError> {
|
|
3534
3542
|
let source = crate::model::ids::AgentId::new(source_agent);
|
|
3535
3543
|
let dest = crate::model::ids::AgentId::new(as_agent_id);
|
|
3544
|
+
// A contract seat forks through the generic contract pipeline; every
|
|
3545
|
+
// leaf's descriptor decides admission. No legacy fallback is taken.
|
|
3546
|
+
#[cfg(unix)]
|
|
3547
|
+
if let Some(receipt) =
|
|
3548
|
+
crate::contract_runtime::fork::fork_agent(workspace, team, source_agent, as_agent_id, label)?
|
|
3549
|
+
{
|
|
3550
|
+
return Ok(receipt);
|
|
3551
|
+
}
|
|
3536
3552
|
#[cfg(unix)]
|
|
3537
3553
|
crate::contract_runtime::framework::require_legacy_lifecycle(
|
|
3538
3554
|
workspace,
|
|
@@ -3541,30 +3557,14 @@ pub mod lifecycle_port {
|
|
|
3541
3557
|
"fork-agent",
|
|
3542
3558
|
)?;
|
|
3543
3559
|
match crate::lifecycle::fork_agent(workspace, &source, &dest, label, true, team) {
|
|
3544
|
-
Ok(report) => {
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
});
|
|
3553
|
-
if let (Some(details), Some(object)) = (report.pi_fork, value.as_object_mut()) {
|
|
3554
|
-
object.insert("status".to_string(), json!("forked"));
|
|
3555
|
-
object.insert("target".to_string(), json!(report.new_agent_id.as_str()));
|
|
3556
|
-
object.insert(
|
|
3557
|
-
"source_session_id".to_string(),
|
|
3558
|
-
json!(details.source_session_id.as_str()),
|
|
3559
|
-
);
|
|
3560
|
-
object.insert("session_id".to_string(), json!(details.session_id.as_str()));
|
|
3561
|
-
object.insert(
|
|
3562
|
-
"backing_path".to_string(),
|
|
3563
|
-
json!(details.backing_path.0.to_string_lossy().to_string()),
|
|
3564
|
-
);
|
|
3565
|
-
}
|
|
3566
|
-
Ok(value)
|
|
3567
|
-
}
|
|
3560
|
+
Ok(report) => Ok(json!({
|
|
3561
|
+
"ok": true,
|
|
3562
|
+
"source_agent_id": report.source_agent_id.as_str(),
|
|
3563
|
+
"new_agent_id": report.new_agent_id.as_str(),
|
|
3564
|
+
"session_id": report.session_id.as_ref().map(|session| session.as_str()),
|
|
3565
|
+
"new_session_id": report.session_id.as_ref().map(|session| session.as_str()),
|
|
3566
|
+
"backing_state": report.backing_state,
|
|
3567
|
+
})),
|
|
3568
3568
|
Err(e) => Ok(error_value(e)),
|
|
3569
3569
|
}
|
|
3570
3570
|
}
|
|
@@ -3608,6 +3608,12 @@ pub mod lifecycle_port {
|
|
|
3608
3608
|
force: bool,
|
|
3609
3609
|
team: Option<&str>,
|
|
3610
3610
|
) -> Result<Value, CliError> {
|
|
3611
|
+
#[cfg(unix)]
|
|
3612
|
+
if let Some(receipt) = crate::contract_runtime::commands::remove_agent(
|
|
3613
|
+
workspace, team, agent, from_spec, confirm, force,
|
|
3614
|
+
)? {
|
|
3615
|
+
return Ok(receipt);
|
|
3616
|
+
}
|
|
3611
3617
|
let agent_id = crate::model::ids::AgentId::new(agent);
|
|
3612
3618
|
#[cfg(unix)]
|
|
3613
3619
|
crate::contract_runtime::framework::require_legacy_lifecycle(
|
|
@@ -4492,7 +4498,7 @@ pub mod lifecycle_port {
|
|
|
4492
4498
|
.unwrap();
|
|
4493
4499
|
std::fs::write(
|
|
4494
4500
|
team_dir.join("agents").join("implementer.md"),
|
|
4495
|
-
"---\nname: implementer\nrole: Implementation Engineer\nprovider:
|
|
4501
|
+
"---\nname: implementer\nrole: Implementation Engineer\nprovider: fake\nmodel: fake\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nImplement bounded tasks.\n",
|
|
4496
4502
|
)
|
|
4497
4503
|
.unwrap();
|
|
4498
4504
|
super::super::hermetic_test_support::seed_in_process_coordinator(&root);
|