@agent-native/core 0.80.2 → 0.80.5
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 +66 -2
- package/corpus/core/docs/content/locales/ar-SA/real-time-collaboration.mdx +2 -2
- package/corpus/core/docs/content/locales/ar-SA/template-design.mdx +1 -1
- package/corpus/core/docs/content/locales/de-DE/real-time-collaboration.mdx +3 -3
- package/corpus/core/docs/content/locales/de-DE/template-design.mdx +1 -1
- package/corpus/core/docs/content/locales/es-ES/real-time-collaboration.mdx +2 -2
- package/corpus/core/docs/content/locales/es-ES/template-design.mdx +1 -1
- package/corpus/core/docs/content/locales/fr-FR/real-time-collaboration.mdx +2 -2
- package/corpus/core/docs/content/locales/fr-FR/template-design.mdx +1 -1
- package/corpus/core/docs/content/locales/hi-IN/template-design.mdx +1 -1
- package/corpus/core/docs/content/locales/ja-JP/real-time-collaboration.mdx +2 -2
- package/corpus/core/docs/content/locales/ja-JP/template-design.mdx +1 -1
- package/corpus/core/docs/content/locales/ko-KR/real-time-collaboration.mdx +2 -2
- package/corpus/core/docs/content/locales/ko-KR/template-design.mdx +1 -1
- package/corpus/core/docs/content/locales/pt-BR/real-time-collaboration.mdx +2 -2
- package/corpus/core/docs/content/locales/pt-BR/template-design.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-CN/real-time-collaboration.mdx +2 -2
- package/corpus/core/docs/content/locales/zh-CN/template-design.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-TW/real-time-collaboration.mdx +2 -2
- package/corpus/core/docs/content/locales/zh-TW/template-design.mdx +1 -1
- package/corpus/core/docs/content/real-time-collaboration.mdx +2 -2
- package/corpus/core/docs/content/template-design.mdx +1 -1
- package/corpus/core/package.json +3 -7
- package/corpus/core/src/action.ts +32 -0
- package/corpus/core/src/agent/durable-background.ts +32 -11
- package/corpus/core/src/agent/production-agent.ts +14 -1
- package/corpus/core/src/agent/run-loop-with-resume.ts +3 -1
- package/corpus/core/src/brand-kit/fig/index.ts +17 -37
- package/corpus/core/src/cli/index.ts +1 -1
- package/corpus/core/src/cli/mcp-config-writers.ts +187 -51
- package/corpus/core/src/cli/plan-local.ts +445 -108
- package/corpus/core/src/cli/skills.ts +32 -8
- package/corpus/core/src/client/AssistantChat.tsx +11 -1
- package/corpus/core/src/client/agent-chat.ts +12 -1
- package/corpus/core/src/client/composer/PromptComposer.tsx +100 -41
- package/corpus/core/src/client/org/OrgSwitcher.tsx +1 -1
- package/corpus/core/src/client/sharing/ShareButton.tsx +3 -27
- package/corpus/core/src/collab/presence.ts +1 -1
- package/corpus/core/src/mcp/connect-route.ts +34 -5
- package/corpus/core/src/server/action-discovery.ts +4 -0
- package/corpus/core/src/server/action-routes.ts +14 -0
- package/corpus/core/src/server/agent-chat-plugin.ts +20 -0
- package/corpus/core/src/vite/client.ts +15 -1
- package/corpus/templates/analytics/actions/dashboard-mutation-api.ts +2 -0
- package/corpus/templates/analytics/actions/update-dashboard.ts +8 -0
- package/corpus/templates/analytics/app/components/layout/Layout.tsx +1 -1
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +117 -33
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +4 -0
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/types.ts +7 -0
- package/corpus/templates/analytics/changelog/2026-06-27-dashboards-can-now-nest-under-a-parent-in-the-sidebar-via-a-.md +6 -0
- package/corpus/templates/analytics/changelog/2026-06-29-analytics-pages-now-sit-closer-under-the-header-with-tighter.md +6 -0
- package/corpus/templates/assets/actions/generate-image-batch.ts +3 -0
- package/corpus/templates/assets/actions/generate-image.ts +3 -0
- package/corpus/templates/assets/changelog/2026-06-29-longer-agent-generation-window.md +6 -0
- package/corpus/templates/assets/netlify.toml +3 -3
- package/corpus/templates/assets/server/plugins/agent-chat.ts +4 -1
- package/corpus/templates/clips/app/components/capture-install-options.tsx +7 -8
- package/corpus/templates/clips/app/components/player/timestamped-comment-button.tsx +162 -0
- package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +1 -1
- package/corpus/templates/clips/app/i18n/ar-SA.ts +4 -0
- package/corpus/templates/clips/app/i18n/de-DE.ts +4 -0
- package/corpus/templates/clips/app/i18n/en-US.ts +4 -0
- package/corpus/templates/clips/app/i18n/es-ES.ts +4 -0
- package/corpus/templates/clips/app/i18n/fr-FR.ts +4 -0
- package/corpus/templates/clips/app/i18n/hi-IN.ts +4 -0
- package/corpus/templates/clips/app/i18n/ja-JP.ts +4 -0
- package/corpus/templates/clips/app/i18n/ko-KR.ts +4 -0
- package/corpus/templates/clips/app/i18n/pt-BR.ts +4 -0
- package/corpus/templates/clips/app/i18n/zh-CN.ts +4 -0
- package/corpus/templates/clips/app/i18n/zh-TW.ts +4 -0
- package/corpus/templates/clips/app/routes/r.$recordingId.tsx +42 -18
- package/corpus/templates/content/AGENTS.md +12 -0
- package/corpus/templates/content/app/blocks/BuilderDocsBlocks.tsx +10 -0
- package/corpus/templates/content/app/components/editor/BubbleToolbar.tsx +1 -0
- package/corpus/templates/content/app/components/editor/ContentReferencePreview.tsx +185 -0
- package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +3 -0
- package/corpus/templates/content/app/components/editor/VisualEditor.tsx +19 -0
- package/corpus/templates/content/app/components/editor/extensions/ContentReferenceNode.tsx +82 -0
- package/corpus/templates/content/app/global.css +9 -0
- package/corpus/templates/content/app/i18n/zh-TW.ts +12 -0
- package/corpus/templates/content/app/i18n-data.ts +140 -0
- package/corpus/templates/content/changelog/2026-06-29-reusable-mdx-references-now-preview-linked-local-documents-i.md +6 -0
- package/corpus/templates/content/shared/builder-docs-blocks.ts +8 -0
- package/corpus/templates/content/shared/builder-mdx.ts +141 -4
- package/corpus/templates/content/shared/nfm.ts +62 -0
- package/corpus/templates/design/.agents/skills/design-systems/SKILL.md +10 -11
- package/corpus/templates/design/AGENTS.md +5 -0
- package/corpus/templates/design/_gitignore +7 -0
- package/corpus/templates/design/actions/apply-visual-edit.ts +22 -12
- package/corpus/templates/design/actions/create-design-system.ts +15 -4
- package/corpus/templates/design/actions/create-file.ts +20 -1
- package/corpus/templates/design/actions/delete-design-system.ts +2 -2
- package/corpus/templates/design/actions/duplicate-design.ts +35 -9
- package/corpus/templates/design/actions/generate-design.ts +146 -69
- package/corpus/templates/design/actions/generate-screens.ts +51 -19
- package/corpus/templates/design/actions/get-design-snapshot.ts +5 -1
- package/corpus/templates/design/actions/get-design.ts +2 -0
- package/corpus/templates/design/actions/import-design-project.ts +28 -9
- package/corpus/templates/design/actions/import-document.ts +22 -8
- package/corpus/templates/design/actions/index-design-system-with-builder.ts +6 -153
- package/corpus/templates/design/actions/navigate.ts +105 -54
- package/corpus/templates/design/actions/set-default-design-system.ts +17 -3
- package/corpus/templates/design/actions/show-design-questions.ts +2 -0
- package/corpus/templates/design/actions/update-design.ts +2 -1
- package/corpus/templates/design/actions/view-screen.ts +12 -6
- package/corpus/templates/design/app/components/design/CanvasContextMenu.tsx +4 -4
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +159 -41
- package/corpus/templates/design/app/components/design/DesignExtensionsPanel.tsx +8 -4
- package/corpus/templates/design/app/components/design/DrawOverlay.tsx +37 -42
- package/corpus/templates/design/app/components/design/EditPanel.tsx +336 -183
- package/corpus/templates/design/app/components/design/LayersPanel.tsx +153 -34
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +135 -33
- package/corpus/templates/design/app/components/design/QuestionFlow.tsx +6 -0
- package/corpus/templates/design/app/components/design/TweaksPanel.tsx +2 -1
- package/corpus/templates/design/app/components/design/inspector/AlignmentMatrix.tsx +4 -10
- package/corpus/templates/design/app/components/design/inspector/AutoLayoutMatrix.tsx +84 -43
- package/corpus/templates/design/app/components/design/inspector/ConstraintsWidget.tsx +4 -4
- package/corpus/templates/design/app/components/design/inspector/{FigmaColorPicker.tsx → DesignColorPicker.tsx} +89 -62
- package/corpus/templates/design/app/components/design/inspector/ExportSettingsPanel.tsx +14 -26
- package/corpus/templates/design/app/components/design/inspector/GradientEditor.tsx +40 -12
- package/corpus/templates/design/app/components/design/inspector/ImageFillControls.tsx +13 -4
- package/corpus/templates/design/app/components/design/inspector/SHADER_INTEGRATION.md +13 -13
- package/corpus/templates/design/app/components/design/inspector/ScrubInput.tsx +13 -9
- package/corpus/templates/design/app/components/design/inspector/ShaderControls.tsx +13 -4
- package/corpus/templates/design/app/components/design/inspector/ShaderFillsPanel.tsx +6 -6
- package/corpus/templates/design/app/components/design/inspector/{figma-icons.tsx → design-icons.tsx} +2 -2
- package/corpus/templates/design/app/components/design/inspector/index.ts +12 -12
- package/corpus/templates/design/app/components/design/inspector/scrub-input-utils.ts +5 -2
- package/corpus/templates/design/app/components/editor/PromptDialog.tsx +3 -3
- package/corpus/templates/design/app/components/layout/Layout.tsx +5 -2
- package/corpus/templates/design/app/components/layout/Sidebar.tsx +1 -1
- package/corpus/templates/design/app/components/visual-editor/CanvasCommentPins.tsx +167 -91
- package/corpus/templates/design/app/components/visual-editor/DrawOverlay.tsx +16 -3
- package/corpus/templates/design/app/components/visual-editor/SaveStatusIndicator.tsx +15 -0
- package/corpus/templates/design/app/global.css +4 -0
- package/corpus/templates/design/app/hooks/use-design-system.ts +4 -1
- package/corpus/templates/design/app/hooks/use-navigation-state.ts +38 -3
- package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +9 -2
- package/corpus/templates/design/app/i18n/zh-TW.ts +22 -0
- package/corpus/templates/design/app/i18n-data.ts +527 -0
- package/corpus/templates/design/app/lib/design-systems.ts +6 -4
- package/corpus/templates/design/app/lib/design-templates.ts +15 -3
- package/corpus/templates/design/app/pages/DesignEditor.tsx +641 -158
- package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +42 -34
- package/corpus/templates/design/app/pages/VisualEdit.tsx +100 -0
- package/corpus/templates/design/app/root.tsx +42 -9
- package/corpus/templates/design/app/routes/visual-edit.tsx +7 -0
- package/corpus/templates/design/changelog/2026-06-28-live-cursors-now-keep-names-beside-a-cleaner-pointer-marker.md +1 -1
- package/corpus/templates/design/changelog/2026-06-28-mode-switching-now-lives-in-a-compact-bottom-right-icon-dock.md +1 -1
- package/corpus/templates/design/changelog/2026-06-28-visual-code-design-mode.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-design-generation-prompts-now-show-connect-ai-before-sending.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-design-mode-top-chrome-now-groups-collaborators-preview-shar.md +1 -1
- package/corpus/templates/design/changelog/2026-06-29-fixed-design-editor-exports-and-gradient-edits-so-multi-scre.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-longer-hosted-agent-turns.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-png-export-handles-modern-css-color-functions-more-reliably.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-png-export-now-ignores-duplicate-clicks-while-a-download-is-.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-public-visual-edit-and-shared-design-links-now-invite-visito.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-visual-edit-actions-now-reject-missing-design-targets-before.md +6 -0
- package/corpus/templates/design/e2e/README.md +71 -0
- package/corpus/templates/design/e2e/global-setup.ts +157 -0
- package/corpus/templates/design/e2e/helpers.ts +148 -0
- package/corpus/templates/design/netlify.toml +3 -4
- package/corpus/templates/design/package.json +5 -1
- package/corpus/templates/design/playwright.config.ts +51 -0
- package/corpus/templates/design/server/handlers/index-design-system-with-builder.ts +121 -0
- package/corpus/templates/design/server/handlers/uploads.ts +89 -38
- package/corpus/templates/design/server/lib/builder-design-system-proxy.ts +181 -0
- package/corpus/templates/design/server/lib/coding-handoff.ts +33 -4
- package/corpus/templates/design/server/lib/design-export.ts +35 -8
- package/corpus/templates/design/server/plugins/agent-chat.ts +4 -0
- package/corpus/templates/design/server/plugins/auth.ts +10 -1
- package/corpus/templates/design/server/routes/api/index-design-system-with-builder.post.ts +1 -0
- package/corpus/templates/design/shared/api.ts +2 -0
- package/corpus/templates/design/shared/apply-edits.ts +12 -8
- package/corpus/templates/design/shared/canvas-math.ts +19 -1
- package/corpus/templates/design/shared/code-layer.ts +87 -28
- package/corpus/templates/design/shared/generation-session.ts +1 -0
- package/corpus/templates/design/shared/resolve-tweaks.ts +4 -3
- package/corpus/templates/design/shared/shader-presets.ts +10 -0
- package/corpus/templates/design/shared/source-mode.ts +9 -0
- package/corpus/templates/design/vitest.config.ts +2 -1
- package/corpus/templates/mail/app/components/layout/AppLayout.tsx +1 -1
- package/corpus/templates/plan/.agents/skills/visual-plan/references/canvas.md +1 -1
- package/corpus/templates/plan/.agents/skills/visual-plan/references/local-files.md +14 -5
- package/corpus/templates/plan/.agents/skills/visual-recap/references/local-files.md +14 -5
- package/corpus/templates/plan/AGENTS.md +1 -1
- package/corpus/templates/plan/actions/create-plan-design.ts +1 -1
- package/corpus/templates/plan/actions/validate-local-plan-source.ts +110 -0
- package/corpus/templates/plan/app/pages/PlansPage.tsx +1 -0
- package/corpus/templates/plan/docs/commenting-ux-plan.md +2 -2
- package/corpus/templates/plan/server/lib/plan-connector-catalog.ts +1 -0
- package/corpus/templates/plan/server/lib/public-action-paths.ts +1 -0
- package/corpus/templates/plan/server/plan-content.ts +1 -1
- package/corpus/templates/plan/server/ui-plan-html.ts +2 -2
- package/corpus/templates/slides/actions/index-design-system-with-builder.ts +6 -153
- package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +53 -38
- package/corpus/templates/slides/app/components/design-system/{fig-import-response.ts → builder-index-response.ts} +9 -6
- package/corpus/templates/slides/app/components/visual-editor/MultiSelectChip.tsx +1 -1
- package/corpus/templates/slides/changelog/2026-06-29-design-system-setup-now-indexes-uploaded-design-files-throug.md +6 -0
- package/corpus/templates/slides/changelog/2026-06-29-longer-hosted-agent-turns.md +6 -0
- package/corpus/templates/slides/netlify.toml +3 -6
- package/corpus/templates/slides/server/handlers/index-design-system-with-builder.ts +116 -0
- package/corpus/templates/slides/server/lib/builder-design-system-proxy.ts +179 -0
- package/corpus/templates/slides/server/plugins/agent-chat.ts +4 -1
- package/corpus/templates/slides/server/routes/api/index-design-system-with-builder.post.ts +1 -0
- package/dist/action.d.ts +23 -0
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js +9 -0
- package/dist/action.js.map +1 -1
- package/dist/agent/durable-background.d.ts +9 -7
- package/dist/agent/durable-background.d.ts.map +1 -1
- package/dist/agent/durable-background.js +27 -11
- package/dist/agent/durable-background.js.map +1 -1
- package/dist/agent/production-agent.d.ts +10 -0
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +4 -1
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-loop-with-resume.d.ts +2 -1
- package/dist/agent/run-loop-with-resume.d.ts.map +1 -1
- package/dist/agent/run-loop-with-resume.js +2 -2
- package/dist/agent/run-loop-with-resume.js.map +1 -1
- package/dist/brand-kit/fig/index.d.ts +4 -4
- package/dist/brand-kit/fig/index.d.ts.map +1 -1
- package/dist/brand-kit/fig/index.js +14 -27
- package/dist/brand-kit/fig/index.js.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/mcp-config-writers.d.ts +15 -7
- package/dist/cli/mcp-config-writers.d.ts.map +1 -1
- package/dist/cli/mcp-config-writers.js +198 -45
- package/dist/cli/mcp-config-writers.js.map +1 -1
- package/dist/cli/plan-local.d.ts +30 -0
- package/dist/cli/plan-local.d.ts.map +1 -1
- package/dist/cli/plan-local.js +281 -56
- package/dist/cli/plan-local.js.map +1 -1
- package/dist/cli/skills.d.ts +2 -2
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +32 -8
- package/dist/cli/skills.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +11 -1
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/agent-chat.d.ts.map +1 -1
- package/dist/client/agent-chat.js +15 -2
- package/dist/client/agent-chat.js.map +1 -1
- package/dist/client/composer/PromptComposer.d.ts.map +1 -1
- package/dist/client/composer/PromptComposer.js +35 -1
- package/dist/client/composer/PromptComposer.js.map +1 -1
- package/dist/client/org/OrgSwitcher.js +1 -1
- package/dist/client/org/OrgSwitcher.js.map +1 -1
- package/dist/client/sharing/ShareButton.d.ts +1 -1
- package/dist/client/sharing/ShareButton.d.ts.map +1 -1
- package/dist/client/sharing/ShareButton.js +2 -15
- package/dist/client/sharing/ShareButton.js.map +1 -1
- package/dist/collab/presence.d.ts +1 -1
- package/dist/collab/presence.js +1 -1
- package/dist/collab/presence.js.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +2 -2
- package/dist/mcp/connect-route.d.ts.map +1 -1
- package/dist/mcp/connect-route.js +34 -5
- package/dist/mcp/connect-route.js.map +1 -1
- package/dist/observability/routes.d.ts +2 -2
- package/dist/progress/routes.d.ts +1 -1
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/server/action-discovery.d.ts.map +1 -1
- package/dist/server/action-discovery.js +5 -0
- package/dist/server/action-discovery.js.map +1 -1
- package/dist/server/action-routes.d.ts.map +1 -1
- package/dist/server/action-routes.js +14 -0
- package/dist/server/action-routes.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts +6 -0
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +12 -3
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +12 -1
- package/dist/vite/client.js.map +1 -1
- package/docs/content/locales/ar-SA/real-time-collaboration.mdx +2 -2
- package/docs/content/locales/ar-SA/template-design.mdx +1 -1
- package/docs/content/locales/de-DE/real-time-collaboration.mdx +3 -3
- package/docs/content/locales/de-DE/template-design.mdx +1 -1
- package/docs/content/locales/es-ES/real-time-collaboration.mdx +2 -2
- package/docs/content/locales/es-ES/template-design.mdx +1 -1
- package/docs/content/locales/fr-FR/real-time-collaboration.mdx +2 -2
- package/docs/content/locales/fr-FR/template-design.mdx +1 -1
- package/docs/content/locales/hi-IN/template-design.mdx +1 -1
- package/docs/content/locales/ja-JP/real-time-collaboration.mdx +2 -2
- package/docs/content/locales/ja-JP/template-design.mdx +1 -1
- package/docs/content/locales/ko-KR/real-time-collaboration.mdx +2 -2
- package/docs/content/locales/ko-KR/template-design.mdx +1 -1
- package/docs/content/locales/pt-BR/real-time-collaboration.mdx +2 -2
- package/docs/content/locales/pt-BR/template-design.mdx +1 -1
- package/docs/content/locales/zh-CN/real-time-collaboration.mdx +2 -2
- package/docs/content/locales/zh-CN/template-design.mdx +1 -1
- package/docs/content/locales/zh-TW/real-time-collaboration.mdx +2 -2
- package/docs/content/locales/zh-TW/template-design.mdx +1 -1
- package/docs/content/real-time-collaboration.mdx +2 -2
- package/docs/content/template-design.mdx +1 -1
- package/package.json +3 -7
- package/corpus/core/src/brand-kit/fig/decode.ts +0 -410
- package/corpus/core/src/brand-kit/fig/extract-design-system.ts +0 -947
- package/corpus/core/src/brand-kit/fig/fig-to-html.ts +0 -1906
- package/corpus/templates/design/actions/import-figma.ts +0 -55
- package/corpus/templates/design/changelog/2026-06-28-figma-style-code-design-mode.md +0 -6
- package/corpus/templates/design/server/handlers/import-figma-system.ts +0 -86
- package/corpus/templates/design/server/routes/api/import-figma-system.post.ts +0 -1
- package/corpus/templates/slides/server/handlers/import-figma-system.ts +0 -101
- package/corpus/templates/slides/server/routes/api/import-figma-system.post.ts +0 -1
- package/dist/brand-kit/fig/decode.d.ts +0 -33
- package/dist/brand-kit/fig/decode.d.ts.map +0 -1
- package/dist/brand-kit/fig/decode.js +0 -358
- package/dist/brand-kit/fig/decode.js.map +0 -1
- package/dist/brand-kit/fig/extract-design-system.d.ts +0 -44
- package/dist/brand-kit/fig/extract-design-system.d.ts.map +0 -1
- package/dist/brand-kit/fig/extract-design-system.js +0 -752
- package/dist/brand-kit/fig/extract-design-system.js.map +0 -1
- package/dist/brand-kit/fig/fig-to-html.d.ts +0 -246
- package/dist/brand-kit/fig/fig-to-html.d.ts.map +0 -1
- package/dist/brand-kit/fig/fig-to-html.js +0 -1506
- package/dist/brand-kit/fig/fig-to-html.js.map +0 -1
|
@@ -36,11 +36,11 @@ import { Textarea } from "@/components/ui/textarea";
|
|
|
36
36
|
import { toast } from "@/hooks/use-toast";
|
|
37
37
|
|
|
38
38
|
import {
|
|
39
|
-
|
|
39
|
+
MAX_BUILDER_INDEX_UPLOAD_BYTES,
|
|
40
|
+
readBuilderIndexResponse,
|
|
40
41
|
formatFileSize,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
} from "./fig-import-response";
|
|
42
|
+
type BuilderIndexResult,
|
|
43
|
+
} from "./builder-index-response";
|
|
44
44
|
|
|
45
45
|
interface DesignSystemSetupProps {
|
|
46
46
|
open: boolean;
|
|
@@ -105,9 +105,12 @@ export function DesignSystemSetup({
|
|
|
105
105
|
const [brandNotes, setBrandNotes] = useState("");
|
|
106
106
|
const [customInstructions, setCustomInstructions] = useState("");
|
|
107
107
|
const [generating, setGenerating] = useState(false);
|
|
108
|
-
const [
|
|
109
|
-
const [
|
|
110
|
-
|
|
108
|
+
const [builderIndexing, setBuilderIndexing] = useState(false);
|
|
109
|
+
const [builderIndexResult, setBuilderIndexResult] =
|
|
110
|
+
useState<BuilderIndexResult | null>(null);
|
|
111
|
+
const [builderIndexError, setBuilderIndexError] = useState<string | null>(
|
|
112
|
+
null,
|
|
113
|
+
);
|
|
111
114
|
|
|
112
115
|
const codeInputRef = useRef<HTMLInputElement>(null);
|
|
113
116
|
const docInputRef = useRef<HTMLInputElement>(null);
|
|
@@ -158,9 +161,9 @@ export function DesignSystemSetup({
|
|
|
158
161
|
setBrandNotes("");
|
|
159
162
|
setCustomInstructions("");
|
|
160
163
|
setSelectedSystemId("");
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
+
setBuilderIndexing(false);
|
|
165
|
+
setBuilderIndexResult(null);
|
|
166
|
+
setBuilderIndexError(null);
|
|
164
167
|
}
|
|
165
168
|
}, [open]);
|
|
166
169
|
|
|
@@ -170,6 +173,7 @@ export function DesignSystemSetup({
|
|
|
170
173
|
websiteUrls.length > 0 ||
|
|
171
174
|
githubLinks.length > 0 ||
|
|
172
175
|
codeFiles.length > 0 ||
|
|
176
|
+
builderIndexResult ||
|
|
173
177
|
docFiles.length > 0 ||
|
|
174
178
|
imageFiles.length > 0 ||
|
|
175
179
|
selectedSystemId ||
|
|
@@ -181,6 +185,7 @@ export function DesignSystemSetup({
|
|
|
181
185
|
websiteUrls,
|
|
182
186
|
githubLinks,
|
|
183
187
|
codeFiles,
|
|
188
|
+
builderIndexResult,
|
|
184
189
|
docFiles,
|
|
185
190
|
imageFiles,
|
|
186
191
|
selectedSystemId,
|
|
@@ -238,44 +243,47 @@ export function DesignSystemSetup({
|
|
|
238
243
|
[t],
|
|
239
244
|
);
|
|
240
245
|
|
|
241
|
-
const
|
|
246
|
+
const handleBuilderIndexUpload = useCallback(
|
|
242
247
|
async (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
243
248
|
const file = event.target.files?.[0];
|
|
244
249
|
event.target.value = "";
|
|
245
250
|
if (!file) return;
|
|
246
251
|
if (!file.name.toLowerCase().endsWith(".fig")) {
|
|
247
|
-
|
|
252
|
+
setBuilderIndexError(t("designSystemSetup.figFileRequired"));
|
|
248
253
|
return;
|
|
249
254
|
}
|
|
250
|
-
if (file.size >
|
|
251
|
-
|
|
255
|
+
if (file.size > MAX_BUILDER_INDEX_UPLOAD_BYTES) {
|
|
256
|
+
setBuilderIndexError(
|
|
252
257
|
t("designSystemSetup.figFileTooLarge", {
|
|
253
|
-
maxSize: formatFileSize(
|
|
258
|
+
maxSize: formatFileSize(MAX_BUILDER_INDEX_UPLOAD_BYTES),
|
|
254
259
|
}),
|
|
255
260
|
);
|
|
256
261
|
return;
|
|
257
262
|
}
|
|
258
263
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
264
|
+
setBuilderIndexError(null);
|
|
265
|
+
setBuilderIndexResult(null);
|
|
266
|
+
setBuilderIndexing(true);
|
|
262
267
|
try {
|
|
263
268
|
const body = new FormData();
|
|
264
269
|
body.append("file", file);
|
|
265
|
-
const res = await fetch(
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
270
|
+
const res = await fetch(
|
|
271
|
+
appApiPath("/api/index-design-system-with-builder"),
|
|
272
|
+
{
|
|
273
|
+
method: "POST",
|
|
274
|
+
body,
|
|
275
|
+
},
|
|
276
|
+
);
|
|
277
|
+
const parsed = await readBuilderIndexResponse(res);
|
|
278
|
+
setBuilderIndexResult(parsed);
|
|
271
279
|
} catch (err) {
|
|
272
|
-
|
|
280
|
+
setBuilderIndexError(
|
|
273
281
|
err instanceof Error
|
|
274
282
|
? err.message
|
|
275
283
|
: t("designSystemSetup.figParseFailed"),
|
|
276
284
|
);
|
|
277
285
|
} finally {
|
|
278
|
-
|
|
286
|
+
setBuilderIndexing(false);
|
|
279
287
|
}
|
|
280
288
|
},
|
|
281
289
|
[t],
|
|
@@ -353,6 +361,12 @@ export function DesignSystemSetup({
|
|
|
353
361
|
}
|
|
354
362
|
}
|
|
355
363
|
|
|
364
|
+
if (builderIndexResult) {
|
|
365
|
+
parts.push(
|
|
366
|
+
`\n## Builder-Indexed Figma File\nBuilder design-system indexing has already started.\n- Design system: ${builderIndexResult.designSystemId}\n- Local selectable design system: ${builderIndexResult.localDesignSystemId ?? "(not returned)"}\n- Project: ${builderIndexResult.projectId}\n- Job: ${builderIndexResult.jobId}\n- URL: ${builderIndexResult.builderUrl}\n\nUse Builder as the source of truth for extracted tokens, assets, and guidance. Do not call \`create-design-system\` again for this Builder-indexed source.`,
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
|
|
356
370
|
if (docFiles.length > 0) {
|
|
357
371
|
const inlined = docFiles.filter((f) => f.textContent);
|
|
358
372
|
const binary = docFiles.filter((f) => !f.textContent);
|
|
@@ -419,6 +433,7 @@ export function DesignSystemSetup({
|
|
|
419
433
|
websiteUrls,
|
|
420
434
|
githubLinks,
|
|
421
435
|
codeFiles,
|
|
436
|
+
builderIndexResult,
|
|
422
437
|
docFiles,
|
|
423
438
|
imageFiles,
|
|
424
439
|
selectedSystemId,
|
|
@@ -469,15 +484,15 @@ export function DesignSystemSetup({
|
|
|
469
484
|
<IconBrandFigma className="w-3.5 h-3.5" />
|
|
470
485
|
{t("designSystemSetup.figmaFile")}
|
|
471
486
|
</Label>
|
|
472
|
-
{!
|
|
487
|
+
{!builderIndexResult ? (
|
|
473
488
|
<>
|
|
474
489
|
<button
|
|
475
490
|
type="button"
|
|
476
491
|
onClick={() => figInputRef.current?.click()}
|
|
477
|
-
disabled={
|
|
492
|
+
disabled={builderIndexing}
|
|
478
493
|
className="w-full border border-dashed border-border rounded-lg p-4 text-center hover:border-foreground/20 cursor-pointer disabled:cursor-wait disabled:opacity-70"
|
|
479
494
|
>
|
|
480
|
-
{
|
|
495
|
+
{builderIndexing ? (
|
|
481
496
|
<span className="inline-flex items-center gap-2 text-xs text-muted-foreground">
|
|
482
497
|
<IconLoader2 className="w-3.5 h-3.5 animate-spin" />
|
|
483
498
|
{t("designSystemSetup.parsingFigmaFile")}
|
|
@@ -492,24 +507,24 @@ export function DesignSystemSetup({
|
|
|
492
507
|
ref={figInputRef}
|
|
493
508
|
type="file"
|
|
494
509
|
accept=".fig"
|
|
495
|
-
onChange={
|
|
510
|
+
onChange={handleBuilderIndexUpload}
|
|
496
511
|
className="hidden"
|
|
497
512
|
/>
|
|
498
|
-
{
|
|
513
|
+
{builderIndexError && (
|
|
499
514
|
<div
|
|
500
515
|
role="alert"
|
|
501
516
|
className="rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive"
|
|
502
517
|
>
|
|
503
|
-
{
|
|
518
|
+
{builderIndexError}
|
|
504
519
|
</div>
|
|
505
520
|
)}
|
|
506
521
|
</>
|
|
507
522
|
) : (
|
|
508
|
-
<
|
|
509
|
-
result={
|
|
523
|
+
<BuilderIndexPreview
|
|
524
|
+
result={builderIndexResult}
|
|
510
525
|
onReset={() => {
|
|
511
|
-
|
|
512
|
-
|
|
526
|
+
setBuilderIndexResult(null);
|
|
527
|
+
setBuilderIndexError(null);
|
|
513
528
|
}}
|
|
514
529
|
/>
|
|
515
530
|
)}
|
|
@@ -842,11 +857,11 @@ function TagList({
|
|
|
842
857
|
);
|
|
843
858
|
}
|
|
844
859
|
|
|
845
|
-
function
|
|
860
|
+
function BuilderIndexPreview({
|
|
846
861
|
result,
|
|
847
862
|
onReset,
|
|
848
863
|
}: {
|
|
849
|
-
result:
|
|
864
|
+
result: BuilderIndexResult;
|
|
850
865
|
onReset: () => void;
|
|
851
866
|
}) {
|
|
852
867
|
const t = useT();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface BuilderIndexResult {
|
|
2
2
|
ok: boolean;
|
|
3
3
|
source: "builder";
|
|
4
4
|
suggestedTitle: string;
|
|
@@ -7,10 +7,13 @@ export interface FigImportResult {
|
|
|
7
7
|
designSystemId: string;
|
|
8
8
|
builderUrl: string;
|
|
9
9
|
status: "in-progress";
|
|
10
|
+
localDesignSystemId?: string;
|
|
11
|
+
uploadedFileCount?: number;
|
|
12
|
+
instructions?: string;
|
|
10
13
|
builderConnectUrl?: string;
|
|
11
14
|
}
|
|
12
15
|
|
|
13
|
-
export const
|
|
16
|
+
export const MAX_BUILDER_INDEX_UPLOAD_BYTES = 200 * 1024 * 1024;
|
|
14
17
|
|
|
15
18
|
export function formatFileSize(bytes: number): string {
|
|
16
19
|
return `${Math.round(bytes / 1024 / 1024)} MB`;
|
|
@@ -18,7 +21,7 @@ export function formatFileSize(bytes: number): string {
|
|
|
18
21
|
|
|
19
22
|
function summarizeUploadFailure(status: number, bodyText: string): string {
|
|
20
23
|
if (status === 413) {
|
|
21
|
-
return `File too large (max ${formatFileSize(
|
|
24
|
+
return `File too large (max ${formatFileSize(MAX_BUILDER_INDEX_UPLOAD_BYTES)}).`;
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
const trimmed = bodyText
|
|
@@ -31,9 +34,9 @@ function summarizeUploadFailure(status: number, bodyText: string): string {
|
|
|
31
34
|
return `Upload failed (${status})`;
|
|
32
35
|
}
|
|
33
36
|
|
|
34
|
-
export async function
|
|
37
|
+
export async function readBuilderIndexResponse(
|
|
35
38
|
res: Response,
|
|
36
|
-
): Promise<
|
|
39
|
+
): Promise<BuilderIndexResult> {
|
|
37
40
|
const bodyText = await res.text();
|
|
38
41
|
let json: unknown = null;
|
|
39
42
|
|
|
@@ -59,5 +62,5 @@ export async function readFigImportResponse(
|
|
|
59
62
|
throw new Error(summarizeUploadFailure(res.status, bodyText));
|
|
60
63
|
}
|
|
61
64
|
|
|
62
|
-
return json as
|
|
65
|
+
return json as BuilderIndexResult;
|
|
63
66
|
}
|
|
@@ -17,7 +17,7 @@ interface MultiSelectChipProps {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* Floating chip that hovers above a multi-select selection (
|
|
20
|
+
* Floating chip that hovers above a multi-select selection (design-editor style).
|
|
21
21
|
* Rendered via portal so it isn't constrained by the slide canvas's stacking
|
|
22
22
|
* context. Reusable across the slides editor and the design template.
|
|
23
23
|
*/
|
|
@@ -8,13 +8,10 @@ functions = "templates/slides/.netlify/functions-internal"
|
|
|
8
8
|
GA_MEASUREMENT_ID = "G-ESF7FYXGN9"
|
|
9
9
|
NITRO_PRESET = "netlify"
|
|
10
10
|
NPM_CONFIG_PRODUCTION = "false"
|
|
11
|
+
AGENT_CHAT_DURABLE_BACKGROUND = "true"
|
|
11
12
|
|
|
12
13
|
# Function wall for the non-agent long-request paths (deck import/export,
|
|
13
|
-
# image generation).
|
|
14
|
-
#
|
|
15
|
-
# HOSTED_SOFT_TIMEOUT_CEILING_MS (40s) in @agent-native/core run-manager.ts,
|
|
16
|
-
# regardless of the per-template runSoftTimeoutMs. The agent's hidden
|
|
17
|
-
# auto-continuation hands off at ~40s; this 300s ceiling only protects the
|
|
18
|
-
# longer non-agent HTTP handlers.
|
|
14
|
+
# image generation). Agent chat opts into the separate Netlify background
|
|
15
|
+
# function so hosted creative turns can use the longer background budget.
|
|
19
16
|
[functions."*"]
|
|
20
17
|
timeout = 300
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FeatureNotConfiguredError,
|
|
3
|
+
getSession,
|
|
4
|
+
startBuilderDesignSystemIndex,
|
|
5
|
+
} from "@agent-native/core/server";
|
|
6
|
+
import {
|
|
7
|
+
defineEventHandler,
|
|
8
|
+
getRequestHeader,
|
|
9
|
+
readMultipartFormData,
|
|
10
|
+
setResponseStatus,
|
|
11
|
+
} from "h3";
|
|
12
|
+
|
|
13
|
+
import { upsertBuilderProxyDesignSystem } from "../lib/builder-design-system-proxy.js";
|
|
14
|
+
|
|
15
|
+
const MAX_FIG_BYTES = 200 * 1024 * 1024;
|
|
16
|
+
const MULTIPART_OVERHEAD_BYTES = 1024 * 1024;
|
|
17
|
+
|
|
18
|
+
function requestContentLength(event: Parameters<typeof getRequestHeader>[0]) {
|
|
19
|
+
const raw = getRequestHeader(event, "content-length");
|
|
20
|
+
if (!raw) return null;
|
|
21
|
+
const parsed = Number(raw);
|
|
22
|
+
return Number.isFinite(parsed) && parsed >= 0 ? parsed : null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const indexDesignSystemWithBuilder = defineEventHandler(
|
|
26
|
+
async (event) => {
|
|
27
|
+
const session = await getSession(event).catch(() => null);
|
|
28
|
+
if (!session?.email) {
|
|
29
|
+
setResponseStatus(event, 401);
|
|
30
|
+
return { error: "Unauthorized" };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const contentLength = requestContentLength(event);
|
|
34
|
+
if (
|
|
35
|
+
contentLength !== null &&
|
|
36
|
+
contentLength > MAX_FIG_BYTES + MULTIPART_OVERHEAD_BYTES
|
|
37
|
+
) {
|
|
38
|
+
setResponseStatus(event, 413);
|
|
39
|
+
return {
|
|
40
|
+
error: `File too large (max ${Math.round(MAX_FIG_BYTES / 1024 / 1024)} MB).`,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
let parts;
|
|
45
|
+
try {
|
|
46
|
+
parts = await readMultipartFormData(event);
|
|
47
|
+
} catch {
|
|
48
|
+
setResponseStatus(event, 413);
|
|
49
|
+
return { error: "Upload too large or malformed." };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const part = parts?.find(
|
|
53
|
+
(p) => (p.name === "file" || p.name === "fig") && p.data,
|
|
54
|
+
);
|
|
55
|
+
if (!part) {
|
|
56
|
+
setResponseStatus(event, 400);
|
|
57
|
+
return {
|
|
58
|
+
error: "No .fig file uploaded (expected multipart field 'file').",
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (part.data.length > MAX_FIG_BYTES) {
|
|
62
|
+
setResponseStatus(event, 413);
|
|
63
|
+
return {
|
|
64
|
+
error: `File too large (max ${Math.round(MAX_FIG_BYTES / 1024 / 1024)} MB).`,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const suggestedTitle =
|
|
69
|
+
(part.filename || "Imported brand")
|
|
70
|
+
.replace(/\.fig$/i, "")
|
|
71
|
+
.replace(/[-_]+/g, " ")
|
|
72
|
+
.trim() || "Imported brand";
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
const result = await startBuilderDesignSystemIndex({
|
|
76
|
+
projectName: suggestedTitle,
|
|
77
|
+
files: [
|
|
78
|
+
{
|
|
79
|
+
name: part.filename || "brand.fig",
|
|
80
|
+
data: part.data,
|
|
81
|
+
mimeType: "application/octet-stream",
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
});
|
|
85
|
+
const proxy = await upsertBuilderProxyDesignSystem({
|
|
86
|
+
result,
|
|
87
|
+
ownerEmail: session.email,
|
|
88
|
+
orgId: session.orgId ?? null,
|
|
89
|
+
projectName: suggestedTitle,
|
|
90
|
+
});
|
|
91
|
+
return {
|
|
92
|
+
...result,
|
|
93
|
+
...proxy,
|
|
94
|
+
uploadedFileCount: 1,
|
|
95
|
+
};
|
|
96
|
+
} catch (err) {
|
|
97
|
+
if (err instanceof FeatureNotConfiguredError) {
|
|
98
|
+
setResponseStatus(event, 412);
|
|
99
|
+
return {
|
|
100
|
+
error:
|
|
101
|
+
err.message ||
|
|
102
|
+
"Connect Builder.io before indexing a design system from Figma.",
|
|
103
|
+
builderConnectUrl:
|
|
104
|
+
err.builderConnectUrl ?? "/_agent-native/builder/connect",
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
setResponseStatus(event, 502);
|
|
108
|
+
return {
|
|
109
|
+
error:
|
|
110
|
+
err instanceof Error
|
|
111
|
+
? err.message
|
|
112
|
+
: "Builder design-system indexing failed.",
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
);
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { eq } from "drizzle-orm";
|
|
2
|
+
import { nanoid } from "nanoid";
|
|
3
|
+
|
|
4
|
+
import { getDb, schema } from "../db/index.js";
|
|
5
|
+
|
|
6
|
+
type BuilderDesignSystemIndexResult = {
|
|
7
|
+
designSystemId: string;
|
|
8
|
+
jobId: string;
|
|
9
|
+
builderUrl: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
function localBuilderDesignSystemId(builderDesignSystemId: string): string {
|
|
13
|
+
const slug = builderDesignSystemId
|
|
14
|
+
.replace(/[^a-zA-Z0-9_-]+/g, "-")
|
|
15
|
+
.replace(/^-+|-+$/g, "")
|
|
16
|
+
.slice(0, 96);
|
|
17
|
+
return `builder-${slug || "design-system"}`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function builderProxyData({
|
|
21
|
+
builderDesignSystemId,
|
|
22
|
+
jobId,
|
|
23
|
+
builderUrl,
|
|
24
|
+
projectName,
|
|
25
|
+
description,
|
|
26
|
+
}: {
|
|
27
|
+
builderDesignSystemId: string;
|
|
28
|
+
jobId: string;
|
|
29
|
+
builderUrl: string;
|
|
30
|
+
projectName?: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
}) {
|
|
33
|
+
return JSON.stringify({
|
|
34
|
+
source: "builder",
|
|
35
|
+
builderDesignSystemId,
|
|
36
|
+
builderJobId: jobId,
|
|
37
|
+
builderUrl,
|
|
38
|
+
colors: {
|
|
39
|
+
primary: "var(--primary)",
|
|
40
|
+
secondary: "var(--secondary)",
|
|
41
|
+
accent: "var(--accent)",
|
|
42
|
+
background: "var(--background)",
|
|
43
|
+
surface: "var(--card)",
|
|
44
|
+
text: "var(--foreground)",
|
|
45
|
+
textMuted: "var(--muted-foreground)",
|
|
46
|
+
},
|
|
47
|
+
typography: {
|
|
48
|
+
headingFont: "inherit",
|
|
49
|
+
bodyFont: "inherit",
|
|
50
|
+
headingWeight: "700",
|
|
51
|
+
bodyWeight: "400",
|
|
52
|
+
headingSizes: { h1: "48px", h2: "32px", h3: "24px" },
|
|
53
|
+
},
|
|
54
|
+
spacing: { elementGap: "24px", slidePadding: "48px" },
|
|
55
|
+
borders: { radius: "12px", accentWidth: "1px" },
|
|
56
|
+
logos: [],
|
|
57
|
+
notes: [
|
|
58
|
+
"This is a local proxy for a Builder-indexed design system.",
|
|
59
|
+
`Builder design system id: ${builderDesignSystemId}`,
|
|
60
|
+
`Builder indexing job id: ${jobId}`,
|
|
61
|
+
`Builder URL: ${builderUrl}`,
|
|
62
|
+
projectName ? `Requested name: ${projectName}` : "",
|
|
63
|
+
description ? `Context: ${description}` : "",
|
|
64
|
+
"Use Builder as the source of truth for extracted tokens and guidance.",
|
|
65
|
+
]
|
|
66
|
+
.filter(Boolean)
|
|
67
|
+
.join("\n"),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function builderProxyInstructions({
|
|
72
|
+
builderDesignSystemId,
|
|
73
|
+
jobId,
|
|
74
|
+
builderUrl,
|
|
75
|
+
}: {
|
|
76
|
+
builderDesignSystemId: string;
|
|
77
|
+
jobId: string;
|
|
78
|
+
builderUrl: string;
|
|
79
|
+
}) {
|
|
80
|
+
return [
|
|
81
|
+
"This design system is indexed and owned by Builder.",
|
|
82
|
+
`Builder design system id: ${builderDesignSystemId}`,
|
|
83
|
+
`Builder job id: ${jobId}`,
|
|
84
|
+
`Builder URL: ${builderUrl}`,
|
|
85
|
+
"When generating slides, treat Builder as the source of truth for the final extracted tokens, assets, and guidance.",
|
|
86
|
+
].join("\n");
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export async function upsertBuilderProxyDesignSystem({
|
|
90
|
+
result,
|
|
91
|
+
ownerEmail,
|
|
92
|
+
orgId,
|
|
93
|
+
projectName,
|
|
94
|
+
description,
|
|
95
|
+
}: {
|
|
96
|
+
result: BuilderDesignSystemIndexResult;
|
|
97
|
+
ownerEmail: string;
|
|
98
|
+
orgId?: string | null;
|
|
99
|
+
projectName?: string;
|
|
100
|
+
description?: string;
|
|
101
|
+
}) {
|
|
102
|
+
const db = getDb();
|
|
103
|
+
const now = new Date().toISOString();
|
|
104
|
+
const baseLocalDesignSystemId = localBuilderDesignSystemId(
|
|
105
|
+
result.designSystemId,
|
|
106
|
+
);
|
|
107
|
+
const title = projectName?.trim() || "Builder indexed design system";
|
|
108
|
+
const localData = builderProxyData({
|
|
109
|
+
builderDesignSystemId: result.designSystemId,
|
|
110
|
+
jobId: result.jobId,
|
|
111
|
+
builderUrl: result.builderUrl,
|
|
112
|
+
projectName,
|
|
113
|
+
description,
|
|
114
|
+
});
|
|
115
|
+
const customInstructions = builderProxyInstructions({
|
|
116
|
+
builderDesignSystemId: result.designSystemId,
|
|
117
|
+
jobId: result.jobId,
|
|
118
|
+
builderUrl: result.builderUrl,
|
|
119
|
+
});
|
|
120
|
+
const [existing] = await db
|
|
121
|
+
.select({
|
|
122
|
+
id: schema.designSystems.id,
|
|
123
|
+
ownerEmail: schema.designSystems.ownerEmail,
|
|
124
|
+
})
|
|
125
|
+
.from(schema.designSystems)
|
|
126
|
+
.where(eq(schema.designSystems.id, baseLocalDesignSystemId))
|
|
127
|
+
.limit(1);
|
|
128
|
+
const localDesignSystemId =
|
|
129
|
+
existing && existing.ownerEmail !== ownerEmail
|
|
130
|
+
? `${baseLocalDesignSystemId}-${nanoid(8)}`
|
|
131
|
+
: baseLocalDesignSystemId;
|
|
132
|
+
if (existing && existing.ownerEmail === ownerEmail) {
|
|
133
|
+
await db
|
|
134
|
+
.update(schema.designSystems)
|
|
135
|
+
.set({
|
|
136
|
+
title,
|
|
137
|
+
description:
|
|
138
|
+
description ??
|
|
139
|
+
`Builder indexed design system ${result.designSystemId}`,
|
|
140
|
+
data: localData,
|
|
141
|
+
assets: "[]",
|
|
142
|
+
customInstructions,
|
|
143
|
+
updatedAt: now,
|
|
144
|
+
})
|
|
145
|
+
.where(eq(schema.designSystems.id, existing.id));
|
|
146
|
+
} else {
|
|
147
|
+
const [ownedSystem] = await db
|
|
148
|
+
.select({ id: schema.designSystems.id })
|
|
149
|
+
.from(schema.designSystems)
|
|
150
|
+
.where(eq(schema.designSystems.ownerEmail, ownerEmail))
|
|
151
|
+
.limit(1);
|
|
152
|
+
await db.insert(schema.designSystems).values({
|
|
153
|
+
id: localDesignSystemId,
|
|
154
|
+
title,
|
|
155
|
+
description:
|
|
156
|
+
description ?? `Builder indexed design system ${result.designSystemId}`,
|
|
157
|
+
data: localData,
|
|
158
|
+
assets: "[]",
|
|
159
|
+
customInstructions,
|
|
160
|
+
isDefault: !ownedSystem,
|
|
161
|
+
ownerEmail,
|
|
162
|
+
orgId: orgId ?? null,
|
|
163
|
+
createdAt: now,
|
|
164
|
+
updatedAt: now,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return {
|
|
169
|
+
localDesignSystemId,
|
|
170
|
+
instructions: [
|
|
171
|
+
"Builder design-system indexing has started.",
|
|
172
|
+
`Builder design system: ${result.designSystemId}`,
|
|
173
|
+
`Local selectable design system: ${localDesignSystemId}`,
|
|
174
|
+
`Builder job: ${result.jobId}`,
|
|
175
|
+
`Open: ${result.builderUrl}`,
|
|
176
|
+
"Use the local design system id in Slides flows; Builder remains the source of truth for the indexed brand kit.",
|
|
177
|
+
].join("\n"),
|
|
178
|
+
};
|
|
179
|
+
}
|
|
@@ -8,6 +8,8 @@ import actionsRegistry from "../../.generated/actions-registry.js";
|
|
|
8
8
|
import { prepareSlidesChatAttachments } from "../lib/chat-attachments.js";
|
|
9
9
|
import "../register-secrets.js";
|
|
10
10
|
|
|
11
|
+
const SLIDES_BACKGROUND_RUN_SOFT_TIMEOUT_MS = 13 * 60_000;
|
|
12
|
+
|
|
11
13
|
const INITIAL_TOOL_NAMES = [
|
|
12
14
|
"view-screen",
|
|
13
15
|
"list-decks",
|
|
@@ -31,7 +33,8 @@ export default createAgentChatPlugin({
|
|
|
31
33
|
appId: "slides",
|
|
32
34
|
actions: loadActionsFromStaticRegistry(actionsRegistry),
|
|
33
35
|
initialToolNames: INITIAL_TOOL_NAMES,
|
|
34
|
-
|
|
36
|
+
durableBackgroundRuns: true,
|
|
37
|
+
runSoftTimeoutMs: SLIDES_BACKGROUND_RUN_SOFT_TIMEOUT_MS,
|
|
35
38
|
// Enable sandboxed JavaScript execution so Slides agents can fetch,
|
|
36
39
|
// paginate, and reduce provider data through providerFetch() without us
|
|
37
40
|
// hardcoding one action per Google Drive endpoint.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { indexDesignSystemWithBuilder as default } from "../../handlers/index-design-system-with-builder";
|
package/dist/action.d.ts
CHANGED
|
@@ -266,6 +266,10 @@ interface DefineActionWithSchema<TSchema extends StandardSchemaV1, TReturn = any
|
|
|
266
266
|
* Defaults to true. Set to false only for metadata/read actions that safely
|
|
267
267
|
* handle `ctx.userEmail` / `getRequestUserEmail()` being undefined. */
|
|
268
268
|
requiresAuth?: boolean;
|
|
269
|
+
/** Max HTTP request body in bytes. When set, the route 413s on the declared
|
|
270
|
+
* `Content-Length` before parsing. Use for public, no-auth POST actions;
|
|
271
|
+
* unset = no route-level cap. */
|
|
272
|
+
maxBodyBytes?: number;
|
|
269
273
|
/** Whether this action is exposed to the agent — the in-app assistant and the
|
|
270
274
|
* app's MCP/A2A tool surfaces — as a callable tool. **Default-allow opt-out**:
|
|
271
275
|
* `undefined` / `true` expose it; only an explicit `false` hides it from every
|
|
@@ -314,6 +318,13 @@ interface DefineActionWithSchema<TSchema extends StandardSchemaV1, TReturn = any
|
|
|
314
318
|
/** Optional native Agent-Native chat renderer for this action's structured
|
|
315
319
|
* result. This is first-party React UI, not arbitrary HTML/JS. */
|
|
316
320
|
chatUI?: ActionChatUIConfig;
|
|
321
|
+
/**
|
|
322
|
+
* Per-tool timeout override in milliseconds for agent-loop tool calls. Use
|
|
323
|
+
* sparingly for actions that legitimately wait on slow provider work.
|
|
324
|
+
*/
|
|
325
|
+
timeoutMs?: number;
|
|
326
|
+
/** Per-tool result truncation override for agent-loop tool calls. */
|
|
327
|
+
maxResultChars?: number;
|
|
317
328
|
/**
|
|
318
329
|
* Opt-in human-in-the-loop approval gate. **Default off** — the framework
|
|
319
330
|
* intentionally keeps HITL approvals rare; almost every action should run
|
|
@@ -361,6 +372,9 @@ interface DefineActionWithParams<TParams extends Record<string, ParameterSchema>
|
|
|
361
372
|
/** Whether the HTTP/frontend action route must have an authenticated owner.
|
|
362
373
|
* Defaults to true. See the schema overload above. */
|
|
363
374
|
requiresAuth?: boolean;
|
|
375
|
+
/** Max HTTP request body in bytes; 413s on `Content-Length` before parsing.
|
|
376
|
+
* See the schema overload above. */
|
|
377
|
+
maxBodyBytes?: number;
|
|
364
378
|
/** Whether this action is exposed to the agent as a callable tool. Only an
|
|
365
379
|
* explicit `false` hides it from every agent tool list while keeping it
|
|
366
380
|
* frontend/HTTP-callable. See the schema overload above and actions.md. */
|
|
@@ -383,6 +397,10 @@ interface DefineActionWithParams<TParams extends Record<string, ParameterSchema>
|
|
|
383
397
|
mcpApp?: ActionMcpAppConfig;
|
|
384
398
|
/** Optional native Agent-Native chat renderer. See schema overload above. */
|
|
385
399
|
chatUI?: ActionChatUIConfig;
|
|
400
|
+
/** Per-tool timeout override in milliseconds. See schema overload above. */
|
|
401
|
+
timeoutMs?: number;
|
|
402
|
+
/** Per-tool result truncation override. See schema overload above. */
|
|
403
|
+
maxResultChars?: number;
|
|
386
404
|
/** Opt-in human-in-the-loop approval gate (default off). See the schema
|
|
387
405
|
* overload above for full semantics. */
|
|
388
406
|
needsApproval?: boolean | ((args: InferParams<TParams>, ctx?: ActionRunContext) => boolean | Promise<boolean>);
|
|
@@ -413,6 +431,7 @@ export interface ActionDefinition<TInput, TReturn> {
|
|
|
413
431
|
readonly tool: import("./agent/types.js").ActionTool;
|
|
414
432
|
readonly http?: ActionHttpConfig | false;
|
|
415
433
|
readonly requiresAuth?: boolean;
|
|
434
|
+
readonly maxBodyBytes?: number;
|
|
416
435
|
readonly agentTool?: boolean;
|
|
417
436
|
readonly readOnly?: boolean;
|
|
418
437
|
readonly parallelSafe?: boolean;
|
|
@@ -421,6 +440,10 @@ export interface ActionDefinition<TInput, TReturn> {
|
|
|
421
440
|
readonly link?: ActionLinkBuilder;
|
|
422
441
|
readonly mcpApp?: ActionMcpAppConfig;
|
|
423
442
|
readonly chatUI?: ActionChatUIConfig;
|
|
443
|
+
/** Per-tool timeout override in milliseconds for agent-loop tool calls. */
|
|
444
|
+
readonly timeoutMs?: number;
|
|
445
|
+
/** Per-tool result truncation override for agent-loop tool calls. */
|
|
446
|
+
readonly maxResultChars?: number;
|
|
424
447
|
/** Standard Schema the action's RETURN value is validated against after
|
|
425
448
|
* `run()` resolves. Present only when the caller passed `outputSchema`. */
|
|
426
449
|
readonly outputSchema?: StandardSchemaV1;
|