@autohq/cli 0.1.540 → 0.1.542
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/agent-bridge.js +59 -18
- package/dist/index.js +67 -26
- package/package.json +1 -1
package/dist/agent-bridge.js
CHANGED
|
@@ -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.
|
|
30873
|
+
version: "0.1.542",
|
|
30874
30874
|
license: "SEE LICENSE IN README.md",
|
|
30875
30875
|
publishConfig: {
|
|
30876
30876
|
access: "public"
|
|
@@ -75798,12 +75798,10 @@ import {
|
|
|
75798
75798
|
readFileSync as readFileSync7,
|
|
75799
75799
|
realpathSync as realpathSync3,
|
|
75800
75800
|
rmSync as rmSync2,
|
|
75801
|
-
symlinkSync as symlinkSync2,
|
|
75802
|
-
unlinkSync as unlinkSync2,
|
|
75803
75801
|
writeFileSync as writeFileSync4
|
|
75804
75802
|
} from "fs";
|
|
75805
75803
|
import { tmpdir } from "os";
|
|
75806
|
-
import { delimiter, dirname as dirname5, join as join3 } from "path";
|
|
75804
|
+
import { basename as basename2, delimiter, dirname as dirname5, isAbsolute as isAbsolute2, join as join3 } from "path";
|
|
75807
75805
|
|
|
75808
75806
|
// src/commands/agent-bridge/harness/codex/options.ts
|
|
75809
75807
|
import { join as join2 } from "path";
|
|
@@ -75987,6 +75985,7 @@ var CODEX_EDIT_PROBE = {
|
|
|
75987
75985
|
].join("\n")
|
|
75988
75986
|
};
|
|
75989
75987
|
var PROBE_TIMEOUT_MS = 15e3;
|
|
75988
|
+
var MAX_CODEX_SHIM_BYTES = 4096;
|
|
75990
75989
|
var MAX_EVIDENCE_LENGTH = 300;
|
|
75991
75990
|
var CODEX_PLATFORM_VENDOR_TARGETS = {
|
|
75992
75991
|
linux: {
|
|
@@ -76007,15 +76006,11 @@ function ensureCodexEditCapability(input) {
|
|
|
76007
76006
|
}
|
|
76008
76007
|
const startedAt = Date.now();
|
|
76009
76008
|
const layout = runStep(input, "resolve", () => resolveCodexVendorLayout());
|
|
76010
|
-
|
|
76011
|
-
input,
|
|
76012
|
-
"provision",
|
|
76013
|
-
() => provisionApplyPatchAlias(layout)
|
|
76014
|
-
);
|
|
76009
|
+
runStep(input, "validate", () => validateApplyPatchAlias(layout));
|
|
76015
76010
|
const alias = join3(layout.codexPathDir, CODEX_APPLY_PATCH_ALIAS);
|
|
76016
76011
|
runStep(input, "verify", () => verifyApplyPatchAlias(alias));
|
|
76017
76012
|
input.writeOutput?.(
|
|
76018
|
-
`agent_bridge_codex_edit_capability status
|
|
76013
|
+
`agent_bridge_codex_edit_capability status=ready alias=${alias} duration_ms=${Date.now() - startedAt}`
|
|
76019
76014
|
);
|
|
76020
76015
|
}
|
|
76021
76016
|
function codexEditFallthroughMarker(item) {
|
|
@@ -76029,7 +76024,7 @@ function codexEditFallthroughMarker(item) {
|
|
|
76029
76024
|
return `agent_bridge_codex_edit_fallthrough item_id=${item.id} exit_code=127`;
|
|
76030
76025
|
}
|
|
76031
76026
|
function resolveCodexVendorLayout() {
|
|
76032
|
-
const wrappers =
|
|
76027
|
+
const wrappers = executableCodexCandidates(CODEX_EXECUTABLE_PATH);
|
|
76033
76028
|
if (wrappers.length === 0) {
|
|
76034
76029
|
throw new Error("codex executable not found on PATH");
|
|
76035
76030
|
}
|
|
@@ -76079,6 +76074,45 @@ function executableCandidatesOnPath(command) {
|
|
|
76079
76074
|
}
|
|
76080
76075
|
return candidates;
|
|
76081
76076
|
}
|
|
76077
|
+
function executableCodexCandidates(command) {
|
|
76078
|
+
const candidates = executableCandidatesOnPath(command);
|
|
76079
|
+
const seen = new Set(candidates);
|
|
76080
|
+
for (let index = 0; index < candidates.length; index += 1) {
|
|
76081
|
+
const candidate = candidates[index];
|
|
76082
|
+
if (!candidate) {
|
|
76083
|
+
continue;
|
|
76084
|
+
}
|
|
76085
|
+
const target = directCodexShimTarget(candidate);
|
|
76086
|
+
if (target && !seen.has(target)) {
|
|
76087
|
+
seen.add(target);
|
|
76088
|
+
candidates.push(target);
|
|
76089
|
+
}
|
|
76090
|
+
}
|
|
76091
|
+
return candidates;
|
|
76092
|
+
}
|
|
76093
|
+
function directCodexShimTarget(candidate) {
|
|
76094
|
+
try {
|
|
76095
|
+
const resolved = realpathSync3(candidate);
|
|
76096
|
+
const metadata = lstatSync3(resolved);
|
|
76097
|
+
if (!metadata.isFile() || metadata.size > MAX_CODEX_SHIM_BYTES) {
|
|
76098
|
+
return null;
|
|
76099
|
+
}
|
|
76100
|
+
const script = readFileSync7(resolved, "utf8");
|
|
76101
|
+
if (!/^#!\/(?:bin\/|usr\/bin\/env )(?:ba)?sh\r?\n/.test(script)) {
|
|
76102
|
+
return null;
|
|
76103
|
+
}
|
|
76104
|
+
const targets = script.split(/\r?\n/).map(
|
|
76105
|
+
(line) => line.match(/^\s*exec\s+(?:"([^"]+)"|'([^']+)'|([^\s]+))\s+"\$@"\s*$/)
|
|
76106
|
+
).filter((match) => match !== null).map((match) => match[1] ?? match[2] ?? match[3] ?? "");
|
|
76107
|
+
const [target] = targets;
|
|
76108
|
+
if (!target || targets.length !== 1) {
|
|
76109
|
+
return null;
|
|
76110
|
+
}
|
|
76111
|
+
return isAbsolute2(target) && basename2(target) === CODEX_EXECUTABLE_PATH && isExecutable(target) ? target : null;
|
|
76112
|
+
} catch {
|
|
76113
|
+
return null;
|
|
76114
|
+
}
|
|
76115
|
+
}
|
|
76082
76116
|
function isExecutable(path2) {
|
|
76083
76117
|
try {
|
|
76084
76118
|
accessSync(path2, constants.X_OK);
|
|
@@ -76087,16 +76121,23 @@ function isExecutable(path2) {
|
|
|
76087
76121
|
return false;
|
|
76088
76122
|
}
|
|
76089
76123
|
}
|
|
76090
|
-
function
|
|
76124
|
+
function validateApplyPatchAlias(layout) {
|
|
76091
76125
|
const alias = join3(layout.codexPathDir, CODEX_APPLY_PATCH_ALIAS);
|
|
76092
|
-
if (
|
|
76093
|
-
|
|
76126
|
+
if (!lstatExists(alias)) {
|
|
76127
|
+
throw new Error(
|
|
76128
|
+
`required preinstalled apply_patch alias is missing: ${alias}`
|
|
76129
|
+
);
|
|
76130
|
+
}
|
|
76131
|
+
if (!lstatSync3(alias).isSymbolicLink()) {
|
|
76132
|
+
throw new Error(
|
|
76133
|
+
`preinstalled apply_patch alias is not a symbolic link: ${alias}`
|
|
76134
|
+
);
|
|
76094
76135
|
}
|
|
76095
|
-
if (
|
|
76096
|
-
|
|
76136
|
+
if (!aliasResolvesToBinary(alias, layout.binary)) {
|
|
76137
|
+
throw new Error(
|
|
76138
|
+
`preinstalled apply_patch alias does not resolve to the vendored Codex binary: ${alias}`
|
|
76139
|
+
);
|
|
76097
76140
|
}
|
|
76098
|
-
symlinkSync2(layout.binary, alias);
|
|
76099
|
-
return "provisioned";
|
|
76100
76141
|
}
|
|
76101
76142
|
function aliasResolvesToBinary(alias, binary) {
|
|
76102
76143
|
try {
|
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.
|
|
81647
|
+
version: "0.1.542",
|
|
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
|
|
81772
|
+
basename as basename4,
|
|
81773
81773
|
dirname as dirname8,
|
|
81774
81774
|
extname,
|
|
81775
|
-
isAbsolute as
|
|
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 =
|
|
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 (
|
|
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 (
|
|
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
|
|
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 (
|
|
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 (
|
|
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
|
);
|
|
@@ -98832,12 +98832,10 @@ import {
|
|
|
98832
98832
|
readFileSync as readFileSync7,
|
|
98833
98833
|
realpathSync as realpathSync2,
|
|
98834
98834
|
rmSync as rmSync2,
|
|
98835
|
-
symlinkSync,
|
|
98836
|
-
unlinkSync,
|
|
98837
98835
|
writeFileSync as writeFileSync5
|
|
98838
98836
|
} from "fs";
|
|
98839
98837
|
import { tmpdir } from "os";
|
|
98840
|
-
import { delimiter, dirname as dirname7, join as join5 } from "path";
|
|
98838
|
+
import { basename as basename3, delimiter, dirname as dirname7, isAbsolute as isAbsolute2, join as join5 } from "path";
|
|
98841
98839
|
|
|
98842
98840
|
// src/commands/agent-bridge/harness/codex/options.ts
|
|
98843
98841
|
import { join as join4 } from "path";
|
|
@@ -99021,6 +99019,7 @@ var CODEX_EDIT_PROBE = {
|
|
|
99021
99019
|
].join("\n")
|
|
99022
99020
|
};
|
|
99023
99021
|
var PROBE_TIMEOUT_MS = 15e3;
|
|
99022
|
+
var MAX_CODEX_SHIM_BYTES = 4096;
|
|
99024
99023
|
var MAX_EVIDENCE_LENGTH = 300;
|
|
99025
99024
|
var CODEX_PLATFORM_VENDOR_TARGETS = {
|
|
99026
99025
|
linux: {
|
|
@@ -99041,15 +99040,11 @@ function ensureCodexEditCapability(input) {
|
|
|
99041
99040
|
}
|
|
99042
99041
|
const startedAt = Date.now();
|
|
99043
99042
|
const layout = runStep(input, "resolve", () => resolveCodexVendorLayout());
|
|
99044
|
-
|
|
99045
|
-
input,
|
|
99046
|
-
"provision",
|
|
99047
|
-
() => provisionApplyPatchAlias(layout)
|
|
99048
|
-
);
|
|
99043
|
+
runStep(input, "validate", () => validateApplyPatchAlias(layout));
|
|
99049
99044
|
const alias = join5(layout.codexPathDir, CODEX_APPLY_PATCH_ALIAS);
|
|
99050
99045
|
runStep(input, "verify", () => verifyApplyPatchAlias(alias));
|
|
99051
99046
|
input.writeOutput?.(
|
|
99052
|
-
`agent_bridge_codex_edit_capability status
|
|
99047
|
+
`agent_bridge_codex_edit_capability status=ready alias=${alias} duration_ms=${Date.now() - startedAt}`
|
|
99053
99048
|
);
|
|
99054
99049
|
}
|
|
99055
99050
|
function codexEditFallthroughMarker(item) {
|
|
@@ -99063,7 +99058,7 @@ function codexEditFallthroughMarker(item) {
|
|
|
99063
99058
|
return `agent_bridge_codex_edit_fallthrough item_id=${item.id} exit_code=127`;
|
|
99064
99059
|
}
|
|
99065
99060
|
function resolveCodexVendorLayout() {
|
|
99066
|
-
const wrappers =
|
|
99061
|
+
const wrappers = executableCodexCandidates(CODEX_EXECUTABLE_PATH);
|
|
99067
99062
|
if (wrappers.length === 0) {
|
|
99068
99063
|
throw new Error("codex executable not found on PATH");
|
|
99069
99064
|
}
|
|
@@ -99113,6 +99108,45 @@ function executableCandidatesOnPath(command) {
|
|
|
99113
99108
|
}
|
|
99114
99109
|
return candidates;
|
|
99115
99110
|
}
|
|
99111
|
+
function executableCodexCandidates(command) {
|
|
99112
|
+
const candidates = executableCandidatesOnPath(command);
|
|
99113
|
+
const seen = new Set(candidates);
|
|
99114
|
+
for (let index = 0; index < candidates.length; index += 1) {
|
|
99115
|
+
const candidate = candidates[index];
|
|
99116
|
+
if (!candidate) {
|
|
99117
|
+
continue;
|
|
99118
|
+
}
|
|
99119
|
+
const target = directCodexShimTarget(candidate);
|
|
99120
|
+
if (target && !seen.has(target)) {
|
|
99121
|
+
seen.add(target);
|
|
99122
|
+
candidates.push(target);
|
|
99123
|
+
}
|
|
99124
|
+
}
|
|
99125
|
+
return candidates;
|
|
99126
|
+
}
|
|
99127
|
+
function directCodexShimTarget(candidate) {
|
|
99128
|
+
try {
|
|
99129
|
+
const resolved = realpathSync2(candidate);
|
|
99130
|
+
const metadata = lstatSync2(resolved);
|
|
99131
|
+
if (!metadata.isFile() || metadata.size > MAX_CODEX_SHIM_BYTES) {
|
|
99132
|
+
return null;
|
|
99133
|
+
}
|
|
99134
|
+
const script = readFileSync7(resolved, "utf8");
|
|
99135
|
+
if (!/^#!\/(?:bin\/|usr\/bin\/env )(?:ba)?sh\r?\n/.test(script)) {
|
|
99136
|
+
return null;
|
|
99137
|
+
}
|
|
99138
|
+
const targets = script.split(/\r?\n/).map(
|
|
99139
|
+
(line) => line.match(/^\s*exec\s+(?:"([^"]+)"|'([^']+)'|([^\s]+))\s+"\$@"\s*$/)
|
|
99140
|
+
).filter((match) => match !== null).map((match) => match[1] ?? match[2] ?? match[3] ?? "");
|
|
99141
|
+
const [target] = targets;
|
|
99142
|
+
if (!target || targets.length !== 1) {
|
|
99143
|
+
return null;
|
|
99144
|
+
}
|
|
99145
|
+
return isAbsolute2(target) && basename3(target) === CODEX_EXECUTABLE_PATH && isExecutable(target) ? target : null;
|
|
99146
|
+
} catch {
|
|
99147
|
+
return null;
|
|
99148
|
+
}
|
|
99149
|
+
}
|
|
99116
99150
|
function isExecutable(path2) {
|
|
99117
99151
|
try {
|
|
99118
99152
|
accessSync(path2, constants.X_OK);
|
|
@@ -99121,16 +99155,23 @@ function isExecutable(path2) {
|
|
|
99121
99155
|
return false;
|
|
99122
99156
|
}
|
|
99123
99157
|
}
|
|
99124
|
-
function
|
|
99158
|
+
function validateApplyPatchAlias(layout) {
|
|
99125
99159
|
const alias = join5(layout.codexPathDir, CODEX_APPLY_PATCH_ALIAS);
|
|
99126
|
-
if (
|
|
99127
|
-
|
|
99160
|
+
if (!lstatExists(alias)) {
|
|
99161
|
+
throw new Error(
|
|
99162
|
+
`required preinstalled apply_patch alias is missing: ${alias}`
|
|
99163
|
+
);
|
|
99164
|
+
}
|
|
99165
|
+
if (!lstatSync2(alias).isSymbolicLink()) {
|
|
99166
|
+
throw new Error(
|
|
99167
|
+
`preinstalled apply_patch alias is not a symbolic link: ${alias}`
|
|
99168
|
+
);
|
|
99128
99169
|
}
|
|
99129
|
-
if (
|
|
99130
|
-
|
|
99170
|
+
if (!aliasResolvesToBinary(alias, layout.binary)) {
|
|
99171
|
+
throw new Error(
|
|
99172
|
+
`preinstalled apply_patch alias does not resolve to the vendored Codex binary: ${alias}`
|
|
99173
|
+
);
|
|
99131
99174
|
}
|
|
99132
|
-
symlinkSync(layout.binary, alias);
|
|
99133
|
-
return "provisioned";
|
|
99134
99175
|
}
|
|
99135
99176
|
function aliasResolvesToBinary(alias, binary) {
|
|
99136
99177
|
try {
|