@team-agent/installer 0.5.123 → 0.5.125
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 -1
- package/crates/team-agent/src/cli/emit.rs +41 -15
- package/crates/team-agent/src/cli/intent/runtime.rs +30 -54
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +59 -118
- 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 +6 -5
- package/crates/team-agent/src/cli/models.rs +93 -128
- 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/status_send.rs +17 -0
- package/crates/team-agent/src/compiler/tests.rs +21 -5
- package/crates/team-agent/src/compiler.rs +24 -1
- package/crates/team-agent/src/contract_runtime/backend.rs +30 -6
- package/crates/team-agent/src/contract_runtime/config.rs +34 -24
- package/crates/team-agent/src/contract_runtime/discovery.rs +79 -56
- package/crates/team-agent/src/contract_runtime/framework.rs +89 -34
- package/crates/team-agent/src/contract_runtime/registry.rs +299 -24
- package/crates/team-agent/src/coordinator/runtime_detectors.rs +0 -1
- 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 +0 -1
- 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 +14 -1
- package/crates/team-agent/src/lifecycle/launch/agent_state.rs +0 -9
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +0 -1
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +2 -2
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +19 -101
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +0 -28
- 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 -20
- package/crates/team-agent/src/lifecycle/profile_launch.rs +11 -39
- package/crates/team-agent/src/lifecycle/profile_smoke.rs +1 -2
- package/crates/team-agent/src/lifecycle/restart/common.rs +1 -63
- package/crates/team-agent/src/lifecycle/role_config.rs +42 -3
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +43 -13
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +6 -2
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +1 -3
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +4 -16
- package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +1 -3
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +84 -53
- package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +19 -1
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +21 -0
- package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +0 -1
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +0 -137
- package/crates/team-agent/src/lifecycle/tests.rs +0 -3
- 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 +186 -38
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +4 -4
- 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 +66 -4
- package/crates/team-agent/src/messaging/tests/runtime.rs +110 -4
- package/crates/team-agent/src/messaging/tests/spine.rs +22 -6
- package/crates/team-agent/src/model/enums.rs +1 -8
- package/crates/team-agent/src/provider/adapter.rs +1 -67
- package/crates/team-agent/src/provider/adapters/mod.rs +0 -1
- package/crates/team-agent/src/provider/adapters/pi.rs +4 -4
- 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 +2 -73
- package/crates/team-agent/src/provider/session/capture.rs +1 -1
- package/crates/team-agent/src/provider/session/context_fork.rs +4 -4
- package/crates/team-agent/src/provider/session_scan/common.rs +1 -2
- package/crates/team-agent/src/provider/session_scan/pi.rs +32 -19
- package/crates/team-agent/src/provider/session_scan.rs +0 -4
- package/crates/team-agent/src/provider/submit_now.rs +5 -28
- package/crates/team-agent/src/provider/tests/adapter.rs +5 -184
- package/crates/team-agent/src/provider/tests/classify.rs +53 -0
- package/crates/team-agent/src/provider/tests/command_helpers.rs +3 -6
- package/crates/team-agent/src/provider/types.rs +1 -1
- package/crates/team-agent/src/provider/wire.rs +48 -8
- 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/npm/install.mjs +40 -3
- package/package.json +4 -4
- package/skills/team-agent/SKILL.md +1 -1
- 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/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/provider/adapters/cursor_agent.rs +0 -44
- 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
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
//! ---
|
|
2
|
-
//! purpose: cursor 席位角色必须显式写 model;写了 effort 必须编译失败
|
|
3
|
-
//! contract:
|
|
4
|
-
//! provides:
|
|
5
|
-
//! - name: cursor-missing-model-refuses
|
|
6
|
-
//! what: 缺 model 的 cursor 角色启动失败(错误含 model)
|
|
7
|
-
//! - name: cursor-explicit-model-reaches-argv
|
|
8
|
-
//! what: 写了 model 则该值进入 `--model <值>`
|
|
9
|
-
//! - name: cursor-effort-refuses-compile
|
|
10
|
-
//! what: 角色写 effort 则失败,不得丢掉后仍起席
|
|
11
|
-
//! - name: cursor-second-seat-refuses
|
|
12
|
-
//! what: 同 workspace 第二 CursorAgent 拒绝,文案含 TEAM_AGENT_ID/mcp.json
|
|
13
|
-
//! boundary:
|
|
14
|
-
//! - 只钉 Provider::CursorAgent;不改 grok/claude 路径
|
|
15
|
-
//! maturity: wired
|
|
16
|
-
//! ---
|
|
17
|
-
|
|
18
|
-
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
|
19
|
-
|
|
20
|
-
#[path = "../../../tests/support/hermetic.rs"]
|
|
21
|
-
mod hermetic_guard;
|
|
22
|
-
#[allow(dead_code)]
|
|
23
|
-
fn _hermetic_boundary_marker(_: &hermetic_guard::HermeticTestEnv) {}
|
|
24
|
-
|
|
25
|
-
use std::path::{Path, PathBuf};
|
|
26
|
-
use std::sync::atomic::{AtomicU64, Ordering};
|
|
27
|
-
|
|
28
|
-
use serial_test::serial;
|
|
29
|
-
use team_agent::lifecycle::quick_start_with_transport_in_workspace;
|
|
30
|
-
use team_agent::transport::test_support::OfflineTransport;
|
|
31
|
-
|
|
32
|
-
#[test]
|
|
33
|
-
#[serial(env)]
|
|
34
|
-
fn cursor_role_missing_model_uses_provider_default() {
|
|
35
|
-
let _hermetic = hermetic_guard::HermeticTestEnv::enter_with_leader("cursor-no-model");
|
|
36
|
-
let ws = tmp_dir("cursor-no-model");
|
|
37
|
-
super::launch_spawn::seed_healthy_coordinator(&ws);
|
|
38
|
-
let team = write_role_team(&ws, "cursortm", "cursor_writer", None, None);
|
|
39
|
-
let transport = OfflineTransport::new();
|
|
40
|
-
quick_start_with_transport_in_workspace(
|
|
41
|
-
&ws,
|
|
42
|
-
&team,
|
|
43
|
-
None,
|
|
44
|
-
true,
|
|
45
|
-
Some("cursortm"),
|
|
46
|
-
&transport,
|
|
47
|
-
)
|
|
48
|
-
.expect("Cursor may use its provider-native model default");
|
|
49
|
-
let argv = first_spawn_argv(&transport);
|
|
50
|
-
assert!(
|
|
51
|
-
!argv.iter().any(|arg| arg == "--model"),
|
|
52
|
-
"an omitted model must not fabricate a --model argument: {argv:?}"
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
#[test]
|
|
57
|
-
#[serial(env)]
|
|
58
|
-
fn cursor_role_explicit_model_reaches_argv() {
|
|
59
|
-
let _hermetic = hermetic_guard::HermeticTestEnv::enter_with_leader("cursor-with-model");
|
|
60
|
-
let ws = tmp_dir("cursor-with-model");
|
|
61
|
-
super::launch_spawn::seed_healthy_coordinator(&ws);
|
|
62
|
-
let team = write_role_team(
|
|
63
|
-
&ws,
|
|
64
|
-
"cursortm",
|
|
65
|
-
"cursor_writer",
|
|
66
|
-
Some("sonnet-4-thinking"),
|
|
67
|
-
None,
|
|
68
|
-
);
|
|
69
|
-
let transport = OfflineTransport::new();
|
|
70
|
-
quick_start_with_transport_in_workspace(&ws, &team, None, true, Some("cursortm"), &transport)
|
|
71
|
-
.expect("cursor role with explicit model must start");
|
|
72
|
-
let argv = first_spawn_argv(&transport);
|
|
73
|
-
assert!(
|
|
74
|
-
argv_contains_adjacent(&argv, &["--model", "sonnet-4-thinking"]),
|
|
75
|
-
"declared model must appear; argv={argv:?}"
|
|
76
|
-
);
|
|
77
|
-
assert!(
|
|
78
|
-
argv_contains_adjacent(&argv, &["--trust"]),
|
|
79
|
-
"argv must keep --trust; argv={argv:?}"
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
#[test]
|
|
84
|
-
#[serial(env)]
|
|
85
|
-
fn cursor_role_with_effort_refuses_to_start() {
|
|
86
|
-
let ws = tmp_dir("cursor-effort");
|
|
87
|
-
let team = write_role_team(
|
|
88
|
-
&ws,
|
|
89
|
-
"cursortm",
|
|
90
|
-
"cursor_writer",
|
|
91
|
-
Some("sonnet-4-thinking"),
|
|
92
|
-
Some("high"),
|
|
93
|
-
);
|
|
94
|
-
let transport = OfflineTransport::new();
|
|
95
|
-
let result = quick_start_with_transport_in_workspace(
|
|
96
|
-
&ws,
|
|
97
|
-
&team,
|
|
98
|
-
None,
|
|
99
|
-
true,
|
|
100
|
-
Some("cursortm"),
|
|
101
|
-
&transport,
|
|
102
|
-
);
|
|
103
|
-
let err = match result {
|
|
104
|
-
Ok(report) => panic!("cursor role with effort must refuse; report={report:?}"),
|
|
105
|
-
Err(error) => error.to_string(),
|
|
106
|
-
};
|
|
107
|
-
let lower = err.to_ascii_lowercase();
|
|
108
|
-
assert!(
|
|
109
|
-
lower.contains("effort"),
|
|
110
|
-
"error must name effort; err={err}"
|
|
111
|
-
);
|
|
112
|
-
assert!(
|
|
113
|
-
transport.spawn_records().is_empty(),
|
|
114
|
-
"must refuse before spawn; records={:?}",
|
|
115
|
-
transport.spawn_records()
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
#[test]
|
|
120
|
-
#[serial(env)]
|
|
121
|
-
fn cursor_second_seat_in_same_workspace_is_refused() {
|
|
122
|
-
let _hermetic = hermetic_guard::HermeticTestEnv::enter_with_leader("cursor-two");
|
|
123
|
-
let ws = tmp_dir("cursor-two");
|
|
124
|
-
let team = ws.join("cursortm");
|
|
125
|
-
std::fs::create_dir_all(team.join("agents")).unwrap();
|
|
126
|
-
std::fs::write(
|
|
127
|
-
team.join("TEAM.md"),
|
|
128
|
-
"---\nname: cursortm\nobjective: two cursor seats.\nprovider: cursor_agent\ndangerously_skip_permissions: true\n---\n\nTeam.\n",
|
|
129
|
-
)
|
|
130
|
-
.unwrap();
|
|
131
|
-
for id in ["cursor_a", "cursor_b"] {
|
|
132
|
-
std::fs::write(
|
|
133
|
-
team.join("agents").join(format!("{id}.md")),
|
|
134
|
-
format!(
|
|
135
|
-
"---\nname: {id}\nrole: Cursor Writer\nprovider: cursor_agent\nmodel: sonnet-4-thinking\nauth_mode: subscription\ndangerously_skip_permissions: true\ntools:\n - mcp_team\n---\n\nWorker.\n"
|
|
136
|
-
),
|
|
137
|
-
)
|
|
138
|
-
.unwrap();
|
|
139
|
-
}
|
|
140
|
-
let transport = OfflineTransport::new();
|
|
141
|
-
let result = quick_start_with_transport_in_workspace(
|
|
142
|
-
&ws,
|
|
143
|
-
&team,
|
|
144
|
-
None,
|
|
145
|
-
true,
|
|
146
|
-
Some("cursortm"),
|
|
147
|
-
&transport,
|
|
148
|
-
);
|
|
149
|
-
let err = match result {
|
|
150
|
-
Ok(report) => panic!("second cursor seat must refuse; report={report:?}"),
|
|
151
|
-
Err(error) => error.to_string(),
|
|
152
|
-
};
|
|
153
|
-
assert!(
|
|
154
|
-
err.contains("TEAM_AGENT_ID") && err.contains("mcp.json"),
|
|
155
|
-
"error must name the last-writer identity file; err={err}"
|
|
156
|
-
);
|
|
157
|
-
assert!(
|
|
158
|
-
transport.spawn_records().is_empty(),
|
|
159
|
-
"must refuse before any cursor spawn; records={:?}",
|
|
160
|
-
transport.spawn_records()
|
|
161
|
-
);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
fn first_spawn_argv(transport: &OfflineTransport) -> Vec<String> {
|
|
165
|
-
let records = transport.spawn_records();
|
|
166
|
-
assert!(
|
|
167
|
-
!records.is_empty(),
|
|
168
|
-
"expected a worker spawn; records={records:?}"
|
|
169
|
-
);
|
|
170
|
-
records[0].1.clone()
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
fn argv_contains_adjacent(hay: &[String], needle: &[&str]) -> bool {
|
|
174
|
-
hay.windows(needle.len())
|
|
175
|
-
.any(|window| window.iter().map(String::as_str).eq(needle.iter().copied()))
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
fn write_role_team(
|
|
179
|
-
ws: &Path,
|
|
180
|
-
team_key: &str,
|
|
181
|
-
agent_id: &str,
|
|
182
|
-
model: Option<&str>,
|
|
183
|
-
effort: Option<&str>,
|
|
184
|
-
) -> PathBuf {
|
|
185
|
-
let team = ws.join(team_key);
|
|
186
|
-
std::fs::create_dir_all(team.join("agents")).unwrap();
|
|
187
|
-
std::fs::write(
|
|
188
|
-
team.join("TEAM.md"),
|
|
189
|
-
format!(
|
|
190
|
-
"---\nname: {team_key}\nobjective: cursor model contract.\nprovider: cursor_agent\ndangerously_skip_permissions: true\n---\n\nTeam.\n"
|
|
191
|
-
),
|
|
192
|
-
)
|
|
193
|
-
.unwrap();
|
|
194
|
-
let model_line = match model {
|
|
195
|
-
Some(value) => format!("model: {value}\n"),
|
|
196
|
-
None => String::new(),
|
|
197
|
-
};
|
|
198
|
-
let effort_line = match effort {
|
|
199
|
-
Some(value) => format!("effort: {value}\n"),
|
|
200
|
-
None => String::new(),
|
|
201
|
-
};
|
|
202
|
-
std::fs::write(
|
|
203
|
-
team.join("agents").join(format!("{agent_id}.md")),
|
|
204
|
-
format!(
|
|
205
|
-
"---\nname: {agent_id}\nrole: Cursor Writer\nprovider: cursor_agent\n{model_line}{effort_line}auth_mode: subscription\ndangerously_skip_permissions: true\ntools:\n - mcp_team\n---\n\nWorker.\n"
|
|
206
|
-
),
|
|
207
|
-
)
|
|
208
|
-
.unwrap();
|
|
209
|
-
team
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
fn tmp_dir(tag: &str) -> PathBuf {
|
|
213
|
-
static N: AtomicU64 = AtomicU64::new(0);
|
|
214
|
-
let dir = std::env::temp_dir().join(format!(
|
|
215
|
-
"ta-rs-cursor-model-{tag}-{}-{}",
|
|
216
|
-
std::process::id(),
|
|
217
|
-
N.fetch_add(1, Ordering::Relaxed)
|
|
218
|
-
));
|
|
219
|
-
let _ = std::fs::remove_dir_all(&dir);
|
|
220
|
-
std::fs::create_dir_all(&dir).unwrap();
|
|
221
|
-
std::fs::canonicalize(dir).unwrap()
|
|
222
|
-
}
|