@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,143 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core";
|
|
2
|
+
import { assertAccess } from "@agent-native/core/sharing";
|
|
3
|
+
import { eq } from "drizzle-orm";
|
|
4
|
+
import { nanoid } from "nanoid";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
|
|
7
|
+
import { getDb, schema } from "../server/db/index.js";
|
|
8
|
+
import "../server/db/index.js"; // ensure registerShareableResource runs
|
|
9
|
+
import type {
|
|
10
|
+
BreakpointDefinition,
|
|
11
|
+
BreakpointSet,
|
|
12
|
+
} from "../shared/design-state.js";
|
|
13
|
+
import { widthToPrefix } from "../shared/responsive-classes.js";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Read the active breakpoint set from designs.data, or return a fresh one.
|
|
17
|
+
* Breakpoint sets are stored inline in `designs.data.breakpointSet` rather
|
|
18
|
+
* than a dedicated table (simplest additive storage for v1; a dedicated table
|
|
19
|
+
* can be added later if per-screen sets are needed).
|
|
20
|
+
*
|
|
21
|
+
* Follow-up: if per-screen breakpoint sets become necessary, add a
|
|
22
|
+
* `design_breakpoint_set` table keyed by (design_id, file_id) and migrate
|
|
23
|
+
* this in-data storage to it.
|
|
24
|
+
*/
|
|
25
|
+
function readBreakpointSet(designData: string | null): BreakpointSet {
|
|
26
|
+
if (designData) {
|
|
27
|
+
try {
|
|
28
|
+
const parsed = JSON.parse(designData) as Record<string, unknown>;
|
|
29
|
+
if (parsed.breakpointSet && typeof parsed.breakpointSet === "object") {
|
|
30
|
+
return parsed.breakpointSet as BreakpointSet;
|
|
31
|
+
}
|
|
32
|
+
} catch {
|
|
33
|
+
// ignore parse errors; fall through to default
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return { id: nanoid(), breakpoints: [] };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function writeBreakpointSet(
|
|
40
|
+
designData: string | null,
|
|
41
|
+
set: BreakpointSet,
|
|
42
|
+
now: string,
|
|
43
|
+
): string {
|
|
44
|
+
let prev: Record<string, unknown> = {};
|
|
45
|
+
if (designData) {
|
|
46
|
+
try {
|
|
47
|
+
const parsed = JSON.parse(designData);
|
|
48
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
49
|
+
prev = parsed;
|
|
50
|
+
}
|
|
51
|
+
} catch {
|
|
52
|
+
// ignore
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return JSON.stringify({
|
|
56
|
+
...prev,
|
|
57
|
+
breakpointSet: set,
|
|
58
|
+
breakpointSetUpdatedAt: now,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default defineAction({
|
|
63
|
+
description:
|
|
64
|
+
"Add a breakpoint frame to the design's breakpoint set. " +
|
|
65
|
+
"The breakpoint set is stored in designs.data and controls which side-by-side " +
|
|
66
|
+
"device widths are shown in the overview canvas (Mobile 390 / Tablet 768 / Desktop 1280, " +
|
|
67
|
+
"or a custom width). The Tailwind prefix is derived automatically from the width. " +
|
|
68
|
+
"Duplicate widths are silently ignored.",
|
|
69
|
+
schema: z.object({
|
|
70
|
+
designId: z.string().describe("Design project ID"),
|
|
71
|
+
label: z
|
|
72
|
+
.string()
|
|
73
|
+
.min(1)
|
|
74
|
+
.describe(
|
|
75
|
+
"Human-readable label shown in the canvas header (e.g. 'Mobile', 'Tablet', 'Desktop').",
|
|
76
|
+
),
|
|
77
|
+
widthPx: z
|
|
78
|
+
.number()
|
|
79
|
+
.int()
|
|
80
|
+
.min(320)
|
|
81
|
+
.max(3840)
|
|
82
|
+
.describe(
|
|
83
|
+
"Frame width in pixels. Snaps semantics to the nearest Tailwind min-width threshold " +
|
|
84
|
+
"(sm:640 / md:768 / lg:1024 / xl:1280 / 2xl:1536); the exact pixel value is preserved " +
|
|
85
|
+
"for the frame geometry.",
|
|
86
|
+
),
|
|
87
|
+
id: z
|
|
88
|
+
.string()
|
|
89
|
+
.optional()
|
|
90
|
+
.describe("Optional pre-generated id. Omit to auto-generate."),
|
|
91
|
+
}),
|
|
92
|
+
run: async ({ designId, label, widthPx, id: providedId }) => {
|
|
93
|
+
await assertAccess("design", designId, "editor");
|
|
94
|
+
|
|
95
|
+
const db = getDb();
|
|
96
|
+
const [design] = await db
|
|
97
|
+
.select({ data: schema.designs.data })
|
|
98
|
+
.from(schema.designs)
|
|
99
|
+
.where(eq(schema.designs.id, designId))
|
|
100
|
+
.limit(1);
|
|
101
|
+
|
|
102
|
+
if (!design) throw new Error(`Design '${designId}' not found.`);
|
|
103
|
+
|
|
104
|
+
const set = readBreakpointSet(design.data);
|
|
105
|
+
|
|
106
|
+
// Ignore duplicate widths.
|
|
107
|
+
if (set.breakpoints.some((bp) => bp.widthPx === widthPx)) {
|
|
108
|
+
return {
|
|
109
|
+
ignored: true,
|
|
110
|
+
reason: `A breakpoint with width ${widthPx}px already exists.`,
|
|
111
|
+
breakpointSet: set,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const breakpointId = providedId ?? nanoid();
|
|
116
|
+
const prefix = widthToPrefix(widthPx);
|
|
117
|
+
|
|
118
|
+
const newBreakpoint: BreakpointDefinition = {
|
|
119
|
+
id: breakpointId,
|
|
120
|
+
label,
|
|
121
|
+
widthPx,
|
|
122
|
+
prefix,
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// Insert sorted by widthPx ascending (Mobile → Tablet → Desktop).
|
|
126
|
+
const breakpoints = [...set.breakpoints, newBreakpoint].sort(
|
|
127
|
+
(a, b) => a.widthPx - b.widthPx,
|
|
128
|
+
);
|
|
129
|
+
const updatedSet: BreakpointSet = { ...set, breakpoints };
|
|
130
|
+
|
|
131
|
+
const now = new Date().toISOString();
|
|
132
|
+
const updatedData = writeBreakpointSet(design.data, updatedSet, now);
|
|
133
|
+
await db
|
|
134
|
+
.update(schema.designs)
|
|
135
|
+
.set({ data: updatedData, updatedAt: now })
|
|
136
|
+
.where(eq(schema.designs.id, designId));
|
|
137
|
+
|
|
138
|
+
return {
|
|
139
|
+
added: newBreakpoint,
|
|
140
|
+
breakpointSet: updatedSet,
|
|
141
|
+
};
|
|
142
|
+
},
|
|
143
|
+
});
|
|
@@ -30,6 +30,7 @@ const routeInputSchema = z.object({
|
|
|
30
30
|
path: z.string().optional(),
|
|
31
31
|
url: z.string().optional(),
|
|
32
32
|
title: z.string().optional(),
|
|
33
|
+
sourceFile: z.string().optional(),
|
|
33
34
|
width: z.number().positive().optional(),
|
|
34
35
|
height: z.number().positive().optional(),
|
|
35
36
|
x: z.number().optional(),
|
|
@@ -307,6 +308,7 @@ export default defineAction({
|
|
|
307
308
|
path: string;
|
|
308
309
|
url: string;
|
|
309
310
|
routeId: string;
|
|
311
|
+
sourceFile?: string;
|
|
310
312
|
width: number;
|
|
311
313
|
height: number;
|
|
312
314
|
}> = [];
|
|
@@ -330,6 +332,7 @@ export default defineAction({
|
|
|
330
332
|
input.routeId ?? manifestRoute?.id ?? makeLocalhostRouteId(path);
|
|
331
333
|
const title =
|
|
332
334
|
input.title ?? manifestRoute?.title ?? titleFromRoutePath(path);
|
|
335
|
+
const sourceFile = input.sourceFile ?? manifestRoute?.sourceFile;
|
|
333
336
|
const width = input.width ?? defaultWidth;
|
|
334
337
|
const height = input.height ?? defaultHeight;
|
|
335
338
|
const preferredFilename = `localhost-${slugForPath(path)}.html`;
|
|
@@ -369,6 +372,7 @@ export default defineAction({
|
|
|
369
372
|
path,
|
|
370
373
|
url,
|
|
371
374
|
routeId,
|
|
375
|
+
sourceFile,
|
|
372
376
|
width,
|
|
373
377
|
height,
|
|
374
378
|
});
|
|
@@ -406,6 +410,7 @@ export default defineAction({
|
|
|
406
410
|
previewUrl: screen.url,
|
|
407
411
|
connectionId: connection.id,
|
|
408
412
|
routeId: screen.routeId,
|
|
413
|
+
sourceFile: screen.sourceFile,
|
|
409
414
|
path: screen.path,
|
|
410
415
|
bridgeUrl: connection.bridgeUrl ?? undefined,
|
|
411
416
|
};
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* apply-a11y-fix — apply an inline accessibility remediation to a design's
|
|
3
|
+
* SQL-backed HTML content.
|
|
4
|
+
*
|
|
5
|
+
* The Review panel surfaces a11y findings from `run-design-audit`. Many common
|
|
6
|
+
* fixes — raising text contrast, enlarging a tap target, adding a
|
|
7
|
+
* focus-visible ring — are ordinary style / class edits that the deterministic
|
|
8
|
+
* edit engine (`applyVisualEdit`, also used by `apply-visual-edit`) can apply to
|
|
9
|
+
* inline HTML. This action takes one such finding, derives the deterministic
|
|
10
|
+
* edit via the shared `a11yFindingToEdit` mapping, applies it, and persists the
|
|
11
|
+
* patched content. The canvas re-renders from the written content — no iframe
|
|
12
|
+
* postMessage is needed.
|
|
13
|
+
*
|
|
14
|
+
* Fixes that need a new attribute (alt / aria-label) or a semantic/structural
|
|
15
|
+
* rewrite are NOT expressible through the deterministic engine and remain
|
|
16
|
+
* "real-app only": `a11yFindingToEdit` returns `null` for them and this action
|
|
17
|
+
* reports them as not auto-fixable instead of writing.
|
|
18
|
+
*
|
|
19
|
+
* Access is gated: only an editor of the design may apply a fix.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { defineAction } from "@agent-native/core";
|
|
23
|
+
import {
|
|
24
|
+
agentEnterDocument,
|
|
25
|
+
agentLeaveDocument,
|
|
26
|
+
agentUpdateSelection,
|
|
27
|
+
applyText,
|
|
28
|
+
getText,
|
|
29
|
+
hasCollabState,
|
|
30
|
+
seedFromText,
|
|
31
|
+
} from "@agent-native/core/collab";
|
|
32
|
+
import { accessFilter, assertAccess } from "@agent-native/core/sharing";
|
|
33
|
+
import { and, eq } from "drizzle-orm";
|
|
34
|
+
import { z } from "zod";
|
|
35
|
+
|
|
36
|
+
import { getDb, schema } from "../server/db/index.js";
|
|
37
|
+
import { applyVisualEdit, type EditIntent } from "../shared/code-layer.js";
|
|
38
|
+
import {
|
|
39
|
+
A11Y_FINDING_CATEGORIES,
|
|
40
|
+
A11Y_FINDING_SEVERITIES,
|
|
41
|
+
a11yFindingToEdit,
|
|
42
|
+
type A11yFinding,
|
|
43
|
+
} from "../shared/design-review.js";
|
|
44
|
+
|
|
45
|
+
// ---------------------------------------------------------------------------
|
|
46
|
+
// Schemas
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The subset of an {@link A11yFinding} the fix needs. The full finding is
|
|
51
|
+
* accepted (extra fields are stripped) so callers can forward what they already
|
|
52
|
+
* have from `run-design-audit` / `get-design-review` verbatim.
|
|
53
|
+
*/
|
|
54
|
+
const findingSchema = z
|
|
55
|
+
.object({
|
|
56
|
+
id: z.string(),
|
|
57
|
+
severity: z.enum(A11Y_FINDING_SEVERITIES),
|
|
58
|
+
category: z.enum(A11Y_FINDING_CATEGORIES),
|
|
59
|
+
message: z.string().default(""),
|
|
60
|
+
detail: z.string().optional(),
|
|
61
|
+
nodeId: z.string().optional(),
|
|
62
|
+
selector: z.string().optional(),
|
|
63
|
+
wcag: z.string().optional(),
|
|
64
|
+
fixAvailable: z.boolean().optional(),
|
|
65
|
+
})
|
|
66
|
+
.superRefine((finding, ctx) => {
|
|
67
|
+
if (!finding.nodeId && !finding.selector) {
|
|
68
|
+
ctx.addIssue({
|
|
69
|
+
code: z.ZodIssueCode.custom,
|
|
70
|
+
path: ["nodeId"],
|
|
71
|
+
message:
|
|
72
|
+
"finding.nodeId or finding.selector is required to anchor the fix.",
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// ---------------------------------------------------------------------------
|
|
78
|
+
// Live-content + resolve/persist helpers (mirrors apply-visual-edit's scoped path)
|
|
79
|
+
// ---------------------------------------------------------------------------
|
|
80
|
+
|
|
81
|
+
async function liveContent(
|
|
82
|
+
fileId: string,
|
|
83
|
+
storedContent: string,
|
|
84
|
+
): Promise<string> {
|
|
85
|
+
try {
|
|
86
|
+
if (await hasCollabState(fileId)) {
|
|
87
|
+
const live = await getText(fileId, "content");
|
|
88
|
+
if (typeof live === "string") return live;
|
|
89
|
+
}
|
|
90
|
+
} catch {
|
|
91
|
+
// Collab reads are best-effort; SQL content remains the fallback.
|
|
92
|
+
}
|
|
93
|
+
return storedContent;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async function resolveEditableDesignFile(source: {
|
|
97
|
+
designId?: string;
|
|
98
|
+
fileId?: string;
|
|
99
|
+
filename?: string;
|
|
100
|
+
}): Promise<{
|
|
101
|
+
id: string;
|
|
102
|
+
designId: string;
|
|
103
|
+
filename: string;
|
|
104
|
+
content: string;
|
|
105
|
+
}> {
|
|
106
|
+
if (!source.fileId && !source.designId) {
|
|
107
|
+
throw new Error("designId or fileId is required.");
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const db = getDb();
|
|
111
|
+
const conditions = [
|
|
112
|
+
accessFilter(schema.designs, schema.designShares),
|
|
113
|
+
source.fileId
|
|
114
|
+
? eq(schema.designFiles.id, source.fileId)
|
|
115
|
+
: eq(schema.designFiles.designId, source.designId ?? ""),
|
|
116
|
+
];
|
|
117
|
+
if (!source.fileId) {
|
|
118
|
+
conditions.push(
|
|
119
|
+
eq(schema.designFiles.filename, source.filename ?? "index.html"),
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const [file] = await db
|
|
124
|
+
.select({
|
|
125
|
+
id: schema.designFiles.id,
|
|
126
|
+
designId: schema.designFiles.designId,
|
|
127
|
+
filename: schema.designFiles.filename,
|
|
128
|
+
fileType: schema.designFiles.fileType,
|
|
129
|
+
content: schema.designFiles.content,
|
|
130
|
+
})
|
|
131
|
+
.from(schema.designFiles)
|
|
132
|
+
.innerJoin(
|
|
133
|
+
schema.designs,
|
|
134
|
+
eq(schema.designFiles.designId, schema.designs.id),
|
|
135
|
+
)
|
|
136
|
+
.where(and(...conditions))
|
|
137
|
+
.limit(1);
|
|
138
|
+
|
|
139
|
+
if (!file) {
|
|
140
|
+
throw new Error("Design HTML file not found.");
|
|
141
|
+
}
|
|
142
|
+
if (file.fileType !== "html") {
|
|
143
|
+
throw new Error("Inline a11y fixes only support HTML files.");
|
|
144
|
+
}
|
|
145
|
+
if (source.designId && file.designId !== source.designId) {
|
|
146
|
+
throw new Error(
|
|
147
|
+
`designId "${source.designId}" does not match file "${file.id}"`,
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Writes require editor access to the owning design.
|
|
152
|
+
await assertAccess("design", file.designId, "editor");
|
|
153
|
+
|
|
154
|
+
return {
|
|
155
|
+
id: file.id,
|
|
156
|
+
designId: file.designId,
|
|
157
|
+
filename: file.filename,
|
|
158
|
+
content: await liveContent(file.id, file.content ?? ""),
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
async function persistDesignFileEdit(file: {
|
|
163
|
+
id: string;
|
|
164
|
+
designId: string;
|
|
165
|
+
content: string;
|
|
166
|
+
}): Promise<void> {
|
|
167
|
+
// Re-assert at the write boundary so the persist path is independently scoped.
|
|
168
|
+
await assertAccess("design", file.designId, "editor");
|
|
169
|
+
|
|
170
|
+
const db = getDb();
|
|
171
|
+
const now = new Date().toISOString();
|
|
172
|
+
|
|
173
|
+
agentEnterDocument(file.id);
|
|
174
|
+
try {
|
|
175
|
+
await db
|
|
176
|
+
.update(schema.designFiles)
|
|
177
|
+
.set({ content: file.content, updatedAt: now })
|
|
178
|
+
.where(eq(schema.designFiles.id, file.id));
|
|
179
|
+
|
|
180
|
+
if (await hasCollabState(file.id)) {
|
|
181
|
+
await applyText(file.id, file.content, "content", "agent");
|
|
182
|
+
} else {
|
|
183
|
+
await seedFromText(file.id, file.content);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
await db
|
|
187
|
+
.update(schema.designs)
|
|
188
|
+
.set({ updatedAt: now })
|
|
189
|
+
.where(eq(schema.designs.id, file.designId));
|
|
190
|
+
} finally {
|
|
191
|
+
agentLeaveDocument(file.id);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// ---------------------------------------------------------------------------
|
|
196
|
+
// Action
|
|
197
|
+
// ---------------------------------------------------------------------------
|
|
198
|
+
|
|
199
|
+
export default defineAction({
|
|
200
|
+
description:
|
|
201
|
+
"Apply one inline accessibility fix to a design's SQL-backed HTML. " +
|
|
202
|
+
"Given an a11y finding from run-design-audit (with a nodeId or selector), " +
|
|
203
|
+
"derives a deterministic style/class edit — raise text contrast, enlarge a " +
|
|
204
|
+
"tap target, or add a focus-visible ring — and persists it via the same " +
|
|
205
|
+
"edit engine as apply-visual-edit. Findings needing new attributes " +
|
|
206
|
+
"(alt / aria-label) or semantic/structural rewrites are not auto-fixable " +
|
|
207
|
+
"and are reported as such (no write). Editor access required.",
|
|
208
|
+
schema: z.object({
|
|
209
|
+
designId: z
|
|
210
|
+
.string()
|
|
211
|
+
.optional()
|
|
212
|
+
.describe(
|
|
213
|
+
"Design project id. Required unless fileId is provided. Combined with " +
|
|
214
|
+
"filename to resolve the HTML file to patch.",
|
|
215
|
+
),
|
|
216
|
+
fileId: z
|
|
217
|
+
.string()
|
|
218
|
+
.optional()
|
|
219
|
+
.describe(
|
|
220
|
+
"Specific design_files.id to patch. Takes priority over designId/filename.",
|
|
221
|
+
),
|
|
222
|
+
filename: z
|
|
223
|
+
.string()
|
|
224
|
+
.optional()
|
|
225
|
+
.default("index.html")
|
|
226
|
+
.describe(
|
|
227
|
+
"Filename to patch when fileId is not provided. Defaults to index.html.",
|
|
228
|
+
),
|
|
229
|
+
finding: findingSchema.describe(
|
|
230
|
+
"The a11y finding to fix. Must carry a nodeId or selector to anchor the edit.",
|
|
231
|
+
),
|
|
232
|
+
color: z
|
|
233
|
+
.string()
|
|
234
|
+
.optional()
|
|
235
|
+
.describe(
|
|
236
|
+
"Optional replacement foreground color (e.g. '#111827') for contrast " +
|
|
237
|
+
"fixes. When omitted, a high-contrast near-black default is used.",
|
|
238
|
+
),
|
|
239
|
+
includeContent: z
|
|
240
|
+
.boolean()
|
|
241
|
+
.optional()
|
|
242
|
+
.default(false)
|
|
243
|
+
.describe("Include the patched HTML content in the response."),
|
|
244
|
+
}),
|
|
245
|
+
run: async ({
|
|
246
|
+
designId,
|
|
247
|
+
fileId,
|
|
248
|
+
filename,
|
|
249
|
+
finding,
|
|
250
|
+
color,
|
|
251
|
+
includeContent,
|
|
252
|
+
}) => {
|
|
253
|
+
const plan = a11yFindingToEdit(finding as A11yFinding, { color });
|
|
254
|
+
|
|
255
|
+
if (!plan) {
|
|
256
|
+
return {
|
|
257
|
+
applied: false,
|
|
258
|
+
autoFixable: false,
|
|
259
|
+
reason:
|
|
260
|
+
`Finding "${finding.id}" (${finding.category}) is not auto-fixable ` +
|
|
261
|
+
"inline — it needs a new attribute (alt / aria-label) or a semantic " +
|
|
262
|
+
"change that the deterministic edit engine cannot apply. Resolve it " +
|
|
263
|
+
"in the real app or via the agent instead.",
|
|
264
|
+
finding,
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const file = await resolveEditableDesignFile({
|
|
269
|
+
designId,
|
|
270
|
+
fileId,
|
|
271
|
+
filename,
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
const patch = applyVisualEdit(file.content, plan.edit as EditIntent, {
|
|
275
|
+
source: {
|
|
276
|
+
kind: "design-file",
|
|
277
|
+
designId: file.designId,
|
|
278
|
+
fileId: file.id,
|
|
279
|
+
filename: file.filename,
|
|
280
|
+
},
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
if (patch.result.target) {
|
|
284
|
+
agentUpdateSelection(file.id, {
|
|
285
|
+
selection: patch.result.target.selector,
|
|
286
|
+
nodeId: patch.result.target.nodeId,
|
|
287
|
+
editingFile: file.filename,
|
|
288
|
+
designId: file.designId,
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const persisted = patch.result.status === "applied" && patch.result.changed;
|
|
293
|
+
if (persisted) {
|
|
294
|
+
await persistDesignFileEdit({
|
|
295
|
+
id: file.id,
|
|
296
|
+
designId: file.designId,
|
|
297
|
+
content: patch.content,
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return {
|
|
302
|
+
applied: persisted,
|
|
303
|
+
autoFixable: true,
|
|
304
|
+
fixLabel: plan.label,
|
|
305
|
+
edit: plan.edit,
|
|
306
|
+
result: patch.result,
|
|
307
|
+
designId: file.designId,
|
|
308
|
+
fileId: file.id,
|
|
309
|
+
filename: file.filename,
|
|
310
|
+
finding,
|
|
311
|
+
persisted,
|
|
312
|
+
patchedContent: includeContent ? patch.content : undefined,
|
|
313
|
+
bytesBefore: file.content.length,
|
|
314
|
+
bytesAfter: patch.content.length,
|
|
315
|
+
};
|
|
316
|
+
},
|
|
317
|
+
});
|