owenloop 0.5.30 → 0.5.31

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/packages/work/src/agent/loop.d.ts +5 -3
  3. package/dist/packages/work/src/agent/loop.js +24 -3
  4. package/dist/packages/work/src/agent/workdir.d.ts +17 -0
  5. package/dist/packages/work/src/agent/workdir.js +24 -0
  6. package/dist/packages/work/src/exec/loop.d.ts +8 -1
  7. package/dist/packages/work/src/exec/loop.js +24 -1
  8. package/dist/packages/work/src/hub/client.d.ts +10 -3
  9. package/dist/packages/work/src/hub/client.js +5 -4
  10. package/dist/packages/work/src/hub/deadline.d.ts +20 -0
  11. package/dist/packages/work/src/hub/deadline.js +49 -0
  12. package/dist/packages/work/src/roles/agent-run.js +1 -0
  13. package/dist/packages/work/src/roles/exec.js +1 -0
  14. package/dist/packages/work/src/settings/hub-roster-cache.js +5 -23
  15. package/dist/packages/work/src/shift/loop.d.ts +59 -0
  16. package/dist/packages/work/src/shift/loop.js +177 -19
  17. package/dist/packages/work/src/shift/protocol.d.ts +53 -1
  18. package/dist/packages/work/src/shift/runtime.js +10 -1
  19. package/dist/packages/work/src/shift/server.js +2 -0
  20. package/dist/src/bundle/manifest.d.ts +6 -1
  21. package/dist/src/bundle/manifest.js +38 -8
  22. package/dist/src/bundle/runtime.d.ts +1 -1
  23. package/dist/src/bundle/runtime.js +1 -0
  24. package/dist/src/bundle/types.d.ts +3 -2
  25. package/dist/src/cli.js +17 -3
  26. package/dist/src/defs.js +17 -4
  27. package/dist/src/engine.d.ts +3 -0
  28. package/dist/src/engine.js +42 -9
  29. package/dist/src/factory.d.ts +2 -0
  30. package/dist/src/factory.js +2 -0
  31. package/dist/src/index.d.ts +1 -1
  32. package/dist/src/index.js +1 -1
  33. package/dist/src/store/def-source.d.ts +1 -1
  34. package/dist/src/store/def-source.js +25 -0
  35. package/dist/src/store/gc.js +9 -7
  36. package/dist/src/store/index.d.ts +1 -0
  37. package/dist/src/store/index.js +1 -0
  38. package/dist/src/store/install.js +9 -3
  39. package/dist/src/store/instruction-source.js +9 -5
  40. package/dist/src/store/verified-lock.d.ts +4 -0
  41. package/dist/src/store/verified-lock.js +38 -0
  42. package/dist/src/store.js +4 -2
  43. package/docs/authoring.md +12 -0
  44. package/docs/bundles.md +3 -2
  45. package/docs/cli.md +39 -11
  46. package/docs/shift-logs.md +53 -4
  47. package/package.json +1 -1
  48. package/plugins/claude-code/plugin/.claude-plugin/plugin.json +1 -1
  49. package/plugins/claude-code/plugin/.mcp.json +1 -1
  50. package/plugins/codex/plugins/owenloop/.codex-plugin/plugin.json +1 -1
  51. package/plugins/codex/plugins/owenloop/.mcp.json +1 -1
@@ -219,12 +219,14 @@ Two properties an uploader can rely on:
219
219
  | `low-disk` | `path`, `freeBytes`, `floorBytes` | the volume holding the work root is below the floor, so the shift declined to start new work. It keeps polling and resumes by itself when space returns; children already running are left alone. **Edge-triggered** (one record per low-disk episode) and **file-only** — see below |
220
220
  | `ended` | — | an operator ran `owenloop shift end` |
221
221
  | `wedged` | `faults[]` (`kind`, `role`, `path`, `message`), `streak` | the shift stopped because the **machine** it runs on is broken, and the process exited non-zero — see below |
