@team-agent/installer 0.5.123 → 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 CHANGED
@@ -727,7 +727,7 @@ dependencies = [
727
727
 
728
728
  [[package]]
729
729
  name = "team-agent"
730
- version = "0.5.123"
730
+ version = "0.5.124"
731
731
  dependencies = [
732
732
  "anyhow",
733
733
  "chrono",
package/Cargo.toml CHANGED
@@ -11,7 +11,7 @@ exclude = ["crates/team-agent-contract"]
11
11
 
12
12
  [workspace.package]
13
13
  edition = "2021"
14
- version = "0.5.123"
14
+ version = "0.5.124"
15
15
  license = "AGPL-3.0"
16
16
  rust-version = "1.95"
17
17
 
@@ -283,6 +283,29 @@ fn shell_carrier(command: &str) -> bool {
283
283
  fn surface_liveness(command: &str, native_frame: bool, live_child: bool) -> bool {
284
284
  !command.is_empty() && native_frame && (!shell_carrier(command) || live_child)
285
285
  }
286
+ fn argv0_names(argv0: &str, native: crate::provider::Provider) -> bool {
287
+ Path::new(argv0).file_name().and_then(|name| name.to_str())
288
+ == Some(crate::provider::wire::command_name(native))
289
+ }
290
+ /// Native installers may exec a version-named file (Claude Code:
291
+ /// `~/.local/bin/claude` -> `versions/<semver>`), so tmux reports the version
292
+ /// as the pane command. The exact argv[0] of the pane process, or of a live
293
+ /// child under its carrier, still names the provider. Unobservable is not
294
+ /// positive evidence.
295
+ fn launched_as_provider(pid: u32, native: crate::provider::Provider) -> bool {
296
+ let named = |pid: u32| {
297
+ crate::platform::argv::argv_tokens(pid)
298
+ .and_then(|argv| argv.into_iter().next())
299
+ .is_some_and(|argv0| argv0_names(&argv0, native))
300
+ };
301
+ named(pid)
302
+ || crate::platform::process::process_tree(pid)
303
+ .unwrap_or_default()
304
+ .into_iter()
305
+ .any(|child| {
306
+ child != pid && named(child) && crate::platform::process::pid_is_alive(child)
307
+ })
308
+ }
286
309
 
287
310
  /// Positive native/store or exact carrier+pane+provider observations only.
288
311
  fn observe(selected: &SelectedTeam, id: &str, row: &Value) -> Result<Observation, CliError> {
@@ -401,7 +424,8 @@ fn observe(selected: &SelectedTeam, id: &str, row: &Value) -> Result<Observation
401
424
  }
402
425
  let command = matches[0].current_command.as_deref().unwrap_or("");
403
426
  let positive_command = command == crate::provider::wire::command_name(native)
404
- || crate::leader::provider_attribution::command_matches_provider(native, command);
427
+ || crate::leader::provider_attribution::command_matches_provider(native, command)
428
+ || (!command.is_empty() && !shell_carrier(command) && launched_as_provider(pid, native));
405
429
  let positive_surface = if !positive_command && !command.is_empty() {
406
430
  let frame = checked(
407
431
  backend.observe_native_input(&Target::Pane(PaneId::new(pane.unwrap_or(""))), native),
@@ -703,6 +703,67 @@ fn original_supervised_shell_needs_both_current_native_frame_and_live_child() {
703
703
  assert!(!surface_liveness("node", false, true));
704
704
  }
705
705
 
706
+ #[test]
707
+ fn provider_argv0_is_exact_basename_not_substring() {
708
+ use crate::model::enums::Provider;
709
+ assert!(argv0_names("claude", Provider::Claude));
710
+ assert!(argv0_names("/Users/u/.local/bin/claude", Provider::Claude));
711
+ assert!(argv0_names("claude", Provider::ClaudeCode));
712
+ for argv0 in ["2.1.309", "claude-wrapper", "team-agent", "node", ""] {
713
+ assert!(!argv0_names(argv0, Provider::Claude), "{argv0}");
714
+ }
715
+ assert!(argv0_names("agent", Provider::CursorAgent));
716
+ assert!(!argv0_names("team-agent", Provider::CursorAgent));
717
+ }
718
+
719
+ #[test]
720
+ #[cfg(unix)]
721
+ fn version_named_native_install_is_identified_by_launch_argv0() {
722
+ // Claude Code's native installer execs `versions/<semver>`; tmux then
723
+ // reports e.g. `2.1.309` as the pane command while argv[0] stays `claude`.
724
+ use crate::model::enums::Provider;
725
+ use std::os::unix::process::CommandExt;
726
+ let mut claude = std::process::Command::new("sleep")
727
+ .arg0("claude")
728
+ .arg("30")
729
+ .spawn()
730
+ .unwrap();
731
+ let mut other = std::process::Command::new("sleep")
732
+ .arg("30")
733
+ .spawn()
734
+ .unwrap();
735
+ let launched = launched_as_provider(claude.id(), Provider::Claude);
736
+ let _ = claude.kill();
737
+ let _ = claude.wait();
738
+ assert!(launched);
739
+ let launched = launched_as_provider(other.id(), Provider::Claude);
740
+ let _ = other.kill();
741
+ let _ = other.wait();
742
+ assert!(!launched);
743
+ }
744
+
745
+ #[test]
746
+ #[cfg(unix)]
747
+ fn supervised_carrier_child_launched_as_provider_is_identified() {
748
+ // Original restart supervises the provider as a child of a shell carrier.
749
+ use crate::model::enums::Provider;
750
+ use std::os::unix::process::CommandExt;
751
+ let mut carrier = std::process::Command::new("bash")
752
+ .args(["-c", "exec -a claude sleep 30 & wait"])
753
+ .process_group(0)
754
+ .spawn()
755
+ .unwrap();
756
+ let deadline = std::time::Instant::now() + std::time::Duration::from_secs(5);
757
+ let mut launched = false;
758
+ while !launched && std::time::Instant::now() < deadline {
759
+ launched = launched_as_provider(carrier.id(), Provider::Claude);
760
+ std::thread::sleep(std::time::Duration::from_millis(20));
761
+ }
762
+ unsafe { libc::kill(-(carrier.id() as i32), libc::SIGKILL) };
763
+ let _ = carrier.wait();
764
+ assert!(launched);
765
+ }
766
+
706
767
  #[test]
707
768
  fn unchanged_observation_port_rejects_native_screen_followed_by_exit_tail() {
708
769
  use crate::model::enums::Provider;
@@ -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
- std::fs::write(
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
- std::fs::write(&path, script).unwrap();
847
+ install_executable(&path, &script);
804
848
  path
805
849
  }
806
850
 
@@ -431,6 +431,10 @@ fn request(
431
431
  return Err(ContractError::AmbiguousProfile.into());
432
432
  }
433
433
  profile.policy.require("native submit policy")?;
434
+ // The worker execs exactly the public command its runtime route was probed on.
435
+ let launcher = discovered.runtime.as_ref()
436
+ .ok_or(ContractError::Invalid("native runtime installation"))?
437
+ .launcher();
434
438
  Ok(LaunchRequest {
435
439
  provider: role.provider.as_str().into(),
436
440
  operation: Operation::Fresh,
@@ -444,6 +448,7 @@ fn request(
444
448
  identity,
445
449
  native: discovered.native.clone(),
446
450
  paths: LaunchPaths {
451
+ launcher,
447
452
  executable: discovered.engine.clone(),
448
453
  candidate: binding.candidate.clone(),
449
454
  cwd: binding.workspace.clone(),
@@ -1486,6 +1491,9 @@ mod tests {
1486
1491
  ui: "metadata".into(), platform: Platform::MacOs, executable_sha256: digest(b"launcher"),
1487
1492
  };
1488
1493
  let mut discovery = Discovery {
1494
+ command: team_agent_contract::host::command::PublicCommand {
1495
+ name: "cursor-agent".into(), search_path: "/controlled".into(), entry: "/controlled/cursor-agent".into(),
1496
+ },
1489
1497
  runtime: None,
1490
1498
  engine: "/controlled/cursor-agent".into(), native: native.clone(),
1491
1499
  catalog: CatalogObservation { provider, native,
@@ -2,7 +2,7 @@
2
2
  use std::path::{Path, PathBuf};
3
3
 
4
4
  use team_agent_contract::contract::{hooks::*, plan::CatalogObservation, types::*};
5
- use team_agent_contract::host::{command::RealCommandRunner, process::resolve_cwd};
5
+ use team_agent_contract::host::{command::{PublicCommand, RealCommandRunner}, process::resolve_cwd};
6
6
  use team_agent_contract::kiro::native as kiro;
7
7
  use team_agent_contract::providers::cursor::native as cursor;
8
8
  use team_agent_contract::providers::grok_build::native as grok;
@@ -31,12 +31,16 @@ pub enum DiscoveryError {
31
31
  }
32
32
 
33
33
  pub struct Discovery {
34
+ /// The provider's public command exactly as the user's shell resolves it.
35
+ pub command: PublicCommand,
34
36
  pub engine: PathBuf,
35
37
  pub native: NativeIdentity,
36
38
  pub catalog: CatalogObservation,
37
39
  pub runtime: Option<NativeRuntime>,
38
40
  }
39
41
 
42
+ /// Canonical tool path for framework infrastructure such as tmux. Providers
43
+ /// never use this: they launch their public command through [`public_command`].
40
44
  pub fn executable(name: &'static str) -> Result<PathBuf, DiscoveryError> {
41
45
  let path = std::env::var_os("PATH").ok_or(DiscoveryError::Executable(name))?;
42
46
  for directory in std::env::split_paths(&path) {
@@ -52,6 +56,13 @@ pub fn executable(name: &'static str) -> Result<PathBuf, DiscoveryError> {
52
56
  Err(DiscoveryError::Executable(name))
53
57
  }
54
58
 
59
+ /// The first `name` on this process's PATH, kept as found so user wrappers and
60
+ /// vendor symlinks stay in the route. No install directory is ever guessed.
61
+ pub fn public_command(name: &'static str) -> Result<PublicCommand, DiscoveryError> {
62
+ let path = std::env::var_os("PATH").ok_or(DiscoveryError::Executable(name))?;
63
+ PublicCommand::resolve(name, &path).map_err(|_| DiscoveryError::Executable(name))
64
+ }
65
+
55
66
  pub fn discover(provider: &ProviderId, workspace: &Path) -> Result<Discovery, DiscoveryError> {
56
67
  let selected = registry::provider(provider.as_str()).map_err(DiscoveryError::Contract)?;
57
68
  let descriptor = selected.descriptor();
@@ -59,43 +70,23 @@ pub fn discover(provider: &ProviderId, workspace: &Path) -> Result<Discovery, Di
59
70
  deadline: std::time::Duration::from_secs(30),
60
71
  max_output_bytes: 1024 * 1024,
61
72
  };
62
- let launcher = if selected == NativeProvider::GrokBuild {
63
- // This macOS admission preserves the explicitly approved proxy entry.
64
- // PATH may put the inner image first; it must never bypass the wrapper.
65
- grok::resolve_launcher(Path::new("/usr/local/bin/grok"))?
66
- } else {
67
- executable(descriptor.identity.binary)?
68
- };
69
- let (engine, native) = match selected {
70
- NativeProvider::Kiro => {
71
- let home = std::env::var_os("HOME")
72
- .map(PathBuf::from)
73
- .ok_or(DiscoveryError::Executable("HOME for native installation lookup"))?;
74
- let engine = kiro::resolve_helper(&launcher, &home)?;
75
- let native = kiro::probe_engine(&engine, &mut RealCommandRunner::default(), bounds)?;
76
- (engine, native)
77
- }
78
- NativeProvider::Cursor => {
79
- let engine = cursor::resolve_launcher(&launcher)?;
80
- let native = cursor::probe_launcher(&engine, &mut RealCommandRunner::default(), bounds)?;
81
- (engine, native)
82
- }
83
- NativeProvider::GrokBuild => {
84
- let engine = grok::resolve_launcher(&launcher)?;
85
- let native = grok::probe_launcher(&engine, &mut RealCommandRunner::default(), bounds)?;
86
- (engine, native)
87
- }
73
+ // Every metadata probe runs the PATH-selected entry, wrappers included.
74
+ let command = public_command(descriptor.identity.binary)?;
75
+ let native = match selected {
76
+ NativeProvider::Kiro => kiro::probe_launcher(&command, &mut RealCommandRunner::default(), bounds)?,
77
+ NativeProvider::Cursor => cursor::probe_launcher(&command, &mut RealCommandRunner::default(), bounds)?,
78
+ NativeProvider::GrokBuild => grok::probe_launcher(&command, &mut RealCommandRunner::default(), bounds)?,
88
79
  };
89
80
  let request = CatalogRequest {
90
81
  provider: ProviderId::new(descriptor.identity.id).map_err(DiscoveryError::Contract)?,
91
82
  native: native.clone(),
92
- executable: engine.clone(),
83
+ executable: command.entry.clone(),
93
84
  cwd: resolve_cwd(workspace)?,
94
85
  source: descriptor.model.catalog.require("native catalog source").map_err(DiscoveryError::Contract)?.clone(),
95
86
  bounds,
96
87
  };
97
- // H1 does not use these pointers or execute an MCP server. Cursor's
98
- // launcher fingerprint authorizes only metadata reads, never worker launch.
88
+ // H1 does not use these pointers or execute an MCP server. The launcher
89
+ // fingerprint authorizes only metadata reads, never worker launch.
99
90
  let adapter = selected.adapter(
100
91
  std::env::current_exe()?.canonicalize()?,
101
92
  Vec::new(),
@@ -120,38 +111,31 @@ pub fn discover(provider: &ProviderId, workspace: &Path) -> Result<Discovery, Di
120
111
  catalog_hook.discover(&request, &mut host)
121
112
  }
122
113
  }.map_err(DiscoveryError::Catalog)?;
123
- let result = Discovery { engine, native, catalog, runtime: None };
114
+ let result = Discovery { engine: command.entry.clone(), command, native, catalog, runtime: None };
124
115
  validate_catalog(provider, &result).map_err(DiscoveryError::Contract)?;
125
116
  Ok(result)
126
117
  }
127
118
 
128
- /// Runtime discovery is separate from public catalog metadata. Cursor explicitly
129
- /// bridges the same installation's catalog to its proven Node/entry identity.
119
+ /// Runtime discovery is separate from public catalog metadata. Each provider
120
+ /// bridges its catalog to the native image its public command route execs into.
130
121
  pub(super) fn discover_runtime(provider: &ProviderId, workspace: &Path) -> Result<Discovery, DiscoveryError> {
131
122
  let mut discovery = discover(provider, workspace)?;
132
123
  let selected = registry::provider(provider.as_str()).map_err(DiscoveryError::Contract)?;
133
- if selected != NativeProvider::Kiro {
134
- let home = std::env::var_os("HOME").map(PathBuf::from)
135
- .ok_or(DiscoveryError::Executable("HOME for native subscription"))?;
136
- let bounds = ReadBounds { deadline: std::time::Duration::from_secs(30), max_output_bytes: 1024 * 1024 };
137
- match selected {
138
- NativeProvider::Cursor => {
139
- let runtime = cursor::probe_runtime(&discovery.engine, &home, &mut RealCommandRunner::default(), bounds)?;
140
- discovery.catalog = runtime.bind_catalog(&discovery.catalog).map_err(DiscoveryError::Contract)?;
141
- discovery.engine = runtime.engine.clone();
142
- discovery.native = runtime.native.clone();
143
- discovery.runtime = Some(NativeRuntime::Cursor(runtime));
144
- }
145
- NativeProvider::GrokBuild => {
146
- let runtime = grok::probe_runtime(&discovery.engine, &home, &mut RealCommandRunner::default(), bounds)?;
147
- discovery.catalog = runtime.bind_catalog(&discovery.catalog).map_err(DiscoveryError::Contract)?;
148
- discovery.engine = runtime.engine.clone();
149
- discovery.native = runtime.native.clone();
150
- discovery.runtime = Some(NativeRuntime::GrokBuild(runtime));
151
- }
152
- NativeProvider::Kiro => unreachable!(),
153
- }
154
- }
124
+ let bounds = ReadBounds { deadline: std::time::Duration::from_secs(30), max_output_bytes: 1024 * 1024 };
125
+ let home = || std::env::var_os("HOME").map(PathBuf::from)
126
+ .ok_or(DiscoveryError::Executable("HOME for native subscription"));
127
+ let runtime = match selected {
128
+ NativeProvider::Kiro => NativeRuntime::Kiro(
129
+ kiro::probe_runtime(&discovery.command, &mut RealCommandRunner::default(), bounds)?),
130
+ NativeProvider::Cursor => NativeRuntime::Cursor(
131
+ cursor::probe_runtime(&discovery.command, &home()?, &mut RealCommandRunner::default(), bounds)?),
132
+ NativeProvider::GrokBuild => NativeRuntime::GrokBuild(
133
+ grok::probe_runtime(&discovery.command, &home()?, &mut RealCommandRunner::default(), bounds)?),
134
+ };
135
+ discovery.catalog = runtime.bind_catalog(&discovery.catalog).map_err(DiscoveryError::Contract)?;
136
+ discovery.engine = runtime.engine().clone();
137
+ discovery.native = runtime.native().clone();
138
+ discovery.runtime = Some(runtime);
155
139
  Ok(discovery)
156
140
  }
157
141
 
@@ -245,6 +229,10 @@ mod tests {
245
229
  use crate::cli::{CmdOutput, ExitCode, ModelsArgs};
246
230
  use team_agent_contract::contract::plan::ModelRecord;
247
231
 
232
+ fn controlled_command(name: &str) -> PublicCommand {
233
+ PublicCommand { name: name.into(), search_path: "/controlled".into(), entry: format!("/controlled/{name}").into() }
234
+ }
235
+
248
236
  #[test]
249
237
  fn native_catalog_projection_preserves_ids_without_claiming_auth_or_effort() {
250
238
  let native = NativeIdentity {
@@ -255,8 +243,9 @@ mod tests {
255
243
  executable_sha256: Digest([1; 32]),
256
244
  };
257
245
  let discovery = Discovery {
246
+ command: controlled_command("kiro-cli"),
258
247
  runtime: None,
259
- engine: "/controlled/kiro-cli-chat".into(),
248
+ engine: "/controlled/kiro-cli".into(),
260
249
  native: native.clone(),
261
250
  catalog: CatalogObservation {
262
251
  provider: ProviderId::new("kiro").unwrap(),
@@ -319,6 +308,7 @@ mod tests {
319
308
  executable_sha256: Digest([2; 32]),
320
309
  };
321
310
  Discovery {
311
+ command: controlled_command("cursor-agent"),
322
312
  runtime: None,
323
313
  engine: "/controlled/cursor-agent".into(),
324
314
  native: native.clone(),
@@ -6,8 +6,8 @@ use team_agent_contract::contract::{
6
6
  descriptor::{PromptCarrier, ProviderDescriptor, ToolNaming},
7
7
  types::InstanceIdentity,
8
8
  hooks::{PlanHook, ProviderHooks},
9
- plan::{LaunchPlan, ResolvedLaunch},
10
- types::{ContractError, Support},
9
+ plan::{CatalogObservation, LaunchEntrypoint, LaunchPlan, ResolvedLaunch},
10
+ types::{ContractError, NativeIdentity, Support},
11
11
  };
12
12
  use team_agent_contract::kiro::{self, KiroAdapter, KIRO_DESCRIPTOR};
13
13
  use team_agent_contract::providers::cursor::{self, CursorAdapter, CURSOR_DESCRIPTOR};
@@ -19,12 +19,49 @@ use team_agent_contract::runtime::{
19
19
 
20
20
  const DESCRIPTORS: &[&ProviderDescriptor] = &[&KIRO_DESCRIPTOR, &CURSOR_DESCRIPTOR, &GROK_BUILD_DESCRIPTOR];
21
21
 
22
+ /// One provider's public command route: the PATH-selected entry the pane execs
23
+ /// by bare name and the native image that route must exec into.
22
24
  #[derive(Clone)]
23
25
  pub enum NativeRuntime {
26
+ Kiro(kiro::native::RuntimeInstallation),
24
27
  Cursor(cursor::native::RuntimeInstallation),
25
28
  GrokBuild(grok_build::native::RuntimeInstallation),
26
29
  }
27
30
 
31
+ impl NativeRuntime {
32
+ pub fn launcher(&self) -> LaunchEntrypoint {
33
+ match self {
34
+ Self::Kiro(runtime) => runtime.launcher(),
35
+ Self::Cursor(runtime) => runtime.launcher(),
36
+ Self::GrokBuild(runtime) => runtime.launcher(),
37
+ }
38
+ }
39
+
40
+ pub fn engine(&self) -> &PathBuf {
41
+ match self {
42
+ Self::Kiro(runtime) => &runtime.engine,
43
+ Self::Cursor(runtime) => &runtime.engine,
44
+ Self::GrokBuild(runtime) => &runtime.engine,
45
+ }
46
+ }
47
+
48
+ pub fn native(&self) -> &NativeIdentity {
49
+ match self {
50
+ Self::Kiro(runtime) => &runtime.native,
51
+ Self::Cursor(runtime) => &runtime.native,
52
+ Self::GrokBuild(runtime) => &runtime.native,
53
+ }
54
+ }
55
+
56
+ pub fn bind_catalog(&self, catalog: &CatalogObservation) -> Result<CatalogObservation, ContractError> {
57
+ match self {
58
+ Self::Kiro(runtime) => runtime.bind_catalog(catalog),
59
+ Self::Cursor(runtime) => runtime.bind_catalog(catalog),
60
+ Self::GrokBuild(runtime) => runtime.bind_catalog(catalog),
61
+ }
62
+ }
63
+ }
64
+
28
65
  /// Leaf selection stays here; the framework, lifecycle and outbox remain shared.
29
66
  #[derive(Clone, Copy, Debug, PartialEq, Eq)]
30
67
  pub(super) enum NativeProvider {
@@ -143,7 +180,8 @@ impl NativeAdapter {
143
180
  runtime: Option<NativeRuntime>,
144
181
  ) -> Result<Self, ContractError> {
145
182
  match self {
146
- Self::Kiro(adapter) if runtime.is_none() => Ok(Self::Kiro(adapter)),
183
+ // Kiro plans from the framework-resolved launch paths alone.
184
+ Self::Kiro(adapter) if matches!(runtime, None | Some(NativeRuntime::Kiro(_))) => Ok(Self::Kiro(adapter)),
147
185
  Self::Kiro(_) => Err(ContractError::Mismatch("native runtime provider")),
148
186
  Self::Cursor(adapter) => {
149
187
  let adapter = adapter.with_project(project)?;