feat(chat): persistence, streaming, and save UX#18
Merged
Conversation
Gap 1 (body never written): extend PATCH /api/content/:id to accept optional `body` field that updates the markdown body, not just frontmatter. Gap 2 (conversation lost on park/navigate): add Save button to chat header that summarises+patches without committing; auto-save runs inside park() so the conversation is preserved on every explicit park action. Gap 3 (promote loses evolved context): pass `session_summary` into the promote payload as a seeded "## Context from idea session" section in the new plan body. Streaming: switch POST /api/chat from a blocking c.json() response to SSE via Hono's streamSSE(); add LLMRouter.stream() using the Anthropic SDK's messages.stream() async iterator. Web side reads the stream with fetch + ReadableStream, appending tokens as they arrive. Empty assistant placeholder shows "…" typing indicator until the first token lands. Tests updated to cover SSE format, context event, and graceful closure on stream error. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
PATCH /api/content/:idnow accepts an optionalbodyfield to update the markdown body (not just frontmatter), enabling future document-level writes from chatpark()auto-saves before navigating away so conversations survive every park actionpromote()passessession_summaryinto the new plan body as a seeded## Context from idea sessionsection, preserving evolved thinkingPOST /api/chatnow streams via SSE (hono/streaming+ Anthropic SDKmessages.stream()); web side reads withfetch+ReadableStream, appending tokens progressively; empty assistant placeholder shows…typing indicator until first tokenTest Plan
…typing indicator shows while waiting for first tokensession_summaryis written to the branch;Saved ✓appearsContinuing from last session:shows the saved summarysession_summary— new plan body includes## Context from idea session🤖 Generated with Claude Code