@agent-native/core 0.83.0 → 0.84.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/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/evals.mdx +34 -12
- 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/evals.mdx +7 -0
- 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/evals.mdx +8 -0
- 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/evals.mdx +8 -0
- 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/evals.mdx +8 -0
- 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/evals.mdx +8 -0
- 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/evals.mdx +7 -0
- 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/evals.mdx +7 -0
- 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/evals.mdx +8 -0
- 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/evals.mdx +7 -0
- 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/evals.mdx +7 -0
- 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/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/eval/define-eval.ts +4 -1
- package/corpus/core/src/eval/report.ts +23 -8
- package/corpus/core/src/eval/runner.ts +41 -6
- package/corpus/core/src/eval/types.ts +11 -0
- 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/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/AGENTS.md +9 -2
- package/corpus/templates/content/actions/_database-row-batch.ts +230 -0
- package/corpus/templates/content/actions/_database-utils.ts +17 -9
- package/corpus/templates/content/actions/_notion-action-utils.ts +26 -0
- package/corpus/templates/content/actions/connect-notion-status.ts +13 -4
- package/corpus/templates/content/actions/create-and-link-notion-page.ts +23 -0
- package/corpus/templates/content/actions/delete-database-items.ts +55 -0
- package/corpus/templates/content/actions/delete-document.ts +4 -4
- package/corpus/templates/content/actions/disconnect-notion.ts +16 -0
- package/corpus/templates/content/actions/duplicate-database-item.ts +1 -1
- package/corpus/templates/content/actions/duplicate-database-items.ts +191 -0
- package/corpus/templates/content/actions/link-notion-page.ts +10 -7
- package/corpus/templates/content/actions/list-notion-links.ts +3 -4
- package/corpus/templates/content/actions/pull-notion-page.ts +7 -9
- package/corpus/templates/content/actions/push-notion-page.ts +7 -9
- package/corpus/templates/content/actions/refresh-notion-sync-status.ts +24 -0
- package/corpus/templates/content/actions/resolve-notion-sync-conflict.ts +23 -0
- package/corpus/templates/content/actions/search-notion-pages.ts +67 -0
- package/corpus/templates/content/actions/unlink-notion-page.ts +23 -0
- package/corpus/templates/content/app/components/editor/BubbleToolbar.tsx +5 -5
- package/corpus/templates/content/app/components/editor/DocumentDatabase.tsx +27 -34
- package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +16 -13
- package/corpus/templates/content/app/components/editor/DocumentToolbar.tsx +10 -10
- package/corpus/templates/content/app/components/editor/NotionConflictBanner.tsx +1 -1
- package/corpus/templates/content/app/components/editor/NotionSyncBar.tsx +18 -9
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +27 -34
- package/corpus/templates/content/app/components/editor/database/navigation-state.ts +10 -4
- package/corpus/templates/content/app/components/sidebar/NotionButton.tsx +32 -17
- package/corpus/templates/content/app/global.css +6 -5
- package/corpus/templates/content/app/hooks/use-content-database.ts +35 -0
- package/corpus/templates/content/app/hooks/use-notion.ts +108 -99
- 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 -0
- package/corpus/templates/content/parity/README.md +69 -0
- package/corpus/templates/content/parity/eval-scenarios.ts +118 -0
- package/corpus/templates/content/parity/exceptions.allowlist.ts +17 -0
- package/corpus/templates/content/parity/matrix.md +28 -0
- package/corpus/templates/content/parity/matrix.ts +606 -0
- package/corpus/templates/content/parity/matrix.types.ts +42 -0
- package/corpus/templates/content/parity/parity-evals.eval.ts +4 -0
- package/corpus/templates/content/parity/render-matrix.ts +90 -0
- package/corpus/templates/content/parity/scenario-to-eval.ts +57 -0
- package/corpus/templates/content/shared/api.ts +11 -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 +345 -14
- 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 +1038 -150
- 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 +1129 -155
- 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/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 +1428 -384
- 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-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/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/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/deploy/build.js +1 -1
- package/dist/deploy/build.js.map +1 -1
- package/dist/eval/define-eval.d.ts.map +1 -1
- package/dist/eval/define-eval.js +2 -1
- package/dist/eval/define-eval.js.map +1 -1
- package/dist/eval/report.d.ts.map +1 -1
- package/dist/eval/report.js +19 -4
- package/dist/eval/report.js.map +1 -1
- package/dist/eval/runner.d.ts.map +1 -1
- package/dist/eval/runner.js +38 -6
- package/dist/eval/runner.js.map +1 -1
- package/dist/eval/types.d.ts +11 -0
- package/dist/eval/types.d.ts.map +1 -1
- package/dist/eval/types.js.map +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +2 -2
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/routes.d.ts +5 -5
- 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/progress/routes.d.ts +1 -1
- package/dist/resources/handlers.d.ts +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/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/evals.mdx +34 -12
- package/docs/content/faq.mdx +1 -1
- package/docs/content/locales/ar-SA/cloneable-saas.mdx +2 -2
- package/docs/content/locales/ar-SA/evals.mdx +7 -0
- 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/evals.mdx +8 -0
- 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/evals.mdx +8 -0
- 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/evals.mdx +8 -0
- 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/evals.mdx +8 -0
- 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/evals.mdx +7 -0
- 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/evals.mdx +7 -0
- 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/evals.mdx +8 -0
- 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/evals.mdx +7 -0
- 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/evals.mdx +7 -0
- 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/content/server/routes/api/notion/disconnect.post.ts +0 -12
- 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
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core";
|
|
2
|
+
import { writeAppState } from "@agent-native/core/application-state";
|
|
3
|
+
import { getRequestUserEmail } from "@agent-native/core/server/request-context";
|
|
4
|
+
import { assertAccess } from "@agent-native/core/sharing";
|
|
5
|
+
import { and, eq, gte, inArray, sql } from "drizzle-orm";
|
|
6
|
+
|
|
7
|
+
import { getDb, schema } from "../server/db/index.js";
|
|
8
|
+
import {
|
|
9
|
+
databaseRowBatchSchema,
|
|
10
|
+
resolveDatabaseRowsForBatch,
|
|
11
|
+
} from "./_database-row-batch.js";
|
|
12
|
+
import { getContentDatabaseResponse } from "./_database-utils.js";
|
|
13
|
+
import { nanoid } from "./_property-utils.js";
|
|
14
|
+
|
|
15
|
+
export default defineAction({
|
|
16
|
+
description:
|
|
17
|
+
"Duplicate multiple page rows in a content database in one atomic batch. Use this for two or more selected/named rows instead of looping duplicate-database-item.",
|
|
18
|
+
schema: databaseRowBatchSchema,
|
|
19
|
+
run: async (args) => {
|
|
20
|
+
const db = getDb();
|
|
21
|
+
const { database, rows } = await resolveDatabaseRowsForBatch(args);
|
|
22
|
+
|
|
23
|
+
await assertAccess("document", database.documentId, "editor");
|
|
24
|
+
for (const row of rows) {
|
|
25
|
+
await assertAccess("document", row.document.id, "viewer");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const sourceDocumentIds = rows.map((row) => row.document.id);
|
|
29
|
+
const sourceItemIds = rows.map((row) => row.item.id);
|
|
30
|
+
const now = new Date().toISOString();
|
|
31
|
+
const insertionPosition =
|
|
32
|
+
Math.max(...rows.map((row) => row.item.position)) + 1;
|
|
33
|
+
const currentUserEmail = getRequestUserEmail() ?? database.ownerEmail;
|
|
34
|
+
|
|
35
|
+
const values =
|
|
36
|
+
sourceDocumentIds.length > 0
|
|
37
|
+
? await db
|
|
38
|
+
.select()
|
|
39
|
+
.from(schema.documentPropertyValues)
|
|
40
|
+
.where(
|
|
41
|
+
inArray(
|
|
42
|
+
schema.documentPropertyValues.documentId,
|
|
43
|
+
sourceDocumentIds,
|
|
44
|
+
),
|
|
45
|
+
)
|
|
46
|
+
: [];
|
|
47
|
+
const valuesByDocumentId = new Map<
|
|
48
|
+
string,
|
|
49
|
+
Array<typeof schema.documentPropertyValues.$inferSelect>
|
|
50
|
+
>();
|
|
51
|
+
for (const value of values) {
|
|
52
|
+
const list = valuesByDocumentId.get(value.documentId) ?? [];
|
|
53
|
+
list.push(value);
|
|
54
|
+
valuesByDocumentId.set(value.documentId, list);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const inheritedShares = await db
|
|
58
|
+
.select({
|
|
59
|
+
principalType: schema.documentShares.principalType,
|
|
60
|
+
principalId: schema.documentShares.principalId,
|
|
61
|
+
role: schema.documentShares.role,
|
|
62
|
+
})
|
|
63
|
+
.from(schema.documentShares)
|
|
64
|
+
.where(eq(schema.documentShares.resourceId, database.documentId));
|
|
65
|
+
|
|
66
|
+
const duplicates = rows.map((row, index) => ({
|
|
67
|
+
sourceItemId: row.item.id,
|
|
68
|
+
sourceDocumentId: row.document.id,
|
|
69
|
+
duplicatedItemId: nanoid(),
|
|
70
|
+
duplicatedDocumentId: nanoid(),
|
|
71
|
+
position: insertionPosition + index,
|
|
72
|
+
row,
|
|
73
|
+
}));
|
|
74
|
+
|
|
75
|
+
await db.transaction(async (tx) => {
|
|
76
|
+
await tx
|
|
77
|
+
.update(schema.contentDatabaseItems)
|
|
78
|
+
.set({
|
|
79
|
+
position: sql`${schema.contentDatabaseItems.position} + ${duplicates.length}`,
|
|
80
|
+
updatedAt: now,
|
|
81
|
+
})
|
|
82
|
+
.where(
|
|
83
|
+
and(
|
|
84
|
+
eq(schema.contentDatabaseItems.databaseId, database.id),
|
|
85
|
+
gte(schema.contentDatabaseItems.position, insertionPosition),
|
|
86
|
+
),
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
await tx
|
|
90
|
+
.update(schema.documents)
|
|
91
|
+
.set({
|
|
92
|
+
position: sql`${schema.documents.position} + ${duplicates.length}`,
|
|
93
|
+
updatedAt: now,
|
|
94
|
+
})
|
|
95
|
+
.where(
|
|
96
|
+
and(
|
|
97
|
+
eq(schema.documents.ownerEmail, database.ownerEmail),
|
|
98
|
+
eq(schema.documents.parentId, database.documentId),
|
|
99
|
+
gte(schema.documents.position, insertionPosition),
|
|
100
|
+
),
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
await tx.insert(schema.documents).values(
|
|
104
|
+
duplicates.map((duplicate) => ({
|
|
105
|
+
id: duplicate.duplicatedDocumentId,
|
|
106
|
+
ownerEmail: duplicate.row.document.ownerEmail,
|
|
107
|
+
orgId: duplicate.row.document.orgId,
|
|
108
|
+
parentId: database.documentId,
|
|
109
|
+
title: `Copy of ${duplicate.row.document.title.trim() || "Untitled"}`,
|
|
110
|
+
content: duplicate.row.document.content,
|
|
111
|
+
icon: duplicate.row.document.icon,
|
|
112
|
+
position: duplicate.position,
|
|
113
|
+
isFavorite: 0,
|
|
114
|
+
hideFromSearch: duplicate.row.document.hideFromSearch,
|
|
115
|
+
visibility: duplicate.row.document.visibility,
|
|
116
|
+
createdAt: now,
|
|
117
|
+
updatedAt: now,
|
|
118
|
+
})),
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
await tx.insert(schema.contentDatabaseItems).values(
|
|
122
|
+
duplicates.map((duplicate) => ({
|
|
123
|
+
id: duplicate.duplicatedItemId,
|
|
124
|
+
ownerEmail: duplicate.row.item.ownerEmail,
|
|
125
|
+
orgId: duplicate.row.item.orgId,
|
|
126
|
+
databaseId: database.id,
|
|
127
|
+
documentId: duplicate.duplicatedDocumentId,
|
|
128
|
+
position: duplicate.position,
|
|
129
|
+
createdAt: now,
|
|
130
|
+
updatedAt: now,
|
|
131
|
+
})),
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
const duplicatedValues = duplicates.flatMap((duplicate) =>
|
|
135
|
+
(valuesByDocumentId.get(duplicate.sourceDocumentId) ?? []).map(
|
|
136
|
+
(value) => ({
|
|
137
|
+
id: nanoid(),
|
|
138
|
+
ownerEmail: duplicate.row.document.ownerEmail,
|
|
139
|
+
documentId: duplicate.duplicatedDocumentId,
|
|
140
|
+
propertyId: value.propertyId,
|
|
141
|
+
valueJson: value.valueJson,
|
|
142
|
+
createdAt: now,
|
|
143
|
+
updatedAt: now,
|
|
144
|
+
}),
|
|
145
|
+
),
|
|
146
|
+
);
|
|
147
|
+
if (duplicatedValues.length > 0) {
|
|
148
|
+
await tx.insert(schema.documentPropertyValues).values(duplicatedValues);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (inheritedShares.length > 0) {
|
|
152
|
+
await tx.insert(schema.documentShares).values(
|
|
153
|
+
duplicates.flatMap((duplicate) =>
|
|
154
|
+
inheritedShares.map((share) => ({
|
|
155
|
+
id: nanoid(),
|
|
156
|
+
resourceId: duplicate.duplicatedDocumentId,
|
|
157
|
+
principalType: share.principalType,
|
|
158
|
+
principalId: share.principalId,
|
|
159
|
+
role: share.role,
|
|
160
|
+
createdBy: currentUserEmail,
|
|
161
|
+
createdAt: now,
|
|
162
|
+
})),
|
|
163
|
+
),
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
await writeAppState("refresh-signal", { ts: Date.now() });
|
|
169
|
+
|
|
170
|
+
return {
|
|
171
|
+
...(await getContentDatabaseResponse(database.id)),
|
|
172
|
+
duplicatedItemId: duplicates[0]?.duplicatedItemId,
|
|
173
|
+
duplicatedDocumentId: duplicates[0]?.duplicatedDocumentId,
|
|
174
|
+
duplicatedItemIds: duplicates.map(
|
|
175
|
+
(duplicate) => duplicate.duplicatedItemId,
|
|
176
|
+
),
|
|
177
|
+
duplicatedDocumentIds: duplicates.map(
|
|
178
|
+
(duplicate) => duplicate.duplicatedDocumentId,
|
|
179
|
+
),
|
|
180
|
+
sourceItemIds,
|
|
181
|
+
sourceDocumentIds,
|
|
182
|
+
sourceToDuplicate: duplicates.map((duplicate) => ({
|
|
183
|
+
sourceItemId: duplicate.sourceItemId,
|
|
184
|
+
sourceDocumentId: duplicate.sourceDocumentId,
|
|
185
|
+
duplicatedItemId: duplicate.duplicatedItemId,
|
|
186
|
+
duplicatedDocumentId: duplicate.duplicatedDocumentId,
|
|
187
|
+
})),
|
|
188
|
+
duplicatedCount: duplicates.length,
|
|
189
|
+
};
|
|
190
|
+
},
|
|
191
|
+
});
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { defineAction } from "@agent-native/core";
|
|
2
|
-
import { getRequestUserEmail } from "@agent-native/core/server";
|
|
3
2
|
import { z } from "zod";
|
|
4
3
|
|
|
5
4
|
import { linkDocumentToNotionPage } from "../server/lib/notion-sync.js";
|
|
5
|
+
import {
|
|
6
|
+
getNotionDocumentOwner,
|
|
7
|
+
resolveDocumentId,
|
|
8
|
+
} from "./_notion-action-utils.js";
|
|
6
9
|
|
|
7
10
|
export default defineAction({
|
|
8
11
|
description: "Link a document to a Notion page for syncing.",
|
|
@@ -10,19 +13,19 @@ export default defineAction({
|
|
|
10
13
|
documentId: z.string().optional().describe("Document ID (required)"),
|
|
11
14
|
id: z.string().optional().describe("Alias for --documentId"),
|
|
12
15
|
pageId: z.string().optional().describe("Notion page ID or URL (required)"),
|
|
16
|
+
pageIdOrUrl: z.string().optional().describe("Alias for --pageId"),
|
|
13
17
|
url: z.string().optional().describe("Alias for --pageId"),
|
|
14
18
|
}),
|
|
15
|
-
http:
|
|
19
|
+
http: { method: "POST" },
|
|
16
20
|
run: async (args) => {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
const documentId = args.documentId || args.id;
|
|
20
|
-
const pageIdOrUrl = args.pageId || args.url;
|
|
21
|
+
const documentId = resolveDocumentId(args);
|
|
22
|
+
const pageIdOrUrl = args.pageId || args.pageIdOrUrl || args.url;
|
|
21
23
|
|
|
22
|
-
if (!
|
|
24
|
+
if (!pageIdOrUrl) {
|
|
23
25
|
throw new Error("documentId and pageId are required");
|
|
24
26
|
}
|
|
25
27
|
|
|
28
|
+
const owner = await getNotionDocumentOwner(documentId);
|
|
26
29
|
return linkDocumentToNotionPage(owner, documentId, pageIdOrUrl);
|
|
27
30
|
},
|
|
28
31
|
});
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { defineAction } from "@agent-native/core";
|
|
2
|
-
import { getRequestUserEmail } from "@agent-native/core/server";
|
|
3
2
|
import { z } from "zod";
|
|
4
3
|
|
|
5
4
|
import { listNotionLinks } from "../server/lib/notion-sync.js";
|
|
5
|
+
import { getCurrentNotionOwner } from "./_notion-action-utils.js";
|
|
6
6
|
|
|
7
7
|
export default defineAction({
|
|
8
8
|
description: "List all documents linked to Notion pages.",
|
|
9
9
|
schema: z.object({}),
|
|
10
|
-
http:
|
|
10
|
+
http: { method: "GET" },
|
|
11
11
|
run: async () => {
|
|
12
|
-
const owner =
|
|
13
|
-
if (!owner) throw new Error("no authenticated user");
|
|
12
|
+
const owner = getCurrentNotionOwner();
|
|
14
13
|
return listNotionLinks(owner);
|
|
15
14
|
},
|
|
16
15
|
});
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { defineAction } from "@agent-native/core";
|
|
2
|
-
import { getRequestUserEmail } from "@agent-native/core/server";
|
|
3
2
|
import { z } from "zod";
|
|
4
3
|
|
|
5
4
|
import { pullDocumentFromNotion } from "../server/lib/notion-sync.js";
|
|
5
|
+
import {
|
|
6
|
+
getNotionDocumentOwner,
|
|
7
|
+
resolveDocumentId,
|
|
8
|
+
} from "./_notion-action-utils.js";
|
|
6
9
|
|
|
7
10
|
export default defineAction({
|
|
8
11
|
description: "Pull content from a linked Notion page into a local document.",
|
|
@@ -10,15 +13,10 @@ export default defineAction({
|
|
|
10
13
|
documentId: z.string().optional().describe("Document ID (required)"),
|
|
11
14
|
id: z.string().optional().describe("Alias for --documentId"),
|
|
12
15
|
}),
|
|
13
|
-
http:
|
|
16
|
+
http: { method: "POST" },
|
|
14
17
|
run: async (args) => {
|
|
15
|
-
const documentId = args
|
|
16
|
-
|
|
17
|
-
throw new Error("documentId is required");
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const owner = getRequestUserEmail();
|
|
21
|
-
if (!owner) throw new Error("no authenticated user");
|
|
18
|
+
const documentId = resolveDocumentId(args);
|
|
19
|
+
const owner = await getNotionDocumentOwner(documentId);
|
|
22
20
|
return pullDocumentFromNotion(owner, documentId, true);
|
|
23
21
|
},
|
|
24
22
|
});
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { defineAction } from "@agent-native/core";
|
|
2
|
-
import { getRequestUserEmail } from "@agent-native/core/server";
|
|
3
2
|
import { z } from "zod";
|
|
4
3
|
|
|
5
4
|
import { pushDocumentToNotion } from "../server/lib/notion-sync.js";
|
|
5
|
+
import {
|
|
6
|
+
getNotionDocumentOwner,
|
|
7
|
+
resolveDocumentId,
|
|
8
|
+
} from "./_notion-action-utils.js";
|
|
6
9
|
|
|
7
10
|
export default defineAction({
|
|
8
11
|
description: "Push local document content to a linked Notion page.",
|
|
@@ -10,15 +13,10 @@ export default defineAction({
|
|
|
10
13
|
documentId: z.string().optional().describe("Document ID (required)"),
|
|
11
14
|
id: z.string().optional().describe("Alias for --documentId"),
|
|
12
15
|
}),
|
|
13
|
-
http:
|
|
16
|
+
http: { method: "POST" },
|
|
14
17
|
run: async (args) => {
|
|
15
|
-
const documentId = args
|
|
16
|
-
|
|
17
|
-
throw new Error("documentId is required");
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const owner = getRequestUserEmail();
|
|
21
|
-
if (!owner) throw new Error("no authenticated user");
|
|
18
|
+
const documentId = resolveDocumentId(args);
|
|
19
|
+
const owner = await getNotionDocumentOwner(documentId);
|
|
22
20
|
return pushDocumentToNotion(owner, documentId);
|
|
23
21
|
},
|
|
24
22
|
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
import { refreshDocumentSyncStatus } from "../server/lib/notion-sync.js";
|
|
5
|
+
import {
|
|
6
|
+
getNotionDocumentOwner,
|
|
7
|
+
resolveDocumentId,
|
|
8
|
+
} from "./_notion-action-utils.js";
|
|
9
|
+
|
|
10
|
+
export default defineAction({
|
|
11
|
+
description: "Refresh Notion sync status for a linked Content document.",
|
|
12
|
+
schema: z.object({
|
|
13
|
+
documentId: z.string().optional().describe("Document ID (required)"),
|
|
14
|
+
id: z.string().optional().describe("Alias for --documentId"),
|
|
15
|
+
autoSync: z.boolean().optional(),
|
|
16
|
+
}),
|
|
17
|
+
run: async (args) => {
|
|
18
|
+
const documentId = resolveDocumentId(args);
|
|
19
|
+
const owner = await getNotionDocumentOwner(documentId);
|
|
20
|
+
return refreshDocumentSyncStatus(owner, documentId, {
|
|
21
|
+
autoSync: !!args.autoSync,
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
import { resolveDocumentSyncConflict } from "../server/lib/notion-sync.js";
|
|
5
|
+
import {
|
|
6
|
+
getNotionDocumentOwner,
|
|
7
|
+
resolveDocumentId,
|
|
8
|
+
} from "./_notion-action-utils.js";
|
|
9
|
+
|
|
10
|
+
export default defineAction({
|
|
11
|
+
description: "Resolve a Notion sync conflict by pulling or pushing.",
|
|
12
|
+
schema: z.object({
|
|
13
|
+
documentId: z.string().optional().describe("Document ID (required)"),
|
|
14
|
+
id: z.string().optional().describe("Alias for --documentId"),
|
|
15
|
+
direction: z.enum(["pull", "push"]),
|
|
16
|
+
}),
|
|
17
|
+
http: { method: "POST" },
|
|
18
|
+
run: async (args) => {
|
|
19
|
+
const documentId = resolveDocumentId(args);
|
|
20
|
+
const owner = await getNotionDocumentOwner(documentId);
|
|
21
|
+
return resolveDocumentSyncConflict(owner, documentId, args.direction);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
getNotionConnectionForOwner,
|
|
6
|
+
notionFetch,
|
|
7
|
+
} from "../server/lib/notion.js";
|
|
8
|
+
import type {
|
|
9
|
+
NotionSearchResponse,
|
|
10
|
+
NotionSearchResult,
|
|
11
|
+
} from "../shared/api.js";
|
|
12
|
+
import { getCurrentNotionOwner } from "./_notion-action-utils.js";
|
|
13
|
+
|
|
14
|
+
export default defineAction({
|
|
15
|
+
description: "Search connected Notion pages visible to the current user.",
|
|
16
|
+
schema: z.object({
|
|
17
|
+
query: z.string().default(""),
|
|
18
|
+
}),
|
|
19
|
+
http: { method: "GET" },
|
|
20
|
+
run: async ({ query }): Promise<NotionSearchResponse> => {
|
|
21
|
+
const owner = getCurrentNotionOwner();
|
|
22
|
+
const conn = await getNotionConnectionForOwner(owner);
|
|
23
|
+
if (!conn) {
|
|
24
|
+
throw new Error("Notion not connected");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const result = await notionFetch<{
|
|
28
|
+
results: Array<{
|
|
29
|
+
id: string;
|
|
30
|
+
object: string;
|
|
31
|
+
icon?: { type: string; emoji?: string } | null;
|
|
32
|
+
url?: string;
|
|
33
|
+
last_edited_time?: string;
|
|
34
|
+
properties?: Record<string, any>;
|
|
35
|
+
}>;
|
|
36
|
+
has_more: boolean;
|
|
37
|
+
}>("/search", conn.accessToken, {
|
|
38
|
+
method: "POST",
|
|
39
|
+
body: JSON.stringify({
|
|
40
|
+
query: query.trim(),
|
|
41
|
+
filter: { value: "page", property: "object" },
|
|
42
|
+
sort: { direction: "descending", timestamp: "last_edited_time" },
|
|
43
|
+
page_size: 20,
|
|
44
|
+
}),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const results: NotionSearchResult[] = result.results.map((page) => {
|
|
48
|
+
const titleProp = Object.values(page.properties || {}).find(
|
|
49
|
+
(value: any) => value?.type === "title",
|
|
50
|
+
) as any;
|
|
51
|
+
const title =
|
|
52
|
+
(titleProp?.title || [])
|
|
53
|
+
.map((part: any) => part.plain_text || "")
|
|
54
|
+
.join("") || "Untitled";
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
id: page.id,
|
|
58
|
+
title,
|
|
59
|
+
icon: page.icon?.type === "emoji" ? page.icon.emoji || null : null,
|
|
60
|
+
url: page.url || `https://notion.so/${page.id.replace(/-/g, "")}`,
|
|
61
|
+
lastEditedTime: page.last_edited_time || null,
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
return { results, hasMore: result.has_more };
|
|
66
|
+
},
|
|
67
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
import { unlinkDocumentFromNotion } from "../server/lib/notion-sync.js";
|
|
5
|
+
import {
|
|
6
|
+
getNotionDocumentOwner,
|
|
7
|
+
resolveDocumentId,
|
|
8
|
+
} from "./_notion-action-utils.js";
|
|
9
|
+
|
|
10
|
+
export default defineAction({
|
|
11
|
+
description: "Unlink a Content document from its Notion page.",
|
|
12
|
+
schema: z.object({
|
|
13
|
+
documentId: z.string().optional().describe("Document ID (required)"),
|
|
14
|
+
id: z.string().optional().describe("Alias for --documentId"),
|
|
15
|
+
}),
|
|
16
|
+
http: { method: "DELETE" },
|
|
17
|
+
run: async (args) => {
|
|
18
|
+
const documentId = resolveDocumentId(args);
|
|
19
|
+
const owner = await getNotionDocumentOwner(documentId);
|
|
20
|
+
await unlinkDocumentFromNotion(owner, documentId);
|
|
21
|
+
return { success: true };
|
|
22
|
+
},
|
|
23
|
+
});
|
|
@@ -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} />
|
|
@@ -143,8 +143,10 @@ import {
|
|
|
143
143
|
useChangeContentDatabaseSourceRole,
|
|
144
144
|
useContentDatabase,
|
|
145
145
|
useContentDatabases,
|
|
146
|
+
useDeleteDatabaseItems,
|
|
146
147
|
useDisconnectContentDatabaseSource,
|
|
147
148
|
useDuplicateDatabaseItem,
|
|
149
|
+
useDuplicateDatabaseItems,
|
|
148
150
|
useExecuteBuilderSourceBatch,
|
|
149
151
|
useMoveDatabaseItem,
|
|
150
152
|
usePrepareBuilderSourceReview,
|
|
@@ -2862,9 +2864,9 @@ function DatabaseTableView({
|
|
|
2862
2864
|
const db = useDatabaseT();
|
|
2863
2865
|
const queryClient = useQueryClient();
|
|
2864
2866
|
const moveItem = useMoveDatabaseItem(databaseDocumentId);
|
|
2865
|
-
const
|
|
2867
|
+
const duplicateItems = useDuplicateDatabaseItems(databaseDocumentId);
|
|
2866
2868
|
const setProperty = useSetDocumentProperty(databaseDocumentId);
|
|
2867
|
-
const
|
|
2869
|
+
const deleteItems = useDeleteDatabaseItems(databaseDocumentId);
|
|
2868
2870
|
const [draggedItemId, setDraggedItemId] = useState<string | null>(null);
|
|
2869
2871
|
const [dropTargetItemId, setDropTargetItemId] = useState<string | null>(null);
|
|
2870
2872
|
const [draggedPropertyId, setDraggedPropertyId] = useState<string | null>(
|
|
@@ -3113,14 +3115,15 @@ function DatabaseTableView({
|
|
|
3113
3115
|
async function deleteSelectedRows() {
|
|
3114
3116
|
if (selectedItems.length === 0) return;
|
|
3115
3117
|
const selectedSnapshot = selectedItems;
|
|
3116
|
-
onClearSelection();
|
|
3117
3118
|
setConfirmDeleteSelectedOpen(false);
|
|
3118
3119
|
|
|
3119
3120
|
try {
|
|
3121
|
+
await deleteItems.mutateAsync({
|
|
3122
|
+
documentId: databaseDocumentId,
|
|
3123
|
+
itemIds: selectedSnapshot.map((item) => item.id),
|
|
3124
|
+
});
|
|
3125
|
+
onClearSelection();
|
|
3120
3126
|
onDeletedPreviewItems(selectedSnapshot);
|
|
3121
|
-
for (const item of selectedSnapshot) {
|
|
3122
|
-
await deleteDocument.mutateAsync({ id: item.document.id });
|
|
3123
|
-
}
|
|
3124
3127
|
await queryClient.invalidateQueries({
|
|
3125
3128
|
queryKey: [
|
|
3126
3129
|
"action",
|
|
@@ -3144,22 +3147,11 @@ function DatabaseTableView({
|
|
|
3144
3147
|
const selectedSnapshot = selectedItems;
|
|
3145
3148
|
setIsDuplicatingSelected(true);
|
|
3146
3149
|
|
|
3147
|
-
let duplicatedPreviewItem: ContentDatabaseItem | null = null;
|
|
3148
|
-
let duplicatedCount = 0;
|
|
3149
|
-
let failedCount = 0;
|
|
3150
|
-
|
|
3151
3150
|
try {
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
duplicatedPreviewItem =
|
|
3157
|
-
databaseDuplicatedItemFromResponse(response) ??
|
|
3158
|
-
duplicatedPreviewItem;
|
|
3159
|
-
} catch {
|
|
3160
|
-
failedCount += 1;
|
|
3161
|
-
}
|
|
3162
|
-
}
|
|
3151
|
+
const response = await duplicateItems.mutateAsync({
|
|
3152
|
+
documentId: databaseDocumentId,
|
|
3153
|
+
itemIds: selectedSnapshot.map((item) => item.id),
|
|
3154
|
+
});
|
|
3163
3155
|
|
|
3164
3156
|
await queryClient.invalidateQueries({
|
|
3165
3157
|
queryKey: [
|
|
@@ -3172,16 +3164,15 @@ function DatabaseTableView({
|
|
|
3172
3164
|
queryKey: ["action", "list-documents"],
|
|
3173
3165
|
});
|
|
3174
3166
|
|
|
3167
|
+
const duplicatedPreviewItem =
|
|
3168
|
+
databaseDuplicatedItemFromResponse(response);
|
|
3175
3169
|
if (duplicatedPreviewItem) onPreview(duplicatedPreviewItem);
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
: "No rows were duplicated.",
|
|
3183
|
-
});
|
|
3184
|
-
}
|
|
3170
|
+
onClearSelection();
|
|
3171
|
+
} catch (err) {
|
|
3172
|
+
toast.error(db("failedToDuplicateEverySelectedRow"), {
|
|
3173
|
+
description:
|
|
3174
|
+
err instanceof Error ? err.message : db("somethingWentWrong"),
|
|
3175
|
+
});
|
|
3185
3176
|
} finally {
|
|
3186
3177
|
setIsDuplicatingSelected(false);
|
|
3187
3178
|
}
|
|
@@ -3240,9 +3231,11 @@ function DatabaseTableView({
|
|
|
3240
3231
|
canEdit={canEdit}
|
|
3241
3232
|
properties={bulkEditableProperties}
|
|
3242
3233
|
duplicateDisabled={
|
|
3243
|
-
isDuplicatingSelected ||
|
|
3234
|
+
isDuplicatingSelected ||
|
|
3235
|
+
duplicateItems.isPending ||
|
|
3236
|
+
deleteItems.isPending
|
|
3244
3237
|
}
|
|
3245
|
-
deleteDisabled={
|
|
3238
|
+
deleteDisabled={deleteItems.isPending}
|
|
3246
3239
|
updateDisabled={setProperty.isPending}
|
|
3247
3240
|
onClearSelection={onClearSelection}
|
|
3248
3241
|
onSetPropertyValue={setSelectedPropertyValue}
|
|
@@ -3466,10 +3459,10 @@ function DatabaseTableView({
|
|
|
3466
3459
|
</AlertDialogCancel>
|
|
3467
3460
|
<AlertDialogAction
|
|
3468
3461
|
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
|
|
3469
|
-
disabled={
|
|
3462
|
+
disabled={deleteItems.isPending}
|
|
3470
3463
|
onClick={() => void deleteSelectedRows()}
|
|
3471
3464
|
>
|
|
3472
|
-
{
|
|
3465
|
+
{deleteItems.isPending ? "Deleting..." : "Delete"}
|
|
3473
3466
|
</AlertDialogAction>
|
|
3474
3467
|
</AlertDialogFooter>
|
|
3475
3468
|
</AlertDialogContent>
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
emailToName,
|
|
7
7
|
useSession,
|
|
8
8
|
useT,
|
|
9
|
-
appApiPath,
|
|
10
9
|
agentNativePath,
|
|
11
10
|
type CollabUser,
|
|
12
11
|
} from "@agent-native/core/client";
|
|
@@ -41,7 +40,11 @@ import {
|
|
|
41
40
|
useUpdateDocument,
|
|
42
41
|
} from "@/hooks/use-documents";
|
|
43
42
|
import { useLocalStorage } from "@/hooks/use-local-storage";
|
|
44
|
-
import {
|
|
43
|
+
import {
|
|
44
|
+
documentSyncStatusQueryKey,
|
|
45
|
+
useDocumentSyncStatus,
|
|
46
|
+
usePushDocumentToNotion,
|
|
47
|
+
} from "@/hooks/use-notion";
|
|
45
48
|
import {
|
|
46
49
|
canWriteLinkedLocalSource,
|
|
47
50
|
readDocumentFromLinkedLocalSource,
|
|
@@ -360,6 +363,7 @@ function DocumentEditorBody({ documentId, document }: DocumentEditorBodyProps) {
|
|
|
360
363
|
useDocumentSyncStatus(canEdit && !isLocalFileDocument ? documentId : null, {
|
|
361
364
|
autoSync,
|
|
362
365
|
});
|
|
366
|
+
const pushDocumentToNotion = usePushDocumentToNotion(documentId);
|
|
363
367
|
const [localTitle, setLocalTitle] = useState("");
|
|
364
368
|
const [localContent, setLocalContent] = useState("");
|
|
365
369
|
const [localContentUpdatedAt, setLocalContentUpdatedAt] = useState<
|
|
@@ -775,20 +779,18 @@ function DocumentEditorBody({ documentId, document }: DocumentEditorBodyProps) {
|
|
|
775
779
|
// the debounce and the next save, reading the previous content.
|
|
776
780
|
// Pulls remain driven by the polling refetch in useDocumentSyncStatus.
|
|
777
781
|
if (autoSync) {
|
|
778
|
-
const status = queryClient.getQueryData<DocumentSyncStatus>(
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
]);
|
|
782
|
+
const status = queryClient.getQueryData<DocumentSyncStatus>(
|
|
783
|
+
documentSyncStatusQueryKey(documentId, { autoSync }),
|
|
784
|
+
);
|
|
782
785
|
if (status?.pageId && !status.hasConflict) {
|
|
783
786
|
try {
|
|
784
|
-
const
|
|
785
|
-
|
|
786
|
-
|
|
787
|
+
const next = await pushDocumentToNotion.mutateAsync({
|
|
788
|
+
documentId,
|
|
789
|
+
});
|
|
790
|
+
queryClient.setQueryData(
|
|
791
|
+
documentSyncStatusQueryKey(documentId, { autoSync }),
|
|
792
|
+
next,
|
|
787
793
|
);
|
|
788
|
-
if (res.ok) {
|
|
789
|
-
const next = (await res.json()) as DocumentSyncStatus;
|
|
790
|
-
queryClient.setQueryData(["document-sync", documentId], next);
|
|
791
|
-
}
|
|
792
794
|
} catch {
|
|
793
795
|
// Non-fatal — next polling refetch will surface any error.
|
|
794
796
|
}
|
|
@@ -803,6 +805,7 @@ function DocumentEditorBody({ documentId, document }: DocumentEditorBodyProps) {
|
|
|
803
805
|
autoSync,
|
|
804
806
|
isLinkedLocalSourceDocument,
|
|
805
807
|
persistDocumentUpdates,
|
|
808
|
+
pushDocumentToNotion,
|
|
806
809
|
queryClient,
|
|
807
810
|
],
|
|
808
811
|
);
|