Repository navigation
feat: a design area where each bot's screens take shape live - #33
Merged
Merged
Conversation
Every .html file a bot makes in its folders is a screen. While the model writes a Write of one, Claude Code streams its input; the daemon reads the partial JSON, keeps a draft of the file and sends screen.draft to the apps at most every 250 ms, until the tool result gives way to the file on disk. GET /view/<key>/<root>/<path> serves screens, drafts and the files next to them, with a per-bot key that lives only in memory and a CSP sandbox that gives every page an opaque origin. screens.list lists them with their address and the device a file asks for. The bot's rules tell it about its browser and the design area. Spec: new section 22.
The app shows it next to "Writing…": a page's head and styles come first and draw nothing, so the size says the bot is at work.
A Screens button in the bot's header opens a dotted board with every HTML screen the bot made, drawn at a computer, tablet or phone size and scaled by the board's zoom. The one being written glows in the bot's color with its size so far, and each new version loads behind the one on show and swaps in when ready, so it grows without flickering. The area opens by itself when the bot starts drawing and nothing else is open. A click opens a screen on its own, alive, with its device, Open and Show in folder. Write and Edit lines of HTML files in the chat get a button to it. Screens load in sandboxed frames from the daemon's /view, which the Tauri CSP now allows. FakeBotloft has screens and drafts; the dev preview has a Designer drawing a bakery page. Texts in English, Portuguese and Spanish.
A Manual bot on Haiku drew a landing page that took shape before the owner allowed the write, and a denied write left the design area.
Merged
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.
What
The N4 from the browser work: a design area beside the chat where every HTML screen a bot makes shows up as an artboard and takes shape while the bot writes it (spec section 22).
Daemon (T1)
Writeof an.htmlfile, Claude Code streams the tool input (input_json_delta). The daemon reads the partial JSON (file_path, andcontentso far, unescaped), keeps a draft of the file and sendsscreen.draftto the apps, at most every 250 ms. When the tool result arrives (written, denied or failed), the draft ends and the address serves the file on disk again.GET /view/<key>/<root>/<path>serves screens, drafts and the files next to them (CSS, images). The per-bot key is random, lives in memory only and goes only to the app. Paths must stay inside the crew's work folder or the bot's folder. Every response carriesContent-Security-Policy: sandbox …, so pages run in an opaque origin, away from the daemon and the app.screens.listreturns the bot's HTML files, with their address and the device a file asks for (<meta name="botloft-device" content="mobile">). The bot's rules now describe its browser and the design area.App (T2)
frame-src http://127.0.0.1:*. Texts in English, Portuguese and Spanish.FakeBotlofthas screens and drafts, and the dev preview has a Designer drawing a bakery page.Tests
cargo test --workspace(245), clippy-D warnings, fmt,pnpm check(129).Writestreamed by theFakeRuntimebecomes a draft at/viewand then the file. Another test checks that/viewserves nothing outside the folders (.., hidden files, wrong key).Tested with the real Claude Code (2.1.284, Haiku, Manual mode)
The Claude desktop app's browser pane blocks frames to 127.0.0.1 (
ERR_BLOCKED_BY_CLIENT), so the preview was checked in a headless Edge instead.Still to try by hand: the design area inside the Tauri window (
pnpm tauri dev), which is the WebView2 CSP path.