Repository navigation
Artifacts: dashboards and small apps agents build and you change by chatting - #238
Merged
Merged
Conversation
…hatting Agents build a small web app (one HTML document plus JSON data) with artifact_create and change it with artifact_update. It opens next to the chat in a sandboxed frame served by the core, with a window.godmode bridge for data, saving, asking the agent and the theme. Versions with restore, refresh through the artifact's chat, an Artifacts page with live previews and starters, and a full-screen view with a line to ask for changes.
…evice groups - godmode.refresh() and godmode.ask() from the artifact's code wait for the human's click, one at a time and not while the agent works; text from the page reaches the agent marked as such, errors fenced as data - Refresh skips while the agent already works in the chat; the refresh instructions are visible and editable - setData calls close together become one save, and older data no longer flows back into the app - Links open in the default browser, no modal dialogs in the sandbox, CSP in the downloaded copy - artifacts and artifact_versions are shared within a device group; a chat that moved to a runner gets a new local chat - Owner-less artifacts are for managers only, a data save needs data, gallery tiles load when they scroll into view
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.
Artifacts: dashboards and small apps you change by chatting
Agents can now build small web apps, like a sales dashboard, a KPI tracker, a deal board or a price calculator, as artifacts. An artifact opens next to the chat, you use it right there, and you change it by writing to the agent. Every code change is a version you can go back to. Refresh asks the agent to fetch fresh data.
Core
artifacts(current HTML, JSON data, version, refresh prompt, pin, agent, chat, workspace) andartifact_versions(the code of the last 50 versions with a note). Both are shared in device groups, move with their workspace, and are included in backups.artifact_create,artifact_update(wholehtmlor exact find/replaceedits,data,refreshPrompt,note),artifact_get,artifact_list. Agents change their own artifacts, managers anyone's. The system prompt gets an Artifacts section./api/artifacts: list, get, patch (title, pin, refresh instructions),PUT /data(saves from the app), versions, restore,message(to the artifact's chat, or a new chat when that one is gone or on a runner),refresh(skipped while the agent already works there),start(new chat that builds one). All routes are classified for Godmode Cloud.GET /api/artifacts/frameserves a page with no data. Its own CSP makes it a sandbox with an opaque origin: scripts, styles and fonts from https CDNs,connect-src https: wss:(never the core), no same-origin, no modals,form-action 'none'. The app posts the document into it. Asrcdocframe wouldn't work, because it inherits the app'sscript-src 'self'. Tauri CSP getsframe-srcfor the local core.App
window.godmode):data,onData,setData(saves close together are coalesced, with no stale echo),askandrefresh(both wait for the human's click, and the agent is told the text came from the page),theme/onThemeand--gm-*CSS variables for light and dark. Links open in the default browser. Script errors show a bar that asks the agent to fix them, with the error passed as fenced data./artifacts/:idshows one artifact full screen with a line to ask for changes.Tests
packages/core/test/artifacts.test.ts(16 tests): tools, edits, versions and pruning, ownership, the HTTP routes, change requests and refresh through the chat, a refresh skipped while the agent is busy, a fallback chat, the sandbox page headers, and a real run whoseartifact_createcall lands in the chat (newARTIFACT_FROM:directive in the fake Claude).maintoo (maintenance, mods x2, tool updates x2).askshows the confirm bar.setDatacalls become one save.localStorageand fetches to the core are blocked inside the frame.