@ouro.bot/cli 0.1.0-alpha.1484 → 0.1.0-alpha.1486

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,13 @@
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.1486",
6
+ "changes": [
7
+ "A blind-interview arm can now carry its own replacement list, which pre-registration section 3 requires. The interview's guarded runtime rewrites every request with the arm's list before the brand-word scan: the system prompt, the tools, the messages, the tool results and the trace id. The model is sent only the rewritten request, and the scan still voids the session if a brand word gets through. A tool the list renames is handed back to the harness under its own name. A call's arguments are not mapped back, so an arm whose list rewrites paths must give those paths their neutral names in its sandbox. The scan reads the request as the guard sends it; a preamble a provider adds after that (the Anthropic setup-token provider's) is not scanned, and the interviews do not use that provider.",
8
+ "Eval sandbox: an agent profile names the agent a sandboxed run puts in its container, where that agent's bundle comes from and which bundle paths the turn may write. The Butler's profile is today's bundle projection and today's writable paths, and is still the default; the sandbox itself moves onto profiles in a later change. The sandbox's guests no longer pick the Butler's bundle themselves. The Telegram guest takes the bundle its `--agent` names, though the Telegram turn still runs only the Butler. The interview guest runs on whichever one bundle the sandbox mounted. A new test pins every Docker command and every file a default run hands the agent container, for the replay eval and the interviews, byte for byte against recordings taken before this change."
9
+ ]
10
+ },
4
11
  {
5
12
  "version": "0.1.0-alpha.1484",
6
13
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1484",
2
+ "runtimeVersion": "0.1.0-alpha.1486",
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.1484</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1486</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -5,10 +5,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
5
5
  * read from the turn file the sandbox mounts at `/eval/turn.json`, with its provider served by the host over stdin
6
6
  * and stdout (see `sandbox/guest.ts`). It takes no arguments, so it is no command an agent's shell is offered.
7
7
  */
8
+ const identity_1 = require("../heart/identity");
8
9
  const runtime_1 = require("../nerves/runtime");
9
10
  const guest_1 = require("./sandbox/guest");
10
11
  const telegram_turn_1 = require("./transport/telegram-turn");
11
- void (0, guest_1.runGuest)({ stdin: process.stdin, stdout: process.stdout, turnFile: "/eval/turn.json", runTurn: telegram_turn_1.runTelegramTurn }).then((outcome) => {
12
+ // The sandbox starts this with `--agent <name>`, the agent whose bundle it mounted.
13
+ void Promise.resolve().then(() => (0, guest_1.runGuest)({ stdin: process.stdin, stdout: process.stdout, turnFile: "/eval/turn.json", runTurn: telegram_turn_1.runTelegramTurn, agentRoot: (0, identity_1.getAgentRoot)() })).then((outcome) => {
12
14
  process.exit(outcome.ok ? 0 : 1);
13
15
  }).catch((error) => {
14
16
  (0, runtime_1.emitNervesEvent)({ component: "eval", level: "error", event: "eval.guest_entry_error", message: "sandbox guest failed outside its turn", meta: { error: String(error) } });
@@ -9,7 +9,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  const identity_1 = require("../heart/identity");
10
10
  const runtime_1 = require("../nerves/runtime");
11
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) => {
12
+ const guest_1 = require("./sandbox/guest");
13
+ // The bundle is whichever one the sandbox mounted, so this command is the same for every agent.
14
+ void Promise.resolve().then(() => (0, run_1.runInterviewGuest)({ stdin: process.stdin, stdout: process.stdout, turnFile: "/eval/turn.json", bundle: (0, guest_1.mountedAgentRoot)((0, identity_1.getAgentBundlesRoot)()) })).then((outcome) => {
13
15
  process.exit(outcome.ok ? 0 : 1);
14
16
  }).catch((error) => {
15
17
  (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) } });
@@ -7,6 +7,7 @@ exports.guardedRuntime = guardedRuntime;
7
7
  const runtime_1 = require("../../nerves/runtime");
8
8
  const budget_1 = require("../budget");
9
9
  const protocol_1 = require("./protocol");
10
+ const rewrite_1 = require("./rewrite");
10
11
  /**
11
12
  * A session's most calls: three jobs at 12, three debriefs at 2, the choice and the blinding check at 1, and the one
12
13
  * nudge the choice may get (36 + 6 + 2 + 1). The pilot amendment of 2026-11-23 reserves the nudge's call too.
@@ -71,9 +72,15 @@ class RefusedCall extends Error {
71
72
  }
72
73
  }
73
74
  exports.RefusedCall = RefusedCall;
74
- /** The text of everything a request sends: system prompt, tools, messages and tool results. */
75
+ /**
76
+ * The text of everything a request sends: system prompt, tools, messages and tool results, and the trace id, which
77
+ * some providers send as metadata. The rest (reasoning effort, tool choice) are the provider's own fixed words.
78
+ */
75
79
  function requestText(request) {
76
- return JSON.stringify({ systemPrompt: request.systemPrompt ?? null, tools: request.activeTools, deferred: request.deferredTools ?? [], messages: request.messages });
80
+ return JSON.stringify({
81
+ systemPrompt: request.systemPrompt ?? null, tools: request.activeTools, deferred: request.deferredTools ?? [], messages: request.messages,
82
+ ...(request.traceId !== undefined ? { traceId: request.traceId } : {}),
83
+ });
77
84
  }
78
85
  /**
79
86
  * The runtime one conversation's calls go through: scan, then the conversation's gate (`gateFor`, which may tell a job
@@ -83,9 +90,11 @@ function requestText(request) {
83
90
  function guardedRuntime(input) {
84
91
  const latch = input.latch;
85
92
  const metered = (0, budget_1.meteredRuntime)(input.inner, latch.hold, input.ledger);
86
- const streamTurn = async (request) => {
93
+ const streamTurn = async (own) => {
94
+ const gate = input.gateFor(own);
95
+ const rewritten = input.replacements ? (0, rewrite_1.rewriteRequest)(own, input.replacements) : undefined;
96
+ const request = rewritten?.request ?? own;
87
97
  const body = requestText(request);
88
- const gate = input.gateFor(request);
89
98
  const hits = (0, protocol_1.brandHits)(body);
90
99
  if (hits.length > 0) {
91
100
  latch._void(hits);
@@ -105,7 +114,7 @@ function guardedRuntime(input) {
105
114
  try {
106
115
  const result = await metered.streamTurn(request);
107
116
  latch._record({ kind: gate.kind, usage: result.usage ?? null, credits: result.usage ? (0, budget_1.creditsOf)(result.usage, input.pricing) : 0, sent: true });
108
- return result;
117
+ return rewritten ? { ...result, toolCalls: result.toolCalls.map((call) => ({ ...call, name: rewritten.toolName(call.name) })) } : result;
109
118
  }
110
119
  catch (error) {
111
120
  latch._record({ kind: gate.kind, usage: null, credits: 0, sent: true });
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.replace = replace;
4
+ exports.rewriteRequest = rewriteRequest;
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 }) => {
9
+ if (!pattern.global)
10
+ throw new Error(`replacement ${String(pattern)} must be global (the g flag)`);
11
+ return out.replace(pattern, by);
12
+ }, text);
13
+ }
14
+ /** Every string in a plain value rewritten; anything else as it is. */
15
+ function deep(value, list) {
16
+ if (typeof value === "string")
17
+ return replace(value, list);
18
+ if (Array.isArray(value))
19
+ return value.map((item) => deep(item, list));
20
+ if (value !== null && typeof value === "object")
21
+ return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, deep(item, list)]));
22
+ return value;
23
+ }
24
+ /**
25
+ * The request as the model is sent it, and the harness's own name for each tool the model may call by its rewritten
26
+ * name. The harness's own fields (callbacks, signal) are passed through untouched.
27
+ */
28
+ function rewriteRequest(request, list) {
29
+ const rewritten = {
30
+ ...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) } : {}),
36
+ };
37
+ const back = new Map();
38
+ for (const tool of [...request.activeTools, ...request.deferredTools ?? []]) {
39
+ const own = tool.function.name;
40
+ const sent = replace(own, list);
41
+ const earlier = back.get(sent);
42
+ if (earlier !== undefined && earlier !== own) {
43
+ (0, runtime_1.emitNervesEvent)({ component: "eval", level: "error", event: "eval.interview_rewrite_clash", message: "an arm's replacement list gives two tools the same name", meta: { name: sent } });
44
+ throw new Error(`tools ${earlier} and ${own} would both be called ${sent}`);
45
+ }
46
+ back.set(sent, own);
47
+ }
48
+ return { request: rewritten, toolName: (name) => back.get(name) ?? name };
49
+ }
@@ -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) => (0, latch_1.guardedRuntime)({
128
- inner: input.target.runtime, latch, ledger: input.ledger, pricing: input.pricing, gateFor,
127
+ const guard = (gateFor, replacements) => (0, latch_1.guardedRuntime)({
128
+ inner: input.target.runtime, latch, ledger: input.ledger, pricing: input.pricing, gateFor, ...(replacements ? { replacements } : {}),
129
129
  log: (entry) => input.log(JSON.stringify({ session: session.id, preregistrationVersion: input.version, ...entry })),
130
130
  });
131
131
  const end = (status, why) => {
@@ -136,7 +136,8 @@ async function runSession(input) {
136
136
  const debrief = (0, protocol_1.debriefQuestion)(session.product, arm.label);
137
137
  const job = latch.gate("job");
138
138
  const debriefGate = latch.gate("debrief");
139
- const host = guard((request) => request.messages.some((m) => m.role === "user" && m.content === debrief) ? debriefGate : job);
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
141
  let obs;
141
142
  try {
142
143
  obs = await input.runCase({ case: c, host, budget: { take: () => true }, guest: input.kit.guest({ session, arm, case: c, debrief }) });
@@ -0,0 +1,74 @@
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.SANCTUARY_WRITABLE = exports.CONTAINER_BUNDLES = void 0;
7
+ exports.sanctuaryProfile = sanctuaryProfile;
8
+ exports.containerBundle = containerBundle;
9
+ exports.checkProfile = checkProfile;
10
+ exports.bundleMounts = bundleMounts;
11
+ /**
12
+ * Which agent a sandboxed run puts in the agent container. A profile names the agent, says where its bundle comes
13
+ * from and lists the bundle paths the turn may write; everything else in the bundle is mounted read-only.
14
+ *
15
+ * - The bundle sits where the agent's own runtime looks for it, `/home/ouro/AgentBundles/<agent>.ouro`, and the
16
+ * Telegram guest is started with `--agent <agent>`.
17
+ * - The bundle source fills the run's bundle folder from the case's `include` paths and says what it left out (the
18
+ * gaps every report lists). The Butler's source projects the bundle under test over the public seed bundle; a
19
+ * later slice adds a source that exports a committed bundle.
20
+ * - The writable paths are relative to the bundle, inside it, and each mounted over its read-only copy.
21
+ *
22
+ * `sanctuaryProfile` is the Butler's, and what every run used before profiles existed; it is still the default, so
23
+ * the replay eval and the interviews run exactly as they did.
24
+ */
25
+ const node_path_1 = __importDefault(require("node:path"));
26
+ const runtime_1 = require("../../nerves/runtime");
27
+ const projection_1 = require("./projection");
28
+ /** Where every agent's bundles sit in the agent container. */
29
+ exports.CONTAINER_BUNDLES = "/home/ouro/AgentBundles";
30
+ /** What the Butler's turn and its books CLI write. */
31
+ exports.SANCTUARY_WRITABLE = ["books/work", "books/removed", "books/ledger.ndjson", "state", "friends", "arc", "desk/_record"];
32
+ const AGENT_NAME = /^[a-z][a-z0-9-]{0,62}$/;
33
+ const WRITABLE_PATH = /^[A-Za-z0-9._-][A-Za-z0-9._/-]*$/;
34
+ /** The Butler's profile: its bundle under test projected over the public seed bundle. */
35
+ function sanctuaryProfile(input) {
36
+ return {
37
+ agent: "sanctuary",
38
+ bundleSource: ({ include, out }) => (0, projection_1.projectBundle)({ bundleDir: input.bundleDir, seedBundleDir: input.seedBundleDir, include, out }),
39
+ writable: exports.SANCTUARY_WRITABLE,
40
+ };
41
+ }
42
+ /** The bundle's path in the agent container. */
43
+ function containerBundle(profile) {
44
+ return `${exports.CONTAINER_BUNDLES}/${profile.agent}.ouro`;
45
+ }
46
+ /** Throws unless the agent's name is a plain name and every writable path stays inside the bundle, once. */
47
+ function checkProfile(profile) {
48
+ const problems = [];
49
+ if (!AGENT_NAME.test(profile.agent))
50
+ problems.push("the agent's name must be lowercase letters, digits and dashes");
51
+ if (profile.writable.length === 0)
52
+ problems.push("it lists no writable path");
53
+ const seen = new Set();
54
+ for (const entry of profile.writable) {
55
+ // Docker splits a `-v` value on `:` and its options on `,`, so a path is held to plain characters.
56
+ if (!WRITABLE_PATH.test(entry) || entry !== node_path_1.default.posix.normalize(entry) || entry === "." || entry.split("/").includes("..") || entry.endsWith("/")) {
57
+ problems.push(`writable path ${JSON.stringify(entry)} must be a plain path inside the bundle`);
58
+ }
59
+ else if (seen.has(entry)) {
60
+ problems.push(`writable path ${entry} is listed twice`);
61
+ }
62
+ seen.add(entry);
63
+ }
64
+ if (problems.length > 0) {
65
+ (0, runtime_1.emitNervesEvent)({ level: "error", component: "eval", event: "eval.sandbox_profile_refused", message: "refused an agent profile", meta: { agent: profile.agent, problems: problems.length } });
66
+ throw new Error(`agent profile ${JSON.stringify(profile.agent)}: ${problems.join("; ")}`);
67
+ }
68
+ }
69
+ /** The agent container's bundle mounts: the whole bundle read-only, then each writable path over it. Checks the profile first. */
70
+ function bundleMounts(profile, hostBundle) {
71
+ checkProfile(profile);
72
+ const target = containerBundle(profile);
73
+ return ["-v", `${hostBundle}:${target}:ro`, ...profile.writable.flatMap((entry) => ["-v", `${node_path_1.default.join(hostBundle, entry)}:${target}/${entry}`])];
74
+ }
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.mountedAgentRoot = mountedAgentRoot;
6
7
  exports.runGuest = runGuest;
7
8
  /**
8
9
  * What runs inside the agent container: one Telegram turn whose provider is served by the host over the container's
@@ -11,9 +12,22 @@ exports.runGuest = runGuest;
11
12
  * host builds the scored observation from its own sources and uses this result only for the replies and their order.
12
13
  */
13
14
  const node_fs_1 = __importDefault(require("node:fs"));
15
+ const node_path_1 = __importDefault(require("node:path"));
14
16
  const identity_1 = require("../../heart/identity");
15
17
  const runtime_1 = require("../../nerves/runtime");
16
18
  const provider_proxy_1 = require("../transport/provider-proxy");
19
+ /**
20
+ * The one bundle the sandbox mounted in the bundles folder (`$HOME/AgentBundles`, as `getAgentBundlesRoot()` gives
21
+ * it), so a guest needs no agent name of its own and its command line stays the same for every agent. Every guest
22
+ * entry other than the Telegram one, which takes `--agent`, finds its bundle this way. It lives here because the
23
+ * agent image keeps only this file of the sandbox's. Throws if there is no bundle, or more than one.
24
+ */
25
+ function mountedAgentRoot(bundlesRoot, list = (dir) => node_fs_1.default.readdirSync(dir)) {
26
+ const bundles = list(bundlesRoot).filter((name) => name.endsWith(".ouro")).sort();
27
+ if (bundles.length !== 1)
28
+ throw new Error(`expected one agent bundle in ${bundlesRoot}, found ${bundles.length}`);
29
+ return node_path_1.default.join(bundlesRoot, bundles[0]);
30
+ }
17
31
  function readTurnFile(file) {
18
32
  const value = JSON.parse(node_fs_1.default.readFileSync(file, "utf8"));
19
33
  if (!Array.isArray(value.prefix) || typeof value.userText !== "string")
@@ -27,7 +41,7 @@ async function runGuest(input) {
27
41
  try {
28
42
  const turn = readTurnFile(input.turnFile);
29
43
  const providerRuntime = await (0, provider_proxy_1.createProxyRuntime)(channel);
30
- const result = await input.runTurn({ agentRoot: (0, identity_1.getAgentRoot)("sanctuary"), prefix: turn.prefix, userText: turn.userText, providerRuntime });
44
+ const result = await input.runTurn({ agentRoot: input.agentRoot ?? (0, identity_1.getAgentRoot)("sanctuary"), prefix: turn.prefix, userText: turn.userText, providerRuntime });
31
45
  outcome = { ok: true, result };
32
46
  (0, runtime_1.emitNervesEvent)({ component: "eval", event: "eval.guest_end", message: "sandbox guest finished its turn", meta: { outcome: result.outcome } });
33
47
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1484",
3
+ "version": "0.1.0-alpha.1486",
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.1484",
9
+ "version": "0.1.0-alpha.1486",
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.1484",
3
+ "version": "0.1.0-alpha.1486",
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": {