overlord-cli 0.2608121828.0 → 0.2608121927.0

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/dist/index.js CHANGED
@@ -16950,13 +16950,9 @@ function evaluateLatchCapabilities({ report, executable, resolvedPath, checkedAt
16950
16950
  directSelectable: true
16951
16951
  };
16952
16952
  }
16953
- function resolveLatchExecutablePath(executable) {
16954
- const name = trimmed2(executable) ?? DEFAULT_LATCH_EXECUTABLE;
16955
- if (path17.isAbsolute(name) || name.includes("/") || name.includes("\\")) {
16956
- return existsSync16(name) ? path17.resolve(name) : null;
16957
- }
16953
+ function resolveLatchExecutableOnPath(executable) {
16958
16954
  try {
16959
- const found = execFileSync3("which", [name], {
16955
+ const found = execFileSync3("which", [executable], {
16960
16956
  encoding: "utf8",
16961
16957
  stdio: ["ignore", "pipe", "ignore"]
16962
16958
  }).trim();
@@ -16965,6 +16961,24 @@ function resolveLatchExecutablePath(executable) {
16965
16961
  return null;
16966
16962
  }
16967
16963
  }
16964
+ function resolveLatchExecutablePathFromEnvironment({ executable, homeDirectory = os3.homedir(), platform: platform2 = process.platform, resolveOnPath = resolveLatchExecutableOnPath, fileExists = existsSync16 }) {
16965
+ const name = trimmed2(executable) ?? DEFAULT_LATCH_EXECUTABLE;
16966
+ if (path17.isAbsolute(name) || name.includes("/") || name.includes("\\")) {
16967
+ return fileExists(name) ? path17.resolve(name) : null;
16968
+ }
16969
+ const resolvedOnPath = resolveOnPath(name);
16970
+ if (resolvedOnPath)
16971
+ return resolvedOnPath;
16972
+ const fallbacks = [
16973
+ path17.join(homeDirectory, ".local", "bin", name),
16974
+ ...platform2 === "darwin" ? [`/opt/homebrew/bin/${name}`, `/usr/local/bin/${name}`] : []
16975
+ ];
16976
+ const fallback = fallbacks.find(fileExists);
16977
+ return fallback ? path17.resolve(fallback) : null;
16978
+ }
16979
+ function resolveLatchExecutablePath(executable) {
16980
+ return resolveLatchExecutablePathFromEnvironment({ executable });
16981
+ }
16968
16982
  function notInstalledResult({ executable, checkedAt }) {
16969
16983
  return {
16970
16984
  state: "not_installed",
@@ -19450,6 +19464,7 @@ async function launchAgent({
19450
19464
  const executable = snapshot?.executionProvider.executable ?? "latch";
19451
19465
  let providerFallbackWarning = null;
19452
19466
  let useLatch = false;
19467
+ let resolvedLatchExecutable = executable;
19453
19468
  const existingProviderSession = providerKind === "latch" ? existingLatchProviderSession({
19454
19469
  latchSessionId: process.env.LATCH_SESSION_ID,
19455
19470
  executionTargetId: options.executionTargetId
@@ -19491,6 +19506,9 @@ async function launchAgent({
19491
19506
  providerKind,
19492
19507
  latchSelectable: discovery.latchSelectable
19493
19508
  });
19509
+ if (useLatch && discovery.state === "found") {
19510
+ resolvedLatchExecutable = discovery.resolvedPath;
19511
+ }
19494
19512
  if (!useLatch) {
19495
19513
  providerFallbackWarning = discovery.state === "not_installed" ? `Latch is not installed on this execution target (${discovery.installCommand}); falling back to direct launch.` : discovery.state === "incompatible" ? `Latch is incompatible (${discovery.missingCapability}: ${discovery.detail}); falling back to direct launch.` : "Latch is unavailable; falling back to direct launch.";
19496
19514
  }
@@ -19498,7 +19516,7 @@ async function launchAgent({
19498
19516
  }
19499
19517
  if (useLatch && plan.latchCommandString) {
19500
19518
  const created = createLatchSession({
19501
- executable,
19519
+ executable: resolvedLatchExecutable,
19502
19520
  commandString: plan.latchCommandString,
19503
19521
  cwd: options.workingDirectory,
19504
19522
  env: plan.env,
@@ -19512,7 +19530,7 @@ async function launchAgent({
19512
19530
  const openOnLaunch = snapshot?.viewer.openOnLaunch !== false;
19513
19531
  if (openOnLaunch) {
19514
19532
  viewerOpen = openLatchViewer({
19515
- executable,
19533
+ executable: resolvedLatchExecutable,
19516
19534
  providerSessionId: created.providerSession.providerSessionId,
19517
19535
  viewerKind: snapshot?.viewer.kind ?? "iterm"
19518
19536
  });
@@ -19521,7 +19539,7 @@ async function launchAgent({
19521
19539
  plan: {
19522
19540
  ...plan,
19523
19541
  execution: {
19524
- command: executable,
19542
+ command: resolvedLatchExecutable,
19525
19543
  args: ["create", "--manifest-file", "-", "--json"],
19526
19544
  useShell: false,
19527
19545
  terminal: snapshot?.viewer.launcher ?? null,