Stream the docs index docbot generates over the WebSocket - #163
Merged
Conversation
Docbot registers --ws and inherits every frame the shared modules emit — hello, log, activity, state, screenshot, research and ask — but nothing under boat/ ever emitted a frame of its own, so the artifact the whole run produces never reached a listener. saveIndex() now emits the rendered index as a `docs` frame the moment it writes it, mirroring how the analyst emits its report. A new kind rather than reusing `report`: a UI keeps the last frame per type, and the two are unrelated artifacts. The exit path had to move with it. `docs collect` ended on a bare process.exit(0), while the main CLI routes exits through remote.close(), which sends `result` and flushes. Since saveIndex() runs at the very end of the crawl, the new frame was the one most likely to die in the socket buffer. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Twc8quqSCEZNzPn4sK1o55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Docbot was already half-wired to the
--wsstream: its bin callsremote.registerOption, and it inherits every frame the shared modules emit —hello,log,activity,state(state-manager),screenshot(action.ts),research(researcher cache) andaskthrough the execution controller. But everytag('data')call site lives insrc/; nothing underboat/emitted a frame of its own, sodocs/index.md— the artifact the whole run produces — never reached a listener.Changes
saveIndex()emits adocsframe (boat/doc-collector/src/docbot.ts) — keeps the rendered markdown in a local, writes it, thentag('data').log('docs', { path, content }), mirroringwriteReport()insrc/ai/session-analyst.ts. Same{path, content}payload asreport, but a new kind rather than reusing it: a UI keeps the last frame per type, and the analyst's report and the spec index are unrelated artifacts.boat/doc-collector/src/cli.ts) —docs collectended on a bareprocess.exit(0), while the main CLI routes exits throughshowStatsAndExit→remote.close(code), which sendsresultand flushes. Docbot did neither, so a listener never learned the run ended. This is a prerequisite, not a separate nit:saveIndex()fires at the very last moment before exit, so the new frame was the one most likely to die in the socket buffer.close()early-returns when unattached, so no guard is needed.docs/reference/websocket.md— added thedocsrow to the frame table, which is the contract listeners actually read.Scope is
index.mdonly. Per-pagepages/*.mdandstate-diagram.mmdstay unstreamed, matching the one-shot-at-end shape ofreport.Not fixed here
boat/api-testerhas the same missingremote.close()on exit, so apibot runs never sendresulteither. Left alone to keep this PR to its stated purpose, and because that boat has unrelated work in flight.Testing
bun run format,bun run lint, andbun test tests/unit/doc-collector.test.ts(45 pass) are green.🤖 Generated with Claude Code
https://claude.ai/code/session_01Twc8quqSCEZNzPn4sK1o55