@agent-native/core 0.82.0 → 0.84.0
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/README.md +2 -2
- package/corpus/README.md +1 -1
- package/corpus/core/CHANGELOG.md +34 -0
- package/corpus/core/README.md +2 -2
- package/corpus/core/docs/content/cloneable-saas.mdx +2 -2
- package/corpus/core/docs/content/faq.mdx +1 -1
- package/corpus/core/docs/content/locales/ar-SA/cloneable-saas.mdx +2 -2
- package/corpus/core/docs/content/locales/ar-SA/faq.mdx +1 -1
- package/corpus/core/docs/content/locales/ar-SA/template-chat.mdx +1 -1
- package/corpus/core/docs/content/locales/de-DE/cloneable-saas.mdx +2 -2
- package/corpus/core/docs/content/locales/de-DE/faq.mdx +1 -1
- package/corpus/core/docs/content/locales/de-DE/template-chat.mdx +1 -1
- package/corpus/core/docs/content/locales/es-ES/cloneable-saas.mdx +2 -2
- package/corpus/core/docs/content/locales/es-ES/faq.mdx +1 -1
- package/corpus/core/docs/content/locales/es-ES/template-chat.mdx +1 -1
- package/corpus/core/docs/content/locales/fr-FR/cloneable-saas.mdx +2 -2
- package/corpus/core/docs/content/locales/fr-FR/faq.mdx +1 -1
- package/corpus/core/docs/content/locales/fr-FR/template-chat.mdx +1 -1
- package/corpus/core/docs/content/locales/hi-IN/cloneable-saas.mdx +2 -2
- package/corpus/core/docs/content/locales/hi-IN/faq.mdx +1 -1
- package/corpus/core/docs/content/locales/hi-IN/template-chat.mdx +1 -1
- package/corpus/core/docs/content/locales/ja-JP/cloneable-saas.mdx +2 -2
- package/corpus/core/docs/content/locales/ja-JP/faq.mdx +1 -1
- package/corpus/core/docs/content/locales/ja-JP/template-chat.mdx +1 -1
- package/corpus/core/docs/content/locales/ko-KR/cloneable-saas.mdx +2 -2
- package/corpus/core/docs/content/locales/ko-KR/faq.mdx +1 -1
- package/corpus/core/docs/content/locales/ko-KR/template-chat.mdx +1 -1
- package/corpus/core/docs/content/locales/pt-BR/cloneable-saas.mdx +2 -2
- package/corpus/core/docs/content/locales/pt-BR/faq.mdx +1 -1
- package/corpus/core/docs/content/locales/pt-BR/template-chat.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-CN/cloneable-saas.mdx +2 -2
- package/corpus/core/docs/content/locales/zh-CN/faq.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-CN/template-chat.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-TW/cloneable-saas.mdx +2 -2
- package/corpus/core/docs/content/locales/zh-TW/faq.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-TW/template-chat.mdx +1 -1
- package/corpus/core/docs/content/template-chat.mdx +1 -1
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/agent/engine/builtin.ts +1 -1
- package/corpus/core/src/agent/engine/output-tokens.ts +1 -1
- package/corpus/core/src/agent/harness/acp-adapter.ts +28 -4
- package/corpus/core/src/agent/harness/ai-sdk-adapter.ts +3 -0
- package/corpus/core/src/agent/harness/translate.ts +3 -0
- package/corpus/core/src/agent/harness/types.ts +1 -0
- package/corpus/core/src/agent/model-config.ts +34 -13
- package/corpus/core/src/agent/production-agent.ts +87 -10
- package/corpus/core/src/agent/thread-data-builder.ts +29 -4
- package/corpus/core/src/agent/tool-call-journal.ts +109 -48
- package/corpus/core/src/agent/types.ts +6 -1
- package/corpus/core/src/cli/design-connect.ts +106 -0
- package/corpus/core/src/cli/gateway-helpers.ts +17 -0
- package/corpus/core/src/cli/recap.ts +0 -2
- package/corpus/core/src/cli/skills.ts +54 -16
- package/corpus/core/src/cli/workspace-dev.ts +29 -5
- package/corpus/core/src/client/AssistantChat.tsx +89 -42
- package/corpus/core/src/client/CommandMenu.tsx +34 -12
- package/corpus/core/src/client/DefaultSpinner.tsx +8 -1
- package/corpus/core/src/client/chat/message-components.tsx +49 -1
- package/corpus/core/src/client/chat/repo-helpers.ts +71 -0
- package/corpus/core/src/client/chat/run-recovery.tsx +15 -5
- package/corpus/core/src/client/components/ApiKeySettings.tsx +8 -8
- package/corpus/core/src/client/components/CodeRequiredDialog.tsx +26 -15
- package/corpus/core/src/client/components/MissingKeyCard.tsx +13 -6
- package/corpus/core/src/client/composer/TiptapComposer.tsx +4 -3
- package/corpus/core/src/client/extensions/ExtensionsSidebarSection.tsx +0 -1
- package/corpus/core/src/client/guided-questions.tsx +21 -27
- package/corpus/core/src/client/integrations/IntegrationCard.tsx +1 -1
- package/corpus/core/src/client/integrations/IntegrationsPanel.tsx +1 -1
- package/corpus/core/src/client/onboarding/OnboardingBanner.tsx +2 -2
- package/corpus/core/src/client/onboarding/OnboardingPanel.tsx +23 -19
- package/corpus/core/src/client/resources/ResourceEditor.tsx +18 -10
- package/corpus/core/src/client/resources/ResourcesPanel.tsx +5 -1
- package/corpus/core/src/client/settings/SettingsPanel.tsx +8 -3
- package/corpus/core/src/client/settings/useBuilderStatus.ts +8 -41
- package/corpus/core/src/client/useProductionAgent.ts +6 -2
- package/corpus/core/src/deploy/build.ts +1 -1
- package/corpus/core/src/observability/traces.ts +3 -3
- package/corpus/core/src/onboarding/default-steps.ts +1 -1
- package/corpus/core/src/scripts/agent-engines/manage-agent-engine.ts +1 -1
- package/corpus/core/src/scripts/agent-engines/set-agent-engine.ts +1 -1
- package/corpus/core/src/server/agent-chat-plugin.ts +177 -81
- package/corpus/core/src/server/core-routes-plugin.ts +7 -1
- package/corpus/core/src/server/open-route.ts +59 -40
- package/corpus/core/src/shared/reasoning-effort.ts +2 -0
- package/corpus/core/src/sharing/access.ts +22 -2
- package/corpus/core/src/sharing/registry.ts +18 -0
- package/corpus/core/src/styles/agent-native.css +104 -20
- package/corpus/core/src/styles/rich-markdown-editor.css +11 -10
- package/corpus/templates/analytics/actions/hubspot-deals.ts +64 -4
- package/corpus/templates/analytics/app/components/dashboard/CumulativeNetChart.tsx +10 -10
- package/corpus/templates/analytics/app/components/dashboard/RevenueChart.tsx +10 -10
- package/corpus/templates/analytics/app/components/dashboard/RevenueComparisonChart.tsx +6 -5
- package/corpus/templates/analytics/app/components/dashboard/TimeSeriesChart.tsx +9 -9
- package/corpus/templates/analytics/app/global.css +4 -0
- package/corpus/templates/analytics/app/lib/chart-theme.ts +13 -0
- package/corpus/templates/analytics/app/pages/adhoc/_shared/KpiChart.tsx +22 -24
- package/corpus/templates/analytics/changelog/2026-06-30-dashboard-charts-now-use-theme-aware-tooltip-and-grid-colors.md +6 -0
- package/corpus/templates/analytics/changelog/2026-06-30-fixed-ask-composer-spacing-so-the-chat-field-has-a-comfortab.md +6 -0
- package/corpus/templates/calendar/AGENTS.md +4 -0
- package/corpus/templates/calendar/actions/connect-google-calendar.ts +80 -0
- package/corpus/templates/calendar/changelog/2026-06-30-calendar-now-gives-the-agent-a-safe-google-connection-link-i.md +6 -0
- package/corpus/templates/calendar/server/plugins/agent-chat.ts +4 -0
- package/corpus/templates/content/.env.local.example +6 -0
- package/corpus/templates/content/AGENTS.md +10 -1
- package/corpus/templates/content/actions/_builder-cms-read-client.ts +14 -1
- package/corpus/templates/content/actions/_builder-cms-source-adapter.ts +43 -0
- package/corpus/templates/content/actions/_builder-cms-write-adapter.ts +79 -7
- package/corpus/templates/content/actions/_database-source-utils.ts +987 -22
- package/corpus/templates/content/actions/_database-utils.ts +41 -0
- package/corpus/templates/content/actions/_local-file-documents.ts +74 -1
- package/corpus/templates/content/actions/attach-content-database-source.ts +33 -8
- package/corpus/templates/content/actions/change-content-database-source-role.ts +14 -0
- package/corpus/templates/content/actions/disconnect-content-database-source.ts +3 -0
- package/corpus/templates/content/actions/execute-builder-source-execution.ts +71 -3
- package/corpus/templates/content/actions/list-content-databases.ts +41 -33
- package/corpus/templates/content/actions/process-builder-body-hydration.ts +47 -0
- package/corpus/templates/content/actions/update-document.ts +93 -0
- package/corpus/templates/content/app/blocks/SourceComponentBlock.tsx +277 -0
- package/corpus/templates/content/app/blocks/contentBlockRegistry.tsx +2 -0
- package/corpus/templates/content/app/components/editor/BubbleToolbar.tsx +5 -5
- package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +45 -4
- package/corpus/templates/content/app/components/editor/VisualEditor.tsx +5 -1
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +92 -0
- package/corpus/templates/content/app/components/editor/database-sources/BuilderSourceReviewDialog.tsx +5 -3
- package/corpus/templates/content/app/components/editor/extensions/registryBlocks.ts +41 -0
- package/corpus/templates/content/app/components/editor/registrySlashItems.ts +4 -0
- package/corpus/templates/content/app/global.css +16 -8
- package/corpus/templates/content/app/hooks/use-content-database.ts +24 -0
- package/corpus/templates/content/app/i18n/zh-TW.ts +24 -0
- package/corpus/templates/content/app/i18n-data.ts +212 -0
- package/corpus/templates/content/app/lib/content-command-search.ts +64 -0
- package/corpus/templates/content/app/root.tsx +236 -8
- package/corpus/templates/content/changelog/2026-06-29-builder-cms-sources-now-sync-article-bodies-through-content.md +6 -0
- package/corpus/templates/content/changelog/2026-06-30-builder-article-media-now-render-as-images-and-embeds-when-r.md +6 -0
- package/corpus/templates/content/changelog/2026-06-30-builder-source-components-now-render-as-preserved-preview-bl.md +6 -0
- package/corpus/templates/content/changelog/2026-06-30-cmd-k-search-now-opens-from-the-editor-and-finds-real-content.md +6 -0
- package/corpus/templates/content/changelog/2026-06-30-editor-floating-toolbars-now-use-theme-aware-colors-in-light.md +6 -0
- package/corpus/templates/content/package.json +3 -1
- package/corpus/templates/content/scripts/check-native-deps.mjs +57 -0
- package/corpus/templates/content/scripts/dev-database.mjs +83 -0
- package/corpus/templates/content/scripts/seed-demo-user.mjs +107 -0
- package/corpus/templates/content/server/db/schema.ts +27 -0
- package/corpus/templates/content/server/plugins/db.ts +33 -0
- package/corpus/templates/content/shared/api.ts +45 -0
- package/corpus/templates/content/shared/builder-mdx.ts +905 -5
- package/corpus/templates/content/shared/nfm-registry.ts +2 -0
- package/corpus/templates/content/shared/source-component-block.ts +141 -0
- package/corpus/templates/design/.agents/skills/visual-edit/SKILL.md +6 -1
- package/corpus/templates/design/actions/add-localhost-screens.ts +63 -8
- package/corpus/templates/design/actions/apply-motion-edit.ts +12 -46
- package/corpus/templates/design/actions/list-design-native-assets.ts +2 -1
- package/corpus/templates/design/actions/migrate-board-objects-to-file.ts +49 -1
- package/corpus/templates/design/actions/navigate.ts +3 -12
- package/corpus/templates/design/actions/open-visual-edit.ts +341 -0
- package/corpus/templates/design/actions/view-screen.ts +1 -1
- package/corpus/templates/design/app/components/design/CanvasContextMenu.tsx +1 -1
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +350 -15
- package/corpus/templates/design/app/components/design/DesignEditorSkeleton.tsx +71 -91
- package/corpus/templates/design/app/components/design/DesignExtensionsPanel.tsx +25 -27
- package/corpus/templates/design/app/components/design/DeviceFrame.tsx +1 -1
- package/corpus/templates/design/app/components/design/DrawOverlay.tsx +2 -2
- package/corpus/templates/design/app/components/design/EditPanel.tsx +1111 -570
- package/corpus/templates/design/app/components/design/LayersPanel.tsx +162 -32
- package/corpus/templates/design/app/components/design/MotionDock.tsx +268 -240
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +1193 -207
- package/corpus/templates/design/app/components/design/QuestionFlow.tsx +1 -1
- package/corpus/templates/design/app/components/design/ReviewPanel.tsx +81 -102
- package/corpus/templates/design/app/components/design/StatesPanel.tsx +6 -6
- package/corpus/templates/design/app/components/design/TokensPanel.tsx +11 -11
- package/corpus/templates/design/app/components/design/TweaksPanel.tsx +9 -7
- package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +1225 -154
- package/corpus/templates/design/app/components/design/bridge/hit-test.bridge.ts +130 -37
- package/corpus/templates/design/app/components/design/canvas-primitive-style.ts +24 -11
- package/corpus/templates/design/app/components/design/inspector/AutoLayoutMatrix.tsx +184 -162
- package/corpus/templates/design/app/components/design/inspector/ConstraintsWidget.tsx +137 -79
- package/corpus/templates/design/app/components/design/inspector/DesignColorPicker.tsx +13 -13
- package/corpus/templates/design/app/components/design/inspector/ExportSettingsPanel.tsx +8 -8
- package/corpus/templates/design/app/components/design/inspector/GradientEditor.tsx +2 -2
- package/corpus/templates/design/app/components/design/inspector/ImageFillControls.tsx +4 -4
- package/corpus/templates/design/app/components/design/inspector/InspectorAiActions.tsx +3 -3
- package/corpus/templates/design/app/components/design/inspector/ScrubInput.tsx +13 -7
- package/corpus/templates/design/app/components/design/inspector/ShaderControls.tsx +14 -11
- package/corpus/templates/design/app/components/design/inspector/ShaderFillsPanel.tsx +4 -4
- package/corpus/templates/design/app/components/design/inspector/index.ts +2 -0
- package/corpus/templates/design/app/components/design/types.ts +19 -0
- package/corpus/templates/design/app/components/editor/PromptDialog.tsx +61 -78
- package/corpus/templates/design/app/components/layout/Header.tsx +0 -1
- package/corpus/templates/design/app/components/layout/Layout.tsx +3 -2
- package/corpus/templates/design/app/components/layout/Sidebar.tsx +0 -2
- package/corpus/templates/design/app/components/visual-editor/CanvasCommentPins.tsx +5 -4
- package/corpus/templates/design/app/components/visual-editor/DrawOverlay.tsx +1 -1
- package/corpus/templates/design/app/components/visual-editor/SaveStatusIndicator.tsx +2 -2
- package/corpus/templates/design/app/global.css +56 -0
- package/corpus/templates/design/app/hooks/use-agent-generating.ts +4 -5
- package/corpus/templates/design/app/hooks/use-navigation-state.ts +6 -7
- package/corpus/templates/design/app/hooks/use-question-flow.ts +3 -2
- package/corpus/templates/design/app/hooks/useAgentEditRequest.ts +6 -4
- package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +6 -3
- package/corpus/templates/design/app/i18n/zh-TW.ts +5 -14
- package/corpus/templates/design/app/i18n-data.ts +63 -188
- package/corpus/templates/design/app/lib/agent-chat.ts +13 -0
- package/corpus/templates/design/app/pages/DesignEditor.tsx +1755 -401
- package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +9 -5
- package/corpus/templates/design/app/pages/DesignSystems.tsx +2 -2
- package/corpus/templates/design/app/pages/Index.tsx +49 -26
- package/corpus/templates/design/app/pages/NotFound.tsx +25 -8
- package/corpus/templates/design/app/pages/VisualEdit.tsx +17 -5
- package/corpus/templates/design/app/routes/examples.tsx +1 -7
- package/corpus/templates/design/app/routes/templates.tsx +7 -4
- package/corpus/templates/design/changelog/2026-06-30-board-shapes-and-auto-layout-controls-are-clearer.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-canvas-editing-now-keeps-undo-redo-and-cross-screen-layer-mo.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-component-selections-now-use-purple-component-chrome-and-sho.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-constraints-now-stay-tucked-into-a-compact-inspector-preview.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-creating-a-component-now-opens-in-a-compact-inspector-popove.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-design-cards-no-longer-show-legacy-project-type-badges.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-design-chat-now-keeps-new-turns-in-the-visible-design-agent-.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-design-editor-panels-now-keep-their-compact-text-sizing-cons.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-design-no-longer-shows-the-connected-local-code-warning-bann.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-design-now-opens-to-the-files-panel-unless-a-generation-is-a.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-design-opens-with-a-cleaner-empty-canvas-and-loading-preview.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-design-tools-use-simpler-less-decorative-icons.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-dragging-absolute-elements-no-longer-shows-coordinate-labels.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-fixed-all-screens-opening-too-zoomed-in-by-default.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-fixed-the-public-design-assets-sidebar-so-native-components-.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-fixed-the-screen-overview-board-so-empty-board-space-no-long.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-full-view-screens-can-now-scroll-while-remaining-editable.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-inspector-element-headers-show-the-selected-html-tag-and-the.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-inspector-inputs-stay-compact-across-desktop-breakpoints.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-layers-can-be-multi-selected-from-the-canvas-and-edited-toge.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-local-visual-edit-links-can-edit-localhost-frames-without-si.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-localhost-visual-edit-frames-can-now-be-selected-and-edited.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-marquee-selection-now-works-inside-screens-multi-selected-la.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-motion-is-now-available-from-the-persistent-left-rail-and-th.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-motion-timeline-collapse-and-reopen-animations-feel-smoother.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-multi-select-outlines-now-stay-consistent-across-all-screens.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-new-board-shapes-now-start-with-neutral-gray-styling.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-new-designs-open-into-a-steadier-loading-state-before-the-ed.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-new-designs-show-a-loading-state-during-handoff-and-keep-edi.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-public-visual-edit-design-links-now-open-directly-instead-of.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-removed-the-confusing-states-section-from-the-design-editor-.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-removed-the-templates-gallery-from-design-navigation.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-share-stays-visible-as-soon-as-editable-designs-load.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-signed-out-save-and-share-controls-use-simpler-labels-and-op.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-text-added-on-the-canvas-now-focuses-cleanly-with-the-right-.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-the-design-editor-loading-skeleton-is-simpler-and-its-bottom.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-the-design-editor-loading-skeleton-now-follows-the-current-t.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-the-design-inspector-no-longer-shows-child-layout-controls-o.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-the-design-inspector-no-longer-shows-the-ask-ai-section-abov.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-the-design-review-panel-no-longer-shows-a-separate-inline-au.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-the-empty-designs-page-now-focuses-on-a-single-primary-new-d.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-the-layers-panel-header-stays-as-layers-while-multiple-items.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-the-missing-design-screen-now-uses-a-neutral-back-button.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-the-motion-timeline-now-closes-without-squeezing-the-canvas-.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-the-new-design-connect-ai-setup-now-lines-up-with-the-compos.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-the-screen-overview-board-now-blends-into-the-canvas-and-new.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-top-level-canvas-drops-now-show-screen-guides.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-top-level-canvas-layers-now-keep-a-transparent-backdrop-and-.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-top-level-canvas-layers-now-select-reliably-from-all-screens.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-visual-edit-can-open-and-refresh-localhost-screens-in-one-au.md +6 -0
- package/corpus/templates/design/e2e/helpers.ts +15 -4
- package/corpus/templates/design/server/db/index.ts +52 -0
- package/corpus/templates/design/server/plugins/agent-chat.ts +5 -0
- package/corpus/templates/design/server/plugins/auth.ts +1 -0
- package/corpus/templates/design/server/plugins/core-routes.ts +4 -0
- package/corpus/templates/design/shared/board-file.ts +380 -5
- package/corpus/templates/design/shared/board-objects.ts +2 -2
- package/corpus/templates/design/shared/code-layer.ts +50 -6
- package/corpus/templates/design/shared/motion-compiler.ts +27 -0
- package/corpus/templates/macros/app/components/DailyProgress.tsx +41 -37
- package/corpus/templates/macros/app/components/ExerciseCard.tsx +2 -2
- package/corpus/templates/macros/app/components/MealCard.tsx +2 -2
- package/corpus/templates/macros/app/components/VoiceDictation.tsx +1 -1
- package/corpus/templates/macros/app/components/WeeklyCaloriesChart.tsx +1 -1
- package/corpus/templates/macros/app/components/WeightCard.tsx +2 -2
- package/corpus/templates/macros/app/components/WeightTracker.tsx +1 -1
- package/corpus/templates/macros/app/components/layout/AppLayout.tsx +1 -1
- package/corpus/templates/macros/app/routes/_index.tsx +5 -5
- package/corpus/templates/macros/app/routes/analytics.tsx +1 -1
- package/corpus/templates/macros/changelog/2026-06-30-dashboard-loading-and-chart-surfaces-now-use-theme-aware-col.md +6 -0
- package/corpus/templates/mail/app/components/email/ComposeBubbleToolbar.tsx +14 -11
- package/corpus/templates/mail/app/global.css +3 -2
- package/corpus/templates/mail/changelog/2026-06-30-compose-floating-toolbars-now-use-theme-aware-colors-in-ligh.md +6 -0
- package/corpus/templates/plan/app/pages/PlansPage.tsx +2 -2
- package/corpus/templates/slides/app/components/deck/DeckCard.tsx +3 -3
- package/corpus/templates/slides/app/global.css +10 -0
- package/corpus/templates/slides/app/pages/Index.tsx +55 -51
- package/corpus/templates/slides/changelog/2026-06-30-deck-thumbnails-collapse-cleanly-to-one-column-when-the-chat.md +6 -0
- package/dist/agent/engine/anthropic-engine.d.ts +2 -2
- package/dist/agent/engine/anthropic-engine.d.ts.map +1 -1
- package/dist/agent/engine/builder-engine.d.ts +2 -2
- package/dist/agent/engine/builder-engine.d.ts.map +1 -1
- package/dist/agent/engine/builtin.js +1 -1
- package/dist/agent/engine/builtin.js.map +1 -1
- package/dist/agent/engine/output-tokens.js +1 -1
- package/dist/agent/engine/output-tokens.js.map +1 -1
- package/dist/agent/harness/acp-adapter.d.ts +4 -1
- package/dist/agent/harness/acp-adapter.d.ts.map +1 -1
- package/dist/agent/harness/acp-adapter.js +19 -2
- package/dist/agent/harness/acp-adapter.js.map +1 -1
- package/dist/agent/harness/ai-sdk-adapter.d.ts.map +1 -1
- package/dist/agent/harness/ai-sdk-adapter.js +3 -0
- package/dist/agent/harness/ai-sdk-adapter.js.map +1 -1
- package/dist/agent/harness/translate.d.ts.map +1 -1
- package/dist/agent/harness/translate.js +3 -0
- package/dist/agent/harness/translate.js.map +1 -1
- package/dist/agent/harness/types.d.ts +1 -0
- package/dist/agent/harness/types.d.ts.map +1 -1
- package/dist/agent/harness/types.js.map +1 -1
- package/dist/agent/model-config.d.ts +21 -20
- package/dist/agent/model-config.d.ts.map +1 -1
- package/dist/agent/model-config.js +31 -13
- package/dist/agent/model-config.js.map +1 -1
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +85 -10
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/thread-data-builder.d.ts.map +1 -1
- package/dist/agent/thread-data-builder.js +27 -6
- package/dist/agent/thread-data-builder.js.map +1 -1
- package/dist/agent/tool-call-journal.d.ts +11 -9
- package/dist/agent/tool-call-journal.d.ts.map +1 -1
- package/dist/agent/tool-call-journal.js +92 -40
- package/dist/agent/tool-call-journal.js.map +1 -1
- package/dist/agent/types.d.ts +5 -1
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/cli/design-connect.d.ts.map +1 -1
- package/dist/cli/design-connect.js +84 -0
- package/dist/cli/design-connect.js.map +1 -1
- package/dist/cli/gateway-helpers.d.ts +4 -0
- package/dist/cli/gateway-helpers.d.ts.map +1 -1
- package/dist/cli/gateway-helpers.js +9 -0
- package/dist/cli/gateway-helpers.js.map +1 -1
- package/dist/cli/recap.d.ts.map +1 -1
- package/dist/cli/recap.js +0 -2
- package/dist/cli/recap.js.map +1 -1
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +54 -16
- package/dist/cli/skills.js.map +1 -1
- package/dist/cli/workspace-dev.d.ts.map +1 -1
- package/dist/cli/workspace-dev.js +33 -6
- package/dist/cli/workspace-dev.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +72 -26
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/CommandMenu.d.ts +6 -2
- package/dist/client/CommandMenu.d.ts.map +1 -1
- package/dist/client/CommandMenu.js +25 -14
- package/dist/client/CommandMenu.js.map +1 -1
- package/dist/client/DefaultSpinner.d.ts.map +1 -1
- package/dist/client/DefaultSpinner.js +8 -1
- package/dist/client/DefaultSpinner.js.map +1 -1
- package/dist/client/chat/message-components.d.ts +7 -1
- package/dist/client/chat/message-components.d.ts.map +1 -1
- package/dist/client/chat/message-components.js +37 -1
- package/dist/client/chat/message-components.js.map +1 -1
- package/dist/client/chat/repo-helpers.d.ts +1 -0
- package/dist/client/chat/repo-helpers.d.ts.map +1 -1
- package/dist/client/chat/repo-helpers.js +59 -0
- package/dist/client/chat/repo-helpers.js.map +1 -1
- package/dist/client/chat/run-recovery.d.ts.map +1 -1
- package/dist/client/chat/run-recovery.js +4 -4
- package/dist/client/chat/run-recovery.js.map +1 -1
- package/dist/client/components/ApiKeySettings.js +8 -8
- package/dist/client/components/ApiKeySettings.js.map +1 -1
- package/dist/client/components/CodeRequiredDialog.d.ts.map +1 -1
- package/dist/client/components/CodeRequiredDialog.js +24 -15
- package/dist/client/components/CodeRequiredDialog.js.map +1 -1
- package/dist/client/components/MissingKeyCard.d.ts.map +1 -1
- package/dist/client/components/MissingKeyCard.js +11 -6
- package/dist/client/components/MissingKeyCard.js.map +1 -1
- package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
- package/dist/client/composer/TiptapComposer.js +4 -3
- package/dist/client/composer/TiptapComposer.js.map +1 -1
- package/dist/client/extensions/ExtensionsSidebarSection.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionsSidebarSection.js +1 -1
- package/dist/client/extensions/ExtensionsSidebarSection.js.map +1 -1
- package/dist/client/guided-questions.d.ts.map +1 -1
- package/dist/client/guided-questions.js +6 -6
- package/dist/client/guided-questions.js.map +1 -1
- package/dist/client/integrations/IntegrationCard.js +1 -1
- package/dist/client/integrations/IntegrationCard.js.map +1 -1
- package/dist/client/integrations/IntegrationsPanel.js +1 -1
- package/dist/client/integrations/IntegrationsPanel.js.map +1 -1
- package/dist/client/onboarding/OnboardingBanner.js +2 -2
- package/dist/client/onboarding/OnboardingBanner.js.map +1 -1
- package/dist/client/onboarding/OnboardingPanel.js +23 -19
- package/dist/client/onboarding/OnboardingPanel.js.map +1 -1
- package/dist/client/resources/ResourceEditor.d.ts.map +1 -1
- package/dist/client/resources/ResourceEditor.js +13 -10
- package/dist/client/resources/ResourceEditor.js.map +1 -1
- package/dist/client/resources/ResourcesPanel.d.ts.map +1 -1
- package/dist/client/resources/ResourcesPanel.js +2 -1
- package/dist/client/resources/ResourcesPanel.js.map +1 -1
- package/dist/client/settings/SettingsPanel.d.ts.map +1 -1
- package/dist/client/settings/SettingsPanel.js +8 -3
- package/dist/client/settings/SettingsPanel.js.map +1 -1
- package/dist/client/settings/useBuilderStatus.d.ts.map +1 -1
- package/dist/client/settings/useBuilderStatus.js +6 -38
- package/dist/client/settings/useBuilderStatus.js.map +1 -1
- package/dist/client/useProductionAgent.d.ts +2 -1
- package/dist/client/useProductionAgent.d.ts.map +1 -1
- package/dist/client/useProductionAgent.js.map +1 -1
- package/dist/deploy/build.js +1 -1
- package/dist/deploy/build.js.map +1 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/routes.d.ts +3 -3
- package/dist/observability/traces.d.ts.map +1 -1
- package/dist/observability/traces.js.map +1 -1
- package/dist/onboarding/default-steps.js +1 -1
- package/dist/onboarding/default-steps.js.map +1 -1
- package/dist/scripts/agent-engines/manage-agent-engine.js +1 -1
- package/dist/scripts/agent-engines/manage-agent-engine.js.map +1 -1
- package/dist/scripts/agent-engines/set-agent-engine.js +1 -1
- package/dist/scripts/agent-engines/set-agent-engine.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts +3 -0
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +134 -72
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/core-routes-plugin.d.ts +3 -0
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +4 -1
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/open-route.d.ts +9 -0
- package/dist/server/open-route.d.ts.map +1 -1
- package/dist/server/open-route.js +48 -38
- package/dist/server/open-route.js.map +1 -1
- package/dist/shared/reasoning-effort.js +3 -0
- package/dist/shared/reasoning-effort.js.map +1 -1
- package/dist/sharing/access.d.ts.map +1 -1
- package/dist/sharing/access.js +18 -2
- package/dist/sharing/access.js.map +1 -1
- package/dist/sharing/registry.d.ts +10 -0
- package/dist/sharing/registry.d.ts.map +1 -1
- package/dist/sharing/registry.js.map +1 -1
- package/dist/styles/agent-native.css +104 -20
- package/dist/styles/rich-markdown-editor.css +11 -10
- package/docs/content/cloneable-saas.mdx +2 -2
- package/docs/content/faq.mdx +1 -1
- package/docs/content/locales/ar-SA/cloneable-saas.mdx +2 -2
- package/docs/content/locales/ar-SA/faq.mdx +1 -1
- package/docs/content/locales/ar-SA/template-chat.mdx +1 -1
- package/docs/content/locales/de-DE/cloneable-saas.mdx +2 -2
- package/docs/content/locales/de-DE/faq.mdx +1 -1
- package/docs/content/locales/de-DE/template-chat.mdx +1 -1
- package/docs/content/locales/es-ES/cloneable-saas.mdx +2 -2
- package/docs/content/locales/es-ES/faq.mdx +1 -1
- package/docs/content/locales/es-ES/template-chat.mdx +1 -1
- package/docs/content/locales/fr-FR/cloneable-saas.mdx +2 -2
- package/docs/content/locales/fr-FR/faq.mdx +1 -1
- package/docs/content/locales/fr-FR/template-chat.mdx +1 -1
- package/docs/content/locales/hi-IN/cloneable-saas.mdx +2 -2
- package/docs/content/locales/hi-IN/faq.mdx +1 -1
- package/docs/content/locales/hi-IN/template-chat.mdx +1 -1
- package/docs/content/locales/ja-JP/cloneable-saas.mdx +2 -2
- package/docs/content/locales/ja-JP/faq.mdx +1 -1
- package/docs/content/locales/ja-JP/template-chat.mdx +1 -1
- package/docs/content/locales/ko-KR/cloneable-saas.mdx +2 -2
- package/docs/content/locales/ko-KR/faq.mdx +1 -1
- package/docs/content/locales/ko-KR/template-chat.mdx +1 -1
- package/docs/content/locales/pt-BR/cloneable-saas.mdx +2 -2
- package/docs/content/locales/pt-BR/faq.mdx +1 -1
- package/docs/content/locales/pt-BR/template-chat.mdx +1 -1
- package/docs/content/locales/zh-CN/cloneable-saas.mdx +2 -2
- package/docs/content/locales/zh-CN/faq.mdx +1 -1
- package/docs/content/locales/zh-CN/template-chat.mdx +1 -1
- package/docs/content/locales/zh-TW/cloneable-saas.mdx +2 -2
- package/docs/content/locales/zh-TW/faq.mdx +1 -1
- package/docs/content/locales/zh-TW/template-chat.mdx +1 -1
- package/docs/content/template-chat.mdx +1 -1
- package/package.json +1 -1
- package/corpus/templates/design/app/components/design/LocalSourceEditBanner.tsx +0 -157
- package/corpus/templates/design/app/lib/design-templates.ts +0 -1305
- package/corpus/templates/design/app/pages/Templates.tsx +0 -279
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
parseDocumentHideFromSearch,
|
|
11
11
|
} from "../server/lib/documents.js";
|
|
12
12
|
import type { DocumentUpdateResponse } from "../shared/api.js";
|
|
13
|
+
import { BUILDER_CMS_BODY_CONTENT_KEY } from "./_builder-cms-source-adapter.js";
|
|
13
14
|
import { reconcileInlineDatabasesForDocument } from "./_content-database-lifecycle.js";
|
|
14
15
|
import { serializeDocumentSource } from "./_document-source.js";
|
|
15
16
|
import {
|
|
@@ -33,6 +34,60 @@ function canManageRole(role: string) {
|
|
|
33
34
|
return role === "owner" || role === "admin";
|
|
34
35
|
}
|
|
35
36
|
|
|
37
|
+
function builderBodyWithoutImageSourceComponentMarkers(
|
|
38
|
+
content: string | null | undefined,
|
|
39
|
+
) {
|
|
40
|
+
return (content ?? "")
|
|
41
|
+
.replace(/(?:^|\n)<SourceComponent\b[\s\S]*?\/>[ \t]*(?=\n|$)/g, (marker) =>
|
|
42
|
+
marker.includes('componentName="Image"') ? "\n" : marker,
|
|
43
|
+
)
|
|
44
|
+
.replace(/\n{3,}/g, "\n\n")
|
|
45
|
+
.trim();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function builderBodyWithoutMarkdownImages(content: string | null | undefined) {
|
|
49
|
+
return (content ?? "")
|
|
50
|
+
.replace(
|
|
51
|
+
/(?:^|\n)!\[(?:\\.|[^\]\\])*\]\(\S+?(?:\s+"[^"]*")?\)[ \t]*(?=\n|$)/g,
|
|
52
|
+
"\n",
|
|
53
|
+
)
|
|
54
|
+
.replace(/\n{3,}/g, "\n\n")
|
|
55
|
+
.trim();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function normalizedBuilderBodyProse(content: string | null | undefined) {
|
|
59
|
+
return (content ?? "")
|
|
60
|
+
.normalize("NFKC")
|
|
61
|
+
.replace(/\u00a0/g, " ")
|
|
62
|
+
.replace(/\s+/g, " ")
|
|
63
|
+
.trim();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function isStaleBuilderImageSourceComponentSave(args: {
|
|
67
|
+
incomingContent: string;
|
|
68
|
+
currentContent: string;
|
|
69
|
+
sourceContent: string | null | undefined;
|
|
70
|
+
}) {
|
|
71
|
+
const sourceContent = args.sourceContent ?? "";
|
|
72
|
+
const currentMatchesSource =
|
|
73
|
+
normalizedBuilderBodyProse(args.currentContent) ===
|
|
74
|
+
normalizedBuilderBodyProse(sourceContent);
|
|
75
|
+
if (
|
|
76
|
+
!args.incomingContent.includes('componentName="Image"') ||
|
|
77
|
+
!sourceContent.includes("![") ||
|
|
78
|
+
sourceContent.includes('componentName="Image"') ||
|
|
79
|
+
!currentMatchesSource
|
|
80
|
+
) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
return (
|
|
84
|
+
normalizedBuilderBodyProse(
|
|
85
|
+
builderBodyWithoutImageSourceComponentMarkers(args.incomingContent),
|
|
86
|
+
) ===
|
|
87
|
+
normalizedBuilderBodyProse(builderBodyWithoutMarkdownImages(sourceContent))
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
36
91
|
export default defineAction({
|
|
37
92
|
description:
|
|
38
93
|
"Update an existing document's title, content, icon, or favorite status.",
|
|
@@ -79,6 +134,44 @@ export default defineAction({
|
|
|
79
134
|
content = content.slice(h1Match[0].length).trimStart();
|
|
80
135
|
}
|
|
81
136
|
}
|
|
137
|
+
if (
|
|
138
|
+
content.includes('componentName="Image"') &&
|
|
139
|
+
existing.content.includes("![")
|
|
140
|
+
) {
|
|
141
|
+
const [builderBody] = await db
|
|
142
|
+
.select({
|
|
143
|
+
sourceValuesJson: schema.contentDatabaseSourceRows.sourceValuesJson,
|
|
144
|
+
})
|
|
145
|
+
.from(schema.contentDatabaseSourceRows)
|
|
146
|
+
.innerJoin(
|
|
147
|
+
schema.contentDatabaseSources,
|
|
148
|
+
eq(
|
|
149
|
+
schema.contentDatabaseSources.id,
|
|
150
|
+
schema.contentDatabaseSourceRows.sourceId,
|
|
151
|
+
),
|
|
152
|
+
)
|
|
153
|
+
.where(
|
|
154
|
+
and(
|
|
155
|
+
eq(schema.contentDatabaseSourceRows.documentId, id),
|
|
156
|
+
eq(schema.contentDatabaseSources.sourceType, "builder-cms"),
|
|
157
|
+
),
|
|
158
|
+
)
|
|
159
|
+
.limit(1);
|
|
160
|
+
const sourceValues = JSON.parse(
|
|
161
|
+
builderBody?.sourceValuesJson ?? "{}",
|
|
162
|
+
) as Record<string, unknown>;
|
|
163
|
+
const sourceContent = sourceValues[BUILDER_CMS_BODY_CONTENT_KEY];
|
|
164
|
+
if (
|
|
165
|
+
typeof sourceContent === "string" &&
|
|
166
|
+
isStaleBuilderImageSourceComponentSave({
|
|
167
|
+
incomingContent: content,
|
|
168
|
+
currentContent: existing.content,
|
|
169
|
+
sourceContent,
|
|
170
|
+
})
|
|
171
|
+
) {
|
|
172
|
+
content = existing.content;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
82
175
|
}
|
|
83
176
|
|
|
84
177
|
// Detect actual changes — a no-op call (e.g. the editor echoing back the
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import type { BlockReadProps, BlockSpec } from "@agent-native/core/blocks";
|
|
2
|
+
import { useT } from "@agent-native/core/client";
|
|
3
|
+
import {
|
|
4
|
+
sourceComponentBlockConfig,
|
|
5
|
+
type SourceComponentData,
|
|
6
|
+
} from "@shared/source-component-block";
|
|
7
|
+
import {
|
|
8
|
+
IconBox,
|
|
9
|
+
IconDatabase,
|
|
10
|
+
IconExternalLink,
|
|
11
|
+
IconPhoto,
|
|
12
|
+
IconLink,
|
|
13
|
+
IconTable,
|
|
14
|
+
} from "@tabler/icons-react";
|
|
15
|
+
|
|
16
|
+
function providerLabel(provider: string) {
|
|
17
|
+
if (provider === "builder") return "Builder";
|
|
18
|
+
return provider.trim() || "Source";
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function safeHttpUrl(value: string | undefined) {
|
|
22
|
+
if (!value) return null;
|
|
23
|
+
try {
|
|
24
|
+
const url = new URL(value);
|
|
25
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") return null;
|
|
26
|
+
return url;
|
|
27
|
+
} catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function youtubeEmbedUrl(value: string | undefined) {
|
|
33
|
+
const url = safeHttpUrl(value);
|
|
34
|
+
if (!url) return null;
|
|
35
|
+
if (url.hostname === "youtu.be") {
|
|
36
|
+
const id = url.pathname.replace(/^\/+/, "").split("/")[0];
|
|
37
|
+
return id ? `https://www.youtube.com/embed/${id}` : null;
|
|
38
|
+
}
|
|
39
|
+
if (
|
|
40
|
+
url.hostname === "youtube.com" ||
|
|
41
|
+
url.hostname === "www.youtube.com" ||
|
|
42
|
+
url.hostname === "m.youtube.com"
|
|
43
|
+
) {
|
|
44
|
+
const id = url.searchParams.get("v");
|
|
45
|
+
if (id) return `https://www.youtube.com/embed/${id}`;
|
|
46
|
+
if (url.pathname.startsWith("/embed/")) return url.toString();
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function SourceImagePreview({ url, alt }: { url: string; alt?: string }) {
|
|
52
|
+
return (
|
|
53
|
+
<figure className="mt-2 overflow-hidden rounded-md border bg-background">
|
|
54
|
+
<img
|
|
55
|
+
src={url}
|
|
56
|
+
alt={alt || ""}
|
|
57
|
+
loading="lazy"
|
|
58
|
+
className="max-h-[520px] w-full object-contain"
|
|
59
|
+
/>
|
|
60
|
+
{alt ? (
|
|
61
|
+
<figcaption className="border-t px-2.5 py-2 text-xs leading-5 text-muted-foreground">
|
|
62
|
+
{alt}
|
|
63
|
+
</figcaption>
|
|
64
|
+
) : null}
|
|
65
|
+
</figure>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function SourceEmbedPreview({ url }: { url: string }) {
|
|
70
|
+
const embedUrl = youtubeEmbedUrl(url);
|
|
71
|
+
if (embedUrl) {
|
|
72
|
+
return (
|
|
73
|
+
<div className="mt-2 overflow-hidden rounded-md border bg-background">
|
|
74
|
+
<iframe
|
|
75
|
+
data-plan-interactive
|
|
76
|
+
className="aspect-video w-full"
|
|
77
|
+
src={embedUrl}
|
|
78
|
+
title="Builder embedded video"
|
|
79
|
+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
|
80
|
+
allowFullScreen
|
|
81
|
+
/>
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
return (
|
|
86
|
+
<a
|
|
87
|
+
data-plan-interactive
|
|
88
|
+
className="mt-2 flex min-w-0 items-center gap-2 rounded-md border bg-background px-2.5 py-2 text-xs text-muted-foreground hover:text-foreground"
|
|
89
|
+
href={url}
|
|
90
|
+
target="_blank"
|
|
91
|
+
rel="noreferrer"
|
|
92
|
+
>
|
|
93
|
+
<IconLink className="size-4 shrink-0" />
|
|
94
|
+
<span className="truncate">{url}</span>
|
|
95
|
+
</a>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function SourceComponentPreview({ data }: { data: SourceComponentData }) {
|
|
100
|
+
const t = useT();
|
|
101
|
+
const preview = data.preview;
|
|
102
|
+
const previewUrl = preview?.url ?? data.previewUrl;
|
|
103
|
+
const safePreviewUrl = safeHttpUrl(previewUrl)?.toString();
|
|
104
|
+
const imageAlt =
|
|
105
|
+
preview?.fields?.find((field) => field.label.toLowerCase() === "alt")
|
|
106
|
+
?.value ?? preview?.summary;
|
|
107
|
+
if (data.componentName === "Image" && safePreviewUrl) {
|
|
108
|
+
return <SourceImagePreview url={safePreviewUrl} alt={imageAlt} />;
|
|
109
|
+
}
|
|
110
|
+
if (preview?.kind === "table" && preview.table) {
|
|
111
|
+
return (
|
|
112
|
+
<div className="mt-2 overflow-hidden rounded-md border bg-background text-xs">
|
|
113
|
+
<table className="w-full table-fixed border-collapse">
|
|
114
|
+
<thead className="bg-muted/60 text-muted-foreground">
|
|
115
|
+
<tr>
|
|
116
|
+
{preview.table.columns.map((column) => (
|
|
117
|
+
<th
|
|
118
|
+
key={column.id}
|
|
119
|
+
className="border-b px-2 py-1.5 text-left font-medium"
|
|
120
|
+
>
|
|
121
|
+
<span className="block truncate">{column.label}</span>
|
|
122
|
+
</th>
|
|
123
|
+
))}
|
|
124
|
+
</tr>
|
|
125
|
+
</thead>
|
|
126
|
+
<tbody>
|
|
127
|
+
{preview.table.rows.length ? (
|
|
128
|
+
preview.table.rows.map((row, index) => (
|
|
129
|
+
<tr key={index} className="border-b last:border-b-0">
|
|
130
|
+
{preview.table?.columns.map((column) => (
|
|
131
|
+
<td key={column.id} className="px-2 py-1.5">
|
|
132
|
+
<span className="block truncate">
|
|
133
|
+
{row[column.id] ?? ""}
|
|
134
|
+
</span>
|
|
135
|
+
</td>
|
|
136
|
+
))}
|
|
137
|
+
</tr>
|
|
138
|
+
))
|
|
139
|
+
) : (
|
|
140
|
+
<tr>
|
|
141
|
+
<td
|
|
142
|
+
className="px-2 py-2 text-muted-foreground"
|
|
143
|
+
colSpan={Math.max(preview.table.columns.length, 1)}
|
|
144
|
+
>
|
|
145
|
+
{t("editor.sourceComponent.noPreviewRows")}
|
|
146
|
+
</td>
|
|
147
|
+
</tr>
|
|
148
|
+
)}
|
|
149
|
+
</tbody>
|
|
150
|
+
</table>
|
|
151
|
+
{preview.table.truncated ? (
|
|
152
|
+
<div className="border-t px-2 py-1.5 text-muted-foreground">
|
|
153
|
+
{t("editor.sourceComponent.previewTruncated")}
|
|
154
|
+
</div>
|
|
155
|
+
) : null}
|
|
156
|
+
</div>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
if (preview?.kind === "embed" && preview.url) {
|
|
160
|
+
return <SourceEmbedPreview url={preview.url} />;
|
|
161
|
+
}
|
|
162
|
+
if (preview?.fields?.length) {
|
|
163
|
+
return (
|
|
164
|
+
<div className="mt-2 flex flex-wrap gap-1.5 text-xs text-muted-foreground">
|
|
165
|
+
{preview.fields.map((field) => (
|
|
166
|
+
<span
|
|
167
|
+
key={`${field.label}:${field.value}`}
|
|
168
|
+
className="rounded border bg-background px-1.5 py-0.5"
|
|
169
|
+
>
|
|
170
|
+
{field.label}: {field.value}
|
|
171
|
+
</span>
|
|
172
|
+
))}
|
|
173
|
+
</div>
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
if (data.previewKind === "table") {
|
|
177
|
+
return (
|
|
178
|
+
<div className="mt-2 flex flex-wrap items-center gap-2 rounded-md border bg-background px-2.5 py-2 text-xs text-muted-foreground">
|
|
179
|
+
<IconTable className="size-4 shrink-0" />
|
|
180
|
+
{(data.previewItems?.length ? data.previewItems : ["Table"]).map(
|
|
181
|
+
(item) => (
|
|
182
|
+
<span
|
|
183
|
+
key={item}
|
|
184
|
+
className="rounded border bg-muted/40 px-1.5 py-0.5"
|
|
185
|
+
>
|
|
186
|
+
{item}
|
|
187
|
+
</span>
|
|
188
|
+
),
|
|
189
|
+
)}
|
|
190
|
+
</div>
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
if (data.previewKind === "embed" && data.previewUrl) {
|
|
194
|
+
return <SourceEmbedPreview url={data.previewUrl} />;
|
|
195
|
+
}
|
|
196
|
+
if (data.previewItems?.length) {
|
|
197
|
+
return (
|
|
198
|
+
<div className="mt-2 flex flex-wrap gap-1.5 text-xs text-muted-foreground">
|
|
199
|
+
{data.previewItems.map((item) => (
|
|
200
|
+
<span
|
|
201
|
+
key={item}
|
|
202
|
+
className="rounded border bg-background px-1.5 py-0.5"
|
|
203
|
+
>
|
|
204
|
+
{item}
|
|
205
|
+
</span>
|
|
206
|
+
))}
|
|
207
|
+
</div>
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export function SourceComponentRead({
|
|
214
|
+
data,
|
|
215
|
+
blockId,
|
|
216
|
+
}: BlockReadProps<SourceComponentData>) {
|
|
217
|
+
const t = useT();
|
|
218
|
+
const label =
|
|
219
|
+
data.title ||
|
|
220
|
+
data.componentName ||
|
|
221
|
+
t("editor.sourceComponent.defaultTitle");
|
|
222
|
+
const status = data.preview?.status ?? data.previewStatus ?? "unavailable";
|
|
223
|
+
const statusLabel =
|
|
224
|
+
status === "available"
|
|
225
|
+
? t("editor.sourceComponent.previewAvailable")
|
|
226
|
+
: status === "warning"
|
|
227
|
+
? t("editor.sourceComponent.needsAttention")
|
|
228
|
+
: t("editor.sourceComponent.previewUnavailable");
|
|
229
|
+
|
|
230
|
+
return (
|
|
231
|
+
<section
|
|
232
|
+
data-block-id={blockId}
|
|
233
|
+
data-plan-interactive
|
|
234
|
+
className="an-block rounded-md border border-dashed bg-muted/20 px-3 py-3 text-sm"
|
|
235
|
+
>
|
|
236
|
+
<div className="flex min-w-0 items-start justify-between gap-3">
|
|
237
|
+
<div className="flex min-w-0 items-start gap-2">
|
|
238
|
+
{data.componentName === "Image" ? (
|
|
239
|
+
<IconPhoto className="mt-0.5 size-4 shrink-0 text-muted-foreground" />
|
|
240
|
+
) : (
|
|
241
|
+
<IconBox className="mt-0.5 size-4 shrink-0 text-muted-foreground" />
|
|
242
|
+
)}
|
|
243
|
+
<div className="min-w-0">
|
|
244
|
+
<div className="truncate font-medium text-foreground">{label}</div>
|
|
245
|
+
<div className="mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground">
|
|
246
|
+
<span className="inline-flex items-center gap-1">
|
|
247
|
+
<IconDatabase className="size-3.5" />
|
|
248
|
+
{providerLabel(data.provider)}
|
|
249
|
+
</span>
|
|
250
|
+
<span>{data.componentName}</span>
|
|
251
|
+
{data.sourceLabel ? <span>{data.sourceLabel}</span> : null}
|
|
252
|
+
</div>
|
|
253
|
+
</div>
|
|
254
|
+
</div>
|
|
255
|
+
<span className="shrink-0 rounded-full border bg-background px-2 py-0.5 text-[11px] text-muted-foreground">
|
|
256
|
+
{statusLabel}
|
|
257
|
+
</span>
|
|
258
|
+
</div>
|
|
259
|
+
{data.summary ? (
|
|
260
|
+
<div className="mt-2 text-sm leading-6 text-muted-foreground">
|
|
261
|
+
{data.summary}
|
|
262
|
+
</div>
|
|
263
|
+
) : null}
|
|
264
|
+
<SourceComponentPreview data={data} />
|
|
265
|
+
<div className="mt-2 flex min-w-0 items-center gap-1 truncate text-[11px] text-muted-foreground">
|
|
266
|
+
<IconExternalLink className="size-3.5 shrink-0" />
|
|
267
|
+
<span className="truncate">{data.rawRef}</span>
|
|
268
|
+
</div>
|
|
269
|
+
</section>
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export const sourceComponentBlock: BlockSpec<SourceComponentData> = {
|
|
274
|
+
...sourceComponentBlockConfig,
|
|
275
|
+
Read: SourceComponentRead,
|
|
276
|
+
icon: IconBox,
|
|
277
|
+
};
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
ContentBlockMarkdownEditor,
|
|
27
27
|
} from "./ContentBlockMarkdown";
|
|
28
28
|
import { inlineDatabaseBlock } from "./InlineDatabaseBlock";
|
|
29
|
+
import { sourceComponentBlock } from "./SourceComponentBlock";
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* Content's BROWSER block registry. Registers the same structured-block library
|
|
@@ -58,6 +59,7 @@ registerLibraryBlocks(contentBlockRegistry, {
|
|
|
58
59
|
for (const block of builderDocsBlocks) {
|
|
59
60
|
contentBlockRegistry.register(block);
|
|
60
61
|
}
|
|
62
|
+
contentBlockRegistry.register(sourceComponentBlock);
|
|
61
63
|
contentBlockRegistry.register(inlineDatabaseBlock);
|
|
62
64
|
|
|
63
65
|
type ContentBlockRenderContext = BlockRenderContext & {
|
|
@@ -301,11 +301,11 @@ export function BubbleToolbar({ editor, onComment }: BubbleToolbarProps) {
|
|
|
301
301
|
setLinkUrl("");
|
|
302
302
|
}
|
|
303
303
|
}}
|
|
304
|
-
className="bg-transparent border-none outline-none text-
|
|
304
|
+
className="bg-transparent border-none outline-none text-popover-foreground text-sm w-40 sm:w-48 px-1 py-1 placeholder:text-muted-foreground"
|
|
305
305
|
/>
|
|
306
306
|
<button
|
|
307
307
|
onClick={handleSetLink}
|
|
308
|
-
className="text-xs text-
|
|
308
|
+
className="text-xs text-primary hover:text-primary/80 px-2 py-1.5 font-medium"
|
|
309
309
|
>
|
|
310
310
|
{t("editor.apply")}
|
|
311
311
|
</button>
|
|
@@ -318,7 +318,7 @@ export function BubbleToolbar({ editor, onComment }: BubbleToolbarProps) {
|
|
|
318
318
|
{items.map((item, i) => {
|
|
319
319
|
if ("type" in item && item.type === "divider") {
|
|
320
320
|
return (
|
|
321
|
-
<div key={`d-${i}`} className="w-px h-5 bg-
|
|
321
|
+
<div key={`d-${i}`} className="w-px h-5 bg-border mx-0.5" />
|
|
322
322
|
);
|
|
323
323
|
}
|
|
324
324
|
const {
|
|
@@ -340,8 +340,8 @@ export function BubbleToolbar({ editor, onComment }: BubbleToolbarProps) {
|
|
|
340
340
|
className={cn(
|
|
341
341
|
"p-2 rounded",
|
|
342
342
|
isActive()
|
|
343
|
-
? "bg-
|
|
344
|
-
: "text-
|
|
343
|
+
? "bg-accent text-accent-foreground"
|
|
344
|
+
: "text-popover-foreground/75 hover:bg-accent hover:text-accent-foreground",
|
|
345
345
|
)}
|
|
346
346
|
>
|
|
347
347
|
<Icon size={16} strokeWidth={2.5} />
|
|
@@ -34,6 +34,7 @@ import { Button } from "@/components/ui/button";
|
|
|
34
34
|
import { Sheet, SheetContent } from "@/components/ui/sheet";
|
|
35
35
|
import { Skeleton } from "@/components/ui/skeleton";
|
|
36
36
|
import { useComments } from "@/hooks/use-comments";
|
|
37
|
+
import { useProcessBuilderBodyHydration } from "@/hooks/use-content-database";
|
|
37
38
|
import {
|
|
38
39
|
useDocument,
|
|
39
40
|
useDocuments,
|
|
@@ -85,14 +86,18 @@ function adoptConfirmedSaveWatermarks({
|
|
|
85
86
|
savedAt: string;
|
|
86
87
|
title: string;
|
|
87
88
|
content: string;
|
|
88
|
-
updates:
|
|
89
|
+
updates: {
|
|
90
|
+
title?: string;
|
|
91
|
+
content?: string;
|
|
92
|
+
icon?: string | null;
|
|
93
|
+
};
|
|
89
94
|
lastSavedTitleRef: MutableRefObject<FieldSaveWatermark>;
|
|
90
95
|
lastSavedContentRef: MutableRefObject<ContentSaveWatermark>;
|
|
91
96
|
}) {
|
|
92
97
|
if (updates.title !== undefined) {
|
|
93
98
|
lastSavedTitleRef.current = { title, updatedAt: savedAt };
|
|
94
99
|
} else if (
|
|
95
|
-
updates.content !== undefined &&
|
|
100
|
+
(updates.content !== undefined || updates.icon !== undefined) &&
|
|
96
101
|
saved?.title === lastSavedTitleRef.current.title
|
|
97
102
|
) {
|
|
98
103
|
lastSavedTitleRef.current = {
|
|
@@ -103,7 +108,7 @@ function adoptConfirmedSaveWatermarks({
|
|
|
103
108
|
if (updates.content !== undefined) {
|
|
104
109
|
lastSavedContentRef.current = { content, updatedAt: savedAt };
|
|
105
110
|
} else if (
|
|
106
|
-
updates.title !== undefined &&
|
|
111
|
+
(updates.title !== undefined || updates.icon !== undefined) &&
|
|
107
112
|
saved?.content === lastSavedContentRef.current.content
|
|
108
113
|
) {
|
|
109
114
|
lastSavedContentRef.current = {
|
|
@@ -326,6 +331,9 @@ function DocumentEditorBody({ documentId, document }: DocumentEditorBodyProps) {
|
|
|
326
331
|
const t = useT();
|
|
327
332
|
const updateDocument = useUpdateDocument();
|
|
328
333
|
const queryClient = useQueryClient();
|
|
334
|
+
const processBuilderBodies = useProcessBuilderBodyHydration(
|
|
335
|
+
document.databaseMembership?.databaseDocumentId ?? documentId,
|
|
336
|
+
);
|
|
329
337
|
const canEdit = document.canEdit ?? true;
|
|
330
338
|
const canEditRef = useRef(canEdit);
|
|
331
339
|
canEditRef.current = canEdit;
|
|
@@ -358,6 +366,7 @@ function DocumentEditorBody({ documentId, document }: DocumentEditorBodyProps) {
|
|
|
358
366
|
string | null
|
|
359
367
|
>(document.updatedAt ?? null);
|
|
360
368
|
const saveTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
369
|
+
const promotedBuilderBodyRef = useRef<string | null>(null);
|
|
361
370
|
const pendingDocumentSaveRef = useRef<PendingDocumentSave | null>(null);
|
|
362
371
|
// Separate freshness watermarks for title and content so that a content save
|
|
363
372
|
// never suppresses adopting a newer external title and vice versa.
|
|
@@ -388,6 +397,26 @@ function DocumentEditorBody({ documentId, document }: DocumentEditorBodyProps) {
|
|
|
388
397
|
},
|
|
389
398
|
[t],
|
|
390
399
|
);
|
|
400
|
+
|
|
401
|
+
useEffect(() => {
|
|
402
|
+
const membership = document.databaseMembership;
|
|
403
|
+
const hydration = membership?.bodyHydration;
|
|
404
|
+
if (
|
|
405
|
+
!membership?.sourceId ||
|
|
406
|
+
!hydration ||
|
|
407
|
+
(hydration.status !== "pending" && hydration.status !== "error")
|
|
408
|
+
) {
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
const promotionKey = `${membership.sourceId}:${documentId}:${hydration.status}:${hydration.version ?? ""}`;
|
|
412
|
+
if (promotedBuilderBodyRef.current === promotionKey) return;
|
|
413
|
+
promotedBuilderBodyRef.current = promotionKey;
|
|
414
|
+
processBuilderBodies.mutate({
|
|
415
|
+
sourceId: membership.sourceId,
|
|
416
|
+
documentId,
|
|
417
|
+
limit: 1,
|
|
418
|
+
});
|
|
419
|
+
}, [document.databaseMembership, documentId, processBuilderBodies.mutate]);
|
|
391
420
|
const titleFocusedRef = useRef(false);
|
|
392
421
|
const scrollContainerRef = useRef<HTMLDivElement>(null);
|
|
393
422
|
const titleInputRef = useRef<HTMLTextAreaElement>(null);
|
|
@@ -1160,7 +1189,19 @@ function DocumentEditorBody({ documentId, document }: DocumentEditorBodyProps) {
|
|
|
1160
1189
|
}
|
|
1161
1190
|
onSelect={(emoji) => {
|
|
1162
1191
|
void (async () => {
|
|
1163
|
-
await persistDocumentUpdates({
|
|
1192
|
+
const saved = await persistDocumentUpdates({
|
|
1193
|
+
icon: emoji,
|
|
1194
|
+
});
|
|
1195
|
+
adoptConfirmedSaveWatermarks({
|
|
1196
|
+
saved,
|
|
1197
|
+
savedAt:
|
|
1198
|
+
saved?.updatedAt ?? new Date().toISOString(),
|
|
1199
|
+
title: localTitleRef.current,
|
|
1200
|
+
content: localContentRef.current,
|
|
1201
|
+
updates: { icon: emoji },
|
|
1202
|
+
lastSavedTitleRef,
|
|
1203
|
+
lastSavedContentRef,
|
|
1204
|
+
});
|
|
1164
1205
|
})().catch(handleBackgroundSaveError);
|
|
1165
1206
|
}}
|
|
1166
1207
|
/>
|
|
@@ -66,7 +66,10 @@ import {
|
|
|
66
66
|
type NotionPageLink,
|
|
67
67
|
} from "./extensions/NotionExtensions";
|
|
68
68
|
import { notionFidelityExtensions } from "./extensions/NotionFidelity";
|
|
69
|
-
import {
|
|
69
|
+
import {
|
|
70
|
+
LockedSourceComponentBlocks,
|
|
71
|
+
RegistryBlockNode,
|
|
72
|
+
} from "./extensions/registryBlocks";
|
|
70
73
|
import { VideoNode } from "./extensions/VideoNode";
|
|
71
74
|
import {
|
|
72
75
|
getImageFiles,
|
|
@@ -1307,6 +1310,7 @@ export function createVisualEditorExtensions({
|
|
|
1307
1310
|
// `VisualEditor` below. Mounted after the Notion nodes and before the
|
|
1308
1311
|
// Markdown extension so the NFM <-> doc round-trip recognizes the node.
|
|
1309
1312
|
RegistryBlockNode,
|
|
1313
|
+
LockedSourceComponentBlocks,
|
|
1310
1314
|
ContentReferenceNode.configure({
|
|
1311
1315
|
currentPath: localFilePath ?? null,
|
|
1312
1316
|
referenceDepth,
|