@team-agent/installer 0.5.124 → 0.5.126
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.lock +1 -8
- package/Cargo.toml +1 -1
- package/README.md +2 -2
- package/README.zh.md +2 -2
- package/crates/team-agent/Cargo.toml +0 -1
- package/crates/team-agent/src/cli/diagnose.rs +39 -69
- package/crates/team-agent/src/cli/emit.rs +45 -15
- package/crates/team-agent/src/cli/intent/runtime.rs +5 -53
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +10 -130
- package/crates/team-agent/src/cli/leader.rs +2 -3
- package/crates/team-agent/src/cli/leader_prompt.rs +1 -1
- package/crates/team-agent/src/cli/mod.rs +28 -33
- package/crates/team-agent/src/cli/models.rs +44 -880
- package/crates/team-agent/src/cli/route.rs +1 -1
- package/crates/team-agent/src/cli/send/persist.rs +36 -0
- package/crates/team-agent/src/cli/send/presentation.rs +7 -1
- package/crates/team-agent/src/cli/send.rs +3 -1
- package/crates/team-agent/src/cli/spec.rs +1 -2
- package/crates/team-agent/src/cli/status_port/brief.rs +66 -0
- package/crates/team-agent/src/cli/tests/base.rs +4 -11
- package/crates/team-agent/src/cli/tests/mod.rs +1 -1
- package/crates/team-agent/src/cli/tests/run_delegation.rs +5 -4
- package/crates/team-agent/src/cli/tests/status_send.rs +17 -0
- package/crates/team-agent/src/compiler/tests.rs +39 -8
- package/crates/team-agent/src/compiler.rs +28 -204
- package/crates/team-agent/src/contract_runtime/backend.rs +79 -40
- package/crates/team-agent/src/contract_runtime/config.rs +37 -24
- package/crates/team-agent/src/contract_runtime/discovery.rs +33 -0
- package/crates/team-agent/src/contract_runtime/fork.rs +368 -0
- package/crates/team-agent/src/contract_runtime/framework.rs +87 -34
- package/crates/team-agent/src/contract_runtime/mod.rs +1 -0
- package/crates/team-agent/src/contract_runtime/registry.rs +299 -21
- package/crates/team-agent/src/coordinator/runtime_detectors.rs +0 -1
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +29 -8
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +0 -42
- package/crates/team-agent/src/coordinator/tick.rs +89 -1
- package/crates/team-agent/src/db/message_store.rs +78 -3
- package/crates/team-agent/src/layout/worker_window_helpers.rs +0 -1
- package/crates/team-agent/src/leader/prompt.rs +1 -2
- package/crates/team-agent/src/leader/provider_attribution.rs +0 -52
- package/crates/team-agent/src/leader/start.rs +1 -2
- package/crates/team-agent/src/leader/tests/prompt_contract.rs +2 -3
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +91 -0
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +15 -195
- package/crates/team-agent/src/lifecycle/launch/agent_state.rs +0 -9
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +11 -27
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +18 -29
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +6 -87
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +3 -11
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +74 -244
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +0 -24
- package/crates/team-agent/src/lifecycle/launch/role_source.rs +5 -0
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +21 -61
- package/crates/team-agent/src/lifecycle/launch/spec_state.rs +0 -1
- package/crates/team-agent/src/lifecycle/launch/worker_env.rs +0 -108
- package/crates/team-agent/src/lifecycle/launch.rs +2 -43
- package/crates/team-agent/src/lifecycle/profile_launch.rs +21 -348
- package/crates/team-agent/src/lifecycle/profile_smoke.rs +1 -2
- package/crates/team-agent/src/lifecycle/restart/common.rs +43 -378
- package/crates/team-agent/src/lifecycle/restart/selection.rs +5 -5
- package/crates/team-agent/src/lifecycle/restart.rs +0 -2
- package/crates/team-agent/src/lifecycle/role_config.rs +42 -3
- package/crates/team-agent/src/lifecycle/tests/behavioral_diff_264_red.rs +11 -6
- package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +8 -320
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +60 -145
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +8 -334
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +30 -11
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests/core.rs +17 -16
- package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +12 -12
- package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +3 -51
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +26 -28
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +6 -18
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +52 -70
- package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +4 -157
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +10 -302
- package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +1 -68
- package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +1 -19
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +2 -100
- package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +11 -10
- package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +0 -1
- package/crates/team-agent/src/lifecycle/tests/restart_session_capture_red.rs +2 -106
- package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +2 -2
- package/crates/team-agent/src/lifecycle/tests/swallow_batch4_semantics_red.rs +2 -254
- package/crates/team-agent/src/lifecycle/tests/upgrade_compat_0211_red.rs +4 -4
- package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +6 -5
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +7 -153
- package/crates/team-agent/src/lifecycle/tests.rs +0 -6
- package/crates/team-agent/src/lifecycle/types.rs +2 -18
- package/crates/team-agent/src/lifecycle/worker_command_context.rs +2 -4
- package/crates/team-agent/src/mcp_server/readiness.rs +148 -97
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +115 -16
- package/crates/team-agent/src/messaging/delivery.rs +185 -168
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +5 -5
- package/crates/team-agent/src/messaging/enter_rescue_tests.rs +1 -1
- package/crates/team-agent/src/messaging/helpers.rs +19 -0
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +67 -5
- package/crates/team-agent/src/messaging/tests/runtime.rs +110 -4
- package/crates/team-agent/src/messaging/tests/spine.rs +46 -36
- package/crates/team-agent/src/model/enums.rs +1 -8
- package/crates/team-agent/src/provider/adapter.rs +33 -302
- package/crates/team-agent/src/provider/adapters/mod.rs +4 -5
- package/crates/team-agent/src/provider/argv_route.rs +1 -5
- package/crates/team-agent/src/provider/bypass_flags.rs +3 -11
- package/crates/team-agent/src/provider/classify.rs +68 -3
- package/crates/team-agent/src/provider/faults.rs +1 -1
- package/crates/team-agent/src/provider/model_catalog.rs +14 -273
- package/crates/team-agent/src/provider/session/capture.rs +7 -107
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +0 -4
- package/crates/team-agent/src/provider/session/context_fork.rs +17 -109
- package/crates/team-agent/src/provider/session_scan/common.rs +11 -36
- package/crates/team-agent/src/provider/session_scan/pi.rs +1 -34
- package/crates/team-agent/src/provider/session_scan.rs +4 -14
- package/crates/team-agent/src/provider/submit_now.rs +5 -28
- package/crates/team-agent/src/provider/tests/adapter.rs +39 -275
- package/crates/team-agent/src/provider/tests/classify.rs +53 -0
- package/crates/team-agent/src/provider/tests/command_helpers.rs +3 -15
- package/crates/team-agent/src/provider/tests/idle.rs +0 -25
- package/crates/team-agent/src/provider/types.rs +1 -1
- package/crates/team-agent/src/provider/wire.rs +79 -11
- package/crates/team-agent/src/state/abnormal_watch/tests/mod.rs +1 -1
- package/crates/team-agent/src/state/persist.rs +6 -6
- package/crates/team-agent/src/state/repository/tests.rs +2 -2
- package/crates/team-agent/src/tmux_backend/native_input_tests.rs +2 -178
- package/crates/team-agent/src/tmux_backend/tests.rs +151 -0
- package/crates/team-agent/src/tmux_backend.rs +43 -8
- package/crates/team-agent/src/transport/native_input.rs +2 -231
- package/package.json +4 -4
- package/skills/team-agent/SKILL.md +7 -5
- package/skills/team-agent/command-coverage.json +15 -1
- package/skills/team-agent/docs/reference/team-agent-operator.md +5 -3
- package/skills/team-agent/references/team-agent-operator.md +5 -3
- package/crates/team-agent/src/lifecycle/launch/cursor_create_chat.rs +0 -229
- package/crates/team-agent/src/lifecycle/launch/cursor_mcp.rs +0 -522
- package/crates/team-agent/src/lifecycle/launch/cursor_mcp_iso.rs +0 -282
- package/crates/team-agent/src/lifecycle/restart/avatar.rs +0 -1805
- package/crates/team-agent/src/lifecycle/tests/claude_compatible_config_red.rs +0 -325
- package/crates/team-agent/src/lifecycle/tests/cursor_mcp_overlay.rs +0 -576
- package/crates/team-agent/src/lifecycle/tests/cursor_require_explicit_model_red.rs +0 -222
- package/crates/team-agent/src/lifecycle/tests/cursor_restart_resume_red.rs +0 -511
- package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +0 -210
- package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +0 -1409
- package/crates/team-agent/src/provider/adapters/claude.rs +0 -78
- package/crates/team-agent/src/provider/adapters/claude_fork.rs +0 -131
- package/crates/team-agent/src/provider/adapters/cursor_agent.rs +0 -44
- package/crates/team-agent/src/provider/adapters/pi.rs +0 -100
- package/crates/team-agent/src/provider/session/context_fork/claude.rs +0 -123
- package/crates/team-agent/src/provider/session_scan/claude.rs +0 -523
- package/crates/team-agent/src/provider/session_scan/cursor.rs +0 -538
- package/crates/team-agent/src/provider/testdata/cursor-list-models-native.stdout +0 -250
- package/crates/team-agent/src/test_support/models_timeout_fixture.rs +0 -144
|
@@ -275,6 +275,17 @@ pub(super) fn spawn_agent_window(
|
|
|
275
275
|
// (agent row → active_team_key) for back-compat with non-restart callers.
|
|
276
276
|
owner_team_id_override: Option<&str>,
|
|
277
277
|
) -> Result<SpawnedAgentWindow, LifecycleError> {
|
|
278
|
+
// A pre-upgrade Claude Code or Pi worker row has no legacy runtime left;
|
|
279
|
+
// refuse before any MCP file, profile or pane side effect.
|
|
280
|
+
if let Some(retired) = agent
|
|
281
|
+
.get("provider")
|
|
282
|
+
.and_then(serde_json::Value::as_str)
|
|
283
|
+
.filter(|provider| crate::provider::wire::is_retired_provider(provider))
|
|
284
|
+
{
|
|
285
|
+
return Err(LifecycleError::Provider(
|
|
286
|
+
crate::provider::wire::retired_provider_error(retired).into(),
|
|
287
|
+
));
|
|
288
|
+
}
|
|
278
289
|
let provider = agent_provider(agent);
|
|
279
290
|
let auth_mode = agent_auth_mode(agent);
|
|
280
291
|
let model = agent.get("model").and_then(|v| v.as_str());
|
|
@@ -337,16 +348,12 @@ pub(super) fn spawn_agent_window(
|
|
|
337
348
|
agent_id.as_str(),
|
|
338
349
|
team_id.as_deref().unwrap_or(""),
|
|
339
350
|
);
|
|
340
|
-
let mcp_config_path =
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
&mcp_config,
|
|
347
|
-
Some(provider),
|
|
348
|
-
)?)
|
|
349
|
-
};
|
|
351
|
+
let mcp_config_path = crate::lifecycle::launch::write_worker_mcp_config_for_provider(
|
|
352
|
+
workspace,
|
|
353
|
+
agent_id.as_str(),
|
|
354
|
+
&mcp_config,
|
|
355
|
+
Some(provider),
|
|
356
|
+
)?;
|
|
350
357
|
let profile_launch =
|
|
351
358
|
crate::lifecycle::profile_launch::prepare_provider_profile_launch_from_json(
|
|
352
359
|
workspace,
|
|
@@ -379,65 +386,18 @@ pub(super) fn spawn_agent_window(
|
|
|
379
386
|
agent_id_hint: Some(agent_id.as_str()),
|
|
380
387
|
effort: restart_effort,
|
|
381
388
|
};
|
|
382
|
-
let
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
.map(std::path::PathBuf::from)
|
|
389
|
-
})
|
|
390
|
-
.flatten();
|
|
391
|
-
let spawn_cwd = spawn_cwd_override
|
|
392
|
-
.or(pi_spawn_cwd.as_deref())
|
|
393
|
-
.unwrap_or(workspace);
|
|
394
|
-
let mut plan = if provider == crate::provider::Provider::Pi {
|
|
395
|
-
let request = crate::lifecycle::launch::pi_mcp::PiMaterializeRequest {
|
|
396
|
-
workspace,
|
|
397
|
-
team_id: team_id.as_deref().unwrap_or(""),
|
|
398
|
-
agent_id: agent_id.as_str(),
|
|
399
|
-
model: command_model,
|
|
400
|
-
effort: restart_effort,
|
|
401
|
-
system_prompt: &system_prompt,
|
|
402
|
-
team_mcp_tools: &["send_message", "report_result", "get_team_status"],
|
|
403
|
-
mcp_config: &mcp_config,
|
|
404
|
-
session_scope: crate::lifecycle::launch::pi_mcp::PiSessionScope::Isolated,
|
|
405
|
-
};
|
|
406
|
-
match resume_session_id {
|
|
407
|
-
Some(session_id) => {
|
|
408
|
-
let rollout_path = agent_rollout_path(agent).ok_or_else(|| {
|
|
409
|
-
LifecycleError::RequirementUnmet(
|
|
410
|
-
"Pi resume requires the persisted exact session path".to_string(),
|
|
411
|
-
)
|
|
412
|
-
})?;
|
|
413
|
-
crate::lifecycle::launch::pi_mcp::materialize_pi_resume_plan(
|
|
414
|
-
request,
|
|
415
|
-
session_id,
|
|
416
|
-
rollout_path.as_path(),
|
|
417
|
-
spawn_cwd,
|
|
418
|
-
)
|
|
419
|
-
}
|
|
420
|
-
None => crate::lifecycle::launch::pi_mcp::materialize_pi_plan(request),
|
|
421
|
-
}
|
|
422
|
-
.map_err(|e| LifecycleError::Provider(e.to_string()))?
|
|
423
|
-
} else {
|
|
424
|
-
match resume_session_id {
|
|
425
|
-
Some(session_id) => adapter
|
|
426
|
-
.build_resume_command_plan(Some(session_id), context)
|
|
427
|
-
.map_err(|e| LifecycleError::Provider(e.to_string()))?,
|
|
428
|
-
None => adapter
|
|
429
|
-
.build_command_plan(context)
|
|
430
|
-
.map_err(|e| LifecycleError::Provider(e.to_string()))?,
|
|
431
|
-
}
|
|
432
|
-
};
|
|
389
|
+
let spawn_cwd = spawn_cwd_override.unwrap_or(workspace);
|
|
390
|
+
let mut plan = match resume_session_id {
|
|
391
|
+
Some(session_id) => adapter.build_resume_command_plan(Some(session_id), context),
|
|
392
|
+
None => adapter.build_command_plan(context),
|
|
393
|
+
}
|
|
394
|
+
.map_err(|e| LifecycleError::Provider(e.to_string()))?;
|
|
433
395
|
if !plan.managed_mcp_config && !profile_launch.managed_mcp_config {
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
);
|
|
440
|
-
}
|
|
396
|
+
crate::lifecycle::launch::point_native_mcp_config_at_file(
|
|
397
|
+
&mut plan.argv,
|
|
398
|
+
provider,
|
|
399
|
+
&mcp_config_path,
|
|
400
|
+
);
|
|
441
401
|
}
|
|
442
402
|
crate::lifecycle::launch::fill_spawn_placeholders_full(
|
|
443
403
|
&mut plan.argv,
|
|
@@ -464,54 +424,12 @@ pub(super) fn spawn_agent_window(
|
|
|
464
424
|
&mut env,
|
|
465
425
|
)?;
|
|
466
426
|
}
|
|
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
427
|
if provider == crate::provider::Provider::Grok {
|
|
506
428
|
crate::lifecycle::launch::ensure_grok_login_and_folder_trust(workspace)?;
|
|
507
429
|
crate::lifecycle::launch::apply_grok_mcp_overlay(workspace, &mcp_config)?;
|
|
508
430
|
}
|
|
509
|
-
//
|
|
510
|
-
// `.team/runtime/<team_key>/`).
|
|
511
|
-
// already resolved above so exact-path header checks match capture.
|
|
512
|
-
// 0.4.x provider effort MVP step 9: scrub CLAUDE_EFFORT for Claude
|
|
513
|
-
// worker spawn so a parent shell env cannot silently override the
|
|
514
|
-
// framework's effort decision.
|
|
431
|
+
// Spawn cwd is override-or-workspace (E56: ignore drifted state
|
|
432
|
+
// `.team/runtime/<team_key>/`).
|
|
515
433
|
let env_unset = crate::layout::worker_env::isolate_worker_spawn_env(
|
|
516
434
|
provider,
|
|
517
435
|
&mut env,
|
|
@@ -702,8 +620,8 @@ pub(super) fn spawn_agent_window(
|
|
|
702
620
|
plan,
|
|
703
621
|
profile_launch,
|
|
704
622
|
layout_placement: layout_placement.cloned(),
|
|
705
|
-
spawn_cwd:
|
|
706
|
-
mcp_config_path,
|
|
623
|
+
spawn_cwd: spawn_cwd.to_path_buf(),
|
|
624
|
+
mcp_config_path: Some(mcp_config_path),
|
|
707
625
|
owner_team_id: team_id,
|
|
708
626
|
})
|
|
709
627
|
}
|
|
@@ -1356,11 +1274,11 @@ pub(crate) fn session_identity_probe_for_agent(
|
|
|
1356
1274
|
}
|
|
1357
1275
|
|
|
1358
1276
|
/// ---
|
|
1359
|
-
/// purpose:
|
|
1277
|
+
/// purpose: 共享会话身份判定(Pi fork 血统随遗留 Pi worker 运行时一并移除)
|
|
1360
1278
|
/// params:
|
|
1361
|
-
/// workspace/state/agent:
|
|
1279
|
+
/// workspace/state/agent: 保留调用形状
|
|
1362
1280
|
/// rollout_path: 当前席位的精确 backing
|
|
1363
|
-
/// returns:
|
|
1281
|
+
/// returns: 字面身份判定结果
|
|
1364
1282
|
/// ---
|
|
1365
1283
|
pub(crate) fn session_identity_probe_for_agent_with_fork_ancestry(
|
|
1366
1284
|
workspace: &Path,
|
|
@@ -1370,102 +1288,8 @@ pub(crate) fn session_identity_probe_for_agent_with_fork_ancestry(
|
|
|
1370
1288
|
provider: Provider,
|
|
1371
1289
|
rollout_path: Option<&RolloutPath>,
|
|
1372
1290
|
) -> SessionIdentityProbeResult {
|
|
1373
|
-
let
|
|
1374
|
-
|
|
1375
|
-
|| !pi_fork_ancestor_identity_is_valid(
|
|
1376
|
-
workspace,
|
|
1377
|
-
state,
|
|
1378
|
-
agent_id,
|
|
1379
|
-
agent,
|
|
1380
|
-
provider,
|
|
1381
|
-
rollout_path,
|
|
1382
|
-
probe.embedded_agent_id.as_deref(),
|
|
1383
|
-
)
|
|
1384
|
-
{
|
|
1385
|
-
return probe;
|
|
1386
|
-
}
|
|
1387
|
-
probe.identity_ok = Some(true);
|
|
1388
|
-
probe
|
|
1389
|
-
}
|
|
1390
|
-
|
|
1391
|
-
fn pi_fork_ancestor_identity_is_valid(
|
|
1392
|
-
workspace: &Path,
|
|
1393
|
-
state: &serde_json::Value,
|
|
1394
|
-
agent_id: &AgentId,
|
|
1395
|
-
agent: &serde_json::Value,
|
|
1396
|
-
provider: Provider,
|
|
1397
|
-
rollout_path: Option<&RolloutPath>,
|
|
1398
|
-
embedded_agent_id: Option<&str>,
|
|
1399
|
-
) -> bool {
|
|
1400
|
-
if provider != Provider::Pi
|
|
1401
|
-
|| agent.get("attribution_ambiguous").and_then(serde_json::Value::as_bool) == Some(true)
|
|
1402
|
-
|| agent.get("capture_state").and_then(serde_json::Value::as_str)
|
|
1403
|
-
== Some("attribution_ambiguous")
|
|
1404
|
-
|| !matches!(
|
|
1405
|
-
agent
|
|
1406
|
-
.get("attribution_confidence")
|
|
1407
|
-
.and_then(serde_json::Value::as_str),
|
|
1408
|
-
Some("high" | "medium")
|
|
1409
|
-
)
|
|
1410
|
-
{
|
|
1411
|
-
return false;
|
|
1412
|
-
}
|
|
1413
|
-
let (Some(embedded_agent_id), Some(forked_from), Some(target_path)) = (
|
|
1414
|
-
embedded_agent_id,
|
|
1415
|
-
agent
|
|
1416
|
-
.get("forked_from")
|
|
1417
|
-
.and_then(serde_json::Value::as_str)
|
|
1418
|
-
.filter(|value| !value.is_empty()),
|
|
1419
|
-
rollout_path.map(RolloutPath::as_path),
|
|
1420
|
-
) else {
|
|
1421
|
-
return false;
|
|
1422
|
-
};
|
|
1423
|
-
if forked_from != embedded_agent_id || forked_from == agent_id.as_str() {
|
|
1424
|
-
return false;
|
|
1425
|
-
}
|
|
1426
|
-
let Some(source_agent) = state
|
|
1427
|
-
.get("agents")
|
|
1428
|
-
.and_then(|agents| agents.get(forked_from))
|
|
1429
|
-
.filter(|source| agent_provider(source) == Provider::Pi)
|
|
1430
|
-
else {
|
|
1431
|
-
return false;
|
|
1432
|
-
};
|
|
1433
|
-
let Some(source_path) = agent_rollout_path(source_agent) else {
|
|
1434
|
-
return false;
|
|
1435
|
-
};
|
|
1436
|
-
if source_path.as_path() == target_path {
|
|
1437
|
-
return false;
|
|
1438
|
-
}
|
|
1439
|
-
let (Some(session_id), Ok(target_path), Some(target_root)) = (
|
|
1440
|
-
agent_session_id(agent),
|
|
1441
|
-
std::fs::canonicalize(target_path),
|
|
1442
|
-
agent
|
|
1443
|
-
.get("claude_projects_root")
|
|
1444
|
-
.and_then(serde_json::Value::as_str)
|
|
1445
|
-
.filter(|path| !path.is_empty())
|
|
1446
|
-
.map(std::path::PathBuf::from),
|
|
1447
|
-
) else {
|
|
1448
|
-
return false;
|
|
1449
|
-
};
|
|
1450
|
-
let Ok(target_root) = std::fs::canonicalize(target_root) else {
|
|
1451
|
-
return false;
|
|
1452
|
-
};
|
|
1453
|
-
if !target_path.starts_with(target_root)
|
|
1454
|
-
|| std::fs::canonicalize(source_path.as_path())
|
|
1455
|
-
.is_ok_and(|source_path| source_path == target_path)
|
|
1456
|
-
|| !resume_backing_probe_for_agent(
|
|
1457
|
-
workspace,
|
|
1458
|
-
agent_id,
|
|
1459
|
-
agent,
|
|
1460
|
-
provider,
|
|
1461
|
-
&session_id,
|
|
1462
|
-
rollout_path,
|
|
1463
|
-
)
|
|
1464
|
-
.exists
|
|
1465
|
-
{
|
|
1466
|
-
return false;
|
|
1467
|
-
}
|
|
1468
|
-
true
|
|
1291
|
+
let _ = (workspace, state, agent);
|
|
1292
|
+
session_identity_probe_for_agent(agent_id, provider, rollout_path)
|
|
1469
1293
|
}
|
|
1470
1294
|
|
|
1471
1295
|
/// ---
|
|
@@ -1503,20 +1327,6 @@ pub(super) fn resume_backing_probe_for_agent(
|
|
|
1503
1327
|
rollout_ok
|
|
1504
1328
|
|| codex_session_transcript_exists_with_roots(session_id.as_str(), &scan_roots)
|
|
1505
1329
|
}
|
|
1506
|
-
Provider::Claude | Provider::ClaudeCode => {
|
|
1507
|
-
let rollout_ok = rollout_path_exists(rollout_path);
|
|
1508
|
-
let projects_root = claude_projects_root_for_agent(agent);
|
|
1509
|
-
if let Some(root) = projects_root.as_ref() {
|
|
1510
|
-
checked_paths.push(root.clone());
|
|
1511
|
-
}
|
|
1512
|
-
let event_log_path = workspace.join(".team/logs/events.jsonl");
|
|
1513
|
-
checked_paths.push(event_log_path);
|
|
1514
|
-
rollout_ok
|
|
1515
|
-
|| event_log_transcript_exists(workspace, agent_id.as_str(), session_id.as_str())
|
|
1516
|
-
|| projects_root.is_some_and(|root| {
|
|
1517
|
-
claude_project_transcript_exists_under(&root, session_id.as_str())
|
|
1518
|
-
})
|
|
1519
|
-
}
|
|
1520
1330
|
Provider::Copilot => {
|
|
1521
1331
|
if let Some(home) = std::env::var_os("HOME").map(PathBuf::from) {
|
|
1522
1332
|
checked_paths.push(home.join(".copilot/session-store.db"));
|
|
@@ -1540,47 +1350,12 @@ pub(super) fn resume_backing_probe_for_agent(
|
|
|
1540
1350
|
None => false,
|
|
1541
1351
|
}
|
|
1542
1352
|
}
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
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
|
-
Provider::Pi => {
|
|
1568
|
-
let spawn_cwd = agent
|
|
1569
|
-
.get("spawn_cwd")
|
|
1570
|
-
.and_then(serde_json::Value::as_str)
|
|
1571
|
-
.filter(|value| !value.is_empty())
|
|
1572
|
-
.map(PathBuf::from)
|
|
1573
|
-
.unwrap_or_else(|| workspace.to_path_buf());
|
|
1574
|
-
rollout_path.is_some_and(|path| {
|
|
1575
|
-
crate::provider::session_scan::pi::validate_exact_backing(
|
|
1576
|
-
path.as_path(),
|
|
1577
|
-
session_id,
|
|
1578
|
-
&spawn_cwd,
|
|
1579
|
-
)
|
|
1580
|
-
.is_ok()
|
|
1581
|
-
})
|
|
1582
|
-
}
|
|
1583
|
-
Provider::GeminiCli | Provider::Fake => false,
|
|
1353
|
+
// Claude Code and Pi workers run only through their contract leaves.
|
|
1354
|
+
Provider::Claude
|
|
1355
|
+
| Provider::ClaudeCode
|
|
1356
|
+
| Provider::Pi
|
|
1357
|
+
| Provider::GeminiCli
|
|
1358
|
+
| Provider::Fake => false,
|
|
1584
1359
|
};
|
|
1585
1360
|
|
|
1586
1361
|
// Deduplicate while preserving order (HashSet would lose deterministic
|
|
@@ -1620,73 +1395,6 @@ fn rollout_path_exists(rollout_path: Option<&RolloutPath>) -> bool {
|
|
|
1620
1395
|
.is_some_and(|path| path.as_path().exists())
|
|
1621
1396
|
}
|
|
1622
1397
|
|
|
1623
|
-
fn event_log_transcript_exists(workspace: &Path, agent_id: &str, session_id: &str) -> bool {
|
|
1624
|
-
let Ok(events) = crate::event_log::EventLog::new(workspace).tail(0) else {
|
|
1625
|
-
return false;
|
|
1626
|
-
};
|
|
1627
|
-
events.iter().rev().any(|event| {
|
|
1628
|
-
event.get("event").and_then(serde_json::Value::as_str) == Some("session.captured")
|
|
1629
|
-
&& ["agent_id", "worker_id"]
|
|
1630
|
-
.iter()
|
|
1631
|
-
.any(|key| event.get(*key).and_then(serde_json::Value::as_str) == Some(agent_id))
|
|
1632
|
-
&& event.get("session_id").and_then(serde_json::Value::as_str) == Some(session_id)
|
|
1633
|
-
&& event_transcript_path(event).is_some_and(|path| path.exists())
|
|
1634
|
-
})
|
|
1635
|
-
}
|
|
1636
|
-
|
|
1637
|
-
fn event_transcript_path(event: &serde_json::Value) -> Option<PathBuf> {
|
|
1638
|
-
event
|
|
1639
|
-
.get("rollout_path")
|
|
1640
|
-
.or_else(|| event.get("transcript_path"))
|
|
1641
|
-
.and_then(serde_json::Value::as_str)
|
|
1642
|
-
.filter(|path| !path.is_empty())
|
|
1643
|
-
.map(PathBuf::from)
|
|
1644
|
-
}
|
|
1645
|
-
|
|
1646
|
-
/// E36 fix-B: a real Claude worker writes its session transcript to
|
|
1647
|
-
/// `<claude_projects_root>/<workspace-slug>/<session_id>.jsonl` even when neither
|
|
1648
|
-
/// `rollout_path` was persisted to state nor a `session.captured` event was logged.
|
|
1649
|
-
/// That landed transcript is itself a valid resume backing — restart was wrongly
|
|
1650
|
-
/// refusing resumable workers because it only checked the two paths above. Scan the
|
|
1651
|
-
/// projects root recursively for `<session_id>.jsonl` (session_id is a unique UUID,
|
|
1652
|
-
/// so we avoid recomputing the project-dir slug, which is brittle for non-ASCII
|
|
1653
|
-
/// workspace paths).
|
|
1654
|
-
fn claude_project_transcript_exists(agent: &serde_json::Value, session_id: &str) -> bool {
|
|
1655
|
-
let Some(root) = claude_projects_root_for_agent(agent) else {
|
|
1656
|
-
return false;
|
|
1657
|
-
};
|
|
1658
|
-
claude_project_transcript_exists_under(&root, session_id)
|
|
1659
|
-
}
|
|
1660
|
-
|
|
1661
|
-
fn claude_projects_root_for_agent(agent: &serde_json::Value) -> Option<PathBuf> {
|
|
1662
|
-
agent
|
|
1663
|
-
.get("claude_projects_root")
|
|
1664
|
-
.and_then(serde_json::Value::as_str)
|
|
1665
|
-
.filter(|value| !value.is_empty())
|
|
1666
|
-
.map(PathBuf::from)
|
|
1667
|
-
.or_else(|| {
|
|
1668
|
-
std::env::var_os("HOME")
|
|
1669
|
-
.map(|home| PathBuf::from(home).join(".claude").join("projects"))
|
|
1670
|
-
})
|
|
1671
|
-
}
|
|
1672
|
-
|
|
1673
|
-
fn claude_project_transcript_exists_under(projects_root: &Path, session_id: &str) -> bool {
|
|
1674
|
-
if session_id.is_empty() {
|
|
1675
|
-
return false;
|
|
1676
|
-
}
|
|
1677
|
-
if !projects_root.is_dir() {
|
|
1678
|
-
return false;
|
|
1679
|
-
}
|
|
1680
|
-
let transcript_name = format!("{session_id}.jsonl");
|
|
1681
|
-
let Ok(project_dirs) = std::fs::read_dir(projects_root) else {
|
|
1682
|
-
return false;
|
|
1683
|
-
};
|
|
1684
|
-
project_dirs
|
|
1685
|
-
.flatten()
|
|
1686
|
-
.filter(|entry| entry.path().is_dir())
|
|
1687
|
-
.any(|entry| entry.path().join(&transcript_name).is_file())
|
|
1688
|
-
}
|
|
1689
|
-
|
|
1690
1398
|
fn codex_session_transcript_exists(
|
|
1691
1399
|
agent: &serde_json::Value,
|
|
1692
1400
|
session_id: &str,
|
|
@@ -2450,49 +2158,6 @@ mod e36_transcript_backing_tests {
|
|
|
2450
2158
|
.is_err());
|
|
2451
2159
|
}
|
|
2452
2160
|
|
|
2453
|
-
// E36 fix-B RED→GREEN: a real Claude worker that sent a message has its session
|
|
2454
|
-
// transcript landed at <projects_root>/<slug>/<session_id>.jsonl, but neither
|
|
2455
|
-
// rollout_path was persisted to state nor a session.captured event was logged.
|
|
2456
|
-
// Before the fix, claude_project_transcript_exists did not exist and restart
|
|
2457
|
-
// refused such a worker. This asserts the landed transcript is recognized.
|
|
2458
|
-
#[test]
|
|
2459
|
-
fn claude_project_transcript_is_recognized_without_rollout_or_capture_event() {
|
|
2460
|
-
let scratch = ScratchDir::new("recognized");
|
|
2461
|
-
let projects_root = scratch.path().join("projects");
|
|
2462
|
-
let slug_dir = projects_root.join("-Users-alauda-Documents-code---rust---9");
|
|
2463
|
-
std::fs::create_dir_all(&slug_dir).expect("mkdir slug");
|
|
2464
|
-
let session_id = "87742d3f-0b4e-4fc1-ad35-447ac2340b65";
|
|
2465
|
-
std::fs::write(slug_dir.join(format!("{session_id}.jsonl")), b"{}\n").expect("transcript");
|
|
2466
|
-
|
|
2467
|
-
let agent = serde_json::json!({
|
|
2468
|
-
"claude_projects_root": projects_root.to_string_lossy(),
|
|
2469
|
-
});
|
|
2470
|
-
assert!(
|
|
2471
|
-
claude_project_transcript_exists(&agent, session_id),
|
|
2472
|
-
"landed claude transcript must count as resume backing (E36 fix-B)"
|
|
2473
|
-
);
|
|
2474
|
-
}
|
|
2475
|
-
|
|
2476
|
-
#[test]
|
|
2477
|
-
fn missing_claude_transcript_is_not_backing() {
|
|
2478
|
-
let scratch = ScratchDir::new("missing");
|
|
2479
|
-
let projects_root = scratch.path().join("projects");
|
|
2480
|
-
std::fs::create_dir_all(&projects_root).expect("mkdir");
|
|
2481
|
-
let agent = serde_json::json!({
|
|
2482
|
-
"claude_projects_root": projects_root.to_string_lossy(),
|
|
2483
|
-
});
|
|
2484
|
-
assert!(
|
|
2485
|
-
!claude_project_transcript_exists(&agent, "deadbeef-0000-0000-0000-000000000000"),
|
|
2486
|
-
"no transcript file => no backing"
|
|
2487
|
-
);
|
|
2488
|
-
}
|
|
2489
|
-
|
|
2490
|
-
#[test]
|
|
2491
|
-
fn empty_session_id_is_not_backing() {
|
|
2492
|
-
let agent = serde_json::json!({});
|
|
2493
|
-
assert!(!claude_project_transcript_exists(&agent, ""));
|
|
2494
|
-
}
|
|
2495
|
-
|
|
2496
2161
|
#[test]
|
|
2497
2162
|
fn codex_session_transcript_is_recognized_when_rollout_path_is_stale() {
|
|
2498
2163
|
let scratch = ScratchDir::new("codex-recognized");
|
|
@@ -45,7 +45,7 @@ mod contract_route_tests {
|
|
|
45
45
|
fn mixed_team_retains_legacy_classification_without_native_codex_fallback() {
|
|
46
46
|
let state = serde_json::json!({"agents": {
|
|
47
47
|
"native": {"provider":"cursor","status":"running","session_id":"native-id"},
|
|
48
|
-
"legacy": {"provider":"
|
|
48
|
+
"legacy": {"provider":"copilot","status":"running"},
|
|
49
49
|
}});
|
|
50
50
|
let plan = classify_restart_plan(&state, false).unwrap();
|
|
51
51
|
assert_eq!(plan.decisions.len(), 1);
|
|
@@ -61,11 +61,11 @@ mod stopped_restart_tests {
|
|
|
61
61
|
#[test]
|
|
62
62
|
fn stopped_rows_never_enter_validation_or_fresh_spawn_even_with_allow_fresh() {
|
|
63
63
|
let state = serde_json::json!({"agents": {
|
|
64
|
-
"stopped": {"provider":"
|
|
64
|
+
"stopped": {"provider":"copilot","status":"stopped","explicit_stop":true,
|
|
65
65
|
"session_id":"preserved","generation":7,"first_send_at":false},
|
|
66
|
-
"legacy_stopped": {"provider":"
|
|
67
|
-
"marker": {"provider":"
|
|
68
|
-
"active": {"provider":"
|
|
66
|
+
"legacy_stopped": {"provider":"copilot","status":"stopped"},
|
|
67
|
+
"marker": {"provider":"copilot","status":"running","explicit_stop":true},
|
|
68
|
+
"active": {"provider":"copilot","status":"running"}
|
|
69
69
|
}});
|
|
70
70
|
let before = state.clone();
|
|
71
71
|
for allow_fresh in [false, true] {
|
|
@@ -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";
|
|
@@ -269,14 +269,14 @@ fn d6_compiled_system_prompt_first_section_is_identity() {
|
|
|
269
269
|
&ws,
|
|
270
270
|
&TeamFixture {
|
|
271
271
|
name: "d6team",
|
|
272
|
-
provider: "
|
|
272
|
+
provider: "codex",
|
|
273
273
|
fast: false,
|
|
274
274
|
agents: &[AgentDoc {
|
|
275
275
|
id: "worker_a",
|
|
276
276
|
role: "Prompt Order Worker",
|
|
277
|
-
provider: "
|
|
277
|
+
provider: "codex",
|
|
278
278
|
auth_mode: "subscription",
|
|
279
|
-
model: Some("
|
|
279
|
+
model: Some("gpt-5.5"),
|
|
280
280
|
profile: None,
|
|
281
281
|
tools: &["mcp_team"],
|
|
282
282
|
body: "ROLE BODY SENTINEL for prompt ordering.",
|
|
@@ -287,10 +287,15 @@ fn d6_compiled_system_prompt_first_section_is_identity() {
|
|
|
287
287
|
let transport = RecordingTransport::new();
|
|
288
288
|
|
|
289
289
|
quick_start_with_transport_in_workspace(&ws, &team_dir, None, true, Some("d6team"), &transport)
|
|
290
|
-
.expect("quick-start should spawn the
|
|
290
|
+
.expect("quick-start should spawn the codex worker");
|
|
291
291
|
let spawn = transport.single_spawn();
|
|
292
|
-
|
|
293
|
-
|
|
292
|
+
// The identity line has no `\`, `"` or newline, so codex's escaping leaves it verbatim.
|
|
293
|
+
let prompt = spawn
|
|
294
|
+
.argv
|
|
295
|
+
.iter()
|
|
296
|
+
.find_map(|arg| arg.strip_prefix("developer_instructions=\""))
|
|
297
|
+
.expect("codex argv must carry -c developer_instructions")
|
|
298
|
+
.to_string();
|
|
294
299
|
|
|
295
300
|
let identity = "You are Team Agent worker `worker_a` with role `Prompt Order Worker`. \
|
|
296
301
|
When asked about your role or identity, answer with this Team Agent worker identity first, \
|