@crouton-kit/crouter 0.3.45 → 0.3.47

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 (52) hide show
  1. package/dist/build-root.js +0 -1
  2. package/dist/builtin-memory/00-runtime-base.md +3 -0
  3. package/dist/builtin-memory/internal/nodes-and-canvas.md +2 -2
  4. package/dist/builtin-memory/wedged-child-on-runaway-bash.md +2 -2
  5. package/dist/builtin-views/chat/web.jsx +1 -1
  6. package/dist/clients/attach/__tests__/crtr-output-render.test.js +11 -9
  7. package/dist/clients/attach/attach-cmd.js +557 -546
  8. package/dist/clients/attach/chat-view.d.ts +4 -0
  9. package/dist/clients/attach/chat-view.js +13 -2
  10. package/dist/clients/attach/mermaid-render.d.ts +23 -0
  11. package/dist/clients/attach/mermaid-render.js +124 -0
  12. package/dist/clients/web/source-cache.js +1 -1
  13. package/dist/commands/__tests__/revive-now-gate.test.js +2 -2
  14. package/dist/commands/canvas-history/read.js +3 -3
  15. package/dist/commands/canvas-history/search.js +1 -1
  16. package/dist/commands/canvas-history.js +11 -12
  17. package/dist/commands/canvas-rebuild-index.js +2 -2
  18. package/dist/commands/canvas.js +4 -4
  19. package/dist/commands/node-inspect-artifacts.d.ts +1 -0
  20. package/dist/commands/{canvas-history/show.js → node-inspect-artifacts.js} +7 -7
  21. package/dist/commands/node-lifecycle-revive.d.ts +12 -0
  22. package/dist/commands/node-lifecycle-revive.js +166 -0
  23. package/dist/commands/node-worktree.d.ts +2 -0
  24. package/dist/commands/{worktree.js → node-worktree.js} +15 -16
  25. package/dist/commands/node.js +16 -13
  26. package/dist/commands/push.js +1 -1
  27. package/dist/commands/revive.d.ts +0 -10
  28. package/dist/commands/revive.js +31 -181
  29. package/dist/core/__tests__/kickoff.test.js +2 -2
  30. package/dist/core/canvas/boot.js +1 -1
  31. package/dist/core/canvas/browse/app.js +6 -6
  32. package/dist/core/canvas/browse/render.js +1 -1
  33. package/dist/core/canvas/status-glyph.d.ts +1 -1
  34. package/dist/core/canvas/status-glyph.js +1 -1
  35. package/dist/core/preview-registry.js +27 -26
  36. package/dist/core/profiles/select.d.ts +12 -4
  37. package/dist/core/profiles/select.js +182 -22
  38. package/dist/core/runtime/bearings.js +1 -1
  39. package/dist/core/runtime/close.js +1 -1
  40. package/dist/core/runtime/kickoff.js +3 -3
  41. package/dist/core/runtime/revive.js +2 -2
  42. package/dist/core/view/stream-local.js +1 -1
  43. package/dist/core/worktree.js +4 -4
  44. package/dist/daemon/crtrd.js +3 -3
  45. package/dist/web/transport-stream.js +1 -1
  46. package/dist/web-client/assets/index-dpd0Rzuw.js +80 -0
  47. package/dist/web-client/index.html +1 -1
  48. package/package.json +2 -2
  49. package/scripts/postinstall.mjs +73 -0
  50. package/dist/commands/canvas-history/show.d.ts +0 -1
  51. package/dist/commands/worktree.d.ts +0 -2
  52. package/dist/web-client/assets/index-B00YpRQ1.js +0 -80
@@ -18,7 +18,6 @@ const SUBTREE_LOADERS = {
18
18
  push: async () => (await import('./commands/push.js')).registerPush(),
19
19
  canvas: async () => (await import('./commands/canvas.js')).registerCanvas(),
20
20
  surface: async () => (await import('./commands/surface.js')).registerSurface(),
21
- worktree: async () => (await import('./commands/worktree.js')).registerWorktree(),
22
21
  };