222
+ | `stalled` | `lastPollAt`, `sinceMs` | the poll loop has made no progress — no hub call settled, no cycle completed — for longer than the stall threshold; written by a watchdog timer the loop cannot block. **Edge-triggered** (one record per stall episode, re-armed on the next completed cycle) — see below |
223
+ | `heartbeat` | `cyclesCompleted`, `lastPollAt`, `hubFailureStreak`, `stalled` | periodic proof of life (every five minutes by default) carrying the loop's counters, so a silent file can be told apart from a silent daemon. **File-only** — see below |
222
224
  | `gate` | optional `workflow`, `run`, `name`, `question` | reserved; not emitted today |
223
225
 
224
226
  `kind` is `'exec' | 'agent-run'`.
225
227
 
226
- **Five of these are file-only.** `parked`, `capacity`, `hub-error`,
227
- `event-queue-overflow`, and `low-disk` are written to `shift.log` and are never
228
+ **Six of these are file-only.** `parked`, `capacity`, `hub-error`,
229
+ `event-queue-overflow`, `low-disk`, and `heartbeat` are written to `shift.log` and are never
228
230
  delivered over the daemon's Unix socket to `owenloop shift next`. Every other type goes to
229
231
  both. The routing rule is `FILE_ONLY_EVENTS` in
230
232
  `packages/work/src/shift/runtime.ts`, applied at the one point where an event
@@ -236,7 +238,9 @@ The split is not importance. It is what each consumer is:
236
238
  `failed`, `order-dropped`, `bundle-miss`, `ended` — tells a socket client
237
239
  something it cannot otherwise learn. Both sinks get it. `wedged` joins them
238
240
  for the same reason `ended` does: a client parked on a shift that is about to
239
- exit is waiting for work that will never arrive.
241
+ exit is waiting for work that will never arrive. `stalled` joins them for the
242
+ same reason again: a client parked on a shift whose loop has hung is waiting
243
+ for work that will not arrive until someone restarts it.
240
244
  - A record about the **shift's own condition** is redundant or harmful on the
241
245
  socket, and load-bearing in the file.
242
246
 
@@ -303,7 +307,7 @@ as a refusal.
303
307
 
304
308
  Nothing is lost, because the file is the consumer with no envelope and no
305
309
  context. `shift.log` has no per-response `cap`/`free`/`running`, so without
306
- these five records a reader cannot tell an **idle** shift (no orders offered)
310
+ these six records a reader cannot tell an **idle** shift (no orders offered)
307
311
  from a **saturated** one (orders offered, no slots) from a **stranded** one (hub
308
312
  unreachable, so nothing was ever offered) from one **refusing work on a full
309
313
  disk**, nor tell a quiet log from a lossy one.
@@ -415,6 +419,51 @@ check ran, and is `0` for the check every shift makes at start, before its first
415
419
  hub call. It is evidence of what prompted the check, not the reason the shift
416
420
  stopped; the `faults` are that.
417
421
 
