@agent-native/core 0.80.8 → 0.80.10
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 +19 -0
- package/corpus/core/docs/content/locales/ar-SA/template-design.mdx +6 -0
- package/corpus/core/docs/content/locales/de-DE/template-design.mdx +8 -0
- package/corpus/core/docs/content/locales/es-ES/template-design.mdx +10 -2
- package/corpus/core/docs/content/locales/fr-FR/template-design.mdx +10 -2
- package/corpus/core/docs/content/locales/hi-IN/template-design.mdx +7 -0
- package/corpus/core/docs/content/locales/ja-JP/template-design.mdx +7 -0
- package/corpus/core/docs/content/locales/ko-KR/template-design.mdx +7 -0
- package/corpus/core/docs/content/locales/pt-BR/template-design.mdx +9 -2
- package/corpus/core/docs/content/locales/zh-CN/template-design.mdx +6 -0
- package/corpus/core/docs/content/locales/zh-TW/template-design.mdx +6 -0
- package/corpus/core/docs/content/template-design.mdx +9 -2
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/cli/design-connect.ts +28 -2
- package/corpus/core/src/cli/mcp.ts +10 -0
- package/corpus/core/src/cli/skills.ts +103 -36
- package/corpus/core/src/client/error-format.ts +25 -0
- package/corpus/core/src/client/extensions/ExtensionViewer.tsx +13 -11
- package/corpus/core/src/client/guided-questions.tsx +32 -4
- package/corpus/core/src/client/onboarding/OnboardingPanel.tsx +33 -1
- package/corpus/core/src/client/resources/BuiltinCapabilityDetail.tsx +8 -0
- package/corpus/core/src/client/resources/use-builtin-capabilities.ts +4 -2
- package/corpus/core/src/client/session-replay.ts +34 -0
- package/corpus/core/src/client/sharing/ShareButton.tsx +106 -21
- package/corpus/core/src/coding-tools/index.ts +1 -1
- package/corpus/core/src/mcp/index.ts +2 -0
- package/corpus/core/src/mcp/screen-memory-stdio.ts +290 -0
- package/corpus/core/src/mcp-client/builtin-capabilities.ts +13 -1
- package/corpus/core/src/mcp-client/index.ts +9 -0
- package/corpus/core/src/mcp-client/screen-memory-local.ts +461 -0
- package/corpus/core/src/onboarding/types.ts +7 -0
- package/corpus/core/src/server/agent-chat-plugin.ts +25 -0
- package/corpus/core/src/server/agents-bundle.ts +35 -7
- package/corpus/core/src/styles/agent-native.css +5 -0
- package/corpus/core/src/templates/default/app/global.css +35 -35
- package/corpus/templates/analytics/AGENTS.md +6 -0
- package/corpus/templates/analytics/actions/github-repo-files.ts +9 -0
- package/corpus/templates/analytics/app/components/layout/Layout.tsx +4 -4
- package/corpus/templates/analytics/app/global.css +144 -40
- package/corpus/templates/analytics/app/pages/adhoc/explorer/index.tsx +1 -1
- package/corpus/templates/analytics/app/pages/adhoc/explorer-dashboard/ChartCard.tsx +1 -1
- package/corpus/templates/analytics/app/pages/adhoc/explorer-dashboard/index.tsx +1 -1
- package/corpus/templates/analytics/app/pages/sessions/SessionDetailPage.tsx +4 -4
- package/corpus/templates/analytics/app/pages/sessions/SessionsPage.tsx +9 -9
- package/corpus/templates/analytics/changelog/2026-06-29-agents-can-search-and-read-connected-github-repositories-whe.md +6 -0
- package/corpus/templates/analytics/changelog/2026-06-29-sessions-and-explorer-layouts-adapt-when-the-agent-sidebar-is.md +6 -0
- package/corpus/templates/assets/app/components/layout/Layout.tsx +3 -1
- package/corpus/templates/assets/app/components/library/LibraryPresetGrid.tsx +1 -1
- package/corpus/templates/assets/app/global.css +99 -35
- package/corpus/templates/assets/app/routes/asset.$id.tsx +2 -2
- package/corpus/templates/assets/app/routes/brand-kits.$id.tsx +4 -4
- package/corpus/templates/assets/app/routes/library.tsx +4 -4
- package/corpus/templates/assets/changelog/2026-06-29-asset-library-and-detail-layouts-adapt-when-the-agent-sidebar.md +6 -0
- package/corpus/templates/brain/app/components/layout/Layout.tsx +1 -1
- package/corpus/templates/brain/app/global.css +63 -35
- package/corpus/templates/brain/app/routes/search.tsx +1 -1
- package/corpus/templates/brain/app/routes/settings.tsx +1 -1
- package/corpus/templates/brain/app/routes/sources.tsx +2 -2
- package/corpus/templates/brain/changelog/2026-06-29-search-settings-and-source-layouts-adapt-when-the-agent-sidebar.md +6 -0
- package/corpus/templates/calendar/app/components/calendar/EventDetailPanel.tsx +4 -4
- package/corpus/templates/calendar/app/components/calendar/FindTimePanel.tsx +3 -2
- package/corpus/templates/calendar/app/components/layout/AppLayout.tsx +4 -2
- package/corpus/templates/calendar/app/global.css +69 -35
- package/corpus/templates/calendar/changelog/2026-06-29-event-and-find-time-layouts-adapt-when-the-agent-sidebar-is.md +6 -0
- package/corpus/templates/chat/app/components/layout/Layout.tsx +1 -1
- package/corpus/templates/chat/app/global.css +35 -35
- package/corpus/templates/chat/changelog/2026-06-29-chat-layouts-adapt-when-the-agent-sidebar-is-open.md +6 -0
- package/corpus/templates/clips/AGENTS.md +13 -0
- package/corpus/templates/clips/actions/get-screen-memory-status.ts +12 -0
- package/corpus/templates/clips/actions/query-screen-memory-context.ts +29 -0
- package/corpus/templates/clips/actions/view-screen.ts +2 -2
- package/corpus/templates/clips/app/components/library/library-layout.tsx +1 -1
- package/corpus/templates/clips/app/global.css +47 -35
- package/corpus/templates/clips/app/routes/_app.meetings.$meetingId.tsx +3 -3
- package/corpus/templates/clips/app/routes/r.$recordingId.tsx +45 -18
- package/corpus/templates/clips/changelog/2026-06-29-meeting-detail-layouts-adapt-when-the-agent-sidebar-is-open.md +6 -0
- package/corpus/templates/clips/changelog/2026-06-29-screen-memory-keeps-a-local-rolling-screen-buffer-for-agent-context.md +5 -0
- package/corpus/templates/clips/changelog/2026-06-29-video-chat-is-easier-to-find-on-recording-pages-and-s3-setup.md +6 -0
- package/corpus/templates/clips/chrome-extension/src/styles.css +39 -39
- package/corpus/templates/clips/desktop/src/app.tsx +290 -1
- package/corpus/templates/clips/desktop/src/shared/config.ts +83 -0
- package/corpus/templates/clips/desktop/src/styles.css +67 -52
- package/corpus/templates/clips/desktop/src-tauri/src/config.rs +50 -0
- package/corpus/templates/clips/desktop/src-tauri/src/lib.rs +17 -0
- package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +13 -13
- package/corpus/templates/clips/desktop/src-tauri/src/screen_memory.rs +990 -0
- package/corpus/templates/clips/server/plugins/onboarding.ts +2 -0
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +3 -3
- package/corpus/templates/content/app/components/layout/Layout.tsx +1 -1
- package/corpus/templates/content/app/global.css +29 -15
- package/corpus/templates/content/changelog/2026-06-29-database-gallery-layouts-adapt-when-the-agent-sidebar-is-open.md +6 -0
- package/corpus/templates/design/.agents/skills/design-generation/SKILL.md +25 -20
- package/corpus/templates/design/.agents/skills/design-systems/SKILL.md +8 -0
- package/corpus/templates/design/.agents/skills/export-handoff/SKILL.md +8 -0
- package/corpus/templates/design/.agents/skills/visual-edit/SKILL.md +13 -0
- package/corpus/templates/design/AGENTS.md +20 -12
- package/corpus/templates/design/CODE_NATIVE_DESIGN_STUDIO_IMPLEMENTATION_PLAN.md +1054 -0
- package/corpus/templates/design/DESIGN-STUDIO-PLAN.md +717 -0
- package/corpus/templates/design/actions/add-breakpoint.ts +143 -0
- package/corpus/templates/design/actions/add-localhost-screens.ts +5 -0
- package/corpus/templates/design/actions/apply-a11y-fix.ts +317 -0
- package/corpus/templates/design/actions/apply-component-prop-edit.ts +433 -0
- package/corpus/templates/design/actions/apply-design-state.ts +200 -0
- package/corpus/templates/design/actions/apply-design-token-edit.ts +202 -0
- package/corpus/templates/design/actions/apply-motion-edit.ts +450 -0
- package/corpus/templates/design/actions/apply-shader-fill.ts +404 -0
- package/corpus/templates/design/actions/apply-visual-edit.ts +214 -8
- package/corpus/templates/design/actions/capture-design-state.ts +224 -0
- package/corpus/templates/design/actions/connect-builder-app.ts +162 -0
- package/corpus/templates/design/actions/create-component.ts +447 -0
- package/corpus/templates/design/actions/create-design-branch.ts +263 -0
- package/corpus/templates/design/actions/create-design-state.ts +162 -0
- package/corpus/templates/design/actions/delete-design-state.ts +55 -0
- package/corpus/templates/design/actions/deploy-design-preview.ts +275 -0
- package/corpus/templates/design/actions/export-coding-handoff.ts +12 -4
- package/corpus/templates/design/actions/generate-design.ts +6 -21
- package/corpus/templates/design/actions/generate-screens.ts +43 -2
- package/corpus/templates/design/actions/get-component-details.ts +242 -0
- package/corpus/templates/design/actions/get-design-branch-diff.ts +362 -0
- package/corpus/templates/design/actions/get-design-review.ts +314 -0
- package/corpus/templates/design/actions/get-design-surface-index.ts +582 -0
- package/corpus/templates/design/actions/get-design.ts +1 -0
- package/corpus/templates/design/actions/get-motion-timeline.ts +99 -0
- package/corpus/templates/design/actions/index-components.ts +258 -0
- package/corpus/templates/design/actions/index-design-tokens.ts +273 -0
- package/corpus/templates/design/actions/list-design-extensions.ts +309 -0
- package/corpus/templates/design/actions/list-design-source-capabilities.ts +153 -0
- package/corpus/templates/design/actions/list-design-states.ts +72 -0
- package/corpus/templates/design/actions/migrate-inline-design-to-app.ts +298 -0
- package/corpus/templates/design/actions/open-component-source.ts +237 -0
- package/corpus/templates/design/actions/present-design-variants.ts +355 -30
- package/corpus/templates/design/actions/preview-component-prop-edit.ts +254 -0
- package/corpus/templates/design/actions/preview-design-token-edit.ts +113 -0
- package/corpus/templates/design/actions/preview-shader-fill.ts +189 -0
- package/corpus/templates/design/actions/remove-breakpoint.ts +103 -0
- package/corpus/templates/design/actions/remove-motion-timeline.ts +196 -0
- package/corpus/templates/design/actions/run-design-audit.ts +421 -0
- package/corpus/templates/design/actions/run-design-extension-action.ts +284 -0
- package/corpus/templates/design/actions/set-active-breakpoint.ts +39 -0
- package/corpus/templates/design/actions/view-screen.ts +75 -31
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +1738 -135
- package/corpus/templates/design/app/components/design/DesignEditorSkeleton.tsx +1 -1
- package/corpus/templates/design/app/components/design/DesignExtensionsPanel.tsx +632 -43
- package/corpus/templates/design/app/components/design/DrawOverlay.tsx +1 -1
- package/corpus/templates/design/app/components/design/EditPanel.tsx +1873 -132
- package/corpus/templates/design/app/components/design/LayersPanel.tsx +384 -219
- package/corpus/templates/design/app/components/design/LocalSourceEditBanner.tsx +157 -0
- package/corpus/templates/design/app/components/design/MotionDock.tsx +1062 -0
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +2103 -295
- package/corpus/templates/design/app/components/design/QuestionFlow.tsx +83 -206
- package/corpus/templates/design/app/components/design/ReviewPanel.tsx +759 -0
- package/corpus/templates/design/app/components/design/StatesPanel.tsx +579 -0
- package/corpus/templates/design/app/components/design/TokensPanel.tsx +573 -0
- package/corpus/templates/design/app/components/design/TweaksPanel.tsx +1 -1
- package/corpus/templates/design/app/components/design/canvas-primitive-style.ts +241 -0
- package/corpus/templates/design/app/components/design/index.ts +16 -1
- package/corpus/templates/design/app/components/design/inspector/AutoLayoutMatrix.tsx +238 -137
- package/corpus/templates/design/app/components/design/inspector/DesignColorPicker.tsx +188 -14
- package/corpus/templates/design/app/components/design/inspector/ExportSettingsPanel.tsx +24 -5
- package/corpus/templates/design/app/components/design/inspector/ImageFillControls.tsx +57 -1
- package/corpus/templates/design/app/components/design/inspector/InspectorAiActions.tsx +145 -0
- package/corpus/templates/design/app/components/design/inspector/SHADER_INTEGRATION.md +42 -12
- package/corpus/templates/design/app/components/design/inspector/ScrubInput.tsx +37 -12
- package/corpus/templates/design/app/components/design/inspector/index.ts +1 -0
- package/corpus/templates/design/app/components/design/inspector/scrub-input-utils.ts +12 -5
- package/corpus/templates/design/app/components/design/types.ts +9 -0
- package/corpus/templates/design/app/components/layout/Layout.tsx +23 -5
- package/corpus/templates/design/app/components/visual-editor/DrawOverlay.tsx +1 -1
- package/corpus/templates/design/app/global.css +77 -49
- package/corpus/templates/design/app/hooks/use-question-flow.ts +2 -2
- package/corpus/templates/design/app/hooks/useAgentEditRequest.ts +131 -0
- package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +11 -2
- package/corpus/templates/design/app/i18n/zh-TW.ts +34 -0
- package/corpus/templates/design/app/i18n-data.ts +314 -3
- package/corpus/templates/design/app/pages/DesignEditor.tsx +4929 -892
- package/corpus/templates/design/app/root.tsx +1 -1
- package/corpus/templates/design/changelog/2026-06-29-added-a-review-panel-in-the-design-editor-s-inspector-with-a.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-containers-no-longer-block-selecting-nested-elements-and-nor.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-copying-and-pasting-layers-no-longer-shows-success-notificat.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-design-agents-now-generate-and-refine-variants-from-stronger.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-design-inspector-controls-now-match-figmas-softer-dark-chrome.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-design-questions-now-appear-as-a-cleaner-canvas-intake-with-.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-design-variant-directions-now-appear-as-board-screens-with-chat-buttons.md +5 -0
- package/corpus/templates/design/changelog/2026-06-29-device-presets-in-all-screens-view-resize-the-selected-previ.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-element-selection-no-longer-snaps-back-to-the-previous-layer.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-frame-resize-measurements-now-stay-beside-the-cursor-while-d.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-inspector-number-fields-have-cleaner-tooltips-and-draggable-.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-layer-and-canvas-drags-keep-the-layer-list-stable-while-chan.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-layer-locking-layer-nesting-generated-question-intake-and-im.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-layer-moves-can-be-undone-and-redone-without-flashing-the-ca.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-layer-names-in-the-sidebar-can-scroll-horizontally-instead-o.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-layer-nesting-in-the-sidebar-now-uses-tighter-spacing-so-nam.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-layers-no-longer-repeat-document-wrapper-rows-when-a-screen-.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-overview-previews-now-keep-element-hover-and-selection-tied-.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-pressing-escape-now-cancels-a-stuck-screen-drag-in-the-overv.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-screen-overview-is-easier-to-find-and-named-screens-open-dir.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-screen-overview-only-highlights-screens-when-the-frame-or-ti.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-screen-overview-previews-now-resize-to-match-the-selected-de.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-screen-overview-selection-now-uses-a-pointer-cursor-instead-.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-screen-overview-selection-outlines-now-stay-locked-to-the-se.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-screen-overview-zoom-now-reports-real-screen-scale-separatel.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-screen-overview-zooming-feels-smoother-and-selection-outline.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-screen-overview-zooming-now-stays-on-the-overview-canvas-ins.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-screen-previews-use-a-single-blue-hover-border-in-all-screen.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-selected-containers-show-draggable-padding-and-gap-guides-on.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-selecting-a-nested-layer-from-all-screens-now-keeps-you-in-a.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-share-now-groups-link-sharing-exports-and-agent-handoff.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-the-design-editor-adds-a-studio-layer-with-tokens-respon.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-the-design-editor-loading-skeleton-now-uses-a-softer-charcoa.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-the-device-preview-menu-now-sits-next-to-the-preview-button-.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-the-inspector-stays-read-only-while-an-empty-design-is-still.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-the-missing-design-view-now-matches-the-rest-of-the-editor-c.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-the-pen-tool-icon-and-tool-option-menus-better-match-the-edi.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-typography-controls-now-keep-the-font-name-visible-and-move-.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-accessibility-findings-now-offer-a-one-click-fix.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-component-instances-now-have-editable-props-in-the-inspe.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-inspect-code-now-shows-the-elements-opening-tag-at-a-gla.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-shader-fill-presets-can-now-be-applied-to-an-element.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-the-motion-timeline-can-now-add-a-track-to-any-element-a.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-visual-editor-selection-layer-paint-and-drawing-controls-are-more-reliable.md +6 -0
- package/corpus/templates/design/e2e/README.md +3 -3
- package/corpus/templates/design/e2e/global-setup.ts +11 -22
- package/corpus/templates/design/e2e/helpers.ts +128 -11
- package/corpus/templates/design/playwright.config.ts +9 -3
- package/corpus/templates/design/server/db/schema.ts +123 -0
- package/corpus/templates/design/server/lib/coding-handoff.ts +126 -2
- package/corpus/templates/design/server/plugins/core-routes.ts +1 -2
- package/corpus/templates/design/server/plugins/db.ts +90 -0
- package/corpus/templates/design/server/routes/api/design-handoff/[id].zip.get.ts +86 -0
- package/corpus/templates/design/shared/builder-app.ts +297 -0
- package/corpus/templates/design/shared/capability-resolver.ts +123 -0
- package/corpus/templates/design/shared/capture-sanitize.ts +70 -0
- package/corpus/templates/design/shared/code-layer.ts +1141 -93
- package/corpus/templates/design/shared/component-model.ts +239 -0
- package/corpus/templates/design/shared/design-review.ts +275 -0
- package/corpus/templates/design/shared/design-source-capabilities.ts +286 -0
- package/corpus/templates/design/shared/design-state.ts +112 -0
- package/corpus/templates/design/shared/design-surface-index.ts +258 -0
- package/corpus/templates/design/shared/generation-session.ts +41 -0
- package/corpus/templates/design/shared/motion-compiler.ts +278 -0
- package/corpus/templates/design/shared/motion-timeline.ts +193 -0
- package/corpus/templates/design/shared/responsive-classes.ts +452 -0
- package/corpus/templates/design/shared/shader-fill.ts +323 -0
- package/corpus/templates/design/shared/source-mode.ts +245 -0
- package/corpus/templates/dispatch/app/global.css +79 -35
- package/corpus/templates/dispatch/app/routes/integrations.tsx +8 -7
- package/corpus/templates/dispatch/changelog/2026-06-29-integration-layouts-adapt-when-the-agent-sidebar-is-open.md +6 -0
- package/corpus/templates/forms/app/components/layout/Layout.tsx +6 -2
- package/corpus/templates/forms/app/global.css +64 -35
- package/corpus/templates/forms/app/pages/FormsListPage.tsx +2 -2
- package/corpus/templates/forms/app/pages/ResponseInsightsPage.tsx +3 -3
- package/corpus/templates/forms/changelog/2026-06-29-form-list-and-insight-layouts-adapt-when-the-agent-sidebar.md +6 -0
- package/corpus/templates/macros/app/components/layout/AppLayout.tsx +3 -1
- package/corpus/templates/macros/app/global.css +25 -9
- package/corpus/templates/macros/changelog/2026-06-29-macro-layouts-adapt-when-the-agent-sidebar-is-open.md +6 -0
- package/corpus/templates/mail/app/components/layout/AppLayout.tsx +6 -2
- package/corpus/templates/mail/app/global.css +42 -36
- package/corpus/templates/mail/app/pages/InboxPage.tsx +1 -1
- package/corpus/templates/mail/changelog/2026-06-29-the-contact-panel-now-adapts-to-the-available-mail-pane-width.md +6 -0
- package/corpus/templates/plan/app/components/layout/Layout.tsx +3 -1
- package/corpus/templates/plan/app/components/plan/CanvasArea.tsx +6 -2
- package/corpus/templates/plan/app/components/plan/DocumentArea.tsx +6 -7
- package/corpus/templates/plan/app/global.css +74 -42
- package/corpus/templates/plan/changelog/2026-06-29-plan-canvases-open-without-an-initial-pan-and-zoom-flicker.md +6 -0
- package/corpus/templates/plan/changelog/2026-06-29-plan-document-blocks-adapt-to-the-available-document-width.md +6 -0
- package/corpus/templates/plan/changelog/2026-06-29-plan-titles-and-summaries-can-be-edited-inline-without-focus.md +6 -0
- package/corpus/templates/slides/app/components/layout/Layout.tsx +3 -1
- package/corpus/templates/slides/app/global.css +49 -33
- package/corpus/templates/slides/changelog/2026-06-29-slide-layouts-adapt-when-the-agent-sidebar-is-open.md +6 -0
- package/corpus/templates/videos/app/components/layout/Layout.tsx +3 -1
- package/corpus/templates/videos/app/global.css +35 -35
- package/corpus/templates/videos/changelog/2026-06-29-video-layouts-adapt-when-the-agent-sidebar-is-open.md +6 -0
- package/dist/cli/design-connect.d.ts.map +1 -1
- package/dist/cli/design-connect.js +28 -2
- package/dist/cli/design-connect.js.map +1 -1
- package/dist/cli/mcp.d.ts.map +1 -1
- package/dist/cli/mcp.js +10 -0
- package/dist/cli/mcp.js.map +1 -1
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +95 -33
- package/dist/cli/skills.js.map +1 -1
- package/dist/client/error-format.d.ts.map +1 -1
- package/dist/client/error-format.js +17 -0
- package/dist/client/error-format.js.map +1 -1
- package/dist/client/extensions/ExtensionViewer.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionViewer.js +3 -4
- package/dist/client/extensions/ExtensionViewer.js.map +1 -1
- package/dist/client/guided-questions.d.ts +4 -0
- package/dist/client/guided-questions.d.ts.map +1 -1
- package/dist/client/guided-questions.js +16 -7
- package/dist/client/guided-questions.js.map +1 -1
- package/dist/client/onboarding/OnboardingPanel.js +26 -1
- package/dist/client/onboarding/OnboardingPanel.js.map +1 -1
- package/dist/client/resources/BuiltinCapabilityDetail.d.ts.map +1 -1
- package/dist/client/resources/BuiltinCapabilityDetail.js +1 -1
- package/dist/client/resources/BuiltinCapabilityDetail.js.map +1 -1
- package/dist/client/resources/use-builtin-capabilities.d.ts +1 -1
- package/dist/client/resources/use-builtin-capabilities.d.ts.map +1 -1
- package/dist/client/resources/use-builtin-capabilities.js +2 -1
- package/dist/client/resources/use-builtin-capabilities.js.map +1 -1
- package/dist/client/session-replay.d.ts.map +1 -1
- package/dist/client/session-replay.js +31 -0
- package/dist/client/session-replay.js.map +1 -1
- package/dist/client/sharing/ShareButton.d.ts +14 -0
- package/dist/client/sharing/ShareButton.d.ts.map +1 -1
- package/dist/client/sharing/ShareButton.js +36 -7
- package/dist/client/sharing/ShareButton.js.map +1 -1
- package/dist/coding-tools/index.js +1 -1
- package/dist/coding-tools/index.js.map +1 -1
- package/dist/mcp/index.d.ts +2 -0
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +1 -0
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/screen-memory-stdio.d.ts +6 -0
- package/dist/mcp/screen-memory-stdio.d.ts.map +1 -0
- package/dist/mcp/screen-memory-stdio.js +213 -0
- package/dist/mcp/screen-memory-stdio.js.map +1 -0
- package/dist/mcp-client/builtin-capabilities.d.ts +1 -1
- package/dist/mcp-client/builtin-capabilities.d.ts.map +1 -1
- package/dist/mcp-client/builtin-capabilities.js +10 -0
- package/dist/mcp-client/builtin-capabilities.js.map +1 -1
- package/dist/mcp-client/index.d.ts +1 -0
- package/dist/mcp-client/index.d.ts.map +1 -1
- package/dist/mcp-client/index.js +1 -0
- package/dist/mcp-client/index.js.map +1 -1
- package/dist/mcp-client/screen-memory-local.d.ts +61 -0
- package/dist/mcp-client/screen-memory-local.d.ts.map +1 -0
- package/dist/mcp-client/screen-memory-local.js +336 -0
- package/dist/mcp-client/screen-memory-local.js.map +1 -0
- package/dist/observability/routes.d.ts +3 -3
- package/dist/onboarding/types.d.ts +7 -0
- package/dist/onboarding/types.d.ts.map +1 -1
- package/dist/onboarding/types.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +26 -0
- 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/agents-bundle.d.ts.map +1 -1
- package/dist/server/agents-bundle.js +22 -7
- package/dist/server/agents-bundle.js.map +1 -1
- package/dist/styles/agent-native.css +5 -0
- package/dist/templates/default/app/global.css +35 -35
- package/docs/content/locales/ar-SA/template-design.mdx +6 -0
- package/docs/content/locales/de-DE/template-design.mdx +8 -0
- package/docs/content/locales/es-ES/template-design.mdx +10 -2
- package/docs/content/locales/fr-FR/template-design.mdx +10 -2
- package/docs/content/locales/hi-IN/template-design.mdx +7 -0
- package/docs/content/locales/ja-JP/template-design.mdx +7 -0
- package/docs/content/locales/ko-KR/template-design.mdx +7 -0
- package/docs/content/locales/pt-BR/template-design.mdx +9 -2
- package/docs/content/locales/zh-CN/template-design.mdx +6 -0
- package/docs/content/locales/zh-TW/template-design.mdx +6 -0
- package/docs/content/template-design.mdx +9 -2
- package/package.json +1 -1
- package/src/templates/default/app/global.css +35 -35
- package/corpus/templates/design/app/components/design/VariantGrid.tsx +0 -189
- package/corpus/templates/design/app/components/design/VariantHandoffCard.tsx +0 -115
- package/corpus/templates/design/app/hooks/use-variant-flow.ts +0 -342
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* run-design-extension-action — thin dispatcher.
|
|
3
|
+
*
|
|
4
|
+
* Routes an extension action request to the correct first-party action via
|
|
5
|
+
* the existing action surface. Extensions add NO permanent editor chrome —
|
|
6
|
+
* this action is the single call-through so the agent doesn't need to remember
|
|
7
|
+
* which internal action backs each extension capability.
|
|
8
|
+
*
|
|
9
|
+
* For first-party extensions (design.asset-library, design.shader-fills,
|
|
10
|
+
* design.token-auditor, design.motion-presets), the action dispatches to the
|
|
11
|
+
* correct implementation. The caller can always call the underlying action
|
|
12
|
+
* directly; this dispatcher exists as a convenience layer for the agent and
|
|
13
|
+
* for extension iframe code that calls `appAction("run-design-extension-action")`.
|
|
14
|
+
*
|
|
15
|
+
* For user-created extensions (kind="user-extension"), the action does NOT
|
|
16
|
+
* inject content into or modify the extension iframe itself — the iframe
|
|
17
|
+
* bridge handles that. Instead, it records the request context so the agent
|
|
18
|
+
* can follow up.
|
|
19
|
+
*
|
|
20
|
+
* Reuses the existing extension infra:
|
|
21
|
+
* - Core `list-extensions` / `get-extension` for user extension resolution.
|
|
22
|
+
* - Per-action implementations for first-party capabilities.
|
|
23
|
+
* - The `design.editor.inspector` slot contract from DesignExtensionsPanel.tsx.
|
|
24
|
+
*
|
|
25
|
+
* Plan reference: DESIGN-STUDIO-PLAN.md §6.7 + §7 (`run-design-extension-action`).
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import { defineAction } from "@agent-native/core";
|
|
29
|
+
import { resolveAccess } from "@agent-native/core/sharing";
|
|
30
|
+
import { z } from "zod";
|
|
31
|
+
|
|
32
|
+
// ─── Supported first-party extension ids ──────────────────────────────────────
|
|
33
|
+
|
|
34
|
+
const FIRST_PARTY_IDS = [
|
|
35
|
+
"design.asset-library",
|
|
36
|
+
"design.shader-fills",
|
|
37
|
+
"design.token-auditor",
|
|
38
|
+
"design.motion-presets",
|
|
39
|
+
] as const;
|
|
40
|
+
|
|
41
|
+
type FirstPartyId = (typeof FIRST_PARTY_IDS)[number];
|
|
42
|
+
|
|
43
|
+
// ─── Capability routing map ───────────────────────────────────────────────────
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Maps a `extensionId:capabilityId` pair to the action the caller should use.
|
|
47
|
+
* The dispatcher does NOT inline-call other actions (actions are not composable
|
|
48
|
+
* that way in this framework) — it returns routing guidance with the exact
|
|
49
|
+
* action name and params so the agent makes one follow-up call.
|
|
50
|
+
*/
|
|
51
|
+
interface CapabilityRoute {
|
|
52
|
+
action: string;
|
|
53
|
+
paramHint: string;
|
|
54
|
+
readOnly: boolean;
|
|
55
|
+
gated?: boolean;
|
|
56
|
+
gateReason?: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const CAPABILITY_ROUTES: Record<string, CapabilityRoute> = {
|
|
60
|
+
// Asset Library
|
|
61
|
+
"design.asset-library:browse": {
|
|
62
|
+
action: "get-design-snapshot",
|
|
63
|
+
paramHint:
|
|
64
|
+
"Call get-design-snapshot to inspect the active design, then use the Assets MCP tool (generate-asset / open-asset-picker) or the Assets app via call-agent.",
|
|
65
|
+
readOnly: true,
|
|
66
|
+
},
|
|
67
|
+
"design.asset-library:insert": {
|
|
68
|
+
action: "insert-asset",
|
|
69
|
+
paramHint:
|
|
70
|
+
"Call insert-asset with { assetUrl, designId?, fileId?, ownerId? }. Pass ownerId from view-screen.designSelection for selection-aware placement.",
|
|
71
|
+
readOnly: false,
|
|
72
|
+
},
|
|
73
|
+
"design.asset-library:generate": {
|
|
74
|
+
action: "call-agent",
|
|
75
|
+
paramHint:
|
|
76
|
+
'Delegate to the Assets app via call-agent with agent "assets" and a generation prompt. Pass the returned assetUrl to insert-asset.',
|
|
77
|
+
readOnly: false,
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
// Shader Fills
|
|
81
|
+
"design.shader-fills:catalog": {
|
|
82
|
+
action: "get-shader",
|
|
83
|
+
paramHint: "Call get-shader with an optional source context.",
|
|
84
|
+
readOnly: true,
|
|
85
|
+
},
|
|
86
|
+
"design.shader-fills:preview": {
|
|
87
|
+
action: "preview-shader-fill",
|
|
88
|
+
paramHint:
|
|
89
|
+
"Call preview-shader-fill with { descriptor: { preset, params?, colors?, speed? }, target? }. Returns previewCss + bridgeMessage; no writes.",
|
|
90
|
+
readOnly: true,
|
|
91
|
+
},
|
|
92
|
+
"design.shader-fills:code-snippet": {
|
|
93
|
+
action: "apply-shader",
|
|
94
|
+
paramHint:
|
|
95
|
+
"Call apply-shader with { descriptor, surface?, target?, source? }. Returns JSX import + snippet or HTML bridge mount for manual insertion.",
|
|
96
|
+
readOnly: true,
|
|
97
|
+
},
|
|
98
|
+
"design.shader-fills:apply": {
|
|
99
|
+
action: "apply-shader-fill",
|
|
100
|
+
paramHint:
|
|
101
|
+
"Call apply-shader-fill with { descriptor, target?, source?, surface? }. NOTE: currently returns gated:true — all safety conditions are unmet. Use preview or code-snippet instead.",
|
|
102
|
+
readOnly: false,
|
|
103
|
+
gated: true,
|
|
104
|
+
gateReason:
|
|
105
|
+
"apply-shader-fill is GATED until runtime rendering + source-write path + CSS fallback + diff proof are all in place. It will return { ok: false, gated: true } today.",
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
// Token Auditor
|
|
109
|
+
"design.token-auditor:index": {
|
|
110
|
+
action: "index-design-tokens",
|
|
111
|
+
paramHint:
|
|
112
|
+
"Call index-design-tokens with { designId? } to parse CSS vars from the design.",
|
|
113
|
+
readOnly: true,
|
|
114
|
+
},
|
|
115
|
+
"design.token-auditor:preview-edit": {
|
|
116
|
+
action: "preview-design-token-edit",
|
|
117
|
+
paramHint:
|
|
118
|
+
"Call preview-design-token-edit with { designId, tokenId, value } for a live CSS-var preview.",
|
|
119
|
+
readOnly: true,
|
|
120
|
+
},
|
|
121
|
+
"design.token-auditor:apply-edit": {
|
|
122
|
+
action: "apply-design-token-edit",
|
|
123
|
+
paramHint:
|
|
124
|
+
"Call apply-design-token-edit with { designId, tokenId, value } to persist via the Tweaks loop.",
|
|
125
|
+
readOnly: false,
|
|
126
|
+
},
|
|
127
|
+
"design.token-auditor:write-source": {
|
|
128
|
+
action: "apply-design-token-edit",
|
|
129
|
+
paramHint:
|
|
130
|
+
"Source write-back is planned. Call apply-design-token-edit — for inline designs it persists via Tweaks; for real-app sources with writeTokens capability it writes to the source file.",
|
|
131
|
+
readOnly: false,
|
|
132
|
+
gated: true,
|
|
133
|
+
gateReason:
|
|
134
|
+
"Source write-back to globals.css / tailwind.config is planned pending bridge hardening.",
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
// Motion Presets
|
|
138
|
+
"design.motion-presets:preview": {
|
|
139
|
+
action: "get-motion-timeline",
|
|
140
|
+
paramHint:
|
|
141
|
+
"Motion preview is a client-side postMessage bridge operation, not a server action. " +
|
|
142
|
+
"To inspect an existing timeline before committing, call get-motion-timeline with { designId }. " +
|
|
143
|
+
"To trigger a live scrub preview in the editor iframe, send a `motion-preview` postMessage from the extension UI.",
|
|
144
|
+
readOnly: true,
|
|
145
|
+
},
|
|
146
|
+
"design.motion-presets:apply": {
|
|
147
|
+
action: "apply-motion-edit",
|
|
148
|
+
paramHint:
|
|
149
|
+
"Call apply-motion-edit with { designId, fileId?, timeline: { tracks, durationMs } } for an atomic Write to CSS commit.",
|
|
150
|
+
readOnly: false,
|
|
151
|
+
},
|
|
152
|
+
"design.motion-presets:write-source": {
|
|
153
|
+
action: "apply-motion-edit",
|
|
154
|
+
paramHint:
|
|
155
|
+
"Real-source CSS module write-back is planned for fusion tier. Today apply-motion-edit writes to the managed <style> block for inline designs.",
|
|
156
|
+
readOnly: false,
|
|
157
|
+
gated: true,
|
|
158
|
+
gateReason:
|
|
159
|
+
"CSS module write-back is planned pending fusion bridge hardening.",
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
// ─── Action ──────────────────────────────────────────────────────────────────
|
|
164
|
+
|
|
165
|
+
export default defineAction({
|
|
166
|
+
description: `
|
|
167
|
+
Dispatch an action through a first-party Design Studio extension surface.
|
|
168
|
+
|
|
169
|
+
This is a thin routing layer — it does not call the underlying action itself;
|
|
170
|
+
instead it returns the exact action name + param hint so the agent makes one
|
|
171
|
+
follow-up call. This keeps the extension surface composable without
|
|
172
|
+
duplicating action logic.
|
|
173
|
+
|
|
174
|
+
Supported first-party extensions (extensionId):
|
|
175
|
+
design.asset-library — browse / insert / generate assets.
|
|
176
|
+
design.shader-fills — catalog / preview / code-snippet / apply (apply is GATED).
|
|
177
|
+
design.token-auditor — index / preview-edit / apply-edit / write-source.
|
|
178
|
+
design.motion-presets — preview / apply / write-source.
|
|
179
|
+
|
|
180
|
+
For user-created Alpine extensions, use list-extensions / get-extension / update-extension.
|
|
181
|
+
The extension iframe itself is not called by this action — only the backing action route.
|
|
182
|
+
`.trim(),
|
|
183
|
+
schema: z.object({
|
|
184
|
+
extensionId: z
|
|
185
|
+
.string()
|
|
186
|
+
.describe(
|
|
187
|
+
"First-party extension id. One of: " + FIRST_PARTY_IDS.join(", "),
|
|
188
|
+
),
|
|
189
|
+
capabilityId: z
|
|
190
|
+
.string()
|
|
191
|
+
.describe(
|
|
192
|
+
"Capability to invoke within the extension. Call list-design-extensions to see available capabilities per extension.",
|
|
193
|
+
),
|
|
194
|
+
context: z
|
|
195
|
+
.object({
|
|
196
|
+
designId: z.string().optional(),
|
|
197
|
+
fileId: z.string().optional(),
|
|
198
|
+
nodeId: z.string().optional(),
|
|
199
|
+
selector: z.string().optional(),
|
|
200
|
+
ownerId: z.string().optional(),
|
|
201
|
+
})
|
|
202
|
+
.optional()
|
|
203
|
+
.describe(
|
|
204
|
+
"Optional context from the current design editor state (view-screen output).",
|
|
205
|
+
),
|
|
206
|
+
}),
|
|
207
|
+
readOnly: true, // This dispatcher only returns routing guidance; it never writes.
|
|
208
|
+
run: async ({ extensionId, capabilityId, context }) => {
|
|
209
|
+
// Enforce read access before doing anything else when a designId is given,
|
|
210
|
+
// so this dispatcher can't be used to probe whether a design exists.
|
|
211
|
+
if (context?.designId) {
|
|
212
|
+
const access = await resolveAccess("design", context.designId);
|
|
213
|
+
if (!access) {
|
|
214
|
+
const err = new Error("Design not found") as Error & {
|
|
215
|
+
statusCode: number;
|
|
216
|
+
};
|
|
217
|
+
err.statusCode = 404;
|
|
218
|
+
throw err;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Validate extension id.
|
|
223
|
+
if (!FIRST_PARTY_IDS.includes(extensionId as FirstPartyId)) {
|
|
224
|
+
return {
|
|
225
|
+
ok: false,
|
|
226
|
+
error: `Unknown first-party extensionId: "${extensionId}".`,
|
|
227
|
+
knownExtensions: FIRST_PARTY_IDS,
|
|
228
|
+
hint: "For user-created extensions, use list-extensions / get-extension / update-extension.",
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const routeKey = `${extensionId}:${capabilityId}`;
|
|
233
|
+
const route = CAPABILITY_ROUTES[routeKey];
|
|
234
|
+
|
|
235
|
+
if (!route) {
|
|
236
|
+
// Return available capabilities for this extension.
|
|
237
|
+
const availableCaps = Object.keys(CAPABILITY_ROUTES)
|
|
238
|
+
.filter((k) => k.startsWith(`${extensionId}:`))
|
|
239
|
+
.map((k) => k.split(":")[1]);
|
|
240
|
+
|
|
241
|
+
return {
|
|
242
|
+
ok: false,
|
|
243
|
+
error: `Unknown capabilityId "${capabilityId}" for extension "${extensionId}".`,
|
|
244
|
+
availableCapabilities: availableCaps,
|
|
245
|
+
hint: `Call list-design-extensions with extensionId "${extensionId}" to see all capabilities.`,
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Build a helpful context-aware param hint.
|
|
250
|
+
let contextualHint = route.paramHint;
|
|
251
|
+
if (context?.designId) {
|
|
252
|
+
contextualHint += ` Current designId: "${context.designId}".`;
|
|
253
|
+
}
|
|
254
|
+
if (context?.fileId) {
|
|
255
|
+
contextualHint += ` Current fileId: "${context.fileId}".`;
|
|
256
|
+
}
|
|
257
|
+
if (context?.nodeId ?? context?.selector) {
|
|
258
|
+
const target = context.nodeId
|
|
259
|
+
? `nodeId="${context.nodeId}"`
|
|
260
|
+
: `selector="${context.selector}"`;
|
|
261
|
+
contextualHint += ` Current target: ${target}.`;
|
|
262
|
+
}
|
|
263
|
+
if (context?.ownerId) {
|
|
264
|
+
contextualHint += ` Current ownerId: "${context.ownerId}".`;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
return {
|
|
268
|
+
ok: true,
|
|
269
|
+
extensionId,
|
|
270
|
+
capabilityId,
|
|
271
|
+
route: {
|
|
272
|
+
action: route.action,
|
|
273
|
+
paramHint: contextualHint,
|
|
274
|
+
readOnly: route.readOnly,
|
|
275
|
+
gated: route.gated ?? false,
|
|
276
|
+
gateReason: route.gateReason ?? null,
|
|
277
|
+
},
|
|
278
|
+
nextStep: route.gated
|
|
279
|
+
? `NOTE: This capability is gated. ${route.gateReason ?? ""} The underlying action will return a clear gated result; do not imply the operation will succeed.`
|
|
280
|
+
: `Call the action "${route.action}" with the params described in paramHint.`,
|
|
281
|
+
slotId: "design.editor.inspector",
|
|
282
|
+
};
|
|
283
|
+
},
|
|
284
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core";
|
|
2
|
+
import { writeAppState } from "@agent-native/core/application-state";
|
|
3
|
+
import { assertAccess } from "@agent-native/core/sharing";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
|
|
6
|
+
import "../server/db/index.js"; // ensure registerShareableResource runs
|
|
7
|
+
|
|
8
|
+
export default defineAction({
|
|
9
|
+
description:
|
|
10
|
+
"Set the active breakpoint for a design editor session. " +
|
|
11
|
+
"The active breakpoint controls which frame is the current edit scope: " +
|
|
12
|
+
"editing a layer while 'base' is active writes unprefixed Tailwind classes; " +
|
|
13
|
+
"editing while 'md' is active writes md: prefixed classes. " +
|
|
14
|
+
"Persists to application state so the agent and UI always agree on the active scope.",
|
|
15
|
+
schema: z.object({
|
|
16
|
+
designId: z.string().describe("Design project ID"),
|
|
17
|
+
breakpointId: z
|
|
18
|
+
.string()
|
|
19
|
+
.describe(
|
|
20
|
+
"Id of the BreakpointDefinition to activate, or the literal string 'auto' " +
|
|
21
|
+
"to reset to a single-frame (all-breakpoints) view.",
|
|
22
|
+
),
|
|
23
|
+
}),
|
|
24
|
+
run: async ({ designId, breakpointId }) => {
|
|
25
|
+
await assertAccess("design", designId, "editor");
|
|
26
|
+
|
|
27
|
+
// Persist as application state so view-screen returns it and the UI reflects it.
|
|
28
|
+
await writeAppState(`design-active-breakpoint:${designId}`, {
|
|
29
|
+
designId,
|
|
30
|
+
activeBreakpointId: breakpointId,
|
|
31
|
+
setAt: new Date().toISOString(),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
designId,
|
|
36
|
+
activeBreakpointId: breakpointId,
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
});
|
|
@@ -20,9 +20,82 @@ import { getDb, schema } from "../server/db/index.js";
|
|
|
20
20
|
import { parseCanvasFrameGeometryById } from "../shared/canvas-frames.js";
|
|
21
21
|
import { designGenerationSessionKey } from "../shared/generation-session.js";
|
|
22
22
|
|
|
23
|
+
function stringProp(value: unknown, key: string): string | undefined {
|
|
24
|
+
if (!value || typeof value !== "object") return undefined;
|
|
25
|
+
const candidate = (value as Record<string, unknown>)[key];
|
|
26
|
+
return typeof candidate === "string" ? candidate : undefined;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function stringArrayProp(value: unknown, key: string): string[] {
|
|
30
|
+
if (!value || typeof value !== "object") return [];
|
|
31
|
+
const candidate = (value as Record<string, unknown>)[key];
|
|
32
|
+
return Array.isArray(candidate)
|
|
33
|
+
? candidate.filter((item): item is string => typeof item === "string")
|
|
34
|
+
: [];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function resolveActiveScreen(
|
|
38
|
+
files: Array<{
|
|
39
|
+
id: string;
|
|
40
|
+
filename: string;
|
|
41
|
+
fileType: string | null;
|
|
42
|
+
updatedAt: string | null;
|
|
43
|
+
}>,
|
|
44
|
+
navigation: unknown,
|
|
45
|
+
designSelection: unknown,
|
|
46
|
+
) {
|
|
47
|
+
const selectionFileId = stringProp(designSelection, "activeFileId");
|
|
48
|
+
if (selectionFileId) {
|
|
49
|
+
const active = files.find((file) => file.id === selectionFileId);
|
|
50
|
+
if (active) return active;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const selectionFilename = stringProp(designSelection, "activeFilename");
|
|
54
|
+
if (selectionFilename) {
|
|
55
|
+
const active = files.find((file) => file.filename === selectionFilename);
|
|
56
|
+
if (active) return active;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const selectedScreenIds = stringArrayProp(
|
|
60
|
+
designSelection,
|
|
61
|
+
"selectedScreenIds",
|
|
62
|
+
);
|
|
63
|
+
for (const screenId of selectedScreenIds) {
|
|
64
|
+
const selected = files.find((file) => file.id === screenId);
|
|
65
|
+
if (selected) return selected;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const navigationTargets = [
|
|
69
|
+
stringProp(navigation, "fileId"),
|
|
70
|
+
stringProp(navigation, "screenId"),
|
|
71
|
+
stringProp(navigation, "filename"),
|
|
72
|
+
stringProp(navigation, "screen"),
|
|
73
|
+
].filter((value): value is string => !!value);
|
|
74
|
+
for (const target of navigationTargets) {
|
|
75
|
+
const active = files.find(
|
|
76
|
+
(file) =>
|
|
77
|
+
file.id === target ||
|
|
78
|
+
file.filename === target ||
|
|
79
|
+
file.filename.replace(/\.[^.]+$/, "") === target,
|
|
80
|
+
);
|
|
81
|
+
if (active) return active;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const view = stringProp(navigation, "view");
|
|
85
|
+
const editorView =
|
|
86
|
+
stringProp(navigation, "editorView") ?? stringProp(navigation, "viewMode");
|
|
87
|
+
if (view === "present" || (view === "editor" && editorView === "single")) {
|
|
88
|
+
return (
|
|
89
|
+
files.find((file) => file.filename === "index.html") ?? files[0] ?? null
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
|
|
23
96
|
export default defineAction({
|
|
24
97
|
description:
|
|
25
|
-
"See what the user is currently looking at on screen. Returns the current navigation state including which design is open, which view they are on (list, editor, design-systems, present, templates, settings), active/focused design screen, selected element, active inspector tab (design, tweaks, or extensions), overview canvas state, plus any pending question overlay
|
|
98
|
+
"See what the user is currently looking at on screen. Returns the current navigation state including which design is open, which view they are on (list, editor, design-systems, present, templates, settings), active/focused design screen, selected element, active inspector tab (design, tweaks, or extensions), overview canvas state, plus any pending question overlay. Always call this first before taking any action.",
|
|
26
99
|
schema: z.object({}),
|
|
27
100
|
http: false,
|
|
28
101
|
run: async () => {
|
|
@@ -43,14 +116,6 @@ export default defineAction({
|
|
|
43
116
|
const generationSession = designId
|
|
44
117
|
? await readAppState(designGenerationSessionKey(designId))
|
|
45
118
|
: undefined;
|
|
46
|
-
const designVariants = designId
|
|
47
|
-
? await readAppState("design-variants").then((value) => {
|
|
48
|
-
if (!value || typeof value !== "object") return undefined;
|
|
49
|
-
return (value as { designId?: unknown }).designId === designId
|
|
50
|
-
? value
|
|
51
|
-
: undefined;
|
|
52
|
-
})
|
|
53
|
-
: undefined;
|
|
54
119
|
|
|
55
120
|
const screen: Record<string, unknown> = {};
|
|
56
121
|
if (navigation) screen.navigation = navigation;
|
|
@@ -84,27 +149,11 @@ export default defineAction({
|
|
|
84
149
|
data = {};
|
|
85
150
|
}
|
|
86
151
|
}
|
|
87
|
-
const activeFileId =
|
|
88
|
-
designSelection &&
|
|
89
|
-
typeof designSelection === "object" &&
|
|
90
|
-
typeof (designSelection as { activeFileId?: unknown })
|
|
91
|
-
.activeFileId === "string"
|
|
92
|
-
? (designSelection as { activeFileId: string }).activeFileId
|
|
93
|
-
: undefined;
|
|
94
|
-
const activeFilename =
|
|
95
|
-
designSelection &&
|
|
96
|
-
typeof designSelection === "object" &&
|
|
97
|
-
typeof (designSelection as { activeFilename?: unknown })
|
|
98
|
-
.activeFilename === "string"
|
|
99
|
-
? (designSelection as { activeFilename: string }).activeFilename
|
|
100
|
-
: undefined;
|
|
101
152
|
screen.design = {
|
|
102
153
|
id: designId,
|
|
103
154
|
title: (access.resource as { title?: unknown }).title ?? null,
|
|
104
155
|
screens: files,
|
|
105
|
-
activeScreen:
|
|
106
|
-
? (files.find((file) => file.id === activeFileId) ?? null)
|
|
107
|
-
: (files.find((file) => file.filename === activeFilename) ?? null),
|
|
156
|
+
activeScreen: resolveActiveScreen(files, navigation, designSelection),
|
|
108
157
|
canvasFrames: parseCanvasFrameGeometryById(data.canvasFrames),
|
|
109
158
|
};
|
|
110
159
|
}
|
|
@@ -114,11 +163,6 @@ export default defineAction({
|
|
|
114
163
|
screen.note =
|
|
115
164
|
"Questions are visible to the user as a full-canvas overlay. Wait for their answers (they'll come back as a chat message) before generating.";
|
|
116
165
|
}
|
|
117
|
-
if (designVariants) {
|
|
118
|
-
screen.pendingVariants = designVariants;
|
|
119
|
-
screen.variantsNote =
|
|
120
|
-
'A variant picker is open. Wait for the user to choose a direction before generating further. In an inline MCP app their pick returns to you automatically; if it opened as a browser tab (a CLI or code editor), they paste an auto-copied summary or just tell you which one (e.g. "use variant A"). Once you know the choice, read the saved index.html with get-design-snapshot. Do not call generate-design while this picker is open.';
|
|
121
|
-
}
|
|
122
166
|
if (generationSession) {
|
|
123
167
|
const GENERATION_SESSION_TTL_MS = 10 * 60 * 1000; // 10 minutes
|
|
124
168
|
const startedAt =
|