@ouro.bot/cli 0.1.0-alpha.1431 → 0.1.0-alpha.1432

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.
Files changed (30) hide show
  1. package/changelog.json +12 -1
  2. package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
  3. package/deploy/unraid/sanctuary.xml +1 -1
  4. package/dist/eval/interview-guest-entry.js +17 -0
  5. package/dist/eval/interviews/allocation.js +64 -0
  6. package/dist/eval/interviews/guest/arms.js +173 -0
  7. package/dist/eval/interviews/guest/ax/ax-command.js +792 -0
  8. package/dist/eval/interviews/guest/ax/effects.js +51 -0
  9. package/dist/eval/interviews/guest/ax/exit-codes.js +51 -0
  10. package/dist/eval/interviews/guest/ax/help.js +181 -0
  11. package/dist/eval/interviews/guest/ax/mcp.js +246 -0
  12. package/dist/eval/interviews/guest/ax/outcome.js +211 -0
  13. package/dist/eval/interviews/guest/ax/output.js +53 -0
  14. package/dist/eval/interviews/guest/ax/precise-copy.js +200 -0
  15. package/dist/eval/interviews/guest/ax/problem.js +95 -0
  16. package/dist/eval/interviews/guest/ax/voice.js +83 -0
  17. package/dist/eval/interviews/guest/ax/wait.js +158 -0
  18. package/dist/eval/interviews/guest/books-core.js +54 -0
  19. package/dist/eval/interviews/guest/cli-shell.js +267 -0
  20. package/dist/eval/interviews/guest/loop.js +78 -0
  21. package/dist/eval/interviews/guest/operations.js +108 -0
  22. package/dist/eval/interviews/guest/run.js +62 -0
  23. package/dist/eval/interviews/latch.js +122 -0
  24. package/dist/eval/interviews/protocol.js +77 -0
  25. package/dist/eval/remote-entry.js +2 -0
  26. package/dist/eval/sandbox/docker.js +23 -6
  27. package/dist/eval/sandbox/remote.js +2 -2
  28. package/dist/nerves/coverage/file-completeness.js +3 -0
  29. package/npm-shrinkwrap.json +2 -2
  30. package/package.json +1 -1
package/changelog.json CHANGED
@@ -1,13 +1,24 @@
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.1432",
6
+ "changes": [
7
+ "The eval can now run a blind interview conversation in its sandbox: a neutral tool loop, not the Butler's own turn, with one of three book-tool interfaces (an AX-kit tool set, plain MCP-style tools, or a `books` command behind a single `shell` tool), all doing the same operations with the same results. A conversation can have a follow-up question after the job, and the host scans every model request for brand words and counts it against a per-session call latch before sending it."
8
+ ]
9
+ },
4
10
  {
5
11
  "version": "0.1.0-alpha.1431",
6
12
  "changes": [
7
- "Phone utterances in the cascade voice path (Twilio Media Stream and Twilio recordings) now end with a recorded outcome; the OpenAI Realtime and SIP engines are not covered yet. Each thing a caller says is recorded before its turn runs. Its speech, and any tool that messages a person, is noted before it goes out, and its turn records it as answered, silent (the agent had nothing to say) or failed. A reply counts as answered only once it could reach the caller: a Media Stream reply once some of its audio went down the call (so a hangup or talk-over after part of it played still counts as answered), a buffered recording's reply once its playback files are written, and a streamed recording's reply once its speech is made, before Twilio fetches the stream. A Media Stream reply cut off before any audio played is recorded as failed, saying why: the call ended, the caller spoke again, a tool's audio took its place, or the reply made no audio to send. Live audio is never replayed: an utterance a stopped process left is recorded as failed once the voice sense is listening again, and when it shuts down, and the record says what the caller had already heard. A bridge that cannot take its port leaves the running one's records alone. A recording callback Twilio sends twice runs one turn: a retry while the first is still being answered gets the same reply, a retry of a streamed reply gets the same play link while its stream is still served, and any other retry is sent on to listen. A record that cannot be written is logged and never costs the caller the answer or stops the voice sense.",
8
13
  "`ouro up` now says why an update did not install (\"could not install X: ...\"), instead of \"update check unavailable\", and says when npm lists a release but is not serving its tarball yet. The unattended updater treats that not-served-yet answer (ETARGET, or a 404 on the release's tarball) as a wait for the next pass, not an install failure, and does not count it as a failed attempt."
9
14
  ]
10
15
  },
