@autohq/cli 0.1.539 → 0.1.540

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.
@@ -30870,7 +30870,7 @@ Object.assign(lookup, {
30870
30870
  // package.json
30871
30871
  var package_default = {
30872
30872
  name: "@autohq/cli",
30873
- version: "0.1.539",
30873
+ version: "0.1.540",
30874
30874
  license: "SEE LICENSE IN README.md",
30875
30875
  publishConfig: {
30876
30876
  access: "public"
@@ -76029,8 +76029,8 @@ function codexEditFallthroughMarker(item) {
76029
76029
  return `agent_bridge_codex_edit_fallthrough item_id=${item.id} exit_code=127`;
76030
76030
  }
76031
76031
  function resolveCodexVendorLayout() {
76032
- const wrapper = whichOnPath(CODEX_EXECUTABLE_PATH);
76033
- if (!wrapper) {
76032
+ const wrappers = executableCandidatesOnPath(CODEX_EXECUTABLE_PATH);
76033
+ if (wrappers.length === 0) {
76034
76034
  throw new Error("codex executable not found on PATH");
76035
76035
  }
76036
76036
  const target = CODEX_PLATFORM_VENDOR_TARGETS[process.platform]?.[process.arch];
@@ -76039,40 +76039,53 @@ function resolveCodexVendorLayout() {
76039
76039
  `unsupported platform for codex vendor layout: ${process.platform}/${process.arch}`
76040
76040
  );
76041
76041
  }
76042
- const packageRoot = join3(dirname5(realpathSync3(wrapper)), "..");
76043
76042
  const platformPackage = `@openai/codex-${platformPackageSuffix()}`;
76044
- const candidates = [
76045
- join3(packageRoot, "node_modules", platformPackage, "vendor", target),
76046
- join3(packageRoot, "vendor", target)
76047
- ];
76048
- for (const vendorDir of candidates) {
76049
- const binary = join3(vendorDir, "bin", "codex");
76050
- const codexPathDir = join3(vendorDir, "codex-path");
76051
- if (existsSync5(binary) && existsSync5(codexPathDir)) {
76052
- return { binary, codexPathDir };
76043
+ const attemptedVendorDirs = [];
76044
+ for (const wrapper of wrappers) {
76045
+ const packageRoot = join3(dirname5(realpathSync3(wrapper)), "..");
76046
+ const vendorDirs = [
76047
+ join3(packageRoot, "node_modules", platformPackage, "vendor", target),
76048
+ join3(packageRoot, "vendor", target)
76049
+ ];
76050
+ attemptedVendorDirs.push(...vendorDirs);
76051
+ for (const vendorDir of vendorDirs) {
76052
+ const binary = join3(vendorDir, "bin", "codex");
76053
+ const codexPathDir = join3(vendorDir, "codex-path");
76054
+ if (isExecutable(binary) && existsSync5(codexPathDir)) {
76055
+ return { binary, codexPathDir };
76056
+ }
76053
76057
  }
76054
76058
  }
76055
76059
  throw new Error(
76056
- `codex vendor layout not found (wrapper=${wrapper} candidates=${candidates.join(",")})`
76060
+ `codex vendor layout not found (wrappers=${wrappers.join(",")} candidates=${attemptedVendorDirs.join(",")})`
76057
76061
  );
76058
76062
  }
76059
76063
  function platformPackageSuffix() {
76060
76064
  const os = process.platform === "darwin" ? "darwin" : "linux";
76061
76065
  return `${os}-${process.arch}`;
76062
76066
  }
76063
- function whichOnPath(command) {
76067
+ function executableCandidatesOnPath(command) {
76068
+ const candidates = [];
76069
+ const seen = /* @__PURE__ */ new Set();
76064
76070
  for (const dir of (process.env.PATH ?? "").split(delimiter)) {
76065
76071
  if (!dir) {
76066
76072
  continue;
76067
76073
  }
76068
76074
  const candidate = join3(dir, command);
76069
- try {
76070
- accessSync(candidate, constants.X_OK);
76071
- return candidate;
76072
- } catch {
76075
+ if (!seen.has(candidate) && isExecutable(candidate)) {
76076
+ seen.add(candidate);
76077
+ candidates.push(candidate);
76073
76078
  }
76074
76079
  }
76075
- return null;
76080
+ return candidates;
76081
+ }
76082
+ function isExecutable(path2) {
76083
+ try {
76084
+ accessSync(path2, constants.X_OK);
76085
+ return true;
76086
+ } catch {
76087
+ return false;
76088
+ }
76076
76089
  }
76077
76090
  function provisionApplyPatchAlias(layout) {
76078
76091
  const alias = join3(layout.codexPathDir, CODEX_APPLY_PATCH_ALIAS);
@@ -76388,10 +76401,17 @@ var CodexAgentBridgeSessionImpl = class {
76388
76401
  this.input.writeOutput?.(
76389
76402
  `agent_bridge_codex_startup_started codex_home=${options.codexHome}`
76390
76403
  );
76391
- ensureCodexEditCapability({
76392
- command: options.command,
76393
- ...this.input.writeOutput ? { writeOutput: this.input.writeOutput } : {}
76394
- });
76404
+ try {
76405
+ ensureCodexEditCapability({
76406
+ command: options.command,
76407
+ ...this.input.writeOutput ? { writeOutput: this.input.writeOutput } : {}
76408
+ });
76409
+ } catch (error51) {
76410
+ throw new AgentBridgeTerminalPrepareError(
76411
+ error51 instanceof Error ? error51.message : String(error51),
76412
+ { cause: error51 }
76413
+ );
76414
+ }
76395
76415
  const proc = spawn(options.command, options.args, {
76396
76416
  env: options.env,
76397
76417
  stdio: ["pipe", "pipe", "pipe"]
package/dist/index.js CHANGED
@@ -81644,7 +81644,7 @@ var init_package = __esm({
81644
81644
  "package.json"() {
81645
81645
  package_default = {
81646
81646
  name: "@autohq/cli",
81647
- version: "0.1.539",
81647
+ version: "0.1.540",
81648
81648
  license: "SEE LICENSE IN README.md",
81649
81649
  publishConfig: {
81650
81650
  access: "public"
@@ -99063,8 +99063,8 @@ function codexEditFallthroughMarker(item) {
99063
99063
  return `agent_bridge_codex_edit_fallthrough item_id=${item.id} exit_code=127`;
99064
99064
  }
99065
99065
  function resolveCodexVendorLayout() {
99066
- const wrapper = whichOnPath(CODEX_EXECUTABLE_PATH);
99067
- if (!wrapper) {
99066
+ const wrappers = executableCandidatesOnPath(CODEX_EXECUTABLE_PATH);
99067
+ if (wrappers.length === 0) {
99068
99068
  throw new Error("codex executable not found on PATH");
99069
99069
  }
99070
99070
  const target = CODEX_PLATFORM_VENDOR_TARGETS[process.platform]?.[process.arch];
@@ -99073,40 +99073,53 @@ function resolveCodexVendorLayout() {
99073
99073
  `unsupported platform for codex vendor layout: ${process.platform}/${process.arch}`
99074
99074
  );
99075
99075
  }
99076
- const packageRoot = join5(dirname7(realpathSync2(wrapper)), "..");
99077
99076
  const platformPackage = `@openai/codex-${platformPackageSuffix()}`;
99078
- const candidates = [
99079
- join5(packageRoot, "node_modules", platformPackage, "vendor", target),
99080
- join5(packageRoot, "vendor", target)
99081
- ];
99082
- for (const vendorDir of candidates) {
99083
- const binary = join5(vendorDir, "bin", "codex");
99084
- const codexPathDir = join5(vendorDir, "codex-path");
99085
- if (existsSync4(binary) && existsSync4(codexPathDir)) {
99086
- return { binary, codexPathDir };
99077
+ const attemptedVendorDirs = [];
99078
+ for (const wrapper of wrappers) {
99079
+ const packageRoot = join5(dirname7(realpathSync2(wrapper)), "..");
99080
+ const vendorDirs = [
99081
+ join5(packageRoot, "node_modules", platformPackage, "vendor", target),
99082
+ join5(packageRoot, "vendor", target)
99083
+ ];
99084
+ attemptedVendorDirs.push(...vendorDirs);
99085
+ for (const vendorDir of vendorDirs) {
99086
+ const binary = join5(vendorDir, "bin", "codex");
99087
+ const codexPathDir = join5(vendorDir, "codex-path");
99088
+ if (isExecutable(binary) && existsSync4(codexPathDir)) {
99089
+ return { binary, codexPathDir };
99090
+ }
99087
99091
  }
99088
99092
  }
99089
99093
  throw new Error(
99090
- `codex vendor layout not found (wrapper=${wrapper} candidates=${candidates.join(",")})`
99094
+ `codex vendor layout not found (wrappers=${wrappers.join(",")} candidates=${attemptedVendorDirs.join(",")})`
99091
99095
  );
99092
99096
  }
99093
99097
  function platformPackageSuffix() {
99094
99098
  const os = process.platform === "darwin" ? "darwin" : "linux";
99095
99099
  return `${os}-${process.arch}`;
99096
99100
  }
99097
- function whichOnPath(command) {
99101
+ function executableCandidatesOnPath(command) {
99102
+ const candidates = [];
99103
+ const seen = /* @__PURE__ */ new Set();
99098
99104
  for (const dir of (process.env.PATH ?? "").split(delimiter)) {
99099
99105
  if (!dir) {
99100
99106
  continue;
99101
99107
  }
99102
99108
  const candidate = join5(dir, command);
99103
- try {
99104
- accessSync(candidate, constants.X_OK);
99105
- return candidate;
99106
- } catch {
99109
+ if (!seen.has(candidate) && isExecutable(candidate)) {
99110
+ seen.add(candidate);
99111
+ candidates.push(candidate);
99107
99112
  }
99108
99113
  }
99109
- return null;
99114
+ return candidates;
99115
+ }
99116
+ function isExecutable(path2) {
99117
+ try {
99118
+ accessSync(path2, constants.X_OK);
99119
+ return true;
99120
+ } catch {
99121
+ return false;
99122
+ }
99110
99123
  }
99111
99124
  function provisionApplyPatchAlias(layout) {
99112
99125
  const alias = join5(layout.codexPathDir, CODEX_APPLY_PATCH_ALIAS);
@@ -99422,10 +99435,17 @@ var CodexAgentBridgeSessionImpl = class {
99422
99435
  this.input.writeOutput?.(
99423
99436
  `agent_bridge_codex_startup_started codex_home=${options.codexHome}`
99424
99437
  );
99425
- ensureCodexEditCapability({
99426
- command: options.command,
99427
- ...this.input.writeOutput ? { writeOutput: this.input.writeOutput } : {}
99428
- });
99438
+ try {
99439
+ ensureCodexEditCapability({
99440
+ command: options.command,
99441
+ ...this.input.writeOutput ? { writeOutput: this.input.writeOutput } : {}
99442
+ });
99443
+ } catch (error51) {
99444
+ throw new AgentBridgeTerminalPrepareError(
99445
+ error51 instanceof Error ? error51.message : String(error51),
99446
+ { cause: error51 }
99447
+ );
99448
+ }
99429
99449
  const proc = spawn2(options.command, options.args, {
99430
99450
  env: options.env,
99431
99451
  stdio: ["pipe", "pipe", "pipe"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autohq/cli",
3
- "version": "0.1.539",
3
+ "version": "0.1.540",
4
4
  "license": "SEE LICENSE IN README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"