@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,297 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builder app helpers for the Design Studio.
|
|
3
|
+
*
|
|
4
|
+
* Provides two capabilities:
|
|
5
|
+
*
|
|
6
|
+
* 1. **Connection status** — resolve whether Builder is configured for the
|
|
7
|
+
* current request (credentials + project ID), without duplicating Builder
|
|
8
|
+
* auth logic. Delegates entirely to the core `resolveBuilderCredentials` /
|
|
9
|
+
* `resolveIsBuilderBranchingEnabled` helpers; no credential values are
|
|
10
|
+
* surfaced in return types.
|
|
11
|
+
*
|
|
12
|
+
* 2. **Migration seed** — build the prompt seed handed to the Builder cloud
|
|
13
|
+
* agent when migrating an inline Alpine/HTML design to a real React + Tailwind
|
|
14
|
+
* app. The seed carries:
|
|
15
|
+
* - The design's semantic HTML (up to `MAX_HTML_BYTES` per file).
|
|
16
|
+
* - The `:root` CSS custom-property block extracted from each file.
|
|
17
|
+
* - Any Brand Kit token summary from the linked design system.
|
|
18
|
+
* - Human-readable migration instructions for the Builder cloud agent.
|
|
19
|
+
*
|
|
20
|
+
* Nothing in this module calls the Builder API directly. API calls happen in
|
|
21
|
+
* `migrate-inline-design-to-app.ts` (action) via `runBuilderAgent`.
|
|
22
|
+
*
|
|
23
|
+
* Security note: credential values are never included in return types or seed
|
|
24
|
+
* content. The `resolveBuilderStatus` function returns only boolean flags and
|
|
25
|
+
* the pre-built `connectUrl` from the core browser helpers.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import {
|
|
29
|
+
resolveBuilderBranchProjectId,
|
|
30
|
+
resolveIsBuilderBranchingEnabled,
|
|
31
|
+
} from "@agent-native/core/server";
|
|
32
|
+
import { resolveHasCompleteBuilderConnection } from "@agent-native/core/server";
|
|
33
|
+
import { getRequestUserEmail } from "@agent-native/core/server/request-context";
|
|
34
|
+
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
// Types
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
|
|
39
|
+
export interface BuilderConnectionStatus {
|
|
40
|
+
/** True when Builder credentials are configured and valid. */
|
|
41
|
+
connected: boolean;
|
|
42
|
+
/** True when a Builder branch project is also configured (= agents can run). */
|
|
43
|
+
builderEnabled: boolean;
|
|
44
|
+
/** The resolved Builder branch project ID, empty string when not configured. */
|
|
45
|
+
branchProjectId: string;
|
|
46
|
+
/** The email of the currently authenticated user (for routing the Builder job). */
|
|
47
|
+
ownerEmail: string | null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface MigrationSeed {
|
|
51
|
+
/**
|
|
52
|
+
* The full migration prompt to hand to `runBuilderAgent`.
|
|
53
|
+
* Contains the design HTML, extracted CSS vars, token summary, and
|
|
54
|
+
* detailed instructions for the Builder cloud agent.
|
|
55
|
+
*/
|
|
56
|
+
prompt: string;
|
|
57
|
+
/**
|
|
58
|
+
* The number of design files included in the seed (capped at
|
|
59
|
+
* `MAX_SEED_FILES`).
|
|
60
|
+
*/
|
|
61
|
+
fileCount: number;
|
|
62
|
+
/**
|
|
63
|
+
* Total HTML bytes included in the seed (before any truncation).
|
|
64
|
+
*/
|
|
65
|
+
totalBytes: number;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// ---------------------------------------------------------------------------
|
|
69
|
+
// Constants
|
|
70
|
+
// ---------------------------------------------------------------------------
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Maximum number of files to include in the migration seed.
|
|
74
|
+
* Inline designs rarely exceed this; the cap keeps the Builder prompt
|
|
75
|
+
* within a safe token budget.
|
|
76
|
+
*/
|
|
77
|
+
const MAX_SEED_FILES = 10;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Maximum bytes per HTML file included in the migration seed.
|
|
81
|
+
* Files larger than this are truncated with an ellipsis notice so the
|
|
82
|
+
* Builder agent still sees the overall structure without exceeding its
|
|
83
|
+
* prompt limit.
|
|
84
|
+
*/
|
|
85
|
+
const MAX_HTML_BYTES_PER_FILE = 80_000;
|
|
86
|
+
|
|
87
|
+
// ---------------------------------------------------------------------------
|
|
88
|
+
// Connection status
|
|
89
|
+
// ---------------------------------------------------------------------------
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Return the Builder connection status for the current request context.
|
|
93
|
+
*
|
|
94
|
+
* Delegates to core helpers (`resolveHasCompleteBuilderConnection`,
|
|
95
|
+
* `resolveIsBuilderBranchingEnabled`, `resolveBuilderBranchProjectId`) so
|
|
96
|
+
* credential resolution lives in one place and is never duplicated here.
|
|
97
|
+
*
|
|
98
|
+
* Usage:
|
|
99
|
+
* ```ts
|
|
100
|
+
* const status = await resolveBuilderStatus();
|
|
101
|
+
* if (!status.builderEnabled) {
|
|
102
|
+
* return { cta: "connect-builder" };
|
|
103
|
+
* }
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
export async function resolveBuilderStatus(): Promise<BuilderConnectionStatus> {
|
|
107
|
+
const [connected, builderEnabled, branchProjectId] = await Promise.all([
|
|
108
|
+
resolveHasCompleteBuilderConnection(),
|
|
109
|
+
resolveIsBuilderBranchingEnabled(),
|
|
110
|
+
resolveBuilderBranchProjectId(),
|
|
111
|
+
]);
|
|
112
|
+
|
|
113
|
+
return {
|
|
114
|
+
connected,
|
|
115
|
+
builderEnabled,
|
|
116
|
+
branchProjectId,
|
|
117
|
+
ownerEmail: getRequestUserEmail() ?? null,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// ---------------------------------------------------------------------------
|
|
122
|
+
// CSS-var extraction
|
|
123
|
+
// ---------------------------------------------------------------------------
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Extract the `:root` block(s) from a raw HTML/CSS string.
|
|
127
|
+
*
|
|
128
|
+
* Returns only the lines inside `:root { … }` declarations to keep the
|
|
129
|
+
* migration seed focused on custom-property tokens rather than the full
|
|
130
|
+
* stylesheet. Falls back to the empty string when no `:root` block is found.
|
|
131
|
+
*/
|
|
132
|
+
function extractRootCssVars(html: string): string {
|
|
133
|
+
// Match one or more :root { … } blocks (non-greedy, handles multi-block files).
|
|
134
|
+
const matches = [...html.matchAll(/:root\s*\{([^}]*)\}/g)];
|
|
135
|
+
if (matches.length === 0) return "";
|
|
136
|
+
|
|
137
|
+
const lines: string[] = [];
|
|
138
|
+
for (const match of matches) {
|
|
139
|
+
const block = match[1] ?? "";
|
|
140
|
+
for (const line of block.split("\n")) {
|
|
141
|
+
const trimmed = line.trim();
|
|
142
|
+
// Only include CSS custom property declarations (--var: value;).
|
|
143
|
+
if (trimmed.startsWith("--") && trimmed.includes(":")) {
|
|
144
|
+
lines.push(` ${trimmed}`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return lines.length > 0 ? `:root {\n${lines.join("\n")}\n}` : "";
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// ---------------------------------------------------------------------------
|
|
152
|
+
// Migration seed builder
|
|
153
|
+
// ---------------------------------------------------------------------------
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Build the migration seed prompt for the Builder cloud agent.
|
|
157
|
+
*
|
|
158
|
+
* @param params.title - Human-readable design title (used in the prompt header).
|
|
159
|
+
* @param params.files - Current design files (id + filename + content + fileType).
|
|
160
|
+
* @param params.resolvedCssVars - Resolved CSS-var → value map from tweak selections.
|
|
161
|
+
* @param params.brandKitSummary - Optional human-readable token summary from the
|
|
162
|
+
* linked design system (e.g. from `index-design-tokens`).
|
|
163
|
+
*
|
|
164
|
+
* The caller is responsible for fetching the design snapshot first. This
|
|
165
|
+
* function is pure (no DB or network calls) so it is easy to test and reuse.
|
|
166
|
+
*/
|
|
167
|
+
export function buildMigrationSeed(params: {
|
|
168
|
+
title: string;
|
|
169
|
+
files: Array<{
|
|
170
|
+
filename: string;
|
|
171
|
+
content: string;
|
|
172
|
+
fileType: string;
|
|
173
|
+
}>;
|
|
174
|
+
resolvedCssVars?: Record<string, string>;
|
|
175
|
+
brandKitSummary?: string;
|
|
176
|
+
}): MigrationSeed {
|
|
177
|
+
const { title, files, resolvedCssVars, brandKitSummary } = params;
|
|
178
|
+
|
|
179
|
+
// Limit file count.
|
|
180
|
+
const seedFiles = files.slice(0, MAX_SEED_FILES);
|
|
181
|
+
let totalBytes = 0;
|
|
182
|
+
|
|
183
|
+
// Build per-file sections.
|
|
184
|
+
const fileSections: string[] = [];
|
|
185
|
+
for (const file of seedFiles) {
|
|
186
|
+
const rawBytes = new TextEncoder().encode(file.content).length;
|
|
187
|
+
totalBytes += rawBytes;
|
|
188
|
+
|
|
189
|
+
let content = file.content;
|
|
190
|
+
let truncationNote = "";
|
|
191
|
+
if (rawBytes > MAX_HTML_BYTES_PER_FILE) {
|
|
192
|
+
content = file.content.slice(0, MAX_HTML_BYTES_PER_FILE);
|
|
193
|
+
truncationNote = `\n<!-- [TRUNCATED: original file was ${rawBytes} bytes; only the first ${MAX_HTML_BYTES_PER_FILE} bytes are shown] -->`;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Extract :root CSS vars from each file for the token block.
|
|
197
|
+
const cssVars = extractRootCssVars(content);
|
|
198
|
+
|
|
199
|
+
const section = [
|
|
200
|
+
`### File: ${file.filename}`,
|
|
201
|
+
"```html",
|
|
202
|
+
content,
|
|
203
|
+
truncationNote,
|
|
204
|
+
"```",
|
|
205
|
+
...(cssVars
|
|
206
|
+
? [
|
|
207
|
+
"",
|
|
208
|
+
"**Extracted CSS custom properties (design tokens):**",
|
|
209
|
+
"```css",
|
|
210
|
+
cssVars,
|
|
211
|
+
"```",
|
|
212
|
+
]
|
|
213
|
+
: []),
|
|
214
|
+
]
|
|
215
|
+
.filter((l) => l !== "")
|
|
216
|
+
.join("\n");
|
|
217
|
+
|
|
218
|
+
fileSections.push(section);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Build the resolved CSS vars block (from tweak selections).
|
|
222
|
+
let resolvedVarsBlock = "";
|
|
223
|
+
if (resolvedCssVars && Object.keys(resolvedCssVars).length > 0) {
|
|
224
|
+
const lines = Object.entries(resolvedCssVars)
|
|
225
|
+
.map(([k, v]) => ` ${k}: ${v};`)
|
|
226
|
+
.join("\n");
|
|
227
|
+
resolvedVarsBlock = [
|
|
228
|
+
"",
|
|
229
|
+
"## User-tuned token overrides (apply these values in the real app)",
|
|
230
|
+
"```css",
|
|
231
|
+
`:root {\n${lines}\n}`,
|
|
232
|
+
"```",
|
|
233
|
+
].join("\n");
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// Brand Kit summary block.
|
|
237
|
+
const brandKitBlock =
|
|
238
|
+
brandKitSummary && brandKitSummary.trim()
|
|
239
|
+
? [
|
|
240
|
+
"",
|
|
241
|
+
"## Brand Kit / Design System tokens",
|
|
242
|
+
brandKitSummary.trim(),
|
|
243
|
+
].join("\n")
|
|
244
|
+
: "";
|
|
245
|
+
|
|
246
|
+
// Build the full prompt.
|
|
247
|
+
const omittedFilesNote =
|
|
248
|
+
files.length > MAX_SEED_FILES
|
|
249
|
+
? `\n> Note: ${files.length - MAX_SEED_FILES} additional file(s) were omitted to stay within the prompt limit.\n`
|
|
250
|
+
: "";
|
|
251
|
+
|
|
252
|
+
const prompt = [
|
|
253
|
+
`# Migrate inline design to React app: "${title}"`,
|
|
254
|
+
"",
|
|
255
|
+
"You are a Builder cloud agent. The user has an inline Alpine.js / Tailwind HTML prototype",
|
|
256
|
+
"that they want to migrate to a real React + TypeScript + Tailwind app.",
|
|
257
|
+
"",
|
|
258
|
+
"## Your task",
|
|
259
|
+
"1. Convert the HTML prototype below into a production-quality React + TypeScript + Tailwind",
|
|
260
|
+
" application, preserving the visual design and UX faithfully.",
|
|
261
|
+
"2. Map Alpine.js `x-data` / `x-show` / `x-bind` patterns to React state, conditional",
|
|
262
|
+
" rendering, and event handlers.",
|
|
263
|
+
"3. Extract inline styles and repeated patterns into reusable React components with",
|
|
264
|
+
" Tailwind classes. Preserve the `:root` CSS custom properties as a `globals.css` file",
|
|
265
|
+
" and wire them into the Tailwind theme config.",
|
|
266
|
+
"4. Carry all design tokens (color, typography, spacing, radius) from the `:root` block",
|
|
267
|
+
" into the generated `globals.css` and `tailwind.config.ts` so the visual identity is",
|
|
268
|
+
" identical to the original prototype.",
|
|
269
|
+
"5. Do not introduce placeholder data or lorem ipsum. Keep the structural content",
|
|
270
|
+
" from the original design.",
|
|
271
|
+
"6. Use shadcn/ui primitives (Button, Card, Dialog, Input, etc.) where the HTML uses",
|
|
272
|
+
" semantically equivalent patterns.",
|
|
273
|
+
"7. The app must compile and render without errors.",
|
|
274
|
+
"",
|
|
275
|
+
"## Source design files",
|
|
276
|
+
omittedFilesNote,
|
|
277
|
+
...fileSections,
|
|
278
|
+
resolvedVarsBlock,
|
|
279
|
+
brandKitBlock,
|
|
280
|
+
"",
|
|
281
|
+
"## Output expectations",
|
|
282
|
+
"- A fully working React app in the current project branch.",
|
|
283
|
+
"- `src/app/globals.css` containing all `:root` CSS custom properties from above.",
|
|
284
|
+
"- `tailwind.config.ts` wiring those vars into the Tailwind theme.",
|
|
285
|
+
"- At least one page component that renders the migrated design.",
|
|
286
|
+
"- All Alpine `x-data` patterns converted to React hooks / state.",
|
|
287
|
+
"- All Tailwind CDN classes preserved as-is in JSX.",
|
|
288
|
+
]
|
|
289
|
+
.filter((l) => l !== undefined && l !== null)
|
|
290
|
+
.join("\n");
|
|
291
|
+
|
|
292
|
+
return {
|
|
293
|
+
prompt,
|
|
294
|
+
fileCount: seedFiles.length,
|
|
295
|
+
totalBytes,
|
|
296
|
+
};
|
|
297
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Source capability resolver — pure, no DB, no side effects.
|
|
3
|
+
*
|
|
4
|
+
* Maps a `DesignSourceType` (inline | localhost | fusion) to the concrete
|
|
5
|
+
* `DesignSourceCapabilities` map. Callers that have already proven a richer
|
|
6
|
+
* capability set (e.g. a localhost bridge that has verified `readFile`) should
|
|
7
|
+
* override the defaults after calling this function.
|
|
8
|
+
*
|
|
9
|
+
* The canonical tier semantics live in `DESIGN-STUDIO-PLAN.md` §5:
|
|
10
|
+
*
|
|
11
|
+
* - **inline** — HTML/CSS preview + controlled writes via the deterministic
|
|
12
|
+
* `replace-document-content` / `apply-tweaks` path; `previewMotion` + Tier-A
|
|
13
|
+
* `writeMotion` (managed `<style data-agent-native-motion>` block) and CSS-var
|
|
14
|
+
* token edits are available without a file-write bridge.
|
|
15
|
+
* - **localhost** — starts read-only/preview-only; `readFile` / `applyEdit` /
|
|
16
|
+
* `writeFile` and real-app capabilities (`indexComponents`, `writeTokens`)
|
|
17
|
+
* become `available` only after bridge hardening.
|
|
18
|
+
* - **fusion (Builder)** — starts preview-only; unlocks the full set
|
|
19
|
+
* (`indexComponents`, `writeTokens`, `writeMotion`, `branch`, `deploy`) once
|
|
20
|
+
* the bridge proves capabilities.
|
|
21
|
+
*
|
|
22
|
+
* The UI must never infer write ability from `sourceType` alone; it must always
|
|
23
|
+
* read the capability map returned here (or an overridden variant).
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import {
|
|
27
|
+
available,
|
|
28
|
+
planned,
|
|
29
|
+
unavailable,
|
|
30
|
+
INLINE_DEFAULT_CAPABILITIES,
|
|
31
|
+
LOCALHOST_DEFAULT_CAPABILITIES,
|
|
32
|
+
FUSION_DISCONNECTED_CAPABILITIES,
|
|
33
|
+
FUSION_CONNECTED_CAPABILITIES,
|
|
34
|
+
type DesignSourceCapabilities,
|
|
35
|
+
} from "./design-source-capabilities";
|
|
36
|
+
import type { DesignSourceType } from "./source-mode";
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Return the default `DesignSourceCapabilities` for the given `sourceType`.
|
|
40
|
+
*
|
|
41
|
+
* These are **defaults** — they represent the conservative starting point for
|
|
42
|
+
* a freshly connected source. Callers that have runtime evidence of a richer
|
|
43
|
+
* capability set (e.g. a bridge handshake that confirmed `readFile` works)
|
|
44
|
+
* should spread/override specific entries rather than calling this function
|
|
45
|
+
* again.
|
|
46
|
+
*
|
|
47
|
+
* ```ts
|
|
48
|
+
* const caps = resolveSourceCapabilities(design.sourceType);
|
|
49
|
+
* // Override after bridge handshake:
|
|
50
|
+
* const proven: DesignSourceCapabilities = {
|
|
51
|
+
* ...caps,
|
|
52
|
+
* readFile: available("Bridge verified"),
|
|
53
|
+
* };
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @param sourceType - The source type from `DesignSourceType`.
|
|
57
|
+
* @returns A read-only snapshot of the default capability map.
|
|
58
|
+
*/
|
|
59
|
+
export function resolveSourceCapabilities(
|
|
60
|
+
sourceType: DesignSourceType,
|
|
61
|
+
): DesignSourceCapabilities {
|
|
62
|
+
switch (sourceType) {
|
|
63
|
+
case "inline":
|
|
64
|
+
return INLINE_DEFAULT_CAPABILITIES;
|
|
65
|
+
case "localhost":
|
|
66
|
+
return LOCALHOST_DEFAULT_CAPABILITIES;
|
|
67
|
+
case "fusion":
|
|
68
|
+
// Conservative default for fusion when connection status is unknown.
|
|
69
|
+
// Use resolveFusionCapabilities(connected) when Builder connection status
|
|
70
|
+
// is known, or resolveDescriptorCapabilities() which honours the
|
|
71
|
+
// descriptor's proven capabilities map.
|
|
72
|
+
return FUSION_DISCONNECTED_CAPABILITIES;
|
|
73
|
+
default: {
|
|
74
|
+
// Exhaustive check — TypeScript will catch unhandled variants.
|
|
75
|
+
const _exhaustive: never = sourceType;
|
|
76
|
+
void _exhaustive;
|
|
77
|
+
// Fallback: safest option is inline (no file writes, no real-app ops).
|
|
78
|
+
return INLINE_DEFAULT_CAPABILITIES;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Return the correct `DesignSourceCapabilities` for a **fusion** source based
|
|
85
|
+
* on the current Builder connection status.
|
|
86
|
+
*
|
|
87
|
+
* Per DESIGN-STUDIO-PLAN.md §5:
|
|
88
|
+
* - **Not connected** (`connected = false`): preview-only. No real-app write
|
|
89
|
+
* operations (`indexComponents`, `branch`, `deployPreview`, `deploy`,
|
|
90
|
+
* `writeFile`, `writeTokens`, `writeMotion`) are available.
|
|
91
|
+
* - **Connected** (`connected = true`): `indexComponents`, `branch`,
|
|
92
|
+
* `deployPreview`, and `deploy` are **available**. Source writes
|
|
93
|
+
* (`writeFile`, `writeTokens`, `writeMotion`) remain **planned** until
|
|
94
|
+
* bridge hardening is complete.
|
|
95
|
+
*
|
|
96
|
+
* Usage (in an action that already resolved Builder status):
|
|
97
|
+
* ```ts
|
|
98
|
+
* import { resolveFusionCapabilities } from "../shared/capability-resolver.js";
|
|
99
|
+
* import { resolveIsBuilderBranchingEnabled } from "@agent-native/core/server";
|
|
100
|
+
*
|
|
101
|
+
* const connected = await resolveIsBuilderBranchingEnabled();
|
|
102
|
+
* const caps = resolveFusionCapabilities(connected);
|
|
103
|
+
* if (hasCapability(caps, "branch")) { ... }
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* @param connected - `true` when Builder credentials are configured AND a
|
|
107
|
+
* branch project is set (i.e. `resolveIsBuilderBranchingEnabled()` returns
|
|
108
|
+
* `true`).
|
|
109
|
+
*/
|
|
110
|
+
export function resolveFusionCapabilities(
|
|
111
|
+
connected: boolean,
|
|
112
|
+
): DesignSourceCapabilities {
|
|
113
|
+
return connected
|
|
114
|
+
? FUSION_CONNECTED_CAPABILITIES
|
|
115
|
+
: FUSION_DISCONNECTED_CAPABILITIES;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Re-export factory helpers so callers only need this module to build
|
|
119
|
+
// capability maps with override entries.
|
|
120
|
+
export { available, planned, unavailable };
|
|
121
|
+
export type { DesignSourceCapabilities };
|
|
122
|
+
// Re-export the fusion constants for callers that prefer direct access.
|
|
123
|
+
export { FUSION_CONNECTED_CAPABILITIES, FUSION_DISCONNECTED_CAPABILITIES };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared sanitization helpers for design state capture payloads.
|
|
3
|
+
*
|
|
4
|
+
* Used by both create-design-state and capture-design-state to enforce a
|
|
5
|
+
* consistent stored-XSS guard and size cap before persisting arbitrary
|
|
6
|
+
* caller-supplied markup / DOM snapshots into `design_state` rows.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Maximum serialised size of a captured/replayed `captureData` or
|
|
11
|
+
* `fixtureData` payload. Caps single-row size to protect the DB and the
|
|
12
|
+
* shareable content each row feeds.
|
|
13
|
+
*/
|
|
14
|
+
export const CAPTURE_DATA_MAX_BYTES = 256 * 1024; // 256 KB
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Strip stored-XSS vectors out of an HTML/markup string before it is persisted
|
|
18
|
+
* and later replayed into shareable design content. Mirrors the framework's
|
|
19
|
+
* text-edit HTML sanitiser: removes script/style/iframe/object/embed/link/meta/
|
|
20
|
+
* base tags, inline `on*` handlers, and `javascript:` / `vbscript:` / `data:`
|
|
21
|
+
* URLs in `href` / `src` / `xlink:href`.
|
|
22
|
+
*/
|
|
23
|
+
export function sanitizeMarkup(html: string): string {
|
|
24
|
+
return html
|
|
25
|
+
.replace(
|
|
26
|
+
/<\s*(script|style|iframe|object|embed|link|meta|base)\b[\s\S]*?<\s*\/\s*\1\s*>/gi,
|
|
27
|
+
"",
|
|
28
|
+
)
|
|
29
|
+
.replace(
|
|
30
|
+
/<\s*(script|style|iframe|object|embed|link|meta|base)\b[^>]*\/?\s*>/gi,
|
|
31
|
+
"",
|
|
32
|
+
)
|
|
33
|
+
.replace(/\s+on[A-Za-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/g, "")
|
|
34
|
+
.replace(
|
|
35
|
+
/\s+(href|src|xlink:href)\s*=\s*(?:(["'])\s*(?:javascript|vbscript|data):[\s\S]*?\2|(?:javascript|vbscript|data):[^\s>]*)/gi,
|
|
36
|
+
"",
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A string "looks like markup" — and is therefore worth sanitising — when it
|
|
42
|
+
* contains an angle-bracket tag opener or an Alpine `x-`/`@`/`:` binding that
|
|
43
|
+
* could carry script. Plain data strings (route names, ids) are left untouched.
|
|
44
|
+
*/
|
|
45
|
+
export function looksLikeMarkup(value: string): boolean {
|
|
46
|
+
return /<[a-zA-Z!/]/.test(value) || value.includes("</");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Recursively sanitise every string value inside a captured/replayed
|
|
51
|
+
* `captureData` or `fixtureData` object (e.g. `domHtml`, `domSnapshot`,
|
|
52
|
+
* `x-data` markup) so no untrusted DOM is persisted raw. Non-string leaves
|
|
53
|
+
* pass through unchanged.
|
|
54
|
+
*/
|
|
55
|
+
export function sanitizeCaptureData(value: unknown): unknown {
|
|
56
|
+
if (typeof value === "string") {
|
|
57
|
+
return looksLikeMarkup(value) ? sanitizeMarkup(value) : value;
|
|
58
|
+
}
|
|
59
|
+
if (Array.isArray(value)) {
|
|
60
|
+
return value.map((entry) => sanitizeCaptureData(entry));
|
|
61
|
+
}
|
|
62
|
+
if (value && typeof value === "object") {
|
|
63
|
+
const out: Record<string, unknown> = {};
|
|
64
|
+
for (const [k, v] of Object.entries(value as Record<string, unknown>)) {
|
|
65
|
+
out[k] = sanitizeCaptureData(v);
|
|
66
|
+
}
|
|
67
|
+
return out;
|
|
68
|
+
}
|
|
69
|
+
return value;
|
|
70
|
+
}
|