23
22
  /** Every shipped subtree name. Cheap (no module loading) — the front-door
24
23
  * recursion guard and the dispatcher's first-token routing need only names. */
@@ -38,5 +38,8 @@ Two different moves; don't conflate them. **Promote** when the *shape* of the jo
38
38
 
39
39
  Don't promote or yield for work that fits one window — finish it with `crtr push final`.
40
40
 
41
+ ## Diagrams
42
+ When structure would land faster as a picture than as prose — a flow, a state machine, a small architecture — write it as a ```mermaid fenced code block. The human's viewer renders it inline as a terminal diagram. Reach for it when the shape is the point, not for everything.
43
+
41
44
  ## When you are blocked on a future event or time
42
45
  You are not stuck and you are not done — you are waiting. Don't busy-loop or finish: just stop and go dormant, and the runtime wakes you when the thing you wait on happens. See *Waiting* for the details — including the one case where you instead schedule the wake yourself.
@@ -44,6 +44,6 @@ Tear-down: `node lifecycle close` cascade-cancels a node + its exclusive subtree
44
44
 
45
45
  ## Revive & the daemon
46
46
 
47
- A dormant node (done/idle/dead/canceled) is reopened with `canvas revive` (resumes the saved conversation, or `--fresh` to restart clean). `reviveNode()` is the **only** sanctioned launcher of a node's broker engine — it builds the pi invocation, sets `CRTR_NODE_ID` + canvas extensions, runs `transition('revive')`, and starts the headless broker host, keeping the db row and broker process in lockstep. Never spawn `pi --session` raw, and never open a node by spawning pi directly — UIs go through `node focus` / `canvas revive`.
47
+ A dormant node (done/idle/dead/canceled) is reopened with `node lifecycle revive <id>` (resumes the saved conversation, or `--fresh` to restart clean); mass-reconnecting EVERY disconnected node at once (a reboot/crash recovery) is `canvas revive --all` instead. `reviveNode()` is the **only** sanctioned launcher of a node's broker engine — it builds the pi invocation, sets `CRTR_NODE_ID` + canvas extensions, runs `transition('revive')`, and starts the headless broker host, keeping the db row and broker process in lockstep. Never spawn `pi --session` raw, and never open a node by spawning pi directly — UIs go through `node focus` / `node lifecycle revive`.
48
48
 
49
- The **daemon** (`crtrd`, managed via `canvas daemon start/stop/status`) is a thin supervisor: it polls broker liveness via `pi_pid` and auto-revives active/idle nodes whose broker exited. It does NOT host agents, open viewers, or auto-revive *canceled* nodes (reach for `canvas revive` for those). After rebuilding crouter's `dist/`, restart the daemon — it loads compiled code at start and never reloads it. Restarting is safe: it never signals running nodes.
49
+ The **daemon** (`crtrd`, managed via `canvas daemon start/stop/status`) is a thin supervisor: it polls broker liveness via `pi_pid` and auto-revives active/idle nodes whose broker exited. It does NOT host agents, open viewers, or auto-revive *canceled* nodes (reach for `node lifecycle revive` for those). After rebuilding crouter's `dist/`, restart the daemon — it loads compiled code at start and never reloads it. Restarting is safe: it never signals running nodes.
@@ -13,7 +13,7 @@ A base node can wedge INDEFINITELY on a single runaway bash command (classic: `g
13
13
  **Remediation branches on whether the tree has a descendant (issue #119):**
14
14
 
15
15
  - **A subprocess exists (the common case)** — a runaway bash/find/grep is the likely cause. The daemon does NOT touch the engine here; you kill the subprocess yourself (see below).
16
- - **No subprocess exists** — the broker pid stands alone in its own tree (the engine itself stalled, e.g. mid a `model_change`, with nothing a human could kill). The daemon performs the ONLY remaining remediation itself: it SIGTERMs the broker (the same on-demand kick `canvas revive --now` does), and its own dead-pid crash-grace path resumes it on the saved session within ~20s, no lost context. The resume alone can leave the node IDLE rather than mid-turn (it reloads the session but doesn't restart the dead turn) — if telemetry stays frozen after the kick, nudge it (see "No-subprocess case" below).
16
+ - **No subprocess exists** — the broker pid stands alone in its own tree (the engine itself stalled, e.g. mid a `model_change`, with nothing a human could kill). The daemon performs the ONLY remaining remediation itself: it SIGTERMs the broker (the same on-demand kick `node lifecycle revive --now` does), and its own dead-pid crash-grace path resumes it on the saved session within ~20s, no lost context. The resume alone can leave the node IDLE rather than mid-turn (it reloads the session but doesn't restart the dead turn) — if telemetry stays frozen after the kick, nudge it (see "No-subprocess case" below).
17
17
 
18
18
  **Why it used to be invisible to the orchestrator:** the wake spine only fires on a child's push/finalize/crash. A child wedged *mid-turn* does none of those — its row stays `status=active` and the dashboard shows it `●` working. Before #110, the parent got no wake at all, so an entire wave could stall for hours looking healthy; cli-verbs-B2 sat wedged ~2h14m on a `grep /` before a safety-deadline inspection caught it. The daemon-side detection above closes that gap; you should no longer need to notice a wedge by elapsed-time vibes alone — but if you do (the daemon hasn't caught up yet, or the wedge is younger than its grace window), the manual inspection below still works.
19
19
 
@@ -30,5 +30,5 @@ The wedge can outlive any subprocess, or exist with none at all. A node (includi
30
30
  **This is now the daemon's own remediation (issue #119) — it auto-kicks the broker for you.** If it hasn't caught up yet (younger than the wedge grace, or the daemon was down), do it manually:
31
31
 
32
32
  1. `kill -TERM <broker_pid>` — the wedged broker. Confirm it dies (`ps -p <pid>`) and that no orphan subprocess lingers (`ps -o pid,ppid,command | awk '$2==<pid>'`).
33
- 2. The **daemon auto-resumes** it within ~20s on the saved session — a fresh broker pid appears (`node inspect show`), `status=active`, `intent=null`, `view.sock` accepts connections. (No manual `canvas revive` needed if the daemon is up; do it manually only if it doesn't come back.)
33
+ 2. The **daemon auto-resumes** it within ~20s on the saved session — a fresh broker pid appears (`node inspect show`), `status=active`, `intent=null`, `view.sock` accepts connections. (No manual `node lifecycle revive` needed if the daemon is up; do it manually only if it doesn't come back.)
34
34
  3. **The resume alone leaves it IDLE** — it loads the session but does not restart the dead turn, so telemetry stays frozen and it processes nothing. Send a `--tier critical` `node msg` to force a fresh turn (critical = interrupt + new turn). Word it as a recovery notice: tell it the broker was wedged, to re-orient from `context/roadmap.md`/feed, and NOT to trust that recent inbox context survived (cursor may have advanced past messages the wedged engine never folded into the conversation). Confirm success by watching `telemetry.json` `updated_at` go current and the node run bash again.
@@ -129,7 +129,7 @@ function connectionGuidance(state) {
129
129
  Comp: NotReady,
130
130
  headline: 'node is asleep',
131
131
  explanation: 'Focus or revive the node first, then reconnect.',
132
- nextStep: `crtr node focus ${target} · or crtr canvas revive ${target}`,
132
+ nextStep: `crtr node focus ${target} · or crtr node lifecycle revive ${target}`,
133
133
  };
134
134
  case 'no-node':
135
135
  return {
@@ -745,8 +745,8 @@ test('a crtr canvas attention map card collapses to a hottest-id digest, PASS wh
745
745
  .join('\n');
746
746
  assert.match(expanded, /counts: \{"n1":0,"n2":3,"n3":5\}/);
747
747
  });
748
- test('a crtr canvas revive card collapses to a kicked/revived status line, argv-recovered id', () => {
749
- const kickedDef = createCrtrBashToolDefinition({ command: 'crtr canvas revive mq2jpqz5-87fa626e --now' });
748
+ test('a crtr node lifecycle revive card collapses to a kicked/revived status line, argv-recovered id', () => {
749
+ const kickedDef = createCrtrBashToolDefinition({ command: 'crtr node lifecycle revive mq2jpqz5-87fa626e --now' });
750
750
  const kicked = kickedDef
751
751
  .renderResult({ content: [{ type: 'text', text: ['- session: mysession', '- kicked: true', '', 'Sent SIGTERM to worker-a (mq2jpqz5-87fa626e, pid 456).'].join('\n') }] }, { expanded: false }, theme, {})
752
752
  .render(120)
@@ -757,7 +757,7 @@ test('a crtr canvas revive card collapses to a kicked/revived status line, argv-
757
757
  .render(120)
758
758
  .join('\n');
759
759
  assert.match(kickedExpanded, /Sent SIGTERM to worker-a \(mq2jpqz5-87fa626e, pid 456\)\./);
760
- const revivedDef = createCrtrBashToolDefinition({ command: 'crtr canvas revive mq2jpqz5-87fa626e' });
760
+ const revivedDef = createCrtrBashToolDefinition({ command: 'crtr node lifecycle revive mq2jpqz5-87fa626e' });
761
761
  const revived = revivedDef
762
762
  .renderResult({ content: [{ type: 'text', text: ['- session: mysession', '- resumed: true', '- ready: true'].join('\n') }] }, { expanded: false }, theme, {})
763
763
  .render(120)
@@ -780,9 +780,11 @@ test('a crtr canvas revive card collapses to a kicked/revived status line, argv-
780
780
  .join('\n');
781
781
  assert.match(notReadyExpanded, /resumed: false/);
782
782
  assert.match(notReadyExpanded, /ready: false/);
783
- // `--all` carries a `- mode:` bullet and is deliberately skipped (null) —
784
- // falls through to generic truncation, raw `mode` text survives.
785
- const allPreview = revivedDef
783
+ // `canvas revive --all` carries a `- mode:` bullet; no summarizer is
784
+ // registered for it (rare admin path) falls through to generic
785
+ // truncation, raw `mode` text survives.
786
+ const allDef = createCrtrBashToolDefinition({ command: 'crtr canvas revive --all' });
787
+ const allPreview = allDef
786
788
  .renderResult({ content: [{ type: 'text', text: '- mode: preview\n- candidates: mq1' }] }, { expanded: false }, theme, {})
787
789
  .render(120)
788
790
  .join('\n');
@@ -907,10 +909,10 @@ const HISTORY_SHOW_OUTPUT = [
907
909
  '| n1:docs/design.md | doc | 2026-01-03T00:00:00.000Z | Design doc |',
908
910
  '| n1:roadmap.md | roadmap | 2026-01-04T00:00:00.000Z | Roadmap |',
909
911
  '',
910
- 'Read one with `canvas history read <ref>`; reopen the node with `canvas revive n1`.',
912
+ 'Read one with `canvas history read <ref>`; reopen the node with `node lifecycle revive n1`.',
911
913
  ].join('\n');
912
- test('a crtr canvas history show card collapses to a node line + type-count digest, not the raw table', () => {
913
- const def = createCrtrBashToolDefinition({ command: 'crtr canvas history show n1' });
914
+ test('a crtr node inspect artifacts card collapses to a node line + type-count digest, not the raw table', () => {
915
+ const def = createCrtrBashToolDefinition({ command: 'crtr node inspect artifacts n1' });
914
916
  const collapsed = def
915
917
  .renderResult({ content: [{ type: 'text', text: HISTORY_SHOW_OUTPUT }] }, { expanded: false }, theme, {})
916
918
  .render(120)