@team-agent/installer 0.5.124 → 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 +5 -53
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +0 -120
- 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 +40 -119
- 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 +22 -6
- package/crates/team-agent/src/contract_runtime/config.rs +34 -24
- package/crates/team-agent/src/contract_runtime/discovery.rs +33 -0
- package/crates/team-agent/src/contract_runtime/framework.rs +89 -34
- package/crates/team-agent/src/contract_runtime/registry.rs +258 -21
- 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/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 +38 -7
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +6 -2
- 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 +181 -35
- 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/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.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 +1 -4
- 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/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
|
@@ -47,26 +47,6 @@ const COMPATIBLE_NETWORK_ENV_KEYS: &[&str] = &[
|
|
|
47
47
|
"REQUESTS_CA_BUNDLE",
|
|
48
48
|
];
|
|
49
49
|
|
|
50
|
-
// Cursor subscription direct mode removes only proxy URL inputs. NO_PROXY is
|
|
51
|
-
// deliberately retained: it is a bypass list, not a proxy endpoint, and the
|
|
52
|
-
// observed catalog failure came from the GLOBAL_AGENT proxy URL settings.
|
|
53
|
-
const CURSOR_DIRECT_PROXY_ENV_KEYS: &[&str] = &[
|
|
54
|
-
"HTTPS_PROXY",
|
|
55
|
-
"HTTP_PROXY",
|
|
56
|
-
"ALL_PROXY",
|
|
57
|
-
"https_proxy",
|
|
58
|
-
"http_proxy",
|
|
59
|
-
"all_proxy",
|
|
60
|
-
"GLOBAL_AGENT_HTTPS_PROXY",
|
|
61
|
-
"GLOBAL_AGENT_HTTP_PROXY",
|
|
62
|
-
];
|
|
63
|
-
|
|
64
|
-
pub(crate) fn cursor_subscription_direct_mode(profile_launch: &ProviderProfileLaunch) -> bool {
|
|
65
|
-
CURSOR_DIRECT_PROXY_ENV_KEYS
|
|
66
|
-
.iter()
|
|
67
|
-
.all(|key| profile_launch.env_unset.contains(*key))
|
|
68
|
-
}
|
|
69
|
-
|
|
70
50
|
#[derive(Debug, Clone)]
|
|
71
51
|
pub(crate) struct ProfileValues {
|
|
72
52
|
pub(crate) path: PathBuf,
|
|
@@ -117,6 +97,9 @@ pub(crate) fn prepare_provider_profile_launch_with_profile_dir(
|
|
|
117
97
|
profile_dir: Option<&Path>,
|
|
118
98
|
mcp_config: Option<&McpConfig>,
|
|
119
99
|
) -> Result<ProviderProfileLaunch, LifecycleError> {
|
|
100
|
+
if agent.get("provider").and_then(YamlValue::as_str).is_some_and(crate::provider::wire::is_retired_provider) {
|
|
101
|
+
return Err(LifecycleError::Provider(crate::provider::wire::RETIRED_PROVIDER_ERROR.into()));
|
|
102
|
+
}
|
|
120
103
|
let input = AgentProfileInput {
|
|
121
104
|
id: agent
|
|
122
105
|
.get("id")
|
|
@@ -170,6 +153,9 @@ pub(crate) fn prepare_provider_profile_launch_from_json(
|
|
|
170
153
|
agent: &serde_json::Value,
|
|
171
154
|
mcp_config: Option<&McpConfig>,
|
|
172
155
|
) -> Result<ProviderProfileLaunch, LifecycleError> {
|
|
156
|
+
if agent.get("provider").and_then(serde_json::Value::as_str).is_some_and(crate::provider::wire::is_retired_provider) {
|
|
157
|
+
return Err(LifecycleError::Provider(crate::provider::wire::RETIRED_PROVIDER_ERROR.into()));
|
|
158
|
+
}
|
|
173
159
|
let input = AgentProfileInput {
|
|
174
160
|
id: agent
|
|
175
161
|
.get("id")
|
|
@@ -261,16 +247,6 @@ fn prepare_profile_launch(
|
|
|
261
247
|
env_overlay.remove(*key);
|
|
262
248
|
}
|
|
263
249
|
}
|
|
264
|
-
if agent.provider == Provider::CursorAgent
|
|
265
|
-
&& agent.auth_mode == AuthMode::Subscription
|
|
266
|
-
&& profile_proxy_mode(&loaded.values) == "direct"
|
|
267
|
-
{
|
|
268
|
-
for key in CURSOR_DIRECT_PROXY_ENV_KEYS {
|
|
269
|
-
env_unset.insert((*key).to_string());
|
|
270
|
-
env_overlay.remove(*key);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
|
|
274
250
|
let command_overrides = provider_command_overrides(&agent, &loaded.values);
|
|
275
251
|
write_runtime_env_file(workspace, &agent.id, &env_overlay, &env_unset)?;
|
|
276
252
|
|
|
@@ -504,9 +480,8 @@ fn provider_env_exports(
|
|
|
504
480
|
}
|
|
505
481
|
}
|
|
506
482
|
}
|
|
507
|
-
//
|
|
508
|
-
|
|
509
|
-
Provider::Grok | Provider::CursorAgent | Provider::Pi => {}
|
|
483
|
+
// Grok and Pi retain their native subscription credentials.
|
|
484
|
+
Provider::Grok | Provider::Pi => {}
|
|
510
485
|
Provider::Fake => {}
|
|
511
486
|
}
|
|
512
487
|
exports
|
|
@@ -611,11 +586,8 @@ pub(crate) fn provider_env_unsets(provider: Provider, auth_mode: AuthMode) -> BT
|
|
|
611
586
|
// C-7-1 cr verdict: 一期 subscription-only(已登录态),exports/unsets 空;
|
|
612
587
|
// BYOK(COPILOT_PROVIDER_*)二期立项时单独 cr verdict 再开。
|
|
613
588
|
Provider::Copilot => {}
|
|
614
|
-
//
|
|
615
|
-
// `--print` 路径会因 https:// 方案撞 GLOBAL_AGENT,但主路径是 TUI。
|
|
616
|
-
// 禁止在这里 unset 代理。
|
|
589
|
+
// Grok has no provider-specific environment to unset.
|
|
617
590
|
Provider::Grok => {}
|
|
618
|
-
Provider::CursorAgent => {}
|
|
619
591
|
Provider::Pi => {}
|
|
620
592
|
Provider::Fake => {}
|
|
621
593
|
}
|
|
@@ -1041,8 +1013,8 @@ fn required_profile_keys(provider: Provider, auth_mode: AuthMode) -> &'static [&
|
|
|
1041
1013
|
// C-7-1 cr verdict: copilot 一期 subscription-only,无 BYOK required key 集合;
|
|
1042
1014
|
// 二期 BYOK 立项时填(向后兼容字段保留)。
|
|
1043
1015
|
Provider::Copilot => &[],
|
|
1044
|
-
// 0.5.67:
|
|
1045
|
-
Provider::Grok | Provider::
|
|
1016
|
+
// 0.5.67: Grok/Pi 一期无 BYOK required key 集合 (同 copilot 精神)。
|
|
1017
|
+
Provider::Grok | Provider::Pi => &[],
|
|
1046
1018
|
Provider::Fake => &[],
|
|
1047
1019
|
}
|
|
1048
1020
|
}
|
|
@@ -232,10 +232,9 @@ impl SmokeTarget {
|
|
|
232
232
|
}
|
|
233
233
|
// C-7-1 cr verdict: copilot 一期 subscription-only,无 BYOK HTTP smoke
|
|
234
234
|
// 入口;同 GeminiCli/Fake 走 unsupported_provider_smoke_skipped。
|
|
235
|
-
// 0.5.67: grok
|
|
235
|
+
// 0.5.67: grok 同走 skipped (一期 subscription 已登录态)。
|
|
236
236
|
Provider::Copilot
|
|
237
237
|
| Provider::Grok
|
|
238
|
-
| Provider::CursorAgent
|
|
239
238
|
| Provider::Pi
|
|
240
239
|
| Provider::GeminiCli
|
|
241
240
|
| Provider::Fake => {
|
|
@@ -464,44 +464,6 @@ pub(super) fn spawn_agent_window(
|
|
|
464
464
|
&mut env,
|
|
465
465
|
)?;
|
|
466
466
|
}
|
|
467
|
-
// Keep provider/native cwd distinct from the real Team workspace. Cursor
|
|
468
|
-
// changes cwd to --workspace before writing its cwd-keyed session archive.
|
|
469
|
-
let mut native_spawn_cwd = spawn_cwd.to_path_buf();
|
|
470
|
-
// 0.5.67 Cursor 方案 1 变体: role 经 workspace rules 文件注入 (不 argv)。
|
|
471
|
-
if provider == crate::provider::Provider::CursorAgent {
|
|
472
|
-
crate::lifecycle::launch::refuse_second_cursor_occupant(
|
|
473
|
-
workspace,
|
|
474
|
-
agent_id.as_str(),
|
|
475
|
-
None,
|
|
476
|
-
)?;
|
|
477
|
-
crate::lifecycle::launch::apply_cursor_agent_rules_overlay(
|
|
478
|
-
workspace,
|
|
479
|
-
agent_id.as_str(),
|
|
480
|
-
&system_prompt,
|
|
481
|
-
)?;
|
|
482
|
-
let project = crate::lifecycle::launch::prepare_cursor_seat_mcp(
|
|
483
|
-
workspace,
|
|
484
|
-
agent_id.as_str(),
|
|
485
|
-
&mcp_config,
|
|
486
|
-
)?;
|
|
487
|
-
if let Some(primary) = project.as_ref() {
|
|
488
|
-
native_spawn_cwd = primary.clone();
|
|
489
|
-
}
|
|
490
|
-
crate::lifecycle::launch::enable_cursor_workspace_mcp_with_profile(
|
|
491
|
-
workspace,
|
|
492
|
-
project.as_deref(),
|
|
493
|
-
Some(&profile_launch),
|
|
494
|
-
)?;
|
|
495
|
-
crate::lifecycle::launch::apply_cursor_spawn_workspace_pointers(
|
|
496
|
-
&mut plan.argv,
|
|
497
|
-
workspace,
|
|
498
|
-
agent_id.as_str(),
|
|
499
|
-
)?;
|
|
500
|
-
crate::lifecycle::launch::apply_cursor_subscription_proxy_env_with_profile(
|
|
501
|
-
&mut env,
|
|
502
|
-
&profile_launch,
|
|
503
|
-
);
|
|
504
|
-
}
|
|
505
467
|
if provider == crate::provider::Provider::Grok {
|
|
506
468
|
crate::lifecycle::launch::ensure_grok_login_and_folder_trust(workspace)?;
|
|
507
469
|
crate::lifecycle::launch::apply_grok_mcp_overlay(workspace, &mcp_config)?;
|
|
@@ -702,7 +664,7 @@ pub(super) fn spawn_agent_window(
|
|
|
702
664
|
plan,
|
|
703
665
|
profile_launch,
|
|
704
666
|
layout_placement: layout_placement.cloned(),
|
|
705
|
-
spawn_cwd:
|
|
667
|
+
spawn_cwd: spawn_cwd.to_path_buf(),
|
|
706
668
|
mcp_config_path,
|
|
707
669
|
owner_team_id: team_id,
|
|
708
670
|
})
|
|
@@ -1540,30 +1502,6 @@ pub(super) fn resume_backing_probe_for_agent(
|
|
|
1540
1502
|
None => false,
|
|
1541
1503
|
}
|
|
1542
1504
|
}
|
|
1543
|
-
Provider::CursorAgent => {
|
|
1544
|
-
let spawn_cwd = agent
|
|
1545
|
-
.get("spawn_cwd")
|
|
1546
|
-
.and_then(serde_json::Value::as_str)
|
|
1547
|
-
.map(PathBuf::from)
|
|
1548
|
-
.unwrap_or_else(|| workspace.to_path_buf());
|
|
1549
|
-
let rollout_ok = rollout_path.is_some_and(|path| {
|
|
1550
|
-
crate::provider::session_scan::cursor::cursor_session_archive_present(path.as_path())
|
|
1551
|
-
});
|
|
1552
|
-
let discovered = crate::provider::session_scan::cursor::cursor_session_dir_for_cwd(
|
|
1553
|
-
session_id.as_str(),
|
|
1554
|
-
&spawn_cwd,
|
|
1555
|
-
);
|
|
1556
|
-
if let Some(dir) = discovered.as_ref() {
|
|
1557
|
-
checked_paths.push(dir.clone());
|
|
1558
|
-
}
|
|
1559
|
-
if let Some(home) = std::env::var_os("HOME").map(PathBuf::from) {
|
|
1560
|
-
checked_paths.push(home.join(".cursor").join("chats"));
|
|
1561
|
-
}
|
|
1562
|
-
rollout_ok
|
|
1563
|
-
|| discovered.as_ref().is_some_and(|dir| {
|
|
1564
|
-
crate::provider::session_scan::cursor::cursor_session_archive_present(dir)
|
|
1565
|
-
})
|
|
1566
|
-
}
|
|
1567
1505
|
Provider::Pi => {
|
|
1568
1506
|
let spawn_cwd = agent
|
|
1569
1507
|
.get("spawn_cwd")
|
|
@@ -115,7 +115,19 @@ fn add_at_selected(
|
|
|
115
115
|
Some(path) => read_text(path)?,
|
|
116
116
|
None => String::new(),
|
|
117
117
|
};
|
|
118
|
-
|
|
118
|
+
#[allow(unused_mut)]
|
|
119
|
+
let mut reconciled = reconcile_creation(&text, patch)?;
|
|
120
|
+
// A generated legacy role falls back to its id as instructions at compile
|
|
121
|
+
// time; a contract role requires a body, so give it a neutral default.
|
|
122
|
+
#[cfg(unix)]
|
|
123
|
+
if source.is_none()
|
|
124
|
+
&& reconciled.prompt.is_none()
|
|
125
|
+
&& crate::contract_runtime::framework::declares_contract(None, reconciled.provider.as_deref())
|
|
126
|
+
{
|
|
127
|
+
reconciled.prompt = Some(format!(
|
|
128
|
+
"You are {agent_id}. Complete the tasks assigned by the leader.\n"
|
|
129
|
+
));
|
|
130
|
+
}
|
|
119
131
|
let next = patched_role(&text, agent_id, &reconciled, source.is_none())?;
|
|
120
132
|
let snapshot = RoleSnapshot::capture(selected, &role_path)?;
|
|
121
133
|
let result = (|| {
|
|
@@ -330,11 +342,12 @@ fn reconcile_creation(
|
|
|
330
342
|
.get("provider")
|
|
331
343
|
.and_then(Value::as_str)
|
|
332
344
|
.filter(|value| !value.trim().is_empty());
|
|
345
|
+
let opted_in = matches!(meta.get("contract_runtime"), Some(Value::Bool(true)));
|
|
333
346
|
if let Some(file_provider) = file_provider {
|
|
334
|
-
let file_provider =
|
|
347
|
+
let file_provider = declared_provider(file_provider, opted_in)
|
|
335
348
|
.ok_or_else(|| LifecycleError::Compile("unknown role provider".into()))?;
|
|
336
349
|
if let Some(provider) = &next.provider {
|
|
337
|
-
if
|
|
350
|
+
if declared_provider(provider, opted_in) != Some(file_provider) {
|
|
338
351
|
return Err(conflict("provider"));
|
|
339
352
|
}
|
|
340
353
|
next.provider = None;
|
|
@@ -400,6 +413,18 @@ fn reconcile_creation(
|
|
|
400
413
|
Ok(next)
|
|
401
414
|
}
|
|
402
415
|
|
|
416
|
+
/// One identity per declared provider: its contract leaf id, else its legacy
|
|
417
|
+
/// wire form, so `agent` in a role file and `--provider cursor` agree.
|
|
418
|
+
fn declared_provider(value: &str, contract_runtime: bool) -> Option<&'static str> {
|
|
419
|
+
#[cfg(unix)]
|
|
420
|
+
if let Some(descriptor) = crate::contract_runtime::registry::declared(value, contract_runtime) {
|
|
421
|
+
return Some(descriptor.identity.id);
|
|
422
|
+
}
|
|
423
|
+
#[cfg(not(unix))]
|
|
424
|
+
let _ = contract_runtime;
|
|
425
|
+
crate::provider::wire::parse_provider(value).map(crate::provider::wire::provider_wire)
|
|
426
|
+
}
|
|
427
|
+
|
|
403
428
|
fn role_path(selected: &SelectedTeam, agent_id: &AgentId) -> PathBuf {
|
|
404
429
|
selected
|
|
405
430
|
.team_dir
|
|
@@ -976,6 +1001,20 @@ mod tests {
|
|
|
976
1001
|
}
|
|
977
1002
|
}
|
|
978
1003
|
|
|
1004
|
+
#[cfg(unix)]
|
|
1005
|
+
#[test]
|
|
1006
|
+
fn cursor_names_in_a_role_file_and_cli_are_one_provider() {
|
|
1007
|
+
for file in ["cursor", "cursor-agent", "agent", "cursor_agent"] {
|
|
1008
|
+
let text = format!("---\nprovider: {file}\ndangerously_skip_permissions: true\n---\nbody");
|
|
1009
|
+
for cli in ["cursor", "agent"] {
|
|
1010
|
+
let patch = RoleConfigPatch { provider: Some(cli.into()), ..Default::default() };
|
|
1011
|
+
assert_eq!(reconcile_creation(&text, &patch).unwrap(), RoleConfigPatch::default(), "{file}/{cli}");
|
|
1012
|
+
}
|
|
1013
|
+
let pi = RoleConfigPatch { provider: Some("pi".into()), ..Default::default() };
|
|
1014
|
+
assert!(reconcile_creation(&text, &pi).is_err(), "{file}");
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
|
|
979
1018
|
#[test]
|
|
980
1019
|
fn legacy_cr_only_header_does_not_change_engine_when_patched() {
|
|
981
1020
|
let text = "---\rprovider: codex\ndangerously_skip_permissions: false\r---\r\rbody\r";
|
|
@@ -33,7 +33,6 @@ const CANONICAL: &[(&str, Provider)] = &[
|
|
|
33
33
|
("copilot", Provider::Copilot),
|
|
34
34
|
("gemini_cli", Provider::GeminiCli),
|
|
35
35
|
("grok", Provider::Grok),
|
|
36
|
-
("cursor_agent", Provider::CursorAgent),
|
|
37
36
|
("pi", Provider::Pi),
|
|
38
37
|
];
|
|
39
38
|
struct Fixture {
|
|
@@ -587,7 +586,6 @@ provider_tests! {
|
|
|
587
586
|
a06_copilot => "copilot", Copilot;
|
|
588
587
|
a06_gemini_cli => "gemini_cli", GeminiCli;
|
|
589
588
|
a06_grok => "grok", Grok;
|
|
590
|
-
a06_cursor_agent => "cursor_agent", CursorAgent;
|
|
591
589
|
a06_pi => "pi", Pi;
|
|
592
590
|
}
|
|
593
591
|
|
|
@@ -1236,7 +1234,7 @@ fn a07_attach_existing_never_opens_enabled_invalid_route_config() {
|
|
|
1236
1234
|
|
|
1237
1235
|
#[test]
|
|
1238
1236
|
#[serial(env)]
|
|
1239
|
-
fn
|
|
1237
|
+
fn a13_all_provider_version_and_auth_auxiliary_argv_are_native() {
|
|
1240
1238
|
let f = Fixture::new("argv-aux");
|
|
1241
1239
|
let mappings = CANONICAL
|
|
1242
1240
|
.iter()
|
|
@@ -1249,10 +1247,6 @@ fn a13_all_provider_version_auth_and_cursor_mcp_auxiliary_argv_are_native() {
|
|
|
1249
1247
|
}
|
|
1250
1248
|
let _ = crate::provider::get_adapter(Provider::ClaudeCode)
|
|
1251
1249
|
.auth_hint(crate::model::enums::AuthMode::Subscription);
|
|
1252
|
-
assert_eq!(
|
|
1253
|
-
crate::lifecycle::launch::cursor_mcp_enable_argv(),
|
|
1254
|
-
["agent", "mcp", "enable", "team_orchestrator"]
|
|
1255
|
-
);
|
|
1256
1250
|
let _ = f.cold("copilot");
|
|
1257
1251
|
let probes = fs::read_to_string(&f.probes).unwrap();
|
|
1258
1252
|
assert!(!probes.contains("route-must-not-enter-aux"));
|
|
@@ -1401,6 +1395,43 @@ fn a15_provider_drift_and_unknown_force_remain_refused() {
|
|
|
1401
1395
|
);
|
|
1402
1396
|
}
|
|
1403
1397
|
|
|
1398
|
+
#[test]
|
|
1399
|
+
#[serial(env)]
|
|
1400
|
+
fn issue381_every_cursor_name_adds_through_the_contract_leaf_never_legacy_agent() {
|
|
1401
|
+
let f = Fixture::new("cursor-contract-add");
|
|
1402
|
+
f.start_team("codex", &["worker"]);
|
|
1403
|
+
let before = crate::state::projection::select_runtime_state(&f.ws, Some("argvteam")).unwrap();
|
|
1404
|
+
let probes_before = fs::read_to_string(&f.probes).unwrap_or_default();
|
|
1405
|
+
for (index, name) in ["cursor", "cursor-agent", "agent", "cursor_agent"].into_iter().enumerate() {
|
|
1406
|
+
let id = format!("cursor-{index}");
|
|
1407
|
+
let added = crate::lifecycle::role_config::add_agent_from_role(
|
|
1408
|
+
&f.ws,
|
|
1409
|
+
&AgentId::new(&id),
|
|
1410
|
+
None,
|
|
1411
|
+
&crate::lifecycle::role_config::RoleConfigPatch {
|
|
1412
|
+
provider: Some(name.into()),
|
|
1413
|
+
model: Some("gpt-5.6-luna-xhigh".into()),
|
|
1414
|
+
bypass: Some(true),
|
|
1415
|
+
// An omitted --prompt still yields a valid contract role body.
|
|
1416
|
+
prompt: (index > 0).then(|| "Reply to every task.".into()),
|
|
1417
|
+
..Default::default()
|
|
1418
|
+
},
|
|
1419
|
+
false,
|
|
1420
|
+
Some("argvteam"),
|
|
1421
|
+
);
|
|
1422
|
+
// The fixture PATH has a fake legacy `agent` but no `cursor-agent`:
|
|
1423
|
+
// the contract leaf's discovery refuses before any native effect.
|
|
1424
|
+
let error = added.expect_err("no cursor-agent on PATH").to_string();
|
|
1425
|
+
assert!(error.contains("cursor-agent"), "{name}: {error}");
|
|
1426
|
+
assert!(!f.team.join(format!("agents/{id}.md")).exists(), "{name}: role rolled back");
|
|
1427
|
+
let after = crate::state::projection::select_runtime_state(&f.ws, Some("argvteam")).unwrap();
|
|
1428
|
+
assert!(after["agents"].get(&id).is_none(), "{name}: seed row rolled back");
|
|
1429
|
+
assert_eq!(after["agents"]["worker"], before["agents"]["worker"], "{name}");
|
|
1430
|
+
}
|
|
1431
|
+
let probes = fs::read_to_string(&f.probes).unwrap_or_default();
|
|
1432
|
+
assert_eq!(probes, probes_before, "no legacy `agent` probe or catalog read");
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1404
1435
|
#[test]
|
|
1405
1436
|
#[serial(env)]
|
|
1406
1437
|
fn a15_route_does_not_relax_running_start_reset_discard_or_unsupported_fork() {
|
|
@@ -92,8 +92,9 @@ const ISOLATION_GUARD_TEST: &str = concat!(
|
|
|
92
92
|
/// These fixtures need process-global HOME and TEAM_AGENT_* overrides, while the
|
|
93
93
|
/// lib-test harness runs sibling tests in parallel. Execute each body as the sole
|
|
94
94
|
/// selected test in a child process so HermeticTestEnv never mutates the parent
|
|
95
|
-
/// test process.
|
|
96
|
-
///
|
|
95
|
+
/// test process. Fixture-caller tests still hold `serial(env)` while their child
|
|
96
|
+
/// runs: the child inherits the parent's PATH, and a sibling env test may have a
|
|
97
|
+
/// fake `tmux` on it that never creates the fixture caller socket.
|
|
97
98
|
fn run_process_isolated(marker: &str, test_name: &str, body: impl FnOnce()) {
|
|
98
99
|
if std::env::var_os(marker).is_some() {
|
|
99
100
|
body();
|
|
@@ -492,6 +493,7 @@ exec sleep 3600
|
|
|
492
493
|
/// `verifier-r8-caps-recharter-signoff.md`. The SQLite FK-table integrity and
|
|
493
494
|
/// exact-nonce recall remain the GREEN half / subscription-E2E (§1.4).
|
|
494
495
|
#[test]
|
|
496
|
+
#[serial_test::serial(env)]
|
|
495
497
|
fn r8_copilot_fork_is_no_longer_capability_refused() {
|
|
496
498
|
run_process_isolated(R8_CHILD, R8_TEST, || {
|
|
497
499
|
// R8 uses the LIBRARY entry `fork_agent_with_transport` (the same entry the old
|
|
@@ -549,6 +551,7 @@ fn r8_copilot_fork_is_no_longer_capability_refused() {
|
|
|
549
551
|
/// (本 fixture = false → `source=disabled`),不再依赖 leader argv 继承。任何
|
|
550
552
|
/// fork 都不得出现 `source=leader_process`(旧模型已删)或 capability 高于源。
|
|
551
553
|
#[test]
|
|
554
|
+
#[serial_test::serial(env)]
|
|
552
555
|
fn r7_fork_effective_permissions_are_clamped_to_leader_guardrail() {
|
|
553
556
|
run_process_isolated(R7_CHILD, R7_TEST, || {
|
|
554
557
|
// Claude source + success-path backing shim so the fork COMPLETES and a NEW
|
|
@@ -571,6 +574,7 @@ fn r7_fork_effective_permissions_are_clamped_to_leader_guardrail() {
|
|
|
571
574
|
/// false) must also resolve to `source=disabled` under any ancestry seam. 0.5.66
|
|
572
575
|
/// 起 policy 与 leader argv 无关:source 恒 `disabled`,fork 恒不升级(MUST-16)。
|
|
573
576
|
#[test]
|
|
577
|
+
#[serial_test::serial(env)]
|
|
574
578
|
fn r7b_fork_policy_under_restricted_leader_ancestry_is_disabled() {
|
|
575
579
|
run_process_isolated(R7B_CHILD, R7B_TEST, || {
|
|
576
580
|
let case = Case::start_with_ancestry("cf-r7b", RESTRICTED_LEADER_ARGV);
|
|
@@ -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
|
}
|
|
@@ -95,103 +95,6 @@ fn worker_spawn_inherits_parent_process_env_for_proxy_and_ca() {
|
|
|
95
95
|
);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
#[test]
|
|
99
|
-
#[serial(env)]
|
|
100
|
-
fn cursor_subscription_proxy_profile_reaches_fresh_and_restart_transport_final_env() {
|
|
101
|
-
let _guard = EnvGuard::set([
|
|
102
|
-
("HTTPS_PROXY", "https://upper-https:1"),
|
|
103
|
-
("HTTP_PROXY", "http://upper-http:1"),
|
|
104
|
-
("ALL_PROXY", "socks5://upper-all:1"),
|
|
105
|
-
("https_proxy", "https://lower-https:1"),
|
|
106
|
-
("http_proxy", "http://lower-http:1"),
|
|
107
|
-
("all_proxy", "socks5://lower-all:1"),
|
|
108
|
-
("NO_PROXY", "localhost,127.0.0.1"),
|
|
109
|
-
("no_proxy", "localhost,127.0.0.1"),
|
|
110
|
-
("GLOBAL_AGENT_HTTPS_PROXY", "https://global-https:1"),
|
|
111
|
-
("GLOBAL_AGENT_HTTP_PROXY", "http://global-http:1"),
|
|
112
|
-
]);
|
|
113
|
-
|
|
114
|
-
let launch_direct = compiled_cursor_profile_team("cursor-direct-launch", "direct");
|
|
115
|
-
let launch_transport = RecordingTransport::new().with_session_present(false);
|
|
116
|
-
launch_with_transport(
|
|
117
|
-
&launch_direct.join("team.spec.yaml"),
|
|
118
|
-
false,
|
|
119
|
-
true,
|
|
120
|
-
true,
|
|
121
|
-
&launch_transport,
|
|
122
|
-
)
|
|
123
|
-
.expect("direct Cursor launch fixture should spawn");
|
|
124
|
-
assert_cursor_proxy_spawn(&launch_transport.single_spawn(), true);
|
|
125
|
-
|
|
126
|
-
let restart_direct = compiled_cursor_profile_team("cursor-direct-restart", "direct");
|
|
127
|
-
seed_restart_state_with_profile(&restart_direct, "worker_a", "cursor_proxy");
|
|
128
|
-
let restart_transport = RecordingTransport::new().with_session_present(false);
|
|
129
|
-
restart_with_transport(&restart_direct, true, None, &restart_transport)
|
|
130
|
-
.expect("direct Cursor restart fixture should spawn");
|
|
131
|
-
assert_cursor_proxy_spawn(&restart_transport.single_spawn(), true);
|
|
132
|
-
|
|
133
|
-
let launch_inherit = compiled_cursor_profile_team("cursor-inherit-launch", "inherit");
|
|
134
|
-
let inherit_transport = RecordingTransport::new().with_session_present(false);
|
|
135
|
-
launch_with_transport(
|
|
136
|
-
&launch_inherit.join("team.spec.yaml"),
|
|
137
|
-
false,
|
|
138
|
-
true,
|
|
139
|
-
true,
|
|
140
|
-
&inherit_transport,
|
|
141
|
-
)
|
|
142
|
-
.expect("inherit Cursor launch fixture should spawn");
|
|
143
|
-
assert_cursor_proxy_spawn(&inherit_transport.single_spawn(), false);
|
|
144
|
-
|
|
145
|
-
let restart_inherit = compiled_cursor_profile_team("cursor-inherit-restart", "inherit");
|
|
146
|
-
seed_restart_state_with_profile(&restart_inherit, "worker_a", "cursor_proxy");
|
|
147
|
-
let restart_inherit_transport = RecordingTransport::new().with_session_present(false);
|
|
148
|
-
restart_with_transport(
|
|
149
|
-
&restart_inherit,
|
|
150
|
-
true,
|
|
151
|
-
None,
|
|
152
|
-
&restart_inherit_transport,
|
|
153
|
-
)
|
|
154
|
-
.expect("inherit Cursor restart fixture should spawn");
|
|
155
|
-
assert_cursor_proxy_spawn(&restart_inherit_transport.single_spawn(), false);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
fn assert_cursor_proxy_spawn(spawn: &RecordedSpawn, direct: bool) {
|
|
159
|
-
let keys = [
|
|
160
|
-
"HTTPS_PROXY",
|
|
161
|
-
"HTTP_PROXY",
|
|
162
|
-
"ALL_PROXY",
|
|
163
|
-
"https_proxy",
|
|
164
|
-
"http_proxy",
|
|
165
|
-
"all_proxy",
|
|
166
|
-
"GLOBAL_AGENT_HTTPS_PROXY",
|
|
167
|
-
"GLOBAL_AGENT_HTTP_PROXY",
|
|
168
|
-
];
|
|
169
|
-
for key in keys {
|
|
170
|
-
if direct {
|
|
171
|
-
assert!(!spawn.env.contains_key(key), "direct env must omit {key}");
|
|
172
|
-
assert!(
|
|
173
|
-
spawn.env_unset.iter().any(|candidate| candidate == key),
|
|
174
|
-
"direct env_unset must contain {key}; got {:?}",
|
|
175
|
-
spawn.env_unset
|
|
176
|
-
);
|
|
177
|
-
} else {
|
|
178
|
-
assert!(spawn.env.contains_key(key), "inherit env must preserve {key}");
|
|
179
|
-
assert!(
|
|
180
|
-
spawn.env_unset.iter().all(|candidate| candidate != key),
|
|
181
|
-
"inherit env_unset must not contain {key}; got {:?}",
|
|
182
|
-
spawn.env_unset
|
|
183
|
-
);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
for key in ["NO_PROXY", "no_proxy"] {
|
|
187
|
-
assert!(spawn.env.contains_key(key), "NO_PROXY bypass key must remain: {key}");
|
|
188
|
-
assert!(
|
|
189
|
-
spawn.env_unset.iter().all(|candidate| candidate != key),
|
|
190
|
-
"NO_PROXY bypass key must not be unset: {key}"
|
|
191
|
-
);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
98
|
#[test]
|
|
196
99
|
fn tmux_control_filter_uses_env_keys_not_substring_in_inherited_values() {
|
|
197
100
|
let mut env = BTreeMap::from([
|
|
@@ -507,39 +410,6 @@ fn compiled_team_dir(label: &str, agents: &[(&str, &str)]) -> PathBuf {
|
|
|
507
410
|
compiled_team_dir_for_provider(label, agents, "codex")
|
|
508
411
|
}
|
|
509
412
|
|
|
510
|
-
fn compiled_cursor_profile_team(label: &str, proxy_mode: &str) -> PathBuf {
|
|
511
|
-
let team = tmp_dir(label).join("teamdir");
|
|
512
|
-
std::fs::create_dir_all(team.join("agents")).unwrap();
|
|
513
|
-
std::fs::write(
|
|
514
|
-
team.join("TEAM.md"),
|
|
515
|
-
"---\nname: envteam\nobjective: Cursor proxy environment contract.\nprovider: cursor_agent\n---\n\nTeam.\n",
|
|
516
|
-
)
|
|
517
|
-
.unwrap();
|
|
518
|
-
std::fs::write(
|
|
519
|
-
team.join("agents").join("worker_a.md"),
|
|
520
|
-
"---\nname: worker_a\nrole: Cursor Worker\nprovider: cursor_agent\nmodel: sonnet-4-thinking\nauth_mode: subscription\nprofile: cursor_proxy\ndangerously_skip_permissions: false\ntools:\n - mcp_team\n---\n\nCursor worker.\n",
|
|
521
|
-
)
|
|
522
|
-
.unwrap();
|
|
523
|
-
for directory in [
|
|
524
|
-
team.join("profiles"),
|
|
525
|
-
team.join(".team/current/profiles"),
|
|
526
|
-
] {
|
|
527
|
-
std::fs::create_dir_all(&directory).unwrap();
|
|
528
|
-
std::fs::write(
|
|
529
|
-
directory.join("cursor_proxy.env"),
|
|
530
|
-
format!("AUTH_MODE=subscription\nPROFILE_NAME=cursor_proxy\nPROXY_MODE={proxy_mode}\n"),
|
|
531
|
-
)
|
|
532
|
-
.unwrap();
|
|
533
|
-
}
|
|
534
|
-
let spec = team_agent::compiler::compile_team(&team).unwrap();
|
|
535
|
-
std::fs::write(
|
|
536
|
-
team.join("team.spec.yaml"),
|
|
537
|
-
team_agent::model::yaml::dumps(&spec),
|
|
538
|
-
)
|
|
539
|
-
.unwrap();
|
|
540
|
-
team
|
|
541
|
-
}
|
|
542
|
-
|
|
543
413
|
fn compiled_team_dir_for_provider(label: &str, agents: &[(&str, &str)], provider: &str) -> PathBuf {
|
|
544
414
|
let team = tmp_dir(label).join("teamdir");
|
|
545
415
|
std::fs::create_dir_all(team.join("agents")).unwrap();
|
|
@@ -580,13 +450,6 @@ fn seed_restart_state(team: &Path, agent_id: &str) {
|
|
|
580
450
|
seed_restart_state_as(team, agent_id, "codex");
|
|
581
451
|
}
|
|
582
452
|
|
|
583
|
-
fn seed_restart_state_with_profile(team: &Path, agent_id: &str, profile: &str) {
|
|
584
|
-
seed_restart_state_as(team, agent_id, "cursor_agent");
|
|
585
|
-
let mut state = team_agent::state::persist::load_runtime_state(team).unwrap();
|
|
586
|
-
state["agents"][agent_id]["profile"] = json!(profile);
|
|
587
|
-
team_agent::state::persist::save_runtime_state(team, &state).unwrap();
|
|
588
|
-
}
|
|
589
|
-
|
|
590
453
|
fn seed_restart_state_as(team: &Path, agent_id: &str, provider: &str) {
|
|
591
454
|
team_agent::state::persist::save_runtime_state(
|
|
592
455
|
team,
|
|
@@ -59,9 +59,6 @@ mod codex_weak_window_attribution_red;
|
|
|
59
59
|
mod communication_mode_runtime_contract_red;
|
|
60
60
|
mod copilot_provider_red;
|
|
61
61
|
mod core;
|
|
62
|
-
mod cursor_mcp_overlay;
|
|
63
|
-
mod cursor_require_explicit_model_red;
|
|
64
|
-
mod cursor_restart_resume_red;
|
|
65
62
|
mod f032_startup_prompt_best_effort_red;
|
|
66
63
|
mod grok_effort_argv_red;
|
|
67
64
|
mod grok_mcp_overlay_red;
|
|
@@ -226,10 +226,8 @@ fn mcp_tool_name(provider: Provider, server: &str, tool: &str) -> String {
|
|
|
226
226
|
Provider::Grok => format!("{server}__{tool}"),
|
|
227
227
|
// Pi's owned extension binds these logical operations to the observed MCP call surface.
|
|
228
228
|
Provider::Pi => tool.to_string(),
|
|
229
|
-
//
|
|
230
|
-
|
|
231
|
-
Provider::CursorAgent
|
|
232
|
-
| Provider::Codex
|
|
229
|
+
// Codex / Copilot / GeminiCli / Fake: 未验证,沿用现状点号。
|
|
230
|
+
Provider::Codex
|
|
233
231
|
| Provider::Copilot
|
|
234
232
|
| Provider::GeminiCli
|
|
235
233
|
| Provider::Fake => format!("{server}.{tool}"),
|