16
+ {
17
+ "version": "0.1.0-alpha.1430",
18
+ "changes": [
19
+ "Phone utterances in the cascade voice path (Twilio Media Stream and Twilio recordings) now end with a recorded outcome; the OpenAI Realtime and SIP engines are not covered yet. Each thing a caller says is recorded before its turn runs. Its speech, and any tool that messages a person, is noted before it goes out, and its turn records it as answered, silent (the agent had nothing to say) or failed. A reply counts as answered only once it could reach the caller: a Media Stream reply once some of its audio went down the call (so a hangup or talk-over after part of it played still counts as answered), a buffered recording's reply once its playback files are written, and a streamed recording's reply once its speech is made, before Twilio fetches the stream. A Media Stream reply cut off before any audio played is recorded as failed, saying why: the call ended, the caller spoke again, a tool's audio took its place, or the reply made no audio to send. Live audio is never replayed: an utterance a stopped process left is recorded as failed once the voice sense is listening again, and when it shuts down, and the record says what the caller had already heard. A bridge that cannot take its port leaves the running one's records alone. A recording callback Twilio sends twice runs one turn: a retry while the first is still being answered gets the same reply, a retry of a streamed reply gets the same play link while its stream is still served, and any other retry is sent on to listen. A record that cannot be written is logged and never costs the caller the answer or stops the voice sense."
20
+ ]
21
+ },
11
22
  {
12
23
  "version": "0.1.0-alpha.1429",
13
24
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1431",
2
+ "runtimeVersion": "0.1.0-alpha.1432",
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.1431</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1432</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * The agent container's command for a U or X interview conversation, `node dist/eval/interview-guest-entry.js`, run
5
+ * only inside the eval sandbox: the neutral loop with one arm's tools, from the turn file the sandbox mounts at
6
+ * `/eval/turn.json`, its provider served by the host over stdin and stdout (see `interviews/guest/run.ts`). It takes
7
+ * no arguments, so it is no command an agent's shell is offered.
8
+ */
9
+ const identity_1 = require("../heart/identity");
10
+ const runtime_1 = require("../nerves/runtime");
11
+ const run_1 = require("./interviews/guest/run");
12
+ void (0, run_1.runInterviewGuest)({ stdin: process.stdin, stdout: process.stdout, turnFile: "/eval/turn.json", bundle: (0, identity_1.getAgentRoot)("sanctuary") }).then((outcome) => {
13
+ process.exit(outcome.ok ? 0 : 1);
14
+ }).catch((error) => {
15
+ (0, runtime_1.emitNervesEvent)({ component: "eval", level: "error", event: "eval.interview_guest_entry_error", message: "interview guest failed outside its conversation", meta: { error: String(error) } });
16
+ process.exit(1);
17
+ });
@@ -0,0 +1,64 @@
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.APPENDIX_B_SHA256 = void 0;
7
+ exports.readAllocation = readAllocation;
8
+ exports.reducedDesign = reducedDesign;
9
+ /**
10
+ * The pre-registered allocation (Appendix B): every session's model, job and labelled arms in run order, read from
11
+ * the pre-registration file itself and refused unless its rows hash to the SHA-256 the file states (Appendix A), so a
12
+ * session can never run from an edited table.
13
+ */
14
+ const node_crypto_1 = __importDefault(require("node:crypto"));
15
+ const runtime_1 = require("../../nerves/runtime");
16
+ const protocol_1 = require("./protocol");
17
+ /** The SHA-256 of Appendix B's rows as the allocation script prints them, one per line. */
18
+ exports.APPENDIX_B_SHA256 = "ca0b441641c6c62e70238ee2b31b2283d358103d683061a97e0174f6c29851f2";
19
+ const ROW = /^\| ([HUX])-(\S+) \| (\S+) \| (\S+) \| (.+) \|$/;
20
+ function parseArms(product, cell, id) {
21
+ const arms = cell.split(", ").map((pair) => {
22
+ const [label, arm] = pair.split("=");
23
+ if (!label || !arm || !protocol_1.LABELS.includes(label) || !protocol_1.ARMS[product].includes(arm))
24
+ throw new Error(`session ${id}: ${pair} is not a label and one of ${product}'s arms`);
25
+ return { label, arm };
26
+ });
27
+ if (arms.length !== 3 || new Set(arms.map((a) => a.arm)).size !== 3 || new Set(arms.map((a) => a.label)).size !== 3)
28
+ throw new Error(`session ${id} must have three different labels and arms`);
29
+ return arms;
30
+ }
31
+ /** Every session of Appendix B in its order, from the pre-registration's text. */
32
+ function readAllocation(preregistration, expectedSha256 = exports.APPENDIX_B_SHA256) {
33
+ const start = preregistration.indexOf("## Appendix B");
34
+ const end = preregistration.indexOf("## Appendix C");
35
+ if (start < 0 || end < start)
36
+ throw new Error("the pre-registration has no Appendix B");
37
+ const rows = preregistration.slice(start, end).split("\n").filter((line) => /^\| [HUX]-/.test(line));
38
+ const sha = node_crypto_1.default.createHash("sha256").update(`${rows.join("\n")}\n`).digest("hex");
39
+ if (sha !== expectedSha256)
40
+ throw new Error(`Appendix B hashes to ${sha}, not the registered ${expectedSha256}; refusing to run from a changed allocation`);
41
+ const sessions = rows.map((line) => {
42
+ const match = ROW.exec(line);
43
+ if (!match)
44
+ throw new Error(`Appendix B row is malformed: ${line}`);
45
+ const product = match[1];
46
+ const id = `${product}-${match[2]}`;
47
+ return { id, product, model: match[3], job: match[4], arms: parseArms(product, match[5], id), pilot: match[2] === "pilot" };
48
+ });
49
+ (0, runtime_1.emitNervesEvent)({ component: "eval", event: "eval.interview_allocation_read", message: "read the pre-registered allocation", meta: { sessions: sessions.length } });
50
+ return sessions;
51
+ }
52
+ /**
53
+ * The reduced design (section 5): per model and product, only the sessions whose order is a rotation of the arm list
54
+ * (`ouro, alt1, alt2`, `alt1, alt2, ouro`, `alt2, ouro, alt1`). Pilot sessions are kept as they are.
55
+ */
56
+ function reducedDesign(sessions) {
57
+ return sessions.filter((session) => {
58
+ if (session.pilot)
59
+ return true;
60
+ const [a, b, c] = protocol_1.ARMS[session.product];
61
+ const order = session.arms.map((entry) => entry.arm).join(",");
62
+ return [[a, b, c], [b, c, a], [c, a, b]].some((rotation) => rotation.join(",") === order);
63
+ });
64
+ }
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.X_ARMS = void 0;
4
+ exports.booksAxCli = booksAxCli;
5
+ exports.buildArm = buildArm;
6
+ /**
7
+ * The three X arms (pre-registration section 2), each the same books operations (`operations.ts`) on the same books
8
+ * command (`books-core.ts`), presented three ways:
9
+ * - `ouro`: the operations defined once with `ax-command` from Ouro AX v1.3.445 (vendored unchanged in `./ax`, its
10
+ * imports without the `.ts` extension), offered as the kit's own MCP tools: `createMcpHandler`'s tools/list and
11
+ * tools/call, with its input checks, error shape and result text.
12
+ * - `mcp-plain`: the same operations as hand-written MCP tools, each with a description, an `inputSchema`, a text
13
+ * result and `isError` on failure.
14
+ * - `cli-shell`: a conventional `books` command line behind one `shell` tool (`cli-shell.ts`).
15
+ *
16
+ * The core's answer is the result in every arm, as JSON text in the two tool arms and as lines of text (or `--json`)
17
+ * on the command line. A core error is an error in every arm, with the core's message; none adds a fix the others lack.
18
+ */
19
+ const runtime_1 = require("../../../nerves/runtime");
20
+ const ax_command_1 = require("./ax/ax-command");
21
+ const mcp_1 = require("./ax/mcp");
22
+ const problem_1 = require("./ax/problem");
23
+ const books_core_1 = require("./books-core");
24
+ const cli_shell_1 = require("./cli-shell");
25
+ const operations_1 = require("./operations");
26
+ exports.X_ARMS = ["ouro", "mcp-plain", "cli-shell"];
27
+ const parseArgs = (args) => {
28
+ try {
29
+ const value = JSON.parse(args || "{}");
30
+ return value && typeof value === "object" && !Array.isArray(value) ? value : null;
31
+ }
32
+ catch {
33
+ return null;
34
+ }
35
+ };
36
+ // ---- ouro: ax-command ------------------------------------------------------------------------------------------
37
+ const axArg = (param) => ({ name: param.name, description: param.description, required: param.required === true, ...(param.kind === "list" ? { rest: "list" } : {}) });
38
+ const axFlag = (param) => ({ type: param.kind === "flag" ? "boolean" : param.kind === "number" ? "number" : "string", description: param.description });
39
+ function axInput(op, input) {
40
+ const out = {};
41
+ for (const param of op.params) {
42
+ const value = input[param.name];
43
+ if (value !== undefined)
44
+ out[param.name] = Array.isArray(value) ? [...value] : value;
45
+ }
46
+ return out;
47
+ }
48
+ /** The books command line built with ax-command, one definition per operation. */
49
+ function booksAxCli(core) {
50
+ return (0, ax_command_1.defineCli)({
51
+ name: "books",
52
+ about: ["books: find, check, shelve and send the household's e-books."],
53
+ commands: operations_1.OPERATIONS.map((op) => (0, ax_command_1.defineCommand)({
54
+ name: op.words.join(" "),
55
+ summary: op.summary,
56
+ effect: "private",
57
+ readOnly: op.readOnly,
58
+ args: op.params.filter((p) => p.positional).map(axArg),
59
+ flags: Object.fromEntries(op.params.filter((p) => !p.positional).map((p) => [p.name, axFlag(p)])),
60
+ examples: [`books ${op.example}`],
61
+ output: "the books command's answer as JSON",
62
+ run: async (input) => {
63
+ const result = await core((0, operations_1.argvOf)(op, axInput(op, input)));
64
+ const error = (0, books_core_1.coreError)(result);
65
+ if (error !== null)
66
+ throw new problem_1.AxError({ code: "books-failed", exit: result.code === 2 ? 2 : 1, thing: op.words.join("_"), problem: error, fix: null });
67
+ return result.json;
68
+ },
69
+ })),
70
+ });
71
+ }
72
+ function axArm(core) {
73
+ const cli = booksAxCli(core);
74
+ const handle = (0, mcp_1.createMcpHandler)({ cli });
75
+ const byName = new Map(operations_1.OPERATIONS.map((op) => [op.words.join("_"), op]));
76
+ let id = 0;
77
+ return {
78
+ key: "ouro",
79
+ tools: (0, mcp_1.mcpTools)({ cli }).map((tool) => ({ name: tool.name, description: tool.description, parameters: tool.inputSchema })),
80
+ async call(name, args) {
81
+ id += 1;
82
+ const params = parseArgs(args) ?? { "": args };
83
+ const meta = { "io.modelcontextprotocol/protocolVersion": mcp_1.PROTOCOL_VERSIONS[0], "io.modelcontextprotocol/clientCapabilities": {} };
84
+ const reply = await handle({ jsonrpc: "2.0", id, method: "tools/call", params: { name, arguments: params, _meta: meta } });
85
+ return { text: reply.result.content.map((part) => part.text).join("\n"), isError: reply.result.isError };
86
+ },
87
+ operationOf(name, args) {
88
+ // Only what the kit would run: its own input check, so a call it refuses names no operation.
89
+ const op = byName.get(name);
90
+ const command = cli.commands.find((c) => c.name === op?.words.join(" "));
91
+ const params = parseArgs(args);
92
+ if (!op || !command || !params)
93
+ return null;
94
+ try {
95
+ return { op, input: axInput(op, (0, ax_command_1.checkInput)(cli, command, params)) };
96
+ }
97
+ catch {
98
+ return null;
99
+ }
100
+ },
101
+ };
102
+ }
103
+ // ---- mcp-plain: hand-written MCP tools ---------------------------------------------------------------------------
104
+ const PLAIN_NAMES = {
105
+ "search": "search_books", "get": "download_book", "check": "check_books", "text": "read_book_text", "library find": "find_in_library",
106
+ "library add": "add_to_library", "library remove": "remove_from_library", "library replace": "replace_in_library",
107
+ "send": "send_to_reader", "deliver": "deliver_books", "ledger": "show_history",
108
+ };
109
+ function plainSchema(op) {
110
+ const properties = {};
111
+ for (const param of op.params) {
112
+ const type = param.kind === "list" ? { type: "array", items: { type: "string" } } : param.kind === "flag" ? { type: "boolean" } : param.kind === "number" ? { type: param.name === "id" ? "integer" : "number" } : { type: "string" };
113
+ properties[param.name.replace(/-/g, "_")] = { ...type, description: param.description };
114
+ }
115
+ return { type: "object", properties, required: op.params.filter((p) => p.required).map((p) => p.name.replace(/-/g, "_")) };
116
+ }
117
+ function plainInput(op, params) {
118
+ const input = {};
119
+ for (const param of op.params) {
120
+ const key = param.name.replace(/-/g, "_");
121
+ const value = params[key];
122
+ if (value === undefined || value === null) {
123
+ if (param.required)
124
+ return `missing required argument: ${key}`;
125
+ continue;
126
+ }
127
+ const ok = param.kind === "list" ? Array.isArray(value) && value.every((v) => typeof v === "string") : param.kind === "flag" ? typeof value === "boolean" : param.kind === "number" ? typeof value === "number" : typeof value === "string";
128
+ if (!ok)
129
+ return `argument ${key} must be ${param.kind === "list" ? "an array of strings" : param.kind === "flag" ? "a boolean" : `a ${param.kind}`}`;
130
+ input[param.name] = value;
131
+ }
132
+ return input;
133
+ }
134
+ function mcpPlainArm(core) {
135
+ const byName = new Map(operations_1.OPERATIONS.map((op) => [PLAIN_NAMES[op.words.join(" ")], op]));
136
+ const resolve = (name, args) => {
137
+ const op = byName.get(name);
138
+ if (!op)
139
+ return { error: `Unknown tool: ${name}` };
140
+ const params = parseArgs(args);
141
+ if (!params)
142
+ return { error: "arguments must be a JSON object" };
143
+ const input = plainInput(op, params);
144
+ return typeof input === "string" ? { error: input } : { op, input };
145
+ };
146
+ return {
147
+ key: "mcp-plain",
148
+ tools: [...byName].map(([name, op]) => ({ name, description: op.summary, parameters: plainSchema(op) })),
149
+ async call(name, args) {
150
+ const resolved = resolve(name, args);
151
+ if ("error" in resolved)
152
+ return { text: resolved.error, isError: true };
153
+ const result = await core((0, operations_1.argvOf)(resolved.op, resolved.input));
154
+ const error = (0, books_core_1.coreError)(result);
155
+ return error !== null ? { text: error, isError: true } : { text: JSON.stringify(result.json), isError: false };
156
+ },
157
+ operationOf(name, args) {
158
+ const resolved = resolve(name, args);
159
+ return "error" in resolved ? null : resolved;
160
+ },
161
+ };
162
+ }
163
+ /** The X arm named `key`, on `core`. */
164
+ function buildArm(key, core) {
165
+ (0, runtime_1.emitNervesEvent)({ component: "eval", event: "eval.interview_arm_built", message: "built an X arm's tools", meta: { arm: key } });
166
+ if (key === "ouro")
167
+ return axArm(core);
168
+ if (key === "mcp-plain")
169
+ return mcpPlainArm(core);
170
+ if (key === "cli-shell")
171
+ return (0, cli_shell_1.cliShellArm)(core);
172
+ throw new Error(`no X arm ${key}; the arms are ${exports.X_ARMS.join(", ")}`);
173
+ }