@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
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
//! Claude compatible-api managed config contracts for Batch A Lane 2.
|
|
2
|
-
//!
|
|
3
|
-
//! The profile resolver owns file artifacts; the provider only consumes `managed_mcp_config`.
|
|
4
|
-
//! These tests verify the public files/env/argv shape expected by Python 0.2.11 parity.
|
|
5
|
-
|
|
6
|
-
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
|
7
|
-
|
|
8
|
-
#[path = "../../../tests/support/hermetic.rs"]
|
|
9
|
-
mod hermetic_guard;
|
|
10
|
-
#[allow(dead_code)]
|
|
11
|
-
fn _hermetic_boundary_marker(_: &hermetic_guard::HermeticTestEnv) {}
|
|
12
|
-
|
|
13
|
-
use std::collections::{BTreeMap, BTreeSet};
|
|
14
|
-
use std::path::{Path, PathBuf};
|
|
15
|
-
use std::sync::atomic::{AtomicU64, Ordering};
|
|
16
|
-
use std::sync::Mutex;
|
|
17
|
-
|
|
18
|
-
use serde_json::{json, Value};
|
|
19
|
-
use serial_test::serial;
|
|
20
|
-
use team_agent::lifecycle::quick_start_with_transport_in_workspace;
|
|
21
|
-
use team_agent::model::enums::{AuthMode, Provider};
|
|
22
|
-
use team_agent::provider::{
|
|
23
|
-
get_adapter, McpConfig, ProviderCommandContext, ProviderCommandOverrides, ProviderProfileLaunch,
|
|
24
|
-
};
|
|
25
|
-
use team_agent::transport::{
|
|
26
|
-
AttachOutcome, BackendKind, CaptureRange, CapturedText, InjectPayload, InjectReport,
|
|
27
|
-
InjectStage, InjectVerification, Key, PaneField, PaneId, PaneInfo, SessionName, SetEnvOutcome,
|
|
28
|
-
SpawnResult, SubmitVerification, Target, Transport, TransportError, TurnVerification,
|
|
29
|
-
WindowName,
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
#[test]
|
|
33
|
-
#[serial(env)]
|
|
34
|
-
fn compatible_api_profile_writes_claude_settings_and_project_state_with_mcp_servers() {
|
|
35
|
-
let _hermetic = hermetic_guard::HermeticTestEnv::enter_with_leader("claude-compatible-config");
|
|
36
|
-
let ws = tmp_dir("compatible-config-files");
|
|
37
|
-
super::launch_spawn::seed_healthy_coordinator(&ws);
|
|
38
|
-
let team = write_claude_profile_team(&ws, "cfgteam", "clauder");
|
|
39
|
-
let transport = RecordingTransport::default();
|
|
40
|
-
|
|
41
|
-
quick_start_with_transport_in_workspace(&ws, &team, None, true, Some("cfgteam"), &transport)
|
|
42
|
-
.expect("quick-start through recording transport should resolve compatible profile config");
|
|
43
|
-
|
|
44
|
-
let spawn = transport.single_spawn();
|
|
45
|
-
let config_dir = spawn
|
|
46
|
-
.env
|
|
47
|
-
.get("CLAUDE_CONFIG_DIR")
|
|
48
|
-
.map(PathBuf::from)
|
|
49
|
-
.expect("CLAUDE_CONFIG_DIR must be injected");
|
|
50
|
-
let settings = read_json(&config_dir.join("settings.json"));
|
|
51
|
-
let project_state = read_json(&config_dir.join(".claude.json"));
|
|
52
|
-
|
|
53
|
-
assert!(
|
|
54
|
-
settings_contains_trust_onboarding_and_theme(&settings),
|
|
55
|
-
"settings.json must pre-accept workspace trust/onboarding/theme for managed compatible_api Claude; path={} settings={settings}",
|
|
56
|
-
config_dir.join("settings.json").display()
|
|
57
|
-
);
|
|
58
|
-
assert!(
|
|
59
|
-
project_state
|
|
60
|
-
.pointer("/mcpServers/team_orchestrator")
|
|
61
|
-
.or_else(|| project_state.pointer("/projects/cfgteam/mcpServers/team_orchestrator"))
|
|
62
|
-
.is_some(),
|
|
63
|
-
".claude.json must contain the Team Agent MCP server project state; path={} project_state={project_state}",
|
|
64
|
-
config_dir.join(".claude.json").display()
|
|
65
|
-
);
|
|
66
|
-
assert!(
|
|
67
|
-
!argv_has_flag(&spawn.argv, "--mcp-config"),
|
|
68
|
-
"managed compatible_api launch uses CLAUDE_CONFIG_DIR artifacts, not provider argv --mcp-config; argv={:?}",
|
|
69
|
-
spawn.argv
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
#[test]
|
|
74
|
-
fn managed_profile_command_plan_omits_mcp_config_even_when_mcp_config_is_available() {
|
|
75
|
-
let root = tmp_dir("managed-plan-config");
|
|
76
|
-
let profile = ProviderProfileLaunch {
|
|
77
|
-
env_overlay: BTreeMap::from([(
|
|
78
|
-
"CLAUDE_CONFIG_DIR".to_string(),
|
|
79
|
-
root.join("claude-config").display().to_string(),
|
|
80
|
-
)]),
|
|
81
|
-
env_unset: BTreeSet::from(["ANTHROPIC_API_KEY".to_string()]),
|
|
82
|
-
command_overrides: ProviderCommandOverrides {
|
|
83
|
-
model: Some("profile-effective-haiku".to_string()),
|
|
84
|
-
..ProviderCommandOverrides::default()
|
|
85
|
-
},
|
|
86
|
-
claude_config_dir: Some(root.join("claude-config")),
|
|
87
|
-
claude_projects_root: Some(root.join("claude-config").join("projects")),
|
|
88
|
-
managed_mcp_config: true,
|
|
89
|
-
};
|
|
90
|
-
let config = McpConfig {
|
|
91
|
-
raw: json!({
|
|
92
|
-
"team_orchestrator": {
|
|
93
|
-
"type": "stdio",
|
|
94
|
-
"command": "team-agent",
|
|
95
|
-
"args": ["mcp-server", "--workspace", "{workspace}"]
|
|
96
|
-
}
|
|
97
|
-
}),
|
|
98
|
-
};
|
|
99
|
-
let plan = get_adapter(Provider::Claude)
|
|
100
|
-
.build_command_plan(ProviderCommandContext {
|
|
101
|
-
auth_mode: AuthMode::CompatibleApi,
|
|
102
|
-
mcp_config: Some(&config),
|
|
103
|
-
system_prompt: Some("worker prompt requiring native MCP"),
|
|
104
|
-
model: Some("profile-effective-haiku"),
|
|
105
|
-
dangerously_skip_permissions: false,
|
|
106
|
-
profile_launch: Some(&profile),
|
|
107
|
-
agent_id_hint: None,
|
|
108
|
-
effort: None,
|
|
109
|
-
})
|
|
110
|
-
.expect("managed compatible_api command plan should build");
|
|
111
|
-
|
|
112
|
-
assert!(
|
|
113
|
-
plan.managed_mcp_config,
|
|
114
|
-
"CommandPlan.managed_mcp_config must reflect ProviderProfileLaunch.managed_mcp_config; plan={plan:?}"
|
|
115
|
-
);
|
|
116
|
-
assert!(
|
|
117
|
-
!argv_has_flag(&plan.argv, "--mcp-config"),
|
|
118
|
-
"managed mode must not pass --mcp-config JSON/string in argv; config is materialized under CLAUDE_CONFIG_DIR; argv={:?}",
|
|
119
|
-
plan.argv
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
fn settings_contains_trust_onboarding_and_theme(settings: &Value) -> bool {
|
|
124
|
-
let text = settings.to_string();
|
|
125
|
-
["trust", "onboarding", "theme"]
|
|
126
|
-
.iter()
|
|
127
|
-
.all(|needle| text.to_ascii_lowercase().contains(needle))
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
fn read_json(path: &Path) -> Value {
|
|
131
|
-
let text = std::fs::read_to_string(path).unwrap_or_else(|err| {
|
|
132
|
-
panic!(
|
|
133
|
-
"expected managed Claude config file {}: {err}",
|
|
134
|
-
path.display()
|
|
135
|
-
)
|
|
136
|
-
});
|
|
137
|
-
serde_json::from_str(&text).unwrap_or_else(|err| {
|
|
138
|
-
panic!(
|
|
139
|
-
"managed Claude config file must be JSON {}: {err}; text={text}",
|
|
140
|
-
path.display()
|
|
141
|
-
)
|
|
142
|
-
})
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
fn write_claude_profile_team(ws: &Path, team_key: &str, agent_id: &str) -> PathBuf {
|
|
146
|
-
let team = ws.join(team_key);
|
|
147
|
-
std::fs::create_dir_all(team.join("agents")).unwrap();
|
|
148
|
-
std::fs::create_dir_all(ws.join(".team").join("current").join("profiles")).unwrap();
|
|
149
|
-
std::fs::write(
|
|
150
|
-
ws.join(".team").join("current").join("profiles").join("local.env"),
|
|
151
|
-
"ANTHROPIC_BASE_URL=https://llm.local/v1\nANTHROPIC_AUTH_TOKEN=local-secret\nANTHROPIC_MODEL=profile-effective-haiku\n",
|
|
152
|
-
)
|
|
153
|
-
.unwrap();
|
|
154
|
-
std::fs::write(
|
|
155
|
-
team.join("TEAM.md"),
|
|
156
|
-
format!(
|
|
157
|
-
"---\nname: {team_key}\nobjective: Claude compatible config contract.\nprovider: claude\nauth_mode: compatible_api\ndangerously_skip_permissions: false\n---\n\nTeam.\n"
|
|
158
|
-
),
|
|
159
|
-
)
|
|
160
|
-
.unwrap();
|
|
161
|
-
std::fs::write(
|
|
162
|
-
team.join("agents").join(format!("{agent_id}.md")),
|
|
163
|
-
format!(
|
|
164
|
-
"---\nname: {agent_id}\nrole: Claude Worker\nprovider: claude\nauth_mode: compatible_api\ndangerously_skip_permissions: false\nprofile: local\nmodel: null\ntools:\n - mcp_team\n---\n\nWorker.\n"
|
|
165
|
-
),
|
|
166
|
-
)
|
|
167
|
-
.unwrap();
|
|
168
|
-
team
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
fn argv_has_flag(argv: &[String], flag: &str) -> bool {
|
|
172
|
-
argv.iter().any(|arg| arg == flag)
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
fn tmp_dir(tag: &str) -> PathBuf {
|
|
176
|
-
static N: AtomicU64 = AtomicU64::new(0);
|
|
177
|
-
let dir = std::env::temp_dir().join(format!(
|
|
178
|
-
"ta-rs-claude-compatible-config-{tag}-{}-{}",
|
|
179
|
-
std::process::id(),
|
|
180
|
-
N.fetch_add(1, Ordering::Relaxed)
|
|
181
|
-
));
|
|
182
|
-
let _ = std::fs::remove_dir_all(&dir);
|
|
183
|
-
std::fs::create_dir_all(&dir).unwrap();
|
|
184
|
-
std::fs::canonicalize(dir).unwrap()
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
#[derive(Debug, Clone)]
|
|
188
|
-
struct RecordedSpawn {
|
|
189
|
-
argv: Vec<String>,
|
|
190
|
-
env: BTreeMap<String, String>,
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
#[derive(Debug, Default)]
|
|
194
|
-
struct RecordingTransport {
|
|
195
|
-
spawns: Mutex<Vec<RecordedSpawn>>,
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
impl RecordingTransport {
|
|
199
|
-
fn single_spawn(&self) -> RecordedSpawn {
|
|
200
|
-
let spawns = self.spawns.lock().unwrap();
|
|
201
|
-
assert_eq!(
|
|
202
|
-
spawns.len(),
|
|
203
|
-
1,
|
|
204
|
-
"fixture should record one Claude worker spawn; spawns={spawns:?}"
|
|
205
|
-
);
|
|
206
|
-
spawns[0].clone()
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
impl Transport for RecordingTransport {
|
|
211
|
-
fn kind(&self) -> BackendKind {
|
|
212
|
-
BackendKind::Tmux
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
fn spawn_first(
|
|
216
|
-
&self,
|
|
217
|
-
session: &SessionName,
|
|
218
|
-
window: &WindowName,
|
|
219
|
-
argv: &[String],
|
|
220
|
-
_cwd: &Path,
|
|
221
|
-
env: &BTreeMap<String, String>,
|
|
222
|
-
) -> Result<SpawnResult, TransportError> {
|
|
223
|
-
self.spawn_into(session, window, argv, _cwd, env)
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
fn spawn_into(
|
|
227
|
-
&self,
|
|
228
|
-
session: &SessionName,
|
|
229
|
-
window: &WindowName,
|
|
230
|
-
argv: &[String],
|
|
231
|
-
_cwd: &Path,
|
|
232
|
-
env: &BTreeMap<String, String>,
|
|
233
|
-
) -> Result<SpawnResult, TransportError> {
|
|
234
|
-
let mut spawns = self.spawns.lock().unwrap();
|
|
235
|
-
spawns.push(RecordedSpawn {
|
|
236
|
-
argv: argv.to_vec(),
|
|
237
|
-
env: env.clone(),
|
|
238
|
-
});
|
|
239
|
-
Ok(SpawnResult {
|
|
240
|
-
pane_id: PaneId::new(format!("%{}", spawns.len())),
|
|
241
|
-
session: session.clone(),
|
|
242
|
-
window: window.clone(),
|
|
243
|
-
child_pid: Some(20_000 + spawns.len() as u32),
|
|
244
|
-
})
|
|
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: String::new(),
|
|
275
|
-
range,
|
|
276
|
-
})
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
fn query(&self, _target: &Target, field: PaneField) -> Result<Option<String>, TransportError> {
|
|
280
|
-
match field {
|
|
281
|
-
PaneField::PaneWidth => Ok(Some("120".to_string())),
|
|
282
|
-
_ => Ok(None),
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
fn liveness(
|
|
287
|
-
&self,
|
|
288
|
-
_pane: &PaneId,
|
|
289
|
-
) -> Result<team_agent::transport::PaneLiveness, TransportError> {
|
|
290
|
-
Ok(team_agent::transport::PaneLiveness::Live)
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
fn list_targets(&self) -> Result<Vec<PaneInfo>, TransportError> {
|
|
294
|
-
Ok(Vec::new())
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
fn has_session(&self, _session: &SessionName) -> Result<bool, TransportError> {
|
|
298
|
-
Ok(false)
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
fn list_windows(&self, _session: &SessionName) -> Result<Vec<WindowName>, TransportError> {
|
|
302
|
-
Ok(Vec::new())
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
fn set_session_env(
|
|
306
|
-
&self,
|
|
307
|
-
_session: &SessionName,
|
|
308
|
-
_key: &str,
|
|
309
|
-
_value: &str,
|
|
310
|
-
) -> Result<SetEnvOutcome, TransportError> {
|
|
311
|
-
Ok(SetEnvOutcome::Applied)
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
fn kill_session(&self, _session: &SessionName) -> Result<(), TransportError> {
|
|
315
|
-
Ok(())
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
fn kill_window(&self, _target: &Target) -> Result<(), TransportError> {
|
|
319
|
-
Ok(())
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
fn attach_session(&self, _session: &SessionName) -> Result<AttachOutcome, TransportError> {
|
|
323
|
-
Ok(AttachOutcome::Attached)
|
|
324
|
-
}
|
|
325
|
-
}
|