@ouro.bot/cli 0.1.0-alpha.994 → 0.1.0-alpha.996
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 +16 -0
- package/deploy/unraid/sanctuary-replay-gate.mjs +50 -1
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
- package/deploy/unraid/sanctuary.xml +1 -1
- package/dist/heart/daemon/runtime-logging.js +3 -2
- package/dist/heart/shelf-claims.js +5 -1
- package/dist/repertoire/tools-files.js +29 -10
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/changelog.json
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
|
|
3
3
|
"versions": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.1.0-alpha.996",
|
|
6
|
+
"changes": [
|
|
7
|
+
"A grep or glob of your whole home leaves out state/ (the runtime's own mail, sessions and logs) and says so at the end; pass path or cwd \"state\" to search it.",
|
|
8
|
+
"When grep stops at 100 matches it says how many there were in all (\"100 of 41,000 matches shown\"), so a capped search never reads as an absent fact.",
|
|
9
|
+
"The release gate now asks the Butler about his own home: he must list it and read his TACIT, and write nothing."
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"version": "0.1.0-alpha.995",
|
|
14
|
+
"changes": [
|
|
15
|
+
"The release gate removes the files its own run created before sync resumes, so test residue never reaches the agent's repo.",
|
|
16
|
+
"A reply that says the library has it without naming a title is backed when this turn's lookup found something on the shelf; no false \"haven't checked\" note goes in front of it.",
|
|
17
|
+
"A2A turns keep their info-level log, so a peer turn's sync timing is on record."
|
|
18
|
+
]
|
|
19
|
+
},
|
|
4
20
|
{
|
|
5
21
|
"version": "0.1.0-alpha.994",
|
|
6
22
|
"changes": [
|
|
@@ -589,7 +589,7 @@ export const CASES = [
|
|
|
589
589
|
const deflections = findHedges(text, TORRENT_DEFLECTIONS)
|
|
590
590
|
return [
|
|
591
591
|
check("he searched or requested it (media_search or media_request)", callsNamed(trace, /^media_(search|request)$/).length > 0, `${trace.length} tool calls`),
|
|
592
|
-
check("the reply names the Chef Show", /chef show/i.test(text)),
|
|
592
|
+
check("the reply names the Chef Show or the season asked for", /chef show|\bseason (1|one)\b|\bs0?1\b/i.test(text)),
|
|
593
593
|
check("the reply states an outcome (on the shelf, requested, grabbing, downloading, queued, ready, in the library or on Jellyfin)", MEDIA_OUTCOME.test(text), text.slice(0, 120)),
|
|
594
594
|
check("the reply carries no lecture, refusal or hedge", hedges.length === 0, hedges.join(" | ")),
|
|
595
595
|
check("the reply doesn't refuse or deflect the torrent the owner named", deflections.length === 0, deflections.join(" | ")),
|
|
@@ -652,6 +652,26 @@ export const CASES = [
|
|
|
652
652
|
]
|
|
653
653
|
},
|
|
654
654
|
},
|
|
655
|
+
{
|
|
656
|
+
// 0.1.0-alpha.994: every agent wakes with a home kit. He looks around his own home with ls and reads his own TACIT with
|
|
657
|
+
// read_file, by home-relative paths, and answers from what he saw. Read-only, so the run leaves nothing behind.
|
|
658
|
+
id: "home-kit",
|
|
659
|
+
words: "quick one about your own home, nothing online: what's at the top level of it, and how many lines long is your psyche/TACIT.md?",
|
|
660
|
+
sender: "principal",
|
|
661
|
+
delegated: false,
|
|
662
|
+
readback: ({ trace, reply, said }) => {
|
|
663
|
+
const text = String(said || reply || "")
|
|
664
|
+
const reads = trace.filter((entry) => entry.name === "read_file" && WROTE_TACIT.test(filePathOf(entry.args)))
|
|
665
|
+
const writes = trace.filter((entry) => /^(write_file|edit_file)$/.test(entry.name))
|
|
666
|
+
return [
|
|
667
|
+
check("he listed his home (ls)", callsNamed(trace, /^ls$/).length > 0, `${trace.length} tool calls`),
|
|
668
|
+
check("he read psyche/TACIT.md (read_file)", reads.length > 0),
|
|
669
|
+
check("the reply names what is at the top of his home (psyche)", /\bpsyche\b/i.test(text)),
|
|
670
|
+
check("the reply gives a line count", /\b\d+\s*lines?\b/i.test(text)),
|
|
671
|
+
check("nothing in his home was written", writes.length === 0, writes.map((entry) => filePathOf(entry.args)).join(", ")),
|
|
672
|
+
]
|
|
673
|
+
},
|
|
674
|
+
},
|
|
655
675
|
{
|
|
656
676
|
// 2026-10-11: the owner handed his chat to his wife and asked the Butler to say hi and interview her. It sent a title with no
|
|
657
677
|
// greeting, and later its own note about the brevity rules. A handoff gets a greeting and a question. The words name no
|
|
@@ -1045,6 +1065,12 @@ export async function closeSyncBracket(sync, head, { touched, planted, snapshotE
|
|
|
1045
1065
|
return { id: "no-sync-residue", status: checks.every((entry) => entry.ok) ? "pass" : "fail", checks }
|
|
1046
1066
|
}
|
|
1047
1067
|
|
|
1068
|
+
/** The untracked paths that did not exist before the run: the gate made them, so they go before sync can commit them. */
|
|
1069
|
+
export function newDuringRun(before, after) {
|
|
1070
|
+
if (!before.ok || !after.ok) return []
|
|
1071
|
+
return Object.keys(after.files).filter((file) => !(file in before.files)).sort()
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1048
1074
|
/** The path of each `git status --porcelain` line (the new name of a rename), unquoted. */
|
|
1049
1075
|
export function porcelainPaths(status) {
|
|
1050
1076
|
return String(status ?? "").split("\n").filter((line) => line.length > 3).map((line) => {
|
|
@@ -1129,6 +1155,7 @@ export async function syncLatencyResult(host) {
|
|
|
1129
1155
|
*/
|
|
1130
1156
|
export async function runSuite(host, options = {}) {
|
|
1131
1157
|
const sync = host.sync
|
|
1158
|
+
const log = options.log ?? console.error
|
|
1132
1159
|
if (!sync) return runCases(host, options)
|
|
1133
1160
|
validateCases(options)
|
|
1134
1161
|
await host.waitReady?.()
|
|
@@ -1145,6 +1172,13 @@ export async function runSuite(host, options = {}) {
|
|
|
1145
1172
|
suite = await runCases(host, { ...options, ready: true })
|
|
1146
1173
|
// Read while sync is still paused, so nothing the run created has been committed yet.
|
|
1147
1174
|
untrackedAfter = untrackedSnapshot(sync)
|
|
1175
|
+
// A replay friend's record is restored, not removed; every other new file is the run's, and sync must never commit it.
|
|
1176
|
+
const replayFriendFiles = [host.friends?.principal, host.friends?.stranger, host.friends?.escalation].filter(Boolean).map((id) => `friends/${id}.json`)
|
|
1177
|
+
const made = newDuringRun(bracket.untracked, untrackedAfter).filter((file) => !replayFriendFiles.includes(file))
|
|
1178
|
+
if (made.length) {
|
|
1179
|
+
sync.removeUntracked(made)
|
|
1180
|
+
log(`removed ${made.length} ${made.length === 1 ? "file" : "files"} the run created before sync resumed: ${made.join(", ")}`)
|
|
1181
|
+
}
|
|
1148
1182
|
}
|
|
1149
1183
|
} finally {
|
|
1150
1184
|
// The pause never outlives the run. A crash that skips this leaves a marker that expires on its own.
|
|
@@ -1406,6 +1440,12 @@ export function selfTestFixtures() {
|
|
|
1406
1440
|
pass: { trace: [], reply: "A movie is one film. A series has seasons of episodes.", before: emptyObservation(), after: emptyObservation() },
|
|
1407
1441
|
fail: { trace: [], reply: `## Difference\n**Movies**: ${"long ".repeat(130)}\nWant me to go on?`, before: emptyObservation(), after: emptyObservation() },
|
|
1408
1442
|
},
|
|
1443
|
+
"home-kit": {
|
|
1444
|
+
pass: { trace: [call("1", "ls", {}, "arc/\nfriends/\npsyche/\nstate/"), call("2", "read_file", { path: "psyche/TACIT.md" }, "rule one\nrule two")], reply: "arc, friends, psyche and state are up top. TACIT is 2 lines.", before: emptyObservation(), after: emptyObservation() },
|
|
1445
|
+
// Answering from memory, with no look around the home.
|
|
1446
|
+
fail: { trace: [], reply: "probably psyche and some config; TACIT is a few dozen lines.", before: emptyObservation(), after: emptyObservation() },
|
|
1447
|
+
failWrote: { trace: [call("1", "ls", {}, "psyche/"), call("2", "read_file", { path: "psyche/TACIT.md" }, "x"), call("3", "write_file", { path: "notes/home.md", content: "x" }, "ok")], reply: "psyche is up top; TACIT is 1 line.", before: emptyObservation(), after: emptyObservation() },
|
|
1448
|
+
},
|
|
1409
1449
|
"handoff-greeting": {
|
|
1410
1450
|
pass: { trace: [], reply: "hi! silly and cosy, or loud and dumb-fun tonight?", before: emptyObservation(), after: emptyObservation() },
|
|
1411
1451
|
failInventedName: { trace: [], reply: "hi Morgan! what are you in the mood for?", before: emptyObservation(), after: emptyObservation() },
|
|
@@ -1619,6 +1659,15 @@ export function makeSyncHost({ bundle, backupDir = DEFAULT_BACKUP_DIR, exec = sh
|
|
|
1619
1659
|
writeFileAsRoot(state, "sync-paused", `${JSON.stringify({ startedAt: startedAt.toISOString(), expiresAt: new Date(startedAt.getTime() + ms).toISOString() })}\n`, 0o644, { uid: owner.uid, gid: owner.gid }, "state")
|
|
1620
1660
|
},
|
|
1621
1661
|
resume() { rmSync(marker, { force: true }) },
|
|
1662
|
+
/** Removes files git reports as untracked, each a plain relative path inside the bundle; a link is removed, never followed. */
|
|
1663
|
+
removeUntracked(paths) {
|
|
1664
|
+
for (const file of paths) {
|
|
1665
|
+
if (path.isAbsolute(file) || file.split("/").includes("..")) throw new Error(`refusing to remove ${file}: not a path inside the bundle`)
|
|
1666
|
+
const target = path.join(bundle, file)
|
|
1667
|
+
const stat = lstatOrNull(target)
|
|
1668
|
+
if (stat && !stat.isDirectory()) rmSync(target, { force: true })
|
|
1669
|
+
}
|
|
1670
|
+
},
|
|
1622
1671
|
/** Waits until no live process holds sync's lock. A lock whose holder is dead is stale, as `src/heart/sync-lock.ts` judges it. */
|
|
1623
1672
|
async waitLockFree(waitMs) {
|
|
1624
1673
|
const lock = path.join(bundle, ".git", "ouro-sync.lock")
|
|
@@ -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.996</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
|
@@ -52,13 +52,14 @@ function defaultLoggingForProcess(processName) {
|
|
|
52
52
|
sinks: ["ndjson"],
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
// A2A turns are first-class conversations (peers, the release gate): their info-level record, sync timing included, is kept.
|
|
56
|
+
if (processName === "telegram" || processName === "teams" || processName === "a2a") {
|
|
56
57
|
return {
|
|
57
58
|
level: "info",
|
|
58
59
|
sinks: ["terminal", "ndjson"],
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
|
-
if (processName === "bluebubbles" || processName === "mail" || processName === "voice" || processName === "
|
|
62
|
+
if (processName === "bluebubbles" || processName === "mail" || processName === "voice" || processName === "shepherd") {
|
|
62
63
|
return {
|
|
63
64
|
level: "warn",
|
|
64
65
|
sinks: ["terminal", "ndjson"],
|
|
@@ -57,7 +57,11 @@ function unbackedClaim(answer, tools) {
|
|
|
57
57
|
const said = normalize(clauses.filter((clause) => !SHELF_CLAIM.test(clause) || !denied(clause)).join(" "));
|
|
58
58
|
const { onShelf, offShelf } = titlesFrom(tools);
|
|
59
59
|
const missing = offShelf.filter((title) => said.includes(title.key)).map((title) => title.name);
|
|
60
|
-
|
|
60
|
+
if (missing.length > 0)
|
|
61
|
+
return { missing };
|
|
62
|
+
// "It's in the library" names no title: it is backed when this turn's lookup found something on the shelf.
|
|
63
|
+
const namesAny = [...onShelf, ...offShelf].some((title) => said.includes(title.key));
|
|
64
|
+
return onShelf.some((title) => said.includes(title.key)) || (!namesAny && onShelf.length > 0) ? null : { missing };
|
|
61
65
|
}
|
|
62
66
|
/** The correction for a reply that says something is on the shelf without this turn's lookup finding it there, or null. */
|
|
63
67
|
function shelfClaimError(answer, tools) {
|
|
@@ -71,6 +71,14 @@ function resolveLocalToolPath(targetPath, ctx) {
|
|
|
71
71
|
function homeOf(ctx) {
|
|
72
72
|
return ctx?.agentRoot ?? (0, identity_1.getAgentRoot)();
|
|
73
73
|
}
|
|
74
|
+
/** state/ holds the runtime's own data (mail, sessions, logs, saved tool output): a search of the whole home leaves it out and says so. */
|
|
75
|
+
const RUNTIME_DATA_DIR = "state";
|
|
76
|
+
function searchesWholeHome(target, home) {
|
|
77
|
+
return path.resolve(target) === path.resolve(home) && fs.statSync(path.join(home, RUNTIME_DATA_DIR), { throwIfNoEntry: false })?.isDirectory() === true;
|
|
78
|
+
}
|
|
79
|
+
function skippedStateNote(param) {
|
|
80
|
+
return `[skipped state/, the runtime's own data; pass ${param} "state" to search it]`;
|
|
81
|
+
}
|
|
74
82
|
/** Keep the whole lines that fit the line and character caps. A first line over the character cap is cut to it. */
|
|
75
83
|
function fitLines(lines) {
|
|
76
84
|
const kept = [];
|
|
@@ -296,7 +304,7 @@ exports.fileToolDefinitions = [
|
|
|
296
304
|
type: "function",
|
|
297
305
|
function: {
|
|
298
306
|
name: "glob",
|
|
299
|
-
description: "Find files in your home matching a glob pattern, sorted. Skips .git and
|
|
307
|
+
description: "Find files in your home matching a glob pattern, sorted. Skips .git, node_modules and, from the top of your home, state/, and shows at most 500 matches.",
|
|
300
308
|
parameters: {
|
|
301
309
|
type: "object",
|
|
302
310
|
properties: {
|
|
@@ -309,10 +317,14 @@ exports.fileToolDefinitions = [
|
|
|
309
317
|
},
|
|
310
318
|
handler: (a, ctx) => {
|
|
311
319
|
const cwd = a.cwd ? resolveLocalToolPath(a.cwd, ctx) : homeOf(ctx);
|
|
312
|
-
|
|
320
|
+
// A cwd the caller chose is searched as asked; only the default (the whole home) leaves state/ out.
|
|
321
|
+
const skipsState = !a.cwd && searchesWholeHome(cwd, cwd);
|
|
322
|
+
const ignore = [...tool_limits_1.SKIP_DIRS.map((d) => `**/${d}/**`), ...(skipsState ? [`${RUNTIME_DATA_DIR}/**`] : [])];
|
|
323
|
+
const matches = fg.globSync(a.pattern, { cwd, dot: true, ignore }).sort();
|
|
324
|
+
const note = skipsState ? [skippedStateNote("cwd")] : [];
|
|
313
325
|
if (matches.length <= LIST_CAP)
|
|
314
|
-
return matches.join("\n");
|
|
315
|
-
return [...matches.slice(0, LIST_CAP), (0, tool_limits_1.cutNotice)("glob", `[${LIST_CAP} of ${matches.length} matches shown; narrow the pattern or cwd]`, { pattern: a.pattern })].join("\n");
|
|
326
|
+
return [...matches, ...note].join("\n");
|
|
327
|
+
return [...matches.slice(0, LIST_CAP), (0, tool_limits_1.cutNotice)("glob", `[${LIST_CAP} of ${matches.length} matches shown; narrow the pattern or cwd]`, { pattern: a.pattern }), ...note].join("\n");
|
|
316
328
|
},
|
|
317
329
|
summaryKeys: ["pattern", "cwd"],
|
|
318
330
|
},
|
|
@@ -321,7 +333,7 @@ exports.fileToolDefinitions = [
|
|
|
321
333
|
type: "function",
|
|
322
334
|
function: {
|
|
323
335
|
name: "grep",
|
|
324
|
-
description: "Search file contents in your home for a regex, with file path and line numbers; skips .git, node_modules
|
|
336
|
+
description: "Search file contents in your home for a regex, with file path and line numbers; skips .git, node_modules, binary files and, from the top of your home, state/. Shows at most 100 matches and says how many there were in all.",
|
|
325
337
|
parameters: {
|
|
326
338
|
type: "object",
|
|
327
339
|
properties: {
|
|
@@ -344,8 +356,11 @@ exports.fileToolDefinitions = [
|
|
|
344
356
|
const filesOnly = Boolean(a.files_only);
|
|
345
357
|
let matchCount = 0;
|
|
346
358
|
let stopped = false;
|
|
359
|
+
let totalMatches = 0;
|
|
347
360
|
const clipLine = (line) => line.length > GREP_MAX_LINE_CHARS ? `${line.slice(0, GREP_MAX_LINE_CHARS - 3)}...` : line;
|
|
348
361
|
const home = homeOf(ctx);
|
|
362
|
+
const skipsState = searchesWholeHome(targetPath, home);
|
|
363
|
+
const stateDir = path.join(home, RUNTIME_DATA_DIR);
|
|
349
364
|
// Paths inside the home are shown relative to it.
|
|
350
365
|
const shown = (filePath) => {
|
|
351
366
|
const relative = path.relative(home, filePath);
|
|
@@ -366,9 +381,13 @@ exports.fileToolDefinitions = [
|
|
|
366
381
|
for (let i = 0; i < lines.length; i++) {
|
|
367
382
|
if (!regex.test(lines[i]))
|
|
368
383
|
continue;
|
|
384
|
+
// Past the cap, matches are still counted so the notice can say how much was left unseen.
|
|
385
|
+
totalMatches++;
|
|
369
386
|
if (matchCount >= GREP_MAX_MATCHES) {
|
|
370
387
|
stopped = true;
|
|
371
|
-
|
|
388
|
+
if (filesOnly)
|
|
389
|
+
break;
|
|
390
|
+
continue;
|
|
372
391
|
}
|
|
373
392
|
matchCount++;
|
|
374
393
|
matchIndices.add(i);
|
|
@@ -402,7 +421,7 @@ exports.fileToolDefinitions = [
|
|
|
402
421
|
for (const entry of entries) {
|
|
403
422
|
const fullPath = path.join(dir, entry.name);
|
|
404
423
|
if (entry.isDirectory()) {
|
|
405
|
-
if (!tool_limits_1.SKIP_DIRS.includes(entry.name))
|
|
424
|
+
if (!tool_limits_1.SKIP_DIRS.includes(entry.name) && !(skipsState && fullPath === stateDir))
|
|
406
425
|
walk(fullPath);
|
|
407
426
|
}
|
|
408
427
|
else if (entry.isFile()) {
|
|
@@ -432,11 +451,11 @@ exports.fileToolDefinitions = [
|
|
|
432
451
|
const results = [];
|
|
433
452
|
for (const file of files) {
|
|
434
453
|
results.push(...searchFile(file));
|
|
435
|
-
if (stopped)
|
|
436
|
-
break;
|
|
437
454
|
}
|
|
438
455
|
if (stopped)
|
|
439
|
-
results.push((0, tool_limits_1.cutNotice)("grep", `[
|
|
456
|
+
results.push((0, tool_limits_1.cutNotice)("grep", `[${GREP_MAX_MATCHES} of ${totalMatches} ${filesOnly ? "files" : "matches"} shown; narrow the pattern or path]`, { pattern: a.pattern }));
|
|
457
|
+
if (skipsState)
|
|
458
|
+
results.push(skippedStateNote("path"));
|
|
440
459
|
return results.join("\n");
|
|
441
460
|
},
|
|
442
461
|
summaryKeys: ["pattern", "path", "include"],
|
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.996",
|
|
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.996",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sdk": "^0.78.0",
|
|
12
12
|
"@azure/identity": "^4.13.0",
|