@agent-native/core 0.90.1 → 0.90.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +26 -0
- package/corpus/core/docs/content/agent-native-toolkit.mdx +87 -80
- package/corpus/core/docs/content/locales/ar-SA/agent-native-toolkit.mdx +89 -80
- package/corpus/core/docs/content/locales/de-DE/agent-native-toolkit.mdx +89 -80
- package/corpus/core/docs/content/locales/es-ES/agent-native-toolkit.mdx +89 -80
- package/corpus/core/docs/content/locales/fr-FR/agent-native-toolkit.mdx +89 -80
- package/corpus/core/docs/content/locales/hi-IN/agent-native-toolkit.mdx +89 -80
- package/corpus/core/docs/content/locales/ja-JP/agent-native-toolkit.mdx +89 -80
- package/corpus/core/docs/content/locales/ko-KR/agent-native-toolkit.mdx +89 -80
- package/corpus/core/docs/content/locales/pt-BR/agent-native-toolkit.mdx +89 -80
- package/corpus/core/docs/content/locales/zh-CN/agent-native-toolkit.mdx +89 -80
- package/corpus/core/docs/content/locales/zh-TW/agent-native-toolkit.mdx +89 -80
- package/corpus/core/docs/content/toolkit-agent-ux.mdx +43 -0
- package/corpus/core/docs/content/toolkit-app-adapters.mdx +9 -0
- package/corpus/core/docs/content/toolkit-collaboration-ui.mdx +12 -0
- package/corpus/core/docs/content/toolkit-collaboration.mdx +74 -0
- package/corpus/core/docs/content/toolkit-command-navigation.mdx +106 -0
- package/corpus/core/docs/content/toolkit-comments-review.mdx +98 -0
- package/corpus/core/docs/content/toolkit-history.mdx +95 -0
- package/corpus/core/docs/content/toolkit-observability.mdx +41 -0
- package/corpus/core/docs/content/toolkit-org-team.mdx +80 -0
- package/corpus/core/docs/content/toolkit-resources.mdx +57 -0
- package/corpus/core/docs/content/toolkit-settings.mdx +65 -0
- package/corpus/core/docs/content/toolkit-setup-connections.mdx +109 -0
- package/corpus/core/docs/content/toolkit-sharing-ui.mdx +18 -6
- package/corpus/core/docs/content/toolkit-sharing.mdx +81 -0
- package/corpus/core/docs/content/toolkit-shell-hooks.mdx +9 -0
- package/corpus/core/docs/content/toolkit-ui.mdx +9 -0
- package/corpus/core/package.json +35 -1
- package/corpus/core/src/agent/engine/ai-sdk-engine.ts +19 -1
- package/corpus/core/src/agent/engine/anthropic-engine.ts +25 -1
- package/corpus/core/src/agent/engine/registry.ts +23 -16
- package/corpus/core/src/agent/production-agent.ts +37 -6
- package/corpus/core/src/client/AgentPanel.tsx +1 -1
- package/corpus/core/src/client/command-navigation/index.ts +15 -0
- package/corpus/core/src/client/comments-review/index.ts +1 -0
- package/corpus/core/src/client/history/VersionHistoryPanel.tsx +145 -0
- package/corpus/core/src/client/history/index.ts +18 -0
- package/corpus/core/src/client/history/use-history.ts +86 -0
- package/corpus/core/src/client/index.ts +76 -9
- package/corpus/core/src/client/org/OrgSwitcher.tsx +6 -6
- package/corpus/core/src/client/org/RequireActiveOrg.tsx +2 -2
- package/corpus/core/src/client/org/TeamPage.tsx +3 -3
- package/corpus/core/src/client/org/hooks.ts +32 -0
- package/corpus/core/src/client/org/index.ts +30 -1
- package/corpus/core/src/client/org-team/index.ts +1 -0
- package/corpus/core/src/client/review/ReviewStatusBadge.tsx +39 -0
- package/corpus/core/src/client/review/ReviewThreadPanel.tsx +278 -0
- package/corpus/core/src/client/review/index.ts +25 -0
- package/corpus/core/src/client/review/use-review.ts +114 -0
- package/corpus/core/src/client/rich-markdown-editor/useCollabReconcile.ts +11 -6
- package/corpus/core/src/client/settings/index.ts +11 -1
- package/corpus/core/src/client/setup-connections/BuilderConnectCard.tsx +94 -0
- package/corpus/core/src/client/setup-connections/ProviderReadinessBadge.tsx +73 -0
- package/corpus/core/src/client/setup-connections/SetupConnectionsPage.tsx +94 -0
- package/corpus/core/src/client/setup-connections/index.ts +46 -0
- package/corpus/core/src/client/sharing/ShareButton.tsx +20 -14
- package/corpus/core/src/client/sharing/ShareDialog.tsx +3 -3
- package/corpus/core/src/client/use-action.ts +39 -2
- package/corpus/core/src/client/use-db-sync.ts +44 -18
- package/corpus/core/src/command-navigation/actions.ts +100 -0
- package/corpus/core/src/command-navigation/index.ts +12 -0
- package/corpus/core/src/comments-review/index.ts +1 -0
- package/corpus/core/src/db/create-get-db.ts +32 -2
- package/corpus/core/src/file-upload/builder.ts +24 -3
- package/corpus/core/src/file-upload/types.ts +3 -1
- package/corpus/core/src/history/actions/create-resource-version.ts +89 -0
- package/corpus/core/src/history/actions/get-resource-version.ts +60 -0
- package/corpus/core/src/history/actions/list-resource-history.ts +53 -0
- package/corpus/core/src/history/actions/list-resource-versions.ts +43 -0
- package/corpus/core/src/history/actions/restore-resource-version.ts +96 -0
- package/corpus/core/src/history/index.ts +27 -0
- package/corpus/core/src/history/registry.ts +99 -0
- package/corpus/core/src/history/store.ts +348 -0
- package/corpus/core/src/history/types.ts +69 -0
- package/corpus/core/src/index.ts +10 -0
- package/corpus/core/src/navigation/index.ts +170 -0
- package/corpus/core/src/org/index.ts +8 -0
- package/corpus/core/src/org/permissions.ts +30 -0
- package/corpus/core/src/org-team/index.ts +1 -0
- package/corpus/core/src/private-blob/registry.ts +1 -0
- package/corpus/core/src/review/actions/consume-review-feedback.ts +38 -0
- package/corpus/core/src/review/actions/create-review-comment.ts +107 -0
- package/corpus/core/src/review/actions/delete-review-comment.ts +55 -0
- package/corpus/core/src/review/actions/get-review-feedback.ts +54 -0
- package/corpus/core/src/review/actions/list-review-comments.ts +53 -0
- package/corpus/core/src/review/actions/reply-review-comment.ts +107 -0
- package/corpus/core/src/review/actions/resolve-review-thread.ts +60 -0
- package/corpus/core/src/review/actions/set-review-status.ts +58 -0
- package/corpus/core/src/review/index.ts +36 -0
- package/corpus/core/src/review/mentions.ts +44 -0
- package/corpus/core/src/review/registry.ts +99 -0
- package/corpus/core/src/review/store.ts +687 -0
- package/corpus/core/src/review/types.ts +97 -0
- package/corpus/core/src/server/action-discovery.ts +54 -0
- package/corpus/core/src/server/agent-engine-api-key-route.ts +5 -0
- package/corpus/core/src/server/credential-provider.ts +108 -0
- package/corpus/core/src/server/framework-request-handler.ts +52 -4
- package/corpus/core/src/setup-connections/index.ts +89 -0
- package/corpus/core/src/setup-connections/onboarding.ts +47 -0
- package/corpus/core/src/transcription/builder-transcription.ts +9 -2
- package/corpus/core/src/vite/action-types-plugin.ts +52 -0
- package/corpus/templates/analytics/app/components/layout/Layout.tsx +2 -1
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +2 -2
- package/corpus/templates/analytics/app/global.css +22 -10
- package/corpus/templates/analytics/app/i18n/zh-TW.ts +6 -1
- package/corpus/templates/analytics/app/i18n-data.ts +81 -13
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +2 -2
- package/corpus/templates/analytics/app/pages/analyses/AnalysisDetail.tsx +2 -2
- package/corpus/templates/analytics/app/pages/sessions/SessionDetailPage.tsx +528 -108
- package/corpus/templates/analytics/app/pages/sessions/SessionDevToolsPanel.tsx +466 -183
- package/corpus/templates/analytics/changelog/2026-07-07-session-replays-load-sooner-show-clearer-activity-timelines-.md +6 -0
- package/corpus/templates/assets/.agents/skills/asset-generation/SKILL.md +5 -0
- package/corpus/templates/assets/.agents/skills/logo-composite/SKILL.md +34 -6
- package/corpus/templates/assets/AGENTS.md +23 -4
- package/corpus/templates/assets/actions/_generation-preset-settings.ts +48 -0
- package/corpus/templates/assets/actions/_helpers.ts +8 -1
- package/corpus/templates/assets/actions/_preset-skeleton-validation.ts +64 -0
- package/corpus/templates/assets/actions/create-generation-preset.ts +11 -3
- package/corpus/templates/assets/actions/generate-image-batch.ts +7 -2
- package/corpus/templates/assets/actions/generate-image.ts +342 -25
- package/corpus/templates/assets/actions/get-library.ts +4 -3
- package/corpus/templates/assets/actions/navigate.ts +2 -1
- package/corpus/templates/assets/actions/refresh-generation-run.ts +5 -1
- package/corpus/templates/assets/actions/update-asset.ts +1 -0
- package/corpus/templates/assets/actions/update-generation-preset.ts +8 -1
- package/corpus/templates/assets/actions/view-screen.ts +8 -1
- package/corpus/templates/assets/app/components/generation/GenerationResults.tsx +9 -1
- package/corpus/templates/assets/app/hooks/use-image-model-menu.ts +1 -0
- package/corpus/templates/assets/app/hooks/use-navigation-state.ts +11 -0
- package/corpus/templates/assets/app/i18n/zh-TW.ts +64 -0
- package/corpus/templates/assets/app/i18n-data.ts +650 -0
- package/corpus/templates/assets/app/routes/asset.$id.tsx +2 -1
- package/corpus/templates/assets/app/routes/brand-kits.$id.tsx +44 -33
- package/corpus/templates/assets/app/routes/brand-kits.$id_.presets.$presetId.tsx +1474 -0
- package/corpus/templates/assets/app/routes/library.tsx +43 -1
- package/corpus/templates/assets/server/lib/generation.ts +366 -44
- package/corpus/templates/assets/server/lib/image-processing.ts +252 -0
- package/corpus/templates/assets/server/lib/preset-skeleton.ts +137 -0
- package/corpus/templates/assets/shared/api.ts +47 -0
- package/corpus/templates/brain/app/routes/settings.tsx +2 -2
- package/corpus/templates/calendar/app/components/calendar/AttendeeAutocomplete.tsx +32 -6
- package/corpus/templates/calendar/app/components/calendar/EventDetailPopover.tsx +120 -40
- package/corpus/templates/calendar/app/hooks/use-people.ts +55 -0
- package/corpus/templates/calendar/changelog/2026-07-07-guest-suggestions-now-find-coworkers-from-your-google-worksp.md +6 -0
- package/corpus/templates/calendar/changelog/2026-07-07-zoom-stays-selected-after-connecting-it-from-a-draft-event.md +6 -0
- package/corpus/templates/clips/actions/create-recording.ts +5 -1
- package/corpus/templates/clips/actions/finalize-recording.ts +140 -1
- package/corpus/templates/clips/actions/import-loom-recording.ts +1 -0
- package/corpus/templates/clips/actions/lib/ensure-seekable-video.ts +1 -0
- package/corpus/templates/clips/actions/request-transcript.ts +31 -0
- package/corpus/templates/clips/actions/set-thumbnail.ts +2 -0
- package/corpus/templates/clips/app/components/library/library-layout.tsx +7 -2
- package/corpus/templates/clips/app/components/library/organization-switcher.tsx +2 -2
- package/corpus/templates/clips/app/components/library/sort-menu.tsx +1 -1
- package/corpus/templates/clips/app/components/player/scrubber-position.ts +9 -0
- package/corpus/templates/clips/app/components/player/scrubber.tsx +5 -2
- package/corpus/templates/clips/app/components/player/share-dialog.tsx +69 -41
- package/corpus/templates/clips/app/components/player/video-player.tsx +38 -1
- package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +114 -33
- package/corpus/templates/clips/app/components/sharing/share-ui.tsx +3 -3
- package/corpus/templates/clips/app/components/sharing/slack-share-hint.tsx +9 -19
- package/corpus/templates/clips/app/routes/_app.library._index.tsx +27 -1
- package/corpus/templates/clips/app/routes/r.$recordingId.tsx +9 -3
- package/corpus/templates/clips/app/routes/record.tsx +178 -80
- package/corpus/templates/clips/changelog/2026-07-02-recordings-now-wait-for-storage-media-to-serve-before-finishing.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-07-a-pending-app-update-no-longer-blocks-screen-recording-updat.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-07-chrome-extension-recordings-keep-audio-after-refreshing-tab.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-07-clip-playback-progress-now-starts-and-finishes-at-the-right-times.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-07-sharing-public-clips-now-stays-focused-on-the-normal-link-wi.md +6 -0
- package/corpus/templates/clips/chrome-extension/src/background.ts +18 -0
- package/corpus/templates/clips/chrome-extension/src/offscreen.ts +23 -8
- package/corpus/templates/clips/desktop/src/app.tsx +40 -3
- package/corpus/templates/clips/desktop/src/hooks/useMediaDevices.ts +19 -7
- package/corpus/templates/clips/desktop/src/lib/permissions.ts +2 -0
- package/corpus/templates/clips/desktop/src/lib/updater.ts +25 -2
- package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +7 -0
- package/corpus/templates/clips/server/routes/api/recordings/[recordingId]/thumbnail.post.ts +1 -0
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/abort.post.ts +23 -6
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/chunk.post.ts +28 -3
- package/corpus/templates/clips/server/routes/api/video/[recordingId].get.ts +13 -6
- package/corpus/templates/clips/shared/finalize-recovery.ts +35 -3
- package/corpus/templates/content/AGENTS.md +52 -52
- package/corpus/templates/content/actions/_builder-cms-read-client.ts +188 -8
- package/corpus/templates/content/actions/_builder-docs-client.ts +41 -3
- package/corpus/templates/content/actions/_database-source-utils.ts +998 -160
- package/corpus/templates/content/actions/_database-utils.ts +44 -4
- package/corpus/templates/content/actions/_notion-action-utils.ts +6 -2
- package/corpus/templates/content/actions/add-content-database-source-field-property.ts +23 -1
- package/corpus/templates/content/actions/attach-content-database-source.ts +85 -12
- package/corpus/templates/content/actions/change-content-database-source-role.ts +9 -1
- package/corpus/templates/content/actions/delete-content-database.ts +1 -0
- package/corpus/templates/content/actions/delete-document.ts +337 -52
- package/corpus/templates/content/actions/get-document.ts +11 -2
- package/corpus/templates/content/actions/list-content-databases.ts +57 -9
- package/corpus/templates/content/actions/prepare-builder-source-review.ts +23 -6
- package/corpus/templates/content/actions/refresh-content-database-source.ts +26 -3
- package/corpus/templates/content/actions/restore-content-database.ts +1 -0
- package/corpus/templates/content/actions/update-document.ts +43 -0
- package/corpus/templates/content/app/components/editor/BuilderBodySyncingNotice.tsx +21 -0
- package/corpus/templates/content/app/components/editor/DocumentDatabase.tsx +0 -1
- package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +70 -28
- package/corpus/templates/content/app/components/editor/DocumentProperties.tsx +69 -17
- package/corpus/templates/content/app/components/editor/VisualEditor.tsx +4 -4
- package/corpus/templates/content/app/components/editor/body-hydration.ts +112 -0
- package/corpus/templates/content/app/components/editor/builder-body-hydration-pump.ts +52 -0
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +9076 -2876
- package/corpus/templates/content/app/components/editor/database-sources/BuilderSourceReviewDialog.tsx +41 -1
- package/corpus/templates/content/app/components/editor/extensions/ImageBlock.tsx +36 -11
- package/corpus/templates/content/app/components/editor/previewDocumentSaveController.ts +21 -1
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +11 -1
- package/corpus/templates/content/app/components/sidebar/DocumentTreeItem.tsx +11 -8
- package/corpus/templates/content/app/global.css +41 -0
- package/corpus/templates/content/app/hooks/use-content-database.ts +346 -42
- package/corpus/templates/content/app/hooks/use-db-sync.ts +9 -0
- package/corpus/templates/content/app/hooks/use-documents.ts +47 -0
- package/corpus/templates/content/app/hooks/use-notion.ts +12 -10
- package/corpus/templates/content/app/i18n/zh-TW.ts +35 -0
- package/corpus/templates/content/app/i18n-data.ts +355 -0
- package/corpus/templates/content/app/root.tsx +22 -0
- package/corpus/templates/content/changelog/2026-07-01-builder-database-sources-keep-loading-rows-in-the-background.md +6 -0
- package/corpus/templates/content/changelog/2026-07-01-builder-source-attach-starts-with-usable-rows.md +6 -0
- package/corpus/templates/content/changelog/2026-07-01-builder-source-attachment-now-stays-connected-after-large.md +6 -0
- package/corpus/templates/content/changelog/2026-07-01-builder-source-refreshes-now-show-progress-for-large-docs-blog.md +6 -0
- package/corpus/templates/content/changelog/2026-07-01-database-pages-now-delete-to-trash-without-route-errors.md +6 -0
- package/corpus/templates/content/changelog/2026-07-02-builder-source-refreshes-recover-from-stalled-background-row.md +6 -0
- package/corpus/templates/content/changelog/2026-07-02-builder-sourced-rows-open-with-sync-protection.md +6 -0
- package/corpus/templates/content/changelog/2026-07-02-database-rows-and-pages-open-faster-from-recently-loaded-dat.md +6 -0
- package/corpus/templates/content/changelog/2026-07-02-preview-panels-close-reliably-narrow-sidebar-row-actions-sta.md +6 -0
- package/corpus/templates/content/changelog/2026-07-06-builder-sync-progress-no-longer-shows-continue.md +6 -0
- package/corpus/templates/content/changelog/2026-07-07-permanently-deleting-trashed-databases-now-finishes-reliably.md +6 -0
- package/corpus/templates/content/shared/api.ts +13 -0
- package/corpus/templates/content/shared/builder-mdx.ts +16 -3
- package/corpus/templates/design/.agents/skills/design-generation/SKILL.md +23 -13
- package/corpus/templates/design/.agents/skills/responsive-breakpoints/SKILL.md +98 -0
- package/corpus/templates/design/.agents/skills/shader-fills/SKILL.md +162 -0
- package/corpus/templates/design/AGENTS.md +9 -2
- package/corpus/templates/design/actions/add-breakpoint.ts +6 -3
- package/corpus/templates/design/actions/apply-a11y-fix.ts +57 -37
- package/corpus/templates/design/actions/apply-component-prop-edit.ts +41 -20
- package/corpus/templates/design/actions/apply-motion-edit.ts +251 -38
- package/corpus/templates/design/actions/apply-shader-fill.ts +90 -66
- package/corpus/templates/design/actions/apply-visual-edit.ts +282 -55
- package/corpus/templates/design/actions/create-component.ts +29 -60
- package/corpus/templates/design/actions/create-file.ts +9 -2
- package/corpus/templates/design/actions/duplicate-design.ts +31 -2
- package/corpus/templates/design/actions/edit-design.ts +36 -38
- package/corpus/templates/design/actions/generate-design-title.ts +87 -0
- package/corpus/templates/design/actions/generate-design.ts +53 -18
- package/corpus/templates/design/actions/generate-screens.ts +108 -4
- package/corpus/templates/design/actions/get-motion-timeline.ts +35 -7
- package/corpus/templates/design/actions/insert-asset.ts +34 -29
- package/corpus/templates/design/actions/insert-design-native-asset.ts +129 -32
- package/corpus/templates/design/actions/insert-figma-library-asset.ts +35 -30
- package/corpus/templates/design/actions/present-design-variants.ts +7 -2
- package/corpus/templates/design/actions/remove-motion-timeline.ts +31 -36
- package/corpus/templates/design/actions/update-file.ts +190 -75
- package/corpus/templates/design/app/components/design/BreakpointBar.tsx +403 -0
- package/corpus/templates/design/app/components/design/CanvasContextMenu.tsx +469 -222
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +708 -53
- package/corpus/templates/design/app/components/design/DesignExtensionsPanel.tsx +83 -3
- package/corpus/templates/design/app/components/design/EditPanel.tsx +1091 -6948
- package/corpus/templates/design/app/components/design/LayersPanel.tsx +419 -85
- package/corpus/templates/design/app/components/design/MotionDock.tsx +1124 -103
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +2610 -1398
- package/corpus/templates/design/app/components/design/ReadOnlyDesignBanner.tsx +22 -0
- package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +2182 -235
- package/corpus/templates/design/app/components/design/bridge/motion-preview.bridge.ts +187 -11
- package/corpus/templates/design/app/components/design/bridge/shader-fill-preview.bridge.ts +376 -1
- package/corpus/templates/design/app/components/design/bridge/shader-runtime.bridge.ts +746 -0
- package/corpus/templates/design/app/components/design/canvas-primitive-style.ts +17 -0
- package/corpus/templates/design/app/components/design/code-workbench/SideBar.tsx +1 -1
- package/corpus/templates/design/app/components/design/code-workbench/explorer/FileTree.tsx +1 -3
- package/corpus/templates/design/app/components/design/code-workbench/quickinput/QuickInput.tsx +1 -1
- package/corpus/templates/design/app/components/design/edit-panel/appearance-properties.tsx +518 -0
- package/corpus/templates/design/app/components/design/edit-panel/code-inspect-helpers.tsx +562 -0
- package/corpus/templates/design/app/components/design/edit-panel/component-section.tsx +763 -0
- package/corpus/templates/design/app/components/design/edit-panel/document-colors.ts +94 -0
- package/corpus/templates/design/app/components/design/edit-panel/effects-properties.tsx +780 -0
- package/corpus/templates/design/app/components/design/edit-panel/element-classification.ts +446 -0
- package/corpus/templates/design/app/components/design/edit-panel/element-identity.ts +79 -0
- package/corpus/templates/design/app/components/design/edit-panel/field-primitives.tsx +315 -0
- package/corpus/templates/design/app/components/design/edit-panel/fill-gradient-helpers.ts +344 -0
- package/corpus/templates/design/app/components/design/edit-panel/fill-properties.tsx +594 -0
- package/corpus/templates/design/app/components/design/edit-panel/frame-presets-panel.tsx +119 -0
- package/corpus/templates/design/app/components/design/edit-panel/inspector-controls.tsx +248 -0
- package/corpus/templates/design/app/components/design/edit-panel/interaction-state-helpers.ts +45 -0
- package/corpus/templates/design/app/components/design/edit-panel/layout-properties.tsx +693 -0
- package/corpus/templates/design/app/components/design/edit-panel/panel-primitives.tsx +724 -0
- package/corpus/templates/design/app/components/design/edit-panel/position-helpers.ts +207 -0
- package/corpus/templates/design/app/components/design/edit-panel/position-layout-properties.tsx +628 -0
- package/corpus/templates/design/app/components/design/edit-panel/selection-helpers.ts +91 -0
- package/corpus/templates/design/app/components/design/edit-panel/stroke-properties.tsx +649 -0
- package/corpus/templates/design/app/components/design/edit-panel/style-change-types.ts +118 -0
- package/corpus/templates/design/app/components/design/edit-panel/style-options.ts +88 -0
- package/corpus/templates/design/app/components/design/edit-panel/transform-helpers.ts +100 -0
- package/corpus/templates/design/app/components/design/edit-panel/typography-helpers.ts +117 -0
- package/corpus/templates/design/app/components/design/edit-panel/typography-properties.tsx +501 -0
- package/corpus/templates/design/app/components/design/inspector/AutoLayoutMatrix.tsx +91 -40
- package/corpus/templates/design/app/components/design/inspector/BreakpointOverrideIndicator.tsx +82 -0
- package/corpus/templates/design/app/components/design/inspector/DesignColorPicker.tsx +189 -87
- package/corpus/templates/design/app/components/design/inspector/GlslShaderPanel.tsx +1097 -0
- package/corpus/templates/design/app/components/design/inspector/GradientEditor.tsx +44 -0
- package/corpus/templates/design/app/components/design/inspector/InteractionStatePanel.tsx +258 -0
- package/corpus/templates/design/app/components/design/inspector/MotionKeyframeDiamond.tsx +144 -0
- package/corpus/templates/design/app/components/design/inspector/ScrubInput.tsx +99 -9
- package/corpus/templates/design/app/components/design/inspector/frame-size-presets.ts +116 -0
- package/corpus/templates/design/app/components/design/inspector/index.ts +26 -0
- package/corpus/templates/design/app/components/design/inspector/scrub-input-utils.ts +29 -0
- package/corpus/templates/design/app/components/design/multi-screen/alt-hover-measurement.ts +171 -0
- package/corpus/templates/design/app/components/design/multi-screen/board-surface-html.ts +220 -0
- package/corpus/templates/design/app/components/design/multi-screen/chrome-transitions.ts +35 -0
- package/corpus/templates/design/app/components/design/multi-screen/cross-screen-drop.ts +134 -0
- package/corpus/templates/design/app/components/design/multi-screen/culling.ts +185 -0
- package/corpus/templates/design/app/components/design/multi-screen/gradient-overlay-geometry.ts +120 -0
- package/corpus/templates/design/app/components/design/multi-screen/types.ts +892 -0
- package/corpus/templates/design/app/components/design/multi-screen/vector-edit-geometry.ts +21 -0
- package/corpus/templates/design/app/components/design/types.ts +15 -0
- package/corpus/templates/design/app/components/editor/PromptDialog.tsx +109 -5
- package/corpus/templates/design/app/global.css +8 -8
- package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +259 -2
- package/corpus/templates/design/app/i18n/zh-TW.ts +163 -9
- package/corpus/templates/design/app/i18n-breakpoints.ts +205 -0
- package/corpus/templates/design/app/i18n-data.ts +1664 -152
- package/corpus/templates/design/app/i18n-motion.ts +563 -0
- package/corpus/templates/design/app/lib/design-import.ts +73 -0
- package/corpus/templates/design/app/pages/Index.tsx +41 -22
- package/corpus/templates/design/changelog/2026-06-29-design-inspector-controls-now-match-figmas-softer-dark-chrome.md +1 -1
- package/corpus/templates/design/changelog/2026-06-30-design-now-has-a-figma-style-left-rail-for-file-agent-assets.md +1 -1
- package/corpus/templates/design/changelog/2026-06-30-design-tools-now-use-a-quieter-figma-style-list-layout.md +1 -1
- package/corpus/templates/design/changelog/2026-06-30-multi-select-outlines-now-stay-consistent-across-all-screens.md +1 -1
- package/corpus/templates/design/changelog/2026-07-03-canvas-interactions-now-match-figma-rotation-aware-resizing-.md +1 -1
- package/corpus/templates/design/changelog/2026-07-03-layers-panel-matches-figma-top-layer-on-top-drag-with-auto-s.md +1 -1
- package/corpus/templates/design/changelog/2026-07-05-designs-get-ai-generated-names-from-your-prompt.md +6 -0
- package/corpus/templates/design/changelog/2026-07-05-local-code-screens-keep-their-connection-when-duplicated-and.md +6 -0
- package/corpus/templates/design/changelog/2026-07-05-press-a-to-draw-screens-on-the-canvas-inside-a-screen-it-dr.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-3d-rotation-and-perspective-controls-on-every-element.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-ai-generated-and-duplicated-screens-now-get-their-editor-sel.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-applying-shaders-and-fills-in-quick-succession-can-no-longer.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-breakpoint-frames-in-the-overview-now-support-click-to-selec.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-breakpoint-segments-in-the-inspector-now-show-a-device-icon-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-breakpoint-targeting-now-lives-in-one-compact-control-in-the.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-canvas-edits-can-no-longer-be-overwritten-by-stale-collabora.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-canvas-edits-inside-screens-save-reliably-again.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-cleaner-inspector-removed-the-ask-ai-box-from-the-design-tab.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-clicking-empty-canvas-space-now-deselects-an-element-inside-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-dragging-an-element-onto-a-rectangle-now-nests-it-inside-wit.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-dragging-screens-and-objects-on-the-canvas-is-now-much-smoot.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-drawing-a-shape-or-text-on-the-canvas-no-longer-flashes-away.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-dropping-an-element-between-two-others-inside-a-screen-now-s.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-duplicating-a-screen-now-places-the-copy-exactly-where-you-d.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-edit-gradients-directly-on-elements-inside-screens-scale-str.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-edits-from-collaborators-and-the-agent-now-update-the-canvas.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-fixed-a-bug-where-most-style-position-and-text-edits-briefly.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-fixed-a-confusing-raw-error-message-when-a-file-upload-fails.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-fixed-a-rare-case-where-an-edit-could-be-silently-overwritte.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-fixed-inserted-assets-sometimes-disappearing-reappearing-or-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-fixed-inspector-value-scrubbing-producing-erratic-numbers-an.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-fixed-padding-gap-and-min-max-size-scrubbing-not-updating-th.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-fixed-text-stroke-color-turning-black-and-glyphs-disappearin.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-fixed-the-collapsed-effects-and-stroke-inspector-sections-sh.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-fixed-the-new-design-dialog-closing-unexpectedly-when-using-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-fixed-the-typography-section-missing-when-selecting-text-nes.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-full-view-no-longer-flashes-back-to-the-overview-on-entry-no.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-keyframe-animation-timeline-per-property-keyframes-easing-cu.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-moving-restyling-and-scrubbing-values-on-elements-in-ai-gene.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-padding-and-corner-radius-value-scrubbing-now-snaps-to-whole.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-padding-handles-now-only-resize-on-the-handle-line-itself-sh.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-preview-and-edit-hover-focus-and-pressed-states-with-real-cs.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-promoting-an-element-to-a-component-now-works-correctly-for-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-reduced-url-history-churn-and-selection-overlay-flicker-whil.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-removed-the-decorative-dot-before-screen-names-in-the-overvi.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-responsive-breakpoints-edit-at-any-width-with-cascading-over.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-screen-labels-no-longer-turn-blue-when-you-hover-inside-the-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-scrolling-a-screen-with-an-element-selected-stays-smooth-on-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-selecting-multiple-elements-and-dragging-now-moves-the-whole.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-selection-borders-handles-and-value-readouts-now-stay-the-sa.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-selection-handles-and-editing-chrome-now-stay-a-constant-siz.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-shader-fills-and-effects-ai-authored-or-preset-glsl-shaders-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-text-drawn-on-the-canvas-now-defaults-to-white-and-inter-in-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-text-dropped-into-a-shape-now-stays-readable-instead-of-disa.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-the-add-tweak-controls-prompt-no-longer-jumps-to-the-corner-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-the-padding-value-readout-now-stays-visible-while-you-hover-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-the-selected-element-attachment-now-clears-from-the-chat-com.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-the-zoom-menu-is-more-compact-with-tight-rows-and-right-alig.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-undo-and-redo-no-longer-flash-the-screen-changes-now-apply-i.md +6 -0
- package/corpus/templates/design/changelog/2026-07-06-zoom-presets-like-zoom-to-50-now-stay-on-the-focused-screen-.md +6 -0
- package/corpus/templates/design/server/lib/import-design-files.ts +11 -2
- package/corpus/templates/design/server/source-workspace.ts +139 -59
- package/corpus/templates/design/shared/board-file.ts +11 -2
- package/corpus/templates/design/shared/breakpoint-media.ts +543 -0
- package/corpus/templates/design/shared/canvas-math.ts +354 -35
- package/corpus/templates/design/shared/code-layer.ts +277 -8
- package/corpus/templates/design/shared/design-state.ts +11 -4
- package/corpus/templates/design/shared/interaction-states.ts +548 -0
- package/corpus/templates/design/shared/motion-compiler.ts +186 -23
- package/corpus/templates/design/shared/motion-easing.ts +294 -0
- package/corpus/templates/design/shared/motion-timeline.ts +400 -34
- package/corpus/templates/design/shared/prompt-title.ts +95 -0
- package/corpus/templates/design/shared/responsive-classes.ts +448 -10
- package/corpus/templates/design/shared/screen-annotation.ts +46 -0
- package/corpus/templates/design/shared/shader-fills.ts +1009 -0
- package/corpus/templates/design/shared/shader-presets.ts +852 -4
- package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +15 -2
- package/corpus/templates/slides/app/components/editor/ImportButton.tsx +10 -1
- package/corpus/templates/slides/app/lib/upload-response.ts +71 -0
- package/corpus/templates/slides/app/pages/DeckEditor.tsx +2 -2
- package/dist/agent/engine/ai-sdk-engine.d.ts.map +1 -1
- package/dist/agent/engine/ai-sdk-engine.js +15 -1
- package/dist/agent/engine/ai-sdk-engine.js.map +1 -1
- package/dist/agent/engine/anthropic-engine.d.ts.map +1 -1
- package/dist/agent/engine/anthropic-engine.js +20 -1
- package/dist/agent/engine/anthropic-engine.js.map +1 -1
- package/dist/agent/engine/registry.d.ts.map +1 -1
- package/dist/agent/engine/registry.js +22 -14
- package/dist/agent/engine/registry.js.map +1 -1
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +27 -7
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/client/AgentPanel.js +1 -1
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/command-navigation/index.d.ts +4 -0
- package/dist/client/command-navigation/index.d.ts.map +1 -0
- package/dist/client/command-navigation/index.js +4 -0
- package/dist/client/command-navigation/index.js.map +1 -0
- package/dist/client/comments-review/index.d.ts +2 -0
- package/dist/client/comments-review/index.d.ts.map +1 -0
- package/dist/client/comments-review/index.js +2 -0
- package/dist/client/comments-review/index.js.map +1 -0
- package/dist/client/history/VersionHistoryPanel.d.ts +18 -0
- package/dist/client/history/VersionHistoryPanel.d.ts.map +1 -0
- package/dist/client/history/VersionHistoryPanel.js +24 -0
- package/dist/client/history/VersionHistoryPanel.js.map +1 -0
- package/dist/client/history/index.d.ts +3 -0
- package/dist/client/history/index.d.ts.map +1 -0
- package/dist/client/history/index.js +3 -0
- package/dist/client/history/index.js.map +1 -0
- package/dist/client/history/use-history.d.ts +46 -0
- package/dist/client/history/use-history.d.ts.map +1 -0
- package/dist/client/history/use-history.js +18 -0
- package/dist/client/history/use-history.js.map +1 -0
- package/dist/client/index.d.ts +6 -4
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +6 -4
- package/dist/client/index.js.map +1 -1
- package/dist/client/org/OrgSwitcher.js +5 -5
- package/dist/client/org/OrgSwitcher.js.map +1 -1
- package/dist/client/org/RequireActiveOrg.js +2 -2
- package/dist/client/org/RequireActiveOrg.js.map +1 -1
- package/dist/client/org/TeamPage.js +3 -3
- package/dist/client/org/TeamPage.js.map +1 -1
- package/dist/client/org/hooks.d.ts +12 -1
- package/dist/client/org/hooks.d.ts.map +1 -1
- package/dist/client/org/hooks.js +15 -0
- package/dist/client/org/hooks.js.map +1 -1
- package/dist/client/org/index.d.ts +4 -2
- package/dist/client/org/index.d.ts.map +1 -1
- package/dist/client/org/index.js +3 -1
- package/dist/client/org/index.js.map +1 -1
- package/dist/client/org-team/index.d.ts +2 -0
- package/dist/client/org-team/index.d.ts.map +1 -0
- package/dist/client/org-team/index.js +2 -0
- package/dist/client/org-team/index.js.map +1 -0
- package/dist/client/review/ReviewStatusBadge.d.ts +7 -0
- package/dist/client/review/ReviewStatusBadge.d.ts.map +1 -0
- package/dist/client/review/ReviewStatusBadge.js +19 -0
- package/dist/client/review/ReviewStatusBadge.js.map +1 -0
- package/dist/client/review/ReviewThreadPanel.d.ts +20 -0
- package/dist/client/review/ReviewThreadPanel.d.ts.map +1 -0
- package/dist/client/review/ReviewThreadPanel.js +84 -0
- package/dist/client/review/ReviewThreadPanel.js.map +1 -0
- package/dist/client/review/index.d.ts +4 -0
- package/dist/client/review/index.d.ts.map +1 -0
- package/dist/client/review/index.js +4 -0
- package/dist/client/review/index.js.map +1 -0
- package/dist/client/review/use-review.d.ts +68 -0
- package/dist/client/review/use-review.d.ts.map +1 -0
- package/dist/client/review/use-review.js +22 -0
- package/dist/client/review/use-review.js.map +1 -0
- package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts.map +1 -1
- package/dist/client/rich-markdown-editor/useCollabReconcile.js +11 -6
- package/dist/client/rich-markdown-editor/useCollabReconcile.js.map +1 -1
- package/dist/client/settings/index.d.ts +1 -1
- package/dist/client/settings/index.d.ts.map +1 -1
- package/dist/client/settings/index.js +1 -1
- package/dist/client/settings/index.js.map +1 -1
- package/dist/client/setup-connections/BuilderConnectCard.d.ts +9 -0
- package/dist/client/setup-connections/BuilderConnectCard.d.ts.map +1 -0
- package/dist/client/setup-connections/BuilderConnectCard.js +25 -0
- package/dist/client/setup-connections/BuilderConnectCard.js.map +1 -0
- package/dist/client/setup-connections/ProviderReadinessBadge.d.ts +8 -0
- package/dist/client/setup-connections/ProviderReadinessBadge.d.ts.map +1 -0
- package/dist/client/setup-connections/ProviderReadinessBadge.js +32 -0
- package/dist/client/setup-connections/ProviderReadinessBadge.js.map +1 -0
- package/dist/client/setup-connections/SetupConnectionsPage.d.ts +17 -0
- package/dist/client/setup-connections/SetupConnectionsPage.d.ts.map +1 -0
- package/dist/client/setup-connections/SetupConnectionsPage.js +10 -0
- package/dist/client/setup-connections/SetupConnectionsPage.js.map +1 -0
- package/dist/client/setup-connections/index.d.ts +7 -0
- package/dist/client/setup-connections/index.d.ts.map +1 -0
- package/dist/client/setup-connections/index.js +7 -0
- package/dist/client/setup-connections/index.js.map +1 -0
- package/dist/client/sharing/ShareButton.d.ts +4 -4
- package/dist/client/sharing/ShareButton.d.ts.map +1 -1
- package/dist/client/sharing/ShareButton.js +13 -7
- package/dist/client/sharing/ShareButton.js.map +1 -1
- package/dist/client/sharing/ShareDialog.js +3 -3
- package/dist/client/sharing/ShareDialog.js.map +1 -1
- package/dist/client/use-action.d.ts +3 -0
- package/dist/client/use-action.d.ts.map +1 -1
- package/dist/client/use-action.js +34 -3
- package/dist/client/use-action.js.map +1 -1
- package/dist/client/use-db-sync.d.ts +4 -0
- package/dist/client/use-db-sync.d.ts.map +1 -1
- package/dist/client/use-db-sync.js +37 -18
- package/dist/client/use-db-sync.js.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/command-navigation/actions.d.ts +25 -0
- package/dist/command-navigation/actions.d.ts.map +1 -0
- package/dist/command-navigation/actions.js +64 -0
- package/dist/command-navigation/actions.js.map +1 -0
- package/dist/command-navigation/index.d.ts +4 -0
- package/dist/command-navigation/index.d.ts.map +1 -0
- package/dist/command-navigation/index.js +4 -0
- package/dist/command-navigation/index.js.map +1 -0
- package/dist/comments-review/index.d.ts +2 -0
- package/dist/comments-review/index.d.ts.map +1 -0
- package/dist/comments-review/index.js +2 -0
- package/dist/comments-review/index.js.map +1 -0
- package/dist/db/create-get-db.d.ts +25 -0
- package/dist/db/create-get-db.d.ts.map +1 -1
- package/dist/db/create-get-db.js +25 -2
- package/dist/db/create-get-db.js.map +1 -1
- package/dist/file-upload/builder.d.ts.map +1 -1
- package/dist/file-upload/builder.js +18 -2
- package/dist/file-upload/builder.js.map +1 -1
- package/dist/file-upload/types.d.ts +3 -0
- package/dist/file-upload/types.d.ts.map +1 -1
- package/dist/file-upload/types.js.map +1 -1
- package/dist/history/actions/create-resource-version.d.ts +10 -0
- package/dist/history/actions/create-resource-version.d.ts.map +1 -0
- package/dist/history/actions/create-resource-version.js +65 -0
- package/dist/history/actions/create-resource-version.js.map +1 -0
- package/dist/history/actions/get-resource-version.d.ts +10 -0
- package/dist/history/actions/get-resource-version.d.ts.map +1 -0
- package/dist/history/actions/get-resource-version.js +38 -0
- package/dist/history/actions/get-resource-version.js.map +1 -0
- package/dist/history/actions/list-resource-history.d.ts +10 -0
- package/dist/history/actions/list-resource-history.d.ts.map +1 -0
- package/dist/history/actions/list-resource-history.js +45 -0
- package/dist/history/actions/list-resource-history.js.map +1 -0
- package/dist/history/actions/list-resource-versions.d.ts +10 -0
- package/dist/history/actions/list-resource-versions.d.ts.map +1 -0
- package/dist/history/actions/list-resource-versions.js +35 -0
- package/dist/history/actions/list-resource-versions.js.map +1 -0
- package/dist/history/actions/restore-resource-version.d.ts +11 -0
- package/dist/history/actions/restore-resource-version.d.ts.map +1 -0
- package/dist/history/actions/restore-resource-version.js +59 -0
- package/dist/history/actions/restore-resource-version.js.map +1 -0
- package/dist/history/index.d.ts +4 -0
- package/dist/history/index.d.ts.map +1 -0
- package/dist/history/index.js +3 -0
- package/dist/history/index.js.map +1 -0
- package/dist/history/registry.d.ts +10 -0
- package/dist/history/registry.d.ts.map +1 -0
- package/dist/history/registry.js +61 -0
- package/dist/history/registry.js.map +1 -0
- package/dist/history/store.d.ts +34 -0
- package/dist/history/store.d.ts.map +1 -0
- package/dist/history/store.js +265 -0
- package/dist/history/store.js.map +1 -0
- package/dist/history/types.d.ts +55 -0
- package/dist/history/types.d.ts.map +1 -0
- package/dist/history/types.js +2 -0
- package/dist/history/types.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/navigation/index.d.ts +53 -0
- package/dist/navigation/index.d.ts.map +1 -0
- package/dist/navigation/index.js +105 -0
- package/dist/navigation/index.js.map +1 -0
- package/dist/observability/routes.d.ts +3 -3
- package/dist/org/index.d.ts +1 -0
- package/dist/org/index.d.ts.map +1 -1
- package/dist/org/index.js +1 -0
- package/dist/org/index.js.map +1 -1
- package/dist/org/permissions.d.ts +7 -0
- package/dist/org/permissions.d.ts.map +1 -0
- package/dist/org/permissions.js +21 -0
- package/dist/org/permissions.js.map +1 -0
- package/dist/org-team/index.d.ts +2 -0
- package/dist/org-team/index.d.ts.map +1 -0
- package/dist/org-team/index.js +2 -0
- package/dist/org-team/index.js.map +1 -0
- package/dist/private-blob/registry.d.ts.map +1 -1
- package/dist/private-blob/registry.js +1 -0
- package/dist/private-blob/registry.js.map +1 -1
- package/dist/resources/handlers.d.ts +2 -2
- package/dist/review/actions/consume-review-feedback.d.ts +9 -0
- package/dist/review/actions/consume-review-feedback.d.ts.map +1 -0
- package/dist/review/actions/consume-review-feedback.js +29 -0
- package/dist/review/actions/consume-review-feedback.js.map +1 -0
- package/dist/review/actions/create-review-comment.d.ts +18 -0
- package/dist/review/actions/create-review-comment.d.ts.map +1 -0
- package/dist/review/actions/create-review-comment.js +81 -0
- package/dist/review/actions/create-review-comment.js.map +1 -0
- package/dist/review/actions/delete-review-comment.d.ts +10 -0
- package/dist/review/actions/delete-review-comment.d.ts.map +1 -0
- package/dist/review/actions/delete-review-comment.js +45 -0
- package/dist/review/actions/delete-review-comment.js.map +1 -0
- package/dist/review/actions/get-review-feedback.d.ts +10 -0
- package/dist/review/actions/get-review-feedback.d.ts.map +1 -0
- package/dist/review/actions/get-review-feedback.js +45 -0
- package/dist/review/actions/get-review-feedback.js.map +1 -0
- package/dist/review/actions/list-review-comments.d.ts +13 -0
- package/dist/review/actions/list-review-comments.d.ts.map +1 -0
- package/dist/review/actions/list-review-comments.js +44 -0
- package/dist/review/actions/list-review-comments.js.map +1 -0
- package/dist/review/actions/reply-review-comment.d.ts +16 -0
- package/dist/review/actions/reply-review-comment.d.ts.map +1 -0
- package/dist/review/actions/reply-review-comment.js +84 -0
- package/dist/review/actions/reply-review-comment.js.map +1 -0
- package/dist/review/actions/resolve-review-thread.d.ts +11 -0
- package/dist/review/actions/resolve-review-thread.d.ts.map +1 -0
- package/dist/review/actions/resolve-review-thread.js +46 -0
- package/dist/review/actions/resolve-review-thread.js.map +1 -0
- package/dist/review/actions/set-review-status.d.ts +9 -0
- package/dist/review/actions/set-review-status.d.ts.map +1 -0
- package/dist/review/actions/set-review-status.js +43 -0
- package/dist/review/actions/set-review-status.js.map +1 -0
- package/dist/review/index.d.ts +5 -0
- package/dist/review/index.d.ts.map +1 -0
- package/dist/review/index.js +4 -0
- package/dist/review/index.js.map +1 -0
- package/dist/review/mentions.d.ts +4 -0
- package/dist/review/mentions.d.ts.map +1 -0
- package/dist/review/mentions.js +39 -0
- package/dist/review/mentions.js.map +1 -0
- package/dist/review/registry.d.ts +10 -0
- package/dist/review/registry.d.ts.map +1 -0
- package/dist/review/registry.js +61 -0
- package/dist/review/registry.js.map +1 -0
- package/dist/review/store.d.ts +63 -0
- package/dist/review/store.d.ts.map +1 -0
- package/dist/review/store.js +558 -0
- package/dist/review/store.js.map +1 -0
- package/dist/review/types.d.ts +77 -0
- package/dist/review/types.d.ts.map +1 -0
- package/dist/review/types.js +2 -0
- package/dist/review/types.js.map +1 -0
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/action-discovery.d.ts.map +1 -1
- package/dist/server/action-discovery.js +54 -0
- package/dist/server/action-discovery.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts.map +1 -1
- package/dist/server/agent-engine-api-key-route.js +5 -0
- package/dist/server/agent-engine-api-key-route.js.map +1 -1
- package/dist/server/credential-provider.d.ts +26 -0
- package/dist/server/credential-provider.d.ts.map +1 -1
- package/dist/server/credential-provider.js +82 -0
- package/dist/server/credential-provider.js.map +1 -1
- package/dist/server/framework-request-handler.d.ts.map +1 -1
- package/dist/server/framework-request-handler.js +37 -1
- package/dist/server/framework-request-handler.js.map +1 -1
- package/dist/setup-connections/index.d.ts +6 -0
- package/dist/setup-connections/index.d.ts.map +1 -0
- package/dist/setup-connections/index.js +6 -0
- package/dist/setup-connections/index.js.map +1 -0
- package/dist/setup-connections/onboarding.d.ts +14 -0
- package/dist/setup-connections/onboarding.d.ts.map +1 -0
- package/dist/setup-connections/onboarding.js +23 -0
- package/dist/setup-connections/onboarding.js.map +1 -0
- package/dist/transcription/builder-transcription.d.ts +1 -0
- package/dist/transcription/builder-transcription.d.ts.map +1 -1
- package/dist/transcription/builder-transcription.js +5 -2
- package/dist/transcription/builder-transcription.js.map +1 -1
- package/dist/vite/action-types-plugin.d.ts.map +1 -1
- package/dist/vite/action-types-plugin.js +52 -0
- package/dist/vite/action-types-plugin.js.map +1 -1
- package/docs/content/agent-native-toolkit.mdx +87 -80
- package/docs/content/locales/ar-SA/agent-native-toolkit.mdx +89 -80
- package/docs/content/locales/de-DE/agent-native-toolkit.mdx +89 -80
- package/docs/content/locales/es-ES/agent-native-toolkit.mdx +89 -80
- package/docs/content/locales/fr-FR/agent-native-toolkit.mdx +89 -80
- package/docs/content/locales/hi-IN/agent-native-toolkit.mdx +89 -80
- package/docs/content/locales/ja-JP/agent-native-toolkit.mdx +89 -80
- package/docs/content/locales/ko-KR/agent-native-toolkit.mdx +89 -80
- package/docs/content/locales/pt-BR/agent-native-toolkit.mdx +89 -80
- package/docs/content/locales/zh-CN/agent-native-toolkit.mdx +89 -80
- package/docs/content/locales/zh-TW/agent-native-toolkit.mdx +89 -80
- package/docs/content/toolkit-agent-ux.mdx +43 -0
- package/docs/content/toolkit-app-adapters.mdx +9 -0
- package/docs/content/toolkit-collaboration-ui.mdx +12 -0
- package/docs/content/toolkit-collaboration.mdx +74 -0
- package/docs/content/toolkit-command-navigation.mdx +106 -0
- package/docs/content/toolkit-comments-review.mdx +98 -0
- package/docs/content/toolkit-history.mdx +95 -0
- package/docs/content/toolkit-observability.mdx +41 -0
- package/docs/content/toolkit-org-team.mdx +80 -0
- package/docs/content/toolkit-resources.mdx +57 -0
- package/docs/content/toolkit-settings.mdx +65 -0
- package/docs/content/toolkit-setup-connections.mdx +109 -0
- package/docs/content/toolkit-sharing-ui.mdx +18 -6
- package/docs/content/toolkit-sharing.mdx +81 -0
- package/docs/content/toolkit-shell-hooks.mdx +9 -0
- package/docs/content/toolkit-ui.mdx +9 -0
- package/package.json +36 -2
- package/corpus/templates/design/app/components/design/inspector/InspectorAiActions.tsx +0 -153
- package/corpus/templates/design/app/hooks/useAgentEditRequest.ts +0 -133
- package/corpus/templates/design/app/pages/DesignEditor.tsx +0 -22924
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShareDialog.js","sourceRoot":"","sources":["../../../src/client/sharing/ShareDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACjD,OAAO,EACL,KAAK,EACL,SAAS,EACT,QAAQ,EACR,YAAY,E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,CACL,oCAEE,SAAS,EAAC,gIAAgI,YAEzI,GAAG,CAAC,CAAC,CAAC,CACL,KAAC,YAAY,IAAC,IAAI,EAAE,EAAE,EAAE,WAAW,EAAE,IAAI,GAAI,CAC9C,CAAC,CAAC,CAAC,CACF,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,CAC5D,GACI,CACR,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,QAAiB;IAC3C,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC9B,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO,SAAS,CAAC;IACpD,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;AAC9B,CAAC;AAED,SAAS,GAAG,CAAC,CAAS;IACpB,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC","sourcesContent":["import * as Select from \"@radix-ui/react-select\";\nimport {\n IconX,\n IconTrash,\n IconLock,\n IconBuilding,\n IconWorld,\n IconCheck,\n IconCopy,\n IconLink,\n IconMail,\n IconCode,\n IconChevronDown,\n} from \"@tabler/icons-react\";\nimport { useEffect, useState, type ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { agentNativePath } from \"../api-path.js\";\nimport { writeClipboardText } from \"../clipboard.js\";\nimport { useT } from \"../i18n.js\";\nimport { useActionQuery, useActionMutation } from \"../use-action.js\";\nimport { cn } from \"../utils.js\";\n\nexport interface ShareDialogProps {\n open: boolean;\n onClose: () => void;\n resourceType: string;\n resourceId: string;\n resourceTitle?: string;\n /**\n * When provided, enables the \"Link\" tab with a copy-link field.\n * Pass the user-facing share URL (e.g. `https://…/share/<id>`).\n */\n shareUrl?: string;\n /**\n * When provided, enables the \"Embed\" tab with a default iframe snippet.\n * For richer per-resource controls (autoplay, start time, responsive /\n * fixed size), pass `embedTabContent` instead (or in addition) — it\n * replaces the default embed body.\n */\n embedUrl?: string;\n /** Advanced: fully custom Embed tab body. Requires `embedUrl` to enable the tab. */\n embedTabContent?: ReactNode;\n /** Extra content appended to the bottom of the Link tab (e.g. download buttons). */\n linkTabExtras?: ReactNode;\n}\n\ntype Visibility = \"private\" | \"org\" | \"public\";\ntype Role = \"viewer\" | \"editor\" | \"admin\";\n\ninterface Share {\n id: string;\n principalType: \"user\" | \"org\";\n principalId: string;\n role: Role;\n}\n\ninterface SharesResponse {\n ownerEmail: string | null;\n orgId: string | null;\n visibility: Visibility | null;\n role?: \"owner\" | Role;\n shares: Share[];\n}\n\ninterface OrgMember {\n email: string;\n name?: string | null;\n}\n\nfunction useOrgMembers(): OrgMember[] {\n const [members, setMembers] = useState<OrgMember[]>([]);\n useEffect(() => {\n let cancelled = false;\n fetch(agentNativePath(\"/_agent-native/org/members\"))\n .then((r) => (r.ok ? r.json() : null))\n .then((data) => {\n if (cancelled || !data) return;\n const list = Array.isArray(data?.members) ? data.members : [];\n setMembers(\n list\n .map((m: any) => ({\n email: typeof m?.email === \"string\" ? m.email : \"\",\n name: typeof m?.name === \"string\" ? m.name : null,\n }))\n .filter((m: OrgMember) => m.email),\n );\n })\n .catch(() => {});\n return () => {\n cancelled = true;\n };\n }, []);\n return members;\n}\n\nfunction displayName(email: string, members: OrgMember[]): string {\n const match = members.find((m) => m.email === email);\n if (match?.name && match.name.trim()) return match.name;\n return email;\n}\n\nconst BUTTON_BASE =\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0\";\nconst BUTTON_OUTLINE_SM = cn(\n BUTTON_BASE,\n \"h-9 px-3 border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n);\nconst BUTTON_PRIMARY_SM = cn(\n BUTTON_BASE,\n \"h-9 px-4 bg-primary text-primary-foreground hover:bg-primary/90\",\n);\nconst BUTTON_GHOST_ICON = cn(\n BUTTON_BASE,\n \"h-8 w-8 p-0 text-muted-foreground hover:bg-accent hover:text-accent-foreground\",\n);\n\nconst VIS_ICONS: Record<Visibility, typeof IconLock> = {\n private: IconLock,\n org: IconBuilding,\n public: IconWorld,\n};\n\nfunction useVisibilityMeta() {\n const t = useT();\n return {\n private: {\n label: t(\"share.private\"),\n description: t(\"share.privateDescription\"),\n Icon: VIS_ICONS.private,\n },\n org: {\n label: t(\"share.organization\"),\n description: t(\"share.organizationDescription\"),\n Icon: VIS_ICONS.org,\n },\n public: {\n label: t(\"share.public\"),\n description: t(\"share.publicDescription\"),\n Icon: VIS_ICONS.public,\n },\n } satisfies Record<\n Visibility,\n { label: string; description: string; Icon: typeof IconLock }\n >;\n}\n\nfunction useRoleOptions() {\n const t = useT();\n return [\n {\n value: \"viewer\",\n label: t(\"share.viewer\"),\n description: t(\"share.viewerDescription\"),\n },\n {\n value: \"editor\",\n label: t(\"share.editor\"),\n description: t(\"share.editorDescription\"),\n },\n {\n value: \"admin\",\n label: t(\"share.admin\"),\n description: t(\"share.adminDescription\"),\n },\n ] satisfies Array<{ value: Role; label: string; description: string }>;\n}\n\n/**\n * Framework share dialog. Drop into any template via\n * `<ShareDialog open onClose resourceType resourceId />`. Passing\n * `shareUrl` lights up a Link tab with a copy field; passing `embedUrl`\n * lights up an Embed tab. With neither prop, renders a single Invite +\n * general-access panel (Google-Docs-lite).\n */\nexport function ShareDialog(props: ShareDialogProps) {\n const {\n open,\n onClose,\n resourceType,\n resourceId,\n resourceTitle,\n shareUrl,\n embedUrl,\n embedTabContent,\n linkTabExtras,\n } = props;\n const t = useT();\n\n const sharesQuery = useActionQuery<SharesResponse>(\"list-resource-shares\", {\n resourceType,\n resourceId,\n });\n const orgMembers = useOrgMembers();\n\n const hasLinkTab = Boolean(shareUrl);\n const hasEmbedTab = Boolean(embedUrl);\n const tabsEnabled = hasLinkTab || hasEmbedTab;\n\n const [tab, setTab] = useState<\"link\" | \"invite\" | \"embed\">(\n hasLinkTab ? \"link\" : \"invite\",\n );\n\n useEffect(() => {\n if (!open) return;\n setTab(hasLinkTab ? \"link\" : \"invite\");\n }, [open, hasLinkTab]);\n\n useEffect(() => {\n if (!open) return;\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") onClose();\n };\n window.addEventListener(\"keydown\", onKey);\n return () => window.removeEventListener(\"keydown\", onKey);\n }, [open, onClose]);\n\n if (!open) return null;\n\n const titleText = resourceTitle\n ? t(\"share.titleWithResource\", { title: resourceTitle })\n : t(\"share.titleWithType\", { type: resourceType });\n\n return createPortal(\n <div\n className=\"fixed inset-0 z-[2000] flex items-start justify-center bg-black/40 p-4 sm:items-center\"\n onClick={onClose}\n >\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={titleText}\n className=\"w-full max-w-lg rounded-xl border border-border bg-popover text-popover-foreground shadow-2xl outline-none\"\n onClick={(e) => e.stopPropagation()}\n >\n <div className=\"flex items-start justify-between gap-3 px-5 pt-4 pb-3\">\n <div className=\"min-w-0 flex-1\">\n <div className=\"truncate text-base font-semibold\" title={titleText}>\n {titleText}\n </div>\n {sharesQuery.data?.ownerEmail ? (\n <div className=\"mt-0.5 truncate text-xs text-muted-foreground\">\n {t(\"share.owner\", {\n name: displayName(sharesQuery.data.ownerEmail, orgMembers),\n })}\n </div>\n ) : null}\n </div>\n <button\n type=\"button\"\n aria-label={t(\"share.close\")}\n onClick={onClose}\n className={BUTTON_GHOST_ICON}\n >\n <IconX size={16} />\n </button>\n </div>\n\n {tabsEnabled ? (\n <div\n role=\"tablist\"\n aria-label={t(\"share.shareOptions\")}\n className=\"mx-5 mt-1 flex gap-1 border-b border-border\"\n >\n {hasLinkTab ? (\n <TabTrigger\n active={tab === \"link\"}\n onClick={() => setTab(\"link\")}\n icon={<IconLink size={14} strokeWidth={1.75} />}\n label={t(\"share.link\")}\n />\n ) : null}\n <TabTrigger\n active={tab === \"invite\"}\n onClick={() => setTab(\"invite\")}\n icon={<IconMail size={14} strokeWidth={1.75} />}\n label={t(\"share.invite\")}\n />\n {hasEmbedTab ? (\n <TabTrigger\n active={tab === \"embed\"}\n onClick={() => setTab(\"embed\")}\n icon={<IconCode size={14} strokeWidth={1.75} />}\n label={t(\"share.embed\")}\n />\n ) : null}\n </div>\n ) : null}\n\n <div className=\"px-5 py-4\">\n {tabsEnabled && tab === \"link\" && hasLinkTab ? (\n <LinkTab\n resourceType={resourceType}\n resourceId={resourceId}\n shareUrl={shareUrl!}\n sharesQuery={sharesQuery}\n extras={linkTabExtras}\n />\n ) : null}\n {!tabsEnabled || tab === \"invite\" ? (\n <InviteTab\n resourceType={resourceType}\n resourceId={resourceId}\n shareUrl={shareUrl}\n sharesQuery={sharesQuery}\n showVisibility={!tabsEnabled}\n orgMembers={orgMembers}\n />\n ) : null}\n {tabsEnabled && tab === \"embed\" && hasEmbedTab\n ? (embedTabContent ?? <DefaultEmbedBody embedUrl={embedUrl!} />)\n : null}\n </div>\n\n <div className=\"flex justify-end border-t border-border px-5 py-3\">\n <button type=\"button\" onClick={onClose} className={BUTTON_PRIMARY_SM}>\n {t(\"share.done\")}\n </button>\n </div>\n </div>\n </div>,\n document.body,\n );\n}\n\n// ---------------------------------------------------------------------------\n// Tabs\n// ---------------------------------------------------------------------------\n\nfunction TabTrigger(props: {\n active: boolean;\n onClick: () => void;\n icon: ReactNode;\n label: string;\n}) {\n return (\n <button\n type=\"button\"\n role=\"tab\"\n aria-selected={props.active}\n onClick={props.onClick}\n className={cn(\n \"inline-flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm font-medium transition-colors\",\n props.active\n ? \"border-foreground text-foreground\"\n : \"border-transparent text-muted-foreground hover:text-foreground\",\n )}\n >\n {props.icon}\n {props.label}\n </button>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Link tab — visibility picker + copy-link field + optional extras\n// ---------------------------------------------------------------------------\n\nfunction LinkTab(props: {\n resourceType: string;\n resourceId: string;\n shareUrl: string;\n sharesQuery: ReturnType<typeof useActionQuery<SharesResponse>>;\n extras?: ReactNode;\n}) {\n const { resourceType, resourceId, shareUrl, sharesQuery, extras } = props;\n const t = useT();\n const visibilityMeta = useVisibilityMeta();\n\n const setVisibility = useActionMutation(\"set-resource-visibility\");\n const data = sharesQuery.data;\n const visibility: Visibility =\n (data?.visibility as Visibility | null) ?? \"private\";\n const canManage = data?.role === \"owner\" || data?.role === \"admin\";\n const meta = visibilityMeta[visibility];\n\n const handleVisibility = (next: Visibility) => {\n if (next === visibility) return;\n if (!canManage) return;\n setVisibility.mutate(\n { resourceType, resourceId, visibility: next } as any,\n { onSuccess: () => sharesQuery.refetch() },\n );\n };\n\n return (\n <div className=\"space-y-4\">\n <div>\n <div className=\"mb-2 text-sm font-semibold\">\n {t(\"share.generalAccess\")}\n </div>\n <div className=\"flex items-center gap-3\">\n <span\n aria-hidden\n className=\"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground\"\n >\n <meta.Icon size={16} strokeWidth={1.75} />\n </span>\n <div className=\"min-w-0 flex-1\">\n <VisibilitySelect\n value={visibility}\n onChange={handleVisibility}\n disabled={!canManage}\n />\n <div className=\"mt-0.5 text-xs text-muted-foreground\">\n {meta.description}\n </div>\n </div>\n </div>\n </div>\n\n <CopyField label={t(\"share.shareLink\")} value={shareUrl} />\n\n {extras}\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Invite tab — invite-by-email + shares list + (optional) visibility\n// ---------------------------------------------------------------------------\n\nfunction InviteTab(props: {\n resourceType: string;\n resourceId: string;\n shareUrl?: string;\n sharesQuery: ReturnType<typeof useActionQuery<SharesResponse>>;\n showVisibility: boolean;\n orgMembers: OrgMember[];\n}) {\n const {\n resourceType,\n resourceId,\n shareUrl,\n sharesQuery,\n showVisibility,\n orgMembers,\n } = props;\n const t = useT();\n const visibilityMeta = useVisibilityMeta();\n\n const share = useActionMutation(\"share-resource\");\n const unshare = useActionMutation(\"unshare-resource\");\n const setVisibility = useActionMutation(\"set-resource-visibility\");\n\n const [email, setEmail] = useState(\"\");\n const [role, setRole] = useState<Role>(\"viewer\");\n const [notifyPeople, setNotifyPeople] = useState(true);\n const hasInviteEmail = email.trim().length > 0;\n\n const data = sharesQuery.data;\n const shares = data?.shares ?? [];\n const visibility: Visibility =\n (data?.visibility as Visibility | null) ?? \"private\";\n const canManage = data?.role === \"owner\" || data?.role === \"admin\";\n const meta = visibilityMeta[visibility];\n\n const handleAdd = () => {\n const trimmed = email.trim();\n if (!trimmed) return;\n share.mutate(\n {\n resourceType,\n resourceId,\n principalType: \"user\",\n principalId: trimmed,\n role,\n notify: notifyPeople,\n resourceUrl: getNotificationUrl(shareUrl),\n } as any,\n {\n onSuccess: () => {\n setEmail(\"\");\n sharesQuery.refetch();\n },\n },\n );\n };\n\n const handleRemove = (s: Share) => {\n unshare.mutate(\n {\n resourceType,\n resourceId,\n principalType: s.principalType,\n principalId: s.principalId,\n } as any,\n { onSuccess: () => sharesQuery.refetch() },\n );\n };\n\n const handleVisibility = (next: Visibility) => {\n if (next === visibility) return;\n if (!canManage) return;\n setVisibility.mutate(\n { resourceType, resourceId, visibility: next } as any,\n { onSuccess: () => sharesQuery.refetch() },\n );\n };\n\n return (\n <div className=\"space-y-4\">\n {canManage ? (\n <div className=\"space-y-2\">\n <div className=\"flex items-stretch gap-2\">\n <input\n type=\"email\"\n placeholder={t(\"share.addPeopleByEmail\")}\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\") handleAdd();\n }}\n autoComplete=\"off\"\n className=\"flex-1 min-w-0 h-9 rounded-md border border-input bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background\"\n />\n <RoleSelect value={role} onChange={setRole} />\n </div>\n {hasInviteEmail ? (\n <label className=\"inline-flex items-center gap-2 text-xs text-muted-foreground\">\n <input\n type=\"checkbox\"\n checked={notifyPeople}\n onChange={(e) => setNotifyPeople(e.target.checked)}\n className=\"h-4 w-4 rounded border-input accent-primary\"\n />\n {t(\"share.notifyPeople\")}\n </label>\n ) : null}\n </div>\n ) : null}\n\n <div>\n <div className=\"mb-2 text-sm font-semibold\">\n {t(\"share.peopleWithAccess\")}\n </div>\n <ul className=\"flex flex-col gap-1 list-none p-0 m-0\">\n {data?.ownerEmail ? (\n <li className=\"flex items-center gap-3 px-1 py-1.5 text-sm\">\n <Avatar label={displayName(data.ownerEmail, orgMembers)} />\n <span className=\"flex-1 min-w-0 truncate\">\n {displayName(data.ownerEmail, orgMembers)}\n </span>\n <span className=\"text-xs text-muted-foreground\">\n {t(\"share.ownerRole\")}\n </span>\n </li>\n ) : null}\n {shares.map((s) => (\n <li\n key={`${s.principalType}:${s.principalId}`}\n className=\"flex items-center gap-3 px-1 py-1.5 text-sm\"\n >\n <Avatar\n label={\n s.principalType === \"org\"\n ? s.principalId\n : displayName(s.principalId, orgMembers)\n }\n org={s.principalType === \"org\"}\n />\n <span className=\"flex-1 min-w-0 truncate\">\n {s.principalType === \"org\"\n ? s.principalId\n : displayName(s.principalId, orgMembers)}\n </span>\n <span className=\"text-xs text-muted-foreground\">\n {cap(s.role)}\n </span>\n {canManage ? (\n <button\n type=\"button\"\n aria-label={t(\"share.remove\")}\n onClick={() => handleRemove(s)}\n className={BUTTON_GHOST_ICON}\n >\n <IconTrash size={14} />\n </button>\n ) : null}\n </li>\n ))}\n {!shares.length && !data?.ownerEmail ? (\n <li className=\"px-1 py-1.5 text-sm text-muted-foreground\">\n {t(\"share.noAccess\")}\n </li>\n ) : null}\n </ul>\n </div>\n\n {showVisibility ? (\n <div>\n <div className=\"mb-2 text-sm font-semibold\">\n {t(\"share.generalAccess\")}\n </div>\n <div className=\"flex items-center gap-3\">\n <span\n aria-hidden\n className=\"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground\"\n >\n <meta.Icon size={16} strokeWidth={1.75} />\n </span>\n <div className=\"min-w-0 flex-1\">\n <VisibilitySelect\n value={visibility}\n onChange={handleVisibility}\n disabled={!canManage}\n />\n <div className=\"mt-0.5 text-xs text-muted-foreground\">\n {meta.description}\n </div>\n </div>\n </div>\n </div>\n ) : null}\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Default Embed body (simple responsive iframe snippet)\n// ---------------------------------------------------------------------------\n\nfunction DefaultEmbedBody({ embedUrl }: { embedUrl: string }) {\n const t = useT();\n const code = `<div style=\"position:relative;padding-bottom:56.25%;height:0\"><iframe src=\"${embedUrl}\" frameborder=\"0\" allowfullscreen allow=\"autoplay; picture-in-picture\" style=\"position:absolute;inset:0;width:100%;height:100%\"></iframe></div>`;\n return (\n <div className=\"space-y-3\">\n <CopyField label={t(\"share.embedUrl\")} value={embedUrl} />\n <CopyField label={t(\"share.embedCode\")} value={code} multiline />\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Primitives\n// ---------------------------------------------------------------------------\n\nfunction CopyField({\n label,\n value,\n multiline,\n}: {\n label: string;\n value: string;\n multiline?: boolean;\n}) {\n const [copied, setCopied] = useState(false);\n const t = useT();\n const copy = async () => {\n if (!(await writeClipboardText(value))) {\n setCopied(false);\n return;\n }\n setCopied(true);\n setTimeout(() => setCopied(false), 1400);\n };\n return (\n <div>\n <div className=\"mb-1 text-xs font-medium text-muted-foreground\">\n {label}\n </div>\n <div className=\"flex items-stretch gap-2\">\n {multiline ? (\n <textarea\n readOnly\n value={value}\n className=\"flex-1 h-20 rounded-md border border-input bg-background px-3 py-2 text-xs font-mono text-foreground resize-none focus:outline-none focus:ring-2 focus:ring-ring\"\n />\n ) : (\n <input\n readOnly\n value={value}\n className=\"flex-1 min-w-0 h-9 rounded-md border border-input bg-background px-3 text-xs font-mono text-foreground focus:outline-none focus:ring-2 focus:ring-ring\"\n />\n )}\n <button\n type=\"button\"\n onClick={copy}\n aria-label={t(\"share.copy\")}\n className={cn(BUTTON_OUTLINE_SM, \"w-9 px-0\")}\n >\n {copied ? <IconCheck size={14} /> : <IconCopy size={14} />}\n </button>\n </div>\n </div>\n );\n}\n\nconst selectContentClass =\n \"z-[2100] min-w-[12rem] overflow-hidden rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md\";\nconst selectItemClass =\n \"relative flex w-full cursor-pointer select-none items-start gap-2 rounded-sm py-2 ps-8 pe-3 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\";\n\nfunction SelectItems({\n items,\n}: {\n items: Array<{ value: string; label: string; description?: string }>;\n}) {\n return (\n <>\n {items.map((it) => (\n <Select.Item\n key={it.value}\n value={it.value}\n className={selectItemClass}\n >\n <span className=\"absolute start-2 top-2 flex h-4 w-4 items-center justify-center\">\n <Select.ItemIndicator>\n <IconCheck size={14} />\n </Select.ItemIndicator>\n </span>\n <span className=\"flex flex-col\">\n <Select.ItemText>{it.label}</Select.ItemText>\n {it.description ? (\n <span className=\"text-xs text-muted-foreground\">\n {it.description}\n </span>\n ) : null}\n </span>\n </Select.Item>\n ))}\n </>\n );\n}\n\nfunction RoleSelect(props: { value: Role; onChange: (v: Role) => void }) {\n const t = useT();\n const roleOptions = useRoleOptions();\n const current =\n roleOptions.find((o) => o.value === props.value) ?? roleOptions[0];\n return (\n <Select.Root\n value={props.value}\n onValueChange={(v) => props.onChange(v as Role)}\n >\n <Select.Trigger\n aria-label={t(\"share.role\")}\n className={cn(\n BUTTON_BASE,\n \"h-9 px-3 border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n )}\n >\n <Select.Value>{current.label}</Select.Value>\n <Select.Icon>\n <IconChevronDown size={14} />\n </Select.Icon>\n </Select.Trigger>\n <Select.Portal>\n <Select.Content\n className={selectContentClass}\n position=\"popper\"\n sideOffset={4}\n >\n <Select.Viewport>\n <SelectItems items={roleOptions} />\n </Select.Viewport>\n </Select.Content>\n </Select.Portal>\n </Select.Root>\n );\n}\n\nfunction VisibilitySelect(props: {\n value: Visibility;\n onChange: (v: Visibility) => void;\n disabled?: boolean;\n allowPrivate?: boolean;\n allowPublic?: boolean;\n}) {\n const t = useT();\n const visibilityMeta = useVisibilityMeta();\n const current = visibilityMeta[props.value];\n const allowPrivate = props.allowPrivate !== false;\n const allowPublic = props.allowPublic !== false;\n const options = (Object.keys(VIS_ICONS) as Visibility[]).filter((k) => {\n if (k === props.value) return true;\n if (k === \"private\" && !allowPrivate) return false;\n if (k === \"public\" && !allowPublic) return false;\n return true;\n });\n return (\n <Select.Root\n value={props.value}\n onValueChange={(v) => props.onChange(v as Visibility)}\n disabled={props.disabled}\n >\n <Select.Trigger\n aria-label={t(\"share.generalAccess\")}\n className={cn(\n BUTTON_BASE,\n \"h-7 px-1 -ms-1 bg-transparent text-foreground hover:bg-accent hover:text-accent-foreground\",\n )}\n >\n <Select.Value>{current.label}</Select.Value>\n <Select.Icon>\n <IconChevronDown size={14} />\n </Select.Icon>\n </Select.Trigger>\n <Select.Portal>\n <Select.Content\n className={selectContentClass}\n position=\"popper\"\n sideOffset={4}\n >\n <Select.Viewport>\n <SelectItems\n items={options.map((k) => ({\n value: k,\n label: visibilityMeta[k].label,\n description: visibilityMeta[k].description,\n }))}\n />\n </Select.Viewport>\n </Select.Content>\n </Select.Portal>\n </Select.Root>\n );\n}\n\nfunction Avatar({ label, org }: { label: string; org?: boolean }) {\n return (\n <span\n aria-hidden\n className=\"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-muted text-[11px] font-semibold text-muted-foreground\"\n >\n {org ? (\n <IconBuilding size={14} strokeWidth={1.75} />\n ) : (\n (label.split(\"@\")[0]?.[0] ?? label[0] ?? \"?\").toUpperCase()\n )}\n </span>\n );\n}\n\nfunction getNotificationUrl(explicit?: string): string | undefined {\n if (explicit) return explicit;\n if (typeof window === \"undefined\") return undefined;\n return window.location.href;\n}\n\nfunction cap(s: string): string {\n return s.charAt(0).toUpperCase() + s.slice(1);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ShareDialog.js","sourceRoot":"","sources":["../../../src/client/sharing/ShareDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACjD,OAAO,EACL,KAAK,EACL,SAAS,EACT,QAAQ,EACR,SAAS,EACT,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAiDjC,SAAS,aAAa;IACpB,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAc,EAAE,CAAC,CAAC;IACxD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,KAAK,CAAC,eAAe,CAAC,4BAA4B,CAAC,CAAC;aACjD,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;aACrC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;YACb,IAAI,SAAS,IAAI,CAAC,IAAI;gBAAE,OAAO;YAC/B,MAA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C,CAAC;gCACzB,KAAK,EAAE,CAAC;gCACR,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,KAAK;gCAC9B,WAAW,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,WAAW;6BAC3C,CAAC,CAAC,GACH,GACc,GACH,GACH,IACJ,CACf,CAAC;AACJ,CAAC;AAED,SAAS,MAAM,CAAC,EAAE,KAAK,EAAE,GAAG,EAAoC;IAC9D,OAAO,CACL,oCAEE,SAAS,EAAC,gIAAgI,YAEzI,GAAG,CAAC,CAAC,CAAC,CACL,KAAC,cAAc,IAAC,IAAI,EAAE,EAAE,EAAE,WAAW,EAAE,IAAI,GAAI,CAChD,CAAC,CAAC,CAAC,CACF,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,CAC5D,GACI,CACR,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,QAAiB;IAC3C,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC9B,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO,SAAS,CAAC;IACpD,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;AAC9B,CAAC;AAED,SAAS,GAAG,CAAC,CAAS;IACpB,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC","sourcesContent":["import * as Select from \"@radix-ui/react-select\";\nimport {\n IconX,\n IconTrash,\n IconLock,\n IconWorld,\n IconCheck,\n IconCopy,\n IconLink,\n IconMail,\n IconCode,\n IconChevronDown,\n IconUsersGroup,\n} from \"@tabler/icons-react\";\nimport { useEffect, useState, type ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { agentNativePath } from \"../api-path.js\";\nimport { writeClipboardText } from \"../clipboard.js\";\nimport { useT } from \"../i18n.js\";\nimport { useActionQuery, useActionMutation } from \"../use-action.js\";\nimport { cn } from \"../utils.js\";\n\nexport interface ShareDialogProps {\n open: boolean;\n onClose: () => void;\n resourceType: string;\n resourceId: string;\n resourceTitle?: string;\n /**\n * When provided, enables the \"Link\" tab with a copy-link field.\n * Pass the user-facing share URL (e.g. `https://…/share/<id>`).\n */\n shareUrl?: string;\n /**\n * When provided, enables the \"Embed\" tab with a default iframe snippet.\n * For richer per-resource controls (autoplay, start time, responsive /\n * fixed size), pass `embedTabContent` instead (or in addition) — it\n * replaces the default embed body.\n */\n embedUrl?: string;\n /** Advanced: fully custom Embed tab body. Requires `embedUrl` to enable the tab. */\n embedTabContent?: ReactNode;\n /** Extra content appended to the bottom of the Link tab (e.g. download buttons). */\n linkTabExtras?: ReactNode;\n}\n\ntype Visibility = \"private\" | \"org\" | \"public\";\ntype Role = \"viewer\" | \"editor\" | \"admin\";\n\ninterface Share {\n id: string;\n principalType: \"user\" | \"org\";\n principalId: string;\n role: Role;\n}\n\ninterface SharesResponse {\n ownerEmail: string | null;\n orgId: string | null;\n visibility: Visibility | null;\n role?: \"owner\" | Role;\n shares: Share[];\n}\n\ninterface OrgMember {\n email: string;\n name?: string | null;\n}\n\nfunction useOrgMembers(): OrgMember[] {\n const [members, setMembers] = useState<OrgMember[]>([]);\n useEffect(() => {\n let cancelled = false;\n fetch(agentNativePath(\"/_agent-native/org/members\"))\n .then((r) => (r.ok ? r.json() : null))\n .then((data) => {\n if (cancelled || !data) return;\n const list = Array.isArray(data?.members) ? data.members : [];\n setMembers(\n list\n .map((m: any) => ({\n email: typeof m?.email === \"string\" ? m.email : \"\",\n name: typeof m?.name === \"string\" ? m.name : null,\n }))\n .filter((m: OrgMember) => m.email),\n );\n })\n .catch(() => {});\n return () => {\n cancelled = true;\n };\n }, []);\n return members;\n}\n\nfunction displayName(email: string, members: OrgMember[]): string {\n const match = members.find((m) => m.email === email);\n if (match?.name && match.name.trim()) return match.name;\n return email;\n}\n\nconst BUTTON_BASE =\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0\";\nconst BUTTON_OUTLINE_SM = cn(\n BUTTON_BASE,\n \"h-9 px-3 border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n);\nconst BUTTON_PRIMARY_SM = cn(\n BUTTON_BASE,\n \"h-9 px-4 bg-primary text-primary-foreground hover:bg-primary/90\",\n);\nconst BUTTON_GHOST_ICON = cn(\n BUTTON_BASE,\n \"h-8 w-8 p-0 text-muted-foreground hover:bg-accent hover:text-accent-foreground\",\n);\n\nconst VIS_ICONS: Record<Visibility, typeof IconLock> = {\n private: IconLock,\n org: IconUsersGroup,\n public: IconWorld,\n};\n\nfunction useVisibilityMeta() {\n const t = useT();\n return {\n private: {\n label: t(\"share.private\"),\n description: t(\"share.privateDescription\"),\n Icon: VIS_ICONS.private,\n },\n org: {\n label: t(\"share.organization\"),\n description: t(\"share.organizationDescription\"),\n Icon: VIS_ICONS.org,\n },\n public: {\n label: t(\"share.public\"),\n description: t(\"share.publicDescription\"),\n Icon: VIS_ICONS.public,\n },\n } satisfies Record<\n Visibility,\n { label: string; description: string; Icon: typeof IconLock }\n >;\n}\n\nfunction useRoleOptions() {\n const t = useT();\n return [\n {\n value: \"viewer\",\n label: t(\"share.viewer\"),\n description: t(\"share.viewerDescription\"),\n },\n {\n value: \"editor\",\n label: t(\"share.editor\"),\n description: t(\"share.editorDescription\"),\n },\n {\n value: \"admin\",\n label: t(\"share.admin\"),\n description: t(\"share.adminDescription\"),\n },\n ] satisfies Array<{ value: Role; label: string; description: string }>;\n}\n\n/**\n * Framework share dialog. Drop into any template via\n * `<ShareDialog open onClose resourceType resourceId />`. Passing\n * `shareUrl` lights up a Link tab with a copy field; passing `embedUrl`\n * lights up an Embed tab. With neither prop, renders a single Invite +\n * general-access panel (Google-Docs-lite).\n */\nexport function ShareDialog(props: ShareDialogProps) {\n const {\n open,\n onClose,\n resourceType,\n resourceId,\n resourceTitle,\n shareUrl,\n embedUrl,\n embedTabContent,\n linkTabExtras,\n } = props;\n const t = useT();\n\n const sharesQuery = useActionQuery<SharesResponse>(\"list-resource-shares\", {\n resourceType,\n resourceId,\n });\n const orgMembers = useOrgMembers();\n\n const hasLinkTab = Boolean(shareUrl);\n const hasEmbedTab = Boolean(embedUrl);\n const tabsEnabled = hasLinkTab || hasEmbedTab;\n\n const [tab, setTab] = useState<\"link\" | \"invite\" | \"embed\">(\n hasLinkTab ? \"link\" : \"invite\",\n );\n\n useEffect(() => {\n if (!open) return;\n setTab(hasLinkTab ? \"link\" : \"invite\");\n }, [open, hasLinkTab]);\n\n useEffect(() => {\n if (!open) return;\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") onClose();\n };\n window.addEventListener(\"keydown\", onKey);\n return () => window.removeEventListener(\"keydown\", onKey);\n }, [open, onClose]);\n\n if (!open) return null;\n\n const titleText = resourceTitle\n ? t(\"share.titleWithResource\", { title: resourceTitle })\n : t(\"share.titleWithType\", { type: resourceType });\n\n return createPortal(\n <div\n className=\"fixed inset-0 z-[2000] flex items-start justify-center bg-black/40 p-4 sm:items-center\"\n onClick={onClose}\n >\n <div\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={titleText}\n className=\"w-full max-w-lg rounded-xl border border-border bg-popover text-popover-foreground shadow-2xl outline-none\"\n onClick={(e) => e.stopPropagation()}\n >\n <div className=\"flex items-start justify-between gap-3 px-5 pt-4 pb-3\">\n <div className=\"min-w-0 flex-1\">\n <div className=\"truncate text-base font-semibold\" title={titleText}>\n {titleText}\n </div>\n {sharesQuery.data?.ownerEmail ? (\n <div className=\"mt-0.5 truncate text-xs text-muted-foreground\">\n {t(\"share.owner\", {\n name: displayName(sharesQuery.data.ownerEmail, orgMembers),\n })}\n </div>\n ) : null}\n </div>\n <button\n type=\"button\"\n aria-label={t(\"share.close\")}\n onClick={onClose}\n className={BUTTON_GHOST_ICON}\n >\n <IconX size={16} />\n </button>\n </div>\n\n {tabsEnabled ? (\n <div\n role=\"tablist\"\n aria-label={t(\"share.shareOptions\")}\n className=\"mx-5 mt-1 flex gap-1 border-b border-border\"\n >\n {hasLinkTab ? (\n <TabTrigger\n active={tab === \"link\"}\n onClick={() => setTab(\"link\")}\n icon={<IconLink size={14} strokeWidth={1.75} />}\n label={t(\"share.link\")}\n />\n ) : null}\n <TabTrigger\n active={tab === \"invite\"}\n onClick={() => setTab(\"invite\")}\n icon={<IconMail size={14} strokeWidth={1.75} />}\n label={t(\"share.invite\")}\n />\n {hasEmbedTab ? (\n <TabTrigger\n active={tab === \"embed\"}\n onClick={() => setTab(\"embed\")}\n icon={<IconCode size={14} strokeWidth={1.75} />}\n label={t(\"share.embed\")}\n />\n ) : null}\n </div>\n ) : null}\n\n <div className=\"px-5 py-4\">\n {tabsEnabled && tab === \"link\" && hasLinkTab ? (\n <LinkTab\n resourceType={resourceType}\n resourceId={resourceId}\n shareUrl={shareUrl!}\n sharesQuery={sharesQuery}\n extras={linkTabExtras}\n />\n ) : null}\n {!tabsEnabled || tab === \"invite\" ? (\n <InviteTab\n resourceType={resourceType}\n resourceId={resourceId}\n shareUrl={shareUrl}\n sharesQuery={sharesQuery}\n showVisibility={!tabsEnabled}\n orgMembers={orgMembers}\n />\n ) : null}\n {tabsEnabled && tab === \"embed\" && hasEmbedTab\n ? (embedTabContent ?? <DefaultEmbedBody embedUrl={embedUrl!} />)\n : null}\n </div>\n\n <div className=\"flex justify-end border-t border-border px-5 py-3\">\n <button type=\"button\" onClick={onClose} className={BUTTON_PRIMARY_SM}>\n {t(\"share.done\")}\n </button>\n </div>\n </div>\n </div>,\n document.body,\n );\n}\n\n// ---------------------------------------------------------------------------\n// Tabs\n// ---------------------------------------------------------------------------\n\nfunction TabTrigger(props: {\n active: boolean;\n onClick: () => void;\n icon: ReactNode;\n label: string;\n}) {\n return (\n <button\n type=\"button\"\n role=\"tab\"\n aria-selected={props.active}\n onClick={props.onClick}\n className={cn(\n \"inline-flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm font-medium transition-colors\",\n props.active\n ? \"border-foreground text-foreground\"\n : \"border-transparent text-muted-foreground hover:text-foreground\",\n )}\n >\n {props.icon}\n {props.label}\n </button>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Link tab — visibility picker + copy-link field + optional extras\n// ---------------------------------------------------------------------------\n\nfunction LinkTab(props: {\n resourceType: string;\n resourceId: string;\n shareUrl: string;\n sharesQuery: ReturnType<typeof useActionQuery<SharesResponse>>;\n extras?: ReactNode;\n}) {\n const { resourceType, resourceId, shareUrl, sharesQuery, extras } = props;\n const t = useT();\n const visibilityMeta = useVisibilityMeta();\n\n const setVisibility = useActionMutation(\"set-resource-visibility\");\n const data = sharesQuery.data;\n const visibility: Visibility =\n (data?.visibility as Visibility | null) ?? \"private\";\n const canManage = data?.role === \"owner\" || data?.role === \"admin\";\n const meta = visibilityMeta[visibility];\n\n const handleVisibility = (next: Visibility) => {\n if (next === visibility) return;\n if (!canManage) return;\n setVisibility.mutate(\n { resourceType, resourceId, visibility: next } as any,\n { onSuccess: () => sharesQuery.refetch() },\n );\n };\n\n return (\n <div className=\"space-y-4\">\n <div>\n <div className=\"mb-2 text-sm font-semibold\">\n {t(\"share.generalAccess\")}\n </div>\n <div className=\"flex items-center gap-3\">\n <span\n aria-hidden\n className=\"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground\"\n >\n <meta.Icon size={16} strokeWidth={1.75} />\n </span>\n <div className=\"min-w-0 flex-1\">\n <VisibilitySelect\n value={visibility}\n onChange={handleVisibility}\n disabled={!canManage}\n />\n <div className=\"mt-0.5 text-xs text-muted-foreground\">\n {meta.description}\n </div>\n </div>\n </div>\n </div>\n\n <CopyField label={t(\"share.shareLink\")} value={shareUrl} />\n\n {extras}\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Invite tab — invite-by-email + shares list + (optional) visibility\n// ---------------------------------------------------------------------------\n\nfunction InviteTab(props: {\n resourceType: string;\n resourceId: string;\n shareUrl?: string;\n sharesQuery: ReturnType<typeof useActionQuery<SharesResponse>>;\n showVisibility: boolean;\n orgMembers: OrgMember[];\n}) {\n const {\n resourceType,\n resourceId,\n shareUrl,\n sharesQuery,\n showVisibility,\n orgMembers,\n } = props;\n const t = useT();\n const visibilityMeta = useVisibilityMeta();\n\n const share = useActionMutation(\"share-resource\");\n const unshare = useActionMutation(\"unshare-resource\");\n const setVisibility = useActionMutation(\"set-resource-visibility\");\n\n const [email, setEmail] = useState(\"\");\n const [role, setRole] = useState<Role>(\"viewer\");\n const [notifyPeople, setNotifyPeople] = useState(true);\n const hasInviteEmail = email.trim().length > 0;\n\n const data = sharesQuery.data;\n const shares = data?.shares ?? [];\n const visibility: Visibility =\n (data?.visibility as Visibility | null) ?? \"private\";\n const canManage = data?.role === \"owner\" || data?.role === \"admin\";\n const meta = visibilityMeta[visibility];\n\n const handleAdd = () => {\n const trimmed = email.trim();\n if (!trimmed) return;\n share.mutate(\n {\n resourceType,\n resourceId,\n principalType: \"user\",\n principalId: trimmed,\n role,\n notify: notifyPeople,\n resourceUrl: getNotificationUrl(shareUrl),\n } as any,\n {\n onSuccess: () => {\n setEmail(\"\");\n sharesQuery.refetch();\n },\n },\n );\n };\n\n const handleRemove = (s: Share) => {\n unshare.mutate(\n {\n resourceType,\n resourceId,\n principalType: s.principalType,\n principalId: s.principalId,\n } as any,\n { onSuccess: () => sharesQuery.refetch() },\n );\n };\n\n const handleVisibility = (next: Visibility) => {\n if (next === visibility) return;\n if (!canManage) return;\n setVisibility.mutate(\n { resourceType, resourceId, visibility: next } as any,\n { onSuccess: () => sharesQuery.refetch() },\n );\n };\n\n return (\n <div className=\"space-y-4\">\n {canManage ? (\n <div className=\"space-y-2\">\n <div className=\"flex items-stretch gap-2\">\n <input\n type=\"email\"\n placeholder={t(\"share.addPeopleByEmail\")}\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\") handleAdd();\n }}\n autoComplete=\"off\"\n className=\"flex-1 min-w-0 h-9 rounded-md border border-input bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background\"\n />\n <RoleSelect value={role} onChange={setRole} />\n </div>\n {hasInviteEmail ? (\n <label className=\"inline-flex items-center gap-2 text-xs text-muted-foreground\">\n <input\n type=\"checkbox\"\n checked={notifyPeople}\n onChange={(e) => setNotifyPeople(e.target.checked)}\n className=\"h-4 w-4 rounded border-input accent-primary\"\n />\n {t(\"share.notifyPeople\")}\n </label>\n ) : null}\n </div>\n ) : null}\n\n <div>\n <div className=\"mb-2 text-sm font-semibold\">\n {t(\"share.peopleWithAccess\")}\n </div>\n <ul className=\"flex flex-col gap-1 list-none p-0 m-0\">\n {data?.ownerEmail ? (\n <li className=\"flex items-center gap-3 px-1 py-1.5 text-sm\">\n <Avatar label={displayName(data.ownerEmail, orgMembers)} />\n <span className=\"flex-1 min-w-0 truncate\">\n {displayName(data.ownerEmail, orgMembers)}\n </span>\n <span className=\"text-xs text-muted-foreground\">\n {t(\"share.ownerRole\")}\n </span>\n </li>\n ) : null}\n {shares.map((s) => (\n <li\n key={`${s.principalType}:${s.principalId}`}\n className=\"flex items-center gap-3 px-1 py-1.5 text-sm\"\n >\n <Avatar\n label={\n s.principalType === \"org\"\n ? s.principalId\n : displayName(s.principalId, orgMembers)\n }\n org={s.principalType === \"org\"}\n />\n <span className=\"flex-1 min-w-0 truncate\">\n {s.principalType === \"org\"\n ? s.principalId\n : displayName(s.principalId, orgMembers)}\n </span>\n <span className=\"text-xs text-muted-foreground\">\n {cap(s.role)}\n </span>\n {canManage ? (\n <button\n type=\"button\"\n aria-label={t(\"share.remove\")}\n onClick={() => handleRemove(s)}\n className={BUTTON_GHOST_ICON}\n >\n <IconTrash size={14} />\n </button>\n ) : null}\n </li>\n ))}\n {!shares.length && !data?.ownerEmail ? (\n <li className=\"px-1 py-1.5 text-sm text-muted-foreground\">\n {t(\"share.noAccess\")}\n </li>\n ) : null}\n </ul>\n </div>\n\n {showVisibility ? (\n <div>\n <div className=\"mb-2 text-sm font-semibold\">\n {t(\"share.generalAccess\")}\n </div>\n <div className=\"flex items-center gap-3\">\n <span\n aria-hidden\n className=\"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground\"\n >\n <meta.Icon size={16} strokeWidth={1.75} />\n </span>\n <div className=\"min-w-0 flex-1\">\n <VisibilitySelect\n value={visibility}\n onChange={handleVisibility}\n disabled={!canManage}\n />\n <div className=\"mt-0.5 text-xs text-muted-foreground\">\n {meta.description}\n </div>\n </div>\n </div>\n </div>\n ) : null}\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Default Embed body (simple responsive iframe snippet)\n// ---------------------------------------------------------------------------\n\nfunction DefaultEmbedBody({ embedUrl }: { embedUrl: string }) {\n const t = useT();\n const code = `<div style=\"position:relative;padding-bottom:56.25%;height:0\"><iframe src=\"${embedUrl}\" frameborder=\"0\" allowfullscreen allow=\"autoplay; picture-in-picture\" style=\"position:absolute;inset:0;width:100%;height:100%\"></iframe></div>`;\n return (\n <div className=\"space-y-3\">\n <CopyField label={t(\"share.embedUrl\")} value={embedUrl} />\n <CopyField label={t(\"share.embedCode\")} value={code} multiline />\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Primitives\n// ---------------------------------------------------------------------------\n\nfunction CopyField({\n label,\n value,\n multiline,\n}: {\n label: string;\n value: string;\n multiline?: boolean;\n}) {\n const [copied, setCopied] = useState(false);\n const t = useT();\n const copy = async () => {\n if (!(await writeClipboardText(value))) {\n setCopied(false);\n return;\n }\n setCopied(true);\n setTimeout(() => setCopied(false), 1400);\n };\n return (\n <div>\n <div className=\"mb-1 text-xs font-medium text-muted-foreground\">\n {label}\n </div>\n <div className=\"flex items-stretch gap-2\">\n {multiline ? (\n <textarea\n readOnly\n value={value}\n className=\"flex-1 h-20 rounded-md border border-input bg-background px-3 py-2 text-xs font-mono text-foreground resize-none focus:outline-none focus:ring-2 focus:ring-ring\"\n />\n ) : (\n <input\n readOnly\n value={value}\n className=\"flex-1 min-w-0 h-9 rounded-md border border-input bg-background px-3 text-xs font-mono text-foreground focus:outline-none focus:ring-2 focus:ring-ring\"\n />\n )}\n <button\n type=\"button\"\n onClick={copy}\n aria-label={t(\"share.copy\")}\n className={cn(BUTTON_OUTLINE_SM, \"w-9 px-0\")}\n >\n {copied ? <IconCheck size={14} /> : <IconCopy size={14} />}\n </button>\n </div>\n </div>\n );\n}\n\nconst selectContentClass =\n \"z-[2100] min-w-[12rem] overflow-hidden rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md\";\nconst selectItemClass =\n \"relative flex w-full cursor-pointer select-none items-start gap-2 rounded-sm py-2 ps-8 pe-3 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\";\n\nfunction SelectItems({\n items,\n}: {\n items: Array<{ value: string; label: string; description?: string }>;\n}) {\n return (\n <>\n {items.map((it) => (\n <Select.Item\n key={it.value}\n value={it.value}\n className={selectItemClass}\n >\n <span className=\"absolute start-2 top-2 flex h-4 w-4 items-center justify-center\">\n <Select.ItemIndicator>\n <IconCheck size={14} />\n </Select.ItemIndicator>\n </span>\n <span className=\"flex flex-col\">\n <Select.ItemText>{it.label}</Select.ItemText>\n {it.description ? (\n <span className=\"text-xs text-muted-foreground\">\n {it.description}\n </span>\n ) : null}\n </span>\n </Select.Item>\n ))}\n </>\n );\n}\n\nfunction RoleSelect(props: { value: Role; onChange: (v: Role) => void }) {\n const t = useT();\n const roleOptions = useRoleOptions();\n const current =\n roleOptions.find((o) => o.value === props.value) ?? roleOptions[0];\n return (\n <Select.Root\n value={props.value}\n onValueChange={(v) => props.onChange(v as Role)}\n >\n <Select.Trigger\n aria-label={t(\"share.role\")}\n className={cn(\n BUTTON_BASE,\n \"h-9 px-3 border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n )}\n >\n <Select.Value>{current.label}</Select.Value>\n <Select.Icon>\n <IconChevronDown size={14} />\n </Select.Icon>\n </Select.Trigger>\n <Select.Portal>\n <Select.Content\n className={selectContentClass}\n position=\"popper\"\n sideOffset={4}\n >\n <Select.Viewport>\n <SelectItems items={roleOptions} />\n </Select.Viewport>\n </Select.Content>\n </Select.Portal>\n </Select.Root>\n );\n}\n\nfunction VisibilitySelect(props: {\n value: Visibility;\n onChange: (v: Visibility) => void;\n disabled?: boolean;\n allowPrivate?: boolean;\n allowPublic?: boolean;\n}) {\n const t = useT();\n const visibilityMeta = useVisibilityMeta();\n const current = visibilityMeta[props.value];\n const allowPrivate = props.allowPrivate !== false;\n const allowPublic = props.allowPublic !== false;\n const options = (Object.keys(VIS_ICONS) as Visibility[]).filter((k) => {\n if (k === props.value) return true;\n if (k === \"private\" && !allowPrivate) return false;\n if (k === \"public\" && !allowPublic) return false;\n return true;\n });\n return (\n <Select.Root\n value={props.value}\n onValueChange={(v) => props.onChange(v as Visibility)}\n disabled={props.disabled}\n >\n <Select.Trigger\n aria-label={t(\"share.generalAccess\")}\n className={cn(\n BUTTON_BASE,\n \"h-7 px-1 -ms-1 bg-transparent text-foreground hover:bg-accent hover:text-accent-foreground\",\n )}\n >\n <Select.Value>{current.label}</Select.Value>\n <Select.Icon>\n <IconChevronDown size={14} />\n </Select.Icon>\n </Select.Trigger>\n <Select.Portal>\n <Select.Content\n className={selectContentClass}\n position=\"popper\"\n sideOffset={4}\n >\n <Select.Viewport>\n <SelectItems\n items={options.map((k) => ({\n value: k,\n label: visibilityMeta[k].label,\n description: visibilityMeta[k].description,\n }))}\n />\n </Select.Viewport>\n </Select.Content>\n </Select.Portal>\n </Select.Root>\n );\n}\n\nfunction Avatar({ label, org }: { label: string; org?: boolean }) {\n return (\n <span\n aria-hidden\n className=\"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-muted text-[11px] font-semibold text-muted-foreground\"\n >\n {org ? (\n <IconUsersGroup size={14} strokeWidth={1.75} />\n ) : (\n (label.split(\"@\")[0]?.[0] ?? label[0] ?? \"?\").toUpperCase()\n )}\n </span>\n );\n}\n\nfunction getNotificationUrl(explicit?: string): string | undefined {\n if (explicit) return explicit;\n if (typeof window === \"undefined\") return undefined;\n return window.location.href;\n}\n\nfunction cap(s: string): string {\n return s.charAt(0).toUpperCase() + s.slice(1);\n}\n"]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { UseQueryOptions, UseMutationOptions } from "@tanstack/react-query";
|
|
2
2
|
/** @internal exported for tests */
|
|
3
3
|
export declare function defaultActionQueryRetry(failureCount: number, error: unknown): boolean;
|
|
4
|
+
/** @internal alias kept for existing specs. */
|
|
5
|
+
export declare const shouldRetryActionQueryForError: typeof defaultActionQueryRetry;
|
|
4
6
|
/**
|
|
5
7
|
* Default retry backoff for action queries. React Query's stock retryDelay
|
|
6
8
|
* (1s → 2s → 4s) makes a failing query sit on a spinner for ~7s before the
|
|
@@ -87,6 +89,7 @@ export declare function useActionQuery<TResult = undefined, TName extends Action
|
|
|
87
89
|
*/
|
|
88
90
|
export declare function useActionMutation<TData = undefined, TVariables = undefined, TName extends ActionName = ActionName>(actionName: TName, options?: Omit<UseMutationOptions<TData extends undefined ? ActionResult<TName> : TData, Error, TVariables extends undefined ? ActionParams<TName> : TVariables>, "mutationFn"> & {
|
|
89
91
|
method?: "POST" | "PUT" | "DELETE";
|
|
92
|
+
skipActionQueryInvalidation?: boolean;
|
|
90
93
|
}): import("@tanstack/react-query").UseMutationResult<TData extends undefined ? ActionResult<TName> : TData, Error, TVariables extends undefined ? ActionParams<TName> : TVariables, unknown>;
|
|
91
94
|
export {};
|
|
92
95
|
//# sourceMappingURL=use-action.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-action.d.ts","sourceRoot":"","sources":["../../src/client/use-action.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAkC/B,mCAAmC;AACnC,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,OAAO,GACb,OAAO,
|
|
1
|
+
{"version":3,"file":"use-action.d.ts","sourceRoot":"","sources":["../../src/client/use-action.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAkC/B,mCAAmC;AACnC,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,OAAO,GACb,OAAO,CAaT;AAED,+CAA+C;AAC/C,eAAO,MAAM,8BAA8B,gCAA0B,CAAC;AAwBtE;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAEzE;AAMD;;;;;GAKG;AACH,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,yBAAyB;KAAG;CACvC;AAED,MAAM,WAAW,cAAe,SAAQ,yBAAyB;CAAG;AAEpE,2FAA2F;AAC3F,KAAK,UAAU,GAAG,MAAM,cAAc,SAAS,KAAK,GAChD,MAAM,GACN,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEpD,8EAA8E;AAC9E,KAAK,YAAY,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,MAAM,cAAc,GAChE,cAAc,CAAC,CAAC,CAAC,SAAS;IAAE,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAC3C,CAAC,GACD,GAAG,GACL,GAAG,CAAC;AAER,iGAAiG;AACjG,KAAK,YAAY,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,MAAM,cAAc,GAChE,cAAc,CAAC,C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AAC,EAC1E,UAAU,GAAG,SAAS,CACvB,6HAcF;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,GAAG,SAAS,EACjB,UAAU,GAAG,SAAS,EACtB,KAAK,SAAS,UAAU,GAAG,UAAU,EAErC,UAAU,EAAE,KAAK,EACjB,OAAO,CAAC,EAAE,IAAI,CACZ,kBAAkB,CAChB,KAAK,SAAS,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,KAAK,EACrD,KAAK,EACL,UAAU,SAAS,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,UAAU,CAChE,EACD,YAAY,CACb,GAAG;IACF,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;IACnC,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACvC,6LA2BF"}
|
|
@@ -53,8 +53,36 @@ export function defaultActionQueryRetry(failureCount, error) {
|
|
|
53
53
|
// silently retrying would multiply that wait. Surface it instead.
|
|
54
54
|
if (isActionTimeout(error))
|
|
55
55
|
return false;
|
|
56
|
+
if (isBrowserResourceExhaustion(error))
|
|
57
|
+
return false;
|
|
58
|
+
// Network-level failures never carry an HTTP `status` (actionFetch only
|
|
59
|
+
// sets it after a response arrives). Chrome reports connection-pool
|
|
60
|
+
// exhaustion (net::ERR_INSUFFICIENT_RESOURCES) as a generic "Failed to
|
|
61
|
+
// fetch", indistinguishable from a transient blip — allow one retry, not
|
|
62
|
+
// three, so an exhausted tab cannot sustain its own fetch storm.
|
|
63
|
+
if (isNetworkLevelFailure(error))
|
|
64
|
+
return failureCount < 1;
|
|
56
65
|
return failureCount < 3;
|
|
57
66
|
}
|
|
67
|
+
/** @internal alias kept for existing specs. */
|
|
68
|
+
export const shouldRetryActionQueryForError = defaultActionQueryRetry;
|
|
69
|
+
function isBrowserResourceExhaustion(error) {
|
|
70
|
+
const message = error instanceof Error
|
|
71
|
+
? error.message
|
|
72
|
+
: typeof error === "string"
|
|
73
|
+
? error
|
|
74
|
+
: "";
|
|
75
|
+
return /ERR_INSUFFICIENT_RESOURCES|insufficient resources/i.test(message);
|
|
76
|
+
}
|
|
77
|
+
function isNetworkLevelFailure(error) {
|
|
78
|
+
// Match the exact shape actionFetch produces for fetch-level failures (its
|
|
79
|
+
// catch wraps the cause as "Action <name> failed: <cause>" and never sets a
|
|
80
|
+
// status). Other status-less errors (test doubles, transport internals)
|
|
81
|
+
// keep the standard three-retry policy.
|
|
82
|
+
return (error instanceof Error &&
|
|
83
|
+
error.status === undefined &&
|
|
84
|
+
/^Action .+ failed: /.test(error.message));
|
|
85
|
+
}
|
|
58
86
|
/**
|
|
59
87
|
* Default retry backoff for action queries. React Query's stock retryDelay
|
|
60
88
|
* (1s → 2s → 4s) makes a failing query sit on a spinner for ~7s before the
|
|
@@ -309,14 +337,17 @@ export function useActionQuery(actionName, params, options) {
|
|
|
309
337
|
*/
|
|
310
338
|
export function useActionMutation(actionName, options) {
|
|
311
339
|
const queryClient = useQueryClient();
|
|
312
|
-
const { method: methodOpt, onSuccess, ...restOptions } = options ?? {};
|
|
340
|
+
const { method: methodOpt, onSuccess, skipActionQueryInvalidation = false, ...restOptions } = options ?? {};
|
|
313
341
|
const method = methodOpt ?? "POST";
|
|
314
342
|
return useMutation({
|
|
315
343
|
...restOptions,
|
|
316
344
|
mutationFn: (params) => actionFetch(actionName, method, params),
|
|
317
345
|
onSuccess: (...args) => {
|
|
318
|
-
//
|
|
319
|
-
|
|
346
|
+
// Most mutations change app data broadly. High-volume background
|
|
347
|
+
// mutations can opt out and perform narrower invalidation in onSuccess.
|
|
348
|
+
if (!skipActionQueryInvalidation) {
|
|
349
|
+
queryClient.invalidateQueries({ queryKey: ["action"] });
|
|
350
|
+
}
|
|
320
351
|
onSuccess?.(...args);
|
|
321
352
|
},
|
|
322
353
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-action.js","sourceRoot":"","sources":["../../src/client/use-action.ts"],"names":[],"mappings":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CAAC","sourcesContent":["/**\n * Client helpers for calling actions through the framework transport.\n *\n * Components should prefer `useActionQuery` / `useActionMutation`; use\n * `callAction` for imperative cases such as debounced search, prefetching, or\n * event handlers that do not fit a hook.\n *\n * ## End-to-end type safety\n *\n * When the action type registry is generated (via the Vite plugin or CLI),\n * `useActionQuery` and `useActionMutation` automatically infer the correct\n * return type and parameter types from the action definitions — no manual\n * type annotations needed.\n *\n * ```ts\n * // Fully typed — return type and params inferred from the action's defineAction()\n * const { data } = useActionQuery(\"list-forms\", { status: \"published\" });\n * // ^? Form[] (inferred from the action's run() return type)\n * ```\n *\n * Without the registry, the hooks fall back to `any` types for backward\n * compatibility.\n */\nimport { useQuery, useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n} from \"@tanstack/react-query\";\n\nimport { agentNativePath } from \"./api-path.js\";\nimport { ensureEmbedAuthFetchInterceptor } from \"./embed-auth.js\";\n\nconst ACTION_PREFIX = agentNativePath(\"/_agent-native/actions\");\n\n/**\n * Upper bound on how long a single action fetch may stay in flight (headers\n * AND body). Converts a hung server/proxy/connection into a visible, typed\n * failure instead of a UI that spins forever. Generous on purpose: it sits\n * above every server-side budget (serverless function limits, hosted run\n * wall-clock), so it only fires when something is genuinely stuck.\n */\nconst DEFAULT_ACTION_TIMEOUT_MS = 60_000;\n\nfunction isAuthFailure(error: unknown): boolean {\n return (\n !!error &&\n typeof error === \"object\" &&\n \"status\" in error &&\n ((error as { status?: unknown }).status === 401 ||\n (error as { status?: unknown }).status === 403)\n );\n}\n\nfunction isActionTimeout(error: unknown): boolean {\n return (\n !!error &&\n typeof error === \"object\" &&\n (error as { timedOut?: unknown }).timedOut === true\n );\n}\n\n/** @internal exported for tests */\nexport function defaultActionQueryRetry(\n failureCount: number,\n error: unknown,\n): boolean {\n if (isAuthFailure(error)) return false;\n // A timeout already made the user wait the full timeout window once;\n // silently retrying would multiply that wait. Surface it instead.\n if (isActionTimeout(error)) return false;\n return failureCount < 3;\n}\n\n/**\n * Default retry backoff for action queries. React Query's stock retryDelay\n * (1s → 2s → 4s) makes a failing query sit on a spinner for ~7s before the\n * error surfaces; interactive data fetches want failures visible fast.\n *\n * @internal exported for tests\n */\nexport function defaultActionQueryRetryDelay(failureCount: number): number {\n return Math.min(500 * 2 ** failureCount, 2_000);\n}\n\n// ---------------------------------------------------------------------------\n// Action type registry — augmented by generated code\n// ---------------------------------------------------------------------------\n\n/**\n * Action type registry. This interface is empty by default and gets augmented\n * by the auto-generated `.generated/action-types.d.ts` file. When augmented,\n * it maps action names to their parameter and return types, enabling\n * end-to-end type safety for `useActionQuery` and `useActionMutation`.\n */\ndeclare global {\n interface AgentNativeActionRegistry {}\n}\n\nexport interface ActionRegistry extends AgentNativeActionRegistry {}\n\n/** Resolves to the union of registered action names, or `string` if no registry exists. */\ntype ActionName = keyof ActionRegistry extends never\n ? string\n : (keyof ActionRegistry & string) | (string & {});\n\n/** Resolves the return type of an action, or `any` if not in the registry. */\ntype ActionResult<T extends string> = T extends keyof ActionRegistry\n ? ActionRegistry[T] extends { result: infer R }\n ? R\n : any\n : any;\n\n/** Resolves the parameter type of an action, or `Record<string, any>` if not in the registry. */\ntype ActionParams<T extends string> = T extends keyof ActionRegistry\n ? ActionRegistry[T] extends { params: infer P }\n ? P\n : Record<string, any>\n : Record<string, any>;\n\nexport type ClientActionMethod = \"GET\" | \"POST\" | \"PUT\" | \"DELETE\";\n\nexport interface ClientActionCallOptions {\n method?: ClientActionMethod;\n /** Abort signal for the underlying fetch. */\n signal?: AbortSignal;\n /** Override the default 60s fetch timeout for long-running actions. */\n timeoutMs?: number;\n}\n\n// ---------------------------------------------------------------------------\n// Fetch helper\n// ---------------------------------------------------------------------------\n\n/**\n * Resolve the browser's IANA timezone (e.g. \"America/Los_Angeles\"). This is\n * sent on every action request as `x-user-timezone` so server-side defaults\n * like \"today\" honor the user's local day rather than the server's UTC clock.\n */\nfunction resolveUserTimezone(): string | undefined {\n try {\n return Intl.DateTimeFormat().resolvedOptions().timeZone || undefined;\n } catch {\n return undefined;\n }\n}\n\nexport function serializeActionQueryParams(\n params: Record<string, any>,\n): string {\n const qs = new URLSearchParams();\n for (const [key, value] of Object.entries(params)) {\n appendActionQueryParam(qs, key, value);\n }\n return qs.toString();\n}\n\nfunction appendActionQueryParam(\n qs: URLSearchParams,\n key: string,\n value: unknown,\n) {\n if (value === null || value === undefined) return;\n if (Array.isArray(value)) {\n // Use bracket keys so a one-item array still arrives as an array after the\n // server parses URLSearchParams. Repeated bare keys lose that distinction.\n for (const item of value) {\n appendActionQueryParam(qs, `${key}[]`, item);\n }\n return;\n }\n qs.append(key, String(value));\n}\n\nexport interface ActionFetchOptions {\n /**\n * Abort signal from the caller (React Query passes one per queryFn\n * invocation so superseded requests — key change, unmount, refetch — cancel\n * the underlying network request instead of hogging a connection slot).\n */\n signal?: AbortSignal;\n /** Per-call override for the fetch timeout. */\n timeoutMs?: number;\n}\n\nasync function actionFetch<T>(\n name: string,\n method: string,\n params?: Record<string, any>,\n options?: ActionFetchOptions,\n): Promise<T> {\n ensureEmbedAuthFetchInterceptor();\n let url = `${ACTION_PREFIX}/${name}`;\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n // Tag browser-originated action calls so the server can set\n // `ctx.caller = \"frontend\"` (vs a bare programmatic `\"http\"` POST).\n // Mirrors the X-Agent-Native-Tool-Bridge: 1 convention. The header is\n // safe to expose: CORS allows it (see action-routes.ts) and it carries\n // no auth weight — it only narrows the caller tag.\n \"X-Agent-Native-Frontend\": \"1\",\n };\n const tz = resolveUserTimezone();\n if (tz) headers[\"x-user-timezone\"] = tz;\n const init: RequestInit = {\n method,\n headers,\n cache: \"no-store\",\n };\n\n if (method === \"GET\" && params && Object.keys(params).length > 0) {\n // Skip null/undefined so optional filters don't turn into literal \"null\"\n // strings in the query string (e.g. `?folderId=null`).\n const qs = serializeActionQueryParams(params);\n if (qs) url += `?${qs}`;\n } else if (method !== \"GET\" && params) {\n init.body = JSON.stringify(params);\n }\n\n // One controller drives both cancellation sources: the caller's signal\n // (superseded query, unmount) and the timeout. The timer stays armed until\n // the BODY is fully read — headers arriving quickly while the body stalls\n // is exactly the hang this bounds.\n const outerSignal = options?.signal;\n const timeoutMs = options?.timeoutMs ?? DEFAULT_ACTION_TIMEOUT_MS;\n const controller =\n typeof AbortController === \"undefined\" ? null : new AbortController();\n const onOuterAbort = () => controller?.abort();\n if (outerSignal && controller) {\n if (outerSignal.aborted) controller.abort();\n else outerSignal.addEventListener(\"abort\", onOuterAbort, { once: true });\n }\n let timedOut = false;\n const timer = controller\n ? setTimeout(() => {\n timedOut = true;\n controller.abort();\n }, timeoutMs)\n : null;\n if (controller) init.signal = controller.signal;\n\n const throwTimeout = (): never => {\n const error = new Error(\n `Action ${name} timed out after ${Math.round(timeoutMs / 1000)}s`,\n );\n (error as any).timedOut = true;\n (error as any).status = 408;\n throw error;\n };\n\n let res: Response;\n let raw = \"\";\n let readFailed = false;\n let readError: unknown;\n try {\n try {\n res = await fetch(url, init);\n } catch (err) {\n if (timedOut) throwTimeout();\n // Caller-initiated cancellation — rethrow untouched so React Query\n // recognizes it as a cancellation rather than a query failure.\n if (outerSignal?.aborted) throw err;\n // Network failures, CORS, server unreachable, etc. — give the caller a\n // useful message instead of the opaque \"Failed to fetch\".\n const cause = err instanceof Error ? err.message : String(err);\n throw new Error(`Action ${name} failed: ${cause}`);\n }\n\n // 204 No Content — nothing to parse.\n if (res.status === 204) return null as T;\n\n // Read the body as text first so we can:\n // - tolerate empty bodies (avoids \"Unexpected end of JSON input\")\n // - surface non-JSON error responses (HTML 401/404 pages, plain text, etc.)\n // - preserve the original HTTP status in the thrown error\n // Track read failures separately from \"no body\" — a stream interruption /\n // decode failure on a 2xx response should error rather than silently\n // succeed with `null`.\n try {\n raw = await res.text();\n } catch (err) {\n if (timedOut) throwTimeout();\n if (outerSignal?.aborted) throw err;\n readFailed = true;\n readError = err;\n }\n } finally {\n if (timer) clearTimeout(timer);\n if (outerSignal) outerSignal.removeEventListener(\"abort\", onOuterAbort);\n }\n\n let data: any = undefined;\n let parseFailed = false;\n if (raw.length > 0) {\n try {\n data = JSON.parse(raw);\n } catch {\n // Body wasn't JSON — keep `data` undefined and use the raw text below.\n parseFailed = true;\n }\n }\n\n if (!res.ok) {\n const message =\n (data && (data.error || data.message)) ||\n // Truncate non-JSON bodies so we don't dump entire HTML pages into the\n // console, but still give the developer a hint as to what came back.\n (raw && raw.slice(0, 200)) ||\n res.statusText ||\n `HTTP ${res.status}`;\n const error = new Error(`Action ${name} failed: ${message}`);\n (error as any).status = res.status;\n throw error;\n }\n\n // 2xx but the body couldn't even be read (mid-stream abort, decode failure,\n // etc.). Don't silently treat that as a `null` success.\n if (readFailed) {\n const cause =\n readError instanceof Error ? readError.message : String(readError);\n const error = new Error(\n `Action ${name} returned ${res.status} but the body could not be read: ${cause}`,\n );\n (error as any).status = res.status;\n throw error;\n }\n\n // 2xx with a non-empty, non-JSON body. Action callers expect typed data, so\n // returning `null` here would silently mask a real server bug (e.g. a proxy\n // returning HTML 200 instead of JSON). Throw instead — empty bodies (handled\n // above by the `raw.length > 0` guard and the 204 short-circuit) still\n // correctly resolve to `null`.\n if (parseFailed) {\n const error = new Error(\n `Action ${name} returned a non-JSON ${res.status} response: ${raw.slice(0, 200)}`,\n );\n (error as any).status = res.status;\n throw error;\n }\n\n return (data ?? (null as unknown)) as T;\n}\n\n/**\n * Imperatively call an action from browser/client code.\n *\n * Prefer `useActionQuery` / `useActionMutation` in React render flows. Use this\n * helper when a hook is not ergonomic; do not hand-write fetch calls to\n * `/_agent-native/actions/*` in components.\n */\nexport function callAction<\n TResult = undefined,\n TName extends ActionName = ActionName,\n>(\n actionName: TName,\n params?: ActionParams<TName>,\n options: ClientActionCallOptions = {},\n): Promise<TResult extends undefined ? ActionResult<TName> : TResult> {\n type R = TResult extends undefined ? ActionResult<TName> : TResult;\n return actionFetch<R>(actionName, options.method ?? \"POST\", params, {\n signal: options.signal,\n timeoutMs: options.timeoutMs,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Query hook\n// ---------------------------------------------------------------------------\n\n/**\n * Query an action exposed as GET.\n *\n * When the action type registry is generated, the return type and parameter\n * types are inferred automatically from the action's `defineAction()` call.\n *\n * ```ts\n * // Type-safe — no manual generic needed\n * const { data } = useActionQuery(\"list-meals\", { date: \"2025-01-01\" });\n *\n * // Manual override still works when needed\n * const { data } = useActionQuery<CustomType>(\"list-meals\");\n * ```\n */\nexport function useActionQuery<\n TResult = undefined,\n TName extends ActionName = ActionName,\n>(\n actionName: TName,\n params?: ActionParams<TName>,\n options?: Omit<\n UseQueryOptions<TResult extends undefined ? ActionResult<TName> : TResult>,\n \"queryKey\" | \"queryFn\"\n >,\n) {\n type R = TResult extends undefined ? ActionResult<TName> : TResult;\n return useQuery<R>({\n queryKey: [\"action\", actionName, params],\n // Thread React Query's per-fetch AbortSignal into the network request so\n // superseded fetches (key change, unmount, rapid refetch) actually cancel\n // instead of holding a per-origin connection slot until they finish.\n queryFn: ({ signal }) =>\n actionFetch<R>(actionName, \"GET\", params, { signal }),\n retry: defaultActionQueryRetry,\n retryDelay: defaultActionQueryRetryDelay,\n ...options,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Mutation hook\n// ---------------------------------------------------------------------------\n\n/**\n * Mutate via an action exposed as POST (default), PUT, or DELETE.\n *\n * When the action type registry is generated, the return type and parameter\n * types are inferred automatically.\n *\n * ```ts\n * // Type-safe\n * const { mutate } = useActionMutation(\"log-meal\");\n * mutate({ name: \"Salad\", calories: 350 });\n * ```\n */\nexport function useActionMutation<\n TData = undefined,\n TVariables = undefined,\n TName extends ActionName = ActionName,\n>(\n actionName: TName,\n options?: Omit<\n UseMutationOptions<\n TData extends undefined ? ActionResult<TName> : TData,\n Error,\n TVariables extends undefined ? ActionParams<TName> : TVariables\n >,\n \"mutationFn\"\n > & {\n method?: \"POST\" | \"PUT\" | \"DELETE\";\n },\n) {\n const queryClient = useQueryClient();\n const {\n method: methodOpt,\n onSuccess,\n ...restOptions\n } = options ?? ({} as any);\n const method = methodOpt ?? \"POST\";\n\n type D = TData extends undefined ? ActionResult<TName> : TData;\n type V = TVariables extends undefined ? ActionParams<TName> : TVariables;\n\n return useMutation<D, Error, V>({\n ...restOptions,\n mutationFn: (params) =>\n actionFetch<D>(actionName, method, params as Record<string, any>),\n onSuccess: (...args: [any, any, any]) => {\n // Invalidate related action queries\n queryClient.invalidateQueries({ queryKey: [\"action\"] });\n (onSuccess as Function)?.(...args);\n },\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"use-action.js","sourceRoot":"","sources":["../../src/client/use-action.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAM9E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,+BAA+B,EAAE,MAAM,iBAAiB,CAAC;AAElE,MAAM,aAAa,GAAG,eAAe,CAAC,wBAAwB,CAAC,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAEzC,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,CACL,CAAC,CAAC,KAAK;QACP,OAAO,KAAK,KAAK,QAAQ;QACzB,QAAQ,IAAI,KAAK;QACjB,CAAE,KAA8B,CAAC,MAAM,KAAK,GAAG;YAC5C,KAA8B,CAAC,MAAM,KAAK,GAAG,CAAC,CAClD,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,KAAc;IACrC,OAAO,CACL,CAAC,CAAC,KAAK;QACP,OAAO,KAAK,KAAK,QAAQ;QACxB,KAAgC,CAAC,QAAQ,KAAK,IAAI,CACpD,CAAC;AACJ,CAAC;AAED,mCAAmC;AACnC,MAAM,UAAU,uBAAuB,CACrC,YAAoB,EACpB,KAAc;IAEd,IAAI,aAAa,CAAC,KAAK,CAAC;QAAE,OAAO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AC,GAAG,IAAI,CAAC,CAAC;QACrC,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * Client helpers for calling actions through the framework transport.\n *\n * Components should prefer `useActionQuery` / `useActionMutation`; use\n * `callAction` for imperative cases such as debounced search, prefetching, or\n * event handlers that do not fit a hook.\n *\n * ## End-to-end type safety\n *\n * When the action type registry is generated (via the Vite plugin or CLI),\n * `useActionQuery` and `useActionMutation` automatically infer the correct\n * return type and parameter types from the action definitions — no manual\n * type annotations needed.\n *\n * ```ts\n * // Fully typed — return type and params inferred from the action's defineAction()\n * const { data } = useActionQuery(\"list-forms\", { status: \"published\" });\n * // ^? Form[] (inferred from the action's run() return type)\n * ```\n *\n * Without the registry, the hooks fall back to `any` types for backward\n * compatibility.\n */\nimport { useQuery, useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport type {\n UseQueryOptions,\n UseMutationOptions,\n} from \"@tanstack/react-query\";\n\nimport { agentNativePath } from \"./api-path.js\";\nimport { ensureEmbedAuthFetchInterceptor } from \"./embed-auth.js\";\n\nconst ACTION_PREFIX = agentNativePath(\"/_agent-native/actions\");\n\n/**\n * Upper bound on how long a single action fetch may stay in flight (headers\n * AND body). Converts a hung server/proxy/connection into a visible, typed\n * failure instead of a UI that spins forever. Generous on purpose: it sits\n * above every server-side budget (serverless function limits, hosted run\n * wall-clock), so it only fires when something is genuinely stuck.\n */\nconst DEFAULT_ACTION_TIMEOUT_MS = 60_000;\n\nfunction isAuthFailure(error: unknown): boolean {\n return (\n !!error &&\n typeof error === \"object\" &&\n \"status\" in error &&\n ((error as { status?: unknown }).status === 401 ||\n (error as { status?: unknown }).status === 403)\n );\n}\n\nfunction isActionTimeout(error: unknown): boolean {\n return (\n !!error &&\n typeof error === \"object\" &&\n (error as { timedOut?: unknown }).timedOut === true\n );\n}\n\n/** @internal exported for tests */\nexport function defaultActionQueryRetry(\n failureCount: number,\n error: unknown,\n): boolean {\n if (isAuthFailure(error)) return false;\n // A timeout already made the user wait the full timeout window once;\n // silently retrying would multiply that wait. Surface it instead.\n if (isActionTimeout(error)) return false;\n if (isBrowserResourceExhaustion(error)) return false;\n // Network-level failures never carry an HTTP `status` (actionFetch only\n // sets it after a response arrives). Chrome reports connection-pool\n // exhaustion (net::ERR_INSUFFICIENT_RESOURCES) as a generic \"Failed to\n // fetch\", indistinguishable from a transient blip — allow one retry, not\n // three, so an exhausted tab cannot sustain its own fetch storm.\n if (isNetworkLevelFailure(error)) return failureCount < 1;\n return failureCount < 3;\n}\n\n/** @internal alias kept for existing specs. */\nexport const shouldRetryActionQueryForError = defaultActionQueryRetry;\n\nfunction isBrowserResourceExhaustion(error: unknown): boolean {\n const message =\n error instanceof Error\n ? error.message\n : typeof error === \"string\"\n ? error\n : \"\";\n return /ERR_INSUFFICIENT_RESOURCES|insufficient resources/i.test(message);\n}\n\nfunction isNetworkLevelFailure(error: unknown): boolean {\n // Match the exact shape actionFetch produces for fetch-level failures (its\n // catch wraps the cause as \"Action <name> failed: <cause>\" and never sets a\n // status). Other status-less errors (test doubles, transport internals)\n // keep the standard three-retry policy.\n return (\n error instanceof Error &&\n (error as { status?: unknown }).status === undefined &&\n /^Action .+ failed: /.test(error.message)\n );\n}\n\n/**\n * Default retry backoff for action queries. React Query's stock retryDelay\n * (1s → 2s → 4s) makes a failing query sit on a spinner for ~7s before the\n * error surfaces; interactive data fetches want failures visible fast.\n *\n * @internal exported for tests\n */\nexport function defaultActionQueryRetryDelay(failureCount: number): number {\n return Math.min(500 * 2 ** failureCount, 2_000);\n}\n\n// ---------------------------------------------------------------------------\n// Action type registry — augmented by generated code\n// ---------------------------------------------------------------------------\n\n/**\n * Action type registry. This interface is empty by default and gets augmented\n * by the auto-generated `.generated/action-types.d.ts` file. When augmented,\n * it maps action names to their parameter and return types, enabling\n * end-to-end type safety for `useActionQuery` and `useActionMutation`.\n */\ndeclare global {\n interface AgentNativeActionRegistry {}\n}\n\nexport interface ActionRegistry extends AgentNativeActionRegistry {}\n\n/** Resolves to the union of registered action names, or `string` if no registry exists. */\ntype ActionName = keyof ActionRegistry extends never\n ? string\n : (keyof ActionRegistry & string) | (string & {});\n\n/** Resolves the return type of an action, or `any` if not in the registry. */\ntype ActionResult<T extends string> = T extends keyof ActionRegistry\n ? ActionRegistry[T] extends { result: infer R }\n ? R\n : any\n : any;\n\n/** Resolves the parameter type of an action, or `Record<string, any>` if not in the registry. */\ntype ActionParams<T extends string> = T extends keyof ActionRegistry\n ? ActionRegistry[T] extends { params: infer P }\n ? P\n : Record<string, any>\n : Record<string, any>;\n\nexport type ClientActionMethod = \"GET\" | \"POST\" | \"PUT\" | \"DELETE\";\n\nexport interface ClientActionCallOptions {\n method?: ClientActionMethod;\n /** Abort signal for the underlying fetch. */\n signal?: AbortSignal;\n /** Override the default 60s fetch timeout for long-running actions. */\n timeoutMs?: number;\n}\n\n// ---------------------------------------------------------------------------\n// Fetch helper\n// ---------------------------------------------------------------------------\n\n/**\n * Resolve the browser's IANA timezone (e.g. \"America/Los_Angeles\"). This is\n * sent on every action request as `x-user-timezone` so server-side defaults\n * like \"today\" honor the user's local day rather than the server's UTC clock.\n */\nfunction resolveUserTimezone(): string | undefined {\n try {\n return Intl.DateTimeFormat().resolvedOptions().timeZone || undefined;\n } catch {\n return undefined;\n }\n}\n\nexport function serializeActionQueryParams(\n params: Record<string, any>,\n): string {\n const qs = new URLSearchParams();\n for (const [key, value] of Object.entries(params)) {\n appendActionQueryParam(qs, key, value);\n }\n return qs.toString();\n}\n\nfunction appendActionQueryParam(\n qs: URLSearchParams,\n key: string,\n value: unknown,\n) {\n if (value === null || value === undefined) return;\n if (Array.isArray(value)) {\n // Use bracket keys so a one-item array still arrives as an array after the\n // server parses URLSearchParams. Repeated bare keys lose that distinction.\n for (const item of value) {\n appendActionQueryParam(qs, `${key}[]`, item);\n }\n return;\n }\n qs.append(key, String(value));\n}\n\nexport interface ActionFetchOptions {\n /**\n * Abort signal from the caller (React Query passes one per queryFn\n * invocation so superseded requests — key change, unmount, refetch — cancel\n * the underlying network request instead of hogging a connection slot).\n */\n signal?: AbortSignal;\n /** Per-call override for the fetch timeout. */\n timeoutMs?: number;\n}\n\nasync function actionFetch<T>(\n name: string,\n method: string,\n params?: Record<string, any>,\n options?: ActionFetchOptions,\n): Promise<T> {\n ensureEmbedAuthFetchInterceptor();\n let url = `${ACTION_PREFIX}/${name}`;\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n // Tag browser-originated action calls so the server can set\n // `ctx.caller = \"frontend\"` (vs a bare programmatic `\"http\"` POST).\n // Mirrors the X-Agent-Native-Tool-Bridge: 1 convention. The header is\n // safe to expose: CORS allows it (see action-routes.ts) and it carries\n // no auth weight — it only narrows the caller tag.\n \"X-Agent-Native-Frontend\": \"1\",\n };\n const tz = resolveUserTimezone();\n if (tz) headers[\"x-user-timezone\"] = tz;\n const init: RequestInit = {\n method,\n headers,\n cache: \"no-store\",\n };\n\n if (method === \"GET\" && params && Object.keys(params).length > 0) {\n // Skip null/undefined so optional filters don't turn into literal \"null\"\n // strings in the query string (e.g. `?folderId=null`).\n const qs = serializeActionQueryParams(params);\n if (qs) url += `?${qs}`;\n } else if (method !== \"GET\" && params) {\n init.body = JSON.stringify(params);\n }\n\n // One controller drives both cancellation sources: the caller's signal\n // (superseded query, unmount) and the timeout. The timer stays armed until\n // the BODY is fully read — headers arriving quickly while the body stalls\n // is exactly the hang this bounds.\n const outerSignal = options?.signal;\n const timeoutMs = options?.timeoutMs ?? DEFAULT_ACTION_TIMEOUT_MS;\n const controller =\n typeof AbortController === \"undefined\" ? null : new AbortController();\n const onOuterAbort = () => controller?.abort();\n if (outerSignal && controller) {\n if (outerSignal.aborted) controller.abort();\n else outerSignal.addEventListener(\"abort\", onOuterAbort, { once: true });\n }\n let timedOut = false;\n const timer = controller\n ? setTimeout(() => {\n timedOut = true;\n controller.abort();\n }, timeoutMs)\n : null;\n if (controller) init.signal = controller.signal;\n\n const throwTimeout = (): never => {\n const error = new Error(\n `Action ${name} timed out after ${Math.round(timeoutMs / 1000)}s`,\n );\n (error as any).timedOut = true;\n (error as any).status = 408;\n throw error;\n };\n\n let res: Response;\n let raw = \"\";\n let readFailed = false;\n let readError: unknown;\n try {\n try {\n res = await fetch(url, init);\n } catch (err) {\n if (timedOut) throwTimeout();\n // Caller-initiated cancellation — rethrow untouched so React Query\n // recognizes it as a cancellation rather than a query failure.\n if (outerSignal?.aborted) throw err;\n // Network failures, CORS, server unreachable, etc. — give the caller a\n // useful message instead of the opaque \"Failed to fetch\".\n const cause = err instanceof Error ? err.message : String(err);\n throw new Error(`Action ${name} failed: ${cause}`);\n }\n\n // 204 No Content — nothing to parse.\n if (res.status === 204) return null as T;\n\n // Read the body as text first so we can:\n // - tolerate empty bodies (avoids \"Unexpected end of JSON input\")\n // - surface non-JSON error responses (HTML 401/404 pages, plain text, etc.)\n // - preserve the original HTTP status in the thrown error\n // Track read failures separately from \"no body\" — a stream interruption /\n // decode failure on a 2xx response should error rather than silently\n // succeed with `null`.\n try {\n raw = await res.text();\n } catch (err) {\n if (timedOut) throwTimeout();\n if (outerSignal?.aborted) throw err;\n readFailed = true;\n readError = err;\n }\n } finally {\n if (timer) clearTimeout(timer);\n if (outerSignal) outerSignal.removeEventListener(\"abort\", onOuterAbort);\n }\n\n let data: any = undefined;\n let parseFailed = false;\n if (raw.length > 0) {\n try {\n data = JSON.parse(raw);\n } catch {\n // Body wasn't JSON — keep `data` undefined and use the raw text below.\n parseFailed = true;\n }\n }\n\n if (!res.ok) {\n const message =\n (data && (data.error || data.message)) ||\n // Truncate non-JSON bodies so we don't dump entire HTML pages into the\n // console, but still give the developer a hint as to what came back.\n (raw && raw.slice(0, 200)) ||\n res.statusText ||\n `HTTP ${res.status}`;\n const error = new Error(`Action ${name} failed: ${message}`);\n (error as any).status = res.status;\n throw error;\n }\n\n // 2xx but the body couldn't even be read (mid-stream abort, decode failure,\n // etc.). Don't silently treat that as a `null` success.\n if (readFailed) {\n const cause =\n readError instanceof Error ? readError.message : String(readError);\n const error = new Error(\n `Action ${name} returned ${res.status} but the body could not be read: ${cause}`,\n );\n (error as any).status = res.status;\n throw error;\n }\n\n // 2xx with a non-empty, non-JSON body. Action callers expect typed data, so\n // returning `null` here would silently mask a real server bug (e.g. a proxy\n // returning HTML 200 instead of JSON). Throw instead — empty bodies (handled\n // above by the `raw.length > 0` guard and the 204 short-circuit) still\n // correctly resolve to `null`.\n if (parseFailed) {\n const error = new Error(\n `Action ${name} returned a non-JSON ${res.status} response: ${raw.slice(0, 200)}`,\n );\n (error as any).status = res.status;\n throw error;\n }\n\n return (data ?? (null as unknown)) as T;\n}\n\n/**\n * Imperatively call an action from browser/client code.\n *\n * Prefer `useActionQuery` / `useActionMutation` in React render flows. Use this\n * helper when a hook is not ergonomic; do not hand-write fetch calls to\n * `/_agent-native/actions/*` in components.\n */\nexport function callAction<\n TResult = undefined,\n TName extends ActionName = ActionName,\n>(\n actionName: TName,\n params?: ActionParams<TName>,\n options: ClientActionCallOptions = {},\n): Promise<TResult extends undefined ? ActionResult<TName> : TResult> {\n type R = TResult extends undefined ? ActionResult<TName> : TResult;\n return actionFetch<R>(actionName, options.method ?? \"POST\", params, {\n signal: options.signal,\n timeoutMs: options.timeoutMs,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Query hook\n// ---------------------------------------------------------------------------\n\n/**\n * Query an action exposed as GET.\n *\n * When the action type registry is generated, the return type and parameter\n * types are inferred automatically from the action's `defineAction()` call.\n *\n * ```ts\n * // Type-safe — no manual generic needed\n * const { data } = useActionQuery(\"list-meals\", { date: \"2025-01-01\" });\n *\n * // Manual override still works when needed\n * const { data } = useActionQuery<CustomType>(\"list-meals\");\n * ```\n */\nexport function useActionQuery<\n TResult = undefined,\n TName extends ActionName = ActionName,\n>(\n actionName: TName,\n params?: ActionParams<TName>,\n options?: Omit<\n UseQueryOptions<TResult extends undefined ? ActionResult<TName> : TResult>,\n \"queryKey\" | \"queryFn\"\n >,\n) {\n type R = TResult extends undefined ? ActionResult<TName> : TResult;\n return useQuery<R>({\n queryKey: [\"action\", actionName, params],\n // Thread React Query's per-fetch AbortSignal into the network request so\n // superseded fetches (key change, unmount, rapid refetch) actually cancel\n // instead of holding a per-origin connection slot until they finish.\n queryFn: ({ signal }) =>\n actionFetch<R>(actionName, \"GET\", params, { signal }),\n retry: defaultActionQueryRetry,\n retryDelay: defaultActionQueryRetryDelay,\n ...options,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Mutation hook\n// ---------------------------------------------------------------------------\n\n/**\n * Mutate via an action exposed as POST (default), PUT, or DELETE.\n *\n * When the action type registry is generated, the return type and parameter\n * types are inferred automatically.\n *\n * ```ts\n * // Type-safe\n * const { mutate } = useActionMutation(\"log-meal\");\n * mutate({ name: \"Salad\", calories: 350 });\n * ```\n */\nexport function useActionMutation<\n TData = undefined,\n TVariables = undefined,\n TName extends ActionName = ActionName,\n>(\n actionName: TName,\n options?: Omit<\n UseMutationOptions<\n TData extends undefined ? ActionResult<TName> : TData,\n Error,\n TVariables extends undefined ? ActionParams<TName> : TVariables\n >,\n \"mutationFn\"\n > & {\n method?: \"POST\" | \"PUT\" | \"DELETE\";\n skipActionQueryInvalidation?: boolean;\n },\n) {\n const queryClient = useQueryClient();\n const {\n method: methodOpt,\n onSuccess,\n skipActionQueryInvalidation = false,\n ...restOptions\n } = options ?? ({} as any);\n const method = methodOpt ?? \"POST\";\n\n type D = TData extends undefined ? ActionResult<TName> : TData;\n type V = TVariables extends undefined ? ActionParams<TName> : TVariables;\n\n return useMutation<D, Error, V>({\n ...restOptions,\n mutationFn: (params) =>\n actionFetch<D>(actionName, method, params as Record<string, any>),\n onSuccess: (...args: [any, any, any]) => {\n // Most mutations change app data broadly. High-volume background\n // mutations can opt out and perform narrower invalidation in onSuccess.\n if (!skipActionQueryInvalidation) {\n queryClient.invalidateQueries({ queryKey: [\"action\"] });\n }\n (onSuccess as Function)?.(...args);\n },\n });\n}\n"]}
|
|
@@ -75,6 +75,9 @@ export declare function subscribeSyncEvents(options: SubscribeSyncEventsOptions)
|
|
|
75
75
|
* compatibility invalidate triggered by `action` events. Use this to keep
|
|
76
76
|
* expensive active queries on explicit-refresh semantics while still letting
|
|
77
77
|
* normal source-versioned queries react through `useChangeVersion`.
|
|
78
|
+
* @param options.suppressActionInvalidationFor - Action names whose sync events
|
|
79
|
+
* should not invalidate all action queries. Use only for high-volume
|
|
80
|
+
* background actions that perform their own narrow client invalidation.
|
|
78
81
|
*/
|
|
79
82
|
export declare function useDbSync(options?: {
|
|
80
83
|
queryClient?: QueryClient;
|
|
@@ -89,6 +92,7 @@ export declare function useDbSync(options?: {
|
|
|
89
92
|
pauseWhenHidden?: boolean;
|
|
90
93
|
ignoreSource?: string;
|
|
91
94
|
actionInvalidatePredicate?: (query: Query) => boolean;
|
|
95
|
+
suppressActionInvalidationFor?: string[];
|
|
92
96
|
}): void;
|
|
93
97
|
/** @deprecated Use useDbSync instead */
|
|
94
98
|
export declare const useFileWatcher: typeof useDbSync;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-db-sync.d.ts","sourceRoot":"","sources":["../../src/client/use-db-sync.ts"],"names":[],"mappings":"AAUA,UAAU,KAAK;IACb,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;CAC9B;AAED,UAAU,WAAW;IACnB,iBAAiB,CAAC,IAAI,CAAC,EAAE;QACvB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC;KACvC,GAAG,IAAI,CAAC;CACV;AAeD,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB,CAAC;AAqbF,gB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N;AAED,wCAAwC;AACxC,eAAO,MAAM,cAAc,kBAAY,CAAC;AAExC;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,GAAE;IACP,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;CACtB,GACL,MAAM,CAuDR"}
|
|
@@ -423,6 +423,9 @@ export function subscribeSyncEvents(options) {
|
|
|
423
423
|
* compatibility invalidate triggered by `action` events. Use this to keep
|
|
424
424
|
* expensive active queries on explicit-refresh semantics while still letting
|
|
425
425
|
* normal source-versioned queries react through `useChangeVersion`.
|
|
426
|
+
* @param options.suppressActionInvalidationFor - Action names whose sync events
|
|
427
|
+
* should not invalidate all action queries. Use only for high-volume
|
|
428
|
+
* background actions that perform their own narrow client invalidation.
|
|
426
429
|
*/
|
|
427
430
|
export function useDbSync(options = {}) {
|
|
428
431
|
const { queryClient, pollUrl = agentNativePath(options.eventsUrl ?? "/_agent-native/poll"), sseUrl = resolveSseUrl(options.sseUrl), interval = 2000, fallbackInterval = Math.max(options.fallbackInterval ?? SSE_FALLBACK_INTERVAL_MS, interval), pauseWhenHidden = true, } = options;
|
|
@@ -432,6 +435,9 @@ export function useDbSync(options = {}) {
|
|
|
432
435
|
ignoreSourceRef.current = options.ignoreSource;
|
|
433
436
|
const actionInvalidatePredicateRef = useRef(options.actionInvalidatePredicate);
|
|
434
437
|
actionInvalidatePredicateRef.current = options.actionInvalidatePredicate;
|
|
438
|
+
const suppressActionInvalidationForRef = useRef(options.suppressActionInvalidationFor);
|
|
439
|
+
suppressActionInvalidationForRef.current =
|
|
440
|
+
options.suppressActionInvalidationFor;
|
|
435
441
|
useEffect(() => {
|
|
436
442
|
const id = Symbol("useDbSync");
|
|
437
443
|
// Per-subscriber version cursor: tracks which events have already been
|
|
@@ -448,6 +454,14 @@ export function useDbSync(options = {}) {
|
|
|
448
454
|
const relevant = ignore
|
|
449
455
|
? events.filter((e) => e.requestSource !== ignore)
|
|
450
456
|
: events;
|
|
457
|
+
const suppressedActions = new Set(suppressActionInvalidationForRef.current ?? []);
|
|
458
|
+
const isSuppressedActionEvent = (evt) => evt.source === "action" &&
|
|
459
|
+
typeof evt.key === "string" &&
|
|
460
|
+
suppressedActions.has(evt.key);
|
|
461
|
+
const nonAwareness = relevant.filter((e) => e.source !== "awareness");
|
|
462
|
+
const suppressesWholeBatch = nonAwareness.length > 0 &&
|
|
463
|
+
nonAwareness.every((evt) => evt.source === "action") &&
|
|
464
|
+
nonAwareness.every(isSuppressedActionEvent);
|
|
451
465
|
// Bump per-source change counters. Components that read these via
|
|
452
466
|
// `useChangeVersion(source)` and fold the value into a React Query
|
|
453
467
|
// queryKey get a targeted refetch — no whole-cache invalidate, no
|
|
@@ -466,7 +480,7 @@ export function useDbSync(options = {}) {
|
|
|
466
480
|
// still reach onEvent below for callers that render presence.
|
|
467
481
|
const invalidating = relevant.filter((e) => e.source !== "awareness");
|
|
468
482
|
if (invalidating.length > 0 && queryClient) {
|
|
469
|
-
const hasActionEvent = invalidating.some((evt) => evt.source === "action");
|
|
483
|
+
const hasActionEvent = invalidating.some((evt) => evt.source === "action" && !isSuppressedActionEvent(evt));
|
|
470
484
|
if (hasActionEvent) {
|
|
471
485
|
// Custom apps frequently start with raw `useQuery` calls before
|
|
472
486
|
// graduating to `useActionQuery` or source-versioned query keys.
|
|
@@ -483,23 +497,28 @@ export function useDbSync(options = {}) {
|
|
|
483
497
|
// etc.). Templates' own data queries do NOT live here — they react
|
|
484
498
|
// through `useChangeVersion(source)` in their query keys instead, so
|
|
485
499
|
// a single change event doesn't fan out into "refetch everything".
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
queryClient.invalidateQueries({ queryKey: ["
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
500
|
+
// Suppressed-action-only batches skip this whole list (their
|
|
501
|
+
// mutations perform their own narrow invalidation) — but events must
|
|
502
|
+
// STILL reach the onEvent forwarding below, so guard, don't return.
|
|
503
|
+
if (!suppressesWholeBatch) {
|
|
504
|
+
queryClient.invalidateQueries({ queryKey: ["action"] });
|
|
505
|
+
queryClient.invalidateQueries({ queryKey: ["extension"] });
|
|
506
|
+
queryClient.invalidateQueries({ queryKey: ["extensions"] });
|
|
507
|
+
queryClient.invalidateQueries({ queryKey: ["extension-slots"] });
|
|
508
|
+
queryClient.invalidateQueries({ queryKey: ["slot-installs"] });
|
|
509
|
+
queryClient.invalidateQueries({ queryKey: ["slot-available"] });
|
|
510
|
+
queryClient.invalidateQueries({ queryKey: ["tool"] });
|
|
511
|
+
queryClient.invalidateQueries({ queryKey: ["tools"] });
|
|
512
|
+
queryClient.invalidateQueries({ queryKey: ["app-state"] });
|
|
513
|
+
if (hasAppStateEvent(invalidating, "navigate")) {
|
|
514
|
+
queryClient.invalidateQueries({ queryKey: ["navigate-command"] });
|
|
515
|
+
}
|
|
516
|
+
if (hasAppStateEvent(invalidating, "show-questions")) {
|
|
517
|
+
queryClient.invalidateQueries({ queryKey: ["show-questions"] });
|
|
518
|
+
}
|
|
519
|
+
if (hasAppStateEvent(invalidating, "__set_url__")) {
|
|
520
|
+
queryClient.invalidateQueries({ queryKey: ["__set_url__"] });
|
|
521
|
+
}
|
|
503
522
|
}
|
|
504
523
|
}
|
|
505
524
|
// Always forward all events to onEvent — templates can layer surgical
|