@ouro.bot/cli 0.1.0-alpha.1505 → 0.1.0-alpha.1507

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.json CHANGED
@@ -1,6 +1,18 @@
1
1
  {
2
2
  "_note": "Each pull request writes its own change note under changes/; the release job on main gives each landed change its version and adds the notes here (scripts/release-version.cjs). On main this file stops at the last version set by hand; the published package has every release. Agents read this file directly via read_file to understand what changed between versions.",
3
3
  "versions": [
4
+ {
5
+ "version": "0.1.0-alpha.1507",
6
+ "changes": [
7
+ "The interview runner runs product H. Its kit runs every arm in the H guest on the books cases, codex and openhands each in its own agent image. A run refuses to start any session unless `--images` names every image the kit needs. Each arm has a replacement list in three tiers: what the arm's own prompt and tools say about the product, then the container's real home and bundle paths, then single brand words. The lists rewrite every arm's paths to /tmp/agent/AgentBundles/sanctuary.agent, and the ouro arm now links that path to its real bundle, as the other arms already did. A test runs each arm's captured first request through its list and the brand scan and finds nothing. codex's `exec_command` and openhands' `terminal` are read as the `shell` calls the books cases check. Every request's rewrites, counted by tier, go on its request-log line. Each arm's totals go in its record and in the printed summary."
8
+ ]
9
+ },
10
+ {
11
+ "version": "0.1.0-alpha.1506",
12
+ "changes": [
13
+ "The H interview guest has an `openhands` arm: the OpenHands Software Agent SDK at the commit pre-registration v2 pins, with its terminal and file-editor tools, running its own agent loop in a Python supervisor on the H wire. The wire now also answers chat completions without streaming, which is how the SDK calls its model. The Butler's persona and the label line are the agent context's system message suffix, the bundle's skills are installed as user skills, and the SDK's retries are off. The job and each follow-up are messages in one conversation, and OpenHands' `finish` call is a turn's reply. `deploy/eval/build-openhands.sh` installs the SDK with its own lock file in a throwaway container, and `deploy/eval/openhands.Dockerfile` adds it and tmux to the eval's agent image."
14
+ ]
15
+ },
4
16
  {
5
17
  "version": "0.1.0-alpha.1505",
6
18
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1505",
2
+ "runtimeVersion": "0.1.0-alpha.1507",
3
3
  "bundleSchemaVersion": 3,
4
4
  "lastUpdated": "2026-09-03T00:00:00.000Z"
5
5
  }
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0"?>
2
2
  <Container version="2">
3
3
  <Name>ouro-butler</Name>
4
- <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1505</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1507</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -27,6 +27,7 @@ const remote_1 = require("./sandbox/remote");
27
27
  const targets_1 = require("./targets");
28
28
  const runner_1 = require("./interviews/runner");
29
29
  const kit_1 = require("./interviews/u/kit");
30
+ const kit_2 = require("./interviews/h/kit");
30
31
  const REPO = node_path_1.default.resolve(__dirname, "../..");
31
32
  function take(argv, flag) {
32
33
  const at = argv.indexOf(flag);
@@ -104,7 +105,8 @@ async function main() {
104
105
  lock = await (0, host_lock_1.holdHostLock)((0, remote_1.sshNode)(host, [`${root}/harness/deploy/unraid/ouro-host-lock.mjs`, "hold", "--holder", hostLock.value, "--ttl", String(host_lock_1.HOST_LOCK_TTL_S), "--wait", String(host_lock_1.HOST_LOCK_WAIT_S)]));
105
106
  }
106
107
  try {
107
- return await interviews(args, lock ? stopWhenLockLost(runCaseFor(ssh.value, bundle.value, seed.value, images, lock.token)) : { runCase: runCaseFor(ssh.value, bundle.value, seed.value, images, undefined), started: startedSessions() });
108
+ const agentImages = Object.keys(images?.named ?? {});
109
+ return await interviews(args, lock ? stopWhenLockLost(runCaseFor(ssh.value, bundle.value, seed.value, images, lock.token)) : { runCase: runCaseFor(ssh.value, bundle.value, seed.value, images, undefined), started: startedSessions() }, agentImages);
108
110
  }
109
111
  finally {
110
112
  await lock?.release();
@@ -140,13 +142,14 @@ function stopWhenLockLost(runCase) {
140
142
  },
141
143
  };
142
144
  }
143
- async function interviews(args, deps) {
145
+ async function interviews(args, deps, agentImages) {
144
146
  const { exitCode } = await (0, runner_1.runInterviews)(args, {
145
147
  readText: (file) => node_fs_1.default.readFileSync(file, "utf8"),
146
148
  loadCases: self_test_1.loadCases,
147
149
  resolveTarget: (spec, creds) => (0, targets_1.resolveTarget)(spec, creds),
148
150
  runCase: deps.runCase,
149
- kits: { X: runner_1.X_KIT, U: kit_1.U_KIT },
151
+ kits: { X: runner_1.X_KIT, U: kit_1.U_KIT, H: kit_2.H_KIT },
152
+ agentImages,
150
153
  outputExists: (file) => node_fs_1.default.existsSync(file),
151
154
  writeReport: report_1.writePrivateReport,
152
155
  openLog: openPrivateLog,
@@ -5,12 +5,14 @@
5
5
  * config against these notes by key name.
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.H_CODEX_FIDELITY = exports.H_OURO_FIDELITY = void 0;
8
+ exports.H_OPENHANDS_FIDELITY = exports.H_CODEX_FIDELITY = exports.H_OURO_FIDELITY = void 0;
9
9
  /** Departures every H arm shares, and where the `ouro` arm still differs from the others. */
10
10
  exports.H_OURO_FIDELITY = [
11
11
  "no provider retries, as in every arm: each error from the host's runtime is marked not retryable, so a retry is never a second metered call",
12
12
  "offers web_search and fetch_url, which fail in the sandbox (no route off the host); the other arms don't offer web search at all, since their hosted search tools can't reach the host's runtime",
13
- "the bundle sits at its production path, so the working folder the model sees differs from the other arms' neutral path",
13
+ "the bundle sits at its production path, where the turn reads it; the arm's list shows the model that path, and /home/ouro, as the other arms' neutral ones (/tmp/agent/AgentBundles/sanctuary.agent), which the guest links to the real ones",
14
+ "every arm's list rewrites the container's user name (ouro) and real paths in what the model sees, tool results included, so a rewritten name that is no path (the user agent, AGENT_HOME, ~/.agent) finds nothing when the model types it, nor does an id or file name with a brand word inside it; model names are in no list, so the host's scan voids a session that shows one",
15
+ "the neutral home is a real folder under /tmp in every arm, with the bundle linked at /tmp/agent/AgentBundles/sanctuary.agent; in the ouro arm, the real home's entries are linked into it when the arm starts, and one the turn makes later is not",
14
16
  "skills aren't listed in the prompt: a skill reaches the model only when the agent reads its file, while the other arms list each skill's name and when-line",
15
17
  ];
16
18
  exports.H_CODEX_FIDELITY = [
@@ -26,9 +28,29 @@ exports.H_CODEX_FIDELITY = [
26
28
  "the request's own settings (tool_choice, parallel_tool_calls, reasoning, include, store, prompt_cache_key and the like) are not passed on: the host's runtime sets the model's settings, as it does for the ouro arm",
27
29
  "codex's leading developer messages become one system message, joined with a blank line, and a message's text parts are joined with a newline, since the harness's messages carry one string each",
28
30
  "codex doesn't know the model's name, so it runs as for any unknown model: its generic base prompt, no apply_patch tool, and output of each tool call cut at 10,000 bytes",
29
- "the brand words in codex's base prompt are replaced before the call reaches the model",
30
- "the shell can still show the brand through the names of the variables codex sets (CODEX_HOME, CODEX_THREAD_ID, CODEX_SESSION_ID, CODEX_CI), none of which is in the prompt; codex adds no helper folder to PATH, since it refuses to create one under /tmp",
31
+ "codex's base prompt is rewritten before the call reaches the model: its first sentences say a coding agent running in a terminal-based coding assistant, and the line on what Codex refers to is removed",
32
+ "what the shell shows of the brand (the variables codex sets, CODEX_HOME, CODEX_THREAD_ID, CODEX_SESSION_ID and CODEX_CI, and codex's own name in output) is rewritten to AGENT_ and agent in tool results; codex adds no helper folder to PATH, since it refuses to create one under /tmp",
31
33
  "codex runs from a neutral home under /tmp (the agent container is read-only elsewhere), with the bundle linked at /tmp/agent/AgentBundles/sanctuary.agent",
32
34
  "codex is killed at 540 seconds, inside the host's 600-second guest deadline, and the turn reports that it exited 137; commands it started stop when the host removes the container at the guest's end",
35
+ "the books checks read each exec_command as a shell call in its workdir; a command typed into an open session through write_stdin is not read as one",
33
36
  "built from source at the pinned commit for x86_64 gnu (on the x86_64 sandbox host, which runs every session), not codex's released musl build, without the release's version stamp",
34
37
  ];
38
+ exports.H_OPENHANDS_FIDELITY = [
39
+ "num_retries = 0: LiteLLM's retries are off, since a retry would be a second metered call",
40
+ "the agent's tools are the terminal and the file editor, as pre-registration v2 names, plus the SDK's own finish tool and, when a skill is installed, its invoke_skill tool; the SDK's default preset also gives the task tracker and the browser, and the browser couldn't reach anything in the sandbox",
41
+ "no condenser: the default preset summarises a long history with extra model calls; these conversations are short",
42
+ "load_user_skills = True: the bundle's skills are installed as user skills and listed in the prompt's skills block, as codex lists them; the default preset loads none",
43
+ "the model is called through chat completions without streaming (api_mode chat, stream False), since the H wire answers chat only whole",
44
+ "the request's own settings (max_completion_tokens, prompt_cache_key) are not passed on: the host's runtime sets the model's settings, as it does for the ouro arm",
45
+ "the SDK doesn't know the model's name (openai/model), so it uses its defaults for an unknown model; LITELLM_LOCAL_MODEL_COST_MAP = True makes LiteLLM read the cost map it ships with instead of fetching one",
46
+ "the Butler's persona and the label line are the system message's suffix, after the SDK's own system prompt",
47
+ "the system prompt is the default preset's (system_prompt_kwargs cli_mode False), so its security-risk wording is the preset's, not the command line's",
48
+ "the SDK's system prompt and tool descriptions are rewritten before the call reaches the model: the self-documentation section, the previous-conversations and skills-docs lines and the security-risk note's origin are removed, the opening says a helpful AI assistant, and the git identity reads agent <agent@agent.dev>",
49
+ "what the shell shows of the brand (the tmux socket and session names in TMUX, the ~/.openhands folder) is rewritten to agent in tool results; the LITELLM_LOCAL_MODEL_COST_MAP variable has no brand word. AI_AGENT is set to a neutral name, where the SDK would set its own",
50
+ "the SDK runs on the uv-managed Python 3.13 and uv 0.13.7 its own agent-server image uses, with bytecode compiled at build time because the image is read-only when the arm runs",
51
+ "runs from a neutral home under /tmp (the agent container is read-only elsewhere), with the bundle linked at /tmp/agent/AgentBundles/sanctuary.agent",
52
+ "the books checks read each terminal call as a shell call in the folder the terminal reported after the call before (tmux keeps the folder between calls); the first starts in the workdir",
53
+ "the supervisor process is killed at 540 seconds, inside the host's 600-second guest deadline; the terminal's tmux and anything it started stop when the host removes the container at the guest's end",
54
+ "SHELL is /bin/bash: tmux runs its session through SHELL, and the image's user has no login shell to fall back on",
55
+ "the supervisor's stdout carries only its status lines; anything the SDK or LiteLLM prints goes to stderr",
56
+ ];
@@ -0,0 +1,176 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.openhandsArm = openhandsArm;
7
+ /**
8
+ * H's `openhands` arm (pre-registration v2 product H): the OpenHands Software Agent SDK at `ecea9a91d8d0` with its
9
+ * terminal and file-editor tools, its own agent loop unchanged, on the H wire's chat-completions route as its only
10
+ * provider. Every call goes through the wire to the host's runtime, so the host still rewrites, scans, gates and
11
+ * meters it.
12
+ *
13
+ * What stays the same as in every arm: the Butler's persona and the label line (here the agent context's system
14
+ * message suffix, after the SDK's own system prompt), the case's conversation (put before the job by the wire), the
15
+ * bundle's skills (installed as user skills, which the SDK loads), the books command line and the household.
16
+ *
17
+ * One conversation runs in a Python supervisor (`deploy/eval/openhands/supervise.py`), given one message at a time:
18
+ * the job, then each follow-up as the owner's next message. OpenHands ends a turn with its `finish` tool, whose
19
+ * message is the turn's reply, so the trace shows it as one. The SDK's retries are off, since a retried call would
20
+ * be metered twice. It runs in the same neutral home and workdir as the codex arm.
21
+ */
22
+ const node_child_process_1 = require("node:child_process");
23
+ const node_fs_1 = __importDefault(require("node:fs"));
24
+ const node_path_1 = __importDefault(require("node:path"));
25
+ const runtime_1 = require("../../../../nerves/runtime");
26
+ const loop_1 = require("../loop");
27
+ const run_1 = require("../run");
28
+ const codex_1 = require("./codex");
29
+ const wire_1 = require("./wire");
30
+ /** Where the arm's image installs the SDK and the supervisor, under a path with no brand word. */
31
+ const SDK_DIR = "/opt/agent-sdk";
32
+ /* v8 ignore start -- process wiring: what the arm does with the supervisor's lines and exit is tested with an injected supervisor @preserve */
33
+ const startPython = (specFile, options) => {
34
+ const child = (0, node_child_process_1.spawn)(node_path_1.default.join(SDK_DIR, "venv/bin/python"), [node_path_1.default.join(SDK_DIR, "supervise.py"), specFile], { cwd: options.cwd, env: options.env, stdio: ["pipe", "pipe", "pipe"] });
35
+ let stderr = "";
36
+ let buffered = "";
37
+ const lines = [];
38
+ let waiting = null;
39
+ let ended = false;
40
+ const exited = new Promise((resolve) => {
41
+ child.on("error", (error) => { stderr += `${error.message}\n`; resolve(127); });
42
+ child.on("close", (code) => resolve(code ?? 137));
43
+ });
44
+ child.stderr.on("data", (chunk) => { stderr += chunk.toString("utf8"); });
45
+ // A supervisor that died between turns breaks the pipe; its exit says why, so the write's error is not thrown.
46
+ child.stdin.on("error", () => undefined);
47
+ child.stdout.on("data", (chunk) => {
48
+ buffered += chunk.toString("utf8");
49
+ let at;
50
+ while ((at = buffered.indexOf("\n")) >= 0) {
51
+ const line = buffered.slice(0, at);
52
+ buffered = buffered.slice(at + 1);
53
+ if (waiting) {
54
+ const take = waiting;
55
+ waiting = null;
56
+ take(line);
57
+ }
58
+ else
59
+ lines.push(line);
60
+ }
61
+ });
62
+ void exited.then(() => { ended = true; if (waiting) {
63
+ const take = waiting;
64
+ waiting = null;
65
+ take(null);
66
+ } });
67
+ const next = () => lines.length > 0 ? Promise.resolve(lines.shift()) : ended ? Promise.resolve(null) : new Promise((resolve) => { waiting = resolve; });
68
+ // Inside the host's 600-second guest deadline, so a stuck supervisor ends as this arm's failure, not the guest's.
69
+ const timer = setTimeout(() => child.kill("SIGKILL"), 540_000);
70
+ return {
71
+ send: async (message) => {
72
+ if (!ended)
73
+ child.stdin.write(`${JSON.stringify(message)}\n`);
74
+ const line = await next();
75
+ if (line === null)
76
+ return null;
77
+ try {
78
+ return JSON.parse(line);
79
+ }
80
+ catch {
81
+ return { error: `the supervisor printed ${line.slice(0, 200)}` };
82
+ }
83
+ },
84
+ close: async () => {
85
+ child.stdin.end();
86
+ const code = await exited;
87
+ clearTimeout(timer);
88
+ return { code, stderr };
89
+ },
90
+ };
91
+ };
92
+ /* v8 ignore stop */
93
+ const lastLine = (text) => text.trim().split("\n").at(-1).trim();
94
+ /** The message of a `finish` call: its `message` argument, or its arguments as they are. */
95
+ function finishMessage(args) {
96
+ try {
97
+ const message = JSON.parse(args).message;
98
+ if (typeof message === "string")
99
+ return message;
100
+ }
101
+ catch {
102
+ // Not JSON: the arguments are the message.
103
+ }
104
+ return args;
105
+ }
106
+ function openhandsArm(options = {}) {
107
+ const start = options.start ?? startPython;
108
+ const home = options.home ?? codex_1.CODEX_HOME_DIR;
109
+ const workdir = options.workdir ?? node_path_1.default.join(home, "AgentBundles", "sanctuary.agent");
110
+ return async ({ turn, bundle, providerRuntime }) => {
111
+ node_fs_1.default.mkdirSync(node_path_1.default.dirname(workdir), { recursive: true });
112
+ if (!node_fs_1.default.existsSync(workdir))
113
+ node_fs_1.default.symlinkSync(bundle, workdir);
114
+ (0, codex_1.installSkills)(bundle, home);
115
+ const wire = (0, wire_1.createWire)({ runtime: providerRuntime, prefix: turn.prefix });
116
+ const served = await (0, wire_1.serveWire)(wire);
117
+ try {
118
+ const specFile = node_path_1.default.join(home, ".arm-spec.json");
119
+ node_fs_1.default.writeFileSync(specFile, JSON.stringify({ baseUrl: served.url, workdir, systemSuffix: `${(0, run_1.personaPrompt)(bundle)}\n\n${turn.labelLine}` }));
120
+ // The SDK reads the model cost map it ships with rather than fetching one; the container has no route out.
121
+ // The terminal's tmux keeps the neutral workdir as given; PWD keeps it too if the SDK falls back to a plain shell.
122
+ // AI_AGENT is set to a neutral name, since the SDK otherwise puts its own brand there for the shell. SHELL is
123
+ // bash because tmux runs its session through SHELL, and the image's user has no login shell to fall back on.
124
+ const supervisor = start(specFile, { cwd: workdir, env: { HOME: home, PWD: workdir, PATH: process.env.PATH, SHELL: "/bin/bash", LITELLM_LOCAL_MODEL_COST_MAP: "True", AI_AGENT: "agent" } });
125
+ // OpenHands' `finish` call is the turn's reply.
126
+ const traced = () => wire.timeline().map((entry) => entry.kind === "call" && entry.name === "finish"
127
+ ? { kind: "reply", text: (0, loop_1.withoutThinking)(finishMessage(entry.args)) }
128
+ : entry.kind === "reply" ? { kind: "reply", text: (0, loop_1.withoutThinking)(entry.text) } : entry);
129
+ const turns = [];
130
+ let closed = null;
131
+ // The supervisor is closed however the turns end, so Python never outlives the arm.
132
+ try {
133
+ for (const [index, text] of [turn.userText, ...turn.followUps].entries()) {
134
+ const record = { start: traced().length, finalReply: "", outcome: "settled", calls: 0 };
135
+ turns.push(record);
136
+ (0, runtime_1.emitNervesEvent)({ component: "eval", event: "eval.h_openhands_turn_start", message: "openhands is taking a turn", meta: { index } });
137
+ const callsBefore = wire.calls();
138
+ const line = await supervisor.send(text);
139
+ record.calls = wire.calls() - callsBefore;
140
+ const reply = traced().slice(record.start).filter((entry) => entry.kind === "reply").at(-1);
141
+ if (reply)
142
+ record.finalReply = reply.text;
143
+ // A failed call ends the conversation, so any failure the wire remembers is this turn's.
144
+ const failure = wire.error();
145
+ if (failure !== null) {
146
+ record.outcome = `provider-error: ${failure}`;
147
+ }
148
+ else if (line === null) {
149
+ closed = await supervisor.close();
150
+ record.outcome = `harness-error: openhands exited ${closed.code}${closed.stderr.trim() ? `: ${lastLine(closed.stderr)}` : ""}`;
151
+ }
152
+ else if (line.error !== undefined) {
153
+ record.outcome = `harness-error: openhands failed: ${line.error}`;
154
+ }
155
+ else if (line.status !== "finished") {
156
+ record.outcome = `harness-error: openhands stopped the turn ${line.status}`;
157
+ }
158
+ else if (!reply) {
159
+ record.outcome = "harness-error: openhands ended the turn with no reply";
160
+ }
161
+ (0, runtime_1.emitNervesEvent)({ component: "eval", event: "eval.h_openhands_turn_end", message: "openhands ended a turn", meta: { index, outcome: record.outcome, calls: record.calls } });
162
+ if (record.outcome !== "settled")
163
+ break;
164
+ }
165
+ }
166
+ finally {
167
+ if (!closed)
168
+ await supervisor.close();
169
+ }
170
+ return { timeline: traced(), finalReply: turns[0].finalReply, outcome: turns[0].outcome, steps: wire.calls(), turns };
171
+ }
172
+ finally {
173
+ await served.close();
174
+ }
175
+ };
176
+ }
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.H_ARMS = void 0;
7
+ exports.linkNeutralPaths = linkNeutralPaths;
7
8
  exports.ouroArm = ouroArm;
8
9
  exports.runHGuest = runHGuest;
9
10
  /**
@@ -17,18 +18,55 @@ exports.runHGuest = runHGuest;
17
18
  * model calls, as every interview guest gives it; the first turn's reply and outcome are the job's.
18
19
  */
19
20
  const node_fs_1 = __importDefault(require("node:fs"));
21
+ const node_path_1 = __importDefault(require("node:path"));
20
22
  const runtime_1 = require("../../../../nerves/runtime");
21
23
  const provider_proxy_1 = require("../../../transport/provider-proxy");
22
24
  const telegram_turn_1 = require("../../../transport/telegram-turn");
23
25
  const codex_1 = require("./codex");
24
- /** The ouro arm: the harness's own turn, unchanged but for the label line and the later message. */
25
- function ouroArm(runTurn = telegram_turn_1.runTelegramTurn) {
26
- return ({ turn, bundle, providerRuntime }) => runTurn({
27
- agentRoot: bundle, prefix: turn.prefix, userText: turn.userText, providerRuntime, systemLine: turn.labelLine, followUps: turn.followUps,
28
- });
26
+ const openhands_1 = require("./openhands");
27
+ /**
28
+ * The neutral paths the H kit's lists show the model, made to exist in the ouro arm as they do in the others: a real
29
+ * neutral home (`/tmp/agent`, on the container's writable /tmp) with the bundle linked at
30
+ * `AgentBundles/sanctuary.agent`, and a link for each other entry the real home has now. The bundles folder beside the
31
+ * real bundle is the mount point Docker made, which the container's user can't write, so no link goes there. Entries
32
+ * that are already there are kept.
33
+ */
34
+ function linkNeutralPaths(bundle, neutral) {
35
+ const bundles = node_path_1.default.dirname(bundle);
36
+ const home = node_path_1.default.dirname(bundles);
37
+ const exists = (file) => { try {
38
+ node_fs_1.default.lstatSync(file);
39
+ return true;
40
+ }
41
+ catch {
42
+ return false;
43
+ } };
44
+ const named = node_path_1.default.join(neutral, node_path_1.default.basename(bundles), node_path_1.default.basename(bundle).replace(/\.ouro$/, ".agent"));
45
+ node_fs_1.default.mkdirSync(node_path_1.default.dirname(named), { recursive: true });
46
+ if (!exists(named))
47
+ node_fs_1.default.symlinkSync(bundle, named);
48
+ let linked = 0;
49
+ for (const entry of node_fs_1.default.readdirSync(home)) {
50
+ if (entry === node_path_1.default.basename(bundles) || exists(node_path_1.default.join(neutral, entry)))
51
+ continue;
52
+ node_fs_1.default.symlinkSync(node_path_1.default.join(home, entry), node_path_1.default.join(neutral, entry));
53
+ linked += 1;
54
+ }
55
+ (0, runtime_1.emitNervesEvent)({ component: "eval", event: "eval.h_neutral_links", message: "linked the ouro arm's neutral paths", meta: { neutral, linked } });
56
+ }
57
+ /**
58
+ * The ouro arm: the harness's own turn, unchanged but for the label line and the later message. With `neutral`, the
59
+ * neutral paths are linked first; the turn still runs from the bundle at its production path, where it reads it.
60
+ */
61
+ function ouroArm(runTurn = telegram_turn_1.runTelegramTurn, neutral) {
62
+ return ({ turn, bundle, providerRuntime }) => {
63
+ if (neutral !== undefined)
64
+ linkNeutralPaths(bundle, neutral);
65
+ return runTurn({ agentRoot: bundle, prefix: turn.prefix, userText: turn.userText, providerRuntime, systemLine: turn.labelLine, followUps: turn.followUps });
66
+ };
29
67
  }
30
68
  /** The H arms this guest runs. */
31
- exports.H_ARMS = { ouro: ouroArm(), codex: (0, codex_1.codexArm)() };
69
+ exports.H_ARMS = { ouro: ouroArm(telegram_turn_1.runTelegramTurn, codex_1.CODEX_HOME_DIR), codex: (0, codex_1.codexArm)(), openhands: (0, openhands_1.openhandsArm)() };
32
70
  function readTurnFile(file) {
33
71
  const value = JSON.parse(node_fs_1.default.readFileSync(file, "utf8"));
34
72
  if (value.product !== "H" || typeof value.arm !== "string" || typeof value.labelLine !== "string" || !Array.isArray(value.prefix)
@@ -5,6 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.checkToolFields = checkToolFields;
7
7
  exports.responsesRequest = responsesRequest;
8
+ exports.chatRequest = chatRequest;
9
+ exports.chatAnswer = chatAnswer;
8
10
  exports.responsesEvents = responsesEvents;
9
11
  exports.sse = sse;
10
12
  exports.createWire = createWire;
@@ -180,6 +182,79 @@ function responsesRequest(body, prefix) {
180
182
  const activeTools = wireTools(tools);
181
183
  return { messages: [...(leading.length > 0 ? [{ role: "system", content: leading.join("\n\n") }] : []), ...rest], activeTools };
182
184
  }
185
+ /**
186
+ * A chat-completions body as the harness's request: its messages as they are, with text-only content made plain, a
187
+ * developer message as a system message, and the case's conversation before the first user message. Streaming is
188
+ * refused: the clients the wire serves this way (openhands) ask for one whole answer.
189
+ */
190
+ const CHAT_FIELDS = new Set(["model", "messages", "tools", "stream", "max_completion_tokens", "prompt_cache_key"]);
191
+ function chatRequest(body, prefix) {
192
+ if (!isRecord(body) || !Array.isArray(body.messages))
193
+ throw new Error("a chat body needs a messages list");
194
+ if (body.stream === true)
195
+ throw new Error("the H wire answers chat completions only without streaming");
196
+ // The request settings the arm may send, which the host's runtime sets instead (a fidelity note); any other field
197
+ // is refused by name, never dropped unseen.
198
+ for (const key of Object.keys(body))
199
+ if (!CHAT_FIELDS.has(key))
200
+ throw new Error(`the H wire can't carry a chat request's ${key}`);
201
+ const messages = [];
202
+ let prefixed = false;
203
+ for (const item of body.messages) {
204
+ const value = isRecord(item) ? item : {};
205
+ const role = String(value.role);
206
+ if (role === "system" || role === "developer") {
207
+ messages.push({ role: "system", content: textOf(value.content) });
208
+ }
209
+ else if (role === "user") {
210
+ if (!prefixed)
211
+ messages.push(...prefix);
212
+ prefixed = true;
213
+ messages.push({ role: "user", content: textOf(value.content) });
214
+ }
215
+ else if (role === "assistant") {
216
+ const calls = Array.isArray(value.tool_calls) ? value.tool_calls : [];
217
+ messages.push({
218
+ role: "assistant", content: value.content === null || value.content === undefined ? null : textOf(value.content),
219
+ ...(calls.length > 0 ? { tool_calls: calls.map((call) => ({ id: String(call.id), type: "function", function: { name: String(call.function.name), arguments: String(call.function.arguments) } })) } : {}),
220
+ });
221
+ }
222
+ else if (role === "tool") {
223
+ messages.push({ role: "tool", tool_call_id: String(value.tool_call_id), content: textOf(value.content) });
224
+ }
225
+ else {
226
+ throw new Error(`the H wire can't carry a message from ${role}`);
227
+ }
228
+ }
229
+ const tools = Array.isArray(body.tools) ? body.tools : [];
230
+ // A chat tool nests the same fields under `function`; they pass through as the Responses shape's do.
231
+ for (const tool of tools) {
232
+ if (typeOf(tool) !== "function")
233
+ throw new Error(`the H wire can't carry a tool of type ${typeOf(tool)}`);
234
+ const { function: fields, ...outer } = tool;
235
+ if (!isRecord(fields))
236
+ throw new Error("a chat tool needs its function");
237
+ checkToolFields({ ...outer, ...fields });
238
+ }
239
+ const activeTools = wireTools(tools.map((tool) => tool.function));
240
+ return { messages, activeTools };
241
+ }
242
+ /** One chat completion for an answer: the reply, its calls, why it stopped and the usage. */
243
+ function chatAnswer(result, id) {
244
+ const usage = result.usage;
245
+ const message = {
246
+ role: "assistant", content: result.content,
247
+ ...(result.toolCalls.length > 0 ? { tool_calls: result.toolCalls.map((call) => ({ id: call.id, type: "function", function: { name: call.name, arguments: call.arguments } })) } : {}),
248
+ };
249
+ return {
250
+ id, object: "chat.completion", created: 0, model: "model",
251
+ choices: [{ index: 0, finish_reason: result.toolCalls.length > 0 ? "tool_calls" : "stop", message }],
252
+ usage: {
253
+ prompt_tokens: usage?.input_tokens ?? 0, completion_tokens: usage?.output_tokens ?? 0, total_tokens: usage?.total_tokens ?? 0,
254
+ prompt_tokens_details: { cached_tokens: usage?.cached_input_tokens ?? 0 }, completion_tokens_details: { reasoning_tokens: usage?.reasoning_tokens ?? 0 },
255
+ },
256
+ };
257
+ }
183
258
  /** The events a Responses client reads for one answer: created, each output item done, then completed with usage. */
184
259
  function responsesEvents(result, id) {
185
260
  const usage = result.usage;
@@ -214,11 +289,12 @@ function createWire(input) {
214
289
  calls: () => calls,
215
290
  error: () => failure,
216
291
  async handle(route, body) {
217
- if (route !== "/v1/responses" && route !== "/responses")
292
+ const chat = route === "/v1/chat/completions" || route === "/chat/completions";
293
+ if (!chat && route !== "/v1/responses" && route !== "/responses")
218
294
  return errorAnswer(404, `no route ${route}`);
219
295
  let request;
220
296
  try {
221
- request = responsesRequest(body, input.prefix);
297
+ request = chat ? chatRequest(body, input.prefix) : responsesRequest(body, input.prefix);
222
298
  }
223
299
  catch (error) {
224
300
  failure = (0, loop_1.messageOf)(error);
@@ -256,6 +332,8 @@ function createWire(input) {
256
332
  if (result.toolCalls.length === 0)
257
333
  timeline.push({ kind: "reply", text: result.content });
258
334
  responses += 1;
335
+ if (chat)
336
+ return { status: 200, contentType: "application/json", body: JSON.stringify(chatAnswer(result, `chat_${responses}`)) };
259
337
  return { status: 200, contentType: "text/event-stream", body: sse(responsesEvents(result, `resp_${responses}`)) };
260
338
  },
261
339
  };
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.H_KIT = exports.H_REPLACEMENTS = exports.H_ARMS_IMAGES = void 0;
4
+ exports.canonicalH = canonicalH;
5
+ /**
6
+ * Product H, whole harnesses (pre-registration v2 section 2), as the runner's `ProductKit`. Every arm runs in the H
7
+ * guest (`h-guest-entry.js`) on the books cases: the ouro arm in the default agent image, codex and openhands each in
8
+ * its own image, which `--images` must name.
9
+ *
10
+ * Each arm's replacement list (section 3) runs in three tiers, in order:
11
+ * - sentences and sections: what the arm's own prompt and tools say about the product, replaced with a neutral
12
+ * sentence or removed where it is only about the product;
13
+ * - paths: the container's real home and bundle, shown to the model as the neutral ones every arm has
14
+ * (/tmp/agent/AgentBundles/sanctuary.agent), which are linked to the real ones, so a path the model copies works;
15
+ * - words: the user's name and the arm's own name, wherever a tool result shows them.
16
+ * Model names are in no list, so the host's scan still voids a session where one appears.
17
+ */
18
+ const runtime_1 = require("../../../nerves/runtime");
19
+ const fidelity_1 = require("../guest/h/fidelity");
20
+ const protocol_1 = require("../protocol");
21
+ /** The named agent images H needs, besides the default one the ouro arm runs in. */
22
+ exports.H_ARMS_IMAGES = ["codex", "openhands"];
23
+ const escape = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
24
+ const sentence = (text, by) => ({ pattern: new RegExp(escape(text), "g"), with: by, tier: "sentence" });
25
+ /** The container's real home and bundle, as every arm shows them; the H guest links both. */
26
+ const PATHS = [
27
+ { pattern: /\/home\/ouro(?![\w.-])/g, with: "/tmp/agent", tier: "path" },
28
+ { pattern: /\bsanctuary\.ouro\b/g, with: "sanctuary.agent", tier: "path" },
29
+ ];
30
+ /** The container's user, `ouro`, and the harness's own name, wherever a tool result shows them. */
31
+ const OURO_WORDS = [
32
+ { pattern: /ouroboros/gi, with: "agent", tier: "word" },
33
+ { pattern: /ouro/gi, with: "agent", tier: "word" },
34
+ ];
35
+ const CODEX = [
36
+ sentence("You are a coding agent running in the Codex CLI, a terminal-based coding assistant. Codex CLI is an open source project led by OpenAI.", "You are a coding agent running in a terminal-based coding assistant."),
37
+ sentence("Within this context, Codex refers to the open-source agentic coding interface (not the old Codex language model built by OpenAI).\n\n", ""),
38
+ ...PATHS,
39
+ // The variables codex puts in the shell (CODEX_HOME, CODEX_THREAD_ID, CODEX_SESSION_ID, CODEX_CI).
40
+ { pattern: /CODEX_/g, with: "AGENT_", tier: "word" },
41
+ { pattern: /codex/gi, with: "agent", tier: "word" },
42
+ ...OURO_WORDS,
43
+ ];
44
+ const OPENHANDS = [
45
+ sentence("You are OpenHands agent, a helpful AI assistant", "You are a helpful AI assistant"),
46
+ sentence("* When asked to find a previous local OpenHands conversation, search the workspace's `workspace/conversations/` directory for its event history.\n", ""),
47
+ sentence("* For more information about skills, see: https://docs.openhands.dev/overview/skills\n", ""),
48
+ { pattern: /<SELF_DOCUMENTATION>[\s\S]*?<\/SELF_DOCUMENTATION>\n\n/g, with: "", tier: "sentence" },
49
+ sentence("an AI agent (OpenHands) on behalf of", "an AI agent on behalf of"),
50
+ sentence("Based on OpenHands security risk levels but adapted for agent-sdk.\n", ""),
51
+ ...PATHS,
52
+ { pattern: /openhands/gi, with: "agent", tier: "word" },
53
+ { pattern: /open hands/gi, with: "agent", tier: "word" },
54
+ { pattern: /all-hands/gi, with: "agent", tier: "word" },
55
+ ...OURO_WORDS,
56
+ ];
57
+ exports.H_REPLACEMENTS = {
58
+ ouro: [...PATHS, ...OURO_WORDS],
59
+ codex: CODEX,
60
+ openhands: OPENHANDS,
61
+ };
62
+ /** The folder openhands' terminal reports after a command, the last such line in its result. */
63
+ const REPORTED_FOLDER = /\[Current working directory: ([^\]\n]+)\]/g;
64
+ const reportedFolder = (result) => [...result.matchAll(REPORTED_FOLDER)].at(-1)?.[1];
65
+ /** A shell call's command and folder, from the arm's own arguments; null when they aren't readable. */
66
+ function shellArgs(arm, name, args, folder) {
67
+ const tool = arm === "codex" ? "exec_command" : arm === "openhands" ? "terminal" : null;
68
+ if (name !== tool)
69
+ return null;
70
+ let value;
71
+ try {
72
+ value = JSON.parse(args);
73
+ }
74
+ catch {
75
+ return null;
76
+ }
77
+ if (typeof value !== "object" || value === null)
78
+ return null;
79
+ const fields = value;
80
+ const command = arm === "codex" ? fields.cmd : fields.command;
81
+ if (typeof command !== "string")
82
+ return null;
83
+ // codex names the call's folder. openhands' tmux keeps the folder between calls, so a call starts where the terminal
84
+ // reported it was after the call before; the first starts in the workdir, the bundle.
85
+ const cwd = arm === "codex" ? (typeof fields.workdir === "string" ? fields.workdir : undefined) : folder;
86
+ return cwd === undefined ? { command } : { command, cwd };
87
+ }
88
+ /** codex's exec_command and openhands' terminal as the `shell` calls the books cases' assertions read. */
89
+ function canonicalH(arm, obs) {
90
+ let mapped = 0;
91
+ let folder;
92
+ const timeline = obs.timeline.map((entry) => {
93
+ if (entry.kind !== "call")
94
+ return entry;
95
+ const shell = shellArgs(arm, entry.name, entry.args, folder);
96
+ if (!shell)
97
+ return entry;
98
+ if (arm === "openhands")
99
+ folder = reportedFolder(entry.result) ?? folder;
100
+ mapped += 1;
101
+ return { ...entry, name: "shell", args: JSON.stringify(shell) };
102
+ });
103
+ (0, runtime_1.emitNervesEvent)({ component: "eval", event: "eval.h_canonical", message: "read an H arm's calls as shell calls", meta: { arm, mapped } });
104
+ return { ...obs, timeline };
105
+ }
106
+ exports.H_KIT = {
107
+ guest: ({ session, arm, case: c, debrief }) => {
108
+ const last = c.prefix[c.prefix.length - 1];
109
+ return {
110
+ entry: "h-guest-entry.js",
111
+ turn: { product: session.product, arm: arm.arm, labelLine: (0, protocol_1.labelLine)(session.product, arm.label), prefix: c.prefix.slice(0, -1), userText: last.content, followUps: [debrief] },
112
+ ...(arm.arm === "ouro" ? {} : { image: arm.arm }),
113
+ };
114
+ },
115
+ canonical: canonicalH,
116
+ fidelity: { "H:ouro": [...fidelity_1.H_OURO_FIDELITY], "H:codex": [...fidelity_1.H_CODEX_FIDELITY], "H:openhands": [...fidelity_1.H_OPENHANDS_FIDELITY] },
117
+ replacements: (arm) => Object.hasOwn(exports.H_REPLACEMENTS, arm) ? exports.H_REPLACEMENTS[arm] : undefined,
118
+ images: exports.H_ARMS_IMAGES,
119
+ };
@@ -95,19 +95,23 @@ function guardedRuntime(input) {
95
95
  const rewritten = input.replacements ? (0, rewrite_1.rewriteRequest)(own, input.replacements) : undefined;
96
96
  const request = rewritten?.request ?? own;
97
97
  const body = requestText(request);
98
+ const counted = rewritten ? { rewrites: rewritten.rewrites } : {};
99
+ if (rewritten && input.rewrites)
100
+ for (const [tier, n] of Object.entries(rewritten.rewrites))
101
+ input.rewrites[tier] = (input.rewrites[tier] ?? 0) + n;
98
102
  const hits = (0, protocol_1.brandHits)(body);
99
103
  if (hits.length > 0) {
100
104
  latch._void(hits);
101
- input.log({ kind: gate.kind, sent: false, body });
105
+ input.log({ kind: gate.kind, sent: false, body, ...counted });
102
106
  latch._record({ kind: gate.kind, usage: null, credits: 0, sent: false });
103
107
  (0, runtime_1.emitNervesEvent)({ component: "eval", level: "warn", event: "eval.interview_request_void", message: "refused a request with brand words; its session is void", meta: { kind: gate.kind, count: hits.length } });
104
108
  throw new RefusedCall(`not sent: the request names ${[...new Set(hits.map((hit) => hit.toLowerCase()))].join(", ")}`, "brand");
105
109
  }
106
110
  if (!gate.take()) {
107
- input.log({ kind: gate.kind, sent: false, body });
111
+ input.log({ kind: gate.kind, sent: false, body, ...counted });
108
112
  throw new RefusedCall(`not sent: ${gate.refused()}`, "limit");
109
113
  }
110
- input.log({ kind: gate.kind, sent: true, body });
114
+ input.log({ kind: gate.kind, sent: true, body, ...counted });
111
115
  // The provider builds its body from the messages just scanned, never from items it kept from an earlier call (a
112
116
  // Responses-API runtime keeps reasoning and output items otherwise), so what is sent is what was scanned.
113
117
  input.inner.resetTurnState(request.messages);
@@ -3,22 +3,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.replace = replace;
4
4
  exports.rewriteRequest = rewriteRequest;
5
5
  const runtime_1 = require("../../nerves/runtime");
6
- /** Applies the list in order to one text. */
7
- function replace(text, list) {
8
- return list.reduce((out, { pattern, with: by }) => {
6
+ /** Applies the list in order to one text, adding each replacement's matches to `counts` when given. */
7
+ function replace(text, list, counts) {
8
+ return list.reduce((out, { pattern, with: by, tier = "list" }) => {
9
9
  if (!pattern.global)
10
10
  throw new Error(`replacement ${String(pattern)} must be global (the g flag)`);
11
+ if (counts) {
12
+ const matches = out.match(pattern)?.length ?? 0;
13
+ if (matches > 0)
14
+ counts[tier] = (counts[tier] ?? 0) + matches;
15
+ }
11
16
  return out.replace(pattern, by);
12
17
  }, text);
13
18
  }
14
19
  /** Every string in a plain value rewritten; anything else as it is. */
15
- function deep(value, list) {
20
+ function deep(value, list, counts) {
16
21
  if (typeof value === "string")
17
- return replace(value, list);
22
+ return replace(value, list, counts);
18
23
  if (Array.isArray(value))
19
- return value.map((item) => deep(item, list));
24
+ return value.map((item) => deep(item, list, counts));
20
25
  if (value !== null && typeof value === "object")
21
- return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, deep(item, list)]));
26
+ return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, deep(item, list, counts)]));
22
27
  return value;
23
28
  }
24
29
  /**
@@ -26,13 +31,14 @@ function deep(value, list) {
26
31
  * name. The harness's own fields (callbacks, signal) are passed through untouched.
27
32
  */
28
33
  function rewriteRequest(request, list) {
34
+ const rewrites = {};
29
35
  const rewritten = {
30
36
  ...request,
31
- messages: deep(request.messages, list),
32
- activeTools: deep(request.activeTools, list),
33
- ...(request.deferredTools ? { deferredTools: deep(request.deferredTools, list) } : {}),
34
- ...(request.systemPrompt ? { systemPrompt: deep(request.systemPrompt, list) } : {}),
35
- ...(request.traceId !== undefined ? { traceId: replace(request.traceId, list) } : {}),
37
+ messages: deep(request.messages, list, rewrites),
38
+ activeTools: deep(request.activeTools, list, rewrites),
39
+ ...(request.deferredTools ? { deferredTools: deep(request.deferredTools, list, rewrites) } : {}),
40
+ ...(request.systemPrompt ? { systemPrompt: deep(request.systemPrompt, list, rewrites) } : {}),
41
+ ...(request.traceId !== undefined ? { traceId: replace(request.traceId, list, rewrites) } : {}),
36
42
  };
37
43
  const back = new Map();
38
44
  for (const tool of [...request.activeTools, ...request.deferredTools ?? []]) {
@@ -45,5 +51,5 @@ function rewriteRequest(request, list) {
45
51
  }
46
52
  back.set(sent, own);
47
53
  }
48
- return { request: rewritten, toolName: (name) => back.get(name) ?? name };
54
+ return { request: rewritten, toolName: (name) => back.get(name) ?? name, rewrites };
49
55
  }
@@ -87,7 +87,7 @@ function armRecord(input) {
87
87
  return {
88
88
  label: input.arm.label, arm: input.arm.arm, ...verdict, outcome: raw.outcome, checks: graded.checks, note, rating: (0, protocol_1.ratingOf)(note),
89
89
  debriefOutcome: debrief?.outcome ?? null, debriefToolCalls: debrief?.toolCalls ?? 0,
90
- jobCalls: input.job.calls(), debriefCalls: input.debrief.calls(), observation,
90
+ jobCalls: input.job.calls(), debriefCalls: input.debrief.calls(), rewrites: input.rewrites, observation,
91
91
  };
92
92
  }
93
93
  /** A kit's verdict, or a failed one when it throws: the guest's grade is untrusted input. */
@@ -124,8 +124,8 @@ async function runSession(input) {
124
124
  ouroFirst: false, voidedBy: null, calls: [], spent: ZERO,
125
125
  };
126
126
  const c = caseOf(input.kit, input.cases, session);
127
- const guard = (gateFor, replacements) => (0, latch_1.guardedRuntime)({
128
- inner: input.target.runtime, latch, ledger: input.ledger, pricing: input.pricing, gateFor, ...(replacements ? { replacements } : {}),
127
+ const guard = (gateFor, replacements, rewrites) => (0, latch_1.guardedRuntime)({
128
+ inner: input.target.runtime, latch, ledger: input.ledger, pricing: input.pricing, gateFor, ...(replacements ? { replacements, rewrites } : {}),
129
129
  log: (entry) => input.log(JSON.stringify({ session: session.id, preregistrationVersion: input.version, ...entry })),
130
130
  });
131
131
  const end = (status, why) => {
@@ -137,7 +137,8 @@ async function runSession(input) {
137
137
  const job = latch.gate("job");
138
138
  const debriefGate = latch.gate("debrief");
139
139
  // The gate reads the runner's own request, so the debrief is told apart before the arm's list rewrites it.
140
- const host = guard((request) => request.messages.some((m) => m.role === "user" && m.content === debrief) ? debriefGate : job, input.kit.replacements?.(arm.arm));
140
+ const rewrites = {};
141
+ const host = guard((request) => request.messages.some((m) => m.role === "user" && m.content === debrief) ? debriefGate : job, input.kit.replacements?.(arm.arm), rewrites);
141
142
  let obs;
142
143
  try {
143
144
  obs = await input.runCase({ case: c, host, budget: { take: () => true }, guest: input.kit.guest({ session, arm, case: c, debrief }) });
@@ -146,7 +147,7 @@ async function runSession(input) {
146
147
  end("crashed", `${arm.label}: ${(0, loop_1.messageOf)(error)}`);
147
148
  break;
148
149
  }
149
- const armResult = armRecord({ arm, c, obs, kit: input.kit, job, debrief: debriefGate });
150
+ const armResult = armRecord({ arm, c, obs, kit: input.kit, job, debrief: debriefGate, rewrites });
150
151
  record.arms.push(armResult);
151
152
  if (latch.voided()) {
152
153
  end("void", `${arm.label}: a request named ${named(latch.voided())}`);
@@ -189,7 +190,8 @@ function summarizeSessions(records, spent, stopped) {
189
190
  const lines = records.map((r) => {
190
191
  const passed = r.arms.filter((arm) => arm.passed).length;
191
192
  const usage = r.calls.reduce((sum, call) => ({ input: sum.input + (call.usage?.input_tokens ?? 0), output: sum.output + (call.usage?.output_tokens ?? 0) }), { input: 0, output: 0 });
192
- return `${r.id} ${r.status} ouro-first=${r.ouroFirst ? "yes" : "no"} jobs-passed=${passed}/${r.arms.length} calls=${r.calls.length} tokens-in=${usage.input} tokens-out=${usage.output} credits=${r.spent.credits.toFixed(3)} premium=${r.spent.premium}`;
193
+ const rewrites = r.arms.map((arm) => `${arm.arm}:${Object.entries(arm.rewrites).map(([tier, n]) => `${tier} ${n}`).join(",") || "none"}`).join(";");
194
+ return `${r.id} ${r.status} ouro-first=${r.ouroFirst ? "yes" : "no"} jobs-passed=${passed}/${r.arms.length} calls=${r.calls.length} tokens-in=${usage.input} tokens-out=${usage.output} credits=${r.spent.credits.toFixed(3)} premium=${r.spent.premium}${rewrites ? ` rewrites=${rewrites}` : ""}`;
193
195
  });
194
196
  return [...lines, `spent: ${spent.credits.toFixed(3)} credits, ${spent.premium} premium requests${stopped ? `; stopped: ${stopped}` : ""}`].join("\n");
195
197
  }
@@ -221,6 +223,11 @@ async function runInterviews(args, deps) {
221
223
  const missingKit = chosen.find((session) => !deps.kits[session.product]);
222
224
  if (missingKit)
223
225
  throw new Error(`session ${missingKit.id} is product ${missingKit.product}, which has no runner kit yet`);
226
+ for (const session of chosen) {
227
+ const missing = (deps.kits[session.product].images ?? []).find((name) => !(deps.agentImages ?? []).includes(name));
228
+ if (missing)
229
+ throw new Error(`session ${session.id} needs the agent image ${missing}; name it in --images as ${missing}=<image>`);
230
+ }
224
231
  const fidelity = fidelityOf(deps.kits, chosen);
225
232
  const cases = new Map(deps.loadCases(args.cases).map((c) => [c.id, c]));
226
233
  const missingCase = chosen.find((session) => !caseOf(deps.kits[session.product], cases, session));
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1505",
3
+ "version": "0.1.0-alpha.1507",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@ouro.bot/cli",
9
- "version": "0.1.0-alpha.1505",
9
+ "version": "0.1.0-alpha.1507",
10
10
  "bundleDependencies": [
11
11
  "@ouro.bot/friends"
12
12
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1505",
3
+ "version": "0.1.0-alpha.1507",
4
4
  "description": "Ouroboros, the agent harness: agents with durable memory that live where you talk (terminal, Teams, iMessage, mail, voice) and use real tools. Start with npx ouro.bot@latest.",
5
5
  "homepage": "https://ouroboros.bot/",
6
6
  "engines": {