feat(runtime): cmd:screenshot + cmd:force-incident + prismarine-viewer dep

Three live-verification surfaces on top of v0.1.0:

1. cmd:screenshot { reason?, frames? } → runtime/viewer.takeScreenshot
   - Headless POV render via prismarine-viewer.headless to
     state/<host>/screenshots/<ISO>-<reason>.mp4 (1 frame ≈ ~10 KB).
   - Lazy-loads the heavy GL stack on first call so the bot doesn't pay
     the cost on startup or in TUI-only sessions.
   - Returns { ok, path, error } over IPC LOG event.
   - Known limitation: needs node-canvas. node-canvas v3 (current npm
     default) is incompatible with prismarine-viewer's API; v2 doesn't
     build under Node 24 (node-pre-gyp fail). So today the feature is
     wired and the IPC contract is stable, but the underlying render
     fails fast with "createCanvas is not a function". A future cleanup
     can either fork the renderer or pin a Node 20 toolchain.

2. cmd:force-incident { kind?, reason? } → filePostCritique path
   - Operator-triggered demo of the critic → proposal → auto-improve →
     auto-patch chain. Was previously only observable when the bot
     genuinely got stuck. Now a single IPC call exercises the full
     loop on demand.
   - Verified live 2026-05-26: critic call returned a real, useful
     critique ("attack zombie returns done while target is alive →
     blocks gather.logs"), proposal landed with all sections including
     the Critic block, auto-improve picked it up within 10 s.

3. prismarine-viewer + canvas added to dependencies so npm install
   builds the deps once and the IPC surface is always available.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-26 16:01:43 +03:00
co-authored by Claude Opus 4.7
parent 4ae63dabe1
commit 8bc9b41c01
5 changed files with 1645 additions and 9 deletions
+2
View File
@@ -31,6 +31,8 @@ export const COMMAND_TYPES = Object.freeze({
CONV_SAY: "cmd:conv-say", // { topic, text, intent?, position? } append turn to a multi-agent topic
CONV_RECENT: "cmd:conv-recent", // { topic, n? } read last n turns
CONV_LIST: "cmd:conv-list", // list active conversation topics
SCREENSHOT: "cmd:screenshot", // { reason?, frames? } headless POV render to state/screenshots/
FORCE_INCIDENT: "cmd:force-incident", // { kind?, reason? } emulate a stuck-incident to demo critic + auto-improve pipeline
});
export function encodeFrame(obj) {