@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
|
@@ -18,9 +18,8 @@ use std::time::{Duration, Instant};
|
|
|
18
18
|
|
|
19
19
|
use crate::event_log::EventLog;
|
|
20
20
|
use crate::lifecycle::launch::pi_mcp::{
|
|
21
|
-
materialize_pi_plan,
|
|
21
|
+
materialize_pi_plan, pi_seat_paths, PiMaterializeRequest, PiSessionScope,
|
|
22
22
|
};
|
|
23
|
-
use crate::lifecycle::launch::run_pi_catalog_preflight;
|
|
24
23
|
use crate::lifecycle::tests::test_binary_path;
|
|
25
24
|
use crate::message_store::MessageStore;
|
|
26
25
|
use crate::provider::McpConfig;
|
|
@@ -91,23 +90,6 @@ esac
|
|
|
91
90
|
call_log.to_str().expect("call log path must be UTF-8"),
|
|
92
91
|
);
|
|
93
92
|
|
|
94
|
-
let roles = hermetic.workspace("roles");
|
|
95
|
-
let agents = roles.join("agents");
|
|
96
|
-
std::fs::create_dir_all(&agents).expect("create Pi role directory");
|
|
97
|
-
std::fs::write(
|
|
98
|
-
agents.join("n1.md"),
|
|
99
|
-
"---\nprovider: pi\nmodel: team-agent/qwen3.8-27b\n---\nN1 native Pi fixture\n",
|
|
100
|
-
)
|
|
101
|
-
.expect("write exact-model Pi role");
|
|
102
|
-
assert_eq!(
|
|
103
|
-
pi_model_candidates("qwen3.8-27b").expect("fake Pi model catalog"),
|
|
104
|
-
["team-agent/qwen3.8-27b"],
|
|
105
|
-
"catalog discovery must succeed without consulting the package list"
|
|
106
|
-
);
|
|
107
|
-
let mut discover = |requested: &str| pi_model_candidates(requested).map_err(|_| ());
|
|
108
|
-
run_pi_catalog_preflight(&roles, &mut discover)
|
|
109
|
-
.expect("exact-model catalog preflight must pass on native-only Pi");
|
|
110
|
-
|
|
111
93
|
let harness = sim::McpSimHarness::new();
|
|
112
94
|
harness.bind_leader_receiver_to_team("teamA");
|
|
113
95
|
let workspace = harness.workspace_path();
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
use std::path::{Path, PathBuf};
|
|
2
2
|
use std::sync::atomic::{AtomicU32, Ordering};
|
|
3
|
-
use std::time::Duration;
|
|
4
3
|
|
|
5
|
-
use crate::
|
|
6
|
-
use crate::messaging::delivery::{
|
|
7
|
-
paste_to_submit_floor_for_recipient, recipient_allows_explicit_queue_flush,
|
|
8
|
-
recipient_requires_single_enter,
|
|
9
|
-
};
|
|
10
|
-
use crate::model::enums::{Provider, ProviderEffort};
|
|
11
|
-
use crate::provider::adapters::pi::{build_pi_command_argv, PiCommandRequest, PiSessionSelector};
|
|
4
|
+
use crate::model::enums::Provider;
|
|
12
5
|
use crate::provider::session_scan::{scan_session_candidates_once, CaptureSessionContext};
|
|
13
|
-
use crate::provider::
|
|
6
|
+
use crate::provider::SessionId;
|
|
14
7
|
|
|
15
8
|
static NEXT_ROOT: AtomicU32 = AtomicU32::new(0);
|
|
16
9
|
|
|
@@ -52,20 +45,6 @@ fn scan_context(cwd: &Path, root: &Path, id: &str, generation: &str) -> CaptureS
|
|
|
52
45
|
}
|
|
53
46
|
}
|
|
54
47
|
|
|
55
|
-
fn resume_argv(path: &Path) -> Result<Vec<String>, ProviderError> {
|
|
56
|
-
build_pi_command_argv(PiCommandRequest {
|
|
57
|
-
extension: Path::new("/workspace/.team/runtime/pi/team-a/worker-a/team-mcp.ts"),
|
|
58
|
-
model: Some("team-agent/qwen3.8-27b"),
|
|
59
|
-
effort: Some(ProviderEffort::Medium),
|
|
60
|
-
system_prompt: "worker contract",
|
|
61
|
-
session_dir: Some(Path::new(
|
|
62
|
-
"/workspace/.team/runtime/pi/team-a/worker-a/sessions",
|
|
63
|
-
)),
|
|
64
|
-
session: PiSessionSelector::Resume { path },
|
|
65
|
-
agent_id: "worker-a",
|
|
66
|
-
})
|
|
67
|
-
}
|
|
68
|
-
|
|
69
48
|
#[test]
|
|
70
49
|
fn pi_session_capture_requires_header_id_cwd_generation_and_unique_claim() {
|
|
71
50
|
let root = temp_root("session-capture");
|
|
@@ -153,80 +132,3 @@ fn pi_fresh_capture_reads_the_header_id_pi_wrote() {
|
|
|
153
132
|
);
|
|
154
133
|
std::fs::remove_dir_all(root).expect("remove native header fixture");
|
|
155
134
|
}
|
|
156
|
-
|
|
157
|
-
#[test]
|
|
158
|
-
fn pi_restart_uses_exact_path_and_refuses_missing_backing() {
|
|
159
|
-
let root = temp_root("resume");
|
|
160
|
-
let cwd = root.join("workspace");
|
|
161
|
-
let sessions = root.join("seat/sessions");
|
|
162
|
-
std::fs::create_dir_all(&cwd).expect("create cwd");
|
|
163
|
-
let id = "cc09d133-878f-4241-920f-f7ebfefc2a9e";
|
|
164
|
-
let generation = "2026-08-29T10:00:00Z";
|
|
165
|
-
let exact = sessions.join("nested/exact.jsonl");
|
|
166
|
-
write_header(&exact, id, &cwd, "2026-08-29T10:00:01Z");
|
|
167
|
-
|
|
168
|
-
let candidates =
|
|
169
|
-
scan_session_candidates_once(Provider::Pi, &scan_context(&cwd, &sessions, id, generation))
|
|
170
|
-
.expect("resume preflight scan");
|
|
171
|
-
assert_eq!(
|
|
172
|
-
candidates.len(),
|
|
173
|
-
1,
|
|
174
|
-
"exact backing must revalidate before restart"
|
|
175
|
-
);
|
|
176
|
-
|
|
177
|
-
let argv = resume_argv(&exact).expect("resume exact path");
|
|
178
|
-
assert!(argv
|
|
179
|
-
.windows(2)
|
|
180
|
-
.any(|pair| { pair[0] == "--session" && pair[1] == exact.to_string_lossy().as_ref() }));
|
|
181
|
-
assert!(!argv.iter().any(|arg| {
|
|
182
|
-
matches!(
|
|
183
|
-
arg.as_str(),
|
|
184
|
-
"--session-id" | "-c" | "--continue" | "-r" | "--resume"
|
|
185
|
-
)
|
|
186
|
-
}));
|
|
187
|
-
|
|
188
|
-
std::fs::remove_file(&exact).expect("remove backing tooth");
|
|
189
|
-
let missing = resume_argv(&exact);
|
|
190
|
-
assert!(
|
|
191
|
-
matches!(missing, Err(ProviderError::ResumeUnavailable(_))),
|
|
192
|
-
"missing exact backing must refuse rather than create a new session: {missing:?}"
|
|
193
|
-
);
|
|
194
|
-
std::fs::remove_dir_all(root).expect("remove resume fixture");
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
#[test]
|
|
198
|
-
fn pi_delivery_submits_one_enter_and_never_flushes_or_retries() {
|
|
199
|
-
let idle = serde_json::json!({
|
|
200
|
-
"agents": {
|
|
201
|
-
"worker-a": {"provider": "pi", "status": "running"}
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
assert!(recipient_requires_single_enter(&idle, "worker-a"));
|
|
205
|
-
assert!(!recipient_allows_explicit_queue_flush(&idle, "worker-a"));
|
|
206
|
-
assert_eq!(
|
|
207
|
-
paste_to_submit_floor_for_recipient(&idle, "worker-a"),
|
|
208
|
-
Duration::ZERO
|
|
209
|
-
);
|
|
210
|
-
let busy = serde_json::json!({
|
|
211
|
-
"agents": {
|
|
212
|
-
"worker-a": {"provider": "pi", "status": "busy"}
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
// Working native CLIs queue the same single-Enter input; no idle admission.
|
|
216
|
-
assert!(recipient_requires_single_enter(&busy, "worker-a"));
|
|
217
|
-
assert!(!recipient_allows_explicit_queue_flush(&busy, "worker-a"));
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
#[test]
|
|
221
|
-
fn pi_clone_is_fresh_and_fork_is_not_clone() {
|
|
222
|
-
let workspace = Path::new("/workspace");
|
|
223
|
-
let source_paths = pi_seat_paths(workspace, "team-a", "source");
|
|
224
|
-
let clone_paths = pi_seat_paths(workspace, "team-a", "clone");
|
|
225
|
-
assert_ne!(source_paths.runtime_root, clone_paths.runtime_root);
|
|
226
|
-
assert_ne!(source_paths.wrapper, clone_paths.wrapper);
|
|
227
|
-
assert_ne!(source_paths.sessions, clone_paths.sessions);
|
|
228
|
-
|
|
229
|
-
let source_session = SessionId::new("652756ea-aaee-4437-a30f-40c5606826d5");
|
|
230
|
-
let fork = get_adapter(Provider::Pi).fork(Some(&source_session), AuthMode::Subscription, None);
|
|
231
|
-
assert!(matches!(fork, Err(ProviderError::CapabilityUnsupported(_))));
|
|
232
|
-
}
|
|
@@ -40,7 +40,7 @@ const TEAM_MD: &str =
|
|
|
40
40
|
|
|
41
41
|
const CODEX_ROLE: &str = "---\nname: codexer\nrole: Codex Worker\nprovider: codex\nmodel: gpt-5.5\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nCodex worker.\n";
|
|
42
42
|
|
|
43
|
-
const
|
|
43
|
+
const COPILOT_ROLE: &str = "---\nname: copiloter\nrole: Copilot Worker\nprovider: copilot\nmodel: gpt-5.5\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nCopilot worker.\n";
|
|
44
44
|
|
|
45
45
|
#[test]
|
|
46
46
|
#[ignore = "real-machine: quick-start worker readiness gate"]
|
|
@@ -51,10 +51,10 @@ fn t1_quick_start_must_not_emit_bare_ready_when_worker_tool_load_is_unverified()
|
|
|
51
51
|
let team = bug7_team_dir(&hermetic, "t1-pending");
|
|
52
52
|
// Both agents spawn successfully (recording transport reports both windows live)
|
|
53
53
|
// but the framework has no way to verify the worker MCP tool set actually
|
|
54
|
-
// loaded — codex/
|
|
54
|
+
// loaded — codex/copilot can still reject schemas asynchronously. The report
|
|
55
55
|
// therefore must be PendingToolLoad, not bare Ready.
|
|
56
56
|
let transport = RecordingTransport::new()
|
|
57
|
-
.with_windows(vec![WindowName::new("codexer"), WindowName::new("
|
|
57
|
+
.with_windows(vec![WindowName::new("codexer"), WindowName::new("copiloter")]);
|
|
58
58
|
let report = quick_start_with_transport(&team, None, true, None, &transport)
|
|
59
59
|
.expect("quick_start_with_transport should succeed for healthy spawn");
|
|
60
60
|
let QuickStartReport::Ready {
|
|
@@ -98,8 +98,8 @@ fn t2_quick_start_must_report_degraded_when_a_worker_spawn_yields_no_live_window
|
|
|
98
98
|
hermetic.assert_no_real_tmux();
|
|
99
99
|
let team = bug7_team_dir(&hermetic, "t2-degraded");
|
|
100
100
|
// Recording transport simulates the Mac mini final capture: only the codex
|
|
101
|
-
// window exists after launch; the
|
|
102
|
-
// `
|
|
101
|
+
// window exists after launch; the copilot window never materialized (no
|
|
102
|
+
// `copilot` binary on PATH, etc.). BUG-2 fix already marks `copiloter` as
|
|
103
103
|
// spawn_failed in runtime state; BUG-7 must surface that as a Degraded
|
|
104
104
|
// verdict so quick-start cannot pretend the team is ready.
|
|
105
105
|
let transport = RecordingTransport::new().with_windows(vec![WindowName::new("codexer")]);
|
|
@@ -117,9 +117,9 @@ fn t2_quick_start_must_report_degraded_when_a_worker_spawn_yields_no_live_window
|
|
|
117
117
|
);
|
|
118
118
|
};
|
|
119
119
|
assert!(
|
|
120
|
-
unhealthy_agents.iter().any(|id| id == "
|
|
120
|
+
unhealthy_agents.iter().any(|id| id == "copiloter"),
|
|
121
121
|
"T2: Degraded verdict must list the agent whose window never materialized \
|
|
122
|
-
(
|
|
122
|
+
(copiloter); got unhealthy_agents={unhealthy_agents:?}"
|
|
123
123
|
);
|
|
124
124
|
let rendered = render_quick_start_summary(&report);
|
|
125
125
|
assert!(
|
|
@@ -128,8 +128,8 @@ fn t2_quick_start_must_report_degraded_when_a_worker_spawn_yields_no_live_window
|
|
|
128
128
|
the report as ready; got {rendered:?}"
|
|
129
129
|
);
|
|
130
130
|
assert!(
|
|
131
|
-
rendered.contains("
|
|
132
|
-
"T2: CLI summary should mention the unhealthy agent id (
|
|
131
|
+
rendered.contains("copiloter"),
|
|
132
|
+
"T2: CLI summary should mention the unhealthy agent id (copiloter); got {rendered:?}"
|
|
133
133
|
);
|
|
134
134
|
}
|
|
135
135
|
|
|
@@ -145,7 +145,8 @@ fn bug7_team_dir(hermetic: &HermeticTestEnv, tag: &str) -> PathBuf {
|
|
|
145
145
|
std::fs::create_dir_all(team.join("agents")).expect("mkdir teamdir/agents");
|
|
146
146
|
std::fs::write(team.join("TEAM.md"), TEAM_MD).expect("write TEAM.md");
|
|
147
147
|
std::fs::write(team.join("agents").join("codexer.md"), CODEX_ROLE).expect("write codexer.md");
|
|
148
|
-
std::fs::write(team.join("agents").join("
|
|
148
|
+
std::fs::write(team.join("agents").join("copiloter.md"), COPILOT_ROLE)
|
|
149
|
+
.expect("write copiloter.md");
|
|
149
150
|
team
|
|
150
151
|
}
|
|
151
152
|
|
|
@@ -1067,7 +1067,6 @@ fn provider_name(provider: Provider) -> &'static str {
|
|
|
1067
1067
|
Provider::Copilot => "copilot",
|
|
1068
1068
|
Provider::GeminiCli => "gemini",
|
|
1069
1069
|
Provider::Grok => "grok",
|
|
1070
|
-
Provider::CursorAgent => "cursor_agent",
|
|
1071
1070
|
Provider::Pi => "pi",
|
|
1072
1071
|
Provider::Fake => "fake",
|
|
1073
1072
|
}
|
|
@@ -621,35 +621,6 @@ fn provider_home_codex_rollout_from_foreign_workspace_is_not_captured() {
|
|
|
621
621
|
);
|
|
622
622
|
}
|
|
623
623
|
|
|
624
|
-
#[test]
|
|
625
|
-
#[ignore = "real-machine: provider session filesystem + restart/shutdown lifecycle convergence"]
|
|
626
|
-
#[serial(env)]
|
|
627
|
-
fn provider_home_claude_session_is_captured_for_restart_resume() {
|
|
628
|
-
let fixture = RestartFixture::new("claude-home-capture", "claude");
|
|
629
|
-
let _home = HomeGuard::with_home(fixture.root.join("home"));
|
|
630
|
-
let claude_session = "claude-sess-240";
|
|
631
|
-
seed_claude_home_session(&fixture.home(), &fixture.spawn_cwd, claude_session);
|
|
632
|
-
seed_running_state_without_session(&fixture.team, "claude", &fixture.spawn_cwd);
|
|
633
|
-
|
|
634
|
-
let adapter = get_adapter(Provider::Claude);
|
|
635
|
-
let captured = adapter
|
|
636
|
-
.capture_session_id("worker_a", &fixture.spawn_cwd, 0)
|
|
637
|
-
.expect("Claude provider-home capture should not error")
|
|
638
|
-
.expect("Claude session under HOME/.claude/sessions must be discoverable before restart");
|
|
639
|
-
|
|
640
|
-
assert_eq!(
|
|
641
|
-
captured.session_id.as_ref().map(|id| id.as_str()),
|
|
642
|
-
Some(claude_session),
|
|
643
|
-
"Claude capture must recover sessionId from provider-home session JSON"
|
|
644
|
-
);
|
|
645
|
-
assert!(
|
|
646
|
-
captured.rollout_path.as_ref().is_some_and(|path| path
|
|
647
|
-
.as_path()
|
|
648
|
-
.starts_with(fixture.home().join(".claude/sessions"))),
|
|
649
|
-
"Claude capture must scan provider home, not only spawn_cwd; captured={captured:?}"
|
|
650
|
-
);
|
|
651
|
-
}
|
|
652
|
-
|
|
653
624
|
#[test]
|
|
654
625
|
#[ignore = "real-machine: provider session filesystem + restart/shutdown lifecycle convergence"]
|
|
655
626
|
#[serial(env)]
|
|
@@ -679,30 +650,6 @@ fn restart_force_captures_real_codex_session_meta_before_teardown() {
|
|
|
679
650
|
);
|
|
680
651
|
}
|
|
681
652
|
|
|
682
|
-
#[test]
|
|
683
|
-
#[ignore = "real-machine: provider session filesystem + restart/shutdown lifecycle convergence"]
|
|
684
|
-
#[serial(env)]
|
|
685
|
-
fn restart_force_captures_claude_session_before_teardown() {
|
|
686
|
-
let fixture = RestartFixture::new("restart-claude-force-capture", "claude");
|
|
687
|
-
let _home = HomeGuard::with_home(fixture.root.join("home"));
|
|
688
|
-
let claude_session = "claude-sess-before-kill";
|
|
689
|
-
seed_claude_home_session(&fixture.home(), &fixture.spawn_cwd, claude_session);
|
|
690
|
-
seed_running_state_without_session(&fixture.team, "claude", &fixture.spawn_cwd);
|
|
691
|
-
let transport = RecordingTransport::new().with_session_present(true);
|
|
692
|
-
|
|
693
|
-
let report = restart_with_transport(&fixture.team, false, None, &transport)
|
|
694
|
-
.expect("restart should succeed after forced session capture");
|
|
695
|
-
|
|
696
|
-
assert_restarted_with_resume(&report, claude_session);
|
|
697
|
-
assert_spawn_contains_adjacent(
|
|
698
|
-
&transport.single_spawn_argv(),
|
|
699
|
-
&["--resume", claude_session],
|
|
700
|
-
"Claude restart must spawn `claude ... --resume <session_id>`",
|
|
701
|
-
);
|
|
702
|
-
assert_state_session_id(&fixture.team, claude_session);
|
|
703
|
-
assert_events_contain_resume_decision(&fixture.team, "resume", claude_session);
|
|
704
|
-
}
|
|
705
|
-
|
|
706
653
|
#[test]
|
|
707
654
|
#[ignore = "real-machine: provider session filesystem + restart/shutdown lifecycle convergence"]
|
|
708
655
|
#[serial(env)]
|
|
@@ -756,23 +703,6 @@ fn persisted_session_id_is_the_resume_authority_for_restart_plan_and_spawn_argv(
|
|
|
756
703
|
&["resume", "codex-known-session"],
|
|
757
704
|
"Codex restart must use the persisted session id",
|
|
758
705
|
);
|
|
759
|
-
|
|
760
|
-
let claude = RestartFixture::new("claude-resume-authority", "claude");
|
|
761
|
-
seed_running_state_with_session(
|
|
762
|
-
&claude.team,
|
|
763
|
-
"claude",
|
|
764
|
-
&claude.spawn_cwd,
|
|
765
|
-
"claude-known-session",
|
|
766
|
-
);
|
|
767
|
-
let claude_transport = RecordingTransport::new().with_session_present(true);
|
|
768
|
-
let claude_report = restart_with_transport(&claude.team, false, None, &claude_transport)
|
|
769
|
-
.expect("persisted Claude session_id must be resumable");
|
|
770
|
-
assert_restarted_with_resume(&claude_report, "claude-known-session");
|
|
771
|
-
assert_spawn_contains_adjacent(
|
|
772
|
-
&claude_transport.single_spawn_argv(),
|
|
773
|
-
&["--resume", "claude-known-session"],
|
|
774
|
-
"Claude restart must use the persisted session id",
|
|
775
|
-
);
|
|
776
706
|
}
|
|
777
707
|
|
|
778
708
|
fn assert_restarted_with_resume(report: &RestartReport, expected_session: &str) {
|
|
@@ -980,16 +910,6 @@ fn agent_session<'a>(state: &'a serde_json::Value, agent_id: &str) -> Option<&'a
|
|
|
980
910
|
.filter(|value| !value.is_empty())
|
|
981
911
|
}
|
|
982
912
|
|
|
983
|
-
fn assert_spawn_contains_adjacent(argv: &[String], expected: &[&str], message: &str) {
|
|
984
|
-
assert!(
|
|
985
|
-
argv.windows(expected.len()).any(|window| window
|
|
986
|
-
.iter()
|
|
987
|
-
.map(String::as_str)
|
|
988
|
-
.eq(expected.iter().copied())),
|
|
989
|
-
"{message}; argv={argv:?}"
|
|
990
|
-
);
|
|
991
|
-
}
|
|
992
|
-
|
|
993
913
|
fn assert_spawn_contains_ordered(argv: &[String], expected: &[&str], message: &str) {
|
|
994
914
|
let mut index = 0;
|
|
995
915
|
for arg in argv {
|
|
@@ -1100,20 +1020,6 @@ fn seed_codex_home_rollout_with_agent_hint(
|
|
|
1100
1020
|
.unwrap();
|
|
1101
1021
|
}
|
|
1102
1022
|
|
|
1103
|
-
fn seed_claude_home_session(home: &Path, spawn_cwd: &Path, session_id: &str) {
|
|
1104
|
-
let dir = home.join(".claude/sessions");
|
|
1105
|
-
std::fs::create_dir_all(&dir).unwrap();
|
|
1106
|
-
std::fs::write(
|
|
1107
|
-
dir.join("worker-a-session.json"),
|
|
1108
|
-
serde_json::to_string(&json!({
|
|
1109
|
-
"sessionId": session_id,
|
|
1110
|
-
"cwd": spawn_cwd.to_string_lossy().to_string()
|
|
1111
|
-
}))
|
|
1112
|
-
.unwrap(),
|
|
1113
|
-
)
|
|
1114
|
-
.unwrap();
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
1023
|
fn seed_running_state_without_session(team: &Path, provider: &str, spawn_cwd: &Path) {
|
|
1118
1024
|
seed_running_state(team, provider, spawn_cwd, None);
|
|
1119
1025
|
seed_healthy_coordinator(team);
|
|
@@ -1322,12 +1228,7 @@ impl RestartFixture {
|
|
|
1322
1228
|
std::fs::write(
|
|
1323
1229
|
team.join("agents/worker_a.md"),
|
|
1324
1230
|
format!(
|
|
1325
|
-
"---\nname: worker_a\nrole: Worker\nprovider: {provider}\nmodel:
|
|
1326
|
-
if provider == "claude" {
|
|
1327
|
-
"claude-sonnet-4-6"
|
|
1328
|
-
} else {
|
|
1329
|
-
"gpt-5.5"
|
|
1330
|
-
}
|
|
1231
|
+
"---\nname: worker_a\nrole: Worker\nprovider: {provider}\nmodel: gpt-5.5\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nWorker.\n"
|
|
1331
1232
|
),
|
|
1332
1233
|
)
|
|
1333
1234
|
.unwrap();
|
|
@@ -1360,12 +1261,7 @@ impl RestartFixture {
|
|
|
1360
1261
|
std::fs::write(
|
|
1361
1262
|
team.join("agents/worker_a.md"),
|
|
1362
1263
|
format!(
|
|
1363
|
-
"---\nname: worker_a\nrole: Worker\nprovider: {provider}\nmodel:
|
|
1364
|
-
if provider == "claude" {
|
|
1365
|
-
"claude-sonnet-4-6"
|
|
1366
|
-
} else {
|
|
1367
|
-
"gpt-5.5"
|
|
1368
|
-
}
|
|
1264
|
+
"---\nname: worker_a\nrole: Worker\nprovider: {provider}\nmodel: gpt-5.5\nauth_mode: subscription\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nWorker.\n"
|
|
1369
1265
|
),
|
|
1370
1266
|
)
|
|
1371
1267
|
.unwrap();
|
|
@@ -686,7 +686,7 @@ fn write_profile_fixture(root: &Path, base_url: &str, token: &str) -> PathBuf {
|
|
|
686
686
|
fs::write(
|
|
687
687
|
team.join("profiles/local.env"),
|
|
688
688
|
format!(
|
|
689
|
-
"
|
|
689
|
+
"OPENAI_BASE_URL={base_url}\nOPENAI_API_KEY={token}\nOPENAI_MODEL=mock-model\n"
|
|
690
690
|
),
|
|
691
691
|
)
|
|
692
692
|
.unwrap();
|
|
@@ -697,7 +697,7 @@ fn write_profile_fixture(root: &Path, base_url: &str, token: &str) -> PathBuf {
|
|
|
697
697
|
.unwrap();
|
|
698
698
|
fs::write(
|
|
699
699
|
team.join("agents/worker.md"),
|
|
700
|
-
"---\nname: worker\nrole: Worker\nprovider:
|
|
700
|
+
"---\nname: worker\nrole: Worker\nprovider: codex\nauth_mode: compatible_api\ndangerously_skip_permissions: false\nprofile: local\nmodel: null\ntools:\n - mcp_team\n---\n\nWorker.\n",
|
|
701
701
|
)
|
|
702
702
|
.unwrap();
|
|
703
703
|
team
|
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
//! `swallow-batch4-cr-verdict.md` (workspace artifacts; BOTH points APPROVE'd,
|
|
5
5
|
//! 8 constraints C1-C8 + 6 reverse cases — folded below).
|
|
6
6
|
//!
|
|
7
|
-
//! Point 1 (C1-C4)
|
|
8
|
-
//!
|
|
9
|
-
//! empty map and `write_json_object` then flattens the user's file (silent
|
|
10
|
-
//! destructive rewrite; MUST-NOT-9 / MUST-NOT-13 violation).
|
|
7
|
+
//! Point 1 (C1-C4) covered the Claude compatible-API config dir that profile launch
|
|
8
|
+
//! maintained for legacy Claude workers; it left with that runtime.
|
|
11
9
|
//! Point 2 (C5-C8): MCP scope validation must FAIL CLOSED when the runtime state is
|
|
12
10
|
//! unreadable — today `load_runtime_state(..).unwrap_or(json!({}))`
|
|
13
11
|
//! (mcp_server/tools.rs:574/:232) silently substitutes an empty state, so a
|
|
@@ -25,75 +23,9 @@ mod hermetic_guard;
|
|
|
25
23
|
#[allow(dead_code)]
|
|
26
24
|
fn _hermetic_boundary_marker(_: &hermetic_guard::HermeticTestEnv) {}
|
|
27
25
|
|
|
28
|
-
use std::path::{Path, PathBuf};
|
|
29
|
-
use std::sync::atomic::{AtomicU64, Ordering};
|
|
30
|
-
|
|
31
26
|
use mcp_sim_harness::McpSimHarness;
|
|
32
27
|
use serde_json::json;
|
|
33
28
|
use serial_test::serial;
|
|
34
|
-
use team_agent::lifecycle::launch_with_transport;
|
|
35
|
-
|
|
36
|
-
/// C1-C4 + reverse cases `profile_invalid_json_returns_error_and_does_not_overwrite_file`
|
|
37
|
-
/// / `..._includes_path_and_parse_detail_and_next_action`: launching a claude
|
|
38
|
-
/// compatible_api profile over a CORRUPT `.claude.json` must return a structured error
|
|
39
|
-
/// (path + parse detail + next action) and leave the corrupt file byte-identical —
|
|
40
|
-
/// never rewrite it with a flattened empty object.
|
|
41
|
-
#[test]
|
|
42
|
-
#[serial(b4_mcp)]
|
|
43
|
-
fn b4_profile_invalid_json_fails_explicit_and_never_flattens_the_file() {
|
|
44
|
-
// Pin a neutral process ancestry so the launch path is deterministic regardless of
|
|
45
|
-
// which provider flags this test process inherited (same guard as the #264 batch).
|
|
46
|
-
std::env::set_var(
|
|
47
|
-
"TEAM_AGENT_TEST_PROCESS_ANCESTRY_ARGV_JSON",
|
|
48
|
-
"[\"/bin/zsh\"]",
|
|
49
|
-
);
|
|
50
|
-
let ws = tmp_ws("b4-profile");
|
|
51
|
-
let team_dir = write_claude_compatible_team(&ws);
|
|
52
|
-
let config_dir = ws.join(".team/runtime/provider-config/worker_a/claude");
|
|
53
|
-
std::fs::create_dir_all(&config_dir).unwrap();
|
|
54
|
-
let corrupt = b"{ this is the user's corrupt claude state".to_vec();
|
|
55
|
-
std::fs::write(config_dir.join(".claude.json"), &corrupt).unwrap();
|
|
56
|
-
|
|
57
|
-
let result = launch_with_transport(
|
|
58
|
-
&team_dir.join("team.spec.yaml"),
|
|
59
|
-
false,
|
|
60
|
-
true,
|
|
61
|
-
true,
|
|
62
|
-
&offline_transport::RecordingTransport::new(),
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
let mut failures = Vec::new();
|
|
66
|
-
match &result {
|
|
67
|
-
Ok(report) => failures.push(format!(
|
|
68
|
-
"C1/C2: a corrupt provider-config JSON must fail the launch with a \
|
|
69
|
-
structured profile_invalid_json error, not silently continue; got Ok({report:?})"
|
|
70
|
-
)),
|
|
71
|
-
Err(error) => {
|
|
72
|
-
let text = error.to_string();
|
|
73
|
-
if !text.contains(".claude.json") {
|
|
74
|
-
failures.push(format!(
|
|
75
|
-
"C1/N38: the error must name the offending path; got {text}"
|
|
76
|
-
));
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
let after = std::fs::read(config_dir.join(".claude.json")).unwrap_or_default();
|
|
81
|
-
if after != corrupt {
|
|
82
|
-
failures.push(format!(
|
|
83
|
-
"C3/C4: the user's corrupt file must stay byte-identical (framework never \
|
|
84
|
-
flattens user files on load failure — MUST-NOT-9); before={} bytes, after={} bytes: {:?}",
|
|
85
|
-
corrupt.len(),
|
|
86
|
-
after.len(),
|
|
87
|
-
String::from_utf8_lossy(&after)
|
|
88
|
-
));
|
|
89
|
-
}
|
|
90
|
-
std::env::remove_var("TEAM_AGENT_TEST_PROCESS_ANCESTRY_ARGV_JSON");
|
|
91
|
-
assert!(
|
|
92
|
-
failures.is_empty(),
|
|
93
|
-
"batch4 point-1 profile fail-explicit contract failed:\n{}",
|
|
94
|
-
failures.join("\n")
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
29
|
|
|
98
30
|
/// C5-C8 + reverse cases `scope_unverifiable_when_state_read_fails_returns_structured_refusal`
|
|
99
31
|
/// / `scope_unverifiable_state_recovers_retry_passes`: with the runtime state
|
|
@@ -156,187 +88,3 @@ gate (owner-required refusal), not some degraded path; body={}",
|
|
|
156
88
|
failures.join("\n")
|
|
157
89
|
);
|
|
158
90
|
}
|
|
159
|
-
|
|
160
|
-
// ───────────────────────────────────── fixtures ─────────────────────────────────────
|
|
161
|
-
|
|
162
|
-
/// Compiled claude compatible_api team with a profile (the path that maintains the
|
|
163
|
-
/// managed `.claude.json`). Mirrors the #264 profile fixture, claude flavor.
|
|
164
|
-
fn write_claude_compatible_team(ws: &Path) -> PathBuf {
|
|
165
|
-
let team = ws.join("teamdir");
|
|
166
|
-
std::fs::create_dir_all(team.join("agents")).unwrap();
|
|
167
|
-
std::fs::create_dir_all(team.join("profiles")).unwrap();
|
|
168
|
-
std::fs::write(
|
|
169
|
-
team.join("TEAM.md"),
|
|
170
|
-
"---\nname: b4team\nobjective: batch4 profile fixture.\nprovider: claude\n---\n\nTeam.\n",
|
|
171
|
-
)
|
|
172
|
-
.unwrap();
|
|
173
|
-
std::fs::write(
|
|
174
|
-
team.join("agents/worker_a.md"),
|
|
175
|
-
"---\nname: worker_a\nrole: Compat Worker\nprovider: claude\nmodel: claude-haiku\nauth_mode: compatible_api\ndangerously_skip_permissions: false\nprofile: relay\ntools:\n - mcp_team\n---\n\nCompat worker.\n",
|
|
176
|
-
)
|
|
177
|
-
.unwrap();
|
|
178
|
-
std::fs::write(
|
|
179
|
-
team.join("profiles/relay.env"),
|
|
180
|
-
"AUTH_MODE=compatible_api\nBASE_URL=https://relay.example/v1\nAPI_KEY=sk-relay-b4\nMODEL=claude-haiku\n",
|
|
181
|
-
)
|
|
182
|
-
.unwrap();
|
|
183
|
-
let spec = team_agent::compiler::compile_team(&team).expect("compile fixture team");
|
|
184
|
-
std::fs::write(
|
|
185
|
-
team.join("team.spec.yaml"),
|
|
186
|
-
team_agent::model::yaml::dumps(&spec),
|
|
187
|
-
)
|
|
188
|
-
.unwrap();
|
|
189
|
-
team
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
mod offline_transport {
|
|
193
|
-
use super::*;
|
|
194
|
-
use std::collections::BTreeMap;
|
|
195
|
-
use std::sync::Mutex;
|
|
196
|
-
use team_agent::transport::{
|
|
197
|
-
AttachOutcome, BackendKind, CaptureRange, CapturedText, InjectPayload, InjectReport,
|
|
198
|
-
InjectStage, InjectVerification, Key, PaneField, PaneId, PaneInfo, SessionName,
|
|
199
|
-
SetEnvOutcome, SpawnResult, SubmitVerification, Target, Transport, TransportError,
|
|
200
|
-
TurnVerification, WindowName,
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
#[derive(Default)]
|
|
204
|
-
pub struct RecordingTransport {
|
|
205
|
-
session_present: Mutex<bool>,
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
impl RecordingTransport {
|
|
209
|
-
pub fn new() -> Self {
|
|
210
|
-
Self::default()
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
impl Transport for RecordingTransport {
|
|
215
|
-
fn kind(&self) -> BackendKind {
|
|
216
|
-
BackendKind::Tmux
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
fn spawn_first(
|
|
220
|
-
&self,
|
|
221
|
-
session: &SessionName,
|
|
222
|
-
window: &WindowName,
|
|
223
|
-
_argv: &[String],
|
|
224
|
-
_cwd: &Path,
|
|
225
|
-
_env: &BTreeMap<String, String>,
|
|
226
|
-
) -> Result<SpawnResult, TransportError> {
|
|
227
|
-
*self.session_present.lock().unwrap() = true;
|
|
228
|
-
Ok(SpawnResult {
|
|
229
|
-
pane_id: PaneId::new("%1"),
|
|
230
|
-
session: session.clone(),
|
|
231
|
-
window: window.clone(),
|
|
232
|
-
child_pid: None,
|
|
233
|
-
})
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
fn spawn_into(
|
|
237
|
-
&self,
|
|
238
|
-
session: &SessionName,
|
|
239
|
-
window: &WindowName,
|
|
240
|
-
argv: &[String],
|
|
241
|
-
cwd: &Path,
|
|
242
|
-
env: &BTreeMap<String, String>,
|
|
243
|
-
) -> Result<SpawnResult, TransportError> {
|
|
244
|
-
self.spawn_first(session, window, argv, cwd, env)
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
fn inject(
|
|
248
|
-
&self,
|
|
249
|
-
_target: &Target,
|
|
250
|
-
_payload: &InjectPayload,
|
|
251
|
-
_submit: Key,
|
|
252
|
-
_bracketed: bool,
|
|
253
|
-
) -> Result<InjectReport, TransportError> {
|
|
254
|
-
Ok(InjectReport {
|
|
255
|
-
stage_reached: InjectStage::Submit,
|
|
256
|
-
inject_verification: InjectVerification::CaptureContainsToken,
|
|
257
|
-
submit_verification: SubmitVerification::EnterSentWithoutPlaceholderCheck,
|
|
258
|
-
turn_verification: TurnVerification::NotYetObserved,
|
|
259
|
-
attempts: 1,
|
|
260
|
-
submit_diagnostics: None,
|
|
261
|
-
})
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
fn send_keys(&self, _target: &Target, _keys: &[Key]) -> Result<(), TransportError> {
|
|
265
|
-
Ok(())
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
fn capture(
|
|
269
|
-
&self,
|
|
270
|
-
_target: &Target,
|
|
271
|
-
range: CaptureRange,
|
|
272
|
-
) -> Result<CapturedText, TransportError> {
|
|
273
|
-
Ok(CapturedText {
|
|
274
|
-
text: "Claude Code\n> ".to_string(),
|
|
275
|
-
range,
|
|
276
|
-
})
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
fn query(
|
|
280
|
-
&self,
|
|
281
|
-
_target: &Target,
|
|
282
|
-
field: PaneField,
|
|
283
|
-
) -> Result<Option<String>, TransportError> {
|
|
284
|
-
match field {
|
|
285
|
-
PaneField::PaneWidth => Ok(Some("120".to_string())),
|
|
286
|
-
_ => Ok(None),
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
fn liveness(
|
|
291
|
-
&self,
|
|
292
|
-
_pane: &PaneId,
|
|
293
|
-
) -> Result<team_agent::transport::PaneLiveness, TransportError> {
|
|
294
|
-
Ok(team_agent::transport::PaneLiveness::Live)
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
fn list_targets(&self) -> Result<Vec<PaneInfo>, TransportError> {
|
|
298
|
-
Ok(Vec::new())
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
fn has_session(&self, _session: &SessionName) -> Result<bool, TransportError> {
|
|
302
|
-
Ok(*self.session_present.lock().unwrap())
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
fn list_windows(&self, _session: &SessionName) -> Result<Vec<WindowName>, TransportError> {
|
|
306
|
-
Ok(Vec::new())
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
fn set_session_env(
|
|
310
|
-
&self,
|
|
311
|
-
_session: &SessionName,
|
|
312
|
-
_key: &str,
|
|
313
|
-
_value: &str,
|
|
314
|
-
) -> Result<SetEnvOutcome, TransportError> {
|
|
315
|
-
Ok(SetEnvOutcome::Applied)
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
fn kill_session(&self, _session: &SessionName) -> Result<(), TransportError> {
|
|
319
|
-
Ok(())
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
fn kill_window(&self, _target: &Target) -> Result<(), TransportError> {
|
|
323
|
-
Ok(())
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
fn attach_session(&self, _session: &SessionName) -> Result<AttachOutcome, TransportError> {
|
|
327
|
-
Ok(AttachOutcome::Attached)
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
fn tmp_ws(tag: &str) -> PathBuf {
|
|
333
|
-
static N: AtomicU64 = AtomicU64::new(0);
|
|
334
|
-
let dir = std::env::temp_dir().join(format!(
|
|
335
|
-
"ta-rs-swallow-{tag}-{}-{}",
|
|
336
|
-
std::process::id(),
|
|
337
|
-
N.fetch_add(1, Ordering::Relaxed)
|
|
338
|
-
));
|
|
339
|
-
let _ = std::fs::remove_dir_all(&dir);
|
|
340
|
-
std::fs::create_dir_all(&dir).unwrap();
|
|
341
|
-
std::fs::canonicalize(dir).unwrap()
|
|
342
|
-
}
|