@agent-native/core 0.79.27 → 0.80.1
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 +34 -0
- package/corpus/core/docs/content/locales/ar-SA/skills-guide.mdx +5 -0
- package/corpus/core/docs/content/locales/ar-SA/template-design.mdx +55 -1
- package/corpus/core/docs/content/locales/de-DE/skills-guide.mdx +5 -0
- package/corpus/core/docs/content/locales/de-DE/template-design.mdx +66 -1
- package/corpus/core/docs/content/locales/es-ES/skills-guide.mdx +5 -0
- package/corpus/core/docs/content/locales/es-ES/template-design.mdx +65 -1
- package/corpus/core/docs/content/locales/fr-FR/skills-guide.mdx +5 -0
- package/corpus/core/docs/content/locales/fr-FR/template-design.mdx +64 -1
- package/corpus/core/docs/content/locales/hi-IN/skills-guide.mdx +5 -0
- package/corpus/core/docs/content/locales/hi-IN/template-design.mdx +59 -1
- package/corpus/core/docs/content/locales/ja-JP/skills-guide.mdx +5 -0
- package/corpus/core/docs/content/locales/ja-JP/template-design.mdx +62 -1
- package/corpus/core/docs/content/locales/ko-KR/skills-guide.mdx +5 -0
- package/corpus/core/docs/content/locales/ko-KR/template-design.mdx +58 -1
- package/corpus/core/docs/content/locales/pt-BR/skills-guide.mdx +5 -0
- package/corpus/core/docs/content/locales/pt-BR/template-design.mdx +62 -1
- package/corpus/core/docs/content/locales/zh-CN/skills-guide.mdx +5 -0
- package/corpus/core/docs/content/locales/zh-CN/template-design.mdx +50 -1
- package/corpus/core/docs/content/locales/zh-TW/skills-guide.mdx +5 -0
- package/corpus/core/docs/content/locales/zh-TW/template-design.mdx +52 -1
- package/corpus/core/docs/content/skills-guide.mdx +5 -0
- package/corpus/core/docs/content/template-design.mdx +59 -1
- package/corpus/core/package.json +2 -1
- package/corpus/core/src/agent/engine/index.ts +1 -0
- package/corpus/core/src/agent/engine/registry.ts +40 -0
- package/corpus/core/src/agent/production-agent.ts +6 -2
- package/corpus/core/src/application-state/handlers.ts +1 -1
- package/corpus/core/src/brand-kit/index.ts +1 -1
- package/corpus/core/src/cli/design-connect.ts +490 -0
- package/corpus/core/src/cli/index.ts +16 -0
- package/corpus/core/src/cli/skills.ts +144 -3
- package/corpus/core/src/client/AgentPanel.tsx +1 -1
- package/corpus/core/src/client/AssistantChat.tsx +43 -7
- package/corpus/core/src/client/MultiTabAssistantChat.tsx +1 -1
- package/corpus/core/src/client/agent-chat.ts +27 -3
- package/corpus/core/src/client/blocks/library/MermaidBlock.tsx +1 -1
- package/corpus/core/src/client/blocks/library/diagram.tsx +2 -2
- package/corpus/core/src/client/blocks/library/wireframe.tsx +1 -1
- package/corpus/core/src/client/chat/message-components.tsx +1 -1
- package/corpus/core/src/client/chat-model-groups.ts +1 -2
- package/corpus/core/src/client/components/LiveCursorOverlay.tsx +33 -66
- package/corpus/core/src/client/composer/TiptapComposer.tsx +99 -24
- package/corpus/core/src/client/composer/useVoiceDictation.ts +429 -260
- package/corpus/core/src/client/extensions/portable-extension.ts +1 -1
- package/corpus/core/src/client/frame-protocol.ts +17 -2
- package/corpus/core/src/client/rich-markdown-editor/RegistryBlockNode.tsx +2 -2
- package/corpus/core/src/client/sharing/ShareButton.tsx +20 -15
- package/corpus/core/src/client/use-agent-engine-configured.ts +80 -28
- package/corpus/core/src/code-agents/transcript-normalizer.ts +1 -1
- package/corpus/core/src/extensions/path.ts +1 -4
- package/corpus/core/src/integrations/a2a-continuation-processor.ts +1 -1
- package/corpus/core/src/mcp/build-server.ts +1 -1
- package/corpus/core/src/org/handlers.ts +5 -5
- package/corpus/core/src/org/plugin.ts +2 -2
- package/corpus/core/src/scripts/call-agent.ts +1 -1
- package/corpus/core/src/scripts/db/safety.ts +1 -1
- package/corpus/core/src/server/auth.ts +3 -0
- package/corpus/core/src/server/builder-design-systems.ts +308 -0
- package/corpus/core/src/server/core-routes-plugin.ts +29 -3
- package/corpus/core/src/server/index.ts +8 -0
- package/corpus/core/src/server/transcribe-voice.ts +57 -22
- package/corpus/core/src/shared/mcp-embed-headers.ts +23 -1
- package/corpus/core/src/styles/agent-native.css +60 -4
- package/corpus/core/src/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +10 -0
- package/corpus/core/src/usage/store.ts +2 -2
- package/corpus/core/src/vite/client.ts +2 -0
- package/corpus/core/src/voice/index.ts +18 -0
- package/corpus/core/src/voice/voice-cleanup-prompt.ts +38 -0
- package/corpus/core/src/voice/voice-context.ts +217 -0
- package/corpus/core/src/voice/voice-replacements.ts +75 -0
- package/corpus/templates/analytics/AGENTS.md +4 -3
- package/corpus/templates/analytics/actions/dashboard-mutation-api.ts +298 -15
- package/corpus/templates/analytics/actions/get-sql-dashboard.ts +9 -4
- package/corpus/templates/analytics/actions/list-session-recordings.ts +6 -1
- package/corpus/templates/analytics/actions/mutate-dashboard.ts +18 -2
- package/corpus/templates/analytics/actions/query-agent-native-analytics.ts +12 -2
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +557 -400
- package/corpus/templates/analytics/app/global.css +0 -4
- package/corpus/templates/analytics/app/hooks/use-replay-storage-status.ts +66 -0
- package/corpus/templates/analytics/app/i18n/zh-TW.ts +39 -0
- package/corpus/templates/analytics/app/i18n-data.ts +424 -0
- package/corpus/templates/analytics/app/pages/Settings.tsx +333 -0
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/PanelEditorDialog.tsx +2 -1
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/dashboard-layout.ts +121 -3
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +82 -34
- package/corpus/templates/analytics/app/pages/sessions/SessionDetailPage.tsx +7 -0
- package/corpus/templates/analytics/app/pages/sessions/SessionsPage.tsx +144 -36
- package/corpus/templates/analytics/changelog/2026-06-28-ask-tab-now-matches-the-darker-app-background.md +6 -0
- package/corpus/templates/analytics/changelog/2026-06-28-dashboard-email-reports-now-use-cleaner-light-mode-snapshots.md +6 -0
- package/corpus/templates/analytics/changelog/2026-06-28-left-sidebar-collapses-into-an-animated-icon-rail.md +6 -0
- package/corpus/templates/analytics/changelog/2026-06-28-sessions-now-show-only-signed-in-recordings-with-playable-re.md +6 -0
- package/corpus/templates/analytics/changelog/2026-06-29-analytics-agents-can-now-place-new-charts-into-requested-das.md +6 -0
- package/corpus/templates/analytics/changelog/2026-06-29-analytics-queries-now-report-failed-source-query-errors-inst.md +6 -0
- package/corpus/templates/analytics/changelog/2026-06-29-charts-can-now-be-dropped-between-full-dashboard-rows-to-cre.md +6 -0
- package/corpus/templates/analytics/changelog/2026-06-29-dashboard-email-reports-include-the-full-dashboard-image-wit.md +6 -0
- package/corpus/templates/analytics/changelog/2026-06-29-main-surface-border-reaches-the-top.md +6 -0
- package/corpus/templates/analytics/changelog/2026-06-29-session-replay-now-records-playable-sessions-in-production-a.md +6 -0
- package/corpus/templates/analytics/changelog/2026-06-29-set-up-session-replay-storage-from-settings-connect-builder-.md +6 -0
- package/corpus/templates/analytics/scripts/cleanup-empty-session-recordings.ts +102 -0
- package/corpus/templates/analytics/seeds/dashboards/agent-native-templates-first-party.json +3 -3
- package/corpus/templates/analytics/server/lib/dashboard-report.ts +75 -30
- package/corpus/templates/analytics/server/lib/first-party-metric-catalog.ts +5 -2
- package/corpus/templates/analytics/server/lib/real-data-actions.ts +81 -20
- package/corpus/templates/analytics/server/lib/replay-storage.ts +79 -0
- package/corpus/templates/analytics/server/lib/s3-upload-provider.ts +255 -0
- package/corpus/templates/analytics/server/lib/session-replay.ts +53 -12
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +11 -2
- package/corpus/templates/analytics/server/plugins/onboarding.ts +97 -0
- package/corpus/templates/assets/app/components/layout/Sidebar.tsx +4 -4
- package/corpus/templates/assets/changelog/2026-06-28-left-sidebar-collapse-motion-and-footer-chrome-are-quieter.md +6 -0
- package/corpus/templates/brain/app/components/layout/Layout.tsx +29 -2
- package/corpus/templates/brain/app/components/layout/Sidebar.tsx +131 -42
- package/corpus/templates/brain/app/i18n/zh-TW.ts +2 -0
- package/corpus/templates/brain/app/i18n-data.ts +20 -0
- package/corpus/templates/brain/changelog/2026-06-28-left-sidebar-collapses-into-an-animated-icon-rail.md +6 -0
- package/corpus/templates/calendar/app/components/layout/AppLayout.tsx +29 -1
- package/corpus/templates/calendar/app/components/layout/Sidebar.tsx +417 -299
- package/corpus/templates/calendar/app/i18n/zh-TW.ts +2 -0
- package/corpus/templates/calendar/app/i18n-data.ts +20 -0
- package/corpus/templates/calendar/changelog/2026-06-28-left-sidebar-collapses-into-an-animated-icon-rail.md +6 -0
- package/corpus/templates/chat/app/components/layout/Sidebar.tsx +6 -19
- package/corpus/templates/chat/changelog/2026-06-28-left-sidebar-collapse-motion-and-footer-chrome-are-quieter.md +6 -0
- package/corpus/templates/clips/AGENTS.md +4 -0
- package/corpus/templates/clips/actions/cleanup-transcript.ts +39 -9
- package/corpus/templates/clips/actions/finalize-meeting.ts +81 -12
- package/corpus/templates/clips/actions/lib/agents-md-context.ts +4 -1
- package/corpus/templates/clips/app/components/library/library-layout.tsx +3 -3
- package/corpus/templates/clips/app/components/meetings/share-meeting-dialog.tsx +1 -1
- package/corpus/templates/clips/app/components/player/share-dialog.tsx +2 -2
- package/corpus/templates/clips/changelog/2026-06-28-left-sidebar-footer-controls-use-less-divider-chrome.md +6 -0
- package/corpus/templates/clips/desktop/src/lib/personal-vocabulary.ts +13 -8
- package/corpus/templates/clips/desktop/src/lib/recorder.ts +24 -0
- package/corpus/templates/clips/desktop/src/lib/transcription-capture.ts +105 -5
- package/corpus/templates/clips/desktop/src/lib/voice-dictation.ts +60 -1
- package/corpus/templates/content/actions/set-image-alt-text.ts +1 -1
- package/corpus/templates/content/app/components/editor/DocumentDatabase.tsx +1 -1
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +1 -1
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +5 -5
- package/corpus/templates/content/changelog/2026-06-28-left-sidebar-collapse-motion-and-footer-chrome-are-quieter.md +6 -0
- package/corpus/templates/content/shared/document-export.ts +1 -1
- package/corpus/templates/design/.agents/skills/design-systems/SKILL.md +8 -18
- package/corpus/templates/design/.agents/skills/visual-edit/SKILL.md +154 -0
- package/corpus/templates/design/AGENTS.md +95 -5
- package/corpus/templates/design/DESIGN.md +82 -0
- package/corpus/templates/design/DEVELOPING.md +43 -0
- package/corpus/templates/design/actions/add-localhost-screens.ts +453 -0
- package/corpus/templates/design/actions/apply-shader.ts +277 -0
- package/corpus/templates/design/actions/apply-visual-edit.ts +303 -0
- package/corpus/templates/design/actions/connect-localhost.ts +183 -0
- package/corpus/templates/design/actions/edit-design.ts +195 -42
- package/corpus/templates/design/actions/generate-design.ts +71 -1
- package/corpus/templates/design/actions/generate-screens.ts +193 -0
- package/corpus/templates/design/actions/get-code-layer-projection.ts +191 -0
- package/corpus/templates/design/actions/get-shader.ts +119 -0
- package/corpus/templates/design/actions/index-design-system-with-builder.ts +259 -0
- package/corpus/templates/design/actions/list-localhost-connections.ts +95 -0
- package/corpus/templates/design/actions/navigate.ts +55 -2
- package/corpus/templates/design/actions/update-file.ts +9 -2
- package/corpus/templates/design/actions/view-screen.ts +68 -1
- package/corpus/templates/design/agent-native.app-skill.json +10 -0
- package/corpus/templates/design/app/components/design/CanvasContextMenu.tsx +719 -0
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +2120 -103
- package/corpus/templates/design/app/components/design/DesignEditorSkeleton.tsx +74 -38
- package/corpus/templates/design/app/components/design/DesignExtensionsPanel.tsx +401 -0
- package/corpus/templates/design/app/components/design/EditPanel.tsx +3966 -440
- package/corpus/templates/design/app/components/design/LayersPanel.tsx +1473 -0
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +3940 -147
- package/corpus/templates/design/app/components/design/QuestionFlow.tsx +700 -13
- package/corpus/templates/design/app/components/design/TweaksPanel.tsx +105 -63
- package/corpus/templates/design/app/components/design/index.ts +0 -5
- package/corpus/templates/design/app/components/design/inspector/AlignmentMatrix.tsx +353 -0
- package/corpus/templates/design/app/components/design/inspector/AutoLayoutMatrix.tsx +1589 -0
- package/corpus/templates/design/app/components/design/inspector/ConstraintsWidget.tsx +511 -0
- package/corpus/templates/design/app/components/design/inspector/ExportSettingsPanel.tsx +395 -0
- package/corpus/templates/design/app/components/design/inspector/FigmaColorPicker.tsx +2010 -0
- package/corpus/templates/design/app/components/design/inspector/GradientEditor.tsx +601 -0
- package/corpus/templates/design/app/components/design/inspector/ImageFillControls.tsx +242 -0
- package/corpus/templates/design/app/components/design/inspector/SHADER_INTEGRATION.md +420 -0
- package/corpus/templates/design/app/components/design/inspector/ScrubInput.tsx +238 -0
- package/corpus/templates/design/app/components/design/inspector/ShaderControls.stories.tsx +71 -0
- package/corpus/templates/design/app/components/design/inspector/ShaderControls.tsx +575 -0
- package/corpus/templates/design/app/components/design/inspector/ShaderEffectRow.tsx +106 -0
- package/corpus/templates/design/app/components/design/inspector/ShaderFillsPanel.tsx +423 -0
- package/corpus/templates/design/app/components/design/inspector/figma-icons.tsx +741 -0
- package/corpus/templates/design/app/components/design/inspector/index.ts +87 -0
- package/corpus/templates/design/app/components/design/inspector/scrub-input-utils.ts +201 -0
- package/corpus/templates/design/app/components/design/types.ts +23 -0
- package/corpus/templates/design/app/components/layout/Layout.tsx +24 -13
- package/corpus/templates/design/app/components/layout/Sidebar.tsx +4 -4
- package/corpus/templates/design/app/components/visual-editor/CanvasCommentPins.tsx +474 -36
- package/corpus/templates/design/app/components/visual-editor/DrawOverlay.tsx +22 -5
- package/corpus/templates/design/app/components/visual-editor/SaveStatusIndicator.tsx +24 -11
- package/corpus/templates/design/app/global.css +149 -5
- package/corpus/templates/design/app/hooks/use-agent-generating.ts +4 -0
- package/corpus/templates/design/app/hooks/use-navigation-state.ts +130 -8
- package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +329 -0
- package/corpus/templates/design/app/i18n/zh-TW.ts +277 -0
- package/corpus/templates/design/app/i18n-data.ts +3028 -1
- package/corpus/templates/design/app/pages/DesignEditor.tsx +5831 -904
- package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +57 -221
- package/corpus/templates/design/changelog/2026-06-28-annotate-mode-now-combines-drawing-and-comment-pins-in-one-c.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-design-editor-panel-borders-are-cleaner-so-the-canvas-edge-s.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-drawing-prompts-now-reliably-open-and-submit-to-the-design-a.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-editor-app-menus-now-use-an-outline-agent-native-mark-with-b.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-figma-style-code-design-mode.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-layer-selection-now-updates-chat-context-without-opening-the.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-layer-selections-now-preserve-hidden-and-locked-canvas-state.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-left-sidebar-collapse-motion-and-footer-chrome-are-quieter.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-live-cursors-now-keep-names-beside-a-cleaner-pointer-marker.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-mode-switching-now-lives-in-a-compact-bottom-right-icon-dock.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-screen-overview-now-handles-zooming-drawing-opening-and-dele.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-screen-overview-now-selects-screens-on-click-and-opens-them-.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-screen-overview-zooms-into-the-active-screen-with-smoother-e.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-selected-element-chips-in-chat-are-shorter-and-easier-to-sca.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-the-design-editor-toolbar-is-more-compact-and-the-app-menu-m.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-tweaks-now-live-at-the-top-of-the-design-sidebar-instead-of-.md +6 -0
- package/corpus/templates/design/changelog/2026-06-28-tweaks-now-live-in-the-right-inspector-beside-the-design-tab.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-active-sidebar-rows-use-soft-highlights.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-agents-can-now-open-screen-overview-focus-screens-and-add.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-canvas-selection-no-longer-flashes-broken-prototype-html-whe.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-command-menu-selections-are-clearer-in-dark-mode.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-design-agents-now-edit-broad-copy-changes-more-reliably.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-design-editor-extensions-now-run-inline-beside-the-artboard.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-design-mode-top-chrome-now-groups-collaborators-preview-shar.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-element-selection-now-stays-on-the-intended-layer-after-sele.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-screen-overview-full-view-controls-now-sit-above-frames-inst.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-screen-overview-tools-can-draw-shapes-create-screens-and-kee.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-sidebars-use-darker-chrome-and-chat-warns-immediately.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-the-pen-tool-now-creates-anchor-based-bezier-vectors-with-ha.md +6 -0
- package/corpus/templates/design/changelog/2026-06-29-visual-edit-can-open-localhost-routes-as-url-backed-screens.md +6 -0
- package/corpus/templates/design/package.json +1 -0
- package/corpus/templates/design/server/db/schema.ts +26 -0
- package/corpus/templates/design/server/handlers/import-figma-system.ts +38 -85
- package/corpus/templates/design/server/lib/design-snapshot.ts +9 -1
- package/corpus/templates/design/server/plugins/agent-chat.ts +3 -0
- package/corpus/templates/design/shared/api.ts +27 -0
- package/corpus/templates/design/shared/canvas-frames.ts +103 -0
- package/corpus/templates/design/shared/canvas-math.ts +1058 -0
- package/corpus/templates/design/shared/code-layer.ts +2412 -0
- package/corpus/templates/design/shared/color-utils.ts +180 -0
- package/corpus/templates/design/shared/generation-session.ts +61 -0
- package/corpus/templates/design/shared/html-content.ts +21 -0
- package/corpus/templates/design/shared/pen-path.ts +207 -0
- package/corpus/templates/design/shared/shader-presets.ts +782 -0
- package/corpus/templates/design/shared/shader-safety.ts +137 -0
- package/corpus/templates/design/shared/source-mode.ts +237 -0
- package/corpus/templates/forms/app/components/layout/Sidebar.tsx +149 -6
- package/corpus/templates/forms/app/i18n/ar-SA.ts +2 -0
- package/corpus/templates/forms/app/i18n/de-DE.ts +2 -0
- package/corpus/templates/forms/app/i18n/en-US.ts +2 -0
- package/corpus/templates/forms/app/i18n/es-ES.ts +2 -0
- package/corpus/templates/forms/app/i18n/fr-FR.ts +2 -0
- package/corpus/templates/forms/app/i18n/hi-IN.ts +2 -0
- package/corpus/templates/forms/app/i18n/ja-JP.ts +2 -0
- package/corpus/templates/forms/app/i18n/ko-KR.ts +2 -0
- package/corpus/templates/forms/app/i18n/pt-BR.ts +2 -0
- package/corpus/templates/forms/app/i18n/zh-CN.ts +2 -0
- package/corpus/templates/forms/app/i18n/zh-TW.ts +2 -0
- package/corpus/templates/forms/changelog/2026-06-28-left-sidebar-collapses-into-an-animated-icon-rail.md +6 -0
- package/corpus/templates/macros/app/components/layout/AppLayout.tsx +2 -2
- package/corpus/templates/macros/changelog/2026-06-28-left-sidebar-footer-controls-use-less-divider-chrome.md +6 -0
- package/corpus/templates/mail/app/components/layout/AppLayout.tsx +408 -247
- package/corpus/templates/mail/app/i18n/ar-SA.ts +4 -0
- package/corpus/templates/mail/app/i18n/de-DE.ts +4 -0
- package/corpus/templates/mail/app/i18n/en-US.ts +4 -0
- package/corpus/templates/mail/app/i18n/es-ES.ts +4 -0
- package/corpus/templates/mail/app/i18n/fr-FR.ts +4 -0
- package/corpus/templates/mail/app/i18n/hi-IN.ts +4 -0
- package/corpus/templates/mail/app/i18n/ja-JP.ts +4 -0
- package/corpus/templates/mail/app/i18n/ko-KR.ts +4 -0
- package/corpus/templates/mail/app/i18n/pt-BR.ts +4 -0
- package/corpus/templates/mail/app/i18n/zh-CN.ts +4 -0
- package/corpus/templates/mail/app/i18n/zh-TW.ts +4 -0
- package/corpus/templates/mail/app/lib/utils.ts +2 -2
- package/corpus/templates/mail/changelog/2026-06-28-pinned-sidebar-collapses-into-an-animated-icon-rail.md +6 -0
- package/corpus/templates/plan/app/components/layout/Sidebar.tsx +6 -8
- package/corpus/templates/plan/app/components/plan/wireframe/Wireframe.tsx +1 -1
- package/corpus/templates/plan/app/global.css +61 -78
- package/corpus/templates/plan/app/pages/PlansPage.tsx +8 -0
- package/corpus/templates/plan/changelog/2026-06-28-left-sidebar-collapse-motion-and-footer-chrome-are-quieter.md +6 -0
- package/corpus/templates/plan/changelog/2026-06-28-plans-use-the-shared-neutral-light-and-dark-theme.md +6 -0
- package/corpus/templates/plan/changelog/2026-06-28-sending-open-feedback-from-a-plan-now-opens-the-inline-plan-.md +6 -0
- package/corpus/templates/slides/.agents/skills/design-systems/SKILL.md +9 -10
- package/corpus/templates/slides/AGENTS.md +3 -2
- package/corpus/templates/slides/actions/import-file.ts +26 -17
- package/corpus/templates/slides/actions/index-design-system-with-builder.ts +259 -0
- package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +35 -167
- package/corpus/templates/slides/app/components/design-system/fig-import-response.ts +9 -13
- package/corpus/templates/slides/app/components/layout/Sidebar.tsx +5 -5
- package/corpus/templates/slides/app/context/DeckContext.tsx +1 -1
- package/corpus/templates/slides/app/i18n/ar-SA.ts +9 -37
- package/corpus/templates/slides/app/i18n/de-DE.ts +10 -25
- package/corpus/templates/slides/app/i18n/en-US.ts +9 -26
- package/corpus/templates/slides/app/i18n/es-ES.ts +10 -28
- package/corpus/templates/slides/app/i18n/fr-FR.ts +10 -28
- package/corpus/templates/slides/app/i18n/hi-IN.ts +9 -26
- package/corpus/templates/slides/app/i18n/ja-JP.ts +10 -22
- package/corpus/templates/slides/app/i18n/ko-KR.ts +9 -23
- package/corpus/templates/slides/app/i18n/pt-BR.ts +10 -28
- package/corpus/templates/slides/app/i18n/zh-CN.ts +9 -22
- package/corpus/templates/slides/app/i18n/zh-TW.ts +9 -22
- package/corpus/templates/slides/changelog/2026-06-28-left-sidebar-collapse-motion-and-footer-chrome-are-quieter.md +6 -0
- package/corpus/templates/slides/server/handlers/import-figma-system.ts +44 -12
- package/corpus/templates/slides/server/lib/chat-attachments.ts +1 -1
- package/corpus/templates/videos/app/components/NewCompositionPopover.tsx +1 -1
- package/corpus/templates/videos/app/components/Sidebar.tsx +2 -2
- package/corpus/templates/videos/app/components/layout/Layout.tsx +29 -2
- package/corpus/templates/videos/app/components/layout/NavSidebar.tsx +113 -30
- package/corpus/templates/videos/app/i18n/ar-SA.ts +2 -0
- package/corpus/templates/videos/app/i18n/de-DE.ts +2 -0
- package/corpus/templates/videos/app/i18n/en-US.ts +2 -0
- package/corpus/templates/videos/app/i18n/es-ES.ts +2 -0
- package/corpus/templates/videos/app/i18n/fr-FR.ts +2 -0
- package/corpus/templates/videos/app/i18n/hi-IN.ts +2 -0
- package/corpus/templates/videos/app/i18n/ja-JP.ts +2 -0
- package/corpus/templates/videos/app/i18n/ko-KR.ts +2 -0
- package/corpus/templates/videos/app/i18n/pt-BR.ts +2 -0
- package/corpus/templates/videos/app/i18n/zh-CN.ts +2 -0
- package/corpus/templates/videos/app/i18n/zh-TW.ts +2 -0
- package/corpus/templates/videos/changelog/2026-06-28-left-sidebar-collapses-into-an-animated-icon-rail.md +6 -0
- package/dist/agent/engine/index.d.ts +1 -1
- package/dist/agent/engine/index.d.ts.map +1 -1
- package/dist/agent/engine/index.js +1 -1
- package/dist/agent/engine/index.js.map +1 -1
- package/dist/agent/engine/registry.d.ts +9 -0
- package/dist/agent/engine/registry.d.ts.map +1 -1
- package/dist/agent/engine/registry.js +37 -0
- package/dist/agent/engine/registry.js.map +1 -1
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +4 -3
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/application-state/handlers.js +1 -1
- package/dist/application-state/handlers.js.map +1 -1
- package/dist/brand-kit/index.d.ts +1 -1
- package/dist/brand-kit/index.js +1 -1
- package/dist/brand-kit/index.js.map +1 -1
- package/dist/cli/design-connect.d.ts +52 -0
- package/dist/cli/design-connect.d.ts.map +1 -0
- package/dist/cli/design-connect.js +409 -0
- package/dist/cli/design-connect.js.map +1 -0
- package/dist/cli/index.js +15 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/skills.d.ts +3 -0
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +139 -3
- package/dist/cli/skills.js.map +1 -1
- package/dist/client/AgentPanel.js +1 -1
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +38 -8
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +1 -1
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/agent-chat.d.ts +6 -0
- package/dist/client/agent-chat.d.ts.map +1 -1
- package/dist/client/agent-chat.js +17 -3
- package/dist/client/agent-chat.js.map +1 -1
- package/dist/client/blocks/library/MermaidBlock.js +1 -1
- package/dist/client/blocks/library/MermaidBlock.js.map +1 -1
- package/dist/client/blocks/library/diagram.js +1 -1
- package/dist/client/blocks/library/diagram.js.map +1 -1
- package/dist/client/blocks/library/wireframe.js +1 -1
- package/dist/client/blocks/library/wireframe.js.map +1 -1
- package/dist/client/chat/message-components.js +1 -1
- package/dist/client/chat/message-components.js.map +1 -1
- package/dist/client/chat-model-groups.d.ts.map +1 -1
- package/dist/client/chat-model-groups.js +1 -2
- package/dist/client/chat-model-groups.js.map +1 -1
- package/dist/client/components/LiveCursorOverlay.d.ts +1 -2
- package/dist/client/components/LiveCursorOverlay.d.ts.map +1 -1
- package/dist/client/components/LiveCursorOverlay.js +19 -40
- package/dist/client/components/LiveCursorOverlay.js.map +1 -1
- package/dist/client/composer/TiptapComposer.d.ts +3 -1
- package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
- package/dist/client/composer/TiptapComposer.js +86 -24
- package/dist/client/composer/TiptapComposer.js.map +1 -1
- package/dist/client/composer/useVoiceDictation.d.ts +9 -0
- package/dist/client/composer/useVoiceDictation.d.ts.map +1 -1
- package/dist/client/composer/useVoiceDictation.js +154 -32
- package/dist/client/composer/useVoiceDictation.js.map +1 -1
- package/dist/client/extensions/portable-extension.d.ts +1 -1
- package/dist/client/extensions/portable-extension.d.ts.map +1 -1
- package/dist/client/extensions/portable-extension.js.map +1 -1
- package/dist/client/frame-protocol.d.ts +17 -2
- package/dist/client/frame-protocol.d.ts.map +1 -1
- package/dist/client/frame-protocol.js.map +1 -1
- package/dist/client/rich-markdown-editor/RegistryBlockNode.js +2 -2
- package/dist/client/rich-markdown-editor/RegistryBlockNode.js.map +1 -1
- package/dist/client/sharing/ShareButton.d.ts +2 -0
- package/dist/client/sharing/ShareButton.d.ts.map +1 -1
- package/dist/client/sharing/ShareButton.js +7 -6
- package/dist/client/sharing/ShareButton.js.map +1 -1
- package/dist/client/use-agent-engine-configured.d.ts +5 -0
- package/dist/client/use-agent-engine-configured.d.ts.map +1 -1
- package/dist/client/use-agent-engine-configured.js +51 -25
- package/dist/client/use-agent-engine-configured.js.map +1 -1
- package/dist/code-agents/transcript-normalizer.js +1 -1
- package/dist/code-agents/transcript-normalizer.js.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/extensions/path.d.ts +1 -1
- package/dist/extensions/path.d.ts.map +1 -1
- package/dist/extensions/path.js.map +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +2 -2
- package/dist/integrations/a2a-continuation-processor.js +1 -1
- package/dist/integrations/a2a-continuation-processor.js.map +1 -1
- package/dist/mcp/build-server.d.ts +1 -1
- package/dist/mcp/build-server.d.ts.map +1 -1
- package/dist/mcp/build-server.js.map +1 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/routes.d.ts +5 -5
- package/dist/org/handlers.js +5 -5
- package/dist/org/handlers.js.map +1 -1
- package/dist/org/plugin.js +2 -2
- package/dist/org/plugin.js.map +1 -1
- package/dist/scripts/call-agent.js +1 -1
- package/dist/scripts/call-agent.js.map +1 -1
- package/dist/scripts/db/safety.js +1 -1
- package/dist/scripts/db/safety.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +3 -0
- package/dist/server/auth.js.map +1 -1
- package/dist/server/builder-design-systems.d.ts +28 -0
- package/dist/server/builder-design-systems.d.ts.map +1 -0
- package/dist/server/builder-design-systems.js +217 -0
- package/dist/server/builder-design-systems.js.map +1 -0
- package/dist/server/core-routes-plugin.d.ts +1 -0
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +20 -3
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts.map +1 -1
- package/dist/server/transcribe-voice.js +40 -24
- package/dist/server/transcribe-voice.js.map +1 -1
- package/dist/shared/mcp-embed-headers.d.ts +1 -0
- package/dist/shared/mcp-embed-headers.d.ts.map +1 -1
- package/dist/shared/mcp-embed-headers.js +20 -1
- package/dist/shared/mcp-embed-headers.js.map +1 -1
- package/dist/styles/agent-native.css +60 -4
- package/dist/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +10 -0
- package/dist/usage/store.js +2 -2
- package/dist/usage/store.js.map +1 -1
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +2 -0
- package/dist/vite/client.js.map +1 -1
- package/dist/voice/index.d.ts +5 -0
- package/dist/voice/index.d.ts.map +1 -0
- package/dist/voice/index.js +4 -0
- package/dist/voice/index.js.map +1 -0
- package/dist/voice/voice-cleanup-prompt.d.ts +6 -0
- package/dist/voice/voice-cleanup-prompt.d.ts.map +1 -0
- package/dist/voice/voice-cleanup-prompt.js +26 -0
- package/dist/voice/voice-cleanup-prompt.js.map +1 -0
- package/dist/voice/voice-context.d.ts +25 -0
- package/dist/voice/voice-context.d.ts.map +1 -0
- package/dist/voice/voice-context.js +156 -0
- package/dist/voice/voice-context.js.map +1 -0
- package/dist/voice/voice-replacements.d.ts +4 -0
- package/dist/voice/voice-replacements.d.ts.map +1 -0
- package/dist/voice/voice-replacements.js +52 -0
- package/dist/voice/voice-replacements.js.map +1 -0
- package/docs/content/locales/ar-SA/skills-guide.mdx +5 -0
- package/docs/content/locales/ar-SA/template-design.mdx +55 -1
- package/docs/content/locales/de-DE/skills-guide.mdx +5 -0
- package/docs/content/locales/de-DE/template-design.mdx +66 -1
- package/docs/content/locales/es-ES/skills-guide.mdx +5 -0
- package/docs/content/locales/es-ES/template-design.mdx +65 -1
- package/docs/content/locales/fr-FR/skills-guide.mdx +5 -0
- package/docs/content/locales/fr-FR/template-design.mdx +64 -1
- package/docs/content/locales/hi-IN/skills-guide.mdx +5 -0
- package/docs/content/locales/hi-IN/template-design.mdx +59 -1
- package/docs/content/locales/ja-JP/skills-guide.mdx +5 -0
- package/docs/content/locales/ja-JP/template-design.mdx +62 -1
- package/docs/content/locales/ko-KR/skills-guide.mdx +5 -0
- package/docs/content/locales/ko-KR/template-design.mdx +58 -1
- package/docs/content/locales/pt-BR/skills-guide.mdx +5 -0
- package/docs/content/locales/pt-BR/template-design.mdx +62 -1
- package/docs/content/locales/zh-CN/skills-guide.mdx +5 -0
- package/docs/content/locales/zh-CN/template-design.mdx +50 -1
- package/docs/content/locales/zh-TW/skills-guide.mdx +5 -0
- package/docs/content/locales/zh-TW/template-design.mdx +52 -1
- package/docs/content/skills-guide.mdx +5 -0
- package/docs/content/template-design.mdx +59 -1
- package/package.json +2 -1
- package/src/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +10 -0
- package/corpus/templates/design/actions/import-figma-file.ts +0 -166
- package/corpus/templates/design/app/components/design/DesignToolbar.tsx +0 -339
- package/corpus/templates/design/app/components/design/PresentMode.tsx +0 -68
- package/corpus/templates/design/app/components/design/ViewportTabs.tsx +0 -149
- package/corpus/templates/design/app/components/design/ZoomControls.tsx +0 -157
- package/corpus/templates/slides/server/lib/fig-design-system.ts +0 -110
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface BuilderDesignSystemIndexFile {
|
|
2
|
+
name: string;
|
|
3
|
+
data: Uint8Array;
|
|
4
|
+
mimeType?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface BuilderDesignSystemIndexOptions {
|
|
7
|
+
projectName?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
githubRepoUrl?: string;
|
|
10
|
+
connectedProjectId?: string;
|
|
11
|
+
files?: BuilderDesignSystemIndexFile[];
|
|
12
|
+
selection?: Record<string, string[]>;
|
|
13
|
+
devToolsVersion?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface BuilderDesignSystemIndexResult {
|
|
16
|
+
ok: true;
|
|
17
|
+
source: "builder";
|
|
18
|
+
projectId: string;
|
|
19
|
+
jobId: string;
|
|
20
|
+
designSystemId: string;
|
|
21
|
+
suggestedTitle: string | null;
|
|
22
|
+
builderUrl: string;
|
|
23
|
+
status: "in-progress";
|
|
24
|
+
}
|
|
25
|
+
export declare function getBuilderDesignSystemsBaseUrl(): string;
|
|
26
|
+
export declare function builderDesignSystemUrl(designSystemId?: string | null): string;
|
|
27
|
+
export declare function startBuilderDesignSystemIndex(options: BuilderDesignSystemIndexOptions): Promise<BuilderDesignSystemIndexResult>;
|
|
28
|
+
//# sourceMappingURL=builder-design-systems.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder-design-systems.d.ts","sourceRoot":"","sources":["../../src/server/builder-design-systems.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,+BAA+B;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,4BAA4B,EAAE,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACrC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,8BAA8B;IAC7C,EAAE,EAAE,IAAI,CAAC;IACT,MAAM,EAAE,SAAS,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,aAAa,CAAC;CACvB;AAsBD,wBAAgB,8BAA8B,IAAI,MAAM,CAKvD;AAyID,wBAAgB,sBAAsB,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAO7E;AAED,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,+BAA+B,GACvC,OAAO,CAAC,8BAA8B,CAAC,CAmGzC"}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { FeatureNotConfiguredError } from "./credential-provider.js";
|
|
2
|
+
import { getBuilderProxyOrigin, resolveBuilderCredentials, } from "./credential-provider.js";
|
|
3
|
+
const DEFAULT_TIMEOUT_MS = 120_000;
|
|
4
|
+
function trimTrailingSlash(value) {
|
|
5
|
+
return value.replace(/\/+$/, "");
|
|
6
|
+
}
|
|
7
|
+
export function getBuilderDesignSystemsBaseUrl() {
|
|
8
|
+
return (process.env.BUILDER_DESIGN_SYSTEMS_BASE_URL ||
|
|
9
|
+
`${trimTrailingSlash(getBuilderProxyOrigin())}/design-systems/v1`);
|
|
10
|
+
}
|
|
11
|
+
function getBuilderAppHost() {
|
|
12
|
+
return (process.env.BUILDER_APP_HOST ||
|
|
13
|
+
process.env.BUILDER_PUBLIC_APP_HOST ||
|
|
14
|
+
"https://builder.io");
|
|
15
|
+
}
|
|
16
|
+
function makeBuilderDesignSystemUrl(path, credentials) {
|
|
17
|
+
const base = `${trimTrailingSlash(getBuilderDesignSystemsBaseUrl())}/`;
|
|
18
|
+
const url = new URL(path.replace(/^\/+/, ""), base);
|
|
19
|
+
url.searchParams.set("apiKey", credentials.publicKey);
|
|
20
|
+
if (credentials.userId)
|
|
21
|
+
url.searchParams.set("userId", credentials.userId);
|
|
22
|
+
return url;
|
|
23
|
+
}
|
|
24
|
+
function makeBuilderHeaders(credentials) {
|
|
25
|
+
return {
|
|
26
|
+
Authorization: `Bearer ${credentials.privateKey}`,
|
|
27
|
+
"x-builder-api-key": credentials.publicKey,
|
|
28
|
+
...(credentials.userId ? { "x-builder-user-id": credentials.userId } : {}),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
async function resolveBuilderDesignSystemCredentials() {
|
|
32
|
+
const credentials = await resolveBuilderCredentials();
|
|
33
|
+
if (!credentials.privateKey || !credentials.publicKey) {
|
|
34
|
+
throw new FeatureNotConfiguredError({
|
|
35
|
+
requiredCredential: "BUILDER_PRIVATE_KEY",
|
|
36
|
+
message: "Connect Builder.io before indexing a design system from Figma or code.",
|
|
37
|
+
builderConnectUrl: "/_agent-native/builder/connect",
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
privateKey: credentials.privateKey,
|
|
42
|
+
publicKey: credentials.publicKey,
|
|
43
|
+
userId: credentials.userId ?? null,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function mimeTypeForFile(file) {
|
|
47
|
+
if (file.mimeType?.trim())
|
|
48
|
+
return file.mimeType.trim();
|
|
49
|
+
const lower = file.name.toLowerCase();
|
|
50
|
+
if (lower.endsWith(".fig"))
|
|
51
|
+
return "application/octet-stream";
|
|
52
|
+
if (lower.endsWith(".pdf"))
|
|
53
|
+
return "application/pdf";
|
|
54
|
+
if (lower.endsWith(".md") || lower.endsWith(".markdown"))
|
|
55
|
+
return "text/markdown";
|
|
56
|
+
if (lower.endsWith(".json"))
|
|
57
|
+
return "application/json";
|
|
58
|
+
if (lower.endsWith(".css"))
|
|
59
|
+
return "text/css";
|
|
60
|
+
return "text/plain";
|
|
61
|
+
}
|
|
62
|
+
function makeBody(bytes, mimeType) {
|
|
63
|
+
return typeof Blob !== "undefined"
|
|
64
|
+
? new Blob([bytes], { type: mimeType })
|
|
65
|
+
: bytes;
|
|
66
|
+
}
|
|
67
|
+
async function fetchWithTimeout(url, init, timeoutMs = DEFAULT_TIMEOUT_MS) {
|
|
68
|
+
const controller = new AbortController();
|
|
69
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
70
|
+
try {
|
|
71
|
+
return await fetch(url, { ...init, signal: controller.signal });
|
|
72
|
+
}
|
|
73
|
+
finally {
|
|
74
|
+
clearTimeout(timer);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async function parseErrorBody(response) {
|
|
78
|
+
const text = await response.text().catch(() => "");
|
|
79
|
+
if (!text)
|
|
80
|
+
return response.statusText || `HTTP ${response.status}`;
|
|
81
|
+
try {
|
|
82
|
+
const json = JSON.parse(text);
|
|
83
|
+
if (typeof json.error === "string")
|
|
84
|
+
return json.error;
|
|
85
|
+
if (json.error && typeof json.error === "object") {
|
|
86
|
+
return JSON.stringify(json.error).slice(0, 500);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch { }
|
|
90
|
+
return text.replace(/\s+/g, " ").trim().slice(0, 500);
|
|
91
|
+
}
|
|
92
|
+
async function assertOk(response, label) {
|
|
93
|
+
if (response.ok)
|
|
94
|
+
return;
|
|
95
|
+
throw new Error(`${label} (${response.status}): ${await parseErrorBody(response)}`);
|
|
96
|
+
}
|
|
97
|
+
async function uploadToResumableUrl(slot, file) {
|
|
98
|
+
const mimeType = mimeTypeForFile(file);
|
|
99
|
+
const bytes = file.data;
|
|
100
|
+
const start = await fetchWithTimeout(slot.uploadUrl, {
|
|
101
|
+
method: "POST",
|
|
102
|
+
headers: {
|
|
103
|
+
"x-goog-resumable": "start",
|
|
104
|
+
"x-goog-content-length-range": `0,${bytes.byteLength}`,
|
|
105
|
+
"Content-Type": mimeType,
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
await assertOk(start, "Builder design-system upload session failed");
|
|
109
|
+
const sessionUrl = start.headers.get("Location");
|
|
110
|
+
if (!sessionUrl) {
|
|
111
|
+
throw new Error("Builder design-system upload session returned no URL.");
|
|
112
|
+
}
|
|
113
|
+
const response = await fetchWithTimeout(sessionUrl, {
|
|
114
|
+
method: "PUT",
|
|
115
|
+
headers: {
|
|
116
|
+
"Content-Range": `bytes 0-${bytes.byteLength - 1}/${bytes.byteLength}`,
|
|
117
|
+
"Content-Type": mimeType,
|
|
118
|
+
},
|
|
119
|
+
body: makeBody(bytes, mimeType),
|
|
120
|
+
});
|
|
121
|
+
await assertOk(response, "Builder design-system file upload failed");
|
|
122
|
+
}
|
|
123
|
+
function nonEmptyFiles(files) {
|
|
124
|
+
return (files ?? []).filter((file) => file.data.byteLength > 0);
|
|
125
|
+
}
|
|
126
|
+
export function builderDesignSystemUrl(designSystemId) {
|
|
127
|
+
const host = trimTrailingSlash(getBuilderAppHost());
|
|
128
|
+
return designSystemId
|
|
129
|
+
? `${host}/app/design-system-intelligence/${encodeURIComponent(designSystemId)}`
|
|
130
|
+
: `${host}/app/design-system-intelligence`;
|
|
131
|
+
}
|
|
132
|
+
export async function startBuilderDesignSystemIndex(options) {
|
|
133
|
+
const files = nonEmptyFiles(options.files);
|
|
134
|
+
const description = options.description?.trim();
|
|
135
|
+
if (description) {
|
|
136
|
+
files.unshift({
|
|
137
|
+
name: "additional-context.txt",
|
|
138
|
+
data: new TextEncoder().encode(description),
|
|
139
|
+
mimeType: "text/plain",
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
if (files.length === 0 &&
|
|
143
|
+
!options.githubRepoUrl &&
|
|
144
|
+
!options.connectedProjectId) {
|
|
145
|
+
throw new Error("Provide at least one .fig/code/text file or a GitHub repository URL to index with Builder.");
|
|
146
|
+
}
|
|
147
|
+
const credentials = await resolveBuilderDesignSystemCredentials();
|
|
148
|
+
let uploadTokens = [];
|
|
149
|
+
if (files.length > 0) {
|
|
150
|
+
const uploadStart = await fetchWithTimeout(makeBuilderDesignSystemUrl("upload/start", credentials), {
|
|
151
|
+
method: "POST",
|
|
152
|
+
headers: {
|
|
153
|
+
...makeBuilderHeaders(credentials),
|
|
154
|
+
"Content-Type": "application/json",
|
|
155
|
+
},
|
|
156
|
+
body: JSON.stringify({
|
|
157
|
+
attachments: files.map((file) => ({
|
|
158
|
+
name: file.name,
|
|
159
|
+
mimetype: mimeTypeForFile(file),
|
|
160
|
+
declaredSize: file.data.byteLength,
|
|
161
|
+
})),
|
|
162
|
+
}),
|
|
163
|
+
});
|
|
164
|
+
await assertOk(uploadStart, "Builder design-system upload start failed");
|
|
165
|
+
const uploadJson = (await uploadStart.json());
|
|
166
|
+
const slots = [...(uploadJson.uploads ?? [])].sort((a, b) => a.idx - b.idx);
|
|
167
|
+
if (slots.length !== files.length) {
|
|
168
|
+
throw new Error("Builder did not return upload slots for all files.");
|
|
169
|
+
}
|
|
170
|
+
for (let i = 0; i < slots.length; i++) {
|
|
171
|
+
if (slots[i].idx !== i) {
|
|
172
|
+
throw new Error(`Builder upload slot mismatch: expected ${i}.`);
|
|
173
|
+
}
|
|
174
|
+
await uploadToResumableUrl(slots[i], files[i]);
|
|
175
|
+
}
|
|
176
|
+
uploadTokens = slots.map((slot) => slot.uploadToken);
|
|
177
|
+
}
|
|
178
|
+
const generate = await fetchWithTimeout(makeBuilderDesignSystemUrl("generate", credentials), {
|
|
179
|
+
method: "POST",
|
|
180
|
+
headers: {
|
|
181
|
+
...makeBuilderHeaders(credentials),
|
|
182
|
+
"Content-Type": "application/json",
|
|
183
|
+
},
|
|
184
|
+
body: JSON.stringify({
|
|
185
|
+
uploads: uploadTokens,
|
|
186
|
+
...(options.projectName?.trim()
|
|
187
|
+
? { projectName: options.projectName.trim() }
|
|
188
|
+
: {}),
|
|
189
|
+
...(options.githubRepoUrl?.trim()
|
|
190
|
+
? { githubRepoUrl: options.githubRepoUrl.trim() }
|
|
191
|
+
: {}),
|
|
192
|
+
...(options.connectedProjectId?.trim()
|
|
193
|
+
? { connectedProjectId: options.connectedProjectId.trim() }
|
|
194
|
+
: {}),
|
|
195
|
+
...(options.selection ? { selection: options.selection } : {}),
|
|
196
|
+
...(options.devToolsVersion?.trim()
|
|
197
|
+
? { devToolsVersion: options.devToolsVersion.trim() }
|
|
198
|
+
: {}),
|
|
199
|
+
}),
|
|
200
|
+
});
|
|
201
|
+
await assertOk(generate, "Builder design-system indexing failed");
|
|
202
|
+
const generated = (await generate.json());
|
|
203
|
+
if (!generated.projectId || !generated.jobId || !generated.designSystemId) {
|
|
204
|
+
throw new Error("Builder design-system indexing returned an incomplete response.");
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
ok: true,
|
|
208
|
+
source: "builder",
|
|
209
|
+
projectId: generated.projectId,
|
|
210
|
+
jobId: generated.jobId,
|
|
211
|
+
designSystemId: generated.designSystemId,
|
|
212
|
+
suggestedTitle: options.projectName?.trim() || null,
|
|
213
|
+
builderUrl: builderDesignSystemUrl(generated.designSystemId),
|
|
214
|
+
status: "in-progress",
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=builder-design-systems.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder-design-systems.js","sourceRoot":"","sources":["../../src/server/builder-design-systems.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE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,CAAC,eAAe,CAAC,IAAI,EAAE,EAAE;gBACrD,CAAC,CAAC,EAAE,CAAC;SACR,CAAC;KACH,CACF,CAAC;IACF,MAAM,QAAQ,CAAC,QAAQ,EAAE,uCAAuC,CAAC,CAAC;IAClE,MAAM,SAAS,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAqB,CAAC;IAC9D,IAAI,CAAC,SAAS,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,CAAC;QAC1E,MAAM,IAAI,KAAK,CACb,iEAAiE,CAClE,CAAC;IACJ,CAAC;IAED,OAAO;QACL,EAAE,EAAE,IAAI;QACR,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,SAAS,CAAC,SAAS;QAC9B,KAAK,EAAE,SAAS,CAAC,KAAK;QACtB,cAAc,EAAE,SAAS,CAAC,cAAc;QACxC,cAAc,EAAE,OAAO,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,IAAI;QACnD,UAAU,EAAE,sBAAsB,CAAC,SAAS,CAAC,cAAc,CAAC;QAC5D,MAAM,EAAE,aAAa;KACtB,CAAC;AACJ,CAAC","sourcesContent":["import { FeatureNotConfiguredError } from \"./credential-provider.js\";\nimport {\n getBuilderProxyOrigin,\n resolveBuilderCredentials,\n} from \"./credential-provider.js\";\n\nconst DEFAULT_TIMEOUT_MS = 120_000;\n\nexport interface BuilderDesignSystemIndexFile {\n name: string;\n data: Uint8Array;\n mimeType?: string;\n}\n\nexport interface BuilderDesignSystemIndexOptions {\n projectName?: string;\n description?: string;\n githubRepoUrl?: string;\n connectedProjectId?: string;\n files?: BuilderDesignSystemIndexFile[];\n selection?: Record<string, string[]>;\n devToolsVersion?: string;\n}\n\nexport interface BuilderDesignSystemIndexResult {\n ok: true;\n source: \"builder\";\n projectId: string;\n jobId: string;\n designSystemId: string;\n suggestedTitle: string | null;\n builderUrl: string;\n status: \"in-progress\";\n}\n\ninterface BuilderDesignSystemCredentials {\n privateKey: string;\n publicKey: string;\n userId: string | null;\n}\n\ninterface UploadStartResponse {\n uploads?: Array<{ idx: number; uploadUrl: string; uploadToken: string }>;\n}\n\ninterface GenerateResponse {\n projectId?: string;\n jobId?: string;\n designSystemId?: string;\n}\n\nfunction trimTrailingSlash(value: string): string {\n return value.replace(/\\/+$/, \"\");\n}\n\nexport function getBuilderDesignSystemsBaseUrl(): string {\n return (\n process.env.BUILDER_DESIGN_SYSTEMS_BASE_URL ||\n `${trimTrailingSlash(getBuilderProxyOrigin())}/design-systems/v1`\n );\n}\n\nfunction getBuilderAppHost(): string {\n return (\n process.env.BUILDER_APP_HOST ||\n process.env.BUILDER_PUBLIC_APP_HOST ||\n \"https://builder.io\"\n );\n}\n\nfunction makeBuilderDesignSystemUrl(\n path: string,\n credentials: BuilderDesignSystemCredentials,\n): URL {\n const base = `${trimTrailingSlash(getBuilderDesignSystemsBaseUrl())}/`;\n const url = new URL(path.replace(/^\\/+/, \"\"), base);\n url.searchParams.set(\"apiKey\", credentials.publicKey);\n if (credentials.userId) url.searchParams.set(\"userId\", credentials.userId);\n return url;\n}\n\nfunction makeBuilderHeaders(\n credentials: BuilderDesignSystemCredentials,\n): Record<string, string> {\n return {\n Authorization: `Bearer ${credentials.privateKey}`,\n \"x-builder-api-key\": credentials.publicKey,\n ...(credentials.userId ? { \"x-builder-user-id\": credentials.userId } : {}),\n };\n}\n\nasync function resolveBuilderDesignSystemCredentials(): Promise<BuilderDesignSystemCredentials> {\n const credentials = await resolveBuilderCredentials();\n if (!credentials.privateKey || !credentials.publicKey) {\n throw new FeatureNotConfiguredError({\n requiredCredential: \"BUILDER_PRIVATE_KEY\",\n message:\n \"Connect Builder.io before indexing a design system from Figma or code.\",\n builderConnectUrl: \"/_agent-native/builder/connect\",\n });\n }\n return {\n privateKey: credentials.privateKey,\n publicKey: credentials.publicKey,\n userId: credentials.userId ?? null,\n };\n}\n\nfunction mimeTypeForFile(file: BuilderDesignSystemIndexFile): string {\n if (file.mimeType?.trim()) return file.mimeType.trim();\n const lower = file.name.toLowerCase();\n if (lower.endsWith(\".fig\")) return \"application/octet-stream\";\n if (lower.endsWith(\".pdf\")) return \"application/pdf\";\n if (lower.endsWith(\".md\") || lower.endsWith(\".markdown\"))\n return \"text/markdown\";\n if (lower.endsWith(\".json\")) return \"application/json\";\n if (lower.endsWith(\".css\")) return \"text/css\";\n return \"text/plain\";\n}\n\nfunction makeBody(bytes: Uint8Array, mimeType: string): BodyInit {\n return typeof Blob !== \"undefined\"\n ? new Blob([bytes as unknown as BlobPart], { type: mimeType })\n : (bytes as unknown as BodyInit);\n}\n\nasync function fetchWithTimeout(\n url: string | URL,\n init: RequestInit,\n timeoutMs = DEFAULT_TIMEOUT_MS,\n): Promise<Response> {\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), timeoutMs);\n try {\n return await fetch(url, { ...init, signal: controller.signal });\n } finally {\n clearTimeout(timer);\n }\n}\n\nasync function parseErrorBody(response: Response): Promise<string> {\n const text = await response.text().catch(() => \"\");\n if (!text) return response.statusText || `HTTP ${response.status}`;\n try {\n const json = JSON.parse(text) as { error?: unknown };\n if (typeof json.error === \"string\") return json.error;\n if (json.error && typeof json.error === \"object\") {\n return JSON.stringify(json.error).slice(0, 500);\n }\n } catch {}\n return text.replace(/\\s+/g, \" \").trim().slice(0, 500);\n}\n\nasync function assertOk(response: Response, label: string): Promise<void> {\n if (response.ok) return;\n throw new Error(\n `${label} (${response.status}): ${await parseErrorBody(response)}`,\n );\n}\n\nasync function uploadToResumableUrl(\n slot: { uploadUrl: string },\n file: BuilderDesignSystemIndexFile,\n): Promise<void> {\n const mimeType = mimeTypeForFile(file);\n const bytes = file.data;\n const start = await fetchWithTimeout(slot.uploadUrl, {\n method: \"POST\",\n headers: {\n \"x-goog-resumable\": \"start\",\n \"x-goog-content-length-range\": `0,${bytes.byteLength}`,\n \"Content-Type\": mimeType,\n },\n });\n await assertOk(start, \"Builder design-system upload session failed\");\n const sessionUrl = start.headers.get(\"Location\");\n if (!sessionUrl) {\n throw new Error(\"Builder design-system upload session returned no URL.\");\n }\n\n const response = await fetchWithTimeout(sessionUrl, {\n method: \"PUT\",\n headers: {\n \"Content-Range\": `bytes 0-${bytes.byteLength - 1}/${bytes.byteLength}`,\n \"Content-Type\": mimeType,\n },\n body: makeBody(bytes, mimeType),\n });\n await assertOk(response, \"Builder design-system file upload failed\");\n}\n\nfunction nonEmptyFiles(\n files: BuilderDesignSystemIndexFile[] | undefined,\n): BuilderDesignSystemIndexFile[] {\n return (files ?? []).filter((file) => file.data.byteLength > 0);\n}\n\nexport function builderDesignSystemUrl(designSystemId?: string | null): string {\n const host = trimTrailingSlash(getBuilderAppHost());\n return designSystemId\n ? `${host}/app/design-system-intelligence/${encodeURIComponent(\n designSystemId,\n )}`\n : `${host}/app/design-system-intelligence`;\n}\n\nexport async function startBuilderDesignSystemIndex(\n options: BuilderDesignSystemIndexOptions,\n): Promise<BuilderDesignSystemIndexResult> {\n const files = nonEmptyFiles(options.files);\n const description = options.description?.trim();\n if (description) {\n files.unshift({\n name: \"additional-context.txt\",\n data: new TextEncoder().encode(description),\n mimeType: \"text/plain\",\n });\n }\n if (\n files.length === 0 &&\n !options.githubRepoUrl &&\n !options.connectedProjectId\n ) {\n throw new Error(\n \"Provide at least one .fig/code/text file or a GitHub repository URL to index with Builder.\",\n );\n }\n\n const credentials = await resolveBuilderDesignSystemCredentials();\n let uploadTokens: string[] = [];\n if (files.length > 0) {\n const uploadStart = await fetchWithTimeout(\n makeBuilderDesignSystemUrl(\"upload/start\", credentials),\n {\n method: \"POST\",\n headers: {\n ...makeBuilderHeaders(credentials),\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n attachments: files.map((file) => ({\n name: file.name,\n mimetype: mimeTypeForFile(file),\n declaredSize: file.data.byteLength,\n })),\n }),\n },\n );\n await assertOk(uploadStart, \"Builder design-system upload start failed\");\n const uploadJson = (await uploadStart.json()) as UploadStartResponse;\n const slots = [...(uploadJson.uploads ?? [])].sort((a, b) => a.idx - b.idx);\n if (slots.length !== files.length) {\n throw new Error(\"Builder did not return upload slots for all files.\");\n }\n for (let i = 0; i < slots.length; i++) {\n if (slots[i].idx !== i) {\n throw new Error(`Builder upload slot mismatch: expected ${i}.`);\n }\n await uploadToResumableUrl(slots[i], files[i]);\n }\n uploadTokens = slots.map((slot) => slot.uploadToken);\n }\n\n const generate = await fetchWithTimeout(\n makeBuilderDesignSystemUrl(\"generate\", credentials),\n {\n method: \"POST\",\n headers: {\n ...makeBuilderHeaders(credentials),\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n uploads: uploadTokens,\n ...(options.projectName?.trim()\n ? { projectName: options.projectName.trim() }\n : {}),\n ...(options.githubRepoUrl?.trim()\n ? { githubRepoUrl: options.githubRepoUrl.trim() }\n : {}),\n ...(options.connectedProjectId?.trim()\n ? { connectedProjectId: options.connectedProjectId.trim() }\n : {}),\n ...(options.selection ? { selection: options.selection } : {}),\n ...(options.devToolsVersion?.trim()\n ? { devToolsVersion: options.devToolsVersion.trim() }\n : {}),\n }),\n },\n );\n await assertOk(generate, \"Builder design-system indexing failed\");\n const generated = (await generate.json()) as GenerateResponse;\n if (!generated.projectId || !generated.jobId || !generated.designSystemId) {\n throw new Error(\n \"Builder design-system indexing returned an incomplete response.\",\n );\n }\n\n return {\n ok: true,\n source: \"builder\",\n projectId: generated.projectId,\n jobId: generated.jobId,\n designSystemId: generated.designSystemId,\n suggestedTitle: options.projectName?.trim() || null,\n builderUrl: builderDesignSystemUrl(generated.designSystemId),\n status: \"in-progress\",\n };\n}\n"]}
|
|
@@ -39,6 +39,7 @@ interface BuilderWaitlistFormTarget {
|
|
|
39
39
|
export declare function resolveFrameworkSseRoutes(sseRoute?: string): string[];
|
|
40
40
|
export declare function resolveBuilderWaitlistFormTargetForRequest(event: H3Event): BuilderWaitlistFormTarget | null;
|
|
41
41
|
export declare const AVATAR_RASTER_MIME: RegExp;
|
|
42
|
+
export declare function resolveAvatarEmailParam(pathname: string, appBasePath?: string): string;
|
|
42
43
|
type BuilderAnonymousOwnerResolver = (event: H3Event) => string | null | Promise<string | null>;
|
|
43
44
|
export type BuilderOwnerContext = {
|
|
44
45
|
email: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-routes-plugin.d.ts","sourceRoot":"","sources":["../../src/server/core-routes-plugin.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAmFlC,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AA+BzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAmCvD;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,mBAAmB,CAAC;AACvD,eAAO,MAAM,sBAAsB,0BAAqC,CAAC;AACzE,eAAO,MAAM,6BAA6B,+BAA0C,CAAC;AAErF,wBAAgB,mBAAmB,IAAI,YAAY,EAAE,CA+BpD;AAED,wEAAwE;AACxE,MAAM,WAAW,mBAAmB;IAClC,8DAA8D;IAC9D,EAAE,EAAE,IAAI,CAAC;IACT,gFAAgF;IAChF,EAAE,EAAE,OAAO,CAAC;IACZ,oDAAoD;IACpD,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,GAAE,MAAM;IAAE,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAAc,GACrE,OAAO,CAAC,mBAAmB,CAAC,CAU9B;AAOD,UAAU,yBAAyB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB;AAUD,wBAAgB,yBAAyB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAQrE;AA+BD,wBAAgB,0CAA0C,CACxD,KAAK,EAAE,OAAO,GACb,yBAAyB,GAAG,IAAI,CAsBlC;AAk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,OAAO,CAAC;IAC5B;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,sEAAsE;IACtE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qEAAqE;IACrE,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oDAAoD;IACpD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;wCACoC;IACpC,eAAe,CAAC,EAAE,OAAO,iBAAiB,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;IAChF,qEAAqE;IACrE,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB;;;;OAIG;IACH,cAAc,CAAC,EAAE,6BAA6B,CAAC;CAChD;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,GAAE,uBAA4B,GACpC,cAAc,CAwhFhB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,EAAE,cAAyC,CAAC"}
|
|
@@ -210,6 +210,25 @@ function parseBuilderCallbackBoolean(value) {
|
|
|
210
210
|
// attributes that execute when the browser renders them as an <img> src or
|
|
211
211
|
// inlines them in the DOM. Mirrors SAFE_DATA_IMAGE in sanitize-html.ts.
|
|
212
212
|
export const AVATAR_RASTER_MIME = /^data:image\/(png|jpe?g|gif|webp);/i;
|
|
213
|
+
export function resolveAvatarEmailParam(pathname, appBasePath = "") {
|
|
214
|
+
const base = appBasePath.replace(/\/+$/, "");
|
|
215
|
+
const avatarPaths = Array.from(new Set([`${base}/_agent-native/avatar/`, "/_agent-native/avatar/"]));
|
|
216
|
+
for (const avatarPath of avatarPaths) {
|
|
217
|
+
const avatarIndex = pathname.indexOf(avatarPath);
|
|
218
|
+
if (avatarIndex >= 0) {
|
|
219
|
+
return pathname
|
|
220
|
+
.slice(avatarIndex + avatarPath.length)
|
|
221
|
+
.replace(/^\/+/, "")
|
|
222
|
+
.split("/")[0];
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
const firstSegment = pathname.replace(/^\/+/, "").split("/")[0] ?? "";
|
|
226
|
+
if (!firstSegment || firstSegment === "_agent-native")
|
|
227
|
+
return "";
|
|
228
|
+
if (base && firstSegment === base.replace(/^\/+/, ""))
|
|
229
|
+
return "";
|
|
230
|
+
return firstSegment;
|
|
231
|
+
}
|
|
213
232
|
async function detectUsageEngineName(event, userEmail) {
|
|
214
233
|
try {
|
|
215
234
|
const stored = (await getSetting("agent-engine"));
|
|
@@ -2193,9 +2212,7 @@ export function createCoreRoutesPlugin(options = {}) {
|
|
|
2193
2212
|
// packages/core/src/client/blocks/library/sanitize-html.ts.
|
|
2194
2213
|
getH3App(nitroApp).use(`${P}/avatar`, defineEventHandler(async (event) => {
|
|
2195
2214
|
const method = getMethod(event);
|
|
2196
|
-
const emailParam = (event.url?.pathname || "")
|
|
2197
|
-
.replace(/^\/+/, "")
|
|
2198
|
-
.split("/")[0];
|
|
2215
|
+
const emailParam = resolveAvatarEmailParam(event.url?.pathname || "", getConfiguredAppBasePath());
|
|
2199
2216
|
if (method === "GET") {
|
|
2200
2217
|
if (!emailParam) {
|
|
2201
2218
|
setResponseStatus(event, 400);
|