@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,14 +1,16 @@
|
|
|
1
1
|
//! ---
|
|
2
|
-
//! purpose: Pi executable/catalog
|
|
2
|
+
//! purpose: Pi leader 的 executable/catalog 验证、MCP 能力注册与 fresh 启动计划物化
|
|
3
3
|
//! contract:
|
|
4
4
|
//! provides:
|
|
5
5
|
//! - name: materialize_pi_plan
|
|
6
|
-
//! what: 为 leader
|
|
6
|
+
//! what: 为 `team-agent pi` leader 生成 fresh Pi CommandPlan
|
|
7
7
|
//! - name: write_pi_wrapper
|
|
8
8
|
//! what: 原子写入 0600 per-seat runtime MCP registration extension
|
|
9
|
+
//! - name: pi_cleanup_plan
|
|
10
|
+
//! what: 移除升级前遗留的 legacy Pi worker 席位时只删 wrapper
|
|
9
11
|
//! boundary:
|
|
10
|
-
//! -
|
|
11
|
-
//! -
|
|
12
|
+
//! - Pi worker 席位只走 contract `pi_tui` leaf;这里不再 spawn/resume/fork worker
|
|
13
|
+
//! - 不枚举 Pi session;不投递消息、不执行 doctor 判定
|
|
12
14
|
//! - 不读取 credentials 或 provider settings 值
|
|
13
15
|
//! maturity: wired
|
|
14
16
|
//! ---
|
|
@@ -16,18 +18,15 @@
|
|
|
16
18
|
use std::collections::BTreeSet;
|
|
17
19
|
use std::fs::OpenOptions;
|
|
18
20
|
use std::io::Write;
|
|
19
|
-
#[cfg(test)]
|
|
20
|
-
use std::cell::RefCell;
|
|
21
21
|
use std::os::unix::fs::{OpenOptionsExt, PermissionsExt};
|
|
22
22
|
use std::path::{Path, PathBuf};
|
|
23
23
|
use std::process::Command;
|
|
24
|
-
use std::time::Duration;
|
|
25
24
|
|
|
26
25
|
use sha2::{Digest, Sha256};
|
|
27
26
|
|
|
28
27
|
use crate::model::enums::{Provider, ProviderEffort};
|
|
29
|
-
use crate::provider::
|
|
30
|
-
use crate::provider::{CommandPlan, McpConfig, ProviderError
|
|
28
|
+
use crate::provider::command_helpers::{append_opt_pair, append_pair};
|
|
29
|
+
use crate::provider::{CommandPlan, McpConfig, ProviderError};
|
|
31
30
|
|
|
32
31
|
/// The first executable `pi` on PATH, exactly what the worker's bare `pi`
|
|
33
32
|
/// runs: a wrapper, npm symlink or plain binary alike. No inner binary is probed.
|
|
@@ -95,14 +94,6 @@ pub(crate) fn pi_seat_paths(workspace: &Path, team_id: &str, agent_id: &str) ->
|
|
|
95
94
|
}
|
|
96
95
|
}
|
|
97
96
|
|
|
98
|
-
/// ---
|
|
99
|
-
/// purpose: 为 Pi fresh 启动生成框架预分配 UUID
|
|
100
|
-
/// returns: 新 SessionId
|
|
101
|
-
/// ---
|
|
102
|
-
pub(crate) fn new_pi_session_id() -> SessionId {
|
|
103
|
-
SessionId::new(crate::provider::adapter::next_session_token())
|
|
104
|
-
}
|
|
105
|
-
|
|
106
97
|
/// ---
|
|
107
98
|
/// purpose: 解析 pi --list-models 未过滤表格为 provider/model exact ids
|
|
108
99
|
/// returns: 保序且无重复的 exact ids
|
|
@@ -146,20 +137,6 @@ pub(crate) fn select_exact_pi_model(
|
|
|
146
137
|
Ok(selected.clone())
|
|
147
138
|
}
|
|
148
139
|
|
|
149
|
-
/// ---
|
|
150
|
-
/// purpose: 对比选定与启动后客观观测到的 Pi model identity
|
|
151
|
-
/// returns: 完全相等且非空时成功
|
|
152
|
-
/// errors: 缺失或不匹配时返回 ProviderError
|
|
153
|
-
/// ---
|
|
154
|
-
pub(crate) fn verify_started_pi_model(selected: &str, observed: &str) -> Result<(), ProviderError> {
|
|
155
|
-
if observed.is_empty() || selected != observed {
|
|
156
|
-
return Err(ProviderError::Command(format!(
|
|
157
|
-
"Pi started model mismatch: selected={selected:?} observed={observed:?}"
|
|
158
|
-
)));
|
|
159
|
-
}
|
|
160
|
-
Ok(())
|
|
161
|
-
}
|
|
162
|
-
|
|
163
140
|
/// ---
|
|
164
141
|
/// purpose: 校验 Pi PATH entry 与 live catalog;MCP 能力在实际 Pi context 验证
|
|
165
142
|
/// returns: PATH entry 与 catalog receipt 完整时成功
|
|
@@ -464,136 +441,6 @@ fn sha256(bytes: &[u8]) -> String {
|
|
|
464
441
|
format!("{:x}", Sha256::digest(bytes))
|
|
465
442
|
}
|
|
466
443
|
|
|
467
|
-
#[cfg(test)]
|
|
468
|
-
#[derive(Debug, Default)]
|
|
469
|
-
pub(crate) struct PiCatalogTestObservation {
|
|
470
|
-
pub(crate) spawn_count: usize,
|
|
471
|
-
pub(crate) argv: Vec<String>,
|
|
472
|
-
pub(crate) parent_pid: Option<u32>,
|
|
473
|
-
pub(crate) parent_exit_success: Option<bool>,
|
|
474
|
-
pub(crate) parent_exit_code: Option<i32>,
|
|
475
|
-
pub(crate) reader_timeout: bool,
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
#[cfg(test)]
|
|
479
|
-
struct PiCatalogTestContext {
|
|
480
|
-
receipt: PathBuf,
|
|
481
|
-
helper_mode: Option<String>,
|
|
482
|
-
observation: PiCatalogTestObservation,
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
#[cfg(test)]
|
|
486
|
-
thread_local! {
|
|
487
|
-
static PI_CATALOG_TEST_CONTEXT: RefCell<Option<PiCatalogTestContext>> = RefCell::new(None);
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
#[cfg(test)]
|
|
491
|
-
pub(crate) fn with_pi_catalog_test_observation<T>(
|
|
492
|
-
receipt: &Path,
|
|
493
|
-
helper_mode: Option<&str>,
|
|
494
|
-
action: impl FnOnce() -> T,
|
|
495
|
-
) -> (T, PiCatalogTestObservation) {
|
|
496
|
-
PI_CATALOG_TEST_CONTEXT.with(|slot| {
|
|
497
|
-
assert!(slot
|
|
498
|
-
.replace(Some(PiCatalogTestContext {
|
|
499
|
-
receipt: receipt.to_path_buf(),
|
|
500
|
-
helper_mode: helper_mode.map(str::to_owned),
|
|
501
|
-
observation: PiCatalogTestObservation::default(),
|
|
502
|
-
}))
|
|
503
|
-
.is_none());
|
|
504
|
-
let result = action();
|
|
505
|
-
let context = slot.take().expect("Pi catalog test context");
|
|
506
|
-
(result, context.observation)
|
|
507
|
-
})
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
#[cfg(test)]
|
|
511
|
-
fn observe_pi_catalog_test(f: impl FnOnce(&mut PiCatalogTestContext)) {
|
|
512
|
-
PI_CATALOG_TEST_CONTEXT.with(|slot| {
|
|
513
|
-
if let Some(context) = slot.borrow_mut().as_mut() {
|
|
514
|
-
f(context);
|
|
515
|
-
}
|
|
516
|
-
});
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
#[cfg(test)]
|
|
520
|
-
pub(crate) fn run_pi_catalog_after_parent_exit_for_test(
|
|
521
|
-
stdout: std::process::ChildStdout,
|
|
522
|
-
parent_pid: u32,
|
|
523
|
-
status: std::process::ExitStatus,
|
|
524
|
-
timeout: Duration,
|
|
525
|
-
max_bytes: u64,
|
|
526
|
-
) -> Result<Vec<u8>, String> {
|
|
527
|
-
observe_pi_catalog_test(|context| {
|
|
528
|
-
context.observation.parent_pid = Some(parent_pid);
|
|
529
|
-
context.observation.parent_exit_success = Some(status.success());
|
|
530
|
-
context.observation.parent_exit_code = status.code();
|
|
531
|
-
});
|
|
532
|
-
crate::provider::model_catalog::finish_stdout_after_exit(
|
|
533
|
-
stdout, status, timeout, max_bytes, &mut PiCatalogObserver,
|
|
534
|
-
)
|
|
535
|
-
.map_err(|error| error.pi_legacy_message())
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
/// Shared bounded native-command runner; launch preflight keeps its exact model gate.
|
|
539
|
-
pub(crate) fn run_pi_catalog(
|
|
540
|
-
executable: &Path,
|
|
541
|
-
timeout: Duration,
|
|
542
|
-
max_bytes: u64,
|
|
543
|
-
) -> Result<Vec<u8>, String> {
|
|
544
|
-
let mut extra_env = Vec::new();
|
|
545
|
-
#[cfg(test)]
|
|
546
|
-
observe_pi_catalog_test(|context| {
|
|
547
|
-
context.observation.spawn_count += 1;
|
|
548
|
-
context.observation.argv.push("--list-models".to_string());
|
|
549
|
-
extra_env.push(("TEAM_AGENT_MODELS_TIMEOUT_RECEIPT".into(), context.receipt.as_os_str().into()));
|
|
550
|
-
if let Some(mode) = context.helper_mode.as_deref() {
|
|
551
|
-
extra_env.push(("TEAM_AGENT_MODELS_TIMEOUT_MODE".into(), mode.into()));
|
|
552
|
-
}
|
|
553
|
-
});
|
|
554
|
-
crate::provider::model_catalog::run_command(
|
|
555
|
-
executable, &["--list-models"], None, None, &[], &extra_env, timeout, max_bytes,
|
|
556
|
-
&mut PiCatalogObserver,
|
|
557
|
-
)
|
|
558
|
-
.map_err(|error| error.pi_legacy_message())
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
struct PiCatalogObserver;
|
|
562
|
-
impl crate::provider::model_catalog::CatalogObserver for PiCatalogObserver {
|
|
563
|
-
#[cfg(test)]
|
|
564
|
-
fn spawned(&mut self, pid: u32) {
|
|
565
|
-
observe_pi_catalog_test(|context| context.observation.parent_pid = Some(pid));
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
#[cfg(test)]
|
|
569
|
-
fn exited(&mut self, status: &std::process::ExitStatus) {
|
|
570
|
-
observe_pi_catalog_test(|context| {
|
|
571
|
-
context.observation.parent_exit_success = Some(status.success());
|
|
572
|
-
context.observation.parent_exit_code = status.code();
|
|
573
|
-
});
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
#[cfg(test)]
|
|
577
|
-
fn output_timeout(&mut self) {
|
|
578
|
-
observe_pi_catalog_test(|context| context.observation.reader_timeout = true);
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
pub(crate) fn pi_model_candidates(requested: &str) -> Result<Vec<String>, ProviderError> {
|
|
583
|
-
let executable = pi_path_entry()?;
|
|
584
|
-
let catalog = run_pi_catalog(&executable, Duration::from_secs(10), 1024 * 1024)
|
|
585
|
-
.map_err(ProviderError::Command)?;
|
|
586
|
-
let models = parse_pi_list_models_table(&catalog)?;
|
|
587
|
-
Ok(models
|
|
588
|
-
.into_iter()
|
|
589
|
-
.filter(|model| {
|
|
590
|
-
model
|
|
591
|
-
.rsplit_once('/')
|
|
592
|
-
.is_some_and(|(_, name)| name == requested)
|
|
593
|
-
})
|
|
594
|
-
.collect())
|
|
595
|
-
}
|
|
596
|
-
|
|
597
444
|
/// The shell's own PATH choice: the first executable `pi`, kept as found.
|
|
598
445
|
fn pi_path_entry() -> Result<PathBuf, ProviderError> {
|
|
599
446
|
let path = std::env::var_os("PATH")
|
|
@@ -683,34 +530,13 @@ pub(crate) struct PiMaterializeRequest<'a> {
|
|
|
683
530
|
}
|
|
684
531
|
|
|
685
532
|
/// ---
|
|
686
|
-
/// purpose:
|
|
687
|
-
/// returns: fresh Pi CommandPlan 不传 --session-id;isolated
|
|
688
|
-
/// interactive leader preserves Pi's native default root
|
|
533
|
+
/// purpose: 物化 Pi leader 的 wrapper 和 fresh CommandPlan
|
|
534
|
+
/// returns: fresh Pi CommandPlan 不传 --session-id;an isolated leader carries its session root,
|
|
535
|
+
/// while the interactive leader preserves Pi's native default root
|
|
689
536
|
/// errors: resolver、exact model、wrapper 或 argv 构造失败时返回 ProviderError
|
|
690
537
|
/// ---
|
|
691
538
|
pub(crate) fn materialize_pi_plan(
|
|
692
539
|
request: PiMaterializeRequest<'_>,
|
|
693
|
-
) -> Result<CommandPlan, ProviderError> {
|
|
694
|
-
materialize_pi_plan_with_session(request, None)
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
/// ---
|
|
698
|
-
/// purpose: 用上游已验证的 captured id/path 物化 Pi exact-path resume 计划
|
|
699
|
-
/// returns: 与 fresh 共用 resolver/wrapper/argv builder,且不再生成 session id
|
|
700
|
-
/// errors: backing 缺失或越出席位 root 时拒绝;header id/cwd 由 session scanner 在调用前验证
|
|
701
|
-
/// ---
|
|
702
|
-
pub(crate) fn materialize_pi_resume_plan(
|
|
703
|
-
request: PiMaterializeRequest<'_>,
|
|
704
|
-
session_id: &SessionId,
|
|
705
|
-
session_path: &Path,
|
|
706
|
-
spawn_cwd: &Path,
|
|
707
|
-
) -> Result<CommandPlan, ProviderError> {
|
|
708
|
-
materialize_pi_plan_with_session(request, Some((session_id, session_path, spawn_cwd)))
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
fn materialize_pi_plan_with_session(
|
|
712
|
-
request: PiMaterializeRequest<'_>,
|
|
713
|
-
resume: Option<(&SessionId, &Path, &Path)>,
|
|
714
540
|
) -> Result<CommandPlan, ProviderError> {
|
|
715
541
|
let (_chain, catalog) = resolve_pi_executable_chain()?;
|
|
716
542
|
let model = request
|
|
@@ -722,41 +548,10 @@ fn materialize_pi_plan_with_session(
|
|
|
722
548
|
PiSessionScope::Isolated => Some(paths.sessions.as_path()),
|
|
723
549
|
PiSessionScope::NativeDefault => None,
|
|
724
550
|
};
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
ProviderError::
|
|
728
|
-
|
|
729
|
-
paths.sessions.display()
|
|
730
|
-
))
|
|
731
|
-
})?;
|
|
732
|
-
let session_root = std::fs::canonicalize(session_dir).map_err(|error| {
|
|
733
|
-
ProviderError::ResumeUnavailable(format!(
|
|
734
|
-
"Pi session root is unavailable {}: {error}",
|
|
735
|
-
paths.sessions.display()
|
|
736
|
-
))
|
|
737
|
-
})?;
|
|
738
|
-
let exact_path = std::fs::canonicalize(session_path).map_err(|error| {
|
|
739
|
-
ProviderError::ResumeUnavailable(format!(
|
|
740
|
-
"Pi exact session backing is unavailable {}: {error}",
|
|
741
|
-
session_path.display()
|
|
742
|
-
))
|
|
743
|
-
})?;
|
|
744
|
-
if !exact_path.starts_with(&session_root) {
|
|
745
|
-
return Err(ProviderError::ResumeUnavailable(format!(
|
|
746
|
-
"Pi exact session backing is outside the recorded seat root: {}",
|
|
747
|
-
exact_path.display()
|
|
748
|
-
)));
|
|
749
|
-
}
|
|
750
|
-
let _ = spawn_cwd;
|
|
751
|
-
Some((session_id, exact_path))
|
|
752
|
-
} else {
|
|
753
|
-
if let Some(session_dir) = session_dir {
|
|
754
|
-
std::fs::create_dir_all(session_dir).map_err(|error| {
|
|
755
|
-
ProviderError::Io(format!("{}: {error}", session_dir.display()))
|
|
756
|
-
})?;
|
|
757
|
-
}
|
|
758
|
-
None
|
|
759
|
-
};
|
|
551
|
+
if let Some(session_dir) = session_dir {
|
|
552
|
+
std::fs::create_dir_all(session_dir)
|
|
553
|
+
.map_err(|error| ProviderError::Io(format!("{}: {error}", session_dir.display())))?;
|
|
554
|
+
}
|
|
760
555
|
let candidate = candidate_from_mcp_config(request.mcp_config)?;
|
|
761
556
|
let wrapper = write_pi_wrapper(PiWrapperRequest {
|
|
762
557
|
destination: &paths.wrapper,
|
|
@@ -767,33 +562,68 @@ fn materialize_pi_plan_with_session(
|
|
|
767
562
|
workspace: request.workspace,
|
|
768
563
|
include_tools: request.team_mcp_tools,
|
|
769
564
|
})?;
|
|
770
|
-
let
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
agent_id: request.agent_id,
|
|
779
|
-
})?;
|
|
780
|
-
(argv, None)
|
|
781
|
-
} else {
|
|
782
|
-
let argv = build_pi_command_argv(PiCommandRequest {
|
|
783
|
-
extension: &wrapper,
|
|
784
|
-
model: model.as_deref(),
|
|
785
|
-
effort: request.effort,
|
|
786
|
-
system_prompt: request.system_prompt,
|
|
787
|
-
session_dir,
|
|
788
|
-
session: PiSessionSelector::Fresh,
|
|
789
|
-
agent_id: request.agent_id,
|
|
790
|
-
})?;
|
|
791
|
-
(argv, None)
|
|
792
|
-
};
|
|
565
|
+
let argv = build_pi_command_argv(PiCommandRequest {
|
|
566
|
+
extension: &wrapper,
|
|
567
|
+
model: model.as_deref(),
|
|
568
|
+
effort: request.effort,
|
|
569
|
+
system_prompt: request.system_prompt,
|
|
570
|
+
session_dir,
|
|
571
|
+
agent_id: request.agent_id,
|
|
572
|
+
})?;
|
|
793
573
|
Ok(CommandPlan {
|
|
794
574
|
argv,
|
|
795
|
-
expected_session_id,
|
|
575
|
+
expected_session_id: None,
|
|
796
576
|
provider_projects_root: session_dir.map(Path::to_path_buf),
|
|
797
577
|
managed_mcp_config: false,
|
|
798
578
|
})
|
|
799
579
|
}
|
|
580
|
+
|
|
581
|
+
pub(crate) struct PiCommandRequest<'a> {
|
|
582
|
+
pub extension: &'a Path,
|
|
583
|
+
pub model: Option<&'a str>,
|
|
584
|
+
pub effort: Option<ProviderEffort>,
|
|
585
|
+
pub system_prompt: &'a str,
|
|
586
|
+
/// Team-owned session root for an isolated leader; `None` preserves Pi's native default.
|
|
587
|
+
pub session_dir: Option<&'a Path>,
|
|
588
|
+
pub agent_id: &'a str,
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
/// ---
|
|
592
|
+
/// purpose: 从已验证 semantic request 构造仅追加 Team Agent MCP/提示/session root 的 fresh Pi argv
|
|
593
|
+
/// returns: exact ordered argv,argv[0] 固定为裸 `pi`;Pi 自己分配 session id
|
|
594
|
+
/// errors: 必需字段为空时返回 ProviderError
|
|
595
|
+
/// ---
|
|
596
|
+
pub(crate) fn build_pi_command_argv(
|
|
597
|
+
request: PiCommandRequest<'_>,
|
|
598
|
+
) -> Result<Vec<String>, ProviderError> {
|
|
599
|
+
if request.extension.as_os_str().is_empty()
|
|
600
|
+
|| request
|
|
601
|
+
.session_dir
|
|
602
|
+
.is_some_and(|session_dir| session_dir.as_os_str().is_empty())
|
|
603
|
+
|| request.model.is_some_and(|model| model.trim().is_empty())
|
|
604
|
+
|| request.system_prompt.trim().is_empty()
|
|
605
|
+
|| request.agent_id.trim().is_empty()
|
|
606
|
+
{
|
|
607
|
+
return Err(ProviderError::Command(
|
|
608
|
+
"Pi command requires extension, prompt, and agent id".to_string(),
|
|
609
|
+
));
|
|
610
|
+
}
|
|
611
|
+
// The command stays PATH-resolved at spawn time, so a user wrapper runs.
|
|
612
|
+
let mut argv = vec![
|
|
613
|
+
"pi".to_string(),
|
|
614
|
+
"-e".to_string(),
|
|
615
|
+
request.extension.to_string_lossy().into_owned(),
|
|
616
|
+
];
|
|
617
|
+
append_opt_pair(&mut argv, "--model", request.model);
|
|
618
|
+
if let Some(effort) = request.effort {
|
|
619
|
+
argv.push("--thinking".to_string());
|
|
620
|
+
argv.push(effort.as_str().to_string());
|
|
621
|
+
}
|
|
622
|
+
append_pair(&mut argv, "--append-system-prompt", request.system_prompt);
|
|
623
|
+
if let Some(session_dir) = request.session_dir {
|
|
624
|
+
append_pair(&mut argv, "--session-dir", session_dir.to_string_lossy().into_owned());
|
|
625
|
+
}
|
|
626
|
+
// Passing `--session-id` makes Pi warn and then create: Pi names a fresh session.
|
|
627
|
+
append_pair(&mut argv, "--name", request.agent_id);
|
|
628
|
+
Ok(argv)
|
|
629
|
+
}
|
|
@@ -1239,29 +1239,6 @@ pub(crate) fn quick_start_with_transport_in_workspace(
|
|
|
1239
1239
|
yes: bool,
|
|
1240
1240
|
team_id: Option<&str>,
|
|
1241
1241
|
transport: &dyn Transport,
|
|
1242
|
-
) -> Result<QuickStartReport, LifecycleError> {
|
|
1243
|
-
let mut discover = |requested: &str| {
|
|
1244
|
-
crate::lifecycle::launch::pi_mcp::pi_model_candidates(requested).map_err(|_| ())
|
|
1245
|
-
};
|
|
1246
|
-
quick_start_with_transport_in_workspace_pi_preflight(
|
|
1247
|
-
workspace,
|
|
1248
|
-
agents_dir,
|
|
1249
|
-
name,
|
|
1250
|
-
yes,
|
|
1251
|
-
team_id,
|
|
1252
|
-
transport,
|
|
1253
|
-
&mut discover,
|
|
1254
|
-
)
|
|
1255
|
-
}
|
|
1256
|
-
|
|
1257
|
-
pub(crate) fn quick_start_with_transport_in_workspace_pi_preflight(
|
|
1258
|
-
workspace: &Path,
|
|
1259
|
-
agents_dir: &Path,
|
|
1260
|
-
name: Option<&str>,
|
|
1261
|
-
yes: bool,
|
|
1262
|
-
team_id: Option<&str>,
|
|
1263
|
-
transport: &dyn Transport,
|
|
1264
|
-
discover: &mut dyn FnMut(&str) -> Result<Vec<String>, ()>,
|
|
1265
1242
|
) -> Result<QuickStartReport, LifecycleError> {
|
|
1266
1243
|
// B-7 / 036b N38 三行 fail-fast — TEAM_AGENT_LEADER_PANE_ID 主动路径在 quick-start
|
|
1267
1244
|
// 入口验活;死/缺(Dead)的 pane 必须明确报错,不可 silent bind 到 spawner /
|
|
@@ -1277,7 +1254,6 @@ pub(crate) fn quick_start_with_transport_in_workspace_pi_preflight(
|
|
|
1277
1254
|
agents_dir.display()
|
|
1278
1255
|
)));
|
|
1279
1256
|
}
|
|
1280
|
-
crate::lifecycle::launch::run_pi_catalog_preflight(agents_dir, discover)?;
|
|
1281
1257
|
#[cfg(unix)]
|
|
1282
1258
|
{
|
|
1283
1259
|
let input = crate::cli::QuickStartArgs {
|
|
@@ -1748,7 +1724,7 @@ mod fresh_quick_start_leader_binding_tests {
|
|
|
1748
1724
|
let team = workspace.join("roles");
|
|
1749
1725
|
std::fs::create_dir_all(team.join("agents")).unwrap();
|
|
1750
1726
|
std::fs::write(team.join("TEAM.md"), "---\nname: fresh\nobjective: test\nprovider: codex\n---\nTeam.\n").unwrap();
|
|
1751
|
-
std::fs::write(team.join("agents/worker.md"), "---\nname: worker\nrole: Worker\nprovider:
|
|
1727
|
+
std::fs::write(team.join("agents/worker.md"), "---\nname: worker\nrole: Worker\nprovider: fake\nmodel: fake\nauth_mode: subscription\ndangerously_skip_permissions: false\n---\nTest.\n").unwrap();
|
|
1752
1728
|
let transport = OfflineTransport::new();
|
|
1753
1729
|
let report = quick_start_with_transport_in_workspace(
|
|
1754
1730
|
&workspace, &team, None, true, Some("fresh"), &transport,
|
|
@@ -1873,7 +1849,7 @@ mod fresh_quick_start_leader_binding_tests {
|
|
|
1873
1849
|
"---\nname: current\nobjective: Bootstrap fixture.\n---\n",
|
|
1874
1850
|
)
|
|
1875
1851
|
.unwrap();
|
|
1876
|
-
std::fs::write(team.join("agents/worker.md"), "---\nname: worker\nrole: Worker\nprovider:
|
|
1852
|
+
std::fs::write(team.join("agents/worker.md"), "---\nname: worker\nrole: Worker\nprovider: fake\nmodel: fake\nauth_mode: subscription\ndangerously_skip_permissions: false\n---\nBounded fixture.\n").unwrap();
|
|
1877
1853
|
let state_path = crate::state::persist::runtime_state_path(&workspace);
|
|
1878
1854
|
std::fs::create_dir_all(state_path.parent().unwrap()).unwrap();
|
|
1879
1855
|
let state = json!({
|
|
@@ -151,6 +151,11 @@ pub(crate) fn materialize_latest_role(
|
|
|
151
151
|
"name",
|
|
152
152
|
Value::Str(as_agent_id.as_str().to_string()),
|
|
153
153
|
)?;
|
|
154
|
+
// `agent_id` outranks `name` when compiling: the new seat must not keep
|
|
155
|
+
// compiling to the source's id.
|
|
156
|
+
if let Value::Map(pairs) = &mut meta {
|
|
157
|
+
pairs.retain(|(key, _)| key != "agent_id");
|
|
158
|
+
}
|
|
154
159
|
if let Some(label) = label
|
|
155
160
|
.map(strip_label_quotes)
|
|
156
161
|
.filter(|value| !value.is_empty())
|
|
@@ -69,10 +69,6 @@ pub(super) fn spawn_agents(
|
|
|
69
69
|
let team_dir = team_dir_buf
|
|
70
70
|
.as_deref()
|
|
71
71
|
.unwrap_or_else(|| spec_path.parent().unwrap_or_else(|| Path::new(".")));
|
|
72
|
-
let runtime_fast = matches!(
|
|
73
|
-
spec.get("runtime").and_then(|v| v.get("fast")),
|
|
74
|
-
Some(Value::Bool(true))
|
|
75
|
-
);
|
|
76
72
|
let mut started = Vec::new();
|
|
77
73
|
#[cfg(unix)]
|
|
78
74
|
let mut contract_started = Vec::new();
|
|
@@ -111,12 +107,24 @@ pub(super) fn spawn_agents(
|
|
|
111
107
|
// persist_spawn_agent_state projects the actual K3 seat separately.
|
|
112
108
|
continue;
|
|
113
109
|
}
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
// A pre-upgrade Claude Code, Codex, Grok or Pi worker spec has no
|
|
111
|
+
// legacy runtime left; refuse before any MCP file, profile or pane
|
|
112
|
+
// side effect.
|
|
113
|
+
if let Some(retired) = agent
|
|
116
114
|
.get("provider")
|
|
117
115
|
.and_then(Value::as_str)
|
|
118
|
-
.
|
|
119
|
-
|
|
116
|
+
.filter(|provider| crate::provider::wire::is_retired_provider(provider))
|
|
117
|
+
{
|
|
118
|
+
return Err(LifecycleError::Provider(
|
|
119
|
+
crate::provider::wire::retired_provider_error(retired).into(),
|
|
120
|
+
));
|
|
121
|
+
}
|
|
122
|
+
let agent_id = AgentId::new(agent_id_raw);
|
|
123
|
+
// No provider silently falls back to a legacy engine.
|
|
124
|
+
let raw_provider = agent.get("provider").and_then(Value::as_str).unwrap_or("");
|
|
125
|
+
let provider = parse_provider(raw_provider).ok_or_else(|| {
|
|
126
|
+
LifecycleError::Provider(format!("unknown worker provider {raw_provider:?}"))
|
|
127
|
+
})?;
|
|
120
128
|
let auth_mode = agent
|
|
121
129
|
.get("auth_mode")
|
|
122
130
|
.and_then(Value::as_str)
|
|
@@ -144,16 +152,12 @@ pub(super) fn spawn_agents(
|
|
|
144
152
|
.mcp_config(auth_mode)
|
|
145
153
|
.map_err(|e| LifecycleError::Provider(e.to_string()))?;
|
|
146
154
|
let mcp_config = resolve_mcp_config(mcp_config, workspace, agent_id_raw, &mcp_team_id);
|
|
147
|
-
let mcp_config_path =
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
&mcp_config,
|
|
154
|
-
Some(provider),
|
|
155
|
-
)?)
|
|
156
|
-
};
|
|
155
|
+
let mcp_config_path = write_worker_mcp_config_for_provider(
|
|
156
|
+
workspace,
|
|
157
|
+
agent_id_raw,
|
|
158
|
+
&mcp_config,
|
|
159
|
+
Some(provider),
|
|
160
|
+
)?;
|
|
157
161
|
let profile_dir = team_dir.join("profiles");
|
|
158
162
|
let profile_launch =
|
|
159
163
|
crate::lifecycle::profile_launch::prepare_provider_profile_launch_with_profile_dir(
|
|
@@ -189,30 +193,11 @@ pub(super) fn spawn_agents(
|
|
|
189
193
|
agent_id_hint: Some(agent_id_raw),
|
|
190
194
|
effort: agent_effort,
|
|
191
195
|
};
|
|
192
|
-
let mut plan =
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
workspace,
|
|
196
|
-
team_id: &mcp_team_id,
|
|
197
|
-
agent_id: agent_id_raw,
|
|
198
|
-
model: command_model,
|
|
199
|
-
effort: agent_effort,
|
|
200
|
-
system_prompt: &system_prompt,
|
|
201
|
-
team_mcp_tools: &["send_message", "report_result", "get_team_status"],
|
|
202
|
-
mcp_config: &mcp_config,
|
|
203
|
-
session_scope: crate::lifecycle::launch::pi_mcp::PiSessionScope::Isolated,
|
|
204
|
-
},
|
|
205
|
-
)
|
|
206
|
-
.map_err(|e| LifecycleError::Provider(e.to_string()))?
|
|
207
|
-
} else {
|
|
208
|
-
adapter
|
|
209
|
-
.build_command_plan(command_context)
|
|
210
|
-
.map_err(|e| LifecycleError::Provider(e.to_string()))?
|
|
211
|
-
};
|
|
196
|
+
let mut plan = adapter
|
|
197
|
+
.build_command_plan(command_context)
|
|
198
|
+
.map_err(|e| LifecycleError::Provider(e.to_string()))?;
|
|
212
199
|
if !plan.managed_mcp_config && !profile_launch.managed_mcp_config {
|
|
213
|
-
|
|
214
|
-
point_native_mcp_config_at_file(&mut plan.argv, provider, mcp_config_path);
|
|
215
|
-
}
|
|
200
|
+
point_native_mcp_config_at_file(&mut plan.argv, provider, &mcp_config_path);
|
|
216
201
|
}
|
|
217
202
|
// C-A-4 cr verdict v2 — Copilot BYOK(compatible_api)硬性校验:
|
|
218
203
|
// "A model is required for BYOK"(help-providers 原文)。检查 agent
|
|
@@ -328,11 +313,6 @@ pub(super) fn spawn_agents(
|
|
|
328
313
|
);
|
|
329
314
|
}
|
|
330
315
|
}
|
|
331
|
-
// Grok 无 --mcp-config;写 <cwd>/.grok/config.toml 让 CLI 读到 team-agent。
|
|
332
|
-
if matches!(provider, Provider::Grok) {
|
|
333
|
-
ensure_grok_login_and_folder_trust(workspace)?;
|
|
334
|
-
apply_grok_mcp_overlay(workspace, &mcp_config)?;
|
|
335
|
-
}
|
|
336
316
|
crate::provider::argv_route::apply(provider, &mut plan.argv)
|
|
337
317
|
.map_err(|error| LifecycleError::Provider(error.to_string()))?;
|
|
338
318
|
let spawn_epoch = u64::try_from(started.len()).unwrap_or(u64::MAX);
|
|
@@ -410,11 +390,6 @@ pub(super) fn spawn_agents(
|
|
|
410
390
|
30,
|
|
411
391
|
0.5,
|
|
412
392
|
);
|
|
413
|
-
// Python launch/core.py:235-237 — runtime.fast toggles the provider's fast mode
|
|
414
|
-
// after spawn; provider specifics live behind the adapter (F032).
|
|
415
|
-
if runtime_fast {
|
|
416
|
-
let _ = adapter.enable_fast_mode(transport, &Target::Pane(spawn.pane_id.clone()));
|
|
417
|
-
}
|
|
418
393
|
if matches!(transport.liveness(&spawn.pane_id), Ok(PaneLiveness::Dead)) {
|
|
419
394
|
continue;
|
|
420
395
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//! contract:
|
|
4
4
|
//! provides:
|
|
5
5
|
//! - name: fork_agent
|
|
6
|
-
//! what:
|
|
6
|
+
//! what: 成员分身入口;legacy 席位一律拒绝,新席位 fork 只走 contract 管道
|
|
7
7
|
//! boundary:
|
|
8
8
|
//! - 不读 provider 会话落盘
|
|
9
9
|
//! maturity: wired
|
|
@@ -23,15 +23,6 @@ use crate::transport::{PaneId, SessionName, Target, Transport, WindowName};
|
|
|
23
23
|
|
|
24
24
|
use crate::lifecycle::lock::{acquire_agent_lifecycle_lock, LifecycleLockRequest};
|
|
25
25
|
|
|
26
|
-
#[derive(Clone, Debug)]
|
|
27
|
-
pub(crate) struct ForkCaptureSeed {
|
|
28
|
-
pub source_agent_id: AgentId,
|
|
29
|
-
pub captured: crate::provider::CapturedSession,
|
|
30
|
-
pub captured_at: String,
|
|
31
|
-
pub pi_sessions_root: PathBuf,
|
|
32
|
-
pub profile_dir: PathBuf,
|
|
33
|
-
}
|
|
34
|
-
|
|
35
26
|
use super::*;
|
|
36
27
|
|
|
37
28
|
// ── lifecycle::launch —— 冷启 / quick-start / 危险审批探测 ──────────────────
|
|
@@ -343,37 +334,15 @@ pub(crate) use agent_state::{
|
|
|
343
334
|
persist_effective_approval_policy_from_agent,
|
|
344
335
|
};
|
|
345
336
|
|
|
346
|
-
mod grok_per_seat;
|
|
347
|
-
pub(crate) use grok_per_seat::{
|
|
348
|
-
is_per_seat_env_key, non_per_seat_env_in_tables, per_seat_keys_in_toml,
|
|
349
|
-
strip_per_seat_keys_from_toml,
|
|
350
|
-
};
|
|
351
|
-
|
|
352
337
|
mod mcp_config;
|
|
353
|
-
pub use mcp_config::apply_grok_mcp_overlay;
|
|
354
338
|
pub(super) use mcp_config::*;
|
|
355
339
|
pub(crate) use mcp_config::{
|
|
356
|
-
|
|
357
|
-
reconcile_grok_toml_per_seat_keys, resolve_mcp_config, write_worker_mcp_config,
|
|
340
|
+
point_native_mcp_config_at_file, resolve_mcp_config, write_worker_mcp_config,
|
|
358
341
|
write_worker_mcp_config_for_provider,
|
|
359
342
|
};
|
|
360
343
|
|
|
361
344
|
pub(crate) mod pi_mcp;
|
|
362
345
|
|
|
363
|
-
pub(crate) fn run_pi_catalog_preflight(
|
|
364
|
-
agents_dir: &std::path::Path,
|
|
365
|
-
discover: &mut dyn FnMut(&str) -> Result<Vec<String>, ()>,
|
|
366
|
-
) -> Result<(), crate::lifecycle::LifecycleError> {
|
|
367
|
-
crate::compiler::preflight_pi_models_in_team_with(agents_dir, discover).map_err(|error| {
|
|
368
|
-
crate::lifecycle::LifecycleError::PiModelPreflight {
|
|
369
|
-
requested: error.requested,
|
|
370
|
-
candidates: error.candidates,
|
|
371
|
-
action: error.action,
|
|
372
|
-
not_ready: error.not_ready,
|
|
373
|
-
}
|
|
374
|
-
})
|
|
375
|
-
}
|
|
376
|
-
|
|
377
346
|
mod worker_env;
|
|
378
347
|
pub(super) use worker_env::*;
|
|
379
348
|
pub(crate) use worker_env::{
|
|
@@ -441,7 +410,7 @@ pub(super) use add_agent_state::*;
|
|
|
441
410
|
|
|
442
411
|
mod fork_agent;
|
|
443
412
|
pub(super) use fork_agent::*;
|
|
444
|
-
pub use fork_agent::
|
|
413
|
+
pub use fork_agent::fork_agent_with_transport;
|
|
445
414
|
|
|
446
415
|
mod fork_entry;
|
|
447
416
|
pub use fork_entry::fork_agent;
|