@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,260 +0,0 @@
|
|
|
1
|
-
//! ---
|
|
2
|
-
//! purpose: 判定 .grok/config.toml env 里哪些键是每席私有
|
|
3
|
-
//! contract:
|
|
4
|
-
//! provides:
|
|
5
|
-
//! - name: is_per_seat_env_key
|
|
6
|
-
//! what: TEAM_AGENT_* 除 WORKSPACE 外都是每席键
|
|
7
|
-
//! - name: per_seat_keys_in_toml
|
|
8
|
-
//! what: 扫描 toml env 表里的每席键
|
|
9
|
-
//! - name: strip_per_seat_keys_from_toml
|
|
10
|
-
//! what: 从任意 .env 表删掉每席键,留下非框架键
|
|
11
|
-
//! - name: non_per_seat_env_in_tables
|
|
12
|
-
//! what: 从指定表的 .env 取出非每席键(值原样),供 overlay 保留
|
|
13
|
-
//! boundary:
|
|
14
|
-
//! - 不写盘
|
|
15
|
-
//! - 不数 grok 席位个数
|
|
16
|
-
//! - 剥离结果只含键名,不含键值
|
|
17
|
-
//! maturity: wired
|
|
18
|
-
//! ---
|
|
19
|
-
|
|
20
|
-
/// ---
|
|
21
|
-
/// purpose: 判断某环境键是否属于每席私有
|
|
22
|
-
/// returns: 以 TEAM_AGENT_ 起头且不是 TEAM_AGENT_WORKSPACE 时为 true
|
|
23
|
-
/// ---
|
|
24
|
-
/// Shared identity keys belong on pane env. The only TEAM_AGENT_* key
|
|
25
|
-
/// allowed in the directory-scoped grok toml is WORKSPACE (same cwd).
|
|
26
|
-
pub(crate) fn is_per_seat_env_key(key: &str) -> bool {
|
|
27
|
-
let key = key.trim();
|
|
28
|
-
key.starts_with("TEAM_AGENT_") && key != "TEAM_AGENT_WORKSPACE"
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/// ---
|
|
32
|
-
/// purpose: 扫出 toml 里所有 env 表中的每席键
|
|
33
|
-
/// returns: 首次出现顺序的键值对,值已去掉引号
|
|
34
|
-
/// ---
|
|
35
|
-
pub(crate) fn per_seat_keys_in_toml(text: &str) -> Vec<(String, String)> {
|
|
36
|
-
let mut in_env_table = false;
|
|
37
|
-
let mut out = Vec::new();
|
|
38
|
-
for line in text.lines() {
|
|
39
|
-
let trimmed = line.trim();
|
|
40
|
-
if trimmed.starts_with('[') && trimmed.ends_with(']') {
|
|
41
|
-
let name = &trimmed[1..trimmed.len() - 1];
|
|
42
|
-
in_env_table = name.ends_with(".env");
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
if !in_env_table {
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
let Some((key, rest)) = trimmed.split_once('=') else {
|
|
49
|
-
continue;
|
|
50
|
-
};
|
|
51
|
-
let key = key.trim();
|
|
52
|
-
if !is_per_seat_env_key(key) {
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
let rest = rest.trim();
|
|
56
|
-
let value = rest
|
|
57
|
-
.strip_prefix('"')
|
|
58
|
-
.and_then(|s| s.strip_suffix('"'))
|
|
59
|
-
.or_else(|| rest.strip_prefix('\'').and_then(|s| s.strip_suffix('\'')))
|
|
60
|
-
.unwrap_or(rest);
|
|
61
|
-
if out.iter().any(|(existing, _)| existing == key) {
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
out.push((key.to_string(), value.to_string()));
|
|
65
|
-
}
|
|
66
|
-
out
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/// ---
|
|
70
|
-
/// purpose: 从所有 env 表里删掉每席键
|
|
71
|
-
/// returns: 删后的全文,以及被删键名的首次出现顺序列表,不含值
|
|
72
|
-
/// ---
|
|
73
|
-
/// Drop per-seat `TEAM_AGENT_*` assignments from any `*.env` table.
|
|
74
|
-
/// Other keys (`TEAM_AGENT_WORKSPACE`, `GROK_FOLDER_TRUST`, user keys) stay.
|
|
75
|
-
/// Returned names are first-seen order, values never included.
|
|
76
|
-
pub(crate) fn strip_per_seat_keys_from_toml(text: &str) -> (String, Vec<String>) {
|
|
77
|
-
let mut in_env_table = false;
|
|
78
|
-
let mut out = String::new();
|
|
79
|
-
let mut removed = Vec::new();
|
|
80
|
-
for line in text.lines() {
|
|
81
|
-
let trimmed = line.trim();
|
|
82
|
-
if trimmed.starts_with('[') && trimmed.ends_with(']') {
|
|
83
|
-
let name = &trimmed[1..trimmed.len() - 1];
|
|
84
|
-
in_env_table = name.ends_with(".env");
|
|
85
|
-
out.push_str(line);
|
|
86
|
-
out.push('\n');
|
|
87
|
-
continue;
|
|
88
|
-
}
|
|
89
|
-
if in_env_table {
|
|
90
|
-
if let Some((key, _)) = trimmed.split_once('=') {
|
|
91
|
-
let key = key.trim();
|
|
92
|
-
if is_per_seat_env_key(key) {
|
|
93
|
-
if !removed.iter().any(|existing| existing == key) {
|
|
94
|
-
removed.push(key.to_string());
|
|
95
|
-
}
|
|
96
|
-
continue;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
out.push_str(line);
|
|
101
|
-
out.push('\n');
|
|
102
|
-
}
|
|
103
|
-
(out, removed)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
fn toml_env_value(rest: &str) -> String {
|
|
107
|
-
let rest = rest.trim();
|
|
108
|
-
rest.strip_prefix('"')
|
|
109
|
-
.and_then(|s| s.strip_suffix('"'))
|
|
110
|
-
.or_else(|| rest.strip_prefix('\'').and_then(|s| s.strip_suffix('\'')))
|
|
111
|
-
.unwrap_or(rest)
|
|
112
|
-
.to_string()
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/// ---
|
|
116
|
-
/// purpose: 取出指定表的 env 段里非每席的键值
|
|
117
|
-
/// params:
|
|
118
|
-
/// tables: 目标表名前缀,只看这些表下的 env 段
|
|
119
|
-
/// returns: 键到值的有序映射,供覆盖写入时保留用户键
|
|
120
|
-
/// ---
|
|
121
|
-
/// Keys in `tables*.env` that are **not** per-seat. Unknown keys must be
|
|
122
|
-
/// kept — detection failure does not authorize deletion.
|
|
123
|
-
pub(crate) fn non_per_seat_env_in_tables(
|
|
124
|
-
text: &str,
|
|
125
|
-
tables: &[&str],
|
|
126
|
-
) -> std::collections::BTreeMap<String, String> {
|
|
127
|
-
let mut in_target_env = false;
|
|
128
|
-
let mut out = std::collections::BTreeMap::new();
|
|
129
|
-
for line in text.lines() {
|
|
130
|
-
let trimmed = line.trim();
|
|
131
|
-
if trimmed.starts_with('[') && trimmed.ends_with(']') {
|
|
132
|
-
let name = &trimmed[1..trimmed.len() - 1];
|
|
133
|
-
in_target_env = name.ends_with(".env")
|
|
134
|
-
&& tables
|
|
135
|
-
.iter()
|
|
136
|
-
.any(|table| name == *table || name.starts_with(&format!("{table}.")));
|
|
137
|
-
continue;
|
|
138
|
-
}
|
|
139
|
-
if !in_target_env {
|
|
140
|
-
continue;
|
|
141
|
-
}
|
|
142
|
-
let Some((key, rest)) = trimmed.split_once('=') else {
|
|
143
|
-
continue;
|
|
144
|
-
};
|
|
145
|
-
let key = key.trim();
|
|
146
|
-
if key.is_empty() || is_per_seat_env_key(key) {
|
|
147
|
-
continue;
|
|
148
|
-
}
|
|
149
|
-
out.entry(key.to_string())
|
|
150
|
-
.or_insert_with(|| toml_env_value(rest));
|
|
151
|
-
}
|
|
152
|
-
out
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
#[cfg(test)]
|
|
156
|
-
mod tests {
|
|
157
|
-
use super::*;
|
|
158
|
-
|
|
159
|
-
#[test]
|
|
160
|
-
fn workspace_is_shared_other_team_agent_keys_are_per_seat() {
|
|
161
|
-
assert!(!is_per_seat_env_key("TEAM_AGENT_WORKSPACE"));
|
|
162
|
-
assert!(is_per_seat_env_key("TEAM_AGENT_ID"));
|
|
163
|
-
assert!(is_per_seat_env_key("TEAM_AGENT_OWNER_TEAM_ID"));
|
|
164
|
-
assert!(is_per_seat_env_key("TEAM_AGENT_AUTH_MODE"));
|
|
165
|
-
assert!(is_per_seat_env_key("TEAM_AGENT_FUTURE_SEAT_KEY"));
|
|
166
|
-
assert!(!is_per_seat_env_key("GROK_FOLDER_TRUST"));
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
#[test]
|
|
170
|
-
fn scan_finds_per_seat_keys_in_env_table_only() {
|
|
171
|
-
let text = r#"
|
|
172
|
-
[mcp_servers.other.env]
|
|
173
|
-
TEAM_AGENT_ID = "ignore-other-server-still-counts"
|
|
174
|
-
|
|
175
|
-
[mcp_servers.team_orchestrator]
|
|
176
|
-
command = "/bin/x"
|
|
177
|
-
|
|
178
|
-
[mcp_servers.team_orchestrator.env]
|
|
179
|
-
TEAM_AGENT_WORKSPACE = "/ws"
|
|
180
|
-
TEAM_AGENT_AUTH_MODE = "impostor"
|
|
181
|
-
"#;
|
|
182
|
-
let keys = per_seat_keys_in_toml(text);
|
|
183
|
-
assert!(
|
|
184
|
-
keys.iter()
|
|
185
|
-
.any(|(k, v)| k == "TEAM_AGENT_AUTH_MODE" && v == "impostor"),
|
|
186
|
-
"must see AUTH; keys={keys:?}"
|
|
187
|
-
);
|
|
188
|
-
assert!(
|
|
189
|
-
keys.iter().any(|(k, _)| k == "TEAM_AGENT_ID"),
|
|
190
|
-
"any env table per-seat key counts; keys={keys:?}"
|
|
191
|
-
);
|
|
192
|
-
assert!(
|
|
193
|
-
!keys.iter().any(|(k, _)| k == "TEAM_AGENT_WORKSPACE"),
|
|
194
|
-
"WORKSPACE is shared; keys={keys:?}"
|
|
195
|
-
);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
#[test]
|
|
199
|
-
fn strip_drops_only_per_seat_keys_and_returns_names() {
|
|
200
|
-
let text = r#"
|
|
201
|
-
[mcp_servers.keep.env]
|
|
202
|
-
GROK_FOLDER_TRUST = "1"
|
|
203
|
-
TEAM_AGENT_ID = "impostor"
|
|
204
|
-
TEAM_AGENT_WORKSPACE = "/ws"
|
|
205
|
-
|
|
206
|
-
[mcp_servers.keep]
|
|
207
|
-
command = "/bin/keep"
|
|
208
|
-
|
|
209
|
-
[other]
|
|
210
|
-
TEAM_AGENT_AUTH_MODE = "not-in-env-table"
|
|
211
|
-
"#;
|
|
212
|
-
let (cleaned, removed) = strip_per_seat_keys_from_toml(text);
|
|
213
|
-
assert_eq!(removed, vec!["TEAM_AGENT_ID".to_string()]);
|
|
214
|
-
assert!(
|
|
215
|
-
!cleaned.contains("TEAM_AGENT_ID"),
|
|
216
|
-
"per-seat key must leave the env table; cleaned={cleaned}"
|
|
217
|
-
);
|
|
218
|
-
assert!(
|
|
219
|
-
cleaned.contains("GROK_FOLDER_TRUST = \"1\"")
|
|
220
|
-
&& cleaned.contains("TEAM_AGENT_WORKSPACE = \"/ws\"")
|
|
221
|
-
&& cleaned.contains("TEAM_AGENT_AUTH_MODE = \"not-in-env-table\"")
|
|
222
|
-
&& cleaned.contains("command = \"/bin/keep\""),
|
|
223
|
-
"non-per-seat keys and non-env tables stay; cleaned={cleaned}"
|
|
224
|
-
);
|
|
225
|
-
assert!(
|
|
226
|
-
!cleaned.contains("impostor"),
|
|
227
|
-
"stripped values must not be rewritten; cleaned={cleaned}"
|
|
228
|
-
);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
#[test]
|
|
232
|
-
fn non_per_seat_scan_keeps_unknown_keys_from_named_tables_only() {
|
|
233
|
-
let text = r#"
|
|
234
|
-
[mcp_servers.keep-me.env]
|
|
235
|
-
GROK_FOLDER_TRUST = "other-table"
|
|
236
|
-
|
|
237
|
-
[mcp_servers.team_orchestrator.env]
|
|
238
|
-
TEAM_AGENT_ID = "stale"
|
|
239
|
-
GROK_FOLDER_TRUST = "1"
|
|
240
|
-
TEAM_AGENT_WORKSPACE = "/ws"
|
|
241
|
-
USER_EXTRA = "keep"
|
|
242
|
-
"#;
|
|
243
|
-
let kept = non_per_seat_env_in_tables(text, &["mcp_servers.team_orchestrator"]);
|
|
244
|
-
assert_eq!(kept.get("GROK_FOLDER_TRUST").map(String::as_str), Some("1"));
|
|
245
|
-
assert_eq!(kept.get("USER_EXTRA").map(String::as_str), Some("keep"));
|
|
246
|
-
assert_eq!(
|
|
247
|
-
kept.get("TEAM_AGENT_WORKSPACE").map(String::as_str),
|
|
248
|
-
Some("/ws")
|
|
249
|
-
);
|
|
250
|
-
assert!(
|
|
251
|
-
!kept.contains_key("TEAM_AGENT_ID"),
|
|
252
|
-
"per-seat keys are not preserved; kept={kept:?}"
|
|
253
|
-
);
|
|
254
|
-
assert_ne!(
|
|
255
|
-
kept.get("GROK_FOLDER_TRUST").map(String::as_str),
|
|
256
|
-
Some("other-table"),
|
|
257
|
-
"only the named table is read; kept={kept:?}"
|
|
258
|
-
);
|
|
259
|
-
}
|
|
260
|
-
}
|