@team-agent/installer 0.5.122 → 0.5.124
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 +8 -1
- package/Cargo.toml +1 -1
- package/crates/team-agent/src/cli/diagnose.rs +176 -10
- package/crates/team-agent/src/cli/intent/runtime.rs +103 -43
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +198 -0
- package/crates/team-agent/src/cli/intent/tests.rs +37 -0
- package/crates/team-agent/src/cli/intent.rs +22 -0
- package/crates/team-agent/src/cli/models.rs +54 -10
- package/crates/team-agent/src/contract_runtime/backend.rs +498 -2
- package/crates/team-agent/src/contract_runtime/commands.rs +38 -24
- package/crates/team-agent/src/contract_runtime/discovery.rs +46 -56
- package/crates/team-agent/src/contract_runtime/forward.rs +59 -0
- package/crates/team-agent/src/contract_runtime/framework.rs +23 -17
- package/crates/team-agent/src/contract_runtime/registry.rs +41 -3
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +19 -101
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +6 -17
- package/crates/team-agent/src/lifecycle/launch/quick_start_transport.rs +26 -19
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +19 -2
- package/crates/team-agent/src/lifecycle/restart/rebuild.rs +95 -31
- package/crates/team-agent/src/lifecycle/restart.rs +1 -0
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +5 -6
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +7 -5
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +1 -3
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +4 -16
- package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +1 -3
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +84 -53
- package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +19 -1
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +21 -0
- package/crates/team-agent/src/messaging/delivery.rs +5 -3
- package/crates/team-agent/src/provider/adapters/pi.rs +4 -4
- package/crates/team-agent/src/provider/session_scan/pi.rs +32 -19
- package/crates/team-agent/src/provider/tests/command_helpers.rs +2 -2
- package/crates/team-agent/src/provider/wire.rs +2 -1
- package/npm/install.mjs +56 -99
- package/package.json +4 -4
|
@@ -25,6 +25,43 @@ impl Drop for Sandbox {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
#[test]
|
|
29
|
+
fn native_receipt_reconciliation_is_start_only_not_implicit_stop_or_restart() {
|
|
30
|
+
assert_eq!(
|
|
31
|
+
seat_actions(
|
|
32
|
+
Verb::Start,
|
|
33
|
+
Observation::NativeReconcile,
|
|
34
|
+
false,
|
|
35
|
+
false,
|
|
36
|
+
false,
|
|
37
|
+
true
|
|
38
|
+
)
|
|
39
|
+
.unwrap(),
|
|
40
|
+
vec!["start"]
|
|
41
|
+
);
|
|
42
|
+
for verb in [Verb::Stop, Verb::Restart] {
|
|
43
|
+
assert!(seat_actions(
|
|
44
|
+
verb,
|
|
45
|
+
Observation::NativeReconcile,
|
|
46
|
+
false,
|
|
47
|
+
false,
|
|
48
|
+
false,
|
|
49
|
+
false
|
|
50
|
+
)
|
|
51
|
+
.is_err());
|
|
52
|
+
}
|
|
53
|
+
assert!(seat_actions(
|
|
54
|
+
Verb::Restart,
|
|
55
|
+
Observation::NativeReconcile,
|
|
56
|
+
false,
|
|
57
|
+
true,
|
|
58
|
+
false,
|
|
59
|
+
true
|
|
60
|
+
)
|
|
61
|
+
.unwrap()
|
|
62
|
+
.is_empty());
|
|
63
|
+
}
|
|
64
|
+
|
|
28
65
|
fn args(values: &[&str]) -> Vec<String> {
|
|
29
66
|
values.iter().map(|v| v.to_string()).collect()
|
|
30
67
|
}
|
|
@@ -61,10 +61,16 @@ pub(super) enum Observation {
|
|
|
61
61
|
Live,
|
|
62
62
|
StoppedVerified,
|
|
63
63
|
Unstarted,
|
|
64
|
+
NativeReconcile,
|
|
64
65
|
Unknown,
|
|
65
66
|
}
|
|
66
67
|
#[derive(Clone, Debug)]
|
|
67
68
|
pub(super) enum Step {
|
|
69
|
+
RestoreSpec {
|
|
70
|
+
workspace: PathBuf,
|
|
71
|
+
team: String,
|
|
72
|
+
compiled: crate::model::yaml::Value,
|
|
73
|
+
},
|
|
68
74
|
CreateTeam(QuickStartArgs),
|
|
69
75
|
StartAgent(StartAgentArgs),
|
|
70
76
|
AddAgent(AddAgentArgs),
|
|
@@ -75,6 +81,7 @@ pub(super) enum Step {
|
|
|
75
81
|
impl Step {
|
|
76
82
|
fn name(&self) -> &'static str {
|
|
77
83
|
match self {
|
|
84
|
+
Self::RestoreSpec { .. } => "restore_runtime_spec",
|
|
78
85
|
Self::CreateTeam(_) => "quick_start",
|
|
79
86
|
Self::StartAgent(_) => "start_agent",
|
|
80
87
|
Self::AddAgent(_) => "add_agent",
|
|
@@ -93,6 +100,21 @@ impl Step {
|
|
|
93
100
|
}
|
|
94
101
|
fn execute(&self) -> Result<CmdResult, CliError> {
|
|
95
102
|
match self {
|
|
103
|
+
Self::RestoreSpec {
|
|
104
|
+
workspace,
|
|
105
|
+
team,
|
|
106
|
+
compiled,
|
|
107
|
+
} => {
|
|
108
|
+
let path = crate::lifecycle::restart::restore_missing_runtime_spec(
|
|
109
|
+
workspace, team, compiled,
|
|
110
|
+
)
|
|
111
|
+
.map_err(|e| CliError::Runtime(e.to_string()))?;
|
|
112
|
+
Ok(CmdResult::from_json(
|
|
113
|
+
json!({"ok":true,"status":"metadata_restored","spec_path":path,
|
|
114
|
+
"effects":{"native_processes":"not_attempted","native_input":"not_attempted"}}),
|
|
115
|
+
true,
|
|
116
|
+
))
|
|
117
|
+
}
|
|
96
118
|
Self::CreateTeam(a) => cmd_quick_start(a),
|
|
97
119
|
Self::StartAgent(a) => cmd_start_agent(a),
|
|
98
120
|
Self::AddAgent(a) => cmd_add_agent(a),
|
|
@@ -399,7 +399,7 @@ mod tests {
|
|
|
399
399
|
panic!("expected JSON projection")
|
|
400
400
|
};
|
|
401
401
|
let value: Value = serde_json::from_str(&text).unwrap();
|
|
402
|
-
assert_eq!(value["ok"], true);
|
|
402
|
+
assert_eq!(value["ok"], true, "{text}");
|
|
403
403
|
assert_eq!(value["provider"], "cursor_agent");
|
|
404
404
|
assert_eq!(value["models"].as_array().unwrap().len(), 1);
|
|
405
405
|
assert_eq!(value["models"][0]["role_model"], "gpt-5.6-luna-high");
|
|
@@ -468,6 +468,33 @@ esac"#);
|
|
|
468
468
|
assert!(value["current_role_model"].is_null());
|
|
469
469
|
}
|
|
470
470
|
|
|
471
|
+
#[cfg(unix)]
|
|
472
|
+
#[test]
|
|
473
|
+
fn grok_build_contract_catalog_runs_the_public_grok_found_on_path() {
|
|
474
|
+
let program = fixture_program("grok", r#"
|
|
475
|
+
test "$#" = 1 || exit 9
|
|
476
|
+
case "$1" in
|
|
477
|
+
--version) printf '%s\n' 'grok 1.0.52 (0920c8169e27)' ;;
|
|
478
|
+
models) exec /bin/cat "$TEAM_AGENT_MODELS_FIXTURE" ;;
|
|
479
|
+
*) exit 9 ;;
|
|
480
|
+
esac"#);
|
|
481
|
+
let mut grok = CliFixture::new(program);
|
|
482
|
+
let response = grok.program.with_extension("stdout");
|
|
483
|
+
std::fs::write(&response, include_bytes!("../provider/testdata/grok-models-authenticated.stdout")).unwrap();
|
|
484
|
+
grok.response = Some(response);
|
|
485
|
+
let output = run_public_models_cli(&grok.program, grok.response.as_deref(),
|
|
486
|
+
&["models", "--provider", "grok_build", "--json"]);
|
|
487
|
+
let text = public_cli_text(&output);
|
|
488
|
+
let calls = std::fs::read_to_string(grok.program.with_extension("count")).unwrap_or_default();
|
|
489
|
+
assert!(output.status.success(), "{text}");
|
|
490
|
+
// Whatever `grok` PATH selects answers every probe; no install path is assumed.
|
|
491
|
+
assert_eq!(calls, "1:--version\n1:models\n");
|
|
492
|
+
let value: Value = serde_json::from_str(text.trim()).unwrap();
|
|
493
|
+
assert_eq!(value["provider"], "grok_build");
|
|
494
|
+
assert_eq!(value["source"]["executable"], grok.program.to_str().unwrap());
|
|
495
|
+
assert!(value["models"].as_array().unwrap().iter().any(|row| row["model_id"] == "grok-4.7-build-fast"));
|
|
496
|
+
}
|
|
497
|
+
|
|
471
498
|
#[cfg(unix)]
|
|
472
499
|
#[test]
|
|
473
500
|
fn cursor_contract_bad_version_has_no_legacy_entrypoint_fallback() {
|
|
@@ -694,7 +721,6 @@ esac"#);
|
|
|
694
721
|
|
|
695
722
|
#[cfg(unix)]
|
|
696
723
|
fn fixture_program(program: &str, body: &str) -> std::path::PathBuf {
|
|
697
|
-
use std::os::unix::fs::PermissionsExt;
|
|
698
724
|
let sequence = FIXTURE_SEQUENCE.fetch_add(1, Ordering::Relaxed);
|
|
699
725
|
let root = std::env::current_exe()
|
|
700
726
|
.unwrap()
|
|
@@ -710,17 +736,35 @@ esac"#);
|
|
|
710
736
|
));
|
|
711
737
|
std::fs::create_dir(&root).unwrap();
|
|
712
738
|
let path = root.join(program);
|
|
713
|
-
|
|
739
|
+
install_executable(
|
|
714
740
|
&path,
|
|
715
|
-
format!("#!/bin/sh\nprintf '%s\\n' \"$#:$1\" >> \"$0.count\"\n{body}\n"),
|
|
716
|
-
)
|
|
717
|
-
.unwrap();
|
|
718
|
-
let mut permissions = std::fs::metadata(&path).unwrap().permissions();
|
|
719
|
-
permissions.set_mode(0o700);
|
|
720
|
-
std::fs::set_permissions(&path, permissions).unwrap();
|
|
741
|
+
&format!("#!/bin/sh\nprintf '%s\\n' \"$#:$1\" >> \"$0.count\"\n{body}\n"),
|
|
742
|
+
);
|
|
721
743
|
path
|
|
722
744
|
}
|
|
723
745
|
|
|
746
|
+
/// Linux refuses to exec an inode still open for writing anywhere (ETXTBSY),
|
|
747
|
+
/// and a parallel test's fork can briefly inherit our write fd. Only a
|
|
748
|
+
/// short-lived `cp` ever writes the executable, so no test thread holds it.
|
|
749
|
+
#[cfg(unix)]
|
|
750
|
+
fn install_executable(path: &Path, script: &str) {
|
|
751
|
+
use std::os::unix::fs::PermissionsExt;
|
|
752
|
+
let staged = path.with_extension("staged");
|
|
753
|
+
std::fs::write(&staged, script).unwrap();
|
|
754
|
+
let copied = std::process::Command::new("/bin/cp")
|
|
755
|
+
.arg(&staged)
|
|
756
|
+
.arg(path)
|
|
757
|
+
.status()
|
|
758
|
+
.unwrap();
|
|
759
|
+
assert!(
|
|
760
|
+
copied.success(),
|
|
761
|
+
"install fixture executable {}",
|
|
762
|
+
path.display()
|
|
763
|
+
);
|
|
764
|
+
std::fs::remove_file(&staged).unwrap();
|
|
765
|
+
std::fs::set_permissions(path, std::fs::Permissions::from_mode(0o700)).unwrap();
|
|
766
|
+
}
|
|
767
|
+
|
|
724
768
|
#[cfg(unix)]
|
|
725
769
|
struct CliFixture {
|
|
726
770
|
program: std::path::PathBuf,
|
|
@@ -800,7 +844,7 @@ esac"#);
|
|
|
800
844
|
let script = format!(
|
|
801
845
|
"#!/bin/sh\nprintf '1\\n' > \"$0.entered\" || :\n{script}body_status=$?\nprintf '1\\n' > \"$0.completed\" || :\nexit \"$body_status\"\n"
|
|
802
846
|
);
|
|
803
|
-
|
|
847
|
+
install_executable(&path, &script);
|
|
804
848
|
path
|
|
805
849
|
}
|
|
806
850
|
|