@ouro.bot/cli 0.1.0-alpha.1132 → 0.1.0-alpha.1134
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 +12 -0
- package/deploy/unraid/sanctuary-replay-gate.mjs +6 -2
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
- package/deploy/unraid/sanctuary.xml +1 -1
- package/dist/heart/core.js +15 -10
- package/dist/senses/app-sessions/client.js +17 -10
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/changelog.json
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
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.1134",
|
|
6
|
+
"changes": [
|
|
7
|
+
"I now see a session the app calls running but whose history has not grown for half an hour as stuck, so a hung session no longer hides among the working ones."
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"version": "0.1.0-alpha.1133",
|
|
12
|
+
"changes": [
|
|
13
|
+
"My errors come back to me: a rejected or unparseable settle is answered with why, and I correct course instead of the turn failing; my house notes count however I write them."
|
|
14
|
+
]
|
|
15
|
+
},
|
|
4
16
|
{
|
|
5
17
|
"version": "0.1.0-alpha.1132",
|
|
6
18
|
"changes": [
|
|
@@ -352,6 +352,9 @@ const filedWithClaudeCode = (trace) => trace.some((entry) => entry.name === "rep
|
|
|
352
352
|
/** The path a write_file or edit_file call names, or "" when its arguments are not JSON with a string path. */
|
|
353
353
|
const filePathOf = (args) => { try { const parsed = JSON.parse(String(args ?? "")); return typeof parsed?.path === "string" ? parsed.path : "" } catch { return "" } }
|
|
354
354
|
const WROTE_TACIT = /(?:^|\/)psyche\/TACIT\.md$/
|
|
355
|
+
/** A shell command that writes TACIT.md: a redirect, tee, or sed -i onto it. How he writes it is his call; the file is checked separately. */
|
|
356
|
+
const SHELL_WROTE_TACIT = /(?:>>?|\btee\b(?:\s+-a)?)\s*["']?(?:\S*\/)?TACIT\.md\b|\bsed\s+-i\S*\s[^|;&]*TACIT\.md\b/
|
|
357
|
+
const commandOf = (args) => { try { const parsed = JSON.parse(String(args ?? "")); return typeof parsed?.command === "string" ? parsed.command : "" } catch { return "" } }
|
|
355
358
|
// Scoped to media-ask-no-hedge (REPLY_HEDGE_TERMS is pinned by the no-hedge psyche work): a refusal of the torrent, never a
|
|
356
359
|
// plain "no torrent needed", which is right for a title already in the library. Each torrent pattern stays in one sentence.
|
|
357
360
|
const TORRENT_DEFLECTIONS = [
|
|
@@ -571,13 +574,14 @@ export const CASES = [
|
|
|
571
574
|
sender: "principal",
|
|
572
575
|
delegated: false,
|
|
573
576
|
readback: ({ trace, before, after }) => {
|
|
574
|
-
const writes = trace.filter((entry) => /^(write_file|edit_file)$/.test(entry.name) && WROTE_TACIT.test(filePathOf(entry.args)))
|
|
577
|
+
const writes = trace.filter((entry) => (/^(write_file|edit_file)$/.test(entry.name) && WROTE_TACIT.test(filePathOf(entry.args)))
|
|
578
|
+
|| (entry.name === "shell" && SHELL_WROTE_TACIT.test(commandOf(entry.args))))
|
|
575
579
|
// A refused write leaves TACIT as it was, so a TACIT that already mentioned subtitles must also have changed.
|
|
576
580
|
const was = before.tacit?.text ?? null
|
|
577
581
|
const now = after.tacit?.text ?? ""
|
|
578
582
|
const learned = /subtitle/i.test(now) && (!/subtitle/i.test(was ?? "") || was !== now)
|
|
579
583
|
return [
|
|
580
|
-
check("a
|
|
584
|
+
check("a tool call wrote psyche/TACIT.md (write_file, edit_file or a shell write)", writes.length > 0, `${trace.length} tool calls`),
|
|
581
585
|
check("TACIT gained the subtitle rule during the case (it mentions subtitles now, and did not before or has new text)", learned),
|
|
582
586
|
check("the identity files (SOUL, IDENTITY, LORE, ASPIRATIONS) are unchanged", before.identitySha !== null && before.identitySha === after.identitySha),
|
|
583
587
|
]
|
|
@@ -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.1134</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
package/dist/heart/core.js
CHANGED
|
@@ -1313,7 +1313,11 @@ async function runAgent(messages, callbacks, channel, signal, options) {
|
|
|
1313
1313
|
const queueRequiredCorrection = (assistant, message, limitContext) => {
|
|
1314
1314
|
if (budgetExhausted())
|
|
1315
1315
|
throw new Error(`provider iteration limit exhausted at response ${stepBudget} ${limitContext}`);
|
|
1316
|
-
|
|
1316
|
+
// A rejected tool call (settle, a terminal tool) is answered by its own tool result, so the agent reads why and corrects course.
|
|
1317
|
+
if (assistant.tool_calls?.length)
|
|
1318
|
+
rejectToolBatch(assistant, assistant.tool_calls.map(() => message));
|
|
1319
|
+
else
|
|
1320
|
+
rejectAttempt(assistant, [{ role: "user", content: message }]);
|
|
1317
1321
|
};
|
|
1318
1322
|
const toolLoopState = (0, tool_loop_1.createToolLoopState)();
|
|
1319
1323
|
const toolFrictionLedger = (0, tool_friction_1.createToolFrictionLedger)();
|
|
@@ -1501,6 +1505,9 @@ async function runAgent(messages, callbacks, channel, signal, options) {
|
|
|
1501
1505
|
messages: [...canonicalBudget.messages, ...rejectedAttempt, ...nextAttemptControls],
|
|
1502
1506
|
}).messages]
|
|
1503
1507
|
: [...canonicalBudget.messages];
|
|
1508
|
+
// Whatever path built this request, every tool call reaches the provider with a result: a gap the runtime left must
|
|
1509
|
+
// never 400 the turn and leave the agent unable to answer.
|
|
1510
|
+
repairOrphanedToolCalls(attemptMessages);
|
|
1504
1511
|
if (rejectedAttempt.length > 0 || canonicalBudget.status !== "within_budget")
|
|
1505
1512
|
providerRuntime.resetTurnState(attemptMessages);
|
|
1506
1513
|
const turnCallbackBufferRef = { current: null };
|
|
@@ -1622,15 +1629,6 @@ async function runAgent(messages, callbacks, channel, signal, options) {
|
|
|
1622
1629
|
}
|
|
1623
1630
|
const streamCallbackBuffer = turnCallbackBufferRef.current;
|
|
1624
1631
|
turnCallbackBufferRef.current = null;
|
|
1625
|
-
if (result.settleFinalization && !result.settleFinalization.ok) {
|
|
1626
|
-
// A completed settle payload is terminal provider output, not a prompt
|
|
1627
|
-
// for another model turn. Retractable callbacks have already cleared;
|
|
1628
|
-
// core-owned callback buffers must be discarded before surfacing the exact
|
|
1629
|
-
// parser failure through the ordinary terminal-error path.
|
|
1630
|
-
streamCallbackBuffer?.discard();
|
|
1631
|
-
finishTerminalProviderError(new Error(result.settleFinalization.errorCode), "unknown");
|
|
1632
|
-
continue;
|
|
1633
|
-
}
|
|
1634
1632
|
// Track usage from the latest API call
|
|
1635
1633
|
if (result.usage)
|
|
1636
1634
|
lastUsage = result.usage;
|
|
@@ -1685,6 +1683,13 @@ async function runAgent(messages, callbacks, channel, signal, options) {
|
|
|
1685
1683
|
if (thinkingItems.length > 0) {
|
|
1686
1684
|
msg._thinking_blocks = thinkingItems;
|
|
1687
1685
|
}
|
|
1686
|
+
if (result.settleFinalization && !result.settleFinalization.ok) {
|
|
1687
|
+
// An unparseable settle is the agent's own output: nothing reached anyone, so the agent reads why and settles again.
|
|
1688
|
+
// Retractable callbacks have already cleared; core-owned callback buffers are discarded with the attempt.
|
|
1689
|
+
streamCallbackBuffer?.discard();
|
|
1690
|
+
queueRequiredCorrection(msg, `settle was not delivered: its arguments did not parse (${result.settleFinalization.errorCode}). Call settle again with valid JSON arguments.`, "after an unparseable settle");
|
|
1691
|
+
continue;
|
|
1692
|
+
}
|
|
1688
1693
|
const settlingNow = result.toolCalls.length === 1 && (result.toolCalls[0].name === "settle" || result.toolCalls[0].name === "rest");
|
|
1689
1694
|
if (stepReportIteration === null && result.toolCalls.length > 0 && !settlingNow && budgetExhausted()) {
|
|
1690
1695
|
const wrapUpTool = candidateToolNames.has("settle") ? "settle" : candidateToolNames.has("rest") ? "rest" : null;
|
|
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.realRunFile = exports.HOUSESITTER_ENV = exports.SEND_WAIT_MS = void 0;
|
|
39
|
+
exports.realRunFile = exports.HUNG_MS = exports.HOUSESITTER_ENV = exports.SEND_WAIT_MS = void 0;
|
|
40
40
|
exports.defaultStateDir = defaultStateDir;
|
|
41
41
|
exports.assertSessionId = assertSessionId;
|
|
42
42
|
exports.eventLogPath = eventLogPath;
|
|
@@ -89,6 +89,8 @@ const MAX_EVENT_BYTES = 8 * 1024 * 1024;
|
|
|
89
89
|
const MESSAGE_MAX_CHARS = 4_000;
|
|
90
90
|
/** A cut loop this fresh may just be a turn the database has not marked running yet. */
|
|
91
91
|
const STUCK_GRACE_MS = 120_000;
|
|
92
|
+
/** A session the app says is running whose history, sub-agents included, has not grown for this long is hung. */
|
|
93
|
+
exports.HUNG_MS = 30 * 60_000;
|
|
92
94
|
const SESSION_ID = /^[A-Za-z0-9-]+$/;
|
|
93
95
|
const ASK_TOOLS = new Set(["ask_user", "ask_followup_question", "request_user_input"]);
|
|
94
96
|
const PLAN_TOOLS = new Set(["exit_plan_mode"]);
|
|
@@ -330,31 +332,36 @@ function tailFacts(events) {
|
|
|
330
332
|
return { awaiting, loopCut, detail, lastActivity, ...(prompt ? { prompt } : {}) };
|
|
331
333
|
}
|
|
332
334
|
const factsCache = new Map();
|
|
333
|
-
/** The tail facts, re-read only when the log changed, so a periodic snapshot stays cheap. */
|
|
335
|
+
/** The tail facts and when the log was last written, re-read only when the log changed, so a periodic snapshot stays cheap. */
|
|
334
336
|
function cachedTailFacts(stateDir, id) {
|
|
335
337
|
const file = eventLogPath(id, { stateDir });
|
|
336
338
|
let key = "missing";
|
|
339
|
+
let writtenAtMs = null;
|
|
337
340
|
try {
|
|
338
341
|
const stat = fs.statSync(file);
|
|
339
342
|
key = `${stat.size}:${stat.mtimeMs}`;
|
|
343
|
+
writtenAtMs = stat.mtimeMs;
|
|
340
344
|
}
|
|
341
345
|
catch {
|
|
342
346
|
// No log yet: the facts of an empty history.
|
|
343
347
|
}
|
|
344
348
|
const cached = factsCache.get(file);
|
|
345
349
|
if (cached?.key === key)
|
|
346
|
-
return cached
|
|
347
|
-
const
|
|
348
|
-
factsCache.set(file,
|
|
349
|
-
return
|
|
350
|
+
return cached;
|
|
351
|
+
const entry = { key, facts: tailFacts(tailEvents(stateDir, id, STATUS_TAIL_BYTES)), writtenAtMs };
|
|
352
|
+
factsCache.set(file, entry);
|
|
353
|
+
return entry;
|
|
350
354
|
}
|
|
351
|
-
function classify(isRunning, facts, nowMs) {
|
|
355
|
+
function classify(isRunning, facts, nowMs, writtenAtMs = null) {
|
|
352
356
|
if (facts.awaiting === "permission")
|
|
353
357
|
return { state: "waiting", detail: "waiting for a permission answer" };
|
|
354
358
|
if (facts.awaiting)
|
|
355
359
|
return { state: "waiting", detail: `waiting for the person's ${facts.awaiting === "plan" ? "plan approval" : "answer"}` };
|
|
356
|
-
if (isRunning)
|
|
360
|
+
if (isRunning) {
|
|
361
|
+
if (writtenAtMs !== null && nowMs - writtenAtMs >= exports.HUNG_MS)
|
|
362
|
+
return { state: "stuck", detail: `the app says it is running, but its history has not grown for ${Math.round((nowMs - writtenAtMs) / 60_000)} min` };
|
|
357
363
|
return { state: "working", detail: "the app says it is running" };
|
|
364
|
+
}
|
|
358
365
|
if (facts.loopCut) {
|
|
359
366
|
const at = Date.parse(facts.lastActivity ?? "");
|
|
360
367
|
if (!Number.isNaN(at) && nowMs - at < STUCK_GRACE_MS)
|
|
@@ -374,10 +381,10 @@ function listAppSessions(options = {}) {
|
|
|
374
381
|
if (seen.has(row.id) || !SESSION_ID.test(row.id))
|
|
375
382
|
continue;
|
|
376
383
|
seen.add(row.id);
|
|
377
|
-
const facts = cachedTailFacts(stateDir, row.id);
|
|
384
|
+
const { facts, writtenAtMs } = cachedTailFacts(stateDir, row.id);
|
|
378
385
|
const isRunning = row.is_running === 1;
|
|
379
386
|
const repositoryTrust = trusts.get(row.id);
|
|
380
|
-
const { state, detail } = repositoryTrust ? { state: "waiting", detail: "waiting for a repository trust decision" } : classify(isRunning, facts, now);
|
|
387
|
+
const { state, detail } = repositoryTrust ? { state: "waiting", detail: "waiting for a repository trust decision" } : classify(isRunning, facts, now, writtenAtMs);
|
|
381
388
|
rows.push({
|
|
382
389
|
id: row.id,
|
|
383
390
|
name: row.name || row.title || (row.workspace_id ? "(unnamed)" : "(unnamed chat)"),
|
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.1134",
|
|
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.1134",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sdk": "^0.78.0",
|
|
12
12
|
"@ouro.bot/friends": "0.1.0-alpha.18",
|