@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
|
@@ -348,114 +348,6 @@ pub struct CompiledRole {
|
|
|
348
348
|
pub agent: Value,
|
|
349
349
|
}
|
|
350
350
|
|
|
351
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
352
|
-
pub struct PiModelPreflightError {
|
|
353
|
-
pub requested: String,
|
|
354
|
-
pub candidates: Vec<String>,
|
|
355
|
-
pub action: String,
|
|
356
|
-
pub not_ready: bool,
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
impl std::fmt::Display for PiModelPreflightError {
|
|
360
|
-
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
361
|
-
write!(
|
|
362
|
-
formatter,
|
|
363
|
-
"Pi role model {:?} is not a qualified exact model",
|
|
364
|
-
self.requested
|
|
365
|
-
)
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
/// Shared admission gate: omitted and qualified models pass; only an
|
|
370
|
-
/// unqualified present model causes one bounded catalog observation.
|
|
371
|
-
pub fn preflight_pi_role_model(meta: &Value) -> Result<(), PiModelPreflightError> {
|
|
372
|
-
preflight_pi_role_model_with(meta, |requested| {
|
|
373
|
-
crate::lifecycle::launch::pi_mcp::pi_model_candidates(requested).map_err(|_| ())
|
|
374
|
-
})
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
pub fn preflight_pi_role_model_with<F>(
|
|
378
|
-
meta: &Value,
|
|
379
|
-
mut discover: F,
|
|
380
|
-
) -> Result<(), PiModelPreflightError>
|
|
381
|
-
where
|
|
382
|
-
F: FnMut(&str) -> Result<Vec<String>, ()>,
|
|
383
|
-
{
|
|
384
|
-
if parse_canonical_provider(meta.get("provider").and_then(Value::as_str).unwrap_or(""))
|
|
385
|
-
!= Some(Provider::Pi)
|
|
386
|
-
{
|
|
387
|
-
return Ok(());
|
|
388
|
-
}
|
|
389
|
-
let Some(model) = string_field(meta, "model").filter(|value| !value.trim().is_empty()) else {
|
|
390
|
-
return Ok(());
|
|
391
|
-
};
|
|
392
|
-
let requested = model.trim().to_string();
|
|
393
|
-
if requested.split_once('/').is_some_and(|(provider, name)| {
|
|
394
|
-
!provider.is_empty() && !name.is_empty() && !requested.contains('*')
|
|
395
|
-
}) {
|
|
396
|
-
return Ok(());
|
|
397
|
-
}
|
|
398
|
-
let (candidates, not_ready) = match discover(&requested) {
|
|
399
|
-
Ok(candidates) => (candidates, false),
|
|
400
|
-
Err(()) => (Vec::new(), true),
|
|
401
|
-
};
|
|
402
|
-
let action = if candidates.is_empty() {
|
|
403
|
-
format!("run `team-agent models --provider pi --search {requested}`")
|
|
404
|
-
} else {
|
|
405
|
-
format!("copy a candidate into the role, or run `team-agent models --provider pi --search {requested}`")
|
|
406
|
-
};
|
|
407
|
-
Err(PiModelPreflightError {
|
|
408
|
-
requested,
|
|
409
|
-
candidates,
|
|
410
|
-
action,
|
|
411
|
-
not_ready,
|
|
412
|
-
})
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
pub fn preflight_pi_models_in_team(team_dir: &Path) -> Result<(), PiModelPreflightError> {
|
|
416
|
-
preflight_pi_models_in_team_with(team_dir, |requested| {
|
|
417
|
-
crate::lifecycle::launch::pi_mcp::pi_model_candidates(requested).map_err(|_| ())
|
|
418
|
-
})
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
pub fn preflight_pi_models_in_team_with<F>(
|
|
422
|
-
team_dir: &Path,
|
|
423
|
-
mut discover: F,
|
|
424
|
-
) -> Result<(), PiModelPreflightError>
|
|
425
|
-
where
|
|
426
|
-
F: FnMut(&str) -> Result<Vec<String>, ()>,
|
|
427
|
-
{
|
|
428
|
-
let agents_dir = team_dir.join("agents");
|
|
429
|
-
let entries = match std::fs::read_dir(&agents_dir) {
|
|
430
|
-
Ok(entries) => entries,
|
|
431
|
-
Err(error) if error.kind() == std::io::ErrorKind::NotFound => return Ok(()),
|
|
432
|
-
Err(_) => {
|
|
433
|
-
return Err(PiModelPreflightError {
|
|
434
|
-
requested: "<role directory>".into(),
|
|
435
|
-
candidates: Vec::new(),
|
|
436
|
-
action: "repair the role directory and retry".into(),
|
|
437
|
-
not_ready: true,
|
|
438
|
-
})
|
|
439
|
-
}
|
|
440
|
-
};
|
|
441
|
-
let mut paths = entries
|
|
442
|
-
.filter_map(Result::ok)
|
|
443
|
-
.map(|entry| entry.path())
|
|
444
|
-
.filter(|path| path.extension().and_then(|ext| ext.to_str()) == Some("md"))
|
|
445
|
-
.collect::<Vec<_>>();
|
|
446
|
-
paths.sort();
|
|
447
|
-
for path in paths {
|
|
448
|
-
let (meta, _) = read_front_matter(&path).map_err(|_| PiModelPreflightError {
|
|
449
|
-
requested: path.display().to_string(),
|
|
450
|
-
candidates: Vec::new(),
|
|
451
|
-
action: "repair the role document and retry".into(),
|
|
452
|
-
not_ready: true,
|
|
453
|
-
})?;
|
|
454
|
-
preflight_pi_role_model_with(&meta, &mut discover)?;
|
|
455
|
-
}
|
|
456
|
-
Ok(())
|
|
457
|
-
}
|
|
458
|
-
|
|
459
351
|
/// 把一份 role 文档编译成 agent spec 条目。`team_meta` 供 model/auth_mode 继承;
|
|
460
352
|
/// `workspace_s` 是 working_directory。**纯读 `role_path`,无任何文件落地。**
|
|
461
353
|
pub fn compile_role_agent(
|
|
@@ -494,9 +386,31 @@ fn compile_role_agent_with_mode(
|
|
|
494
386
|
let provider = string_field(&meta, "provider")
|
|
495
387
|
.filter(|provider| !provider.trim().is_empty())
|
|
496
388
|
.unwrap_or_else(|| "pi".to_string());
|
|
497
|
-
|
|
389
|
+
// An exact boolean opt-in; a bare shared key (codex) keeps its legacy meaning.
|
|
390
|
+
let contract_runtime = match meta.get("contract_runtime") {
|
|
391
|
+
None => false,
|
|
392
|
+
Some(Value::Bool(value)) => *value,
|
|
393
|
+
Some(_) => {
|
|
394
|
+
return Err(ModelError::Validation(format!(
|
|
395
|
+
"{}: contract_runtime must be a boolean",
|
|
396
|
+
role_path.display()
|
|
397
|
+
)))
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
#[cfg(unix)]
|
|
401
|
+
let contract = crate::contract_runtime::registry::declared(&provider, contract_runtime);
|
|
402
|
+
#[cfg(not(unix))]
|
|
403
|
+
let contract: Option<()> = None;
|
|
404
|
+
if contract_runtime && contract.is_none() {
|
|
405
|
+
return Err(ModelError::Validation(format!(
|
|
406
|
+
"{}: contract_runtime: true requires a contract provider (got {provider})",
|
|
407
|
+
role_path.display()
|
|
408
|
+
)));
|
|
409
|
+
}
|
|
410
|
+
// The compiled spec and state carry the leaf's canonical id, so legacy
|
|
411
|
+
// readers of a shared key never mistake this seat for a legacy one.
|
|
498
412
|
#[cfg(unix)]
|
|
499
|
-
let
|
|
413
|
+
let provider = contract.map_or(provider, |descriptor| descriptor.identity.id.to_string());
|
|
500
414
|
#[cfg(unix)]
|
|
501
415
|
let contract_role = contract.is_some();
|
|
502
416
|
#[cfg(not(unix))]
|
|
@@ -506,7 +420,6 @@ fn compile_role_agent_with_mode(
|
|
|
506
420
|
contract.is_some_and(|descriptor| !descriptor.effort.inherit_team_default);
|
|
507
421
|
#[cfg(not(unix))]
|
|
508
422
|
let skip_team_effort = false;
|
|
509
|
-
validate_pi_role_fields(&meta, role_path, &provider)?;
|
|
510
423
|
let model = string_field(&meta, "model")
|
|
511
424
|
.filter(|value| !value.trim().is_empty())
|
|
512
425
|
.map(Value::Str)
|
|
@@ -514,12 +427,6 @@ fn compile_role_agent_with_mode(
|
|
|
514
427
|
let auth_mode = string_field(&meta, "auth_mode")
|
|
515
428
|
.or_else(|| string_field(team_meta, "default_auth_mode"))
|
|
516
429
|
.unwrap_or_else(|| "subscription".to_string());
|
|
517
|
-
if is_pi && auth_mode != "subscription" {
|
|
518
|
-
return Err(ModelError::Validation(format!(
|
|
519
|
-
"{}: Pi roles support subscription auth_mode only",
|
|
520
|
-
role_path.display()
|
|
521
|
-
)));
|
|
522
|
-
}
|
|
523
430
|
if auth_mode != "subscription" && meta.get("profile").is_none() {
|
|
524
431
|
return Err(ModelError::Validation(format!(
|
|
525
432
|
"{}: profile is required when auth_mode is '{auth_mode}'",
|
|
@@ -565,8 +472,9 @@ fn compile_role_agent_with_mode(
|
|
|
565
472
|
if let Some(profile) = string_field(&meta, "profile") {
|
|
566
473
|
agent_items.push(("profile", Value::Str(profile)));
|
|
567
474
|
}
|
|
568
|
-
// Role effort wins;
|
|
569
|
-
//
|
|
475
|
+
// Role effort wins; a contract leaf that does not inherit the team default
|
|
476
|
+
// uses only an explicit role value. Legacy providers may inherit TEAM
|
|
477
|
+
// provider_effort for Issue #238 compatibility.
|
|
570
478
|
let role_effort = match string_field(&meta, "effort") {
|
|
571
479
|
Some(raw) if !raw.trim().is_empty() => {
|
|
572
480
|
let value = raw.trim();
|
|
@@ -584,7 +492,7 @@ fn compile_role_agent_with_mode(
|
|
|
584
492
|
Some(raw) if !raw.trim().is_empty() => ProviderEffort::parse(raw.trim()),
|
|
585
493
|
_ => None,
|
|
586
494
|
};
|
|
587
|
-
let resolved_effort = if
|
|
495
|
+
let resolved_effort = if skip_team_effort {
|
|
588
496
|
role_effort
|
|
589
497
|
} else {
|
|
590
498
|
role_effort.or(team_effort)
|
|
@@ -682,27 +590,6 @@ fn string_field(meta: &Value, key: &str) -> Option<String> {
|
|
|
682
590
|
.map(ToString::to_string)
|
|
683
591
|
}
|
|
684
592
|
|
|
685
|
-
fn validate_pi_role_fields(meta: &Value, path: &Path, provider: &str) -> Result<(), ModelError> {
|
|
686
|
-
if parse_canonical_provider(provider) != Some(Provider::Pi) {
|
|
687
|
-
return Ok(());
|
|
688
|
-
}
|
|
689
|
-
if let Some(model) = string_field(meta, "model").filter(|value| !value.trim().is_empty()) {
|
|
690
|
-
let (catalog, name) = model.trim().split_once('/').ok_or_else(|| {
|
|
691
|
-
ModelError::Validation(format!(
|
|
692
|
-
"{}: Pi roles require a qualified exact model such as provider/model",
|
|
693
|
-
path.display()
|
|
694
|
-
))
|
|
695
|
-
})?;
|
|
696
|
-
if catalog.is_empty() || name.is_empty() || model.contains('*') {
|
|
697
|
-
return Err(ModelError::Validation(format!(
|
|
698
|
-
"{}: Pi roles require a qualified exact model",
|
|
699
|
-
path.display()
|
|
700
|
-
)));
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
Ok(())
|
|
704
|
-
}
|
|
705
|
-
|
|
706
593
|
fn optional_dangerously_skip_permissions(meta: &Value) -> bool {
|
|
707
594
|
match meta.get("dangerously_skip_permissions") {
|
|
708
595
|
Some(Value::Bool(value)) => *value,
|
|
@@ -731,69 +618,6 @@ fn int_field(meta: &Value, key: &str, default: i64) -> Value {
|
|
|
731
618
|
}
|
|
732
619
|
}
|
|
733
620
|
|
|
734
|
-
#[cfg(test)]
|
|
735
|
-
mod pi_preflight_tests {
|
|
736
|
-
use super::*;
|
|
737
|
-
use std::cell::Cell;
|
|
738
|
-
|
|
739
|
-
fn role(provider: &str, model: Option<&str>) -> Value {
|
|
740
|
-
let mut fields = vec![("provider".to_string(), Value::Str(provider.into()))];
|
|
741
|
-
if let Some(model) = model {
|
|
742
|
-
fields.push(("model".to_string(), Value::Str(model.into())));
|
|
743
|
-
}
|
|
744
|
-
Value::Map(fields)
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
#[test]
|
|
748
|
-
fn omitted_qualified_and_non_pi_do_not_discover() {
|
|
749
|
-
for meta in [
|
|
750
|
-
role("pi", None),
|
|
751
|
-
role("pi", Some("openai/gpt-5")),
|
|
752
|
-
role("codex", Some("gpt-5")),
|
|
753
|
-
] {
|
|
754
|
-
let calls = Cell::new(0);
|
|
755
|
-
assert!(preflight_pi_role_model_with(&meta, |_| {
|
|
756
|
-
calls.set(calls.get() + 1);
|
|
757
|
-
Ok(vec![])
|
|
758
|
-
})
|
|
759
|
-
.is_ok());
|
|
760
|
-
assert_eq!(calls.get(), 0);
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
#[test]
|
|
765
|
-
fn unqualified_discovers_once_and_projects_candidates() {
|
|
766
|
-
let calls = Cell::new(0);
|
|
767
|
-
let error = preflight_pi_role_model_with(&role("pi", Some("gpt-5.6-sol")), |requested| {
|
|
768
|
-
calls.set(calls.get() + 1);
|
|
769
|
-
assert_eq!(requested, "gpt-5.6-sol");
|
|
770
|
-
Ok(vec![
|
|
771
|
-
"openai-codex/gpt-5.6-sol".into(),
|
|
772
|
-
"azure/gpt-5.6-sol".into(),
|
|
773
|
-
])
|
|
774
|
-
})
|
|
775
|
-
.expect_err("unqualified model must fail closed");
|
|
776
|
-
assert_eq!(calls.get(), 1);
|
|
777
|
-
assert_eq!(
|
|
778
|
-
error.candidates,
|
|
779
|
-
vec!["openai-codex/gpt-5.6-sol", "azure/gpt-5.6-sol"]
|
|
780
|
-
);
|
|
781
|
-
assert!(!error.not_ready);
|
|
782
|
-
assert!(error
|
|
783
|
-
.action
|
|
784
|
-
.contains("team-agent models --provider pi --search gpt-5.6-sol"));
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
#[test]
|
|
788
|
-
fn catalog_failure_is_not_ready_without_partial_candidates() {
|
|
789
|
-
let error = preflight_pi_role_model_with(&role("pi", Some("gpt-5.6-sol")), |_| Err(()))
|
|
790
|
-
.expect_err("catalog failure must reject");
|
|
791
|
-
assert!(error.not_ready);
|
|
792
|
-
assert!(error.candidates.is_empty());
|
|
793
|
-
assert!(!error.to_string().contains("stderr"));
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
|
|
797
621
|
fn py_int_value(value: &Value) -> Option<i64> {
|
|
798
622
|
match value {
|
|
799
623
|
Value::Bool(b) => Some(if *b { 1 } else { 0 }),
|
|
@@ -225,7 +225,7 @@ fn workspace_socket(path: &Path) -> Result<Option<(u64, u64)>, BackendError> {
|
|
|
225
225
|
|
|
226
226
|
/// The selected root transport is authority; ambient TMUX is never a selector.
|
|
227
227
|
/// This runs only in the owning lifecycle action, after native F0 admission.
|
|
228
|
-
fn workspace_tmux(
|
|
228
|
+
pub(super) fn workspace_tmux(
|
|
229
229
|
binding: &Binding,
|
|
230
230
|
seat: &SeatId,
|
|
231
231
|
claim: Option<&team_agent_contract::host::transport::TargetReceipt>,
|
|
@@ -396,7 +396,7 @@ pub(super) fn adapter(
|
|
|
396
396
|
BTreeMap::new(),
|
|
397
397
|
)?.with_launch_context(binding.workspace.path.clone(), None)?)
|
|
398
398
|
}
|
|
399
|
-
fn launch_adapter(
|
|
399
|
+
pub(super) fn launch_adapter(
|
|
400
400
|
binding: &Binding,
|
|
401
401
|
identity: &InstanceIdentity,
|
|
402
402
|
provider: &ProviderId,
|
|
@@ -406,7 +406,7 @@ fn launch_adapter(
|
|
|
406
406
|
binding.workspace.path.clone(), discovered.runtime.clone(),
|
|
407
407
|
)?)
|
|
408
408
|
}
|
|
409
|
-
fn request(
|
|
409
|
+
pub(super) fn request(
|
|
410
410
|
binding: &Binding,
|
|
411
411
|
role: &RoleConfig,
|
|
412
412
|
identity: InstanceIdentity,
|
|
@@ -470,7 +470,7 @@ fn preflight_request(
|
|
|
470
470
|
discovered: &Discovery,
|
|
471
471
|
) -> Result<LaunchRequest, BackendError> {
|
|
472
472
|
let mut request = request(binding, role, identity, discovered)?;
|
|
473
|
-
if registry::provider(role.provider.as_str())
|
|
473
|
+
if matches!(registry::provider(role.provider.as_str())?, registry::NativeProvider::GrokBuild | registry::NativeProvider::Codex | registry::NativeProvider::Pi | registry::NativeProvider::Claude) {
|
|
474
474
|
// Pure H2 only: this is a proposed private path, not a filesystem receipt.
|
|
475
475
|
request.paths.cwd = team_agent_contract::contract::session::CwdIdentity {
|
|
476
476
|
path: binding.transport_root.join("workspaces").join(role.id.as_str()),
|
|
@@ -480,6 +480,22 @@ fn preflight_request(
|
|
|
480
480
|
Ok(request)
|
|
481
481
|
}
|
|
482
482
|
|
|
483
|
+
/// Providers whose native config search would otherwise inherit a Git or
|
|
484
|
+
/// project configuration ancestor. Metadata only; no body is read.
|
|
485
|
+
pub(super) fn require_private_primary(
|
|
486
|
+
selected: registry::NativeProvider,
|
|
487
|
+
cwd: &team_agent_contract::contract::session::CwdIdentity,
|
|
488
|
+
) -> Result<(), BackendError> {
|
|
489
|
+
match selected {
|
|
490
|
+
registry::NativeProvider::GrokBuild => team_agent_contract::providers::grok_build::native::require_private_primary(cwd)?,
|
|
491
|
+
registry::NativeProvider::Codex => team_agent_contract::providers::codex::launcher::require_private_primary(cwd)?,
|
|
492
|
+
registry::NativeProvider::Pi => team_agent_contract::providers::pi::launcher::require_private_primary(cwd)?,
|
|
493
|
+
registry::NativeProvider::Claude => team_agent_contract::providers::claude::launcher::require_private_primary(cwd)?,
|
|
494
|
+
registry::NativeProvider::Kiro | registry::NativeProvider::Cursor => {}
|
|
495
|
+
}
|
|
496
|
+
Ok(())
|
|
497
|
+
}
|
|
498
|
+
|
|
483
499
|
/// Team-wide native discovery/admission before the shared launcher creates any
|
|
484
500
|
/// seats (including legacy peers). Bounded read-only native commands run; no
|
|
485
501
|
/// runtime store, worker config, private socket, or worker process is created.
|
|
@@ -573,7 +589,7 @@ fn existing_start(backend: &Backend, seat: &SeatId) -> Result<Option<ExistingSta
|
|
|
573
589
|
else { ExistingStart::Committed(record) }))
|
|
574
590
|
}
|
|
575
591
|
|
|
576
|
-
fn require_candidate(binding: &Binding) -> Result<(), BackendError> {
|
|
592
|
+
pub(super) fn require_candidate(binding: &Binding) -> Result<(), BackendError> {
|
|
577
593
|
let candidate = std::env::current_exe()?.canonicalize()?;
|
|
578
594
|
if candidate != binding.candidate || fingerprint_file(&candidate, 1024 * 1024 * 1024,
|
|
579
595
|
Duration::from_secs(10))? != binding.candidate_sha256 { return Err(Error::Fence.into()); }
|
|
@@ -678,6 +694,59 @@ fn finish_receipt(backend: &mut Backend, record: OperationRecord) -> Result<Oper
|
|
|
678
694
|
Ok(Lifecycle { store: &mut backend.store, host: &mut host, io: &mut NoNewIo }.recover(&record.id)?)
|
|
679
695
|
}
|
|
680
696
|
|
|
697
|
+
/// No creation receipt, unfinished lease or seat exists for this ID.
|
|
698
|
+
pub(super) fn seat_unclaimed(backend: &Backend, seat: &SeatId) -> Result<bool, BackendError> {
|
|
699
|
+
Ok(existing_start(backend, seat)?.is_none())
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
/// Team-level forwarding peers (legacy members and the leader) that every new
|
|
703
|
+
/// native seat's framework route depends on. Shared by fresh start and fork.
|
|
704
|
+
pub(super) fn publish_framework_routes(backend: &mut Backend, members: &[MemberRoute]) -> Result<(), BackendError> {
|
|
705
|
+
let route = backend.binding.framework().route()?;
|
|
706
|
+
let mut peers: Vec<_> = members
|
|
707
|
+
.iter()
|
|
708
|
+
.filter(|member| member.runtime == RuntimeFamily::Legacy)
|
|
709
|
+
.map(
|
|
710
|
+
|member| team_agent_contract::orchestration::forward::FrameworkPeer {
|
|
711
|
+
recipient: member.id.clone(),
|
|
712
|
+
route: route.clone(),
|
|
713
|
+
provider: member.provider.clone(),
|
|
714
|
+
},
|
|
715
|
+
)
|
|
716
|
+
.collect();
|
|
717
|
+
peers.push(team_agent_contract::orchestration::forward::FrameworkPeer {
|
|
718
|
+
recipient: "leader".into(),
|
|
719
|
+
route: route.clone(),
|
|
720
|
+
provider: "framework".into(),
|
|
721
|
+
});
|
|
722
|
+
backend.store.set_framework_routes(&peers, Some(&route))?;
|
|
723
|
+
Ok(())
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
/// The native session ID a launch names before spawn, for the leaves whose
|
|
727
|
+
/// fresh session is `Preassigned`. Shared by fresh start and a native fork's child.
|
|
728
|
+
pub(super) fn preassign_session(
|
|
729
|
+
selected: registry::NativeProvider,
|
|
730
|
+
request: &mut LaunchRequest,
|
|
731
|
+
discovered: &Discovery,
|
|
732
|
+
) -> Result<(), BackendError> {
|
|
733
|
+
if selected == registry::NativeProvider::Claude {
|
|
734
|
+
// `--session-id` names the new session; derived from this proposed instance.
|
|
735
|
+
request.preassigned_session = Some(team_agent_contract::providers::claude::session_id(&request.identity));
|
|
736
|
+
}
|
|
737
|
+
if let Some(registry::NativeRuntime::Cursor(runtime)) = &discovered.runtime {
|
|
738
|
+
request.preassigned_session = Some(
|
|
739
|
+
team_agent_contract::providers::cursor::native::allocate_chat(
|
|
740
|
+
runtime, &request.paths.cwd, &mut RealCommandRunner::default(),
|
|
741
|
+
team_agent_contract::contract::hooks::ReadBounds {
|
|
742
|
+
deadline: Duration::from_secs(90), max_output_bytes: 1024 * 1024,
|
|
743
|
+
},
|
|
744
|
+
).map_err(|error| BackendError::Discovery(DiscoveryError::Catalog(error)))?,
|
|
745
|
+
);
|
|
746
|
+
}
|
|
747
|
+
Ok(())
|
|
748
|
+
}
|
|
749
|
+
|
|
681
750
|
/// Fresh startup is distinct from resume. An existing generation is never
|
|
682
751
|
/// silently replaced with a new native session.
|
|
683
752
|
pub fn start(
|
|
@@ -766,24 +835,7 @@ pub fn start(
|
|
|
766
835
|
if existing_start(&backend, &role.id)?.is_some() {
|
|
767
836
|
return Err(Error::Conflict.into());
|
|
768
837
|
}
|
|
769
|
-
|
|
770
|
-
let mut peers: Vec<_> = members
|
|
771
|
-
.iter()
|
|
772
|
-
.filter(|member| member.runtime == RuntimeFamily::Legacy)
|
|
773
|
-
.map(
|
|
774
|
-
|member| team_agent_contract::orchestration::forward::FrameworkPeer {
|
|
775
|
-
recipient: member.id.clone(),
|
|
776
|
-
route: route.clone(),
|
|
777
|
-
provider: member.provider.clone(),
|
|
778
|
-
},
|
|
779
|
-
)
|
|
780
|
-
.collect();
|
|
781
|
-
peers.push(team_agent_contract::orchestration::forward::FrameworkPeer {
|
|
782
|
-
recipient: "leader".into(),
|
|
783
|
-
route: route.clone(),
|
|
784
|
-
provider: "framework".into(),
|
|
785
|
-
});
|
|
786
|
-
backend.store.set_framework_routes(&peers, Some(&route))?;
|
|
838
|
+
publish_framework_routes(&mut backend, members)?;
|
|
787
839
|
let identity = backend.store.propose_identity(&role.id)?;
|
|
788
840
|
let server_key = selected.server_key_for(&identity)?;
|
|
789
841
|
write_role(&backend.binding, &identity, role)?;
|
|
@@ -793,19 +845,8 @@ pub fn start(
|
|
|
793
845
|
if !descriptor.workspace.shared_cwd {
|
|
794
846
|
request.paths.cwd = super::workspace::prepare(&backend.binding, &role.id)?;
|
|
795
847
|
}
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
}
|
|
799
|
-
if let Some(registry::NativeRuntime::Cursor(runtime)) = &discovered.runtime {
|
|
800
|
-
request.preassigned_session = Some(
|
|
801
|
-
team_agent_contract::providers::cursor::native::allocate_chat(
|
|
802
|
-
runtime, &request.paths.cwd, &mut RealCommandRunner::default(),
|
|
803
|
-
team_agent_contract::contract::hooks::ReadBounds {
|
|
804
|
-
deadline: Duration::from_secs(90), max_output_bytes: 1024 * 1024,
|
|
805
|
-
},
|
|
806
|
-
).map_err(|error| BackendError::Discovery(DiscoveryError::Catalog(error)))?,
|
|
807
|
-
);
|
|
808
|
-
}
|
|
848
|
+
require_private_primary(selected, &request.paths.cwd)?;
|
|
849
|
+
preassign_session(selected, &mut request, &discovered)?;
|
|
809
850
|
let resolved = resolve_launch(
|
|
810
851
|
descriptor,
|
|
811
852
|
&hooks,
|
|
@@ -942,9 +983,7 @@ pub fn prepare_resume(
|
|
|
942
983
|
binding: source, expected_source: parent.identity,
|
|
943
984
|
});
|
|
944
985
|
let selected = registry::provider(role.provider.as_str())?;
|
|
945
|
-
|
|
946
|
-
team_agent_contract::providers::grok_build::native::require_private_primary(&request.paths.cwd)?;
|
|
947
|
-
}
|
|
986
|
+
require_private_primary(selected, &request.paths.cwd)?;
|
|
948
987
|
let resolved = resolve_launch(selected.descriptor(), &hooks, &request, Some(&discovered.catalog))?;
|
|
949
988
|
validate_launch_plan(selected.descriptor(), &resolved, &adapter.plan(&resolved)?)?;
|
|
950
989
|
Ok(PreparedResume { binding: backend.binding, role, discovered, request })
|
|
@@ -1019,7 +1058,7 @@ fn role_path(binding: &Binding, identity: &InstanceIdentity) -> PathBuf {
|
|
|
1019
1058
|
"role-{}-{}.json", identity.seat.as_str(), identity.instance.as_str(),
|
|
1020
1059
|
))
|
|
1021
1060
|
}
|
|
1022
|
-
fn write_role(binding: &Binding, identity: &InstanceIdentity, role: &RoleConfig) -> Result<(), BackendError> {
|
|
1061
|
+
pub(super) fn write_role(binding: &Binding, identity: &InstanceIdentity, role: &RoleConfig) -> Result<(), BackendError> {
|
|
1023
1062
|
use std::os::unix::fs::OpenOptionsExt;
|
|
1024
1063
|
if identity.scope != binding.scope || identity.seat != role.id {
|
|
1025
1064
|
return Err(BackendError::Metadata);
|
|
@@ -99,25 +99,26 @@ fn mode(meta: &Value, path: &Path) -> Result<Option<CommunicationMode>, ConfigEr
|
|
|
99
99
|
.transpose()
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
/// `contract_runtime` is an exact boolean; a bare shared key stays legacy.
|
|
103
|
+
fn opted_in(meta: &Value, path: &Path) -> Result<bool, ConfigError> {
|
|
104
|
+
match meta.get("contract_runtime") {
|
|
105
|
+
None => Ok(false),
|
|
106
|
+
Some(Value::Bool(value)) => Ok(*value),
|
|
107
|
+
_ => Err(invalid(path, "contract_runtime")),
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
102
111
|
/// A malformed explicit contract header cannot fall back to the default Pi worker.
|
|
103
112
|
fn malformed_contract_header(body: &str) -> bool {
|
|
104
113
|
body.strip_prefix("---\n").is_some_and(|header| {
|
|
105
|
-
header
|
|
114
|
+
let fields: Vec<(&str, &str)> = header
|
|
106
115
|
.lines()
|
|
107
116
|
.take_while(|line| *line != "---")
|
|
108
|
-
.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
.split('#')
|
|
114
|
-
.next()
|
|
115
|
-
.unwrap_or("")
|
|
116
|
-
.trim()
|
|
117
|
-
.trim_matches(['\'', '"']),
|
|
118
|
-
)
|
|
119
|
-
})
|
|
120
|
-
})
|
|
117
|
+
.filter_map(|line| line.split_once(':'))
|
|
118
|
+
.map(|(key, value)| (key.trim(), value.split('#').next().unwrap_or("").trim().trim_matches(['\'', '"'])))
|
|
119
|
+
.collect();
|
|
120
|
+
let opted_in = fields.iter().any(|(key, value)| *key == "contract_runtime" && *value == "true");
|
|
121
|
+
opted_in || fields.iter().any(|(key, value)| *key == "provider" && super::registry::recognizes(value, false))
|
|
121
122
|
})
|
|
122
123
|
}
|
|
123
124
|
|
|
@@ -177,13 +178,22 @@ fn read_team_inner(
|
|
|
177
178
|
};
|
|
178
179
|
let (meta, body) = split_front_matter(&raw);
|
|
179
180
|
let normalized = raw.replace("\r\n", "\n").replace('\r', "\n");
|
|
180
|
-
|
|
181
|
+
// Only an unparsed header loses both keys; an omitted provider is the default `pi`.
|
|
182
|
+
if meta.get("provider").is_none()
|
|
183
|
+
&& meta.get("contract_runtime").is_none()
|
|
184
|
+
&& malformed_contract_header(&normalized)
|
|
185
|
+
{
|
|
181
186
|
return Err(invalid(&path, "front matter"));
|
|
182
187
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
.
|
|
188
|
+
let opted = opted_in(&meta, &path)?;
|
|
189
|
+
// An omitted provider is the default `pi`, which declares the Pi leaf.
|
|
190
|
+
if opted
|
|
191
|
+
|| match meta.get("provider") {
|
|
192
|
+
None | Some(Value::Null) => true,
|
|
193
|
+
Some(provider) => provider
|
|
194
|
+
.as_str()
|
|
195
|
+
.is_some_and(|provider| super::registry::recognizes(provider, false)),
|
|
196
|
+
}
|
|
187
197
|
{
|
|
188
198
|
selected = true;
|
|
189
199
|
}
|
|
@@ -247,9 +257,15 @@ fn read_team_inner(
|
|
|
247
257
|
if !ids.insert(id.clone()) {
|
|
248
258
|
return Err(invalid(&source, "duplicate agent id"));
|
|
249
259
|
}
|
|
260
|
+
// `leader` is the framework's own forwarding route. A role of that name
|
|
261
|
+
// on either runtime would shadow it, so refuse before any seat spawns.
|
|
262
|
+
if id == "leader" {
|
|
263
|
+
return Err(invalid(&source, "reserved worker id"));
|
|
264
|
+
}
|
|
250
265
|
let provider = text(&meta, "provider", &source)?.unwrap_or_else(|| "pi".into());
|
|
251
|
-
let
|
|
252
|
-
|
|
266
|
+
let opted = opted_in(&meta, &source)?;
|
|
267
|
+
let registration = super::registry::declared(&provider, opted);
|
|
268
|
+
if registration.is_none() && (opted || super::registry::recognizes(&provider, false)) {
|
|
253
269
|
return Err(invalid(&source, "provider"));
|
|
254
270
|
}
|
|
255
271
|
let runtime = if registration.is_some() {
|
|
@@ -269,9 +285,6 @@ fn read_team_inner(
|
|
|
269
285
|
let provider =
|
|
270
286
|
ProviderId::new(registration.identity.id).map_err(|_| invalid(&source, "provider"))?;
|
|
271
287
|
let id = SeatId::new(id).map_err(|_| invalid(&source, "agent id"))?;
|
|
272
|
-
if id.as_str() == "leader" {
|
|
273
|
-
return Err(invalid(&source, "reserved worker id"));
|
|
274
|
-
}
|
|
275
288
|
if text(&meta, "auth_mode", &source)?.is_some_and(|value| value != "subscription")
|
|
276
289
|
|| text(&meta, "profile", &source)?.is_some()
|
|
277
290
|
{
|
|
@@ -4,8 +4,11 @@ use std::path::{Path, PathBuf};
|
|
|
4
4
|
use team_agent_contract::contract::{hooks::*, plan::CatalogObservation, types::*};
|
|
5
5
|
use team_agent_contract::host::{command::{PublicCommand, RealCommandRunner}, process::resolve_cwd};
|
|
6
6
|
use team_agent_contract::kiro::native as kiro;
|
|
7
|
+
use team_agent_contract::providers::claude::{catalog as claude_catalog, launcher as claude};
|
|
8
|
+
use team_agent_contract::providers::codex::{catalog as codex_catalog, launcher as codex};
|
|
7
9
|
use team_agent_contract::providers::cursor::native as cursor;
|
|
8
10
|
use team_agent_contract::providers::grok_build::native as grok;
|
|
11
|
+
use team_agent_contract::providers::pi::{catalog as pi_catalog, launcher as pi};
|
|
9
12
|
use thiserror::Error;
|
|
10
13
|
|
|
11
14
|
use super::registry::{self, NativeProvider, NativeRuntime};
|
|
@@ -22,6 +25,12 @@ pub enum DiscoveryError {
|
|
|
22
25
|
CursorProbe(#[from] cursor::ProbeError),
|
|
23
26
|
#[error("native Grok launcher probe failed: {0}")]
|
|
24
27
|
GrokProbe(#[from] grok::ProbeError),
|
|
28
|
+
#[error("native Codex launcher probe failed: {0}")]
|
|
29
|
+
CodexProbe(#[from] codex_catalog::ProbeError),
|
|
30
|
+
#[error("native Pi launcher probe failed: {0}")]
|
|
31
|
+
PiProbe(#[from] pi_catalog::ProbeError),
|
|
32
|
+
#[error("native Claude launcher probe failed: {0}")]
|
|
33
|
+
ClaudeProbe(#[from] claude_catalog::ProbeError),
|
|
25
34
|
#[error("native discovery contract: {0:?}")]
|
|
26
35
|
Contract(ContractError),
|
|
27
36
|
#[error("native model discovery: {0:?}")]
|
|
@@ -76,6 +85,9 @@ pub fn discover(provider: &ProviderId, workspace: &Path) -> Result<Discovery, Di
|
|
|
76
85
|
NativeProvider::Kiro => kiro::probe_launcher(&command, &mut RealCommandRunner::default(), bounds)?,
|
|
77
86
|
NativeProvider::Cursor => cursor::probe_launcher(&command, &mut RealCommandRunner::default(), bounds)?,
|
|
78
87
|
NativeProvider::GrokBuild => grok::probe_launcher(&command, &mut RealCommandRunner::default(), bounds)?,
|
|
88
|
+
NativeProvider::Codex => codex_catalog::probe_launcher(&command, &mut RealCommandRunner::default(), bounds)?,
|
|
89
|
+
NativeProvider::Pi => pi_catalog::probe_launcher(&command, &mut RealCommandRunner::default(), bounds)?,
|
|
90
|
+
NativeProvider::Claude => claude_catalog::probe_launcher(&command, &mut RealCommandRunner::default(), bounds)?,
|
|
79
91
|
};
|
|
80
92
|
let request = CatalogRequest {
|
|
81
93
|
provider: ProviderId::new(descriptor.identity.id).map_err(DiscoveryError::Contract)?,
|
|
@@ -110,6 +122,21 @@ pub fn discover(provider: &ProviderId, workspace: &Path) -> Result<Discovery, Di
|
|
|
110
122
|
.map_err(DiscoveryError::Contract)?;
|
|
111
123
|
catalog_hook.discover(&request, &mut host)
|
|
112
124
|
}
|
|
125
|
+
NativeProvider::Codex => {
|
|
126
|
+
let mut host = codex_catalog::NativeCatalog::new(request.clone(), RealCommandRunner::default())
|
|
127
|
+
.map_err(DiscoveryError::Contract)?;
|
|
128
|
+
catalog_hook.discover(&request, &mut host)
|
|
129
|
+
}
|
|
130
|
+
NativeProvider::Pi => {
|
|
131
|
+
let mut host = pi_catalog::NativeCatalog::new(request.clone(), RealCommandRunner::default())
|
|
132
|
+
.map_err(DiscoveryError::Contract)?;
|
|
133
|
+
catalog_hook.discover(&request, &mut host)
|
|
134
|
+
}
|
|
135
|
+
NativeProvider::Claude => {
|
|
136
|
+
let mut host = claude_catalog::NativeCatalog::new(request.clone(), RealCommandRunner::default())
|
|
137
|
+
.map_err(DiscoveryError::Contract)?;
|
|
138
|
+
catalog_hook.discover(&request, &mut host)
|
|
139
|
+
}
|
|
113
140
|
}.map_err(DiscoveryError::Catalog)?;
|
|
114
141
|
let result = Discovery { engine: command.entry.clone(), command, native, catalog, runtime: None };
|
|
115
142
|
validate_catalog(provider, &result).map_err(DiscoveryError::Contract)?;
|
|
@@ -131,6 +158,12 @@ pub(super) fn discover_runtime(provider: &ProviderId, workspace: &Path) -> Resul
|
|
|
131
158
|
cursor::probe_runtime(&discovery.command, &home()?, &mut RealCommandRunner::default(), bounds)?),
|
|
132
159
|
NativeProvider::GrokBuild => NativeRuntime::GrokBuild(
|
|
133
160
|
grok::probe_runtime(&discovery.command, &home()?, &mut RealCommandRunner::default(), bounds)?),
|
|
161
|
+
NativeProvider::Codex => NativeRuntime::Codex(
|
|
162
|
+
codex::probe_runtime(&discovery.command, &home()?, &mut RealCommandRunner::default(), bounds)?),
|
|
163
|
+
NativeProvider::Pi => NativeRuntime::Pi(
|
|
164
|
+
pi::probe_runtime(&discovery.command, &home()?, &mut RealCommandRunner::default(), bounds)?),
|
|
165
|
+
NativeProvider::Claude => NativeRuntime::Claude(
|
|
166
|
+
claude::probe_runtime(&discovery.command, &home()?, &mut RealCommandRunner::default(), bounds)?),
|
|
134
167
|
};
|
|
135
168
|
discovery.catalog = runtime.bind_catalog(&discovery.catalog).map_err(DiscoveryError::Contract)?;
|
|
136
169
|
discovery.engine = runtime.engine().clone();
|