@ouro.bot/cli 0.1.0-alpha.1133 → 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 CHANGED
@@ -1,6 +1,12 @@
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
+ },
4
10
  {
5
11
  "version": "0.1.0-alpha.1133",
6
12
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1133",
2
+ "runtimeVersion": "0.1.0-alpha.1134",
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.1133</Repository>
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>
@@ -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.facts;
347
- const facts = tailFacts(tailEvents(stateDir, id, STATUS_TAIL_BYTES));
348
- factsCache.set(file, { key, facts });
349
- return facts;
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)"),
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1133",
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.1133",
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",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1133",
3
+ "version": "0.1.0-alpha.1134",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },