@team-agent/installer 0.5.127 → 0.5.128
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/README.md +11 -0
- package/crates/team-agent/src/cli/adapters.rs +3 -13
- package/crates/team-agent/src/cli/arguments.rs +4 -0
- package/crates/team-agent/src/cli/diagnose.rs +68 -22
- package/crates/team-agent/src/cli/emit.rs +58 -26
- package/crates/team-agent/src/cli/intent/runtime.rs +32 -5
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +102 -11
- package/crates/team-agent/src/cli/intent/tests.rs +10 -12
- package/crates/team-agent/src/cli/intent.rs +1 -1
- package/crates/team-agent/src/cli/mod.rs +25 -8
- package/crates/team-agent/src/cli/models.rs +764 -7
- package/crates/team-agent/src/cli/schedule.rs +175 -0
- package/crates/team-agent/src/cli/send/persist.rs +0 -36
- package/crates/team-agent/src/cli/send/presentation.rs +1 -1
- package/crates/team-agent/src/cli/send.rs +108 -110
- package/crates/team-agent/src/cli/spec.rs +6 -0
- package/crates/team-agent/src/cli/status_port/brief.rs +5 -67
- package/crates/team-agent/src/cli/tests/leader_watch.rs +12 -62
- package/crates/team-agent/src/cli/tests/mod.rs +1 -1
- package/crates/team-agent/src/cli/tests/named_address.rs +11 -10
- package/crates/team-agent/src/cli/tests/run_delegation.rs +9 -6
- package/crates/team-agent/src/cli/tests/status_send.rs +68 -271
- package/crates/team-agent/src/compiler/tests.rs +3 -18
- package/crates/team-agent/src/compiler.rs +205 -6
- package/crates/team-agent/src/contract_runtime/backend.rs +145 -11
- package/crates/team-agent/src/contract_runtime/commands.rs +7 -7
- package/crates/team-agent/src/contract_runtime/config.rs +26 -16
- package/crates/team-agent/src/contract_runtime/config_tests.rs +24 -4
- package/crates/team-agent/src/contract_runtime/discovery.rs +12 -1
- package/crates/team-agent/src/contract_runtime/fork.rs +3 -10
- package/crates/team-agent/src/contract_runtime/framework.rs +28 -11
- package/crates/team-agent/src/contract_runtime/mcp.rs +19 -24
- package/crates/team-agent/src/contract_runtime/prompt.rs +2 -2
- package/crates/team-agent/src/contract_runtime/registry.rs +56 -92
- package/crates/team-agent/src/coordinator/steps/abnormal.rs +11 -11
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +16 -54
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +42 -0
- package/crates/team-agent/src/coordinator/tick.rs +1 -89
- package/crates/team-agent/src/db/message_store.rs +7 -65
- package/crates/team-agent/src/direct_delivery.rs +368 -0
- package/crates/team-agent/src/inbox_store.rs +169 -0
- package/crates/team-agent/src/leader/registry.rs +5 -0
- package/crates/team-agent/src/leader/start.rs +2 -1
- package/crates/team-agent/src/leader/tests/lease_api.rs +2 -2
- package/crates/team-agent/src/leader/tests/prompt_contract.rs +1 -0
- package/crates/team-agent/src/lib.rs +2 -0
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +33 -0
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +206 -1
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +28 -2
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +38 -13
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +87 -6
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +9 -1
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +351 -81
- package/crates/team-agent/src/lifecycle/launch/pi_mcp_extension.js +3 -4
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +24 -0
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +36 -13
- package/crates/team-agent/src/lifecycle/launch.rs +24 -1
- package/crates/team-agent/src/lifecycle/profile_launch.rs +321 -11
- package/crates/team-agent/src/lifecycle/restart/agent.rs +1 -0
- package/crates/team-agent/src/lifecycle/restart/avatar.rs +1798 -0
- package/crates/team-agent/src/lifecycle/restart/claude_fork.rs +163 -0
- package/crates/team-agent/src/lifecycle/restart/common.rs +345 -35
- package/crates/team-agent/src/lifecycle/restart/selection.rs +5 -5
- package/crates/team-agent/src/lifecycle/restart.rs +4 -0
- package/crates/team-agent/src/lifecycle/role_config.rs +39 -14
- package/crates/team-agent/src/lifecycle/tests/claude_compatible_config_red.rs +325 -0
- package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +320 -8
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +236 -13
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +378 -4
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +5 -4
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +7 -11
- package/crates/team-agent/src/lifecycle/tests/core.rs +47 -18
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_native_mcp_host.mjs +2 -1
- package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +14 -14
- package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +60 -20
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +28 -26
- package/crates/team-agent/src/lifecycle/tests/mcp_tool_name_format_red.rs +6 -6
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +18 -6
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +70 -52
- package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +210 -0
- package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +157 -4
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +526 -10
- package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +1419 -0
- package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +68 -1
- package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +34 -12
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +94 -2
- package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +10 -11
- 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 +254 -2
- 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 +5 -6
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +16 -7
- package/crates/team-agent/src/lifecycle/tests.rs +3 -0
- package/crates/team-agent/src/lifecycle/types.rs +18 -2
- package/crates/team-agent/src/lifecycle/worker_command_context.rs +43 -50
- package/crates/team-agent/src/mcp_server/readiness.rs +130 -149
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +98 -119
- package/crates/team-agent/src/mcp_server/tests/scoped.rs +21 -31
- package/crates/team-agent/src/mcp_server/tests/send.rs +72 -107
- package/crates/team-agent/src/mcp_server/tests/tools.rs +10 -12
- package/crates/team-agent/src/mcp_server/tools.rs +70 -196
- package/crates/team-agent/src/messaging/delivery.rs +160 -218
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +5 -5
- package/crates/team-agent/src/messaging/helpers.rs +1 -19
- package/crates/team-agent/src/messaging/mod.rs +1 -0
- package/crates/team-agent/src/messaging/reminders.rs +316 -0
- package/crates/team-agent/src/messaging/scheduler.rs +7 -1
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +191 -85
- package/crates/team-agent/src/messaging/tests/runtime.rs +4 -110
- package/crates/team-agent/src/messaging/tests/spine.rs +40 -24
- package/crates/team-agent/src/messaging/types.rs +1 -0
- package/crates/team-agent/src/provider/adapter.rs +303 -51
- package/crates/team-agent/src/provider/adapters/claude.rs +78 -0
- package/crates/team-agent/src/provider/adapters/claude_fork.rs +131 -0
- package/crates/team-agent/src/provider/adapters/mod.rs +7 -5
- package/crates/team-agent/src/provider/adapters/pi.rs +106 -0
- package/crates/team-agent/src/provider/classify.rs +1 -66
- package/crates/team-agent/src/provider/model_catalog.rs +201 -13
- package/crates/team-agent/src/provider/session/capture.rs +106 -6
- package/crates/team-agent/src/provider/session/context_fork/claude.rs +123 -0
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +4 -0
- package/crates/team-agent/src/provider/session/context_fork.rs +150 -18
- package/crates/team-agent/src/provider/session_scan/claude.rs +523 -0
- package/crates/team-agent/src/provider/session_scan/common.rs +44 -8
- package/crates/team-agent/src/provider/session_scan/pi.rs +34 -1
- package/crates/team-agent/src/provider/session_scan.rs +16 -6
- package/crates/team-agent/src/provider/tests/adapter.rs +104 -17
- package/crates/team-agent/src/provider/tests/classify.rs +0 -53
- package/crates/team-agent/src/provider/tests/command_helpers.rs +12 -3
- package/crates/team-agent/src/provider/tests/idle.rs +37 -0
- package/crates/team-agent/src/provider/wire.rs +22 -34
- 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/projection.rs +1 -1
- package/crates/team-agent/src/state/repository/tests.rs +2 -2
- package/crates/team-agent/src/test_support/models_timeout_fixture.rs +144 -0
- package/crates/team-agent/src/tmux_backend/tests.rs +0 -151
- package/crates/team-agent/src/tmux_backend.rs +5 -40
- package/package.json +4 -4
- package/skills/team-agent/SKILL.md +5 -7
- package/skills/team-agent/command-coverage.json +1 -1
- package/skills/team-agent/docs/reference/team-agent-operator.md +3 -3
- package/skills/team-agent/references/team-agent-operator.md +3 -3
|
@@ -20,10 +20,10 @@ fn fixture(ids: &[&str]) -> (Sandbox, Intent) {
|
|
|
20
20
|
(root, intent)
|
|
21
21
|
}
|
|
22
22
|
fn write_role(root: &Path, id: &str) {
|
|
23
|
-
std::fs::write(root.join("agents").join(format!("{id}.md")),format!("---\nname: {id}\nprovider:
|
|
23
|
+
std::fs::write(root.join("agents").join(format!("{id}.md")),format!("---\nname: {id}\nprovider: pi\nmodel: openai-codex/gpt-6-luna\neffort: max\ndangerously_skip_permissions: true\n---\nFixture\n")).unwrap();
|
|
24
24
|
}
|
|
25
25
|
fn install(root: &Path, ids: &[(&str, &str, bool)]) {
|
|
26
|
-
let agents:serde_json::Map<String,Value>=ids.iter().map(|(id,status,explicit)|((*id).into(),json!({"provider":"
|
|
26
|
+
let agents:serde_json::Map<String,Value>=ids.iter().map(|(id,status,explicit)|((*id).into(),json!({"provider":"pi","status":status,"explicit_stop":explicit,"pane_pid":std::process::id(),"pane_id":format!("%{id}"),"window":id}))).collect();
|
|
27
27
|
let entry = json!({"team_key":"fixture","team_dir":root,"status":"alive","session_name":"team-fixture","agents":agents,"tasks":{}});
|
|
28
28
|
let mut raw = entry.clone();
|
|
29
29
|
raw["active_team_key"] = json!("fixture");
|
|
@@ -42,6 +42,33 @@ fn install(root: &Path, ids: &[(&str, &str, bool)]) {
|
|
|
42
42
|
fn actions(plan: &Plan) -> Vec<(&str, Option<&str>)> {
|
|
43
43
|
plan.steps.iter().map(|s| (s.name(), s.agent())).collect()
|
|
44
44
|
}
|
|
45
|
+
#[test]
|
|
46
|
+
fn owned_native_reconciliation_still_allows_the_original_fenced_stop() {
|
|
47
|
+
assert_eq!(seat_actions(Verb::Stop, Observation::NativeReconcile, false, false, false, false).unwrap(), ["stop"]);
|
|
48
|
+
assert!(seat_actions(Verb::Stop, Observation::Unknown, false, false, false, false).is_err());
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
#[test]
|
|
52
|
+
#[serial_test::serial(env)]
|
|
53
|
+
fn team_start_skips_bad_native_preflight_but_explicit_target_still_refuses() {
|
|
54
|
+
let (root, intent) = fixture(&["healthy", "invalid"]);
|
|
55
|
+
std::fs::write(root.path().join("agents/invalid.md"),
|
|
56
|
+
"---\nprovider: codex\nmodel: native-model\nprofile: codex-default\n---\nInvalid native profile\n").unwrap();
|
|
57
|
+
install(root.path(), &[("healthy", "stopped", true), ("invalid", "stopped", true)]);
|
|
58
|
+
let state = crate::state::persist::runtime_state_path(root.path());
|
|
59
|
+
let mut raw: Value = serde_json::from_slice(&std::fs::read(&state).unwrap()).unwrap();
|
|
60
|
+
raw["teams"]["fixture"]["agents"]["invalid"]["provider"] = json!("codex_tui");
|
|
61
|
+
std::fs::write(&state, serde_json::to_vec(&raw).unwrap()).unwrap();
|
|
62
|
+
let before = std::fs::read(&state).unwrap();
|
|
63
|
+
let plan = plan_with_observer(intent.clone(), |_, _, _| Ok(Observation::StoppedVerified)).unwrap();
|
|
64
|
+
assert_eq!(actions(&plan), [("start_agent", Some("healthy"))]);
|
|
65
|
+
assert!(plan.skipped.iter().any(|entry| entry["agent"] == "invalid" && entry["reason"] == "preflight_blocked"));
|
|
66
|
+
let mut single = intent;
|
|
67
|
+
single.subject = Subject::Agent("invalid".into());
|
|
68
|
+
assert!(plan_with_observer(single, |_, _, _| Ok(Observation::StoppedVerified)).is_err());
|
|
69
|
+
assert_eq!(std::fs::read(&state).unwrap(), before);
|
|
70
|
+
}
|
|
71
|
+
|
|
45
72
|
#[test]
|
|
46
73
|
#[serial_test::serial(env)]
|
|
47
74
|
fn absent_source_is_one_original_create_not_restart_or_probe() {
|
|
@@ -472,14 +499,14 @@ fn preserve_rejects_known_missing_backing_before_stop_auto_uses_existing_decisio
|
|
|
472
499
|
let selected =
|
|
473
500
|
resolve_active_team_readonly(root.path(), Some("fixture"), SelectorMode::RuntimeOnly)
|
|
474
501
|
.unwrap();
|
|
475
|
-
let row = json!({"provider":"
|
|
502
|
+
let row = json!({"provider":"pi","session_id":"missing-session","rollout_path":root.path().join("missing.jsonl"),"spawn_cwd":root.path()});
|
|
476
503
|
assert!(preflight_start(&selected, "one", &row, SessionPolicy::Preserve).is_err());
|
|
477
504
|
assert!(preflight_start(&selected, "one", &row, SessionPolicy::Auto).is_ok());
|
|
478
505
|
assert!(
|
|
479
506
|
preflight_start(
|
|
480
507
|
&selected,
|
|
481
508
|
"one",
|
|
482
|
-
&json!({"provider":"
|
|
509
|
+
&json!({"provider":"pi"}),
|
|
483
510
|
SessionPolicy::Preserve
|
|
484
511
|
)
|
|
485
512
|
.is_ok(),
|
|
@@ -533,7 +560,7 @@ fn stopped_text_without_physical_identity_is_unknown_and_standalone_source_keeps
|
|
|
533
560
|
observe(
|
|
534
561
|
&selected,
|
|
535
562
|
"one",
|
|
536
|
-
&json!({"status":"stopped","provider":"
|
|
563
|
+
&json!({"status":"stopped","provider":"pi"})
|
|
537
564
|
)
|
|
538
565
|
.unwrap(),
|
|
539
566
|
Observation::Unknown
|
|
@@ -542,7 +569,7 @@ fn stopped_text_without_physical_identity_is_unknown_and_standalone_source_keeps
|
|
|
542
569
|
observe(
|
|
543
570
|
&selected,
|
|
544
571
|
"one",
|
|
545
|
-
&json!({"status":"stopped","provider":"
|
|
572
|
+
&json!({"status":"stopped","provider":"pi","pane_pid":std::process::id()})
|
|
546
573
|
)
|
|
547
574
|
.unwrap(),
|
|
548
575
|
Observation::Unknown
|
|
@@ -566,11 +593,75 @@ fn stopped_text_without_physical_identity_is_unknown_and_standalone_source_keeps
|
|
|
566
593
|
);
|
|
567
594
|
}
|
|
568
595
|
|
|
596
|
+
#[test]
|
|
597
|
+
#[cfg(unix)]
|
|
598
|
+
#[serial_test::serial(env)]
|
|
599
|
+
fn shell_supervised_claude_is_live_for_both_team_start_spellings() {
|
|
600
|
+
use std::process::Command;
|
|
601
|
+
use std::time::{Duration, Instant};
|
|
602
|
+
let (root, _) = fixture(&["one"]);
|
|
603
|
+
std::fs::write(root.path().join("agents/one.md"),
|
|
604
|
+
"---\nprovider: claude\nmodel: claude-opus-4.6\n---\nFixture\n").unwrap();
|
|
605
|
+
install(root.path(), &[("one", "running", false)]);
|
|
606
|
+
let sleep = Command::new("which").arg("sleep").output().unwrap();
|
|
607
|
+
assert!(sleep.status.success());
|
|
608
|
+
std::os::unix::fs::symlink(String::from_utf8(sleep.stdout).unwrap().trim(), root.path().join("claude")).unwrap();
|
|
609
|
+
let socket = root.path().join("t.sock");
|
|
610
|
+
struct Server(std::path::PathBuf);
|
|
611
|
+
impl Drop for Server {
|
|
612
|
+
fn drop(&mut self) { let _ = Command::new("tmux").arg("-S").arg(&self.0).arg("kill-server").output(); }
|
|
613
|
+
}
|
|
614
|
+
let _server = Server(socket.clone());
|
|
615
|
+
let output = Command::new("tmux").arg("-S").arg(&socket)
|
|
616
|
+
.args(["new-session", "-d", "-P", "-F", "#{pane_id} #{pane_pid}", "-s", "team-fixture", "-n", "one"])
|
|
617
|
+
.arg(format!("sh -c '{} 60 & wait'", root.path().join("claude").display()))
|
|
618
|
+
.output().unwrap();
|
|
619
|
+
assert!(output.status.success(), "{}", String::from_utf8_lossy(&output.stderr));
|
|
620
|
+
let pane = String::from_utf8(output.stdout).unwrap();
|
|
621
|
+
let fields: Vec<_> = pane.split_whitespace().collect();
|
|
622
|
+
let pid: u32 = fields[1].parse().unwrap();
|
|
623
|
+
let deadline = Instant::now() + Duration::from_secs(5);
|
|
624
|
+
while !launched_as_provider(pid, crate::provider::Provider::Claude) {
|
|
625
|
+
assert!(Instant::now() < deadline, "controlled Claude child did not start");
|
|
626
|
+
std::thread::sleep(Duration::from_millis(20));
|
|
627
|
+
}
|
|
628
|
+
let state = crate::state::persist::runtime_state_path(root.path());
|
|
629
|
+
let mut raw: Value = serde_json::from_slice(&std::fs::read(&state).unwrap()).unwrap();
|
|
630
|
+
raw["tmux_socket"] = json!(socket);
|
|
631
|
+
raw["teams"]["fixture"]["tmux_socket"] = json!(socket);
|
|
632
|
+
raw["teams"]["fixture"]["generation"] = json!("fixture-generation");
|
|
633
|
+
raw["teams"]["fixture"]["agents"]["one"] = json!({
|
|
634
|
+
"provider":"claude", "status":"running", "pane_id":fields[0], "pane_pid":pid, "window":"one"
|
|
635
|
+
});
|
|
636
|
+
std::fs::write(&state, serde_json::to_vec(&raw).unwrap()).unwrap();
|
|
637
|
+
let before = std::fs::read(&state).unwrap();
|
|
638
|
+
let selected = resolve_active_team_readonly(root.path(), Some("fixture"), SelectorMode::RuntimeOnly).unwrap();
|
|
639
|
+
let backend = crate::lifecycle::restart::lifecycle_worker_tmux_backend_selection_for_state(
|
|
640
|
+
&selected.run_workspace, &selected.state).unwrap().backend;
|
|
641
|
+
backend.set_session_owner_with_generation(&crate::transport::SessionName::new("team-fixture"),
|
|
642
|
+
&selected.run_workspace, "fixture", "fixture-generation").unwrap();
|
|
643
|
+
let row = &selected.state["agents"]["one"];
|
|
644
|
+
assert_eq!(observe(&selected, "one", row).unwrap(), Observation::Live);
|
|
645
|
+
for (command, values) in [
|
|
646
|
+
("team", vec!["start".into(), root.path().to_string_lossy().into_owned(), "--dry-run".into(), "--json".into()]),
|
|
647
|
+
("start", vec!["--team".into(), "fixture".into(), "--dry-run".into(), "--json".into()]),
|
|
648
|
+
] {
|
|
649
|
+
let output = super::super::run(command, &values, root.path()).unwrap().unwrap();
|
|
650
|
+
let CmdOutput::Json(value) = output.output else { panic!() };
|
|
651
|
+
assert_eq!(value["ok"], true, "{value}");
|
|
652
|
+
assert!(value["skipped"].as_array().unwrap().iter().any(|row| row["reason"] == "already_running"), "{value}");
|
|
653
|
+
}
|
|
654
|
+
let mut wrong = row.clone();
|
|
655
|
+
wrong["provider"] = json!("copilot");
|
|
656
|
+
assert_eq!(observe(&selected, "one", &wrong).unwrap(), Observation::Unknown);
|
|
657
|
+
assert_eq!(std::fs::read(state).unwrap(), before);
|
|
658
|
+
}
|
|
659
|
+
|
|
569
660
|
#[test]
|
|
570
661
|
fn declared_provider_aliases_do_not_create_false_drift_or_absorb_native_routes() {
|
|
571
662
|
assert!(same_provider("claude-code", "claude_code"));
|
|
572
663
|
assert!(!same_provider("cursor", "cursor_agent"));
|
|
573
|
-
assert!(
|
|
664
|
+
assert!(same_provider("grok_build", "grok"));
|
|
574
665
|
}
|
|
575
666
|
|
|
576
667
|
#[test]
|
|
@@ -746,7 +837,7 @@ fn preserve_context_preflight_and_corrupt_metadata_refuse_before_stop() {
|
|
|
746
837
|
json!({"task_prompt_delivered":true}),
|
|
747
838
|
json!({"last_result_at":"2026-10-19T00:00:00Z"}),
|
|
748
839
|
] {
|
|
749
|
-
let mut row = json!({"provider":"
|
|
840
|
+
let mut row = json!({"provider":"pi"});
|
|
750
841
|
row.as_object_mut()
|
|
751
842
|
.unwrap()
|
|
752
843
|
.extend(signal.as_object().unwrap().clone());
|
|
@@ -761,7 +852,7 @@ fn preserve_context_preflight_and_corrupt_metadata_refuse_before_stop() {
|
|
|
761
852
|
"first_send_at",
|
|
762
853
|
"task_prompt_delivered",
|
|
763
854
|
] {
|
|
764
|
-
let mut row = json!({"provider":"
|
|
855
|
+
let mut row = json!({"provider":"pi"});
|
|
765
856
|
row[field] = json!([]);
|
|
766
857
|
for policy in [SessionPolicy::Auto, SessionPolicy::Preserve] {
|
|
767
858
|
assert!(
|
|
@@ -774,14 +865,14 @@ fn preserve_context_preflight_and_corrupt_metadata_refuse_before_stop() {
|
|
|
774
865
|
assert!(preflight_start(
|
|
775
866
|
&selected,
|
|
776
867
|
"one",
|
|
777
|
-
&json!({"provider":"
|
|
868
|
+
&json!({"provider":"pi", "spawn_cwd":outside.path()}),
|
|
778
869
|
SessionPolicy::Auto
|
|
779
870
|
)
|
|
780
871
|
.is_err());
|
|
781
872
|
assert!(preflight_start(
|
|
782
873
|
&selected,
|
|
783
874
|
"one",
|
|
784
|
-
&json!({"provider":"
|
|
875
|
+
&json!({"provider":"pi", "session_id":"captured"}),
|
|
785
876
|
SessionPolicy::Auto
|
|
786
877
|
)
|
|
787
878
|
.is_err());
|
|
@@ -26,7 +26,7 @@ impl Drop for Sandbox {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
#[test]
|
|
29
|
-
fn
|
|
29
|
+
fn native_receipt_reconciliation_does_not_turn_start_into_stop_or_allow_restart() {
|
|
30
30
|
assert_eq!(
|
|
31
31
|
seat_actions(
|
|
32
32
|
Verb::Start,
|
|
@@ -39,17 +39,15 @@ fn native_receipt_reconciliation_is_start_only_not_implicit_stop_or_restart() {
|
|
|
39
39
|
.unwrap(),
|
|
40
40
|
vec!["start"]
|
|
41
41
|
);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
.is_err());
|
|
52
|
-
}
|
|
42
|
+
assert!(seat_actions(
|
|
43
|
+
Verb::Restart,
|
|
44
|
+
Observation::NativeReconcile,
|
|
45
|
+
false,
|
|
46
|
+
false,
|
|
47
|
+
false,
|
|
48
|
+
false
|
|
49
|
+
)
|
|
50
|
+
.is_err());
|
|
53
51
|
assert!(seat_actions(
|
|
54
52
|
Verb::Restart,
|
|
55
53
|
Observation::NativeReconcile,
|
|
@@ -658,7 +658,7 @@ fn seat_actions(
|
|
|
658
658
|
"restart requires a registered, previously started agent",
|
|
659
659
|
)),
|
|
660
660
|
(Verb::Stop, Observation::StoppedVerified | Observation::Unstarted) => Ok(vec![]),
|
|
661
|
-
(Verb::Stop, Observation::Live) => Ok(vec!["stop"]),
|
|
661
|
+
(Verb::Stop, Observation::Live | Observation::NativeReconcile) => Ok(vec!["stop"]),
|
|
662
662
|
_ => Err(refusal("unsupported lifecycle observation")),
|
|
663
663
|
}
|
|
664
664
|
}
|
|
@@ -73,6 +73,7 @@ pub mod profile;
|
|
|
73
73
|
pub(crate) mod leader_prompt;
|
|
74
74
|
pub(crate) mod route;
|
|
75
75
|
pub mod send;
|
|
76
|
+
mod schedule;
|
|
76
77
|
pub(crate) mod spec;
|
|
77
78
|
pub mod status;
|
|
78
79
|
pub(crate) mod triage;
|
|
@@ -3557,14 +3558,30 @@ pub mod lifecycle_port {
|
|
|
3557
3558
|
"fork-agent",
|
|
3558
3559
|
)?;
|
|
3559
3560
|
match crate::lifecycle::fork_agent(workspace, &source, &dest, label, true, team) {
|
|
3560
|
-
Ok(report) =>
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3561
|
+
Ok(report) => {
|
|
3562
|
+
let mut value = json!({
|
|
3563
|
+
"ok": true,
|
|
3564
|
+
"source_agent_id": report.source_agent_id.as_str(),
|
|
3565
|
+
"new_agent_id": report.new_agent_id.as_str(),
|
|
3566
|
+
"session_id": report.session_id.as_ref().map(|session| session.as_str()),
|
|
3567
|
+
"new_session_id": report.session_id.as_ref().map(|session| session.as_str()),
|
|
3568
|
+
"backing_state": report.backing_state,
|
|
3569
|
+
});
|
|
3570
|
+
if let (Some(details), Some(object)) = (report.pi_fork, value.as_object_mut()) {
|
|
3571
|
+
object.insert("status".to_string(), json!("forked"));
|
|
3572
|
+
object.insert("target".to_string(), json!(report.new_agent_id.as_str()));
|
|
3573
|
+
object.insert(
|
|
3574
|
+
"source_session_id".to_string(),
|
|
3575
|
+
json!(details.source_session_id.as_str()),
|
|
3576
|
+
);
|
|
3577
|
+
object.insert("session_id".to_string(), json!(details.session_id.as_str()));
|
|
3578
|
+
object.insert(
|
|
3579
|
+
"backing_path".to_string(),
|
|
3580
|
+
json!(details.backing_path.0.to_string_lossy().to_string()),
|
|
3581
|
+
);
|
|
3582
|
+
}
|
|
3583
|
+
Ok(value)
|
|
3584
|
+
}
|
|
3568
3585
|
Err(e) => Ok(error_value(e)),
|
|
3569
3586
|
}
|
|
3570
3587
|
}
|