@parcha/agentrun-harness-codex 0.1.0-beta.79 → 0.1.0-beta.80
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/CHANGELOG.md +7 -0
- package/dist/config.js +3 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/verify.d.ts +13 -3
- package/dist/verify.js +79 -9
- package/dist/versions.d.ts +7 -2
- package/dist/versions.js +11 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## 0.1.0-beta.80 (2026-12-01)
|
|
6
|
+
|
|
7
|
+
**Breaking:**
|
|
8
|
+
|
|
9
|
+
- The adapter now checks Codex's code-mode host (`codex-code-mode-host`, the binary a code-mode model's `exec` runs in) against a pinned sha256 per target, as it checks Codex's own binary. It looks for the host where Codex does, from the real path of Codex's binary (a link to Codex leads to the folder of the file it links to). In a package's layout (a `codex-package.json` in the folder above `bin/`), that is the package's `codex-resources/` when the host is there, and otherwise the host beside Codex. A host in the other place is checked too. A host that is not the pinned build is refused with `CodexPinMismatch` (pin `code_mode_host_sha256`), and a missing one with `CodexNotInstalled`, before any run starts. A check that passed is kept for the process only while the binary and each host stay the same files, unchanged. `codexPins()` now includes `hostSha256`, and `CODE_MODE_HOST_SHA256` is exported. <!-- changes/codex-code-mode-host-pin.md -->
|
|
10
|
+
A platform the pins list no host for is refused with `CodexPinMismatch` (pin `code_mode_host_sha256`). Pins of a caller's own that leave out `hostSha256` are refused the same way; set `hostSha256: null` to leave the host unchecked, for example for a binary that runs no code-mode model.
|
|
11
|
+
|
|
5
12
|
## 0.1.0-beta.75 (2026-11-30)
|
|
6
13
|
|
|
7
14
|
- On Codex, a call a person denied is no longer made again. When an `exec` waited for a person's approval, the model was told afterwards that its script "was cut short (the session stopped)". It read the denial as a crash to retry past, and asked the person the same question until they cancelled. The output now says the script stopped at a call that waited for approval. When the call was refused, because the person declined it or because the tool was set to deny while the call waited, the output adds that the refusal is an answer: the model should finish without the call or say what it needed it for. <!-- changes/codex-declined-call-not-retried.md -->
|
package/dist/config.js
CHANGED
|
@@ -16,7 +16,10 @@
|
|
|
16
16
|
* call chatgpt.com or start a daemon.
|
|
17
17
|
*/
|
|
18
18
|
export const BUILTINS_OFF = {
|
|
19
|
+
// The shell's gate: with it off no shell tool is offered, unified exec's included.
|
|
19
20
|
shell_tool: false,
|
|
21
|
+
// Not a gate in the pinned Codex, which turns unified exec back on whatever config.toml says (codex-rs
|
|
22
|
+
// managed_features.rs, normalize_candidate); kept off here in case a later release honours it.
|
|
20
23
|
unified_exec: false,
|
|
21
24
|
view_image: false,
|
|
22
25
|
image_generation: false,
|
package/dist/index.d.ts
CHANGED
|
@@ -10,4 +10,4 @@ export { CODEX_VERSION, codexBinary, codexTarget } from "./binary.js";
|
|
|
10
10
|
/** The shapes of a tool's schema Codex 0.164 drops or retypes (schema.ts): a host may refuse them sooner (an MCP grant, at its save). */
|
|
11
11
|
export { codexSchemaProblems } from "./schema.js";
|
|
12
12
|
export { verifyCodex, verifyCodexAsync, verifyCodexBinary, verifyCodexBinaryAsync } from "./verify.js";
|
|
13
|
-
export { CODEX_BASE_INPUT_TOKENS, CODEX_BINARY_SHA256, CODEX_INSTALL, CODEX_NPM_INTEGRITY, CodexNotInstalled, CodexPinMismatch } from "./versions.js";
|
|
13
|
+
export { CODE_MODE_HOST_SHA256, CODEX_BASE_INPUT_TOKENS, CODEX_BINARY_SHA256, CODEX_INSTALL, CODEX_NPM_INTEGRITY, CodexNotInstalled, CodexPinMismatch } from "./versions.js";
|
package/dist/index.js
CHANGED
|
@@ -7,4 +7,4 @@ export { CODEX_VERSION, codexBinary, codexTarget } from "./binary.js";
|
|
|
7
7
|
/** The shapes of a tool's schema Codex 0.164 drops or retypes (schema.ts): a host may refuse them sooner (an MCP grant, at its save). */
|
|
8
8
|
export { codexSchemaProblems } from "./schema.js";
|
|
9
9
|
export { verifyCodex, verifyCodexAsync, verifyCodexBinary, verifyCodexBinaryAsync } from "./verify.js";
|
|
10
|
-
export { CODEX_BASE_INPUT_TOKENS, CODEX_BINARY_SHA256, CODEX_INSTALL, CODEX_NPM_INTEGRITY, CodexNotInstalled, CodexPinMismatch } from "./versions.js";
|
|
10
|
+
export { CODE_MODE_HOST_SHA256, CODEX_BASE_INPUT_TOKENS, CODEX_BINARY_SHA256, CODEX_INSTALL, CODEX_NPM_INTEGRITY, CodexNotInstalled, CodexPinMismatch } from "./versions.js";
|
package/dist/verify.d.ts
CHANGED
|
@@ -6,20 +6,30 @@ export interface CodexPins {
|
|
|
6
6
|
sha256?: string;
|
|
7
7
|
/** The platform package's version (`<version>-<platform>`), when the binary came from one. */
|
|
8
8
|
packageVersion?: string;
|
|
9
|
+
/** The code-mode host's sha256 (CODE_MODE_HOST_SHA256), checked wherever Codex finds it (codeModeHostOf). Undefined
|
|
10
|
+
* (a target the pins do not list) refuses the binary: no host Codex would run is unchecked. `null` leaves the host
|
|
11
|
+
* unchecked, for a caller that names its own pins and runs no code-mode model. */
|
|
12
|
+
hostSha256?: string | null;
|
|
9
13
|
}
|
|
10
14
|
/** The pins for this platform's binary. */
|
|
11
15
|
export declare function codexPins(target?: {
|
|
12
16
|
target: string;
|
|
13
17
|
pkg: string;
|
|
14
18
|
} | undefined): CodexPins;
|
|
19
|
+
/** The code-mode host Codex at `codex` runs, as Codex finds it (codex-rs install-context, code_mode_host_program), from
|
|
20
|
+
* its own executable's real path: in its package's layout (a codex-package.json in the folder above its own), the
|
|
21
|
+
* package's `codex-resources/codex-code-mode-host` when that is a file; else, and with no codex-package.json, the
|
|
22
|
+
* `codex-code-mode-host` beside Codex. */
|
|
23
|
+
export declare function codeModeHostOf(codex: string): string;
|
|
15
24
|
/**
|
|
16
25
|
* The binary at `found.path` checked against `pins`, in order: the platform package's version, the binary's sha256,
|
|
17
|
-
*
|
|
26
|
+
* the sha256 of each code-mode host it could run (codeModeHostOf, from its real path; none pinned for the platform is a
|
|
27
|
+
* refusal), then the version it reports. Returns the path, or the typed error (not thrown) naming the pin, what was expected and
|
|
18
28
|
* what was found. No path, or a binary that cannot be read or run, is `CodexNotInstalled`. The path is made absolute
|
|
19
29
|
* first, from this process's working directory, and that is the one checked and returned: a session starts the binary
|
|
20
30
|
* from its own directory, where a relative `CODEX_BIN` names nothing. The sha256 is read a chunk at a time, never the
|
|
21
|
-
* whole binary in memory, and a check that passed holds for this process while the binary
|
|
22
|
-
* (the kernel's checkedOnce): a host that checks it for each model it resolves, and a run's process that makes its
|
|
31
|
+
* whole binary in memory, and a check that passed holds for this process while the binary and each code-mode host stay
|
|
32
|
+
* the same files, unchanged (the kernel's checkedOnce, keyed by the hosts too): a host that checks it for each model it resolves, and a run's process that makes its
|
|
23
33
|
* adapter, check it once. Its reads hold the event loop: a host checks with verifyCodexBinaryAsync first.
|
|
24
34
|
*/
|
|
25
35
|
export declare function verifyCodexBinary(found: {
|
package/dist/verify.js
CHANGED
|
@@ -1,33 +1,87 @@
|
|
|
1
1
|
// The installed Codex checked against the pins (src/versions.ts) before anything runs, with the typed errors a host maps
|
|
2
2
|
// to a run's failure line. Written for AgentRun.
|
|
3
|
-
import { existsSync } from "node:fs";
|
|
4
|
-
import { resolve } from "node:path";
|
|
3
|
+
import { existsSync, realpathSync, statSync } from "node:fs";
|
|
4
|
+
import { dirname, join, resolve } from "node:path";
|
|
5
5
|
import { env } from "node:process";
|
|
6
6
|
import { checkedOnce, checkedOnceAsync } from "@parcha/agentrun-kernel/host";
|
|
7
7
|
import { codexTarget, findCodex } from "./binary.js";
|
|
8
|
-
import { CODEX_BINARY_SHA256, CODEX_VERSION, CodexNotInstalled, CodexPinMismatch } from "./versions.js";
|
|
8
|
+
import { CODE_MODE_HOST_SHA256, CODEX_BINARY_SHA256, CODEX_VERSION, CodexNotInstalled, CodexPinMismatch } from "./versions.js";
|
|
9
9
|
/** The pins for this platform's binary. */
|
|
10
10
|
export function codexPins(target = codexTarget()) {
|
|
11
|
-
return { version: CODEX_VERSION, sha256: target ? CODEX_BINARY_SHA256[target.target] : undefined, packageVersion: target ? `${CODEX_VERSION}-${target.pkg}` : undefined };
|
|
11
|
+
return { version: CODEX_VERSION, sha256: target ? CODEX_BINARY_SHA256[target.target] : undefined, packageVersion: target ? `${CODEX_VERSION}-${target.pkg}` : undefined, hostSha256: target ? CODE_MODE_HOST_SHA256[target.target] : undefined };
|
|
12
|
+
}
|
|
13
|
+
const HOST = "codex-code-mode-host";
|
|
14
|
+
const isFile = (path) => {
|
|
15
|
+
try {
|
|
16
|
+
return statSync(path).isFile();
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
/** The folder Codex at `codex` runs from: its real path's, as Codex reads its own executable (current_exe), so a link to
|
|
23
|
+
* Codex leads to the folder of the file it links to. */
|
|
24
|
+
const exeOf = (codex) => {
|
|
25
|
+
try {
|
|
26
|
+
return realpathSync(codex);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return codex;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
/** The code-mode host Codex at `codex` runs, as Codex finds it (codex-rs install-context, code_mode_host_program), from
|
|
33
|
+
* its own executable's real path: in its package's layout (a codex-package.json in the folder above its own), the
|
|
34
|
+
* package's `codex-resources/codex-code-mode-host` when that is a file; else, and with no codex-package.json, the
|
|
35
|
+
* `codex-code-mode-host` beside Codex. */
|
|
36
|
+
export function codeModeHostOf(codex) {
|
|
37
|
+
const exe = exeOf(codex);
|
|
38
|
+
const pkg = dirname(dirname(exe));
|
|
39
|
+
const resources = join(pkg, "codex-resources", HOST);
|
|
40
|
+
return isFile(join(pkg, "codex-package.json")) && isFile(resources) ? resources : join(dirname(exe), HOST);
|
|
41
|
+
}
|
|
42
|
+
/** Every code-mode host by Codex at `codex` that is there: the one it runs (codeModeHostOf) first, then the other place
|
|
43
|
+
* it could look, so a host there is held to the pin too and no reading of Codex's rule leaves one unchecked. */
|
|
44
|
+
function codeModeHostsOf(codex) {
|
|
45
|
+
const runs = codeModeHostOf(codex);
|
|
46
|
+
const exe = exeOf(codex);
|
|
47
|
+
const others = [join(dirname(exe), HOST), join(dirname(dirname(exe)), "codex-resources", HOST)].filter((each) => each !== runs && isFile(each));
|
|
48
|
+
return [runs, ...others];
|
|
49
|
+
}
|
|
50
|
+
/** What the check of the binary at `path` against `pins` is kept by, besides the binary itself: the pins, and each
|
|
51
|
+
* code-mode host as the file it is now, so a host changed or swapped after a check that passed is checked again. */
|
|
52
|
+
function checkKey(path, pins) {
|
|
53
|
+
if (!pins.hostSha256)
|
|
54
|
+
return JSON.stringify(pins);
|
|
55
|
+
const hosts = codeModeHostsOf(resolve(path)).map((host) => {
|
|
56
|
+
try {
|
|
57
|
+
const st = statSync(host, { bigint: true });
|
|
58
|
+
return [host, st.dev, st.ino, st.size, st.mtimeNs, st.ctimeNs].join(":");
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return `${host}:none`;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
return JSON.stringify({ pins, hosts });
|
|
12
65
|
}
|
|
13
66
|
/**
|
|
14
67
|
* The binary at `found.path` checked against `pins`, in order: the platform package's version, the binary's sha256,
|
|
15
|
-
*
|
|
68
|
+
* the sha256 of each code-mode host it could run (codeModeHostOf, from its real path; none pinned for the platform is a
|
|
69
|
+
* refusal), then the version it reports. Returns the path, or the typed error (not thrown) naming the pin, what was expected and
|
|
16
70
|
* what was found. No path, or a binary that cannot be read or run, is `CodexNotInstalled`. The path is made absolute
|
|
17
71
|
* first, from this process's working directory, and that is the one checked and returned: a session starts the binary
|
|
18
72
|
* from its own directory, where a relative `CODEX_BIN` names nothing. The sha256 is read a chunk at a time, never the
|
|
19
|
-
* whole binary in memory, and a check that passed holds for this process while the binary
|
|
20
|
-
* (the kernel's checkedOnce): a host that checks it for each model it resolves, and a run's process that makes its
|
|
73
|
+
* whole binary in memory, and a check that passed holds for this process while the binary and each code-mode host stay
|
|
74
|
+
* the same files, unchanged (the kernel's checkedOnce, keyed by the hosts too): a host that checks it for each model it resolves, and a run's process that makes its
|
|
21
75
|
* adapter, check it once. Its reads hold the event loop: a host checks with verifyCodexBinaryAsync first.
|
|
22
76
|
*/
|
|
23
77
|
export function verifyCodexBinary(found, pins = codexPins()) {
|
|
24
78
|
const at = located(found, pins);
|
|
25
|
-
return at instanceof Error ? at : checkedOnce(at.path,
|
|
79
|
+
return at instanceof Error ? at : checkedOnce(at.path, checkKey(at.path, pins), () => checkBinary(at.path, pins), passed);
|
|
26
80
|
}
|
|
27
81
|
/** verifyCodexBinary without holding the event loop (the kernel's checkedOnceAsync), its pass kept for it too. */
|
|
28
82
|
export async function verifyCodexBinaryAsync(found, pins = codexPins()) {
|
|
29
83
|
const at = located(found, pins);
|
|
30
|
-
return at instanceof Error ? at : checkedOnceAsync(at.path,
|
|
84
|
+
return at instanceof Error ? at : checkedOnceAsync(at.path, checkKey(at.path, pins), () => checkBinary(at.path, pins), passed);
|
|
31
85
|
}
|
|
32
86
|
const passed = (result) => !(result instanceof Error);
|
|
33
87
|
/** The absolute path of `found`, there and of the pinned package's version; or why not. */
|
|
@@ -56,6 +110,22 @@ function* checkBinary(path, pins) {
|
|
|
56
110
|
if (sha256 !== pins.sha256)
|
|
57
111
|
return new CodexPinMismatch("binary_sha256", pins.sha256, sha256, path);
|
|
58
112
|
}
|
|
113
|
+
// No host pinned for this target: refused, since the host Codex would run is checked against nothing.
|
|
114
|
+
if (pins.hostSha256 === undefined)
|
|
115
|
+
return new CodexPinMismatch("code_mode_host_sha256", "a pinned sha256", "unpinned on this platform", codeModeHostOf(path));
|
|
116
|
+
if (pins.hostSha256 !== null) {
|
|
117
|
+
for (const host of codeModeHostsOf(path)) {
|
|
118
|
+
let sha256;
|
|
119
|
+
try {
|
|
120
|
+
sha256 = yield { kind: "sha256", path: host };
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
return new CodexNotInstalled(`its code-mode host ${host} could not be read: ${String(error?.message ?? error).slice(0, 120)}`);
|
|
124
|
+
}
|
|
125
|
+
if (sha256 !== pins.hostSha256)
|
|
126
|
+
return new CodexPinMismatch("code_mode_host_sha256", pins.hostSha256, sha256, host);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
59
129
|
let reported;
|
|
60
130
|
try {
|
|
61
131
|
reported = (yield { kind: "run", path, args: ["--version"], env: { PATH: env.PATH ?? "/usr/bin:/bin" }, timeoutMs: 10_000 }).trim();
|
package/dist/versions.d.ts
CHANGED
|
@@ -18,8 +18,13 @@ export declare const CODEX_NPM_INTEGRITY: Readonly<Record<string, string>>;
|
|
|
18
18
|
/** The sha256 of the pinned native binary (`vendor/<target>/bin/codex` in the platform package), per target, read from
|
|
19
19
|
* the published packages those integrities name. A binary for a target listed here runs only if it matches. */
|
|
20
20
|
export declare const CODEX_BINARY_SHA256: Readonly<Record<string, string>>;
|
|
21
|
-
/**
|
|
22
|
-
|
|
21
|
+
/** The sha256 of the pinned code-mode host (`vendor/<target>/bin/codex-code-mode-host` in the platform package), per
|
|
22
|
+
* target, read from the same published packages: the binary Codex runs a code-mode model's `exec` in (config.ts
|
|
23
|
+
* code_mode_host). It runs only if it matches, wherever Codex finds it (verify.ts codeModeHostOf). */
|
|
24
|
+
export declare const CODE_MODE_HOST_SHA256: Readonly<Record<string, string>>;
|
|
25
|
+
/** Which pin a mismatch is about: the binary's sha256, the version it reports, the platform package's version, or the
|
|
26
|
+
* code-mode host's sha256. */
|
|
27
|
+
export type CodexPin = "binary_sha256" | "version" | "package_version" | "code_mode_host_sha256";
|
|
23
28
|
/** The installed Codex is not the build this adapter is pinned to and checked with: nothing runs. */
|
|
24
29
|
export declare class CodexPinMismatch extends Error {
|
|
25
30
|
readonly pin: CodexPin;
|
package/dist/versions.js
CHANGED
|
@@ -33,6 +33,15 @@ export const CODEX_BINARY_SHA256 = Object.freeze({
|
|
|
33
33
|
"x86_64-apple-darwin": "d7e19691e0c1945612475ee8ab32e59ead55472e976b5cea1682d827d34dbba1",
|
|
34
34
|
"aarch64-apple-darwin": "d8990e3ee7acfbc26f91265b12a1a83f0fee40d0e0f8f1f40a37d4ec21f499cf",
|
|
35
35
|
});
|
|
36
|
+
/** The sha256 of the pinned code-mode host (`vendor/<target>/bin/codex-code-mode-host` in the platform package), per
|
|
37
|
+
* target, read from the same published packages: the binary Codex runs a code-mode model's `exec` in (config.ts
|
|
38
|
+
* code_mode_host). It runs only if it matches, wherever Codex finds it (verify.ts codeModeHostOf). */
|
|
39
|
+
export const CODE_MODE_HOST_SHA256 = Object.freeze({
|
|
40
|
+
"x86_64-unknown-linux-musl": "8ee4f472e92ac226a189e98998633b2d07f989f208515750764db660369f2926",
|
|
41
|
+
"aarch64-unknown-linux-musl": "7d28b996b825b13ea058af67655b619a26a125d61d4fb2985694a9c4e77d2e21",
|
|
42
|
+
"x86_64-apple-darwin": "067f9c14f67b02bdb984d4fc4740da14cd397da7ee60b4506eb378921afe3e7d",
|
|
43
|
+
"aarch64-apple-darwin": "416721e33af8822041dc650793512b3e58d43e0be4f3a5c6187eb4dfaad3148a",
|
|
44
|
+
});
|
|
36
45
|
/** The installed Codex is not the build this adapter is pinned to and checked with: nothing runs. */
|
|
37
46
|
export class CodexPinMismatch extends Error {
|
|
38
47
|
pin;
|
|
@@ -41,7 +50,8 @@ export class CodexPinMismatch extends Error {
|
|
|
41
50
|
path;
|
|
42
51
|
code = "CODEX_PIN_MISMATCH";
|
|
43
52
|
constructor(pin, expected, found, path) {
|
|
44
|
-
|
|
53
|
+
const what = pin === "package_version" ? "platform package" : pin === "code_mode_host_sha256" ? "code-mode host" : "binary";
|
|
54
|
+
super(`agentrun-harness-codex: the Codex ${what}${path ? ` at ${path}` : ""} is not the pinned build: its ${pin === "code_mode_host_sha256" ? "sha256" : pin.replace("_", " ")} is ${found}, not ${expected}`);
|
|
45
55
|
this.pin = pin;
|
|
46
56
|
this.expected = expected;
|
|
47
57
|
this.found = found;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parcha/agentrun-harness-codex",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.80",
|
|
4
4
|
"description": "Codex as an AgentRun harness: a tool-less Codex app-server behind a loopback model proxy, durable in AgentRun's own store, with the host's tools as its only tools.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentrun",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"test": "node --test --test-concurrency=8 'test/*.test.mjs'"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@parcha/agentrun-kernel": "0.1.0-beta.
|
|
47
|
+
"@parcha/agentrun-kernel": "0.1.0-beta.80"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@openai/codex": "0.164.0"
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@openai/codex": "0.164.0",
|
|
59
|
-
"@parcha/agentrun-dsl": "0.1.0-beta.
|
|
59
|
+
"@parcha/agentrun-dsl": "0.1.0-beta.80"
|
|
60
60
|
},
|
|
61
61
|
"repository": {
|
|
62
62
|
"type": "git",
|