@agent-native/core 0.129.1 → 0.130.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +78 -0
- package/corpus/core/docs/content/cloneable-saas.mdx +114 -0
- package/corpus/core/docs/content/creating-templates.mdx +28 -2
- package/corpus/core/docs/content/syncing-template-changes.mdx +7 -0
- package/corpus/core/docs/content/template-clips-developers.mdx +12 -5
- package/corpus/core/docs/content/template-dispatch-developers.mdx +1 -1
- package/corpus/core/docs/content/template-dispatch.mdx +1 -1
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/action-ui.ts +1 -0
- package/corpus/core/src/action.ts +5 -1
- package/corpus/core/src/agent/engine/ai-sdk-engine.ts +15 -5
- package/corpus/core/src/agent/harness/runner.ts +5 -0
- package/corpus/core/src/agent/production-agent.ts +33 -0
- package/corpus/core/src/agent/run-loop-with-resume.ts +5 -0
- package/corpus/core/src/agent/run-manager.ts +126 -1
- package/corpus/core/src/agent/thread-data-builder.ts +47 -2
- package/corpus/core/src/agent/types.ts +2 -0
- package/corpus/core/src/chat-threads/store.ts +4 -5
- package/corpus/core/src/cli/create.ts +1139 -65
- package/corpus/core/src/cli/design-connect.ts +3 -7
- package/corpus/core/src/cli/index.ts +5 -3
- package/corpus/core/src/cli/skills-content/design-visual-edit-skill.ts +83 -47
- package/corpus/core/src/client/AssistantChat.tsx +27 -16
- package/corpus/core/src/client/agent-chat-adapter.ts +24 -0
- package/corpus/core/src/client/blocks/library/wireframe-kit.tsx +17 -2
- package/corpus/core/src/client/chat/index.ts +1 -0
- package/corpus/core/src/client/chat/message-components.tsx +104 -1
- package/corpus/core/src/client/chat/run-recovery.tsx +15 -3
- package/corpus/core/src/client/chat/widgets/DataTableWidget.tsx +10 -29
- package/corpus/core/src/client/chat/widgets/WorkspaceFileWidget.tsx +71 -0
- package/corpus/core/src/client/chat/widgets/builtin-tool-renderers.tsx +22 -0
- package/corpus/core/src/client/chat/widgets/workspace-file-result.ts +49 -0
- package/corpus/core/src/client/embed-auth.ts +2 -0
- package/corpus/core/src/client/org/InvitationBanner.tsx +14 -1
- package/corpus/core/src/client/org/OrgSwitcher.tsx +23 -0
- package/corpus/core/src/client/org/TeamPage.tsx +130 -0
- package/corpus/core/src/client/org/WorkspaceNotice.tsx +85 -0
- package/corpus/core/src/client/org/hooks.ts +14 -0
- package/corpus/core/src/client/org/index.ts +2 -0
- package/corpus/core/src/client/resources/McpIntegrationDialog.tsx +27 -40
- package/corpus/core/src/client/resources/ResourcesPanel.tsx +134 -51
- package/corpus/core/src/client/resources/mcp-integration-catalog.ts +7 -0
- package/corpus/core/src/client/resources/use-resources.ts +6 -0
- package/corpus/core/src/client/use-action.ts +3 -1
- package/corpus/core/src/client/widgets/index.ts +1 -0
- package/corpus/core/src/coding-tools/run-code.ts +2 -1
- package/corpus/core/src/db/client.ts +28 -4
- package/corpus/core/src/deploy/build.ts +31 -3
- package/corpus/core/src/eject/remote-mcp-presets.ts +1 -1
- package/corpus/core/src/index.browser.ts +1 -0
- package/corpus/core/src/index.ts +1 -0
- package/corpus/core/src/integrations/google-docs-poller.ts +3 -0
- package/corpus/core/src/integrations/webhook-handler.ts +28 -11
- package/corpus/core/src/jobs/scheduler.ts +4 -0
- package/corpus/core/src/localization/default-messages.ts +3 -2
- package/corpus/core/src/mcp/build-server.ts +20 -2
- package/corpus/core/src/observability/traces.ts +48 -12
- package/corpus/core/src/org/handlers.ts +52 -1
- package/corpus/core/src/org/migrations.ts +4 -0
- package/corpus/core/src/org/plugin.ts +14 -0
- package/corpus/core/src/org/schema.ts +1 -0
- package/corpus/core/src/org/types.ts +8 -0
- package/corpus/core/src/org/workspace-url.ts +74 -0
- package/corpus/core/src/resources/handlers.ts +35 -5
- package/corpus/core/src/scripts/runner.ts +183 -5
- package/corpus/core/src/server/action-routes.ts +32 -2
- package/corpus/core/src/server/agent-chat-plugin.ts +29 -0
- package/corpus/core/src/server/agent-teams.ts +10 -1
- package/corpus/core/src/server/auth.ts +33 -7
- package/corpus/core/src/server/embed-route.ts +9 -0
- package/corpus/core/src/server/embed-session.ts +62 -3
- package/corpus/core/src/server/open-route.ts +20 -6
- package/corpus/core/src/server/prompts/framework-core-compact.ts +1 -1
- package/corpus/core/src/server/prompts/framework-core.ts +1 -0
- package/corpus/core/src/server/request-context.ts +36 -1
- package/corpus/core/src/shared/embed-auth.ts +1 -0
- package/corpus/core/src/shared/html-document.ts +115 -0
- package/corpus/core/src/shared/index.ts +1 -0
- package/corpus/core/src/sharing/access.ts +8 -1
- package/corpus/core/src/sharing/registry.ts +11 -2
- package/corpus/core/src/workspace-files/actions.ts +100 -0
- package/corpus/core/src/workspace-files/tool.ts +4 -0
- package/corpus/templates/analytics/.agents/skills/analysis-workspace/SKILL.md +4 -0
- package/corpus/templates/analytics/.agents/skills/hubspot/SKILL.md +9 -1
- package/corpus/templates/analytics/AGENTS.md +17 -24
- package/corpus/templates/analytics/actions/data-source-status.ts +11 -1
- package/corpus/templates/analytics/app/i18n-data.ts +34 -0
- package/corpus/templates/analytics/app/lib/data-source-status.ts +86 -0
- package/corpus/templates/analytics/app/lib/native-mcp-exclusions.ts +9 -0
- package/corpus/templates/analytics/app/pages/DataSources.tsx +184 -20
- package/corpus/templates/analytics/changelog/2026-07-28-native-analytics-data-sources-no-longer-show-duplicate-mc.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-29-exports-now-appear-in-chat-with-a-direct-download-instead-of.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-29-queued-chat-prompts-no-longer-resend-after-analytics-navigat.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-29-scheduled-dashboard-emails-load-every-panel-reliably-without.md +6 -0
- package/corpus/templates/analytics/scripts/emit-netlify-dashboard-report-cron.ts +6 -3
- package/corpus/templates/analytics/server/lib/credential-keys.ts +1 -1
- package/corpus/templates/analytics/server/lib/hubspot.ts +1 -1
- package/corpus/templates/analytics/server/lib/provider-credentials.ts +55 -1
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +123 -27
- package/corpus/templates/analytics/server/routes/[...page].get.ts +2 -7
- package/corpus/templates/analytics/vite.config.ts +7 -0
- package/corpus/templates/brain/actions/list-connection-providers.ts +100 -2
- package/corpus/templates/brain/app/lib/brain.ts +10 -0
- package/corpus/templates/brain/app/routes/sources.tsx +15 -4
- package/corpus/templates/brain/changelog/2026-07-29-brain-automatically-retries-failed-source-syncs-and-guides-y.md +6 -0
- package/corpus/templates/brain/jobs/process-ingest-queue.ts +13 -0
- package/corpus/templates/brain/server/jobs/sync-sources.ts +27 -22
- package/corpus/templates/brain/server/plugins/agent-chat.ts +2 -1
- package/corpus/templates/brain/server/routes/api/brain/queue/run.post.ts +7 -1
- package/corpus/templates/clips/AGENTS.md +1 -1
- package/corpus/templates/clips/actions/create-recording-agent-link.ts +11 -1
- package/corpus/templates/clips/actions/update-comment.ts +68 -0
- package/corpus/templates/clips/app/components/editor/editor-layout.tsx +0 -1
- package/corpus/templates/clips/app/components/player/comments-panel.tsx +221 -65
- package/corpus/templates/clips/app/components/player/video-player.tsx +101 -27
- package/corpus/templates/clips/app/i18n/en-US.ts +2 -1
- package/corpus/templates/clips/app/routes/bug-report.done.tsx +48 -27
- package/corpus/templates/clips/app/routes/bug-report.tsx +43 -4
- package/corpus/templates/clips/app/routes/record.tsx +2 -0
- package/corpus/templates/clips/changelog/2026-07-29-clip-playback-now-recovers-instead-of-getting-stuck-when-a-b.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-29-comments-can-now-be-edited-after-posting.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-29-download-actions-now-use-a-shorter-clearer-label.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-29-embedded-bug-reports-now-return-a-temporary-agent-readable.md +6 -0
- package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +1 -1
- package/corpus/templates/clips/desktop/src-tauri/src/system_audio.rs +21 -1
- package/corpus/templates/clips/shared/bug-report.ts +99 -0
- package/corpus/templates/content/actions/_content-database-personal-view.ts +7 -1
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +5 -2
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +20 -8
- package/corpus/templates/content/changelog/2026-07-29-missing-databases-no-longer-trigger-repeated-personal-view-e.md +6 -0
- package/corpus/templates/design/.agents/skills/visual-edit/SKILL.md +83 -47
- package/corpus/templates/design/.generated/bridge/editor-chrome.generated.ts +474 -55
- package/corpus/templates/design/.generated/bridge/embedded-wheel.generated.ts +3 -0
- package/corpus/templates/design/.generated/bridge/hit-test.generated.ts +18 -1
- package/corpus/templates/design/.generated/bridge/source-location.generated.ts +348 -0
- package/corpus/templates/design/actions/add-localhost-screens.ts +2 -7
- package/corpus/templates/design/actions/apply-visual-edit.ts +7 -1
- package/corpus/templates/design/actions/connect-localhost.ts +5 -9
- package/corpus/templates/design/actions/create-component.ts +16 -13
- package/corpus/templates/design/actions/grant-localhost-write-consent.ts +2 -7
- package/corpus/templates/design/actions/list-design-source-capabilities.ts +4 -7
- package/corpus/templates/design/actions/list-local-files.ts +26 -50
- package/corpus/templates/design/actions/list-localhost-connections.ts +2 -7
- package/corpus/templates/design/actions/migrate-board-objects-to-file.ts +2 -2
- package/corpus/templates/design/actions/open-visual-edit.ts +234 -135
- package/corpus/templates/design/actions/read-local-file.ts +26 -50
- package/corpus/templates/design/actions/request-localhost-write-consent.ts +2 -7
- package/corpus/templates/design/actions/write-local-file.ts +31 -73
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +307 -133
- package/corpus/templates/design/app/components/design/EditPanel.tsx +94 -22
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +137 -60
- package/corpus/templates/design/app/components/design/ResponsiveInteractBar.tsx +75 -14
- package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +755 -97
- package/corpus/templates/design/app/components/design/bridge/embedded-wheel.bridge.ts +8 -0
- package/corpus/templates/design/app/components/design/bridge/hit-test.bridge.ts +24 -1
- package/corpus/templates/design/app/components/design/bridge/source-location.bridge.ts +530 -0
- package/corpus/templates/design/app/components/design/code-workbench/CodeWorkbenchLoader.tsx +278 -0
- package/corpus/templates/design/app/components/design/code-workbench/editor/MonacoHost.tsx +32 -12
- package/corpus/templates/design/app/components/design/code-workbench/editor/monaco-setup.ts +14 -3
- package/corpus/templates/design/app/components/design/code-workbench/explorer/ExplorerView.tsx +87 -24
- package/corpus/templates/design/app/components/design/code-workbench/explorer/FileTree.tsx +36 -0
- package/corpus/templates/design/app/components/design/code-workbench/store.tsx +2 -1
- package/corpus/templates/design/app/components/design/code-workbench/workspace/localhost-provider.ts +48 -8
- package/corpus/templates/design/app/components/design/design-canvas/content-size-report.ts +3 -13
- package/corpus/templates/design/app/components/design/design-canvas/embedded-frame.ts +4 -2
- package/corpus/templates/design/app/components/design/design-canvas/hit-test.ts +3 -13
- package/corpus/templates/design/app/components/design/edit-panel/element-classification.ts +3 -1
- package/corpus/templates/design/app/components/design/edit-panel/inspect-code-source.ts +93 -0
- package/corpus/templates/design/app/components/design/multi-screen/board-surface-html.ts +4 -2
- package/corpus/templates/design/app/components/design/multi-screen/cross-screen-drop.ts +35 -0
- package/corpus/templates/design/app/components/design/multi-screen/iframe-targeting.ts +24 -0
- package/corpus/templates/design/app/components/design/multi-screen/types.ts +9 -0
- package/corpus/templates/design/app/components/design/types.ts +29 -0
- package/corpus/templates/design/app/components/layout/Layout.tsx +7 -4
- package/corpus/templates/design/app/hooks/use-navigation-state.ts +3 -0
- package/corpus/templates/design/app/i18n-data.ts +153 -46
- package/corpus/templates/design/app/i18n-responsive-interact.ts +12 -12
- package/corpus/templates/design/app/lib/design-editor-route.ts +23 -0
- package/corpus/templates/design/app/pages/VisualEdit.tsx +19 -6
- package/corpus/templates/design/app/pages/design-editor/action-error.ts +19 -0
- package/corpus/templates/design/app/pages/design-editor/canvas-primitive-insert.ts +29 -0
- package/corpus/templates/design/app/pages/design-editor/clone-and-pen-edit.ts +6 -0
- package/corpus/templates/design/app/pages/design-editor/code-layer-state.ts +277 -15
- package/corpus/templates/design/app/pages/design-editor/editor-state.ts +75 -9
- package/corpus/templates/design/app/pages/design-editor/layer-state-scope.ts +28 -0
- package/corpus/templates/design/app/pages/design-editor/live-screen-layer-drop.ts +41 -0
- package/corpus/templates/design/app/pages/design-editor/pending-edits.ts +496 -41
- package/corpus/templates/design/app/pages/design-editor/pending-live-edit-unload-guard.ts +27 -0
- package/corpus/templates/design/app/pages/design-editor/pending-structure-verification.ts +10 -0
- package/corpus/templates/design/app/pages/design-editor/react-semantic-handoff.ts +168 -9
- package/corpus/templates/design/app/pages/design-editor/responsive-interact.ts +41 -3
- package/corpus/templates/design/app/pages/design-editor/screen-command-utils.ts +5 -0
- package/corpus/templates/design/app/pages/design-editor/selection-state.ts +42 -13
- package/corpus/templates/design/app/pages/design-editor/source-location.ts +180 -0
- package/corpus/templates/design/app/pages/design-editor/tool-state.ts +17 -0
- package/corpus/templates/design/app/public-routes.ts +1 -0
- package/corpus/templates/design/app/routes/visual-edit.$id.tsx +15 -0
- package/corpus/templates/design/changelog/2026-06-29-screen-overview-is-easier-to-find-and-named-screens-open-dir.md +1 -1
- package/corpus/templates/design/changelog/2026-07-28-deleting-a-selected-element-now-removes-it-from-the-live-pre.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-deleting-an-element-on-a-connected-localhost-screen-now-queu.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-interact-mode-now-shows-a-responsive-device-preview-with-pre.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-layer-hide-and-lock-now-apply-to-the-live-preview-instead-of.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-layers-panel-selections-on-a-connected-localhost-screen-can-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-locked-layers-now-show-a-subtle-dashed-outline-in-the-live-p.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-the-apply-design-updates-button-now-counts-pending-live-text.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-the-design-canvas-no-longer-stalls-on-a-render-loop-while-a-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-visual-edit-on-a-local-dev-server-no-longer-requires-signing.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-visual-edits-on-a-react-19-app-no-longer-report-a-source-lin.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-an-edit-that-cannot-be-written-to-source-now-names-the-reaso.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-applying-a-primitive-dropped-onto-a-connected-localhost-scre.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-changing-a-style-in-the-inspector-now-updates-a-connected-lo.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-choosing-edit-or-annotate-from-a-focused-screen-now-returns-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-concurrent-source-edits-now-return-a-clear-conflict-response.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-creating-a-component-from-an-element-that-repeats-in-the-sou.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-deleting-an-element-you-just-dropped-onto-a-live-screen-no-l.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-dragging-a-layer-across-screens-no-longer-dies-when-the-poin.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-dragging-an-element-from-a-stored-screen-into-a-live-localho.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-drawing-a-box-on-the-canvas-and-dragging-it-into-a-connected.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-fixed-a-loading-screen-flicker-when-reopening-designs-with-a.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-interact-mode-has-edit-and-annotate-buttons-again-so-you-can.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-layer-groups-can-be-dropped-onto-live-localhost-screens.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-localhost-source-errors-now-say-what-actually-went-wrong-whi.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-opening-or-refreshing-a-live-localhost-screen-in-single-scre.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-redo-after-undoing-a-drop-onto-a-live-screen-puts-the-elemen.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-shapes-can-be-drawn-directly-onto-live-localhost-screens.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-shapes-drawn-on-the-canvas-board-now-appear-immediately-inst.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-style-edits-on-a-running-localhost-screen-now-preview-live-a.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-the-apply-design-updates-control-now-appears-as-a-clean-conn.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-visual-edits-on-a-mapped-component-instance-now-tell-the-age.md +6 -0
- package/corpus/templates/design/server/lib/design-data-access.ts +21 -7
- package/corpus/templates/design/server/lib/localhost-connection.ts +240 -0
- package/corpus/templates/design/server/routes/[...page].get.ts +2 -5
- package/corpus/templates/design/server/source-workspace.ts +2 -0
- package/corpus/templates/design/shared/code-layer.ts +43 -0
- package/corpus/templates/design/shared/html-content.ts +26 -0
- package/corpus/templates/design/shared/html-integrity.ts +21 -1
- package/corpus/templates/design/shared/local-jsx-visual-edit.ts +15 -0
- package/corpus/templates/design/shared/source-mode.ts +76 -0
- package/corpus/templates/dispatch/changelog/2026-07-29-workspace-members-without-admin-access-now-see-a-clear-permi.md +6 -0
- package/corpus/templates/dispatch/server/lib/usage-metrics.ts +2 -1
- package/corpus/templates/plan/app/lib/plan-annotation-runtime.ts +3 -4
- package/corpus/templates/plan/server/routes/[...page].get.ts +2 -5
- package/corpus/templates/slides/actions/patch-deck.ts +29 -17
- package/corpus/toolkit/CHANGELOG.md +6 -0
- package/corpus/toolkit/package.json +1 -1
- package/corpus/toolkit/src/composer/ComposerPlusMenu.tsx +3 -2
- package/dist/action-ui.d.ts +1 -0
- package/dist/action-ui.d.ts.map +1 -1
- package/dist/action-ui.js +1 -0
- package/dist/action-ui.js.map +1 -1
- package/dist/action.d.ts +5 -1
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js.map +1 -1
- package/dist/agent/engine/ai-sdk-engine.d.ts.map +1 -1
- package/dist/agent/engine/ai-sdk-engine.js +13 -5
- package/dist/agent/engine/ai-sdk-engine.js.map +1 -1
- package/dist/agent/harness/runner.d.ts.map +1 -1
- package/dist/agent/harness/runner.js +5 -0
- package/dist/agent/harness/runner.js.map +1 -1
- package/dist/agent/production-agent.d.ts +16 -0
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +18 -1
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-loop-with-resume.d.ts.map +1 -1
- package/dist/agent/run-loop-with-resume.js +6 -0
- package/dist/agent/run-loop-with-resume.js.map +1 -1
- package/dist/agent/run-manager.d.ts +14 -0
- package/dist/agent/run-manager.d.ts.map +1 -1
- package/dist/agent/run-manager.js +91 -1
- package/dist/agent/run-manager.js.map +1 -1
- package/dist/agent/thread-data-builder.d.ts +3 -0
- package/dist/agent/thread-data-builder.d.ts.map +1 -1
- package/dist/agent/thread-data-builder.js +35 -3
- package/dist/agent/thread-data-builder.js.map +1 -1
- package/dist/agent/types.d.ts +2 -0
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/chat-threads/store.d.ts.map +1 -1
- package/dist/chat-threads/store.js +4 -6
- package/dist/chat-threads/store.js.map +1 -1
- package/dist/cli/create.d.ts +66 -6
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +765 -66
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/design-connect.d.ts.map +1 -1
- package/dist/cli/design-connect.js +2 -7
- package/dist/cli/design-connect.js.map +1 -1
- package/dist/cli/index.js +5 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/skills-content/design-visual-edit-skill.d.ts +1 -1
- package/dist/cli/skills-content/design-visual-edit-skill.d.ts.map +1 -1
- package/dist/cli/skills-content/design-visual-edit-skill.js +83 -47
- package/dist/cli/skills-content/design-visual-edit-skill.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +16 -9
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +21 -0
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/blocks/library/wireframe-kit.d.ts +2 -0
- package/dist/client/blocks/library/wireframe-kit.d.ts.map +1 -1
- package/dist/client/blocks/library/wireframe-kit.js +8 -2
- package/dist/client/blocks/library/wireframe-kit.js.map +1 -1
- package/dist/client/chat/index.d.ts +1 -1
- package/dist/client/chat/index.d.ts.map +1 -1
- package/dist/client/chat/index.js +1 -1
- package/dist/client/chat/index.js.map +1 -1
- package/dist/client/chat/message-components.d.ts +17 -0
- package/dist/client/chat/message-components.d.ts.map +1 -1
- package/dist/client/chat/message-components.js +24 -2
- package/dist/client/chat/message-components.js.map +1 -1
- package/dist/client/chat/run-recovery.d.ts +6 -0
- package/dist/client/chat/run-recovery.d.ts.map +1 -1
- package/dist/client/chat/run-recovery.js +13 -3
- package/dist/client/chat/run-recovery.js.map +1 -1
- package/dist/client/chat/widgets/DataTableWidget.d.ts.map +1 -1
- package/dist/client/chat/widgets/DataTableWidget.js +2 -3
- package/dist/client/chat/widgets/DataTableWidget.js.map +1 -1
- package/dist/client/chat/widgets/WorkspaceFileWidget.d.ts +5 -0
- package/dist/client/chat/widgets/WorkspaceFileWidget.d.ts.map +1 -0
- package/dist/client/chat/widgets/WorkspaceFileWidget.js +34 -0
- package/dist/client/chat/widgets/WorkspaceFileWidget.js.map +1 -0
- package/dist/client/chat/widgets/builtin-tool-renderers.d.ts.map +1 -1
- package/dist/client/chat/widgets/builtin-tool-renderers.js +13 -1
- package/dist/client/chat/widgets/builtin-tool-renderers.js.map +1 -1
- package/dist/client/chat/widgets/workspace-file-result.d.ts +12 -0
- package/dist/client/chat/widgets/workspace-file-result.d.ts.map +1 -0
- package/dist/client/chat/widgets/workspace-file-result.js +34 -0
- package/dist/client/chat/widgets/workspace-file-result.js.map +1 -0
- package/dist/client/embed-auth.d.ts.map +1 -1
- package/dist/client/embed-auth.js +2 -1
- package/dist/client/embed-auth.js.map +1 -1
- package/dist/client/org/InvitationBanner.d.ts +5 -2
- package/dist/client/org/InvitationBanner.d.ts.map +1 -1
- package/dist/client/org/InvitationBanner.js +9 -2
- package/dist/client/org/InvitationBanner.js.map +1 -1
- package/dist/client/org/OrgSwitcher.d.ts.map +1 -1
- package/dist/client/org/OrgSwitcher.js +3 -2
- package/dist/client/org/OrgSwitcher.js.map +1 -1
- package/dist/client/org/TeamPage.d.ts.map +1 -1
- package/dist/client/org/TeamPage.js +27 -3
- package/dist/client/org/TeamPage.js.map +1 -1
- package/dist/client/org/WorkspaceNotice.d.ts +18 -0
- package/dist/client/org/WorkspaceNotice.d.ts.map +1 -0
- package/dist/client/org/WorkspaceNotice.js +56 -0
- package/dist/client/org/WorkspaceNotice.js.map +1 -0
- package/dist/client/org/hooks.d.ts +1 -0
- package/dist/client/org/hooks.d.ts.map +1 -1
- package/dist/client/org/hooks.js +12 -0
- package/dist/client/org/hooks.js.map +1 -1
- package/dist/client/org/index.d.ts +2 -1
- package/dist/client/org/index.d.ts.map +1 -1
- package/dist/client/org/index.js +2 -1
- package/dist/client/org/index.js.map +1 -1
- package/dist/client/resources/McpIntegrationDialog.d.ts.map +1 -1
- package/dist/client/resources/McpIntegrationDialog.js +8 -12
- package/dist/client/resources/McpIntegrationDialog.js.map +1 -1
- package/dist/client/resources/ResourcesPanel.d.ts +3 -0
- package/dist/client/resources/ResourcesPanel.d.ts.map +1 -1
- package/dist/client/resources/ResourcesPanel.js +49 -20
- package/dist/client/resources/ResourcesPanel.js.map +1 -1
- package/dist/client/resources/mcp-integration-catalog.d.ts +1 -0
- package/dist/client/resources/mcp-integration-catalog.d.ts.map +1 -1
- package/dist/client/resources/mcp-integration-catalog.js +3 -0
- package/dist/client/resources/mcp-integration-catalog.js.map +1 -1
- package/dist/client/resources/use-resources.d.ts +1 -0
- package/dist/client/resources/use-resources.d.ts.map +1 -1
- package/dist/client/resources/use-resources.js +3 -0
- package/dist/client/resources/use-resources.js.map +1 -1
- package/dist/client/use-action.d.ts +3 -1
- package/dist/client/use-action.d.ts.map +1 -1
- package/dist/client/use-action.js +3 -1
- package/dist/client/use-action.js.map +1 -1
- package/dist/client/widgets/index.d.ts +1 -1
- package/dist/client/widgets/index.d.ts.map +1 -1
- package/dist/client/widgets/index.js +1 -1
- package/dist/client/widgets/index.js.map +1 -1
- package/dist/coding-tools/run-code.js +2 -1
- package/dist/coding-tools/run-code.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/db/client.d.ts +1 -0
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +24 -3
- package/dist/db/client.js.map +1 -1
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +25 -3
- package/dist/deploy/build.js.map +1 -1
- package/dist/eject/remote-mcp-presets.js +1 -1
- package/dist/eject/remote-mcp-presets.js.map +1 -1
- package/dist/index.browser.d.ts +1 -1
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +1 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/integrations/google-docs-poller.d.ts.map +1 -1
- package/dist/integrations/google-docs-poller.js +4 -1
- package/dist/integrations/google-docs-poller.js.map +1 -1
- package/dist/integrations/webhook-handler.d.ts.map +1 -1
- package/dist/integrations/webhook-handler.js +23 -11
- package/dist/integrations/webhook-handler.js.map +1 -1
- package/dist/jobs/scheduler.js +4 -0
- package/dist/jobs/scheduler.js.map +1 -1
- package/dist/localization/default-messages.d.ts +3 -2
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +3 -2
- package/dist/localization/default-messages.js.map +1 -1
- package/dist/mcp/build-server.d.ts.map +1 -1
- package/dist/mcp/build-server.js +10 -1
- package/dist/mcp/build-server.js.map +1 -1
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/observability/traces.d.ts.map +1 -1
- package/dist/observability/traces.js +27 -7
- package/dist/observability/traces.js.map +1 -1
- package/dist/org/handlers.d.ts +15 -0
- package/dist/org/handlers.d.ts.map +1 -1
- package/dist/org/handlers.js +45 -1
- package/dist/org/handlers.js.map +1 -1
- package/dist/org/migrations.d.ts.map +1 -1
- package/dist/org/migrations.js +4 -0
- package/dist/org/migrations.js.map +1 -1
- package/dist/org/plugin.d.ts +1 -0
- package/dist/org/plugin.d.ts.map +1 -1
- package/dist/org/plugin.js +10 -1
- package/dist/org/plugin.js.map +1 -1
- package/dist/org/schema.d.ts +19 -0
- package/dist/org/schema.d.ts.map +1 -1
- package/dist/org/schema.js +1 -0
- package/dist/org/schema.js.map +1 -1
- package/dist/org/types.d.ts +8 -0
- package/dist/org/types.d.ts.map +1 -1
- package/dist/org/types.js.map +1 -1
- package/dist/org/workspace-url.d.ts +32 -0
- package/dist/org/workspace-url.d.ts.map +1 -0
- package/dist/org/workspace-url.js +63 -0
- package/dist/org/workspace-url.js.map +1 -0
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +11 -11
- package/dist/provider-api/actions/provider-api.d.ts +7 -7
- package/dist/resources/handlers.d.ts +2 -3
- package/dist/resources/handlers.d.ts.map +1 -1
- package/dist/resources/handlers.js +25 -5
- package/dist/resources/handlers.js.map +1 -1
- package/dist/scripts/runner.d.ts +17 -0
- package/dist/scripts/runner.d.ts.map +1 -1
- package/dist/scripts/runner.js +130 -5
- package/dist/scripts/runner.js.map +1 -1
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/action-routes.d.ts.map +1 -1
- package/dist/server/action-routes.js +24 -2
- package/dist/server/action-routes.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +26 -1
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/agent-teams.d.ts.map +1 -1
- package/dist/server/agent-teams.js +10 -1
- package/dist/server/agent-teams.js.map +1 -1
- package/dist/server/auth.d.ts +22 -0
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +33 -7
- package/dist/server/auth.js.map +1 -1
- package/dist/server/embed-route.d.ts.map +1 -1
- package/dist/server/embed-route.js +6 -1
- package/dist/server/embed-route.js.map +1 -1
- package/dist/server/embed-session.d.ts +7 -0
- package/dist/server/embed-session.d.ts.map +1 -1
- package/dist/server/embed-session.js +46 -4
- package/dist/server/embed-session.js.map +1 -1
- package/dist/server/open-route.d.ts.map +1 -1
- package/dist/server/open-route.js +17 -7
- package/dist/server/open-route.js.map +1 -1
- package/dist/server/prompts/framework-core-compact.js +1 -1
- package/dist/server/prompts/framework-core-compact.js.map +1 -1
- package/dist/server/prompts/framework-core.d.ts.map +1 -1
- package/dist/server/prompts/framework-core.js +1 -0
- package/dist/server/prompts/framework-core.js.map +1 -1
- package/dist/server/request-context.d.ts +26 -0
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/request-context.js +18 -1
- package/dist/server/request-context.js.map +1 -1
- package/dist/shared/embed-auth.d.ts +1 -0
- package/dist/shared/embed-auth.d.ts.map +1 -1
- package/dist/shared/embed-auth.js +1 -0
- package/dist/shared/embed-auth.js.map +1 -1
- package/dist/shared/html-document.d.ts +12 -0
- package/dist/shared/html-document.d.ts.map +1 -0
- package/dist/shared/html-document.js +92 -0
- package/dist/shared/html-document.js.map +1 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +1 -0
- package/dist/shared/index.js.map +1 -1
- package/dist/sharing/access.d.ts +1 -0
- package/dist/sharing/access.d.ts.map +1 -1
- package/dist/sharing/access.js +8 -2
- package/dist/sharing/access.js.map +1 -1
- package/dist/sharing/registry.d.ts +3 -0
- package/dist/sharing/registry.d.ts.map +1 -1
- package/dist/sharing/registry.js.map +1 -1
- package/dist/workspace-files/actions.d.ts +28 -0
- package/dist/workspace-files/actions.d.ts.map +1 -0
- package/dist/workspace-files/actions.js +75 -0
- package/dist/workspace-files/actions.js.map +1 -0
- package/dist/workspace-files/tool.d.ts.map +1 -1
- package/dist/workspace-files/tool.js +4 -0
- package/dist/workspace-files/tool.js.map +1 -1
- package/docs/content/cloneable-saas.mdx +114 -0
- package/docs/content/creating-templates.mdx +28 -2
- package/docs/content/syncing-template-changes.mdx +7 -0
- package/docs/content/template-clips-developers.mdx +12 -5
- package/docs/content/template-dispatch-developers.mdx +1 -1
- package/docs/content/template-dispatch.mdx +1 -1
- package/package.json +2 -2
- package/src/action-ui.ts +1 -0
- package/src/action.ts +5 -1
- package/src/agent/engine/ai-sdk-engine.ts +15 -5
- package/src/agent/harness/runner.ts +5 -0
- package/src/agent/production-agent.ts +33 -0
- package/src/agent/run-loop-with-resume.ts +5 -0
- package/src/agent/run-manager.ts +126 -1
- package/src/agent/thread-data-builder.ts +47 -2
- package/src/agent/types.ts +2 -0
- package/src/chat-threads/store.ts +4 -5
- package/src/cli/create.ts +1139 -65
- package/src/cli/design-connect.ts +3 -7
- package/src/cli/index.ts +5 -3
- package/src/cli/skills-content/design-visual-edit-skill.ts +83 -47
- package/src/client/AssistantChat.tsx +27 -16
- package/src/client/agent-chat-adapter.ts +24 -0
- package/src/client/blocks/library/wireframe-kit.tsx +17 -2
- package/src/client/chat/index.ts +1 -0
- package/src/client/chat/message-components.tsx +104 -1
- package/src/client/chat/run-recovery.tsx +15 -3
- package/src/client/chat/widgets/DataTableWidget.tsx +10 -29
- package/src/client/chat/widgets/WorkspaceFileWidget.tsx +71 -0
- package/src/client/chat/widgets/builtin-tool-renderers.tsx +22 -0
- package/src/client/chat/widgets/workspace-file-result.ts +49 -0
- package/src/client/embed-auth.ts +2 -0
- package/src/client/org/InvitationBanner.tsx +14 -1
- package/src/client/org/OrgSwitcher.tsx +23 -0
- package/src/client/org/TeamPage.tsx +130 -0
- package/src/client/org/WorkspaceNotice.tsx +85 -0
- package/src/client/org/hooks.ts +14 -0
- package/src/client/org/index.ts +2 -0
- package/src/client/resources/McpIntegrationDialog.tsx +27 -40
- package/src/client/resources/ResourcesPanel.tsx +134 -51
- package/src/client/resources/mcp-integration-catalog.ts +7 -0
- package/src/client/resources/use-resources.ts +6 -0
- package/src/client/use-action.ts +3 -1
- package/src/client/widgets/index.ts +1 -0
- package/src/coding-tools/run-code.ts +2 -1
- package/src/db/client.ts +28 -4
- package/src/deploy/build.ts +31 -3
- package/src/eject/remote-mcp-presets.ts +1 -1
- package/src/index.browser.ts +1 -0
- package/src/index.ts +1 -0
- package/src/integrations/google-docs-poller.ts +3 -0
- package/src/integrations/webhook-handler.ts +28 -11
- package/src/jobs/scheduler.ts +4 -0
- package/src/localization/default-messages.ts +3 -2
- package/src/mcp/build-server.ts +20 -2
- package/src/observability/traces.ts +48 -12
- package/src/org/handlers.ts +52 -1
- package/src/org/migrations.ts +4 -0
- package/src/org/plugin.ts +14 -0
- package/src/org/schema.ts +1 -0
- package/src/org/types.ts +8 -0
- package/src/org/workspace-url.ts +74 -0
- package/src/resources/handlers.ts +35 -5
- package/src/scripts/runner.ts +183 -5
- package/src/server/__snapshots__/agent-chat-plugin.surface.spec.ts.snap +2 -1
- package/src/server/action-routes.ts +32 -2
- package/src/server/agent-chat-plugin.ts +29 -0
- package/src/server/agent-teams.ts +10 -1
- package/src/server/auth.ts +33 -7
- package/src/server/embed-route.ts +9 -0
- package/src/server/embed-session.ts +62 -3
- package/src/server/open-route.ts +20 -6
- package/src/server/prompts/framework-core-compact.ts +1 -1
- package/src/server/prompts/framework-core.ts +1 -0
- package/src/server/request-context.ts +36 -1
- package/src/shared/embed-auth.ts +1 -0
- package/src/shared/html-document.ts +115 -0
- package/src/shared/index.ts +1 -0
- package/src/sharing/access.ts +8 -1
- package/src/sharing/registry.ts +11 -2
- package/src/workspace-files/actions.ts +100 -0
- package/src/workspace-files/tool.ts +4 -0
- package/corpus/templates/design/changelog/2026-07-28-interact-mode-can-preview-designs-in-responsive-device-sizes.md +0 -6
- package/corpus/templates/design/changelog/2026-07-28-interact-mode-now-opens-a-full-screen-responsive-preview-wit.md +0 -6
|
@@ -33,18 +33,15 @@ host renders it. The user gets the Design canvas beside the conversation, and
|
|
|
33
33
|
current host conversation through the standard MCP Apps message bridge. The
|
|
34
34
|
host may ask the user to confirm the current conversation or choose a new one.
|
|
35
35
|
|
|
36
|
-
Otherwise,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
- In
|
|
44
|
-
|
|
45
|
-
inside the app.
|
|
46
|
-
- In Claude Code Desktop's Code tab, open or preview \`openUrl\` in the Browser
|
|
47
|
-
pane. Ask Claude to preview it rather than opening the system browser.
|
|
36
|
+
Otherwise, \`openUrl\` is a credential-free, read-only fallback that is safe to
|
|
37
|
+
show in model text or retain in logs. Do not claim that fallback is editable:
|
|
38
|
+
the edit capability is intentionally available only to the host-managed MCP App
|
|
39
|
+
launcher, where it is hidden from the model and redeemed once.
|
|
40
|
+
|
|
41
|
+
- In Codex Desktop, prefer the rendered MCP App. Use the in-app Browser for the
|
|
42
|
+
credential-free \`openUrl\` only when a read-only fallback is acceptable.
|
|
43
|
+
- In Claude Code Desktop's Code tab, prefer the rendered MCP App. Preview
|
|
44
|
+
\`openUrl\` in the Browser pane only as the read-only fallback.
|
|
48
45
|
- In VS Code, use the Agent Native Design webview/deep link described below.
|
|
49
46
|
- Inline browser availability is host-dependent. CLI, remote, or restricted
|
|
50
47
|
sessions may not expose one. If the inline surface is unavailable or disabled,
|
|
@@ -68,24 +65,41 @@ The same action is available from Design's empty-canvas context menu.
|
|
|
68
65
|
static DOM snapshot. Editing is direct DOM manipulation against that live
|
|
69
66
|
document; the parallel \`/snapshot\` fetch feeds the editable source model only
|
|
70
67
|
and must never be rendered in the frame.
|
|
71
|
-
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
- **The \`/visual-edit\` skill needs no Design account sign-in.**
|
|
69
|
+
\`open-visual-edit\` mints a five-minute, single-use capability for the exact
|
|
70
|
+
\`/visual-edit/:designId\` local-editor route. The MCP host redeems it outside
|
|
71
|
+
model-visible text, then opens the existing editor with localhost edit access.
|
|
72
|
+
This capability is not an account session: \`/_agent-native/session\` remains
|
|
73
|
+
signed out, and account-backed save/share/generate actions remain denied.
|
|
74
|
+
- The skill enters through local \`pnpm action open-visual-edit\`. When that CLI
|
|
75
|
+
has no account session, the action uses a stable, workspace-scoped local
|
|
76
|
+
principal to register the bridge, create/reuse the local design, and place
|
|
77
|
+
screens. That principal exists only inside the in-process CLI call; it is not
|
|
78
|
+
a browser login and cannot be selected by an HTTP, MCP, or tunneled caller.
|
|
79
|
+
- Public links are always read-only, including on loopback. Loopback peer
|
|
80
|
+
identity is not an authentication boundary because a tunnel or reverse proxy
|
|
81
|
+
can make a remote request appear local. A bare \`/visual-edit/:designId\` or
|
|
82
|
+
\`/design/:designId\` URL carries no capability and must never release the
|
|
83
|
+
connection's \`previewToken\`.
|
|
77
84
|
- The live editor is same-origin through the local bridge proxy. This boots
|
|
78
85
|
CSR apps and root-relative assets, but it is still a localhost editing proxy:
|
|
79
86
|
app-origin cookies, WebSockets/HMR, SSE, and non-GET app API calls may need a
|
|
80
87
|
future dev-server/plugin integration for perfect parity with the app's own
|
|
81
88
|
origin.
|
|
82
|
-
-
|
|
83
|
-
|
|
89
|
+
- **There are exactly two views.** The infinite canvas is where all editing
|
|
90
|
+
happens, and the responsive interactive view (Interact) is where the app runs
|
|
91
|
+
for real. There is no third "full view"/focused-edit state — clicking a screen
|
|
92
|
+
in the Screens list, or the view toggle, opens the responsive view, and
|
|
93
|
+
closing it returns to the canvas.
|
|
94
|
+
- Interact keeps the left and right rails and adds a device bar above the canvas
|
|
95
|
+
(device preset, editable width/height, zoom, close). It renders the app's
|
|
96
|
+
normal URL so navigation, scrolling, links, and form controls behave as they
|
|
97
|
+
would in the browser, and the wheel scrolls the app rather than panning the
|
|
98
|
+
canvas. The canvas view is the opposite: the wheel pans and zooms it, and
|
|
99
|
+
native interaction inside the frame is suppressed.
|
|
84
100
|
- While a localhost screen has pending live visual edits, do not switch back to
|
|
85
101
|
Interact until the user either applies the edits to source or explicitly
|
|
86
102
|
aborts/discards the preview.
|
|
87
|
-
- Start in Design's screen overview mode. In overview, screens are static
|
|
88
|
-
design frames; full-screen focus is for scrolling and app interaction.
|
|
89
103
|
- Alt-drag duplicates a screen. For localhost screens, duplication copies the
|
|
90
104
|
iframe frame and URL metadata; change the copy's path/query for a new state.
|
|
91
105
|
- Flow visualization is multiple URL states: \`/checkout?step=shipping\`,
|
|
@@ -147,18 +161,26 @@ content. For conversational resolution such as "apply the second one," call
|
|
|
147
161
|
|
|
148
162
|
## Account And Sharing Model
|
|
149
163
|
|
|
150
|
-
-
|
|
151
|
-
|
|
152
|
-
|
|
164
|
+
- \`/visual-edit/:id\` is the dedicated local-editor surface. The one-time
|
|
165
|
+
handoff returned by \`open-visual-edit\` opens it with edit access without a
|
|
166
|
+
Design login. A copied or bare \`/visual-edit/:id\` URL is read-only because it
|
|
167
|
+
does not carry the capability.
|
|
168
|
+
- The capability permits live iframe inspection and session-local edits,
|
|
169
|
+
undo/redo, **Apply design updates** through the connected host/local agent,
|
|
170
|
+
and **Copy prompt**. Those flows hand bounded source instructions back to the
|
|
171
|
+
coding agent; they do not silently persist account-owned Design data.
|
|
172
|
+
- Public \`/design/:id\` links stay read-only without a signed-in owner/editor
|
|
173
|
+
session. Never use the local capability to upgrade that ordinary sharing
|
|
174
|
+
surface.
|
|
153
175
|
- Prefer links returned by Design actions or \`/_agent-native/open\` deep links.
|
|
154
|
-
Do not surface URLs with \`_session=\` tokens
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
176
|
+
Do not surface URLs with \`_session=\` tokens or hand-build capability URLs.
|
|
177
|
+
- Do not attempt account-backed write actions with the browser capability. The
|
|
178
|
+
trusted local \`open-visual-edit\` CLI call may register its bridge, create or
|
|
179
|
+
reuse its workspace-owned local design, and place screens without an account.
|
|
180
|
+
Direct source-file action writes, generation, saving into an account, and
|
|
181
|
+
sharing still require an authenticated action caller. If a signed-out visitor
|
|
182
|
+
wants those durable account operations, send them through the framework
|
|
183
|
+
sign-in return flow first.
|
|
162
184
|
|
|
163
185
|
## Required Local Bridge
|
|
164
186
|
|
|
@@ -166,7 +188,7 @@ The live-edit bridge is unlocked by a shared secret (the "bridge token") that
|
|
|
166
188
|
must match on two sides: the local bridge process, and the user's connection row
|
|
167
189
|
in Design (which the browser reads to authorize \`/live-edit-bridge\`,
|
|
168
190
|
\`/read-file\`, \`/write-file\`). Get them to match by letting the
|
|
169
|
-
|
|
191
|
+
\`open-visual-edit\` action mint the token, then starting the
|
|
170
192
|
bridge with it. This is the only ordering that works for the remote-MCP flow —
|
|
171
193
|
the bridge cannot push its own token to the server without a CLI auth token, so
|
|
172
194
|
the server mints instead and the bridge adopts.
|
|
@@ -228,7 +250,7 @@ a timeout, check for a stale process (\`lsof -ti:7331\`) before retrying.
|
|
|
228
250
|
|
|
229
251
|
## Action Flow
|
|
230
252
|
|
|
231
|
-
Prefer the single
|
|
253
|
+
Prefer the single \`open-visual-edit\` action. It registers or
|
|
232
254
|
refreshes the localhost bridge connection, mints and stores the bridge token,
|
|
233
255
|
creates or reuses a Design project, places URL-backed screens, stores the active
|
|
234
256
|
visual-edit context, and navigates to overview mode in one call. This avoids
|
|
@@ -252,11 +274,13 @@ pnpm action open-visual-edit '{
|
|
|
252
274
|
\`\`\`
|
|
253
275
|
|
|
254
276
|
The action returns \`designId\`, \`connectionId\`, \`bridgeToken\`, \`screens\`,
|
|
255
|
-
\`urlPath\`, and \`openUrl\`.
|
|
256
|
-
|
|
257
|
-
the
|
|
258
|
-
|
|
259
|
-
|
|
277
|
+
\`urlPath\`, and a credential-free \`openUrl\`. Its MCP App metadata separately
|
|
278
|
+
carries the one-time editor launcher so the host can redeem it without showing
|
|
279
|
+
the capability to the model or retaining it in the action link. Keep
|
|
280
|
+
\`designId\`/\`connectionId\` in the chat context for follow-ups, and pass
|
|
281
|
+
\`bridgeToken\` to \`design connect\` (step 3) to start the bridge. On follow-up
|
|
282
|
+
calls reusing an existing \`connectionId\`, the same token is returned (it is
|
|
283
|
+
minted once and reused), so the running bridge stays valid.
|
|
260
284
|
|
|
261
285
|
### Desktop and mobile side by side
|
|
262
286
|
|
|
@@ -334,10 +358,11 @@ Fallback, only when \`open-visual-edit\` is unavailable:
|
|
|
334
358
|
|
|
335
359
|
- Use the \`link\`, \`deepLink\`, or MCP App embed returned by Design actions so
|
|
336
360
|
the user sees the canvas. Follow **Put Design Beside The Chat**: prefer the
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
-
|
|
340
|
-
|
|
361
|
+
MCP App; otherwise surface the credential-free **Open design** link.
|
|
362
|
+
- Return or open the MCP App first. Its host-managed launcher carries the
|
|
363
|
+
one-time local-editor capability. The credential-free \`openUrl\` / action link
|
|
364
|
+
is the safe read-only fallback; never build a capability URL yourself.
|
|
365
|
+
- Never return or open a hand-built \`/design/:id?_session=...\` URL.
|
|
341
366
|
- If the user is working in VS Code, the Agent Native extension can open the
|
|
342
367
|
same URL via
|
|
343
368
|
\`vscode://builder.agent-native/open?url=<encoded-design-url>\`. Its
|
|
@@ -407,13 +432,24 @@ the connected app's text/code files through the bridge
|
|
|
407
432
|
- Use compiler/debug provenance (project-relative file, line, column,
|
|
408
433
|
component, and runtime multiplicity) to locate React/TSX source. Treat it as
|
|
409
434
|
evidence, not as permission for a generic AST structural transform.
|
|
435
|
+
- Read \`positionPrecision\` on every anchor before you trust \`line\`/\`column\`.
|
|
436
|
+
\`authored\` means those are the real JSX coordinates. \`transformed\` means they
|
|
437
|
+
are the dev server's own output coordinates — React 19 removed \`_debugSource\`
|
|
438
|
+
and exposes only an owner stack, so this is the normal case on a Vite/Next
|
|
439
|
+
dev server, and the line will not match the file. \`unknown\` means no tier was
|
|
440
|
+
reported. On anything but \`authored\`, use the file and component to find the
|
|
441
|
+
element by its JSX shape and re-derive the line from the file you read; never
|
|
442
|
+
edit at the reported line.
|
|
410
443
|
- A single-instance leaf text edit, literal \`className\`/\`class\` edit, or flat
|
|
411
444
|
literal \`style={{ ... }}\` property may use \`apply-visual-edit\` with a
|
|
412
|
-
\`local-file\` source and
|
|
413
|
-
\`
|
|
445
|
+
\`local-file\` source and a complete \`target.sourceAnchor\`. Forward the
|
|
446
|
+
anchor's \`positionPrecision\` with it — the action refuses a \`transformed\`
|
|
447
|
+
anchor with \`status: "needsAgent"\` instead of seeking to a line that means
|
|
448
|
+
something else in the authored file. Preview first (omit \`persist\`), inspect
|
|
449
|
+
\`proposedDiff\`, then call with \`persist: true\`.
|
|
414
450
|
- Reparenting, grouping/ungrouping, wrappers, dynamic expressions, repeated
|
|
415
451
|
\`.map()\` instances, shared components, breakpoint-scoped edits, and
|
|
416
|
-
cross-file changes go through the coding agent with
|
|
452
|
+
cross-file changes go through the coding agent with complete subject/target
|
|
417
453
|
anchors and their runtime relationship. \`apply-visual-edit\` refuses these
|
|
418
454
|
with \`status: "needsAgent"\` rather than guessing.
|
|
419
455
|
- Before each write, read the file and pass its exact \`versionHash\` to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"design-visual-edit-skill.js","sourceRoot":"","sources":["../../../src/cli/skills-content/design-visual-edit-skill.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,2BAA2B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmb1C,CAAC","sourcesContent":["export const DESIGN_VISUAL_EDIT_SKILL_MD = `---\nname: visual-edit\ndescription: >-\n Open a running local app in Design overview mode as URL-backed iframe screens\n for visual editing, flow review, duplication, and route-state exploration.\n Use when the user asks to inspect, compare, or edit a real local app visually\n in Design.\nmetadata:\n visibility: exported\n---\n\n# Visual Edit\n\nUse \\`/visual-edit\\` when the user wants to inspect or edit a real local app\nvisually instead of generating standalone Alpine HTML. The source of truth is\nthe running localhost app plus its route URLs. Design shows those routes as\niframe-backed screens on the infinite canvas.\n\n## Installing this skill for an external MCP host\n\nThe hosted install path\n(\\`npx @agent-native/core@latest skills add visual-edit\\`, or \\`design\\` for the\nfull Design bundle) installs the exported instructions and registers the\nhosted Design MCP connector together. The open Skills CLI path\n(\\`npx skills@latest add BuilderIO/agent-native --skill visual-edit\\`) installs\nexported instructions only, with no MCP connector registration.\n\n## Put Design Beside The Chat\n\nPrefer the interactive MCP App returned by \\`open-visual-edit\\` when the coding\nhost renders it. The user gets the Design canvas beside the conversation, and\n**Apply design updates** can submit the bounded source-edit handoff back to the\ncurrent host conversation through the standard MCP Apps message bridge. The\nhost may ask the user to confirm the current conversation or choose a new one.\n\nOtherwise, after \\`open-visual-edit\\` returns \\`openUrl\\`, open that URL in the\ncoding host's inline browser when one is available. This still keeps Design\nbeside the conversation, but an ordinary browser page has no trusted path into\nthe host's current composer. In that fallback surface, **Apply design updates**\nuses Design's local agent; use **Copy prompt to your agent** to hand the same\nstructured edit batch to the coding agent.\n\n- In Codex Desktop, use the in-app Browser tool to open \\`openUrl\\`. The built-in\n browser is the right surface for localhost and public pages that should stay\n inside the app.\n- In Claude Code Desktop's Code tab, open or preview \\`openUrl\\` in the Browser\n pane. Ask Claude to preview it rather than opening the system browser.\n- In VS Code, use the Agent Native Design webview/deep link described below.\n- Inline browser availability is host-dependent. CLI, remote, or restricted\n sessions may not expose one. If the inline surface is unavailable or disabled,\n return the normal **Open design** link instead of claiming it opened.\n\nPrefer the MCP App surface for a connected Design plugin, then the host's\nbrowser/preview tool as the universal fallback. Keep the canvas beside chat\nwhen the host supports rearrangeable panes.\n\nInside Design, use **Show/Hide UI** from the \\`Cmd+K\\` menu or press Figma's\n\\`Shift+\\\\\\` shortcut to toggle all editing chrome so only the canvas remains.\nThe same action is available from Design's empty-canvas context menu.\n\n## Core Model\n\n- Each screen is a URL-backed iframe, not copied HTML.\n- Each screen keeps URL metadata: \\`connectionId\\`, \\`routeId\\`, \\`path\\`,\n \\`url\\`, \\`bridgeUrl\\`, title, and viewport size.\n- Localhost Edit mode renders the running app through the local bridge as a live\n iframe with the same editor bridge used by HTML designs. It is never a frozen\n static DOM snapshot. Editing is direct DOM manipulation against that live\n document; the parallel \\`/snapshot\\` fetch feeds the editable source model only\n and must never be rendered in the frame.\n- A viewer holding the connection's \\`previewToken\\` gets the proxied\n \\`/live-edit\\` document with editor chrome. A viewer without one — a signed-out\n session, a public link, or an inline browser with no cookies — gets the plain\n dev-server URL: still live, but with no editor chrome, no layers, and no\n editing. If the canvas looks right but selection and the layers panel do\n nothing, the frame is unbridged; sign in rather than assuming Design is broken.\n- The live editor is same-origin through the local bridge proxy. This boots\n CSR apps and root-relative assets, but it is still a localhost editing proxy:\n app-origin cookies, WebSockets/HMR, SSE, and non-GET app API calls may need a\n future dev-server/plugin integration for perfect parity with the app's own\n origin.\n- Interact mode renders the app's normal URL so app navigation, scrolling,\n links, and form controls behave as they would in the browser.\n- While a localhost screen has pending live visual edits, do not switch back to\n Interact until the user either applies the edits to source or explicitly\n aborts/discards the preview.\n- Start in Design's screen overview mode. In overview, screens are static\n design frames; full-screen focus is for scrolling and app interaction.\n- Alt-drag duplicates a screen. For localhost screens, duplication copies the\n iframe frame and URL metadata; change the copy's path/query for a new state.\n- Flow visualization is multiple URL states: \\`/checkout?step=shipping\\`,\n \\`/checkout?step=payment\\`, \\`/checkout?step=done\\`, etc.\n- When the user gives a named flow or numbered screen list, preserve that order\n and create one screen per URL/path. Shorthand like\n \\`localhost:1234/onboarding/1\\` means\n \\`http://localhost:1234/onboarding/1\\`.\n\n## Useful Canvas Sets\n\nTranslate the user's requested review into the smallest useful set of frames:\n\n- **Multi-step flow:** one ordered frame per route or query state, such as cart,\n shipping, payment, and confirmation.\n- **Multiple pages:** one frame per meaningful route, such as home, pricing,\n docs, and account settings.\n- **Responsive comparison:** repeat the same route at the requested desktop,\n tablet, and mobile viewports so they align in one row.\n- **State review:** repeat a route for meaningful URL-addressable states such as\n empty, loading, error, modal-open, or selected-item views.\n\nDo not expand every discovered route or every viewport unless the user asks for\nan exhaustive audit. Preserve the user's labels and sequence so the canvas reads\nlike the workflow they described.\n\n## Select And Reprompt\n\nWhen a chat message begins with \\`[Reprompt selection]\\`, the selected subtree is\na hard write boundary. The only mutation path is \\`propose-node-rewrite\\` with\nthe exact \\`repromptId\\`, target, and \\`baseVersionHash\\` captured in\n\\`design-reprompt-pending:<designId>:<fileId>\\`. Never use \\`apply-visual-edit\\`,\n\\`apply-source-edit\\`, \\`write-source\\`, \\`write-local-file\\`, \\`edit-design\\`, or any\nother content-writing action for that request. Clarifying questions are allowed,\nbut a requested change must remain a proposal.\n\nProduce one variant by default. Produce two or three only when the instruction\nasks for options. A retry includes \\`priorProposalId\\`; keep the same target and\nbase version, incorporate the feedback, and call \\`propose-node-rewrite\\` again.\nThe UI previews the returned subtree without persisting it.\n\nUse \\`resolve-node-rewrite\\` for the accept/reject lifecycle. Accept applies the\nchosen variant as one version-checked inline/Yjs content transaction so one\nundo restores the prior structure; reject clears the proposal without changing\ncontent. For conversational resolution such as \"apply the second one,\" call\n\\`view-screen\\`, read the active \\`design.reprompt.proposal\\`, and pass its\n\\`proposalId\\` plus the zero-based \\`variantIndex\\` to \\`resolve-node-rewrite\\`.\n\n## Review Quality\n\n- Treat the running app as the truth. Preserve its component language, tokens,\n route state, and real content unless the user explicitly asks for a new visual\n direction.\n- Use multiple URL states to reveal meaningful UX moments: empty/loading/error\n states, focused panels, modals, responsive breakpoints, and completed flow\n steps when those matter to the review.\n- For visual edits, compare before/after at the relevant viewport sizes and\n check key hover/focus/scroll states when the app exposes them.\n\n## Account And Sharing Model\n\n- The \\`/visual-edit\\` entry route can open before the viewer signs in. Public\n \\`/design/:id\\` editor links can also render read-only public designs without a\n session.\n- Prefer links returned by Design actions or \\`/_agent-native/open\\` deep links.\n Do not surface URLs with \\`_session=\\` tokens. Query sessions are only a\n fallback after normal cookie resolution, so an existing browser session can\n still open the design as a different user and show \"Design not found\".\n- Do not attempt anonymous write actions. Bridge registration, design creation,\n screen placement, generation, saving, and sharing are account-backed. If a\n signed-out visitor wants to save or share, send them through the framework\n sign-in return flow, then save or copy the design into that account before\n opening the share dialog.\n\n## Required Local Bridge\n\nThe live-edit bridge is unlocked by a shared secret (the \"bridge token\") that\nmust match on two sides: the local bridge process, and the user's connection row\nin Design (which the browser reads to authorize \\`/live-edit-bridge\\`,\n\\`/read-file\\`, \\`/write-file\\`). Get them to match by letting the\n**authenticated** \\`open-visual-edit\\` action mint the token, then starting the\nbridge with it. This is the only ordering that works for the remote-MCP flow —\nthe bridge cannot push its own token to the server without a CLI auth token, so\nthe server mints instead and the bridge adopts.\n\nFrom the target app repo, make sure its dev server is running, then:\n\n**1. Discover routes without starting a durable bridge** (one-shot, exits):\n\n\\`\\`\\`bash\nnpx @agent-native/core@latest design connect --url http://localhost:5173 --root . --json\n\\`\\`\\`\n\nThis prints the manifest (routes + capabilities). Parse it to build\n\\`routeManifest\\` for the next step. (Skip this if the user already gave explicit\npaths/URLs to place.)\n\nInside the agent-native monorepo itself, use the workspace CLI instead of\n\\`npx\\` — \\`npx\\` installs the last published \\`@agent-native/core\\`, which will not\ncontain local changes and costs a slow install on every call:\n\n\\`\\`\\`bash\npnpm dev:cli design connect --url http://localhost:5173 --root templates/<app> --json\n\\`\\`\\`\n\n**2. Call \\`open-visual-edit\\`** (see Action Flow below) with NO \\`bridgeToken\\`.\nThe server mints one, stores it on the user's connection row, copies it into the\nplaced screens' metadata, and returns it to you as \\`bridgeToken\\`. Capture it.\n\n**3. Start the persistent bridge adopting that token** (single line; prefer the\nenv var so the secret does not appear in \\`ps\\`):\n\n\\`\\`\\`bash\nAGENT_NATIVE_BRIDGE_TOKEN=\"<bridgeToken from step 2>\" npx @agent-native/core@latest design connect --url http://localhost:5173 --root . --daemon\n\\`\\`\\`\n\n(Equivalently, pass \\`--bridge-token <token>\\`.) This starts a detached bridge on\n\\`http://127.0.0.1:7331\\`, adopts the server-minted token — so bridge and row\nagree and live-edit authorizes with no self-registration — and stays alive after\nthe command exits.\n\nFor a manual health/manifest check on the running bridge:\n\n\\`\\`\\`bash\ncurl http://127.0.0.1:7331/health\n\\`\\`\\`\n\n\\`/health\\` needs no token. The full manifest at \\`/manifest.json\\` is\npreview-token protected, so an unauthenticated \\`curl\\` of it returns\n\\`{\"ok\":false,\"error\":\"invalid or missing preview token\"}\\` — that response means\nthe bridge is up, not that it is broken.\n\nOnly use \\`--json\\` for the step-1 route probe. Never use \\`--json\\`, \\`--once\\`,\nor \\`--dry-run\\` for the durable step-3 bridge: they print the manifest and exit,\nso Design falls back to a non-editable live iframe.\n\nThe bridge listens on a single fixed port (7331) and refuses to start for a\nsecond, different app. It is detached with no log file, so if \\`--daemon\\` reports\na timeout, check for a stale process (\\`lsof -ti:7331\\`) before retrying.\n\n## Action Flow\n\nPrefer the single authenticated \\`open-visual-edit\\` action. It registers or\nrefreshes the localhost bridge connection, mints and stores the bridge token,\ncreates or reuses a Design project, places URL-backed screens, stores the active\nvisual-edit context, and navigates to overview mode in one call. This avoids\ncreating a private design under a synthetic CLI user and then handing the browser\na tokenized URL that may be shadowed by an existing session.\n\nCall it BEFORE starting the durable bridge (step 3 above): it does not contact\nthe bridge, so the bridge need not be running yet, and you need its returned\n\\`bridgeToken\\` to start the bridge with a matching secret. Omit \\`bridgeToken\\`\non the call so the server mints one.\n\n\\`\\`\\`bash\npnpm action open-visual-edit '{\n \"title\": \"Docs homepage visual edit\",\n \"devServerUrl\": \"http://localhost:5173\",\n \"bridgeUrl\": \"http://127.0.0.1:7331\",\n \"rootPath\": \"/absolute/path/to/app\",\n \"routeManifest\": { \"...\": \"from /manifest.json\" },\n \"paths\": [\"/\", \"/pricing\", \"/checkout?step=payment\"]\n}'\n\\`\\`\\`\n\nThe action returns \\`designId\\`, \\`connectionId\\`, \\`bridgeToken\\`, \\`screens\\`,\n\\`urlPath\\`, and \\`openUrl\\`. Keep \\`designId\\`/\\`connectionId\\` in the chat context\nfor follow-ups, and pass \\`bridgeToken\\` to \\`design connect\\` (step 3) to start\nthe bridge. On follow-up calls reusing an existing \\`connectionId\\`, the same\ntoken is returned (it is minted once and reused), so the running bridge stays\nvalid.\n\n### Desktop and mobile side by side\n\nPass \\`viewports\\` to place every requested route once per viewport. Frames lay\nout as a grid: one row per route, one column per viewport. Presets are\n\\`desktop\\` (1280x900), \\`laptop\\` (1440x900), \\`tablet\\` (834x1112), and \\`mobile\\`\n(390x844); an explicit \\`{ \"label\": \"...\", \"width\": N, \"height\": N }\\` also works.\n\n\\`\\`\\`bash\npnpm action open-visual-edit '{\n \"title\": \"Tasks responsive visual edit\",\n \"devServerUrl\": \"http://localhost:5173\",\n \"bridgeUrl\": \"http://127.0.0.1:7331\",\n \"rootPath\": \"/absolute/path/to/app\",\n \"paths\": [\"/tasks\", \"/inbox\"],\n \"viewports\": [\"desktop\", \"mobile\"]\n}'\n\\`\\`\\`\n\nPrefer this over two separate calls with \\`defaultWidth\\`/\\`defaultHeight\\`: it\nkeeps each route's viewports aligned in a row and titles them\n\\`Tasks — Desktop\\` / \\`Tasks — Mobile\\` so the canvas reads clearly. \\`viewports\\`\noverrides \\`defaultWidth\\`/\\`defaultHeight\\`. With no \\`routes\\`/\\`paths\\`, it expands\nevery route in the localhost manifest, which is usually far more frames than\nthe user wants — name the paths.\n\n### Adding more page frames later\n\nCall \\`open-visual-edit\\` again with the same \\`designId\\` and \\`connectionId\\` and\nonly the new paths. Existing frames for the same route and viewport are\nrefreshed in place rather than duplicated, and a frame the user has dragged or\nresized keeps its position unless you explicitly pass \\`x\\`/\\`y\\`/\\`width\\`/\\`height\\`.\n\n\\`\\`\\`bash\npnpm action open-visual-edit '{\n \"designId\": \"<existing-design-id>\",\n \"connectionId\": \"<existing-connection-id>\",\n \"devServerUrl\": \"http://localhost:5173\",\n \"paths\": [\"/settings\", \"/team\"],\n \"startY\": 2200\n}'\n\\`\\`\\`\n\nDo NOT add \\`defaultWidth\\`/\\`defaultHeight\\` just to restate the default size:\nsupplying either one marks the viewport as explicitly requested, which\noverwrites frame sizes the user has already adjusted on the canvas.\n\nFor a numbered flow the user describes in chat, keep the labels and order:\n\n\\`\\`\\`bash\npnpm action open-visual-edit '{\n \"designId\": \"<existing-design-id>\",\n \"connectionId\": \"<existing-connection-id>\",\n \"devServerUrl\": \"http://localhost:1234\",\n \"routes\": [\n { \"url\": \"localhost:1234/onboarding/1\", \"title\": \"Screen 1\" },\n { \"url\": \"localhost:1234/onboarding/2\", \"title\": \"Screen 2\" },\n { \"url\": \"localhost:1234/onboarding/3\", \"title\": \"Screen 3\" }\n ]\n}'\n\\`\\`\\`\n\nIf no \\`routes\\` or \\`paths\\` are supplied, \\`open-visual-edit\\` uses every route\nfrom the localhost manifest.\n\nFallback, only when \\`open-visual-edit\\` is unavailable:\n\n1. Register or refresh the bridge with \\`connect-localhost\\`, passing the\n \\`/manifest.json\\` result as \\`routeManifest\\` and \\`capabilities\\`.\n2. Create or reuse a Design project with \\`create-design\\`.\n3. Place URL-backed screens with \\`add-localhost-screens\\`.\n4. Navigate to overview mode with \\`navigate\\`.\n\n## Open The Design Surface\n\n- Use the \\`link\\`, \\`deepLink\\`, or MCP App embed returned by Design actions so\n the user sees the canvas. Follow **Put Design Beside The Chat**: prefer the\n host's inline Browser, preview, or webview panel; otherwise surface the\n **Open design** link.\n- Return or open the \\`openUrl\\` / action link, not a hand-built\n \\`/design/:id?_session=...\\` URL.\n- If the user is working in VS Code, the Agent Native extension can open the\n same URL via\n \\`vscode://builder.agent-native/open?url=<encoded-design-url>\\`. Its\n \\`Agent Native: Open Design Canvas\\` command also starts the local bridge and\n opens hosted Design in the VS Code side panel.\n- After \\`open-visual-edit\\`, confirm the Design editor is in overview mode\n with the requested URL-backed frames visible, and that they render the app\n rather than a spinner. Do not stop at \"screens added\" when the user asked to\n inspect or edit visually.\n\n## Applying Visual Edits Back To Source\n\nCanvas edits on a localhost screen do not write source as you make them. They\naccumulate as pending edits and the editor shows an **Apply design updates**\nbutton on the canvas. In an MCP App, clicking it hands the bounded structured\nprompt to the current host coding conversation. In an ordinary browser or\nstandalone Design page, it falls back to the local Design agent. The dropdown's\n**Copy prompt to your agent** action is the universal manual fallback.\n\n- Style, text, and drag/drop structure edits all collect into the same pending\n batch, so the user can make several changes and apply once.\n- After the write lands, the target app's own dev-server HMR refreshes the\n frames — no manual reload. If frames do not refresh, the write did not land;\n say so rather than assuming.\n- The separate disk-icon \"Apply to source\" button is the deterministic\n whole-file HTML/CSS writer. It is intentionally disabled for compiled\n \\`.jsx\\`/\\`.tsx\\` routes — those must go through the agent path above.\n\n## Editing URLs\n\nKeep localhost screens as URL files plus \\`screenMetadata[fileId]\\`. Do not\nreplace them with copied \\`srcdoc\\` HTML unless the user explicitly asks for a\nfrozen snapshot. To change a state, rerun \\`open-visual-edit\\` with the new\npath/query or duplicate the screen and update the copy's URL metadata.\n\n## Local Files in the Code Tab\n\nOnce a connection is registered, the design editor's Code panel (left rail →\nCode, or \\`navigate --view editor --designId <id> --leftPanel code\\`) shows a\nlocal-files workspace root for that connection next to the design's own files.\nTreat that root like VS Code opened at the connected project directory: file\ntree, search, open/edit, and save are backed by the real local files. It lists\nthe connected app's text/code files through the bridge\n(\\`list-local-files\\` / \\`read-local-file\\`); build output, \\`node_modules\\`,\n\\`.git\\`, and secret-looking paths (\\`.env*\\`, key files) are always excluded.\n\n- Browsing and reading need only editor access on the design plus the running\n bridge.\n- Saving goes through \\`write-local-file\\`: the first save opens the\n write-consent dialog (an 8-hour, folder-scoped grant) and retries\n automatically once granted. Only text/code files are writable; secret paths\n are always blocked.\n- If the agent calls \\`write-local-file\\` directly (not through a UI save) and it\n fails with \"no write-consent grant\", call \\`request-localhost-write-consent\\`.\n It opens the write-consent dialog in the editor, or reports \\`alreadyGranted\\`\n if one already exists. Granting is human-only —\n \\`grant-localhost-write-consent\\` is hidden from agents, so you cannot approve\n it yourself. Tell the user to click \"Allow writes\", then retry\n \\`write-local-file\\` once. Do not keep retrying blindly: the write stays\n blocked until the user approves.\n- Saves are conflict-checked against the file's on-disk version — a file that\n changed since it was read fails with a version conflict instead of being\n overwritten.\n\n## React Source Writeback\n\n- Use compiler/debug provenance (project-relative file, line, column,\n component, and runtime multiplicity) to locate React/TSX source. Treat it as\n evidence, not as permission for a generic AST structural transform.\n- A single-instance leaf text edit, literal \\`className\\`/\\`class\\` edit, or flat\n literal \\`style={{ ... }}\\` property may use \\`apply-visual-edit\\` with a\n \\`local-file\\` source and exact \\`target.sourceAnchor\\`. Preview first (omit\n \\`persist\\`), inspect \\`proposedDiff\\`, then call with \\`persist: true\\`.\n- Reparenting, grouping/ungrouping, wrappers, dynamic expressions, repeated\n \\`.map()\\` instances, shared components, breakpoint-scoped edits, and\n cross-file changes go through the coding agent with exact subject/target\n anchors and their runtime relationship. \\`apply-visual-edit\\` refuses these\n with \\`status: \"needsAgent\"\\` rather than guessing.\n- Before each write, read the file and pass its exact \\`versionHash\\` to\n \\`write-local-file\\` with \\`requireExpectedVersionHash: true\\`; on conflict,\n re-read and re-plan. Keep the optimistic preview until HMR/runtime confirms\n the result. Human write consent remains mandatory and agents cannot grant it.\n\n## Verification\n\n- \\`list-localhost-connections\\` returns the expected connection and routes.\n- The Design editor opens in overview mode.\n- Every requested screen renders the intended localhost URL, showing real app\n content rather than an endless loading spinner.\n- The screen iframe carries a \\`src\\`, not a \\`srcdoc\\`. A localhost screen with a\n \\`srcdoc\\` is a bug, not a slow load — check it in the browser devtools before\n reporting the canvas as working.\n- Alt-dragging a screen copies the URL-backed frame, not an inline HTML clone.\n- A query/path edit changes only the target screen's URL metadata and iframe.\n- The Code tab shows a local-files root for the connection and opens its files.\n`;\n"]}
|
|
1
|
+
{"version":3,"file":"design-visual-edit-skill.js","sourceRoot":"","sources":["../../../src/cli/skills-content/design-visual-edit-skill.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,2BAA2B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAud1C,CAAC","sourcesContent":["export const DESIGN_VISUAL_EDIT_SKILL_MD = `---\nname: visual-edit\ndescription: >-\n Open a running local app in Design overview mode as URL-backed iframe screens\n for visual editing, flow review, duplication, and route-state exploration.\n Use when the user asks to inspect, compare, or edit a real local app visually\n in Design.\nmetadata:\n visibility: exported\n---\n\n# Visual Edit\n\nUse \\`/visual-edit\\` when the user wants to inspect or edit a real local app\nvisually instead of generating standalone Alpine HTML. The source of truth is\nthe running localhost app plus its route URLs. Design shows those routes as\niframe-backed screens on the infinite canvas.\n\n## Installing this skill for an external MCP host\n\nThe hosted install path\n(\\`npx @agent-native/core@latest skills add visual-edit\\`, or \\`design\\` for the\nfull Design bundle) installs the exported instructions and registers the\nhosted Design MCP connector together. The open Skills CLI path\n(\\`npx skills@latest add BuilderIO/agent-native --skill visual-edit\\`) installs\nexported instructions only, with no MCP connector registration.\n\n## Put Design Beside The Chat\n\nPrefer the interactive MCP App returned by \\`open-visual-edit\\` when the coding\nhost renders it. The user gets the Design canvas beside the conversation, and\n**Apply design updates** can submit the bounded source-edit handoff back to the\ncurrent host conversation through the standard MCP Apps message bridge. The\nhost may ask the user to confirm the current conversation or choose a new one.\n\nOtherwise, \\`openUrl\\` is a credential-free, read-only fallback that is safe to\nshow in model text or retain in logs. Do not claim that fallback is editable:\nthe edit capability is intentionally available only to the host-managed MCP App\nlauncher, where it is hidden from the model and redeemed once.\n\n- In Codex Desktop, prefer the rendered MCP App. Use the in-app Browser for the\n credential-free \\`openUrl\\` only when a read-only fallback is acceptable.\n- In Claude Code Desktop's Code tab, prefer the rendered MCP App. Preview\n \\`openUrl\\` in the Browser pane only as the read-only fallback.\n- In VS Code, use the Agent Native Design webview/deep link described below.\n- Inline browser availability is host-dependent. CLI, remote, or restricted\n sessions may not expose one. If the inline surface is unavailable or disabled,\n return the normal **Open design** link instead of claiming it opened.\n\nPrefer the MCP App surface for a connected Design plugin, then the host's\nbrowser/preview tool as the universal fallback. Keep the canvas beside chat\nwhen the host supports rearrangeable panes.\n\nInside Design, use **Show/Hide UI** from the \\`Cmd+K\\` menu or press Figma's\n\\`Shift+\\\\\\` shortcut to toggle all editing chrome so only the canvas remains.\nThe same action is available from Design's empty-canvas context menu.\n\n## Core Model\n\n- Each screen is a URL-backed iframe, not copied HTML.\n- Each screen keeps URL metadata: \\`connectionId\\`, \\`routeId\\`, \\`path\\`,\n \\`url\\`, \\`bridgeUrl\\`, title, and viewport size.\n- Localhost Edit mode renders the running app through the local bridge as a live\n iframe with the same editor bridge used by HTML designs. It is never a frozen\n static DOM snapshot. Editing is direct DOM manipulation against that live\n document; the parallel \\`/snapshot\\` fetch feeds the editable source model only\n and must never be rendered in the frame.\n- **The \\`/visual-edit\\` skill needs no Design account sign-in.**\n \\`open-visual-edit\\` mints a five-minute, single-use capability for the exact\n \\`/visual-edit/:designId\\` local-editor route. The MCP host redeems it outside\n model-visible text, then opens the existing editor with localhost edit access.\n This capability is not an account session: \\`/_agent-native/session\\` remains\n signed out, and account-backed save/share/generate actions remain denied.\n- The skill enters through local \\`pnpm action open-visual-edit\\`. When that CLI\n has no account session, the action uses a stable, workspace-scoped local\n principal to register the bridge, create/reuse the local design, and place\n screens. That principal exists only inside the in-process CLI call; it is not\n a browser login and cannot be selected by an HTTP, MCP, or tunneled caller.\n- Public links are always read-only, including on loopback. Loopback peer\n identity is not an authentication boundary because a tunnel or reverse proxy\n can make a remote request appear local. A bare \\`/visual-edit/:designId\\` or\n \\`/design/:designId\\` URL carries no capability and must never release the\n connection's \\`previewToken\\`.\n- The live editor is same-origin through the local bridge proxy. This boots\n CSR apps and root-relative assets, but it is still a localhost editing proxy:\n app-origin cookies, WebSockets/HMR, SSE, and non-GET app API calls may need a\n future dev-server/plugin integration for perfect parity with the app's own\n origin.\n- **There are exactly two views.** The infinite canvas is where all editing\n happens, and the responsive interactive view (Interact) is where the app runs\n for real. There is no third \"full view\"/focused-edit state — clicking a screen\n in the Screens list, or the view toggle, opens the responsive view, and\n closing it returns to the canvas.\n- Interact keeps the left and right rails and adds a device bar above the canvas\n (device preset, editable width/height, zoom, close). It renders the app's\n normal URL so navigation, scrolling, links, and form controls behave as they\n would in the browser, and the wheel scrolls the app rather than panning the\n canvas. The canvas view is the opposite: the wheel pans and zooms it, and\n native interaction inside the frame is suppressed.\n- While a localhost screen has pending live visual edits, do not switch back to\n Interact until the user either applies the edits to source or explicitly\n aborts/discards the preview.\n- Alt-drag duplicates a screen. For localhost screens, duplication copies the\n iframe frame and URL metadata; change the copy's path/query for a new state.\n- Flow visualization is multiple URL states: \\`/checkout?step=shipping\\`,\n \\`/checkout?step=payment\\`, \\`/checkout?step=done\\`, etc.\n- When the user gives a named flow or numbered screen list, preserve that order\n and create one screen per URL/path. Shorthand like\n \\`localhost:1234/onboarding/1\\` means\n \\`http://localhost:1234/onboarding/1\\`.\n\n## Useful Canvas Sets\n\nTranslate the user's requested review into the smallest useful set of frames:\n\n- **Multi-step flow:** one ordered frame per route or query state, such as cart,\n shipping, payment, and confirmation.\n- **Multiple pages:** one frame per meaningful route, such as home, pricing,\n docs, and account settings.\n- **Responsive comparison:** repeat the same route at the requested desktop,\n tablet, and mobile viewports so they align in one row.\n- **State review:** repeat a route for meaningful URL-addressable states such as\n empty, loading, error, modal-open, or selected-item views.\n\nDo not expand every discovered route or every viewport unless the user asks for\nan exhaustive audit. Preserve the user's labels and sequence so the canvas reads\nlike the workflow they described.\n\n## Select And Reprompt\n\nWhen a chat message begins with \\`[Reprompt selection]\\`, the selected subtree is\na hard write boundary. The only mutation path is \\`propose-node-rewrite\\` with\nthe exact \\`repromptId\\`, target, and \\`baseVersionHash\\` captured in\n\\`design-reprompt-pending:<designId>:<fileId>\\`. Never use \\`apply-visual-edit\\`,\n\\`apply-source-edit\\`, \\`write-source\\`, \\`write-local-file\\`, \\`edit-design\\`, or any\nother content-writing action for that request. Clarifying questions are allowed,\nbut a requested change must remain a proposal.\n\nProduce one variant by default. Produce two or three only when the instruction\nasks for options. A retry includes \\`priorProposalId\\`; keep the same target and\nbase version, incorporate the feedback, and call \\`propose-node-rewrite\\` again.\nThe UI previews the returned subtree without persisting it.\n\nUse \\`resolve-node-rewrite\\` for the accept/reject lifecycle. Accept applies the\nchosen variant as one version-checked inline/Yjs content transaction so one\nundo restores the prior structure; reject clears the proposal without changing\ncontent. For conversational resolution such as \"apply the second one,\" call\n\\`view-screen\\`, read the active \\`design.reprompt.proposal\\`, and pass its\n\\`proposalId\\` plus the zero-based \\`variantIndex\\` to \\`resolve-node-rewrite\\`.\n\n## Review Quality\n\n- Treat the running app as the truth. Preserve its component language, tokens,\n route state, and real content unless the user explicitly asks for a new visual\n direction.\n- Use multiple URL states to reveal meaningful UX moments: empty/loading/error\n states, focused panels, modals, responsive breakpoints, and completed flow\n steps when those matter to the review.\n- For visual edits, compare before/after at the relevant viewport sizes and\n check key hover/focus/scroll states when the app exposes them.\n\n## Account And Sharing Model\n\n- \\`/visual-edit/:id\\` is the dedicated local-editor surface. The one-time\n handoff returned by \\`open-visual-edit\\` opens it with edit access without a\n Design login. A copied or bare \\`/visual-edit/:id\\` URL is read-only because it\n does not carry the capability.\n- The capability permits live iframe inspection and session-local edits,\n undo/redo, **Apply design updates** through the connected host/local agent,\n and **Copy prompt**. Those flows hand bounded source instructions back to the\n coding agent; they do not silently persist account-owned Design data.\n- Public \\`/design/:id\\` links stay read-only without a signed-in owner/editor\n session. Never use the local capability to upgrade that ordinary sharing\n surface.\n- Prefer links returned by Design actions or \\`/_agent-native/open\\` deep links.\n Do not surface URLs with \\`_session=\\` tokens or hand-build capability URLs.\n- Do not attempt account-backed write actions with the browser capability. The\n trusted local \\`open-visual-edit\\` CLI call may register its bridge, create or\n reuse its workspace-owned local design, and place screens without an account.\n Direct source-file action writes, generation, saving into an account, and\n sharing still require an authenticated action caller. If a signed-out visitor\n wants those durable account operations, send them through the framework\n sign-in return flow first.\n\n## Required Local Bridge\n\nThe live-edit bridge is unlocked by a shared secret (the \"bridge token\") that\nmust match on two sides: the local bridge process, and the user's connection row\nin Design (which the browser reads to authorize \\`/live-edit-bridge\\`,\n\\`/read-file\\`, \\`/write-file\\`). Get them to match by letting the\n\\`open-visual-edit\\` action mint the token, then starting the\nbridge with it. This is the only ordering that works for the remote-MCP flow —\nthe bridge cannot push its own token to the server without a CLI auth token, so\nthe server mints instead and the bridge adopts.\n\nFrom the target app repo, make sure its dev server is running, then:\n\n**1. Discover routes without starting a durable bridge** (one-shot, exits):\n\n\\`\\`\\`bash\nnpx @agent-native/core@latest design connect --url http://localhost:5173 --root . --json\n\\`\\`\\`\n\nThis prints the manifest (routes + capabilities). Parse it to build\n\\`routeManifest\\` for the next step. (Skip this if the user already gave explicit\npaths/URLs to place.)\n\nInside the agent-native monorepo itself, use the workspace CLI instead of\n\\`npx\\` — \\`npx\\` installs the last published \\`@agent-native/core\\`, which will not\ncontain local changes and costs a slow install on every call:\n\n\\`\\`\\`bash\npnpm dev:cli design connect --url http://localhost:5173 --root templates/<app> --json\n\\`\\`\\`\n\n**2. Call \\`open-visual-edit\\`** (see Action Flow below) with NO \\`bridgeToken\\`.\nThe server mints one, stores it on the user's connection row, copies it into the\nplaced screens' metadata, and returns it to you as \\`bridgeToken\\`. Capture it.\n\n**3. Start the persistent bridge adopting that token** (single line; prefer the\nenv var so the secret does not appear in \\`ps\\`):\n\n\\`\\`\\`bash\nAGENT_NATIVE_BRIDGE_TOKEN=\"<bridgeToken from step 2>\" npx @agent-native/core@latest design connect --url http://localhost:5173 --root . --daemon\n\\`\\`\\`\n\n(Equivalently, pass \\`--bridge-token <token>\\`.) This starts a detached bridge on\n\\`http://127.0.0.1:7331\\`, adopts the server-minted token — so bridge and row\nagree and live-edit authorizes with no self-registration — and stays alive after\nthe command exits.\n\nFor a manual health/manifest check on the running bridge:\n\n\\`\\`\\`bash\ncurl http://127.0.0.1:7331/health\n\\`\\`\\`\n\n\\`/health\\` needs no token. The full manifest at \\`/manifest.json\\` is\npreview-token protected, so an unauthenticated \\`curl\\` of it returns\n\\`{\"ok\":false,\"error\":\"invalid or missing preview token\"}\\` — that response means\nthe bridge is up, not that it is broken.\n\nOnly use \\`--json\\` for the step-1 route probe. Never use \\`--json\\`, \\`--once\\`,\nor \\`--dry-run\\` for the durable step-3 bridge: they print the manifest and exit,\nso Design falls back to a non-editable live iframe.\n\nThe bridge listens on a single fixed port (7331) and refuses to start for a\nsecond, different app. It is detached with no log file, so if \\`--daemon\\` reports\na timeout, check for a stale process (\\`lsof -ti:7331\\`) before retrying.\n\n## Action Flow\n\nPrefer the single \\`open-visual-edit\\` action. It registers or\nrefreshes the localhost bridge connection, mints and stores the bridge token,\ncreates or reuses a Design project, places URL-backed screens, stores the active\nvisual-edit context, and navigates to overview mode in one call. This avoids\ncreating a private design under a synthetic CLI user and then handing the browser\na tokenized URL that may be shadowed by an existing session.\n\nCall it BEFORE starting the durable bridge (step 3 above): it does not contact\nthe bridge, so the bridge need not be running yet, and you need its returned\n\\`bridgeToken\\` to start the bridge with a matching secret. Omit \\`bridgeToken\\`\non the call so the server mints one.\n\n\\`\\`\\`bash\npnpm action open-visual-edit '{\n \"title\": \"Docs homepage visual edit\",\n \"devServerUrl\": \"http://localhost:5173\",\n \"bridgeUrl\": \"http://127.0.0.1:7331\",\n \"rootPath\": \"/absolute/path/to/app\",\n \"routeManifest\": { \"...\": \"from /manifest.json\" },\n \"paths\": [\"/\", \"/pricing\", \"/checkout?step=payment\"]\n}'\n\\`\\`\\`\n\nThe action returns \\`designId\\`, \\`connectionId\\`, \\`bridgeToken\\`, \\`screens\\`,\n\\`urlPath\\`, and a credential-free \\`openUrl\\`. Its MCP App metadata separately\ncarries the one-time editor launcher so the host can redeem it without showing\nthe capability to the model or retaining it in the action link. Keep\n\\`designId\\`/\\`connectionId\\` in the chat context for follow-ups, and pass\n\\`bridgeToken\\` to \\`design connect\\` (step 3) to start the bridge. On follow-up\ncalls reusing an existing \\`connectionId\\`, the same token is returned (it is\nminted once and reused), so the running bridge stays valid.\n\n### Desktop and mobile side by side\n\nPass \\`viewports\\` to place every requested route once per viewport. Frames lay\nout as a grid: one row per route, one column per viewport. Presets are\n\\`desktop\\` (1280x900), \\`laptop\\` (1440x900), \\`tablet\\` (834x1112), and \\`mobile\\`\n(390x844); an explicit \\`{ \"label\": \"...\", \"width\": N, \"height\": N }\\` also works.\n\n\\`\\`\\`bash\npnpm action open-visual-edit '{\n \"title\": \"Tasks responsive visual edit\",\n \"devServerUrl\": \"http://localhost:5173\",\n \"bridgeUrl\": \"http://127.0.0.1:7331\",\n \"rootPath\": \"/absolute/path/to/app\",\n \"paths\": [\"/tasks\", \"/inbox\"],\n \"viewports\": [\"desktop\", \"mobile\"]\n}'\n\\`\\`\\`\n\nPrefer this over two separate calls with \\`defaultWidth\\`/\\`defaultHeight\\`: it\nkeeps each route's viewports aligned in a row and titles them\n\\`Tasks — Desktop\\` / \\`Tasks — Mobile\\` so the canvas reads clearly. \\`viewports\\`\noverrides \\`defaultWidth\\`/\\`defaultHeight\\`. With no \\`routes\\`/\\`paths\\`, it expands\nevery route in the localhost manifest, which is usually far more frames than\nthe user wants — name the paths.\n\n### Adding more page frames later\n\nCall \\`open-visual-edit\\` again with the same \\`designId\\` and \\`connectionId\\` and\nonly the new paths. Existing frames for the same route and viewport are\nrefreshed in place rather than duplicated, and a frame the user has dragged or\nresized keeps its position unless you explicitly pass \\`x\\`/\\`y\\`/\\`width\\`/\\`height\\`.\n\n\\`\\`\\`bash\npnpm action open-visual-edit '{\n \"designId\": \"<existing-design-id>\",\n \"connectionId\": \"<existing-connection-id>\",\n \"devServerUrl\": \"http://localhost:5173\",\n \"paths\": [\"/settings\", \"/team\"],\n \"startY\": 2200\n}'\n\\`\\`\\`\n\nDo NOT add \\`defaultWidth\\`/\\`defaultHeight\\` just to restate the default size:\nsupplying either one marks the viewport as explicitly requested, which\noverwrites frame sizes the user has already adjusted on the canvas.\n\nFor a numbered flow the user describes in chat, keep the labels and order:\n\n\\`\\`\\`bash\npnpm action open-visual-edit '{\n \"designId\": \"<existing-design-id>\",\n \"connectionId\": \"<existing-connection-id>\",\n \"devServerUrl\": \"http://localhost:1234\",\n \"routes\": [\n { \"url\": \"localhost:1234/onboarding/1\", \"title\": \"Screen 1\" },\n { \"url\": \"localhost:1234/onboarding/2\", \"title\": \"Screen 2\" },\n { \"url\": \"localhost:1234/onboarding/3\", \"title\": \"Screen 3\" }\n ]\n}'\n\\`\\`\\`\n\nIf no \\`routes\\` or \\`paths\\` are supplied, \\`open-visual-edit\\` uses every route\nfrom the localhost manifest.\n\nFallback, only when \\`open-visual-edit\\` is unavailable:\n\n1. Register or refresh the bridge with \\`connect-localhost\\`, passing the\n \\`/manifest.json\\` result as \\`routeManifest\\` and \\`capabilities\\`.\n2. Create or reuse a Design project with \\`create-design\\`.\n3. Place URL-backed screens with \\`add-localhost-screens\\`.\n4. Navigate to overview mode with \\`navigate\\`.\n\n## Open The Design Surface\n\n- Use the \\`link\\`, \\`deepLink\\`, or MCP App embed returned by Design actions so\n the user sees the canvas. Follow **Put Design Beside The Chat**: prefer the\n MCP App; otherwise surface the credential-free **Open design** link.\n- Return or open the MCP App first. Its host-managed launcher carries the\n one-time local-editor capability. The credential-free \\`openUrl\\` / action link\n is the safe read-only fallback; never build a capability URL yourself.\n- Never return or open a hand-built \\`/design/:id?_session=...\\` URL.\n- If the user is working in VS Code, the Agent Native extension can open the\n same URL via\n \\`vscode://builder.agent-native/open?url=<encoded-design-url>\\`. Its\n \\`Agent Native: Open Design Canvas\\` command also starts the local bridge and\n opens hosted Design in the VS Code side panel.\n- After \\`open-visual-edit\\`, confirm the Design editor is in overview mode\n with the requested URL-backed frames visible, and that they render the app\n rather than a spinner. Do not stop at \"screens added\" when the user asked to\n inspect or edit visually.\n\n## Applying Visual Edits Back To Source\n\nCanvas edits on a localhost screen do not write source as you make them. They\naccumulate as pending edits and the editor shows an **Apply design updates**\nbutton on the canvas. In an MCP App, clicking it hands the bounded structured\nprompt to the current host coding conversation. In an ordinary browser or\nstandalone Design page, it falls back to the local Design agent. The dropdown's\n**Copy prompt to your agent** action is the universal manual fallback.\n\n- Style, text, and drag/drop structure edits all collect into the same pending\n batch, so the user can make several changes and apply once.\n- After the write lands, the target app's own dev-server HMR refreshes the\n frames — no manual reload. If frames do not refresh, the write did not land;\n say so rather than assuming.\n- The separate disk-icon \"Apply to source\" button is the deterministic\n whole-file HTML/CSS writer. It is intentionally disabled for compiled\n \\`.jsx\\`/\\`.tsx\\` routes — those must go through the agent path above.\n\n## Editing URLs\n\nKeep localhost screens as URL files plus \\`screenMetadata[fileId]\\`. Do not\nreplace them with copied \\`srcdoc\\` HTML unless the user explicitly asks for a\nfrozen snapshot. To change a state, rerun \\`open-visual-edit\\` with the new\npath/query or duplicate the screen and update the copy's URL metadata.\n\n## Local Files in the Code Tab\n\nOnce a connection is registered, the design editor's Code panel (left rail →\nCode, or \\`navigate --view editor --designId <id> --leftPanel code\\`) shows a\nlocal-files workspace root for that connection next to the design's own files.\nTreat that root like VS Code opened at the connected project directory: file\ntree, search, open/edit, and save are backed by the real local files. It lists\nthe connected app's text/code files through the bridge\n(\\`list-local-files\\` / \\`read-local-file\\`); build output, \\`node_modules\\`,\n\\`.git\\`, and secret-looking paths (\\`.env*\\`, key files) are always excluded.\n\n- Browsing and reading need only editor access on the design plus the running\n bridge.\n- Saving goes through \\`write-local-file\\`: the first save opens the\n write-consent dialog (an 8-hour, folder-scoped grant) and retries\n automatically once granted. Only text/code files are writable; secret paths\n are always blocked.\n- If the agent calls \\`write-local-file\\` directly (not through a UI save) and it\n fails with \"no write-consent grant\", call \\`request-localhost-write-consent\\`.\n It opens the write-consent dialog in the editor, or reports \\`alreadyGranted\\`\n if one already exists. Granting is human-only —\n \\`grant-localhost-write-consent\\` is hidden from agents, so you cannot approve\n it yourself. Tell the user to click \"Allow writes\", then retry\n \\`write-local-file\\` once. Do not keep retrying blindly: the write stays\n blocked until the user approves.\n- Saves are conflict-checked against the file's on-disk version — a file that\n changed since it was read fails with a version conflict instead of being\n overwritten.\n\n## React Source Writeback\n\n- Use compiler/debug provenance (project-relative file, line, column,\n component, and runtime multiplicity) to locate React/TSX source. Treat it as\n evidence, not as permission for a generic AST structural transform.\n- Read \\`positionPrecision\\` on every anchor before you trust \\`line\\`/\\`column\\`.\n \\`authored\\` means those are the real JSX coordinates. \\`transformed\\` means they\n are the dev server's own output coordinates — React 19 removed \\`_debugSource\\`\n and exposes only an owner stack, so this is the normal case on a Vite/Next\n dev server, and the line will not match the file. \\`unknown\\` means no tier was\n reported. On anything but \\`authored\\`, use the file and component to find the\n element by its JSX shape and re-derive the line from the file you read; never\n edit at the reported line.\n- A single-instance leaf text edit, literal \\`className\\`/\\`class\\` edit, or flat\n literal \\`style={{ ... }}\\` property may use \\`apply-visual-edit\\` with a\n \\`local-file\\` source and a complete \\`target.sourceAnchor\\`. Forward the\n anchor's \\`positionPrecision\\` with it — the action refuses a \\`transformed\\`\n anchor with \\`status: \"needsAgent\"\\` instead of seeking to a line that means\n something else in the authored file. Preview first (omit \\`persist\\`), inspect\n \\`proposedDiff\\`, then call with \\`persist: true\\`.\n- Reparenting, grouping/ungrouping, wrappers, dynamic expressions, repeated\n \\`.map()\\` instances, shared components, breakpoint-scoped edits, and\n cross-file changes go through the coding agent with complete subject/target\n anchors and their runtime relationship. \\`apply-visual-edit\\` refuses these\n with \\`status: \"needsAgent\"\\` rather than guessing.\n- Before each write, read the file and pass its exact \\`versionHash\\` to\n \\`write-local-file\\` with \\`requireExpectedVersionHash: true\\`; on conflict,\n re-read and re-plan. Keep the optimistic preview until HMR/runtime confirms\n the result. Human write consent remains mandatory and agents cannot grant it.\n\n## Verification\n\n- \\`list-localhost-connections\\` returns the expected connection and routes.\n- The Design editor opens in overview mode.\n- Every requested screen renders the intended localhost URL, showing real app\n content rather than an endless loading spinner.\n- The screen iframe carries a \\`src\\`, not a \\`srcdoc\\`. A localhost screen with a\n \\`srcdoc\\` is a bug, not a slow load — check it in the browser devtools before\n reporting the canvas as working.\n- Alt-dragging a screen copies the URL-backed frame, not an inline HTML clone.\n- A query/path edit changes only the target screen's URL metadata and iframe.\n- The Code tab shows a local-files root for the connection and opens its files.\n`;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantChat.d.ts","sourceRoot":"","sources":["../../src/client/AssistantChat.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AAY5F,OAAO,KAAK,EAEV,gBAAgB,EAChB,yBAAyB,EAC1B,MAAM,qBAAqB,CAAC;AAa7B,OAAO,KASN,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAarE,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAUL,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAC;AASzB,OAAO,EAUL,KAAK,gBAAgB,EACtB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAGL,qBAAqB,EAQtB,MAAM,8BAA8B,CAAC;AAUtC,OAAO,
|
|
1
|
+
{"version":3,"file":"AssistantChat.d.ts","sourceRoot":"","sources":["../../src/client/AssistantChat.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AAY5F,OAAO,KAAK,EAEV,gBAAgB,EAChB,yBAAyB,EAC1B,MAAM,qBAAqB,CAAC;AAa7B,OAAO,KASN,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAarE,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAUL,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAC;AASzB,OAAO,EAUL,KAAK,gBAAgB,EACtB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAGL,qBAAqB,EAQtB,MAAM,8BAA8B,CAAC;AAUtC,OAAO,EASL,KAAK,sBAAsB,EAG5B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,mBAAmB,CAAC;AA4B3B,OA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ACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,2BAA2B,KAAK,gBAAgB,CAAC;IAC3E;;;;;OAKG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAAC;IACxE,kFAAkF;IAClF,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC1C,kFAAkF;IAClF,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;;;OAMG;IACH,eAAe,CAAC,EAAE;QAChB,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;QACvC,aAAa,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;KAC/C,CAAC;CACH;AAED,eAAO,MAAM,mBAAmB,gBAAgB,CAAC;AAsDjD,8DAA8D;AAC9D,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,QAI9C;AAkDD,OAAO,EACL,iBAAiB,EAElB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAsE7B;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,YAAY,EAAE,OAAO,GACpB;IAAE,cAAc,EAAE,OAAO,CAAC;IAAC,eAAe,EAAE,MAAM,IAAI,CAAA;CAAE,CA2D1D;AA0pHD,eAAO,MAAM,aAAa,gGA2GxB,CAAC"}
|
|
@@ -19,7 +19,7 @@ import { DownscalingImageAttachmentAdapter, BinaryDocumentAttachmentAdapter, MAX
|
|
|
19
19
|
import { TextStreamingContext } from "./chat/markdown-renderer.js";
|
|
20
20
|
import { CheckpointContext, MessageActionsContext, assistantMessageRunId, UserMessage, AssistantMessage, SelectionAttachedPill, RunningActivityStatus, displayableUserMessageText, isHiddenUserMessage, ServerRunActiveContext, } from "./chat/message-components.js";
|
|
21
21
|
import { repoHasAssistantMessage, getRepoMessages, getRepoMessage, shouldImportServerThreadData, dedupeRepoMessagesById, dropEmptyAssistantMessages, withLastAssistantRunDuration, } from "./chat/repo-helpers.js";
|
|
22
|
-
import { BuilderSetupContent, LoopLimitContinueCard, RunErrorRecoveryCard, PlanModeCallout, getLoopLimitMetadata, getRunErrorMetadata, getRequestModeMetadata, } from "./chat/run-recovery.js";
|
|
22
|
+
import { BuilderSetupContent, LoopLimitContinueCard, RunErrorRecoveryCard, PlanModeCallout, getLoopLimitMetadata, getRunErrorMetadata, getRequestModeMetadata, runErrorKey, } from "./chat/run-recovery.js";
|
|
23
23
|
import { createAgentChatRuntimeAdapter, } from "./chat/runtime.js";
|
|
24
24
|
import { ChatRunningContext, ChatRunDurationContext, ApprovalContext, ReconnectStreamMessage, } from "./chat/tool-call-display.js";
|
|
25
25
|
import { useAgentChatLifecycleTracking } from "./chat/use-agent-chat-lifecycle-tracking.js";
|
|
@@ -3793,7 +3793,6 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
3793
3793
|
};
|
|
3794
3794
|
}, [apiUrl, cpDevMode, threadId, isRunning]);
|
|
3795
3795
|
const checkpointCtx = useMemo(() => ({ apiUrl, devMode: cpDevMode, threadId, checkpointRunIds }), [apiUrl, cpDevMode, threadId, checkpointRunIds]);
|
|
3796
|
-
const messageActionsCtx = useMemo(() => ({ onForkChat }), [onForkChat]);
|
|
3797
3796
|
const lastMessageLoopLimit = useMemo(() => {
|
|
3798
3797
|
const last = messages[messages.length - 1];
|
|
3799
3798
|
if (!last || last.role !== "assistant")
|
|
@@ -3807,6 +3806,12 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
3807
3806
|
return getRunErrorMetadata(last);
|
|
3808
3807
|
}, [messages]);
|
|
3809
3808
|
const lastUserText = useMemo(() => latestNonRecoveryUserMessageText(messages), [messages]);
|
|
3809
|
+
const retryAfterRunError = useCallback(() => {
|
|
3810
|
+
setRunErrorInfo(null);
|
|
3811
|
+
addToQueue(lastUserText
|
|
3812
|
+
? `Retry the previous request from a clean approach. Do not rerun the exact same failed tool input unless the failure was transient or the user explicitly asked for an exact rerun. If a provider query failed because of schema, syntax, or type mismatch, diagnose the error and adjust the query first.\n\nOriginal request:\n\n${lastUserText}`
|
|
3813
|
+
: "Retry the previous request from a clean approach. Do not rerun the exact same failed tool input unless the failure was transient or the user explicitly asked for an exact rerun. If a provider query failed because of schema, syntax, or type mismatch, diagnose the error and adjust the query first.", undefined, undefined, undefined, undefined, "queued", "retry");
|
|
3814
|
+
}, [addToQueue, lastUserText]);
|
|
3810
3815
|
const latestMessageRole = latestMessage?.role;
|
|
3811
3816
|
const latestAssistantWasPlan = latestMessageRole === "assistant" &&
|
|
3812
3817
|
getRequestModeMetadata(latestMessage) === "plan";
|
|
@@ -3830,7 +3835,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
3830
3835
|
: lastMessageLoopLimit;
|
|
3831
3836
|
const visibleRunError = runErrorInfo ?? lastMessageRunError;
|
|
3832
3837
|
const visibleRunErrorKey = visibleRunError
|
|
3833
|
-
?
|
|
3838
|
+
? runErrorKey(visibleRunError)
|
|
3834
3839
|
: null;
|
|
3835
3840
|
const shouldShowRunError = !!visibleRunError &&
|
|
3836
3841
|
!showRunningInUI &&
|
|
@@ -3840,6 +3845,13 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
3840
3845
|
(!userStoppedRunRef.current.runId ||
|
|
3841
3846
|
!visibleRunError.runId ||
|
|
3842
3847
|
userStoppedRunRef.current.runId === visibleRunError.runId));
|
|
3848
|
+
// The banner covers one run; every failed turn it does not cover keeps its own
|
|
3849
|
+
// inline marker, so a failure stays visible after the next prompt.
|
|
3850
|
+
const messageActionsCtx = useMemo(() => ({
|
|
3851
|
+
onForkChat,
|
|
3852
|
+
onRetryRunError: retryAfterRunError,
|
|
3853
|
+
bannerRunErrorKey: shouldShowRunError ? visibleRunErrorKey : null,
|
|
3854
|
+
}), [onForkChat, retryAfterRunError, shouldShowRunError, visibleRunErrorKey]);
|
|
3843
3855
|
const hasActiveChatWork = showRunningInUI ||
|
|
3844
3856
|
isAutoResuming ||
|
|
3845
3857
|
queuedMessages.length > 0 ||
|
|
@@ -3970,12 +3982,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
3970
3982
|
} }) })), shouldShowRunError && visibleRunError && (_jsx(MessageScrollerItem, { children: _jsx(RunErrorRecoveryCard, { info: visibleRunError, onContinue: () => {
|
|
3971
3983
|
setRunErrorInfo(null);
|
|
3972
3984
|
addToQueue(RECONNECT_NO_PROGRESS_CONTINUE_MESSAGE, undefined, undefined, undefined, undefined, "queued", "continue");
|
|
3973
|
-
}, onRetry: () => {
|
|
3974
|
-
setRunErrorInfo(null);
|
|
3975
|
-
addToQueue(lastUserText
|
|
3976
|
-
? `Retry the previous request from a clean approach. Do not rerun the exact same failed tool input unless the failure was transient or the user explicitly asked for an exact rerun. If a provider query failed because of schema, syntax, or type mismatch, diagnose the error and adjust the query first.\n\nOriginal request:\n\n${lastUserText}`
|
|
3977
|
-
: "Retry the previous request from a clean approach. Do not rerun the exact same failed tool input unless the failure was transient or the user explicitly asked for an exact rerun. If a provider query failed because of schema, syntax, or type mismatch, diagnose the error and adjust the query first.", undefined, undefined, undefined, undefined, "queued", "retry");
|
|
3978
|
-
}, onFork: onForkChat, onDismiss: () => {
|
|
3985
|
+
}, onRetry: retryAfterRunError, onFork: onForkChat, onDismiss: () => {
|
|
3979
3986
|
if (visibleRunErrorKey) {
|
|
3980
3987
|
setDismissedRunErrorKey(visibleRunErrorKey);
|
|
3981
3988
|
}
|