feat: let html_render pages send replies back to the thread
Summary
An agent can now build a page in the thread that also gets answers back from the user. A page calls t3.send(text, data) and the text, with the data as a JSON block, goes into the thread as a normal user message that starts the next turn. The design guide moves into a new html_guide tool, so the MCP tool list gets smaller.
Preview
A real Claude Haiku turn, made headless, after the guide changes. The prompt was only "I am new to compilers. Explain how a small compiler turns TSL into Python", with no layout instructions. The agent read html_guide, then rendered this.


Talk-back test from an earlier run, where the prompt asked for reply buttons: a headless click on Parse, then "Lost me here", put this message in the thread:
A headless click on Parse, then "Lost me here", put this message in the thread:
Lost me here
```json
{
"action": "lost_me",
"station": "parse"
}
```
The agent's next turn explained the Parse stage.
Changes
packages/shared/src/htmlRender.ts: the page bootstrap now haswindow.t3.send(text, data). It posts at3/sendrequest to the parent frame (web) or toReactNativeWebView(mobile) and resolves or rejects on the host's reply.readHtmlRenderSendRequestchecks and formats the request (8000 character limit, data must be JSON).HTML_RENDER_GUIDEholds the guide: when to use a page, layout, theme tokens, look, accessibility, no emojis, and the reply API.apps/server/src/mcp/toolkits/html: new read-onlyhtml_guidetool that returns the guide and a key.html_renderrequires that key asguide, so a model cannot publish before it reads the current guide (the key is a hash of the guide text). Without the key, Haiku skipped the guide and made a white page with gradients. The theme and layout rules moved out of thehtml_renderdescription.- The guide asks for one diagram-led idea per page, 15px body text, interaction only where it shows something a still page cannot, reply buttons only for a real decision, and no commands run to fill a page. It names no example button labels, because models copied them.
- The page theme rule is now
:root:root, so a page that copies the theme variables into its own:rootcannot override them. Haiku did that and got a light page in dark mode. orchestrationInstructions.ts: "diagram or clickable steps" is now "diagram".apps/server/src/provider/agentContextBudget.json:mcpToolListJsonBytes47522 to 46817,claudeSystemAppendBytes5138 to 5119,codexAdditionalContextBytes6868 to 6849.- Web (
BrowserDocumentFrame.tsx,HtmlRenderFrame.tsx,HtmlRenderDialog.tsx,TimelineAssistantRows.tsx): the frame answerst3/sendwith the same gate as links (frame has focus and the user just clicked or typed in it), one send at a time, then calls the existingonSendAppMessage, which queues a user message. Works inline and in the full screen dialog. - Mobile (
HtmlRenderWebView.tsx): a WebView cannot prove a user click, so T3 Code asks before each message (the same as MCP apps do), then queues it through the thread outbox. - Claude read-only allowlist, tool labels, and work summary know
html_guide. docs/user/html-renders.md: one paragraph on reply controls.
Tests
vp run check:changed: all checks pass (format, lint, knip, typecheck, tests, react compiler).BrowserDocumentFrame.browser.test.tsx, new case: the page cannot readparent.documentorlocalStorage, at3.sendwithout a click is refused and sends nothing, and a real click in the frame sends the formatted text once. The case fails when the click gate is removed.packages/shared/src/htmlRender.test.ts, new case: text trimming, data as a JSON block, refusals for empty text, too long text, and data that is not JSON.core.test.ts: thehtml_rendercase now also checks that a wrong key is refused and that the key fromhtml_guideworks.- The browser test also checks that a page
:root{--background:...}does not override the T3 token. It fails without:root:root. AgentContextBudget.test.ts,ClaudeAdapterV2.test.tspass.- End to end on a throwaway dev server with a real Claude Haiku thread (see Preview).
- Mobile is typechecked and passes the React Compiler check. It was not run on a device.
- Evals (
evals/mcp-tool-use) were not run: no API keys on this machine.
Scope affected
html_render pages on web, desktop, and mobile, and the T3 MCP tool list. MCP apps and their ui/message path are not changed. Shared guest pages cannot send (no send handler there). Pages published before this change have no t3.send, because the bootstrap goes in at publish time.
Reasoning
- I extended
html_renderand did not add arender_uitool. Sandbox (opaque origin, noallow-same-origin), theme injection with live theme changes, height fitting, and persistence as a thread attachment already exist there. - The page always sends a new user message. It does not answer a pending tool call. A queued message is visible, survives reloads, and works the same for all providers. A waiting tool would block the turn and need per-provider timeouts.
- On web there is no confirm dialog per send. The click gate stops sends on load or from timers, and the user sees the message in the thread. Mobile confirms because WebViews have no activation signal.
- Network access from pages stays as it was for
html_render(remote URLs load). The opaque origin keeps the page out of the app session.
Summary by cubic
HTML pages rendered in threads can now send replies back to the thread. A page calls t3.send(text, data) and the text, with optional JSON data as a block, goes in as an ordinary user message that starts the next turn.
- On web and desktop, sends are only accepted right after a click or key press inside the page; on mobile, T3 Code asks before each message.
- The design and reply guide moves into a new read-only
html_guideMCP tool, andhtml_rendernow requires the key it returns, so agents must callhtml_guidebefore their first page. - The guide pushes diagram-led, single-idea pages and sets text sizes; T3 theme tokens now win over a page's own
:rootcopies. - The visuals instruction now tells agents when a page beats text: charts for trends, diagrams or clickable steps for linked parts, and controls for a choice, not for brief or one-part answers. This trims the agent context budget; a new eval case checks it.
- Pages published before this change have no
t3.send, because the bootstrap goes in at publish time.