@ouro.bot/cli 0.1.0-alpha.1484 → 0.1.0-alpha.1485
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 +6 -0
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
- package/deploy/unraid/sanctuary.xml +1 -1
- package/dist/eval/interviews/latch.js +14 -5
- package/dist/eval/interviews/rewrite.js +49 -0
- package/dist/eval/interviews/runner.js +4 -3
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/changelog.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
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.1485",
|
|
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
|
+
]
|
|
9
|
+
},
|
|
4
10
|
{
|
|
5
11
|
"version": "0.1.0-alpha.1484",
|
|
6
12
|
"changes": [
|
|
@@ -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.
|
|
4
|
+
<Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1485</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
|
@@ -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
|
-
/**
|
|
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({
|
|
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 (
|
|
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
|
-
|
|
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 }) });
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ouro.bot/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.1485",
|
|
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.
|
|
9
|
+
"version": "0.1.0-alpha.1485",
|
|
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.
|
|
3
|
+
"version": "0.1.0-alpha.1485",
|
|
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": {
|