@parcha/agentrun-harness-codex 0.1.0-beta.32 → 0.1.0-beta.34

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 CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## 0.1.0-beta.34 (2026-11-11)
6
+
7
+ - The server checks a harness's pinned binary (claude-agent's CLI, Codex, OpenCode: its sha256, then the version it reports) without holding its event loop, so requests, timers and store answers go on while a binary of hundreds of MiB is hashed and run. Before, the first check in a process held every request for one to several seconds (GET /v2/capabilities, a server's start, an adapter made for a run). The binary is now hashed off the loop a chunk at a time and run as a child the loop does not wait on. A pass is kept for the adapter's own check, which then reads nothing, and two checks of one binary at once read it once. New: `checkedOnceAsync` and `sha256OfFileAsync` (kernel host), `verifyClaudeAgentCliAsync` (claude-agent), and `verifyCodexAsync` and `verifyCodexBinaryAsync` (Codex). Who breaks: a program that calls the kernel's `checkedOnce` with its own check. A check is now a `BinaryCheck`, a generator that yields each probe (`{ kind: "sha256", path }` or `{ kind: "run", path, args, env, timeoutMs }`) and is given back its answer, so one check runs either way.
8
+ - A codex, opencode or claude-agent run that reads one of its skills' files (`read_skill_file`) now shows the call and its result on the run's Timeline, as pi's tool calls are shown. On the runner, the adapter's own skill reader ran outside the run's record, so the Timeline had no row for it. The read now goes through the host's tool path (the record, the rule before a side effect, the host's hooks on its result); a new `SessionIO.hostTool` hands an adapter's own tool to the host, and the kernel's `hostedTool(io, tool)` applies it.
9
+ - Upgrading: nothing to change.
10
+
5
11
  ## 0.1.0-beta.32 (2026-11-10)
6
12
 
7
13
  - The code copied from the upstream durable harness is now AgentRun's own: the port froze, and the pristine upstream copies, the named patches, the import tables, `scripts/port-durable-harness.mjs` and `npm run verify:port` are gone. `vendor/durable-harness/UPSTREAM.json` still records where each copy came from, and each copy keeps its header and NOTICE its attribution. With it go the kernel's paths that never run:
package/dist/adapter.js CHANGED
@@ -11,7 +11,7 @@
11
11
  // skills turned off. With no shell, the model reads a skill's files with `read_skill_file`.
12
12
  import { createHash, randomBytes, randomUUID } from "node:crypto";
13
13
  import { join } from "node:path";
14
- import { HOST_RESULT_MAX_CHARS, READ_SKILL_FILE, readSkillFileTool, skillProblems, toolSchemaProblems } from "@parcha/agentrun-kernel";
14
+ import { HOST_RESULT_MAX_CHARS, READ_SKILL_FILE, hostedTool, readSkillFileTool, skillProblems, toolSchemaProblems } from "@parcha/agentrun-kernel";
15
15
  import { abortedOutcome, openDrive, SessionHalt } from "@parcha/agentrun-kernel/kernel";
16
16
  import { pendingSubmissions } from "@parcha/agentrun-kernel/kernel";
17
17
  import { NativeJournal, recoveryNote, settleTurn, transcriptOf } from "@parcha/agentrun-kernel/process";
@@ -159,7 +159,7 @@ export function codexAdapter(options) {
159
159
  if (!dir)
160
160
  throw new Error("agentrun-harness-codex: a session needs a private directory: the host lends one (io.dir), or pass sessionsDir");
161
161
  // With skills the model also reads their files (read_skill_file), from the session's own copy of them.
162
- const tools = skills.length ? [...spec.tools, readSkillFileTool(join(sessionDir(dir, "codex-home"), SKILLS_DIR), skills.map((skill) => ({ name: skill.name, files: Object.keys(skill.files) })))] : spec.tools;
162
+ const tools = skills.length ? [...spec.tools, hostedTool(io, readSkillFileTool(join(sessionDir(dir, "codex-home"), SKILLS_DIR), skills.map((skill) => ({ name: skill.name, files: Object.keys(skill.files) }))))] : spec.tools;
163
163
  const effort = spec.effort ?? spec.thinking;
164
164
  const harnessOptions = {
165
165
  tools: tools.map(kernelTool),
package/dist/index.d.ts CHANGED
@@ -9,5 +9,5 @@ export type { ChildCommand, ConfineChild } from "./host/machine.js";
9
9
  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
- export { verifyCodex, verifyCodexBinary } from "./verify.js";
12
+ export { verifyCodex, verifyCodexAsync, verifyCodexBinary, verifyCodexBinaryAsync } from "./verify.js";
13
13
  export { CODEX_BINARY_SHA256, CODEX_INSTALL, CODEX_NPM_INTEGRITY, CodexNotInstalled, CodexPinMismatch } from "./versions.js";
package/dist/index.js CHANGED
@@ -6,5 +6,5 @@ export { skillProblems } from "@parcha/agentrun-kernel";
6
6
  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
- export { verifyCodex, verifyCodexBinary } from "./verify.js";
9
+ export { verifyCodex, verifyCodexAsync, verifyCodexBinary, verifyCodexBinaryAsync } from "./verify.js";
10
10
  export { CODEX_BINARY_SHA256, CODEX_INSTALL, CODEX_NPM_INTEGRITY, CodexNotInstalled, CodexPinMismatch } from "./versions.js";
package/dist/verify.d.ts CHANGED
@@ -20,7 +20,7 @@ export declare function codexPins(target?: {
20
20
  * from its own directory, where a relative `CODEX_BIN` names nothing. The sha256 is read a chunk at a time, never the
21
21
  * whole binary in memory, and a check that passed holds for this process while the binary stays the same file, unchanged
22
22
  * (the kernel's checkedOnce): a host that checks it for each model it resolves, and a run's process that makes its
23
- * adapter, check it once.
23
+ * adapter, check it once. Its reads hold the event loop: a host checks with verifyCodexBinaryAsync first.
24
24
  */
25
25
  export declare function verifyCodexBinary(found: {
26
26
  path: string;
@@ -28,6 +28,13 @@ export declare function verifyCodexBinary(found: {
28
28
  } | undefined, pins?: CodexPins): {
29
29
  path: string;
30
30
  } | CodexPinMismatch | CodexNotInstalled;
31
+ /** verifyCodexBinary without holding the event loop (the kernel's checkedOnceAsync), its pass kept for it too. */
32
+ export declare function verifyCodexBinaryAsync(found: {
33
+ path: string;
34
+ packageVersion?: string;
35
+ } | undefined, pins?: CodexPins): Promise<{
36
+ path: string;
37
+ } | CodexPinMismatch | CodexNotInstalled>;
31
38
  /** This machine's Codex checked against the pins: its path, or the typed error thrown. */
32
39
  export declare function verifyCodex(found?: {
33
40
  path: string;
@@ -35,3 +42,11 @@ export declare function verifyCodex(found?: {
35
42
  } | undefined, pins?: CodexPins): {
36
43
  path: string;
37
44
  };
45
+ /** verifyCodex without holding the event loop: what a host awaits before it makes the adapter, whose own check then
46
+ * answers from what this kept. */
47
+ export declare function verifyCodexAsync(found?: {
48
+ path: string;
49
+ packageVersion?: string;
50
+ } | undefined, pins?: CodexPins): Promise<{
51
+ path: string;
52
+ }>;
package/dist/verify.js CHANGED
@@ -1,10 +1,9 @@
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 { execFileSync } from "node:child_process";
4
3
  import { existsSync } from "node:fs";
5
4
  import { resolve } from "node:path";
6
5
  import { env } from "node:process";
7
- import { checkedOnce, sha256OfFile } from "@parcha/agentrun-kernel/host";
6
+ import { checkedOnce, checkedOnceAsync } from "@parcha/agentrun-kernel/host";
8
7
  import { codexTarget, findCodex } from "./binary.js";
9
8
  import { CODEX_BINARY_SHA256, CODEX_VERSION, CodexNotInstalled, CodexPinMismatch } from "./versions.js";
10
9
  /** The pins for this platform's binary. */
@@ -19,9 +18,20 @@ export function codexPins(target = codexTarget()) {
19
18
  * from its own directory, where a relative `CODEX_BIN` names nothing. The sha256 is read a chunk at a time, never the
20
19
  * whole binary in memory, and a check that passed holds for this process while the binary stays the same file, unchanged
21
20
  * (the kernel's checkedOnce): a host that checks it for each model it resolves, and a run's process that makes its
22
- * adapter, check it once.
21
+ * adapter, check it once. Its reads hold the event loop: a host checks with verifyCodexBinaryAsync first.
23
22
  */
24
23
  export function verifyCodexBinary(found, pins = codexPins()) {
24
+ const at = located(found, pins);
25
+ return at instanceof Error ? at : checkedOnce(at.path, JSON.stringify(pins), () => checkBinary(at.path, pins), passed);
26
+ }
27
+ /** verifyCodexBinary without holding the event loop (the kernel's checkedOnceAsync), its pass kept for it too. */
28
+ export async function verifyCodexBinaryAsync(found, pins = codexPins()) {
29
+ const at = located(found, pins);
30
+ return at instanceof Error ? at : checkedOnceAsync(at.path, JSON.stringify(pins), () => checkBinary(at.path, pins), passed);
31
+ }
32
+ const passed = (result) => !(result instanceof Error);
33
+ /** The absolute path of `found`, there and of the pinned package's version; or why not. */
34
+ function located(found, pins) {
25
35
  if (!found)
26
36
  return new CodexNotInstalled("no Codex binary found for this platform, and CODEX_BIN is not set");
27
37
  const path = resolve(found.path);
@@ -30,15 +40,15 @@ export function verifyCodexBinary(found, pins = codexPins()) {
30
40
  if (pins.packageVersion && found.packageVersion !== undefined && found.packageVersion !== pins.packageVersion) {
31
41
  return new CodexPinMismatch("package_version", pins.packageVersion, found.packageVersion, path);
32
42
  }
33
- // Hashed a chunk at a time, and once per binary in this process while it stays the same file.
34
- return checkedOnce(path, JSON.stringify(pins), () => checkBinary(path, pins), (result) => !(result instanceof Error));
43
+ return { path };
35
44
  }
36
- /** The binary at `path` (absolute, there) against `pins`' sha256 and version. */
37
- function checkBinary(path, pins) {
45
+ /** The binary at `path` (absolute, there) against `pins`' sha256 and version, as the steps it reads (the kernel's
46
+ * BinaryCheck). */
47
+ function* checkBinary(path, pins) {
38
48
  if (pins.sha256) {
39
49
  let sha256;
40
50
  try {
41
- sha256 = sha256OfFile(path);
51
+ sha256 = yield { kind: "sha256", path };
42
52
  }
43
53
  catch (error) {
44
54
  return new CodexNotInstalled(`${path} could not be read: ${String(error?.message ?? error).slice(0, 120)}`);
@@ -48,7 +58,7 @@ function checkBinary(path, pins) {
48
58
  }
49
59
  let reported;
50
60
  try {
51
- reported = execFileSync(path, ["--version"], { env: { PATH: env.PATH ?? "/usr/bin:/bin" }, encoding: "utf8", timeout: 10_000 }).trim();
61
+ reported = (yield { kind: "run", path, args: ["--version"], env: { PATH: env.PATH ?? "/usr/bin:/bin" }, timeoutMs: 10_000 }).trim();
52
62
  }
53
63
  catch (error) {
54
64
  return new CodexNotInstalled(`${path} could not be run: ${String(error?.message ?? error).slice(0, 120)}`);
@@ -65,3 +75,11 @@ export function verifyCodex(found = findCodex(), pins = codexPins()) {
65
75
  throw result;
66
76
  return result;
67
77
  }
78
+ /** verifyCodex without holding the event loop: what a host awaits before it makes the adapter, whose own check then
79
+ * answers from what this kept. */
80
+ export async function verifyCodexAsync(found = findCodex(), pins = codexPins()) {
81
+ const result = await verifyCodexBinaryAsync(found, pins);
82
+ if (result instanceof Error)
83
+ throw result;
84
+ return result;
85
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcha/agentrun-harness-codex",
3
- "version": "0.1.0-beta.32",
3
+ "version": "0.1.0-beta.34",
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,8 +44,8 @@
44
44
  "test": "node --test --test-concurrency=8 'test/*.test.mjs'"
45
45
  },
46
46
  "dependencies": {
47
- "@parcha/agentrun-dsl": "0.1.0-beta.32",
48
- "@parcha/agentrun-kernel": "0.1.0-beta.32"
47
+ "@parcha/agentrun-dsl": "0.1.0-beta.34",
48
+ "@parcha/agentrun-kernel": "0.1.0-beta.34"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@openai/codex": "0.164.0"