422
+ ### `stalled` and `heartbeat` — when the loop itself is the fault
423
+
424
+ `wedged` and `hub-error` both need a hub call to **fail**. A hub call that never
425
+ settles fails nothing: the loop awaits it forever, writes no line, makes no
426
+ further hub traffic, and the daemon still answers `shift status` over its
427
+ socket because that is served by a separate task. One shift was observed in
428
+ this state for hours, indistinguishable in the file from an idle one.
429
+
430
+ Two things close that gap. First, every hub call the loop makes — `wake`,
431
+ `whats_next`, `presence_ping` — now runs under a per-call deadline (30 s by
432
+ default), so a call that hangs is cut short and fails exactly like a call that
433
+ failed outright: it is logged, and recorded as a `hub-error` where that call
434
+ already reports one. Only a `wake` failure advances the `wedged` streak, as
435
+ before. Second, a **watchdog timer** that does not depend on the loop returning
436
+ checks when the loop last made progress — the later of the last hub call that
437
+ settled (success or failure) and the last completed cycle. If that is older
438
+ than the stall threshold (three poll intervals plus the per-call deadline, 45 s
439
+ at the defaults) it writes a `stalled` record: `lastPollAt` is the last
440
+ completed cycle (epoch ms, `null` if none has completed since start) and
441
+ `sinceMs` is how long the loop has made no progress. Progress is per call, not
442
+ per cycle, on purpose: one cycle serialises roster sync, presence, wake, the
443
+ inbox and one targeted `whats_next` per workflow, so a slow-but-alive hub with
444
+ a dozen workflows can legitimately take longer than the threshold per cycle
445
+ without being hung. A hung hub is therefore not what `stalled` reports: every
446
+ poll-loop hub call settles within its deadline, so a hub that stops answering
447
+ shows up as `hub-error` records and the `wedged` streak. `stalled` is the
448
+ backstop for a hang that is NOT under a deadline — local dispatch, the
449
+ filesystem, a spawn, or any other non-hub await inside the iteration. It is
450
+ **edge-triggered** like `capacity` and `low-disk` — one
451
+ record per stall episode, re-armed when a cycle next completes — and a
452
+ hub-instructed `Retry-After` pause is deliberately not a stall, since the shift
453
+ is idle on instruction rather than hung. It reaches both sinks, for the reason
454
+ `wedged` does.
455
+
456
+ `heartbeat` is the complement: proof of life on a fixed cadence (five minutes by
457
+ default) regardless of whether anything happened. It carries `cyclesCompleted`,
458
+ `lastPollAt`, `hubFailureStreak`, and `stalled`, so a reader of the file can
459
+ tell a daemon that is alive and idle (heartbeats arrive, `cyclesCompleted`
460
+ climbs) from one that is alive and stuck (heartbeats arrive, `cyclesCompleted`
461
+ frozen, `stalled: true`) from one that is dead (no heartbeats). It is
462
+ **file-only** for the `parked`/`capacity` reason: a parked `shift next` must
463
+ not be woken every five minutes by news that nothing happened. Both timers are
464
+ started only by a long-running shift — `--once` starts neither — and are
465
+ cleared when the shift stops.
466
+
418
467
  ### Line size
419
468
 
420
469
  Each line is bounded at **512 KiB** (`MAX_RESPONSE_LINE_BYTES`) — the same
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owenloop",
3
- "version": "0.5.30",
3
+ "version": "0.5.31",
4
4
  "description": "Deterministic rails for agentic workflows. Declare steps and dependencies; the engine guarantees order, redoes what changes invalidate, and stops what keeps failing — instead of hoping the agent follows through.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "typicalday",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owenloop",
3
- "version": "0.5.30",
3
+ "version": "0.5.31",
4
4
  "description": "Claude Code driver for owenloop — cross-harness shift and conduct skills driven by the owenloop CLI, plus one hub control-plane MCP server backing an author skill and a fallback worker, for conducting and authoring workflows against your hosted owenloop server.",
5
5
  "author": {
6
6
  "name": "Typical Day"
@@ -7,7 +7,7 @@
7
7
  "mcp"
8
8
  ],
9
9
  "env": {
10
- "OWENLOOP_PLUGIN_VERSION": "0.5.30"
10
+ "OWENLOOP_PLUGIN_VERSION": "0.5.31"
11
11
  }
12
12
  }
13
13
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owenloop",
3
- "version": "0.5.30",
3
+ "version": "0.5.31",
4
4
  "description": "Codex plugin for the owenloop workflow engine.",
5
5
  "skills": "./skills/",
6
6
  "mcpServers": "./.mcp.json"
@@ -6,7 +6,7 @@
6
6
  "mcp"
7
7
  ],
8
8
  "env": {
9
- "OWENLOOP_PLUGIN_VERSION": "0.5.30"
9
+ "OWENLOOP_PLUGIN_VERSION": "0.5.31"
10
10
  },
11
11
  "env_vars": [
12
12
  "HOME",