@autohq/cli 0.1.540 → 0.1.541

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.540",
30873
+ version: "0.1.541",
30874
30874
  license: "SEE LICENSE IN README.md",
30875
30875
  publishConfig: {
30876
30876
  access: "public"
@@ -75803,7 +75803,7 @@ import {
75803
75803
  writeFileSync as writeFileSync4
75804
75804
  } from "fs";
75805
75805
  import { tmpdir } from "os";
75806
- import { delimiter, dirname as dirname5, join as join3 } from "path";
75806
+ import { basename as basename2, delimiter, dirname as dirname5, isAbsolute as isAbsolute2, join as join3 } from "path";
75807
75807
 
75808
75808
  // src/commands/agent-bridge/harness/codex/options.ts
75809
75809
  import { join as join2 } from "path";
@@ -75987,6 +75987,7 @@ var CODEX_EDIT_PROBE = {
75987
75987
  ].join("\n")
75988
75988
  };
75989
75989
  var PROBE_TIMEOUT_MS = 15e3;
75990
+ var MAX_CODEX_SHIM_BYTES = 4096;
75990
75991
  var MAX_EVIDENCE_LENGTH = 300;
75991
75992
  var CODEX_PLATFORM_VENDOR_TARGETS = {
75992
75993
  linux: {
@@ -76029,7 +76030,7 @@ function codexEditFallthroughMarker(item) {
76029
76030
  return `agent_bridge_codex_edit_fallthrough item_id=${item.id} exit_code=127`;
76030
76031
  }
76031
76032
  function resolveCodexVendorLayout() {
76032
- const wrappers = executableCandidatesOnPath(CODEX_EXECUTABLE_PATH);
76033
+ const wrappers = executableCodexCandidates(CODEX_EXECUTABLE_PATH);
76033
76034
  if (wrappers.length === 0) {
76034
76035
  throw new Error("codex executable not found on PATH");
76035
76036
  }
@@ -76079,6 +76080,45 @@ function executableCandidatesOnPath(command) {
76079
76080
  }
76080
76081
  return candidates;
76081
76082
  }
76083
+ function executableCodexCandidates(command) {
76084
+ const candidates = executableCandidatesOnPath(command);
76085
+ const seen = new Set(candidates);
76086
+ for (let index = 0; index < candidates.length; index += 1) {
76087
+ const candidate = candidates[index];
76088
+ if (!candidate) {
76089
+ continue;
76090
+ }
76091
+ const target = directCodexShimTarget(candidate);
76092
+ if (target && !seen.has(target)) {
76093
+ seen.add(target);
76094
+ candidates.push(target);
76095
+ }
76096
+ }
76097
+ return candidates;
76098
+ }
76099
+ function directCodexShimTarget(candidate) {
76100
+ try {
76101
+ const resolved = realpathSync3(candidate);
76102
+ const metadata = lstatSync3(resolved);
76103
+ if (!metadata.isFile() || metadata.size > MAX_CODEX_SHIM_BYTES) {
76104
+ return null;
76105
+ }
76106
+ const script = readFileSync7(resolved, "utf8");
76107
+ if (!/^#!\/(?:bin\/|usr\/bin\/env )(?:ba)?sh\r?\n/.test(script)) {
76108
+ return null;
76109
+ }
76110
+ const targets = script.split(/\r?\n/).map(
76111
+ (line) => line.match(/^\s*exec\s+(?:"([^"]+)"|'([^']+)'|([^\s]+))\s+"\$@"\s*$/)
76112
+ ).filter((match) => match !== null).map((match) => match[1] ?? match[2] ?? match[3] ?? "");
76113
+ const [target] = targets;
76114
+ if (!target || targets.length !== 1) {
76115
+ return null;
76116
+ }
76117
+ return isAbsolute2(target) && basename2(target) === CODEX_EXECUTABLE_PATH && isExecutable(target) ? target : null;
76118
+ } catch {
76119
+ return null;
76120
+ }
76121
+ }
76082
76122
  function isExecutable(path2) {
76083
76123
  try {
76084
76124
  accessSync(path2, constants.X_OK);
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.540",
81647
+ version: "0.1.541",
81648
81648
  license: "SEE LICENSE IN README.md",
81649
81649
  publishConfig: {
81650
81650
  access: "public"
@@ -81769,10 +81769,10 @@ var init_project_apply_filesystem_source = __esm({
81769
81769
  // src/commands/agents/authoring.ts
81770
81770
  import { readFileSync as readFileSync8, readdirSync as readdirSync3, statSync as statSync3 } from "fs";
81771
81771
  import {
81772
- basename as basename3,
81772
+ basename as basename4,
81773
81773
  dirname as dirname8,
81774
81774
  extname,
81775
- isAbsolute as isAbsolute2,
81775
+ isAbsolute as isAbsolute3,
81776
81776
  join as join7,
81777
81777
  resolve as resolve3
81778
81778
  } from "path";
@@ -81831,7 +81831,7 @@ function readLocalAgentAuthoringStatuses(input) {
81831
81831
  );
81832
81832
  const paths = agentAuthoringFiles(agentsDirectory);
81833
81833
  return paths.map((path2) => {
81834
- const fallbackName = basename3(path2, extname(path2));
81834
+ const fallbackName = basename4(path2, extname(path2));
81835
81835
  try {
81836
81836
  const result = compileAgentFile(path2);
81837
81837
  return {
@@ -81970,7 +81970,7 @@ function importPaths(document) {
81970
81970
  });
81971
81971
  }
81972
81972
  function resolveImportPath(importPath, importerPath) {
81973
- if (isAbsolute2(importPath) || /^[A-Za-z]+:\/\//.test(importPath)) {
81973
+ if (isAbsolute3(importPath) || /^[A-Za-z]+:\/\//.test(importPath)) {
81974
81974
  throw new Error(`Agent import must be a relative path: ${importPath}`);
81975
81975
  }
81976
81976
  const resolved = resolve3(dirname8(importerPath), importPath);
@@ -82143,7 +82143,7 @@ function resolveFileBackedString(value, input) {
82143
82143
  );
82144
82144
  }
82145
82145
  const filePath = file2.trim();
82146
- if (isAbsolute2(filePath) || /^[A-Za-z]+:\/\//.test(filePath)) {
82146
+ if (isAbsolute3(filePath) || /^[A-Za-z]+:\/\//.test(filePath)) {
82147
82147
  throw new Error(
82148
82148
  `Invalid agent authoring file ${input.path}: ${input.field}.file must be a relative path`
82149
82149
  );
@@ -84966,7 +84966,7 @@ var init_project_apply_files2 = __esm({
84966
84966
 
84967
84967
  // src/commands/apply/files.ts
84968
84968
  import { existsSync as existsSync6, readFileSync as readFileSync9, realpathSync as realpathSync3, statSync as statSync4 } from "fs";
84969
- import { basename as basename4, dirname as dirname9, extname as extname3, isAbsolute as isAbsolute3, resolve as resolve4 } from "path";
84969
+ import { basename as basename5, dirname as dirname9, extname as extname3, isAbsolute as isAbsolute4, resolve as resolve4 } from "path";
84970
84970
  function readProjectApplyBundleInput(options) {
84971
84971
  if (options.file && options.directory) {
84972
84972
  throw new Error("Cannot use --file with --directory.");
@@ -85071,7 +85071,7 @@ function filesystemAssetReader(projectRoot) {
85071
85071
  function applyFileProjectRoot(file2) {
85072
85072
  let dir = dirname9(resolve4(file2));
85073
85073
  while (true) {
85074
- if (basename4(dir) === ".auto") {
85074
+ if (basename5(dir) === ".auto") {
85075
85075
  return dirname9(dir);
85076
85076
  }
85077
85077
  if (directoryHasAutoRoot(dir)) {
@@ -85099,7 +85099,7 @@ function isInside(path2, parent) {
85099
85099
  return path2.startsWith(`${parent}/`);
85100
85100
  }
85101
85101
  function validateAgentAvatarAsset(input) {
85102
- if (isAbsolute3(input.asset)) {
85102
+ if (isAbsolute4(input.asset)) {
85103
85103
  throw new Error(
85104
85104
  `Invalid identity avatar asset for "${input.resourceName}": asset path must be relative`
85105
85105
  );
@@ -98837,7 +98837,7 @@ import {
98837
98837
  writeFileSync as writeFileSync5
98838
98838
  } from "fs";
98839
98839
  import { tmpdir } from "os";
98840
- import { delimiter, dirname as dirname7, join as join5 } from "path";
98840
+ import { basename as basename3, delimiter, dirname as dirname7, isAbsolute as isAbsolute2, join as join5 } from "path";
98841
98841
 
98842
98842
  // src/commands/agent-bridge/harness/codex/options.ts
98843
98843
  import { join as join4 } from "path";
@@ -99021,6 +99021,7 @@ var CODEX_EDIT_PROBE = {
99021
99021
  ].join("\n")
99022
99022
  };
99023
99023
  var PROBE_TIMEOUT_MS = 15e3;
99024
+ var MAX_CODEX_SHIM_BYTES = 4096;
99024
99025
  var MAX_EVIDENCE_LENGTH = 300;
99025
99026
  var CODEX_PLATFORM_VENDOR_TARGETS = {
99026
99027
  linux: {
@@ -99063,7 +99064,7 @@ function codexEditFallthroughMarker(item) {
99063
99064
  return `agent_bridge_codex_edit_fallthrough item_id=${item.id} exit_code=127`;
99064
99065
  }
99065
99066
  function resolveCodexVendorLayout() {
99066
- const wrappers = executableCandidatesOnPath(CODEX_EXECUTABLE_PATH);
99067
+ const wrappers = executableCodexCandidates(CODEX_EXECUTABLE_PATH);
99067
99068
  if (wrappers.length === 0) {
99068
99069
  throw new Error("codex executable not found on PATH");
99069
99070
  }
@@ -99113,6 +99114,45 @@ function executableCandidatesOnPath(command) {
99113
99114
  }
99114
99115
  return candidates;
99115
99116
  }
99117
+ function executableCodexCandidates(command) {
99118
+ const candidates = executableCandidatesOnPath(command);
99119
+ const seen = new Set(candidates);
99120
+ for (let index = 0; index < candidates.length; index += 1) {
99121
+ const candidate = candidates[index];
99122
+ if (!candidate) {
99123
+ continue;
99124
+ }
99125
+ const target = directCodexShimTarget(candidate);
99126
+ if (target && !seen.has(target)) {
99127
+ seen.add(target);
99128
+ candidates.push(target);
99129
+ }
99130
+ }
99131
+ return candidates;
99132
+ }
99133
+ function directCodexShimTarget(candidate) {
99134
+ try {
99135
+ const resolved = realpathSync2(candidate);
99136
+ const metadata = lstatSync2(resolved);
99137
+ if (!metadata.isFile() || metadata.size > MAX_CODEX_SHIM_BYTES) {
99138
+ return null;
99139
+ }
99140
+ const script = readFileSync7(resolved, "utf8");
99141
+ if (!/^#!\/(?:bin\/|usr\/bin\/env )(?:ba)?sh\r?\n/.test(script)) {
99142
+ return null;
99143
+ }
99144
+ const targets = script.split(/\r?\n/).map(
99145
+ (line) => line.match(/^\s*exec\s+(?:"([^"]+)"|'([^']+)'|([^\s]+))\s+"\$@"\s*$/)
99146
+ ).filter((match) => match !== null).map((match) => match[1] ?? match[2] ?? match[3] ?? "");
99147
+ const [target] = targets;
99148
+ if (!target || targets.length !== 1) {
99149
+ return null;
99150
+ }
99151
+ return isAbsolute2(target) && basename3(target) === CODEX_EXECUTABLE_PATH && isExecutable(target) ? target : null;
99152
+ } catch {
99153
+ return null;
99154
+ }
99155
+ }
99116
99156
  function isExecutable(path2) {
99117
99157
  try {
99118
99158
  accessSync(path2, constants.X_OK);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autohq/cli",
3
- "version": "0.1.540",
3
+ "version": "0.1.541",
4
4
  "license": "SEE LICENSE IN README.md",
5
5
  "publishConfig": {
6
6
  "access": "public"