Repository navigation
message: a chat message kind, tool rows and text that streams, in every renderer (#296) - #305
Merged
Merged
Conversation
…treams (#296) The ADR for #296 in docs/architecture/message/: a message is who is speaking around ordinary blocks (a prose block for text, a new tool kind per tool call, attachments as a field); one new op, append, grows a prose block at its end and is written by diff. Measured on a long reply: the wire, the crate and the HTML drawing. No product code.
…end, guard rules (#296)
…nd grown in place; apply moved to the core; showcase and docs (#296)
…ith a repeat speaker's head (#296)
This was referenced Nov 21, 2026
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.
Closes #296
For humans
Apps can now show a chat as blocks: who said each message, its text as it streams in with a blinking caret, the agent's tool calls (running, done or failed, with output that folds open) and attached files and images.
A reply that is still being written grows where it stands on the web page, the iPhone and Mac app and the desktop app, so a long answer no longer sends or redraws the whole message on every word.
A message can carry the time it was sent, shown quietly beside the speaker's name.
It looks the same in every renderer and on the static site, light and dark.
For apps: two new core kinds,
message(Message::new(Role::Agent, "Scout").id(..).avatar(..).time("14:32").blocks(..).files(vec![Attachment { name, tap, src }])) andtool(Tool::new("Read", ToolState::Done).id(..).summary(..).body(..)), andprosegains an optionalstreaming.Prose::read(markdown)turns markdown into prose parts on the server. A new op,append, grows a prose block at its end; onlydiff(soShelf::put) writes it, so an app keeps putting whole screens. A client built before this asks for the whole screen on each such frame: ship clients first, then stream.wire::oldturnsappendinto amergeofparts. In TS,applymoved from the shell's patch module to the core (@jirathip-dev/blocksexports it; the shell still re-exports it).SCHEMA_VERSIONis unchanged (additive); the guard version goes to 3 for three new rules.What changed (built to docs/architecture/message/ and docs/design/message/)
message,tool,Attachment,Role,ToolState;prose.streaming;Prose::read(kind/read.rs, prefix-stable, unknown markdown stays text);Prose::grow;Op::Appendinwire,patch(message is a host ofblocks),diff(text-only when only the last text grew, elsekeep+ parts; other fields in amergefirst) andwire::old.linkablemoved frombuiltintokindso the reader uses the one link rule.lint/stream-no-id,lint/summary-long,lint/tap-empty(each with a failing fixture);label-long,label-empty,empty-statewidened to messages, tools and attachments (a test each).render/kind/message.ts,tool.ts; the prose view'sgrowdraws anappendin place (earlier parts are the same nodes); the patcher handsappendto it and skips one whose block amerge/replacealready redrew in the same batch.applymoved toweb/src/core/apply.ts(ADR decision 10) with the growth rule incore/kind/prose.ts; the ADR'sstructuredCloneban onpatch.tsis in.drover/arch.toml(the twofetch(bans on patch.ts and render/** were merged to keep the file under its baseline).kinds/message.ts,kinds/tool.ts, prosearia-busy; same markup as HTML (markup test, incl. the thread screen and a continuation pair).site/kind/message.rs,tool.rs(a<details>inside the tool so it opens with no script), prosearia-busy.Kind/Message.swift,Kind/Tool.swift, the caret in the prose view,appendinApply.swift, tool open state kept by id inBlocksView.draw/prose.rs(wasTODO(#45)),draw/message.rs,draw/tool.rs.message.time, optional, drawn after the role word in the role word's muted face (<time class="mt">in HTML, React and the static page; a muted metaTextin SwiftUI, also on a system line; a small muted label in egui, whose name truncation now leaves room for it). Omitted when unset; a repeat speaker's hidden head hides it too. The sample and fixtures carry14:32; tests incrates/blocks/tests/site_message.rsandweb/test/kind/prose.test.tscheck drawn, omitted and the repeat case.docs/schema/stream.md(the op),docs/schema/blocks.md(the kinds).fixtures/append/*.json(the op's cases, read by Rust, TS and Swift),fixtures/append/thread.{screen,steps}.json(the script played by blocks-shot, blocks-snap and the desk harness),fixtures/read/*.json.Decisions taken here:
statecollides with a screen's rootstatemap only when a tool is a fixture's root; codegen's tree writer now reads the rootstateonly when it is an object.agent,owner,system), as drawn in the design; an unknown role readsagent.src/ net +1504 (budget ~+1,300 in the ADR): two kinds in five renderers, the op in three languages, plus the reader and the amended time;
just cap: 42815 / 43000.Evidence (at 4d825b8)
The head adds one test-only commit after fedcb31: the pages test now expects 45 showcase pages. The rows below ran at fedcb31, plus the pages row at 4d825b8.
just fmtjust clippyjust testjust web(211 pass, 0 fail, incl. the new time test)npm --prefix web run test:react(32 pass)just swift(96 tests, 1 skipped as before)just desktopjust arch/just cap(42815 / 43000) /just guard(cd site && cargo test)cargo run --locked -p blocks-site -- sitethennode --test test/pages/showcase.test.ts(pages.yml's step; 9 pass, 45 pages) at 4d825b8Earlier at c84cf2b, before the time field:
just check0,just perf/just soak0 / 0, the blocks-shot thread script at 390 and 1440 light and dark 0,blocks check --all --renderwith no findings on the samples.Not verified here: the look against the design was compared by eye on the harness PNGs (HTML light/dark at 390 and 1440; SwiftUI and egui shots by their slices), not pixel-diffed; the time's look was not compared against a design image, since the design has none. Known gaps, all small: egui has no bold face and no image thumbnails (as the ADR says for egui); the SwiftUI running glyph does not spin.