@ouro.bot/cli 0.1.0-alpha.1440 → 0.1.0-alpha.1442
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 +13 -0
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
- package/deploy/unraid/sanctuary.xml +1 -1
- package/dist/eval/sandbox/docker.js +26 -9
- package/dist/eval/sandbox/oracle.js +2 -1
- package/dist/heart/daemon/sanctuary-authority-root-lifecycle.js +16 -2
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/changelog.json
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
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.1442",
|
|
6
|
+
"changes": [
|
|
7
|
+
"A Butler upgrade or rollback no longer fails when a container on the host stops while the upgrade is checking for other programs reading the Butler's bundle. A container that has stopped can't be one of them, so it is skipped. One that is still running but can't be read still stops the upgrade.",
|
|
8
|
+
"`npm run butler:ship` refuses to start the gate or the upgrade while eval containers (`ouro-eval-*`) are running on the host, and says which ones. Nothing on the host has changed when it refuses.",
|
|
9
|
+
"An eval run's sandbox no longer shares names with the Butler's tooling, and it stays off the Butler's host.",
|
|
10
|
+
"Its containers, network and folder are named `eval-sandbox-<run>`, no longer `ouro-eval-<run>`.",
|
|
11
|
+
"Every container it starts carries the labels `ouro.eval=1` and `ouro.eval.run=<run>`, and so does its network. That includes the fixture, TLS and hand-back helpers. The books oracle's container carries `ouro.eval=1`. CI's clean-up step now removes containers and networks by that label.",
|
|
12
|
+
"A host that has any of the live Butler's containers (`ouro-butler`, `ouro-butler-staging` or `ouro-butler-rollback`) is refused before anything is created, unless the caller holds a host lock that the Butler's upgrade and rollback honour. Nothing provides that lock yet, so for now eval runs stay off the Butler's host.",
|
|
13
|
+
"Background: on 2026-11-23 a vanishing eval container broke the Butler's upgrade and its rollback (#1760).",
|
|
14
|
+
"butler:ship's check for running eval containers (#1764) now finds them by the `ouro.eval=1` label as well as by the old `ouro-eval-` names, so the rename does not hide them from it."
|
|
15
|
+
]
|
|
16
|
+
},
|
|
4
17
|
{
|
|
5
18
|
"version": "0.1.0-alpha.1440",
|
|
6
19
|
"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.1442</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
|
@@ -3,7 +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.WRITABLE = exports.POCKETBOOK_ADDRESS = exports.LIBGEN_MIRRORS = exports.HOUSEHOLD_IMAGE = exports.SANDBOX_IMAGE = void 0;
|
|
6
|
+
exports.WRITABLE = exports.POCKETBOOK_ADDRESS = exports.LIBGEN_MIRRORS = exports.BUTLER_CONTAINERS = exports.EVAL_LABEL = exports.EVAL_RUN_PREFIX = exports.HOUSEHOLD_IMAGE = exports.SANDBOX_IMAGE = void 0;
|
|
7
7
|
exports.dockerCli = dockerCli;
|
|
8
8
|
exports.buildSandboxImage = buildSandboxImage;
|
|
9
9
|
exports.splitTurns = splitTurns;
|
|
@@ -29,7 +29,12 @@ exports.runSandboxed = runSandboxed;
|
|
|
29
29
|
* which ends every process the turn started, then the household, and only then reads the household's state file and
|
|
30
30
|
* hashes the files that appeared in the writable mounts. A run whose files cannot be read back within the limits ends
|
|
31
31
|
* as a sandbox error, which fails it. The containers, the network and the run's folder are removed afterwards,
|
|
32
|
-
* whatever happened. Every name the run creates starts with `ouro
|
|
32
|
+
* whatever happened. Every name the run creates starts with `eval-sandbox-`, outside the `ouro-` names the Butler's
|
|
33
|
+
* tooling owns, and every container and network it creates carries the labels `ouro.eval=1` and `ouro.eval.run=<run>`.
|
|
34
|
+
*
|
|
35
|
+
* It refuses to run on a host that has any of the live Butler's containers unless the caller holds a host lock
|
|
36
|
+
* that the Butler's lifecycle honours: on 2026-11-23 an eval container vanishing mid-upgrade broke the Butler's
|
|
37
|
+
* upgrade and its rollback on the host they shared (#1760).
|
|
33
38
|
*/
|
|
34
39
|
const node_child_process_1 = require("node:child_process");
|
|
35
40
|
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
@@ -44,6 +49,12 @@ const projection_1 = require("./projection");
|
|
|
44
49
|
const readback_1 = require("./readback");
|
|
45
50
|
exports.SANDBOX_IMAGE = "ouro-eval-sandbox:local";
|
|
46
51
|
exports.HOUSEHOLD_IMAGE = "ouro-eval-household:local";
|
|
52
|
+
/** What every container, network and folder a sandboxed run creates is named after. */
|
|
53
|
+
exports.EVAL_RUN_PREFIX = "eval-sandbox-";
|
|
54
|
+
/** The label on everything an eval run creates, so other tooling on the host can tell it is not its own. */
|
|
55
|
+
exports.EVAL_LABEL = "ouro.eval=1";
|
|
56
|
+
/** The live Butler's containers (sanctuary-deployment-target.mjs CANONICAL_NAMES); a host that has any of them is the Butler's. */
|
|
57
|
+
exports.BUTLER_CONTAINERS = "^/?ouro-butler(-staging|-rollback)?$";
|
|
47
58
|
exports.LIBGEN_MIRRORS = ["libgen.li", "libgen.bz", "libgen.gl", "libgen.la", "libgen.vg"];
|
|
48
59
|
exports.POCKETBOOK_ADDRESS = "pocketbook@example.invalid";
|
|
49
60
|
const ALIASES = ["calibre-web", "smtp", ...exports.LIBGEN_MIRRORS];
|
|
@@ -182,12 +193,18 @@ function splitTurns(observation, turns) {
|
|
|
182
193
|
async function runSandboxed(input) {
|
|
183
194
|
const docker = input.docker ?? dockerCli();
|
|
184
195
|
const images = input.images ?? { agent: exports.SANDBOX_IMAGE, household: exports.HOUSEHOLD_IMAGE };
|
|
185
|
-
const runId =
|
|
196
|
+
const runId = `${exports.EVAL_RUN_PREFIX}${node_crypto_1.default.randomBytes(4).toString("hex")}`;
|
|
197
|
+
const runLabels = ["--label", exports.EVAL_LABEL, "--label", `ouro.eval.run=${runId}`];
|
|
186
198
|
const last = input.case.prefix.at(-1);
|
|
187
199
|
if (last?.role !== "user")
|
|
188
200
|
throw new Error(`case ${input.case.id}: the prefix must end with the owner's message`);
|
|
201
|
+
// Docker matches the filter against the name with its leading slash; any container it lists makes this the Butler's host.
|
|
202
|
+
const butler = (await docker.run(["ps", "--all", "--filter", `name=${exports.BUTLER_CONTAINERS}`, "--format", "{{.Names}}"])).trim();
|
|
203
|
+
if (butler !== "" && !(await input.hostLock?.held())) {
|
|
204
|
+
throw new Error(`refusing to run the eval sandbox on this host: it runs the live Butler (${butler.split("\n").join(", ")}), and no host lock that the Butler's upgrade and rollback honour is held`);
|
|
205
|
+
}
|
|
189
206
|
(0, runtime_1.emitNervesEvent)({ component: "eval", event: "eval.sandbox_run_start", message: "starting a sandboxed eval run", meta: { caseId: input.case.id, runId } });
|
|
190
|
-
const work = node_fs_1.default.mkdtempSync(node_path_1.default.join(input.workRoot ?? node_os_1.default.tmpdir(),
|
|
207
|
+
const work = node_fs_1.default.mkdtempSync(node_path_1.default.join(input.workRoot ?? node_os_1.default.tmpdir(), exports.EVAL_RUN_PREFIX));
|
|
191
208
|
node_fs_1.default.chmodSync(work, 0o700);
|
|
192
209
|
const bundle = node_path_1.default.join(work, "bundle");
|
|
193
210
|
const fixtures = node_path_1.default.join(work, "fixtures");
|
|
@@ -203,7 +220,7 @@ async function runSandboxed(input) {
|
|
|
203
220
|
const reclaim = async () => {
|
|
204
221
|
reclaimed = true;
|
|
205
222
|
await docker.run([
|
|
206
|
-
"run", "--rm", "--network", "none", "--log-driver", "none", "--cap-drop", "ALL", "--cap-add", "CHOWN", "--cap-add", "FOWNER", "--cap-add", "DAC_OVERRIDE",
|
|
223
|
+
"run", "--rm", ...runLabels, "--network", "none", "--log-driver", "none", "--cap-drop", "ALL", "--cap-add", "CHOWN", "--cap-add", "FOWNER", "--cap-add", "DAC_OVERRIDE",
|
|
207
224
|
"--user", "0:0", "-v", `${work}:/work`, images.household, "sh", "-c", `chown -R ${self} /work && chmod -R u+rwX /work`,
|
|
208
225
|
]);
|
|
209
226
|
};
|
|
@@ -212,7 +229,7 @@ async function runSandboxed(input) {
|
|
|
212
229
|
node_fs_1.default.writeFileSync(node_path_1.default.join(bundle, "books/credentials.json"), `${JSON.stringify(booksSettings(), null, 1)}\n`);
|
|
213
230
|
for (const dir of [fixtures, tls, household])
|
|
214
231
|
node_fs_1.default.mkdirSync(dir);
|
|
215
|
-
const helper = ["run", "--rm", "--network", "none", "--user", self, ...HARDENING];
|
|
232
|
+
const helper = ["run", "--rm", ...runLabels, "--network", "none", "--user", self, ...HARDENING];
|
|
216
233
|
const labels = JSON.parse(await docker.run([...helper, "-v", `${fixtures}:/out`, images.household, "python3", "/opt/eval/fakes/fixtures.py", "build", "/out"]));
|
|
217
234
|
// A seeded file sits where an earlier `books get` would have left it, so its place does not mark it as seeded.
|
|
218
235
|
const earlier = Math.floor(Date.now() / 1000) - 86_400;
|
|
@@ -234,13 +251,13 @@ async function runSandboxed(input) {
|
|
|
234
251
|
node_fs_1.default.chmodSync(household, 0o777);
|
|
235
252
|
for (const entry of exports.WRITABLE)
|
|
236
253
|
openUp(node_path_1.default.join(bundle, entry));
|
|
237
|
-
await docker.run(["network", "create", "--internal",
|
|
254
|
+
await docker.run(["network", "create", "--internal", ...runLabels, runId]);
|
|
238
255
|
networkMade = true;
|
|
239
256
|
started.push(sidecarName);
|
|
240
257
|
// From here a container's user may own files in the run's folder.
|
|
241
258
|
reclaimed = false;
|
|
242
259
|
const sidecar = docker.start([
|
|
243
|
-
"run", "--rm", "--name", sidecarName, "--network", runId, ...ALIASES.flatMap((alias) => ["--network-alias", alias]),
|
|
260
|
+
"run", "--rm", "--name", sidecarName, ...runLabels, "--network", runId, ...ALIASES.flatMap((alias) => ["--network-alias", alias]),
|
|
244
261
|
"--user", "10002:10002", ...HARDENING, "--tmpfs", "/tmp:rw,size=64m",
|
|
245
262
|
"-v", `${fixtures}:/eval/fixtures:ro`, "-v", `${seedFile}:/eval/seed.json:ro`,
|
|
246
263
|
"-v", `${tls}/server.pem:/eval/tls/server.pem:ro`, "-v", `${tls}/server.key:/eval/tls/server.key:ro`, "-v", `${household}:/eval/state`,
|
|
@@ -251,7 +268,7 @@ async function runSandboxed(input) {
|
|
|
251
268
|
const before = (0, readback_1.snapshotFiles)(bundle, exports.WRITABLE);
|
|
252
269
|
started.push(agentName);
|
|
253
270
|
const agent = docker.start([
|
|
254
|
-
"run", "-i", "--rm", "--name", agentName, "--network", runId, "--user", "10001:10001", ...HARDENING,
|
|
271
|
+
"run", "-i", "--rm", "--name", agentName, ...runLabels, "--network", runId, "--user", "10001:10001", ...HARDENING,
|
|
255
272
|
"--tmpfs", "/tmp:rw,mode=1777,size=256m", "--tmpfs", "/home/ouro:rw,uid=10001,gid=10001,mode=0700,size=256m", "--env", "HOME=/home/ouro",
|
|
256
273
|
"-v", `${bundle}:${BUNDLE}:ro`, ...exports.WRITABLE.flatMap((entry) => ["-v", `${node_path_1.default.join(bundle, entry)}:${BUNDLE}/${entry}`]),
|
|
257
274
|
"-v", `${tls}/ca.pem:/etc/ssl/certs/ca-certificates.crt:ro`, "-v", `${turnFile}:/eval/turn.json:ro`,
|
|
@@ -8,12 +8,13 @@ exports.dockerOracle = dockerOracle;
|
|
|
8
8
|
* checker that cannot run, or answers anything but true or false, grades the file as not readable.
|
|
9
9
|
*/
|
|
10
10
|
const runtime_1 = require("../../nerves/runtime");
|
|
11
|
+
const docker_1 = require("./docker");
|
|
11
12
|
const CHECK = "import json, sys; sys.path.insert(0, '/oracle'); from booklib import quality; print(json.dumps(bool(quality.check('/book.epub')['ok'])))";
|
|
12
13
|
function dockerOracle(input) {
|
|
13
14
|
return async (file) => {
|
|
14
15
|
try {
|
|
15
16
|
const out = await input.docker.run([
|
|
16
|
-
"run", "--rm", "--network", "none", "--log-driver", "none", "--read-only", "--cap-drop", "ALL", "--security-opt", "no-new-privileges",
|
|
17
|
+
"run", "--rm", "--label", docker_1.EVAL_LABEL, "--network", "none", "--log-driver", "none", "--read-only", "--cap-drop", "ALL", "--security-opt", "no-new-privileges",
|
|
17
18
|
"--tmpfs", "/tmp:rw,size=64m", "-v", `${input.booksLib}:/oracle:ro`, "-v", `${file}:/book.epub:ro`, input.image, "python3", "-I", "-c", CHECK,
|
|
18
19
|
]);
|
|
19
20
|
const verdict = out.trim();
|
|
@@ -1213,12 +1213,26 @@ class SanctuaryAuthorityRootLifecycle {
|
|
|
1213
1213
|
const names = this.#docker(["ps", "-a", "--format", "{{json .}}"]).trim().split("\n").filter(Boolean).map((line) => String(JSON.parse(line).Names));
|
|
1214
1214
|
return names.filter((name) => ["ouro-butler", "ouro-butler-rollback"].includes(name)).flatMap((name) => JSON.parse(this.#docker(["inspect", name])));
|
|
1215
1215
|
}
|
|
1216
|
+
#runningNames() {
|
|
1217
|
+
return this.#docker(["ps", "--format", "{{json .}}"]).trim().split("\n").filter(Boolean).map((line) => String(JSON.parse(line).Names));
|
|
1218
|
+
}
|
|
1216
1219
|
#assertNoForeignPoller() {
|
|
1217
|
-
const names = this.#
|
|
1220
|
+
const names = this.#runningNames();
|
|
1218
1221
|
for (const name of names) {
|
|
1219
1222
|
if (["ouro-butler", "ouro-butler-rollback"].includes(name))
|
|
1220
1223
|
continue;
|
|
1221
|
-
|
|
1224
|
+
let containers;
|
|
1225
|
+
try {
|
|
1226
|
+
containers = JSON.parse(this.#docker(["inspect", name]));
|
|
1227
|
+
}
|
|
1228
|
+
catch (error) {
|
|
1229
|
+
// A container can stop between the listing and its inspect (eval sandboxes come and go); one no longer
|
|
1230
|
+
// running can't be polling, so it is skipped. One still running that can't be read still fails the step.
|
|
1231
|
+
if (this.#runningNames().includes(name))
|
|
1232
|
+
throw error;
|
|
1233
|
+
(0, runtime_1.emitNervesEvent)({ component: "daemon", event: "daemon.sanctuary_poller_scan_container_gone", message: "skipped a container that stopped during the direct-poller scan", meta: { name } });
|
|
1234
|
+
continue;
|
|
1235
|
+
}
|
|
1222
1236
|
if (containers.some((container) => container.Mounts.some((mount) => mount.Source === BUNDLE || mount.Source === RUNTIME)))
|
|
1223
1237
|
throw new Error("Sanctuary has an unowned possible direct poller");
|
|
1224
1238
|
}
|
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.1442",
|
|
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.1442",
|
|
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.1442",
|
|
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": {
|