@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
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
//!
|
|
1
|
+
//! Profile launch contracts for Batch A Lane 2.
|
|
2
2
|
//!
|
|
3
|
-
//! The
|
|
4
|
-
//!
|
|
5
|
-
//! S0 it behavior-reds on lifecycle/profile wiring.
|
|
3
|
+
//! The Claude compatible-api worker launch these contracts were written for is gone with the
|
|
4
|
+
//! legacy Claude worker runtime; the provider-neutral resolver wiring and doctor contracts remain.
|
|
6
5
|
|
|
7
6
|
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
|
8
7
|
|
|
@@ -13,117 +12,10 @@ fn _hermetic_boundary_marker(_: &hermetic_guard::HermeticTestEnv) {}
|
|
|
13
12
|
|
|
14
13
|
#[path = "../../../tests/support/composite_source.rs"]
|
|
15
14
|
mod composite_source;
|
|
16
|
-
use std::collections::{BTreeMap, BTreeSet};
|
|
17
15
|
use std::path::{Path, PathBuf};
|
|
18
16
|
use std::process::Command;
|
|
19
|
-
use std::sync::atomic::{AtomicU64, Ordering};
|
|
20
|
-
use std::sync::Mutex;
|
|
21
17
|
|
|
22
18
|
use serde_json::{json, Value};
|
|
23
|
-
use serial_test::serial;
|
|
24
|
-
use team_agent::lifecycle::quick_start_with_transport_in_workspace;
|
|
25
|
-
use team_agent::provider::{ProviderCommandOverrides, ProviderProfileLaunch};
|
|
26
|
-
use team_agent::state::persist::load_runtime_state;
|
|
27
|
-
use team_agent::transport::{
|
|
28
|
-
AttachOutcome, BackendKind, CaptureRange, CapturedText, InjectPayload, InjectReport,
|
|
29
|
-
InjectStage, InjectVerification, Key, PaneField, PaneId, PaneInfo, SessionName, SetEnvOutcome,
|
|
30
|
-
SpawnResult, SubmitVerification, Target, Transport, TransportError, TurnVerification,
|
|
31
|
-
WindowName,
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
#[test]
|
|
35
|
-
#[serial(env)]
|
|
36
|
-
fn compatible_api_profile_quick_start_spawns_claude_with_profile_env_and_state_metadata() {
|
|
37
|
-
let _hermetic = hermetic_guard::HermeticTestEnv::enter_with_leader("claude-profile-quick-start");
|
|
38
|
-
assert_s0_profile_launch_shape();
|
|
39
|
-
|
|
40
|
-
let ws = tmp_dir("profile-launch");
|
|
41
|
-
super::launch_spawn::seed_healthy_coordinator(&ws);
|
|
42
|
-
let team = write_claude_profile_team(&ws, "claudeprof", "clauder");
|
|
43
|
-
let transport = RecordingTransport::default();
|
|
44
|
-
|
|
45
|
-
quick_start_with_transport_in_workspace(&ws, &team, None, true, Some("claudeprof"), &transport)
|
|
46
|
-
.expect(
|
|
47
|
-
"quick-start through recording transport should reach the real lifecycle spawn path",
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
let spawn = transport.single_spawn();
|
|
51
|
-
for (key, expected) in [
|
|
52
|
-
("CLAUDE_CONFIG_DIR", None),
|
|
53
|
-
("ANTHROPIC_BASE_URL", Some("https://llm.local/v1")),
|
|
54
|
-
("ANTHROPIC_AUTH_TOKEN", Some("local-secret")),
|
|
55
|
-
("ANTHROPIC_MODEL", Some("profile-effective-haiku")),
|
|
56
|
-
] {
|
|
57
|
-
let got = spawn.env.get(key).map(String::as_str);
|
|
58
|
-
match expected {
|
|
59
|
-
Some(expected) => assert_eq!(
|
|
60
|
-
got,
|
|
61
|
-
Some(expected),
|
|
62
|
-
"Claude compatible_api profile launch must inject {key} from .team/current/profiles/local.env; env={:?}",
|
|
63
|
-
spawn.env
|
|
64
|
-
),
|
|
65
|
-
None => assert!(
|
|
66
|
-
got.is_some_and(|value| !value.is_empty()),
|
|
67
|
-
"Claude compatible_api profile launch must inject non-empty {key}; env={:?}",
|
|
68
|
-
spawn.env
|
|
69
|
-
),
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
assert!(
|
|
73
|
-
!spawn.env.contains_key("ANTHROPIC_API_KEY"),
|
|
74
|
-
"compatible_api must unset ANTHROPIC_API_KEY and use ANTHROPIC_AUTH_TOKEN instead; env={:?}",
|
|
75
|
-
spawn.env
|
|
76
|
-
);
|
|
77
|
-
assert!(
|
|
78
|
-
argv_contains_adjacent(&spawn.argv, &["--model", "profile-effective-haiku"]),
|
|
79
|
-
"profile model must become the effective Claude model when role model is null; argv={:?}",
|
|
80
|
-
spawn.argv
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
let state = load_runtime_state(&ws).unwrap();
|
|
84
|
-
let agent = &state["teams"]["claudeprof"]["agents"]["clauder"];
|
|
85
|
-
assert!(
|
|
86
|
-
agent["_pending_session_id"].as_str().is_some_and(|value| !value.is_empty()),
|
|
87
|
-
"lifecycle must persist CommandPlan.expected_session_id as agents[*]._pending_session_id; state={state}"
|
|
88
|
-
);
|
|
89
|
-
assert!(
|
|
90
|
-
agent["claude_projects_root"].as_str().is_some_and(|value| !value.is_empty()),
|
|
91
|
-
"lifecycle must persist CommandPlan.provider_projects_root/profile claude_projects_root for capture; state={state}"
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
#[ignore = "flaky under parallel suite, tracked"]
|
|
96
|
-
#[test]
|
|
97
|
-
#[serial(env)]
|
|
98
|
-
fn subscription_profile_keeps_default_claude_config_dir_for_logged_in_quota() {
|
|
99
|
-
let ws = tmp_dir("subscription-config");
|
|
100
|
-
let team = write_claude_subscription_profile_team(&ws, "subteam", "clauder");
|
|
101
|
-
let transport = RecordingTransport::default();
|
|
102
|
-
|
|
103
|
-
quick_start_with_transport_in_workspace(&ws, &team, None, true, Some("subteam"), &transport)
|
|
104
|
-
.expect("subscription profile should launch without managed config isolation");
|
|
105
|
-
|
|
106
|
-
let spawn = transport.single_spawn();
|
|
107
|
-
assert!(
|
|
108
|
-
!spawn.env.contains_key("CLAUDE_CONFIG_DIR"),
|
|
109
|
-
"subscription Claude workers must inherit the user's default ~/.claude login state; env={:?}",
|
|
110
|
-
spawn.env
|
|
111
|
-
);
|
|
112
|
-
assert!(
|
|
113
|
-
!spawn.env.contains_key("ANTHROPIC_API_KEY")
|
|
114
|
-
&& !spawn.env.contains_key("ANTHROPIC_AUTH_TOKEN"),
|
|
115
|
-
"subscription launch must not switch into API-token auth via profile env; env={:?}",
|
|
116
|
-
spawn.env
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
let state = load_runtime_state(&ws).unwrap();
|
|
120
|
-
let agent = &state["teams"]["subteam"]["agents"]["clauder"];
|
|
121
|
-
assert_eq!(
|
|
122
|
-
agent.get("claude_projects_root"),
|
|
123
|
-
None,
|
|
124
|
-
"without a supported fine-grained Claude projects-root env, subscription workers must not fake an isolated transcript root; state={state}"
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
19
|
|
|
128
20
|
#[test]
|
|
129
21
|
fn launch_restart_start_add_and_fork_all_delegate_to_the_profile_launch_resolver() {
|
|
@@ -171,7 +63,7 @@ fn launch_restart_start_add_and_fork_all_delegate_to_the_profile_launch_resolver
|
|
|
171
63
|
fn diagnose_missing_profile_is_rc1_ok_false_and_zero_token() {
|
|
172
64
|
let env = hermetic_guard::HermeticTestEnv::enter("diagnose-missing-profile");
|
|
173
65
|
let ws = env.workspace("missing-profile");
|
|
174
|
-
let team =
|
|
66
|
+
let team = write_compatible_profile_team(&ws, "diagteam", "copiloter");
|
|
175
67
|
std::fs::remove_file(
|
|
176
68
|
ws.join(".team")
|
|
177
69
|
.join("current")
|
|
@@ -212,73 +104,26 @@ fn diagnose_missing_profile_is_rc1_ok_false_and_zero_token() {
|
|
|
212
104
|
);
|
|
213
105
|
}
|
|
214
106
|
|
|
215
|
-
fn
|
|
216
|
-
let profile = ProviderProfileLaunch {
|
|
217
|
-
env_overlay: BTreeMap::from([(
|
|
218
|
-
"ANTHROPIC_MODEL".to_string(),
|
|
219
|
-
"profile-effective-haiku".to_string(),
|
|
220
|
-
)]),
|
|
221
|
-
env_unset: BTreeSet::from(["ANTHROPIC_API_KEY".to_string()]),
|
|
222
|
-
command_overrides: ProviderCommandOverrides {
|
|
223
|
-
model: Some("profile-effective-haiku".to_string()),
|
|
224
|
-
..ProviderCommandOverrides::default()
|
|
225
|
-
},
|
|
226
|
-
claude_config_dir: Some(PathBuf::from("/tmp/claude-config")),
|
|
227
|
-
claude_projects_root: Some(PathBuf::from("/tmp/claude-config/projects")),
|
|
228
|
-
managed_mcp_config: true,
|
|
229
|
-
};
|
|
230
|
-
assert!(profile.managed_mcp_config);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
fn write_claude_profile_team(ws: &Path, team_key: &str, agent_id: &str) -> PathBuf {
|
|
107
|
+
fn write_compatible_profile_team(ws: &Path, team_key: &str, agent_id: &str) -> PathBuf {
|
|
234
108
|
let team = ws.join(team_key);
|
|
235
109
|
std::fs::create_dir_all(team.join("agents")).unwrap();
|
|
236
110
|
std::fs::create_dir_all(ws.join(".team").join("current").join("profiles")).unwrap();
|
|
237
111
|
std::fs::write(
|
|
238
112
|
ws.join(".team").join("current").join("profiles").join("local.env"),
|
|
239
|
-
"
|
|
113
|
+
"BASE_URL=https://llm.local/v1\nAPI_KEY=local-secret\nMODEL=profile-effective-model\n",
|
|
240
114
|
)
|
|
241
115
|
.unwrap();
|
|
242
116
|
std::fs::write(
|
|
243
117
|
team.join("TEAM.md"),
|
|
244
118
|
format!(
|
|
245
|
-
"---\nname: {team_key}\nobjective:
|
|
119
|
+
"---\nname: {team_key}\nobjective: Compatible profile doctor contract.\nprovider: copilot\nauth_mode: compatible_api\ndangerously_skip_permissions: false\n---\n\nTeam.\n"
|
|
246
120
|
),
|
|
247
121
|
)
|
|
248
122
|
.unwrap();
|
|
249
123
|
std::fs::write(
|
|
250
124
|
team.join("agents").join(format!("{agent_id}.md")),
|
|
251
125
|
format!(
|
|
252
|
-
"---\nname: {agent_id}\nrole:
|
|
253
|
-
),
|
|
254
|
-
)
|
|
255
|
-
.unwrap();
|
|
256
|
-
team
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
fn write_claude_subscription_profile_team(ws: &Path, team_key: &str, agent_id: &str) -> PathBuf {
|
|
260
|
-
let team = ws.join(team_key);
|
|
261
|
-
std::fs::create_dir_all(team.join("agents")).unwrap();
|
|
262
|
-
std::fs::create_dir_all(ws.join(".team").join("current").join("profiles")).unwrap();
|
|
263
|
-
std::fs::write(
|
|
264
|
-
ws.join(".team")
|
|
265
|
-
.join("current")
|
|
266
|
-
.join("profiles")
|
|
267
|
-
.join("local.env"),
|
|
268
|
-
"AUTH_MODE=subscription\nMODEL=claude-sonnet-4-6\n",
|
|
269
|
-
)
|
|
270
|
-
.unwrap();
|
|
271
|
-
std::fs::write(
|
|
272
|
-
team.join("TEAM.md"),
|
|
273
|
-
format!(
|
|
274
|
-
"---\nname: {team_key}\nobjective: Claude subscription profile launch contract.\nprovider: claude\nauth_mode: subscription\ndangerously_skip_permissions: false\n---\n\nTeam.\n"
|
|
275
|
-
),
|
|
276
|
-
)
|
|
277
|
-
.unwrap();
|
|
278
|
-
std::fs::write(
|
|
279
|
-
team.join("agents").join(format!("{agent_id}.md")),
|
|
280
|
-
format!(
|
|
281
|
-
"---\nname: {agent_id}\nrole: Claude Worker\nprovider: claude\nauth_mode: subscription\ndangerously_skip_permissions: false\nprofile: local\nmodel: null\ntools:\n - mcp_team\n---\n\nWorker.\n"
|
|
126
|
+
"---\nname: {agent_id}\nrole: Copilot Worker\nprovider: copilot\nauth_mode: compatible_api\ndangerously_skip_permissions: false\nprofile: local\nmodel: profile-effective-model\ntools:\n - mcp_team\n---\n\nWorker.\n"
|
|
282
127
|
),
|
|
283
128
|
)
|
|
284
129
|
.unwrap();
|
|
@@ -288,160 +133,3 @@ fn write_claude_subscription_profile_team(ws: &Path, team_key: &str, agent_id: &
|
|
|
288
133
|
fn source(path: &str) -> String {
|
|
289
134
|
composite_source::composite_source(path)
|
|
290
135
|
}
|
|
291
|
-
|
|
292
|
-
fn argv_contains_adjacent(hay: &[String], needle: &[&str]) -> bool {
|
|
293
|
-
hay.windows(needle.len())
|
|
294
|
-
.any(|window| window.iter().map(String::as_str).eq(needle.iter().copied()))
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
fn tmp_dir(tag: &str) -> PathBuf {
|
|
298
|
-
static N: AtomicU64 = AtomicU64::new(0);
|
|
299
|
-
let dir = std::env::temp_dir().join(format!(
|
|
300
|
-
"ta-rs-claude-profile-launch-{tag}-{}-{}",
|
|
301
|
-
std::process::id(),
|
|
302
|
-
N.fetch_add(1, Ordering::Relaxed)
|
|
303
|
-
));
|
|
304
|
-
let _ = std::fs::remove_dir_all(&dir);
|
|
305
|
-
std::fs::create_dir_all(&dir).unwrap();
|
|
306
|
-
std::fs::canonicalize(dir).unwrap()
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
#[derive(Debug, Clone)]
|
|
310
|
-
struct RecordedSpawn {
|
|
311
|
-
argv: Vec<String>,
|
|
312
|
-
env: BTreeMap<String, String>,
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
#[derive(Debug, Default)]
|
|
316
|
-
struct RecordingTransport {
|
|
317
|
-
spawns: Mutex<Vec<RecordedSpawn>>,
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
impl RecordingTransport {
|
|
321
|
-
fn single_spawn(&self) -> RecordedSpawn {
|
|
322
|
-
let spawns = self.spawns.lock().unwrap();
|
|
323
|
-
assert_eq!(
|
|
324
|
-
spawns.len(),
|
|
325
|
-
1,
|
|
326
|
-
"fixture should record one Claude worker spawn; spawns={spawns:?}"
|
|
327
|
-
);
|
|
328
|
-
spawns[0].clone()
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
impl Transport for RecordingTransport {
|
|
333
|
-
fn kind(&self) -> BackendKind {
|
|
334
|
-
BackendKind::Tmux
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
fn spawn_first(
|
|
338
|
-
&self,
|
|
339
|
-
session: &SessionName,
|
|
340
|
-
window: &WindowName,
|
|
341
|
-
argv: &[String],
|
|
342
|
-
_cwd: &Path,
|
|
343
|
-
env: &BTreeMap<String, String>,
|
|
344
|
-
) -> Result<SpawnResult, TransportError> {
|
|
345
|
-
self.spawn_into(session, window, argv, _cwd, env)
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
fn spawn_into(
|
|
349
|
-
&self,
|
|
350
|
-
session: &SessionName,
|
|
351
|
-
window: &WindowName,
|
|
352
|
-
argv: &[String],
|
|
353
|
-
_cwd: &Path,
|
|
354
|
-
env: &BTreeMap<String, String>,
|
|
355
|
-
) -> Result<SpawnResult, TransportError> {
|
|
356
|
-
let mut spawns = self.spawns.lock().unwrap();
|
|
357
|
-
spawns.push(RecordedSpawn {
|
|
358
|
-
argv: argv.to_vec(),
|
|
359
|
-
env: env.clone(),
|
|
360
|
-
});
|
|
361
|
-
Ok(SpawnResult {
|
|
362
|
-
pane_id: PaneId::new(format!("%{}", spawns.len())),
|
|
363
|
-
session: session.clone(),
|
|
364
|
-
window: window.clone(),
|
|
365
|
-
child_pid: Some(10_000 + spawns.len() as u32),
|
|
366
|
-
})
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
fn inject(
|
|
370
|
-
&self,
|
|
371
|
-
_target: &Target,
|
|
372
|
-
_payload: &InjectPayload,
|
|
373
|
-
_submit: Key,
|
|
374
|
-
_bracketed: bool,
|
|
375
|
-
) -> Result<InjectReport, TransportError> {
|
|
376
|
-
Ok(InjectReport {
|
|
377
|
-
stage_reached: InjectStage::Submit,
|
|
378
|
-
inject_verification: InjectVerification::CaptureContainsToken,
|
|
379
|
-
submit_verification: SubmitVerification::EnterSentWithoutPlaceholderCheck,
|
|
380
|
-
turn_verification: TurnVerification::NotYetObserved,
|
|
381
|
-
attempts: 1,
|
|
382
|
-
submit_diagnostics: None,
|
|
383
|
-
})
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
fn send_keys(&self, _target: &Target, _keys: &[Key]) -> Result<(), TransportError> {
|
|
387
|
-
Ok(())
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
fn capture(
|
|
391
|
-
&self,
|
|
392
|
-
_target: &Target,
|
|
393
|
-
range: CaptureRange,
|
|
394
|
-
) -> Result<CapturedText, TransportError> {
|
|
395
|
-
Ok(CapturedText {
|
|
396
|
-
text: String::new(),
|
|
397
|
-
range,
|
|
398
|
-
})
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
fn query(&self, _target: &Target, field: PaneField) -> Result<Option<String>, TransportError> {
|
|
402
|
-
match field {
|
|
403
|
-
PaneField::PaneWidth => Ok(Some("120".to_string())),
|
|
404
|
-
_ => Ok(None),
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
fn liveness(
|
|
409
|
-
&self,
|
|
410
|
-
_pane: &PaneId,
|
|
411
|
-
) -> Result<team_agent::transport::PaneLiveness, TransportError> {
|
|
412
|
-
Ok(team_agent::transport::PaneLiveness::Live)
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
fn list_targets(&self) -> Result<Vec<PaneInfo>, TransportError> {
|
|
416
|
-
Ok(Vec::new())
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
fn has_session(&self, _session: &SessionName) -> Result<bool, TransportError> {
|
|
420
|
-
Ok(false)
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
fn list_windows(&self, _session: &SessionName) -> Result<Vec<WindowName>, TransportError> {
|
|
424
|
-
Ok(Vec::new())
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
fn set_session_env(
|
|
428
|
-
&self,
|
|
429
|
-
_session: &SessionName,
|
|
430
|
-
_key: &str,
|
|
431
|
-
_value: &str,
|
|
432
|
-
) -> Result<SetEnvOutcome, TransportError> {
|
|
433
|
-
Ok(SetEnvOutcome::Applied)
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
fn kill_session(&self, _session: &SessionName) -> Result<(), TransportError> {
|
|
437
|
-
Ok(())
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
fn kill_window(&self, _target: &Target) -> Result<(), TransportError> {
|
|
441
|
-
Ok(())
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
fn attach_session(&self, _session: &SessionName) -> Result<AttachOutcome, TransportError> {
|
|
445
|
-
Ok(AttachOutcome::Attached)
|
|
446
|
-
}
|
|
447
|
-
}
|