@agent-native/core 0.129.1 → 0.130.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +78 -0
- package/corpus/core/docs/content/cloneable-saas.mdx +114 -0
- package/corpus/core/docs/content/creating-templates.mdx +28 -2
- package/corpus/core/docs/content/syncing-template-changes.mdx +7 -0
- package/corpus/core/docs/content/template-clips-developers.mdx +12 -5
- package/corpus/core/docs/content/template-dispatch-developers.mdx +1 -1
- package/corpus/core/docs/content/template-dispatch.mdx +1 -1
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/action-ui.ts +1 -0
- package/corpus/core/src/action.ts +5 -1
- package/corpus/core/src/agent/engine/ai-sdk-engine.ts +15 -5
- package/corpus/core/src/agent/harness/runner.ts +5 -0
- package/corpus/core/src/agent/production-agent.ts +33 -0
- package/corpus/core/src/agent/run-loop-with-resume.ts +5 -0
- package/corpus/core/src/agent/run-manager.ts +126 -1
- package/corpus/core/src/agent/thread-data-builder.ts +47 -2
- package/corpus/core/src/agent/types.ts +2 -0
- package/corpus/core/src/chat-threads/store.ts +4 -5
- package/corpus/core/src/cli/create.ts +1139 -65
- package/corpus/core/src/cli/design-connect.ts +3 -7
- package/corpus/core/src/cli/index.ts +5 -3
- package/corpus/core/src/cli/skills-content/design-visual-edit-skill.ts +83 -47
- package/corpus/core/src/client/AssistantChat.tsx +27 -16
- package/corpus/core/src/client/agent-chat-adapter.ts +24 -0
- package/corpus/core/src/client/blocks/library/wireframe-kit.tsx +17 -2
- package/corpus/core/src/client/chat/index.ts +1 -0
- package/corpus/core/src/client/chat/message-components.tsx +104 -1
- package/corpus/core/src/client/chat/run-recovery.tsx +15 -3
- package/corpus/core/src/client/chat/widgets/DataTableWidget.tsx +10 -29
- package/corpus/core/src/client/chat/widgets/WorkspaceFileWidget.tsx +71 -0
- package/corpus/core/src/client/chat/widgets/builtin-tool-renderers.tsx +22 -0
- package/corpus/core/src/client/chat/widgets/workspace-file-result.ts +49 -0
- package/corpus/core/src/client/embed-auth.ts +2 -0
- package/corpus/core/src/client/org/InvitationBanner.tsx +14 -1
- package/corpus/core/src/client/org/OrgSwitcher.tsx +23 -0
- package/corpus/core/src/client/org/TeamPage.tsx +130 -0
- package/corpus/core/src/client/org/WorkspaceNotice.tsx +85 -0
- package/corpus/core/src/client/org/hooks.ts +14 -0
- package/corpus/core/src/client/org/index.ts +2 -0
- package/corpus/core/src/client/resources/McpIntegrationDialog.tsx +27 -40
- package/corpus/core/src/client/resources/ResourcesPanel.tsx +134 -51
- package/corpus/core/src/client/resources/mcp-integration-catalog.ts +7 -0
- package/corpus/core/src/client/resources/use-resources.ts +6 -0
- package/corpus/core/src/client/use-action.ts +3 -1
- package/corpus/core/src/client/widgets/index.ts +1 -0
- package/corpus/core/src/coding-tools/run-code.ts +2 -1
- package/corpus/core/src/db/client.ts +28 -4
- package/corpus/core/src/deploy/build.ts +31 -3
- package/corpus/core/src/eject/remote-mcp-presets.ts +1 -1
- package/corpus/core/src/index.browser.ts +1 -0
- package/corpus/core/src/index.ts +1 -0
- package/corpus/core/src/integrations/google-docs-poller.ts +3 -0
- package/corpus/core/src/integrations/webhook-handler.ts +28 -11
- package/corpus/core/src/jobs/scheduler.ts +4 -0
- package/corpus/core/src/localization/default-messages.ts +3 -2
- package/corpus/core/src/mcp/build-server.ts +20 -2
- package/corpus/core/src/observability/traces.ts +48 -12
- package/corpus/core/src/org/handlers.ts +52 -1
- package/corpus/core/src/org/migrations.ts +4 -0
- package/corpus/core/src/org/plugin.ts +14 -0
- package/corpus/core/src/org/schema.ts +1 -0
- package/corpus/core/src/org/types.ts +8 -0
- package/corpus/core/src/org/workspace-url.ts +74 -0
- package/corpus/core/src/resources/handlers.ts +35 -5
- package/corpus/core/src/scripts/runner.ts +183 -5
- package/corpus/core/src/server/action-routes.ts +32 -2
- package/corpus/core/src/server/agent-chat-plugin.ts +29 -0
- package/corpus/core/src/server/agent-teams.ts +10 -1
- package/corpus/core/src/server/auth.ts +33 -7
- package/corpus/core/src/server/embed-route.ts +9 -0
- package/corpus/core/src/server/embed-session.ts +62 -3
- package/corpus/core/src/server/open-route.ts +20 -6
- package/corpus/core/src/server/prompts/framework-core-compact.ts +1 -1
- package/corpus/core/src/server/prompts/framework-core.ts +1 -0
- package/corpus/core/src/server/request-context.ts +36 -1
- package/corpus/core/src/shared/embed-auth.ts +1 -0
- package/corpus/core/src/shared/html-document.ts +115 -0
- package/corpus/core/src/shared/index.ts +1 -0
- package/corpus/core/src/sharing/access.ts +8 -1
- package/corpus/core/src/sharing/registry.ts +11 -2
- package/corpus/core/src/workspace-files/actions.ts +100 -0
- package/corpus/core/src/workspace-files/tool.ts +4 -0
- package/corpus/templates/analytics/.agents/skills/analysis-workspace/SKILL.md +4 -0
- package/corpus/templates/analytics/.agents/skills/hubspot/SKILL.md +9 -1
- package/corpus/templates/analytics/AGENTS.md +17 -24
- package/corpus/templates/analytics/actions/data-source-status.ts +11 -1
- package/corpus/templates/analytics/app/i18n-data.ts +34 -0
- package/corpus/templates/analytics/app/lib/data-source-status.ts +86 -0
- package/corpus/templates/analytics/app/lib/native-mcp-exclusions.ts +9 -0
- package/corpus/templates/analytics/app/pages/DataSources.tsx +184 -20
- package/corpus/templates/analytics/changelog/2026-07-28-native-analytics-data-sources-no-longer-show-duplicate-mc.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-29-exports-now-appear-in-chat-with-a-direct-download-instead-of.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-29-queued-chat-prompts-no-longer-resend-after-analytics-navigat.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-29-scheduled-dashboard-emails-load-every-panel-reliably-without.md +6 -0
- package/corpus/templates/analytics/scripts/emit-netlify-dashboard-report-cron.ts +6 -3
- package/corpus/templates/analytics/server/lib/credential-keys.ts +1 -1
- package/corpus/templates/analytics/server/lib/hubspot.ts +1 -1
- package/corpus/templates/analytics/server/lib/provider-credentials.ts +55 -1
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +123 -27
- package/corpus/templates/analytics/server/routes/[...page].get.ts +2 -7
- package/corpus/templates/analytics/vite.config.ts +7 -0
- package/corpus/templates/brain/actions/list-connection-providers.ts +100 -2
- package/corpus/templates/brain/app/lib/brain.ts +10 -0
- package/corpus/templates/brain/app/routes/sources.tsx +15 -4
- package/corpus/templates/brain/changelog/2026-07-29-brain-automatically-retries-failed-source-syncs-and-guides-y.md +6 -0
- package/corpus/templates/brain/jobs/process-ingest-queue.ts +13 -0
- package/corpus/templates/brain/server/jobs/sync-sources.ts +27 -22
- package/corpus/templates/brain/server/plugins/agent-chat.ts +2 -1
- package/corpus/templates/brain/server/routes/api/brain/queue/run.post.ts +7 -1
- package/corpus/templates/clips/AGENTS.md +1 -1
- package/corpus/templates/clips/actions/create-recording-agent-link.ts +11 -1
- package/corpus/templates/clips/actions/update-comment.ts +68 -0
- package/corpus/templates/clips/app/components/editor/editor-layout.tsx +0 -1
- package/corpus/templates/clips/app/components/player/comments-panel.tsx +221 -65
- package/corpus/templates/clips/app/components/player/video-player.tsx +101 -27
- package/corpus/templates/clips/app/i18n/en-US.ts +2 -1
- package/corpus/templates/clips/app/routes/bug-report.done.tsx +48 -27
- package/corpus/templates/clips/app/routes/bug-report.tsx +43 -4
- package/corpus/templates/clips/app/routes/record.tsx +2 -0
- package/corpus/templates/clips/changelog/2026-07-29-clip-playback-now-recovers-instead-of-getting-stuck-when-a-b.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-29-comments-can-now-be-edited-after-posting.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-29-download-actions-now-use-a-shorter-clearer-label.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-29-embedded-bug-reports-now-return-a-temporary-agent-readable.md +6 -0
- package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +1 -1
- package/corpus/templates/clips/desktop/src-tauri/src/system_audio.rs +21 -1
- package/corpus/templates/clips/shared/bug-report.ts +99 -0
- package/corpus/templates/content/actions/_content-database-personal-view.ts +7 -1
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +5 -2
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +20 -8
- package/corpus/templates/content/changelog/2026-07-29-missing-databases-no-longer-trigger-repeated-personal-view-e.md +6 -0
- package/corpus/templates/design/.agents/skills/visual-edit/SKILL.md +83 -47
- package/corpus/templates/design/.generated/bridge/editor-chrome.generated.ts +474 -55
- package/corpus/templates/design/.generated/bridge/embedded-wheel.generated.ts +3 -0
- package/corpus/templates/design/.generated/bridge/hit-test.generated.ts +18 -1
- package/corpus/templates/design/.generated/bridge/source-location.generated.ts +348 -0
- package/corpus/templates/design/actions/add-localhost-screens.ts +2 -7
- package/corpus/templates/design/actions/apply-visual-edit.ts +7 -1
- package/corpus/templates/design/actions/connect-localhost.ts +5 -9
- package/corpus/templates/design/actions/create-component.ts +16 -13
- package/corpus/templates/design/actions/grant-localhost-write-consent.ts +2 -7
- package/corpus/templates/design/actions/list-design-source-capabilities.ts +4 -7
- package/corpus/templates/design/actions/list-local-files.ts +26 -50
- package/corpus/templates/design/actions/list-localhost-connections.ts +2 -7
- package/corpus/templates/design/actions/migrate-board-objects-to-file.ts +2 -2
- package/corpus/templates/design/actions/open-visual-edit.ts +234 -135
- package/corpus/templates/design/actions/read-local-file.ts +26 -50
- package/corpus/templates/design/actions/request-localhost-write-consent.ts +2 -7
- package/corpus/templates/design/actions/write-local-file.ts +31 -73
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +307 -133
- package/corpus/templates/design/app/components/design/EditPanel.tsx +94 -22
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +137 -60
- package/corpus/templates/design/app/components/design/ResponsiveInteractBar.tsx +75 -14
- package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +755 -97
- package/corpus/templates/design/app/components/design/bridge/embedded-wheel.bridge.ts +8 -0
- package/corpus/templates/design/app/components/design/bridge/hit-test.bridge.ts +24 -1
- package/corpus/templates/design/app/components/design/bridge/source-location.bridge.ts +530 -0
- package/corpus/templates/design/app/components/design/code-workbench/CodeWorkbenchLoader.tsx +278 -0
- package/corpus/templates/design/app/components/design/code-workbench/editor/MonacoHost.tsx +32 -12
- package/corpus/templates/design/app/components/design/code-workbench/editor/monaco-setup.ts +14 -3
- package/corpus/templates/design/app/components/design/code-workbench/explorer/ExplorerView.tsx +87 -24
- package/corpus/templates/design/app/components/design/code-workbench/explorer/FileTree.tsx +36 -0
- package/corpus/templates/design/app/components/design/code-workbench/store.tsx +2 -1
- package/corpus/templates/design/app/components/design/code-workbench/workspace/localhost-provider.ts +48 -8
- package/corpus/templates/design/app/components/design/design-canvas/content-size-report.ts +3 -13
- package/corpus/templates/design/app/components/design/design-canvas/embedded-frame.ts +4 -2
- package/corpus/templates/design/app/components/design/design-canvas/hit-test.ts +3 -13
- package/corpus/templates/design/app/components/design/edit-panel/element-classification.ts +3 -1
- package/corpus/templates/design/app/components/design/edit-panel/inspect-code-source.ts +93 -0
- package/corpus/templates/design/app/components/design/multi-screen/board-surface-html.ts +4 -2
- package/corpus/templates/design/app/components/design/multi-screen/cross-screen-drop.ts +35 -0
- package/corpus/templates/design/app/components/design/multi-screen/iframe-targeting.ts +24 -0
- package/corpus/templates/design/app/components/design/multi-screen/types.ts +9 -0
- package/corpus/templates/design/app/components/design/types.ts +29 -0
- package/corpus/templates/design/app/components/layout/Layout.tsx +7 -4
- package/corpus/templates/design/app/hooks/use-navigation-state.ts +3 -0
- package/corpus/templates/design/app/i18n-data.ts +153 -46
- package/corpus/templates/design/app/i18n-responsive-interact.ts +12 -12
- package/corpus/templates/design/app/lib/design-editor-route.ts +23 -0
- package/corpus/templates/design/app/pages/VisualEdit.tsx +19 -6
- package/corpus/templates/design/app/pages/design-editor/action-error.ts +19 -0
- package/corpus/templates/design/app/pages/design-editor/canvas-primitive-insert.ts +29 -0
- package/corpus/templates/design/app/pages/design-editor/clone-and-pen-edit.ts +6 -0
- package/corpus/templates/design/app/pages/design-editor/code-layer-state.ts +277 -15
- package/corpus/templates/design/app/pages/design-editor/editor-state.ts +75 -9
- package/corpus/templates/design/app/pages/design-editor/layer-state-scope.ts +28 -0
- package/corpus/templates/design/app/pages/design-editor/live-screen-layer-drop.ts +41 -0
- package/corpus/templates/design/app/pages/design-editor/pending-edits.ts +496 -41
- package/corpus/templates/design/app/pages/design-editor/pending-live-edit-unload-guard.ts +27 -0
- package/corpus/templates/design/app/pages/design-editor/pending-structure-verification.ts +10 -0
- package/corpus/templates/design/app/pages/design-editor/react-semantic-handoff.ts +168 -9
- package/corpus/templates/design/app/pages/design-editor/responsive-interact.ts +41 -3
- package/corpus/templates/design/app/pages/design-editor/screen-command-utils.ts +5 -0
- package/corpus/templates/design/app/pages/design-editor/selection-state.ts +42 -13
- package/corpus/templates/design/app/pages/design-editor/source-location.ts +180 -0
- package/corpus/templates/design/app/pages/design-editor/tool-state.ts +17 -0
- package/corpus/templates/design/app/public-routes.ts +1 -0
- package/corpus/templates/design/app/routes/visual-edit.$id.tsx +15 -0
- package/corpus/templates/design/changelog/2026-06-29-screen-overview-is-easier-to-find-and-named-screens-open-dir.md +1 -1
- package/corpus/templates/design/changelog/2026-07-28-deleting-a-selected-element-now-removes-it-from-the-live-pre.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-deleting-an-element-on-a-connected-localhost-screen-now-queu.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-interact-mode-now-shows-a-responsive-device-preview-with-pre.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-layer-hide-and-lock-now-apply-to-the-live-preview-instead-of.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-layers-panel-selections-on-a-connected-localhost-screen-can-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-locked-layers-now-show-a-subtle-dashed-outline-in-the-live-p.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-the-apply-design-updates-button-now-counts-pending-live-text.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-the-design-canvas-no-longer-stalls-on-a-render-loop-while-a-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-visual-edit-on-a-local-dev-server-no-longer-requires-signing.md +6 -0
- package/corpus/templates/design/changelog/2026-07-28-visual-edits-on-a-react-19-app-no-longer-report-a-source-lin.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-an-edit-that-cannot-be-written-to-source-now-names-the-reaso.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-applying-a-primitive-dropped-onto-a-connected-localhost-scre.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-changing-a-style-in-the-inspector-now-updates-a-connected-lo.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-choosing-edit-or-annotate-from-a-focused-screen-now-returns-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-concurrent-source-edits-now-return-a-clear-conflict-response.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-creating-a-component-from-an-element-that-repeats-in-the-sou.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-deleting-an-element-you-just-dropped-onto-a-live-screen-no-l.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-dragging-a-layer-across-screens-no-longer-dies-when-the-poin.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-dragging-an-element-from-a-stored-screen-into-a-live-localho.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-drawing-a-box-on-the-canvas-and-dragging-it-into-a-connected.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-fixed-a-loading-screen-flicker-when-reopening-designs-with-a.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-interact-mode-has-edit-and-annotate-buttons-again-so-you-can.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-layer-groups-can-be-dropped-onto-live-localhost-screens.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-localhost-source-errors-now-say-what-actually-went-wrong-whi.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-opening-or-refreshing-a-live-localhost-screen-in-single-scre.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-redo-after-undoing-a-drop-onto-a-live-screen-puts-the-elemen.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-shapes-can-be-drawn-directly-onto-live-localhost-screens.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-shapes-drawn-on-the-canvas-board-now-appear-immediately-inst.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-style-edits-on-a-running-localhost-screen-now-preview-live-a.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-the-apply-design-updates-control-now-appears-as-a-clean-conn.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-visual-edits-on-a-mapped-component-instance-now-tell-the-age.md +6 -0
- package/corpus/templates/design/server/lib/design-data-access.ts +21 -7
- package/corpus/templates/design/server/lib/localhost-connection.ts +240 -0
- package/corpus/templates/design/server/routes/[...page].get.ts +2 -5
- package/corpus/templates/design/server/source-workspace.ts +2 -0
- package/corpus/templates/design/shared/code-layer.ts +43 -0
- package/corpus/templates/design/shared/html-content.ts +26 -0
- package/corpus/templates/design/shared/html-integrity.ts +21 -1
- package/corpus/templates/design/shared/local-jsx-visual-edit.ts +15 -0
- package/corpus/templates/design/shared/source-mode.ts +76 -0
- package/corpus/templates/dispatch/changelog/2026-07-29-workspace-members-without-admin-access-now-see-a-clear-permi.md +6 -0
- package/corpus/templates/dispatch/server/lib/usage-metrics.ts +2 -1
- package/corpus/templates/plan/app/lib/plan-annotation-runtime.ts +3 -4
- package/corpus/templates/plan/server/routes/[...page].get.ts +2 -5
- package/corpus/templates/slides/actions/patch-deck.ts +29 -17
- package/corpus/toolkit/CHANGELOG.md +6 -0
- package/corpus/toolkit/package.json +1 -1
- package/corpus/toolkit/src/composer/ComposerPlusMenu.tsx +3 -2
- package/dist/action-ui.d.ts +1 -0
- package/dist/action-ui.d.ts.map +1 -1
- package/dist/action-ui.js +1 -0
- package/dist/action-ui.js.map +1 -1
- package/dist/action.d.ts +5 -1
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js.map +1 -1
- package/dist/agent/engine/ai-sdk-engine.d.ts.map +1 -1
- package/dist/agent/engine/ai-sdk-engine.js +13 -5
- package/dist/agent/engine/ai-sdk-engine.js.map +1 -1
- package/dist/agent/harness/runner.d.ts.map +1 -1
- package/dist/agent/harness/runner.js +5 -0
- package/dist/agent/harness/runner.js.map +1 -1
- package/dist/agent/production-agent.d.ts +16 -0
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +18 -1
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-loop-with-resume.d.ts.map +1 -1
- package/dist/agent/run-loop-with-resume.js +6 -0
- package/dist/agent/run-loop-with-resume.js.map +1 -1
- package/dist/agent/run-manager.d.ts +14 -0
- package/dist/agent/run-manager.d.ts.map +1 -1
- package/dist/agent/run-manager.js +91 -1
- package/dist/agent/run-manager.js.map +1 -1
- package/dist/agent/thread-data-builder.d.ts +3 -0
- package/dist/agent/thread-data-builder.d.ts.map +1 -1
- package/dist/agent/thread-data-builder.js +35 -3
- package/dist/agent/thread-data-builder.js.map +1 -1
- package/dist/agent/types.d.ts +2 -0
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/chat-threads/store.d.ts.map +1 -1
- package/dist/chat-threads/store.js +4 -6
- package/dist/chat-threads/store.js.map +1 -1
- package/dist/cli/create.d.ts +66 -6
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +765 -66
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/design-connect.d.ts.map +1 -1
- package/dist/cli/design-connect.js +2 -7
- package/dist/cli/design-connect.js.map +1 -1
- package/dist/cli/index.js +5 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/skills-content/design-visual-edit-skill.d.ts +1 -1
- package/dist/cli/skills-content/design-visual-edit-skill.d.ts.map +1 -1
- package/dist/cli/skills-content/design-visual-edit-skill.js +83 -47
- package/dist/cli/skills-content/design-visual-edit-skill.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +16 -9
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +21 -0
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/blocks/library/wireframe-kit.d.ts +2 -0
- package/dist/client/blocks/library/wireframe-kit.d.ts.map +1 -1
- package/dist/client/blocks/library/wireframe-kit.js +8 -2
- package/dist/client/blocks/library/wireframe-kit.js.map +1 -1
- package/dist/client/chat/index.d.ts +1 -1
- package/dist/client/chat/index.d.ts.map +1 -1
- package/dist/client/chat/index.js +1 -1
- package/dist/client/chat/index.js.map +1 -1
- package/dist/client/chat/message-components.d.ts +17 -0
- package/dist/client/chat/message-components.d.ts.map +1 -1
- package/dist/client/chat/message-components.js +24 -2
- package/dist/client/chat/message-components.js.map +1 -1
- package/dist/client/chat/run-recovery.d.ts +6 -0
- package/dist/client/chat/run-recovery.d.ts.map +1 -1
- package/dist/client/chat/run-recovery.js +13 -3
- package/dist/client/chat/run-recovery.js.map +1 -1
- package/dist/client/chat/widgets/DataTableWidget.d.ts.map +1 -1
- package/dist/client/chat/widgets/DataTableWidget.js +2 -3
- package/dist/client/chat/widgets/DataTableWidget.js.map +1 -1
- package/dist/client/chat/widgets/WorkspaceFileWidget.d.ts +5 -0
- package/dist/client/chat/widgets/WorkspaceFileWidget.d.ts.map +1 -0
- package/dist/client/chat/widgets/WorkspaceFileWidget.js +34 -0
- package/dist/client/chat/widgets/WorkspaceFileWidget.js.map +1 -0
- package/dist/client/chat/widgets/builtin-tool-renderers.d.ts.map +1 -1
- package/dist/client/chat/widgets/builtin-tool-renderers.js +13 -1
- package/dist/client/chat/widgets/builtin-tool-renderers.js.map +1 -1
- package/dist/client/chat/widgets/workspace-file-result.d.ts +12 -0
- package/dist/client/chat/widgets/workspace-file-result.d.ts.map +1 -0
- package/dist/client/chat/widgets/workspace-file-result.js +34 -0
- package/dist/client/chat/widgets/workspace-file-result.js.map +1 -0
- package/dist/client/embed-auth.d.ts.map +1 -1
- package/dist/client/embed-auth.js +2 -1
- package/dist/client/embed-auth.js.map +1 -1
- package/dist/client/org/InvitationBanner.d.ts +5 -2
- package/dist/client/org/InvitationBanner.d.ts.map +1 -1
- package/dist/client/org/InvitationBanner.js +9 -2
- package/dist/client/org/InvitationBanner.js.map +1 -1
- package/dist/client/org/OrgSwitcher.d.ts.map +1 -1
- package/dist/client/org/OrgSwitcher.js +3 -2
- package/dist/client/org/OrgSwitcher.js.map +1 -1
- package/dist/client/org/TeamPage.d.ts.map +1 -1
- package/dist/client/org/TeamPage.js +27 -3
- package/dist/client/org/TeamPage.js.map +1 -1
- package/dist/client/org/WorkspaceNotice.d.ts +18 -0
- package/dist/client/org/WorkspaceNotice.d.ts.map +1 -0
- package/dist/client/org/WorkspaceNotice.js +56 -0
- package/dist/client/org/WorkspaceNotice.js.map +1 -0
- package/dist/client/org/hooks.d.ts +1 -0
- package/dist/client/org/hooks.d.ts.map +1 -1
- package/dist/client/org/hooks.js +12 -0
- package/dist/client/org/hooks.js.map +1 -1
- package/dist/client/org/index.d.ts +2 -1
- package/dist/client/org/index.d.ts.map +1 -1
- package/dist/client/org/index.js +2 -1
- package/dist/client/org/index.js.map +1 -1
- package/dist/client/resources/McpIntegrationDialog.d.ts.map +1 -1
- package/dist/client/resources/McpIntegrationDialog.js +8 -12
- package/dist/client/resources/McpIntegrationDialog.js.map +1 -1
- package/dist/client/resources/ResourcesPanel.d.ts +3 -0
- package/dist/client/resources/ResourcesPanel.d.ts.map +1 -1
- package/dist/client/resources/ResourcesPanel.js +49 -20
- package/dist/client/resources/ResourcesPanel.js.map +1 -1
- package/dist/client/resources/mcp-integration-catalog.d.ts +1 -0
- package/dist/client/resources/mcp-integration-catalog.d.ts.map +1 -1
- package/dist/client/resources/mcp-integration-catalog.js +3 -0
- package/dist/client/resources/mcp-integration-catalog.js.map +1 -1
- package/dist/client/resources/use-resources.d.ts +1 -0
- package/dist/client/resources/use-resources.d.ts.map +1 -1
- package/dist/client/resources/use-resources.js +3 -0
- package/dist/client/resources/use-resources.js.map +1 -1
- package/dist/client/use-action.d.ts +3 -1
- package/dist/client/use-action.d.ts.map +1 -1
- package/dist/client/use-action.js +3 -1
- package/dist/client/use-action.js.map +1 -1
- package/dist/client/widgets/index.d.ts +1 -1
- package/dist/client/widgets/index.d.ts.map +1 -1
- package/dist/client/widgets/index.js +1 -1
- package/dist/client/widgets/index.js.map +1 -1
- package/dist/coding-tools/run-code.js +2 -1
- package/dist/coding-tools/run-code.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/db/client.d.ts +1 -0
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +24 -3
- package/dist/db/client.js.map +1 -1
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +25 -3
- package/dist/deploy/build.js.map +1 -1
- package/dist/eject/remote-mcp-presets.js +1 -1
- package/dist/eject/remote-mcp-presets.js.map +1 -1
- package/dist/index.browser.d.ts +1 -1
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +1 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/integrations/google-docs-poller.d.ts.map +1 -1
- package/dist/integrations/google-docs-poller.js +4 -1
- package/dist/integrations/google-docs-poller.js.map +1 -1
- package/dist/integrations/webhook-handler.d.ts.map +1 -1
- package/dist/integrations/webhook-handler.js +23 -11
- package/dist/integrations/webhook-handler.js.map +1 -1
- package/dist/jobs/scheduler.js +4 -0
- package/dist/jobs/scheduler.js.map +1 -1
- package/dist/localization/default-messages.d.ts +3 -2
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +3 -2
- package/dist/localization/default-messages.js.map +1 -1
- package/dist/mcp/build-server.d.ts.map +1 -1
- package/dist/mcp/build-server.js +10 -1
- package/dist/mcp/build-server.js.map +1 -1
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/observability/traces.d.ts.map +1 -1
- package/dist/observability/traces.js +27 -7
- package/dist/observability/traces.js.map +1 -1
- package/dist/org/handlers.d.ts +15 -0
- package/dist/org/handlers.d.ts.map +1 -1
- package/dist/org/handlers.js +45 -1
- package/dist/org/handlers.js.map +1 -1
- package/dist/org/migrations.d.ts.map +1 -1
- package/dist/org/migrations.js +4 -0
- package/dist/org/migrations.js.map +1 -1
- package/dist/org/plugin.d.ts +1 -0
- package/dist/org/plugin.d.ts.map +1 -1
- package/dist/org/plugin.js +10 -1
- package/dist/org/plugin.js.map +1 -1
- package/dist/org/schema.d.ts +19 -0
- package/dist/org/schema.d.ts.map +1 -1
- package/dist/org/schema.js +1 -0
- package/dist/org/schema.js.map +1 -1
- package/dist/org/types.d.ts +8 -0
- package/dist/org/types.d.ts.map +1 -1
- package/dist/org/types.js.map +1 -1
- package/dist/org/workspace-url.d.ts +32 -0
- package/dist/org/workspace-url.d.ts.map +1 -0
- package/dist/org/workspace-url.js +63 -0
- package/dist/org/workspace-url.js.map +1 -0
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +11 -11
- package/dist/provider-api/actions/provider-api.d.ts +7 -7
- package/dist/resources/handlers.d.ts +2 -3
- package/dist/resources/handlers.d.ts.map +1 -1
- package/dist/resources/handlers.js +25 -5
- package/dist/resources/handlers.js.map +1 -1
- package/dist/scripts/runner.d.ts +17 -0
- package/dist/scripts/runner.d.ts.map +1 -1
- package/dist/scripts/runner.js +130 -5
- package/dist/scripts/runner.js.map +1 -1
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/action-routes.d.ts.map +1 -1
- package/dist/server/action-routes.js +24 -2
- package/dist/server/action-routes.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +26 -1
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/agent-teams.d.ts.map +1 -1
- package/dist/server/agent-teams.js +10 -1
- package/dist/server/agent-teams.js.map +1 -1
- package/dist/server/auth.d.ts +22 -0
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +33 -7
- package/dist/server/auth.js.map +1 -1
- package/dist/server/embed-route.d.ts.map +1 -1
- package/dist/server/embed-route.js +6 -1
- package/dist/server/embed-route.js.map +1 -1
- package/dist/server/embed-session.d.ts +7 -0
- package/dist/server/embed-session.d.ts.map +1 -1
- package/dist/server/embed-session.js +46 -4
- package/dist/server/embed-session.js.map +1 -1
- package/dist/server/open-route.d.ts.map +1 -1
- package/dist/server/open-route.js +17 -7
- package/dist/server/open-route.js.map +1 -1
- package/dist/server/prompts/framework-core-compact.js +1 -1
- package/dist/server/prompts/framework-core-compact.js.map +1 -1
- package/dist/server/prompts/framework-core.d.ts.map +1 -1
- package/dist/server/prompts/framework-core.js +1 -0
- package/dist/server/prompts/framework-core.js.map +1 -1
- package/dist/server/request-context.d.ts +26 -0
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/request-context.js +18 -1
- package/dist/server/request-context.js.map +1 -1
- package/dist/shared/embed-auth.d.ts +1 -0
- package/dist/shared/embed-auth.d.ts.map +1 -1
- package/dist/shared/embed-auth.js +1 -0
- package/dist/shared/embed-auth.js.map +1 -1
- package/dist/shared/html-document.d.ts +12 -0
- package/dist/shared/html-document.d.ts.map +1 -0
- package/dist/shared/html-document.js +92 -0
- package/dist/shared/html-document.js.map +1 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +1 -0
- package/dist/shared/index.js.map +1 -1
- package/dist/sharing/access.d.ts +1 -0
- package/dist/sharing/access.d.ts.map +1 -1
- package/dist/sharing/access.js +8 -2
- package/dist/sharing/access.js.map +1 -1
- package/dist/sharing/registry.d.ts +3 -0
- package/dist/sharing/registry.d.ts.map +1 -1
- package/dist/sharing/registry.js.map +1 -1
- package/dist/workspace-files/actions.d.ts +28 -0
- package/dist/workspace-files/actions.d.ts.map +1 -0
- package/dist/workspace-files/actions.js +75 -0
- package/dist/workspace-files/actions.js.map +1 -0
- package/dist/workspace-files/tool.d.ts.map +1 -1
- package/dist/workspace-files/tool.js +4 -0
- package/dist/workspace-files/tool.js.map +1 -1
- package/docs/content/cloneable-saas.mdx +114 -0
- package/docs/content/creating-templates.mdx +28 -2
- package/docs/content/syncing-template-changes.mdx +7 -0
- package/docs/content/template-clips-developers.mdx +12 -5
- package/docs/content/template-dispatch-developers.mdx +1 -1
- package/docs/content/template-dispatch.mdx +1 -1
- package/package.json +2 -2
- package/src/action-ui.ts +1 -0
- package/src/action.ts +5 -1
- package/src/agent/engine/ai-sdk-engine.ts +15 -5
- package/src/agent/harness/runner.ts +5 -0
- package/src/agent/production-agent.ts +33 -0
- package/src/agent/run-loop-with-resume.ts +5 -0
- package/src/agent/run-manager.ts +126 -1
- package/src/agent/thread-data-builder.ts +47 -2
- package/src/agent/types.ts +2 -0
- package/src/chat-threads/store.ts +4 -5
- package/src/cli/create.ts +1139 -65
- package/src/cli/design-connect.ts +3 -7
- package/src/cli/index.ts +5 -3
- package/src/cli/skills-content/design-visual-edit-skill.ts +83 -47
- package/src/client/AssistantChat.tsx +27 -16
- package/src/client/agent-chat-adapter.ts +24 -0
- package/src/client/blocks/library/wireframe-kit.tsx +17 -2
- package/src/client/chat/index.ts +1 -0
- package/src/client/chat/message-components.tsx +104 -1
- package/src/client/chat/run-recovery.tsx +15 -3
- package/src/client/chat/widgets/DataTableWidget.tsx +10 -29
- package/src/client/chat/widgets/WorkspaceFileWidget.tsx +71 -0
- package/src/client/chat/widgets/builtin-tool-renderers.tsx +22 -0
- package/src/client/chat/widgets/workspace-file-result.ts +49 -0
- package/src/client/embed-auth.ts +2 -0
- package/src/client/org/InvitationBanner.tsx +14 -1
- package/src/client/org/OrgSwitcher.tsx +23 -0
- package/src/client/org/TeamPage.tsx +130 -0
- package/src/client/org/WorkspaceNotice.tsx +85 -0
- package/src/client/org/hooks.ts +14 -0
- package/src/client/org/index.ts +2 -0
- package/src/client/resources/McpIntegrationDialog.tsx +27 -40
- package/src/client/resources/ResourcesPanel.tsx +134 -51
- package/src/client/resources/mcp-integration-catalog.ts +7 -0
- package/src/client/resources/use-resources.ts +6 -0
- package/src/client/use-action.ts +3 -1
- package/src/client/widgets/index.ts +1 -0
- package/src/coding-tools/run-code.ts +2 -1
- package/src/db/client.ts +28 -4
- package/src/deploy/build.ts +31 -3
- package/src/eject/remote-mcp-presets.ts +1 -1
- package/src/index.browser.ts +1 -0
- package/src/index.ts +1 -0
- package/src/integrations/google-docs-poller.ts +3 -0
- package/src/integrations/webhook-handler.ts +28 -11
- package/src/jobs/scheduler.ts +4 -0
- package/src/localization/default-messages.ts +3 -2
- package/src/mcp/build-server.ts +20 -2
- package/src/observability/traces.ts +48 -12
- package/src/org/handlers.ts +52 -1
- package/src/org/migrations.ts +4 -0
- package/src/org/plugin.ts +14 -0
- package/src/org/schema.ts +1 -0
- package/src/org/types.ts +8 -0
- package/src/org/workspace-url.ts +74 -0
- package/src/resources/handlers.ts +35 -5
- package/src/scripts/runner.ts +183 -5
- package/src/server/__snapshots__/agent-chat-plugin.surface.spec.ts.snap +2 -1
- package/src/server/action-routes.ts +32 -2
- package/src/server/agent-chat-plugin.ts +29 -0
- package/src/server/agent-teams.ts +10 -1
- package/src/server/auth.ts +33 -7
- package/src/server/embed-route.ts +9 -0
- package/src/server/embed-session.ts +62 -3
- package/src/server/open-route.ts +20 -6
- package/src/server/prompts/framework-core-compact.ts +1 -1
- package/src/server/prompts/framework-core.ts +1 -0
- package/src/server/request-context.ts +36 -1
- package/src/shared/embed-auth.ts +1 -0
- package/src/shared/html-document.ts +115 -0
- package/src/shared/index.ts +1 -0
- package/src/sharing/access.ts +8 -1
- package/src/sharing/registry.ts +11 -2
- package/src/workspace-files/actions.ts +100 -0
- package/src/workspace-files/tool.ts +4 -0
- package/corpus/templates/design/changelog/2026-07-28-interact-mode-can-preview-designs-in-responsive-device-sizes.md +0 -6
- package/corpus/templates/design/changelog/2026-07-28-interact-mode-now-opens-a-full-screen-responsive-preview-wit.md +0 -6
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
isCustomMcpIntegrationEnabled,
|
|
33
33
|
navigateToMcpOAuthStart,
|
|
34
34
|
resolveMcpIntegrationScope,
|
|
35
|
+
shouldOfferMcpOrganizationScope,
|
|
35
36
|
type DefaultMcpIntegration,
|
|
36
37
|
} from "./mcp-integration-catalog.js";
|
|
37
38
|
import {
|
|
@@ -271,7 +272,7 @@ export function McpIntegrationDialog({
|
|
|
271
272
|
name: args.name,
|
|
272
273
|
url: args.url,
|
|
273
274
|
description: args.description,
|
|
274
|
-
scope
|
|
275
|
+
scope,
|
|
275
276
|
returnUrl,
|
|
276
277
|
}),
|
|
277
278
|
),
|
|
@@ -403,11 +404,7 @@ export function McpIntegrationDialog({
|
|
|
403
404
|
};
|
|
404
405
|
|
|
405
406
|
const renderScopeSelector = () => {
|
|
406
|
-
|
|
407
|
-
? t("mcpIntegrations.orgNoOrg")
|
|
408
|
-
: !canCreateOrgMcp
|
|
409
|
-
? t("mcpIntegrations.orgAdminOnly")
|
|
410
|
-
: null;
|
|
407
|
+
if (!shouldOfferMcpOrganizationScope(hasOrg, canCreateOrgMcp)) return null;
|
|
411
408
|
|
|
412
409
|
return (
|
|
413
410
|
<div className="flex gap-1 rounded-md border border-border bg-background p-0.5">
|
|
@@ -423,26 +420,18 @@ export function McpIntegrationDialog({
|
|
|
423
420
|
>
|
|
424
421
|
{t("mcpIntegrations.personal")}
|
|
425
422
|
</button>
|
|
426
|
-
<
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
"cursor-not-allowed opacity-50 hover:text-muted-foreground",
|
|
439
|
-
)}
|
|
440
|
-
>
|
|
441
|
-
{t("mcpIntegrations.organization")}
|
|
442
|
-
</button>
|
|
443
|
-
</TooltipTrigger>
|
|
444
|
-
{orgTooltip && <TooltipContent>{orgTooltip}</TooltipContent>}
|
|
445
|
-
</Tooltip>
|
|
423
|
+
<button
|
|
424
|
+
type="button"
|
|
425
|
+
onClick={() => setScope("org")}
|
|
426
|
+
className={cn(
|
|
427
|
+
"flex-1 rounded px-2 py-1.5 text-[11px] font-medium",
|
|
428
|
+
scope === "org"
|
|
429
|
+
? "bg-accent text-foreground"
|
|
430
|
+
: "text-muted-foreground hover:text-foreground",
|
|
431
|
+
)}
|
|
432
|
+
>
|
|
433
|
+
{t("mcpIntegrations.organization")}
|
|
434
|
+
</button>
|
|
446
435
|
</div>
|
|
447
436
|
);
|
|
448
437
|
};
|
|
@@ -781,20 +770,7 @@ export function McpIntegrationDialog({
|
|
|
781
770
|
>
|
|
782
771
|
{t("mcpIntegrations.test")}
|
|
783
772
|
</button>
|
|
784
|
-
{selected
|
|
785
|
-
<button
|
|
786
|
-
type="button"
|
|
787
|
-
onClick={() => connectWithOAuth(selected)}
|
|
788
|
-
disabled={!name.trim() || !url.trim() || busy}
|
|
789
|
-
aria-busy={busy}
|
|
790
|
-
className="rounded-md border border-border bg-background px-3 py-1.5 text-[12px] font-medium text-foreground hover:bg-accent disabled:pointer-events-none disabled:opacity-40"
|
|
791
|
-
>
|
|
792
|
-
{busy && (
|
|
793
|
-
<IconLoader2 className="me-1.5 inline h-3.5 w-3.5 animate-spin" />
|
|
794
|
-
)}
|
|
795
|
-
{t("mcpIntegrations.connectWithOAuth")}
|
|
796
|
-
</button>
|
|
797
|
-
) : !selected ? (
|
|
773
|
+
{!selected ? (
|
|
798
774
|
<button
|
|
799
775
|
type="button"
|
|
800
776
|
onClick={connectCustomWithOAuth}
|
|
@@ -820,6 +796,17 @@ export function McpIntegrationDialog({
|
|
|
820
796
|
<IconExternalLink className="h-3 w-3" />
|
|
821
797
|
</a>
|
|
822
798
|
) : null
|
|
799
|
+
) : selected?.authMode === "oauth" ? (
|
|
800
|
+
<button
|
|
801
|
+
type="button"
|
|
802
|
+
onClick={() => connectWithOAuth(selected)}
|
|
803
|
+
disabled={!name.trim() || !url.trim() || busy}
|
|
804
|
+
aria-busy={busy}
|
|
805
|
+
className="inline-flex min-w-[92px] items-center justify-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-[12px] font-medium text-primary-foreground hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-40"
|
|
806
|
+
>
|
|
807
|
+
{busy && <IconLoader2 className="h-3.5 w-3.5 animate-spin" />}
|
|
808
|
+
{t("mcpIntegrations.connectWithOAuth")}
|
|
809
|
+
</button>
|
|
823
810
|
) : (
|
|
824
811
|
<button
|
|
825
812
|
type="button"
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
IconClock,
|
|
13
13
|
IconHierarchy2,
|
|
14
14
|
IconPlugConnected,
|
|
15
|
+
IconDownload,
|
|
15
16
|
} from "@tabler/icons-react";
|
|
16
17
|
import React, {
|
|
17
18
|
useState,
|
|
@@ -46,7 +47,7 @@ import { useUploadResource } from "../uploads/use-upload-resource.js";
|
|
|
46
47
|
import { cn } from "../utils.js";
|
|
47
48
|
import { BuiltinCapabilityDetail } from "./BuiltinCapabilityDetail.js";
|
|
48
49
|
import {
|
|
49
|
-
|
|
50
|
+
isCustomMcpIntegrationEnabled,
|
|
50
51
|
type DefaultMcpIntegration,
|
|
51
52
|
} from "./mcp-integration-catalog.js";
|
|
52
53
|
import { McpIntegrationDialog } from "./McpIntegrationDialog.js";
|
|
@@ -70,6 +71,7 @@ import {
|
|
|
70
71
|
useCreateResource,
|
|
71
72
|
useUpdateResource,
|
|
72
73
|
useDeleteResource,
|
|
74
|
+
resourceDownloadUrl,
|
|
73
75
|
withMcpServersFolder,
|
|
74
76
|
withAgentScratchFolder,
|
|
75
77
|
type ResourceScope,
|
|
@@ -261,6 +263,7 @@ function buildAgentResourceContent({
|
|
|
261
263
|
function CreateMenu({
|
|
262
264
|
scope,
|
|
263
265
|
resourceFilter,
|
|
266
|
+
personalMcpOnly = false,
|
|
264
267
|
onCreateFile,
|
|
265
268
|
onCreateResource,
|
|
266
269
|
onCreateMcpServer,
|
|
@@ -275,6 +278,7 @@ function CreateMenu({
|
|
|
275
278
|
}: {
|
|
276
279
|
scope: ResourceScope;
|
|
277
280
|
resourceFilter?: ResourceView;
|
|
281
|
+
personalMcpOnly?: boolean;
|
|
278
282
|
onCreateFile: (name: string) => void;
|
|
279
283
|
onCreateResource: (
|
|
280
284
|
path: string,
|
|
@@ -310,10 +314,7 @@ function CreateMenu({
|
|
|
310
314
|
const [mcpDialogOpen, setMcpDialogOpen] = useState(false);
|
|
311
315
|
const [view, setView] = useState<CreateMenuView>("menu");
|
|
312
316
|
const showMcpIntegrations = useMemo(
|
|
313
|
-
() =>
|
|
314
|
-
mcpIntegrations
|
|
315
|
-
? mcpIntegrations.length > 0
|
|
316
|
-
: isMcpIntegrationCatalogAvailable(),
|
|
317
|
+
() => hasAvailableMcpIntegrations(mcpIntegrations),
|
|
317
318
|
[mcpIntegrations],
|
|
318
319
|
);
|
|
319
320
|
const [value, setValue] = useState("");
|
|
@@ -323,8 +324,11 @@ function CreateMenu({
|
|
|
323
324
|
const [agentInstructions, setAgentInstructions] = useState(
|
|
324
325
|
`# Role\n\nDefine how this agent should work.\n\n## Focus\n\n- What kinds of tasks it should handle\n- What tone or approach it should use\n- Important constraints or preferences\n`,
|
|
325
326
|
);
|
|
326
|
-
const defaultMcpScope: McpServerScope =
|
|
327
|
-
|
|
327
|
+
const defaultMcpScope: McpServerScope = personalMcpOnly
|
|
328
|
+
? "user"
|
|
329
|
+
: scope === "shared" && canCreateOrgMcp
|
|
330
|
+
? "org"
|
|
331
|
+
: "user";
|
|
328
332
|
const inputRef = useRef<HTMLInputElement | HTMLTextAreaElement>(null);
|
|
329
333
|
const skillFileInputRef = useRef<HTMLInputElement>(null);
|
|
330
334
|
const skillHoverTimerRef = useRef<number | null>(null);
|
|
@@ -364,7 +368,7 @@ function CreateMenu({
|
|
|
364
368
|
|
|
365
369
|
useEffect(() => {
|
|
366
370
|
if (open) {
|
|
367
|
-
setView(initialView);
|
|
371
|
+
setView(personalMcpOnly ? "menu" : initialView);
|
|
368
372
|
setValue("");
|
|
369
373
|
setAgentName("");
|
|
370
374
|
setAgentDescription("");
|
|
@@ -377,7 +381,7 @@ function CreateMenu({
|
|
|
377
381
|
setSkillUploadFileName("");
|
|
378
382
|
setSkillFlyoutOpen(false);
|
|
379
383
|
}
|
|
380
|
-
}, [initialView, open]);
|
|
384
|
+
}, [initialView, open, personalMcpOnly]);
|
|
381
385
|
|
|
382
386
|
useEffect(() => {
|
|
383
387
|
if (view !== "menu" && view !== "agent-form") {
|
|
@@ -610,6 +614,7 @@ The result should be a reusable agent profile, not a one-off task response.`,
|
|
|
610
614
|
desc: string;
|
|
611
615
|
action: () => void;
|
|
612
616
|
hoverAction?: () => void;
|
|
617
|
+
personalMcp?: boolean;
|
|
613
618
|
}[] = [
|
|
614
619
|
{
|
|
615
620
|
icon: <IconPlus className="h-3.5 w-3.5" />,
|
|
@@ -663,6 +668,7 @@ The result should be a reusable agent profile, not a one-off task response.`,
|
|
|
663
668
|
icon: <IconPlugConnected className="h-3.5 w-3.5" />,
|
|
664
669
|
label: t("mcpIntegrations.menuLabel"),
|
|
665
670
|
desc: t("mcpIntegrations.menuDescription"),
|
|
671
|
+
personalMcp: true,
|
|
666
672
|
action: () => {
|
|
667
673
|
setOpen(false);
|
|
668
674
|
setMcpDialogOpen(true);
|
|
@@ -672,6 +678,7 @@ The result should be a reusable agent profile, not a one-off task response.`,
|
|
|
672
678
|
: []),
|
|
673
679
|
];
|
|
674
680
|
const visibleMenuItems = menuItems.filter((item) => {
|
|
681
|
+
if (personalMcpOnly) return item.personalMcp;
|
|
675
682
|
if (!resourceFilter || resourceFilter === "files") return true;
|
|
676
683
|
if (resourceFilter === "agents")
|
|
677
684
|
return item.label === "Create Custom Agent";
|
|
@@ -1185,6 +1192,35 @@ export function resolveInitialResourceScope(
|
|
|
1185
1192
|
return canEditOrg ? "shared" : "personal";
|
|
1186
1193
|
}
|
|
1187
1194
|
|
|
1195
|
+
export function hasAvailableMcpIntegrations(
|
|
1196
|
+
integrations: readonly DefaultMcpIntegration[] | undefined,
|
|
1197
|
+
): boolean {
|
|
1198
|
+
return (integrations?.length ?? 0) > 0 || isCustomMcpIntegrationEnabled();
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
export function resolveResourceCreateMenuMode(
|
|
1202
|
+
scope: ResourceScope,
|
|
1203
|
+
canEditOrg: boolean,
|
|
1204
|
+
resourceFilter: ResourceView | undefined,
|
|
1205
|
+
hasMcpIntegrations: boolean,
|
|
1206
|
+
): "full" | "personal-mcp" | "hidden" {
|
|
1207
|
+
if (scope !== "shared" || canEditOrg) return "full";
|
|
1208
|
+
if (hasMcpIntegrations && (!resourceFilter || resourceFilter === "files")) {
|
|
1209
|
+
return "personal-mcp";
|
|
1210
|
+
}
|
|
1211
|
+
return "hidden";
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
export function shouldRenderResourceSectionCreateMenu(
|
|
1215
|
+
mode: ReturnType<typeof resolveResourceCreateMenuMode>,
|
|
1216
|
+
resourceFilter: ResourceView | undefined,
|
|
1217
|
+
): boolean {
|
|
1218
|
+
return (
|
|
1219
|
+
mode === "full" &&
|
|
1220
|
+
(resourceFilter === "agents" || resourceFilter === "skills")
|
|
1221
|
+
);
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1188
1224
|
export function ResourcesPanel({
|
|
1189
1225
|
showMcpServers = true,
|
|
1190
1226
|
scope: requestedScope,
|
|
@@ -1317,6 +1353,13 @@ export function ResourcesPanel({
|
|
|
1317
1353
|
const hasOrgForMcp = !!(mcpServersQuery.data?.orgId ?? org?.orgId);
|
|
1318
1354
|
const canCreateOrgMcp =
|
|
1319
1355
|
hasOrgForMcp && (orgRole === "owner" || orgRole === "admin");
|
|
1356
|
+
const hasMcpIntegrations = hasAvailableMcpIntegrations(mcpIntegrations);
|
|
1357
|
+
const activeCreateMenuMode = resolveResourceCreateMenuMode(
|
|
1358
|
+
activeScope,
|
|
1359
|
+
canEditOrg,
|
|
1360
|
+
resourceFilter,
|
|
1361
|
+
hasMcpIntegrations,
|
|
1362
|
+
);
|
|
1320
1363
|
|
|
1321
1364
|
// Virtual MCP server currently selected in the tree (or null for a real
|
|
1322
1365
|
// resource / nothing). Resolved by scanning both trees' mcp folders for
|
|
@@ -1563,22 +1606,29 @@ export function ResourcesPanel({
|
|
|
1563
1606
|
e.preventDefault();
|
|
1564
1607
|
e.stopPropagation();
|
|
1565
1608
|
setDragOver(false);
|
|
1609
|
+
if (activeCreateMenuMode !== "full") return;
|
|
1566
1610
|
if (e.dataTransfer.files.length > 0) {
|
|
1567
1611
|
handleUploadFiles(e.dataTransfer.files, activeScope);
|
|
1568
1612
|
}
|
|
1569
1613
|
},
|
|
1570
|
-
[activeScope, handleUploadFiles],
|
|
1614
|
+
[activeCreateMenuMode, activeScope, handleUploadFiles],
|
|
1571
1615
|
);
|
|
1572
1616
|
|
|
1573
1617
|
const renderScopeCreateMenu = (targetScope: ResourceScope) => {
|
|
1574
|
-
|
|
1618
|
+
const mode = resolveResourceCreateMenuMode(
|
|
1619
|
+
targetScope,
|
|
1620
|
+
canEditOrg,
|
|
1621
|
+
resourceFilter,
|
|
1622
|
+
hasMcpIntegrations,
|
|
1623
|
+
);
|
|
1624
|
+
if (!shouldRenderResourceSectionCreateMenu(mode, resourceFilter)) {
|
|
1575
1625
|
return null;
|
|
1576
1626
|
}
|
|
1577
|
-
if (targetScope === "shared" && !canEditOrg) return null;
|
|
1578
1627
|
return (
|
|
1579
1628
|
<CreateMenu
|
|
1580
1629
|
scope={targetScope}
|
|
1581
1630
|
resourceFilter={resourceFilter}
|
|
1631
|
+
personalMcpOnly={mode === "personal-mcp"}
|
|
1582
1632
|
onCreateFile={(name) => handleCreateFromToolbar(targetScope, name)}
|
|
1583
1633
|
onCreateResource={(path, content, mimeType, opts) =>
|
|
1584
1634
|
handleCreateResourceFromToolbar(
|
|
@@ -1599,13 +1649,20 @@ export function ResourcesPanel({
|
|
|
1599
1649
|
};
|
|
1600
1650
|
|
|
1601
1651
|
const renderEmptyStateAction = (targetScope: ResourceScope) => {
|
|
1602
|
-
|
|
1652
|
+
const mode = resolveResourceCreateMenuMode(
|
|
1653
|
+
targetScope,
|
|
1654
|
+
canEditOrg,
|
|
1655
|
+
resourceFilter,
|
|
1656
|
+
hasMcpIntegrations,
|
|
1657
|
+
);
|
|
1658
|
+
if (mode === "hidden") return null;
|
|
1603
1659
|
|
|
1604
1660
|
const label = resourceFilter
|
|
1605
1661
|
? EMPTY_RESOURCE_ACTION_LABELS[resourceFilter]
|
|
1606
1662
|
: "Add resource";
|
|
1607
1663
|
|
|
1608
1664
|
if (
|
|
1665
|
+
mode === "personal-mcp" ||
|
|
1609
1666
|
!resourceFilter ||
|
|
1610
1667
|
resourceFilter === "files" ||
|
|
1611
1668
|
resourceFilter === "agents" ||
|
|
@@ -1615,6 +1672,7 @@ export function ResourcesPanel({
|
|
|
1615
1672
|
<CreateMenu
|
|
1616
1673
|
scope={targetScope}
|
|
1617
1674
|
resourceFilter={resourceFilter}
|
|
1675
|
+
personalMcpOnly={mode === "personal-mcp"}
|
|
1618
1676
|
onCreateFile={(name) => handleCreateFromToolbar(targetScope, name)}
|
|
1619
1677
|
onCreateResource={(path, content, mimeType, opts) =>
|
|
1620
1678
|
handleCreateResourceFromToolbar(
|
|
@@ -1631,7 +1689,9 @@ export function ResourcesPanel({
|
|
|
1631
1689
|
showToast={showToast}
|
|
1632
1690
|
mcpIntegrations={mcpIntegrations}
|
|
1633
1691
|
triggerVariant="outline"
|
|
1634
|
-
triggerLabel={
|
|
1692
|
+
triggerLabel={
|
|
1693
|
+
mode === "personal-mcp" ? t("mcpIntegrations.menuLabel") : label
|
|
1694
|
+
}
|
|
1635
1695
|
initialView={resourceFilter === "files" ? "file" : "menu"}
|
|
1636
1696
|
/>
|
|
1637
1697
|
);
|
|
@@ -1758,6 +1818,25 @@ export function ResourcesPanel({
|
|
|
1758
1818
|
</TooltipProvider>
|
|
1759
1819
|
</div>
|
|
1760
1820
|
)}
|
|
1821
|
+
{!selectedMcpServer &&
|
|
1822
|
+
resourceQuery.data &&
|
|
1823
|
+
(resourceQuery.data.mimeType.startsWith("text/") ||
|
|
1824
|
+
resourceQuery.data.mimeType === "application/json") && (
|
|
1825
|
+
<TooltipProvider delayDuration={200}>
|
|
1826
|
+
<Tooltip>
|
|
1827
|
+
<TooltipTrigger asChild>
|
|
1828
|
+
<a
|
|
1829
|
+
href={resourceDownloadUrl(resourceQuery.data.id)}
|
|
1830
|
+
aria-label="Download resource"
|
|
1831
|
+
className="flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-accent/50"
|
|
1832
|
+
>
|
|
1833
|
+
<IconDownload className="h-3.5 w-3.5" />
|
|
1834
|
+
</a>
|
|
1835
|
+
</TooltipTrigger>
|
|
1836
|
+
<TooltipContent>Download resource</TooltipContent>
|
|
1837
|
+
</Tooltip>
|
|
1838
|
+
</TooltipProvider>
|
|
1839
|
+
)}
|
|
1761
1840
|
{!selectedBuiltinCapability && !selectedResourceReadOnly && (
|
|
1762
1841
|
<TooltipProvider delayDuration={200}>
|
|
1763
1842
|
<Tooltip>
|
|
@@ -1799,45 +1878,49 @@ export function ResourcesPanel({
|
|
|
1799
1878
|
) : (
|
|
1800
1879
|
/* Floating action buttons — absolute top-right over tree view */
|
|
1801
1880
|
<div className="absolute top-1 right-1 z-10 flex items-center gap-1">
|
|
1802
|
-
{
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1881
|
+
{activeCreateMenuMode !== "hidden" &&
|
|
1882
|
+
(!resourceFilter || resourceFilter === "files") && (
|
|
1883
|
+
<CreateMenu
|
|
1884
|
+
scope={activeScope}
|
|
1885
|
+
resourceFilter={resourceFilter}
|
|
1886
|
+
personalMcpOnly={activeCreateMenuMode === "personal-mcp"}
|
|
1887
|
+
onCreateFile={(name) =>
|
|
1888
|
+
handleCreateFromToolbar(activeScope, name)
|
|
1889
|
+
}
|
|
1890
|
+
onCreateResource={(path, content, mimeType, opts) =>
|
|
1891
|
+
handleCreateResourceFromToolbar(
|
|
1892
|
+
activeScope,
|
|
1893
|
+
path,
|
|
1894
|
+
content,
|
|
1895
|
+
mimeType,
|
|
1896
|
+
opts,
|
|
1897
|
+
)
|
|
1898
|
+
}
|
|
1899
|
+
onCreateMcpServer={handleCreateMcpServer}
|
|
1900
|
+
canCreateOrgMcp={canCreateOrgMcp}
|
|
1901
|
+
hasOrg={hasOrgForMcp}
|
|
1902
|
+
showToast={showToast}
|
|
1903
|
+
mcpIntegrations={mcpIntegrations}
|
|
1904
|
+
/>
|
|
1905
|
+
)}
|
|
1825
1906
|
{(!resourceFilter || resourceFilter === "files") && (
|
|
1826
1907
|
<>
|
|
1827
|
-
|
|
1828
|
-
<
|
|
1829
|
-
<
|
|
1830
|
-
<
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1908
|
+
{activeCreateMenuMode === "full" && (
|
|
1909
|
+
<TooltipProvider delayDuration={200}>
|
|
1910
|
+
<Tooltip>
|
|
1911
|
+
<TooltipTrigger asChild>
|
|
1912
|
+
<button
|
|
1913
|
+
onClick={() => fileInputRef.current?.click()}
|
|
1914
|
+
aria-label="Upload file"
|
|
1915
|
+
className="flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-accent/50"
|
|
1916
|
+
>
|
|
1917
|
+
<IconUpload className="h-3.5 w-3.5" />
|
|
1918
|
+
</button>
|
|
1919
|
+
</TooltipTrigger>
|
|
1920
|
+
<TooltipContent>Upload file</TooltipContent>
|
|
1921
|
+
</Tooltip>
|
|
1922
|
+
</TooltipProvider>
|
|
1923
|
+
)}
|
|
1841
1924
|
<TooltipProvider delayDuration={200}>
|
|
1842
1925
|
<Tooltip>
|
|
1843
1926
|
<TooltipTrigger asChild>
|
|
@@ -699,6 +699,13 @@ export function resolveMcpIntegrationScope(
|
|
|
699
699
|
return defaultScope === "org" && hasOrg && canCreateOrgMcp ? "org" : "user";
|
|
700
700
|
}
|
|
701
701
|
|
|
702
|
+
export function shouldOfferMcpOrganizationScope(
|
|
703
|
+
hasOrg: boolean,
|
|
704
|
+
canCreateOrgMcp: boolean,
|
|
705
|
+
): boolean {
|
|
706
|
+
return hasOrg && canCreateOrgMcp;
|
|
707
|
+
}
|
|
708
|
+
|
|
702
709
|
export function filterMcpIntegrations(
|
|
703
710
|
query: string,
|
|
704
711
|
integrations: DefaultMcpIntegration[] = getDefaultMcpIntegrations(),
|
|
@@ -278,6 +278,12 @@ async function fetchJson<T>(url: string): Promise<T> {
|
|
|
278
278
|
return res.json();
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
+
export function resourceDownloadUrl(id: string): string {
|
|
282
|
+
return agentNativePath(
|
|
283
|
+
`/_agent-native/resources/${encodeURIComponent(id)}?download=1`,
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
|
|
281
287
|
export function useResources(scope: ResourceScope = "personal") {
|
|
282
288
|
const query = new URLSearchParams({ scope });
|
|
283
289
|
return useQuery<ResourceMeta[]>({
|
package/src/client/use-action.ts
CHANGED
|
@@ -749,7 +749,9 @@ export function useActionQuery<
|
|
|
749
749
|
// ---------------------------------------------------------------------------
|
|
750
750
|
|
|
751
751
|
/**
|
|
752
|
-
* Mutate
|
|
752
|
+
* Mutate through the framework's frontend action transport. Mutations use
|
|
753
|
+
* POST by default and do not need to repeat the action's direct HTTP method.
|
|
754
|
+
* An explicit PUT or DELETE remains supported for compatibility.
|
|
753
755
|
*
|
|
754
756
|
* When the action type registry is generated, the return type and parameter
|
|
755
757
|
* types are inferred automatically.
|
|
@@ -1612,7 +1612,8 @@ async function workspaceReadMeta(path, opts = {}) {
|
|
|
1612
1612
|
/**
|
|
1613
1613
|
* Write (create or overwrite) a workspace file. Use \`scratch/...\` for
|
|
1614
1614
|
* temporary staging files.
|
|
1615
|
-
* \`content\` must be a string. Returns metadata
|
|
1615
|
+
* \`content\` must be a string. Returns metadata
|
|
1616
|
+
* { resourceId, path, contentType, sizeBytes, updatedAt }.
|
|
1616
1617
|
*/
|
|
1617
1618
|
async function workspaceWrite(path, content, contentType = "text/plain") {
|
|
1618
1619
|
const rawResult = await _bridgeCall("workspace-files", {
|
package/src/db/client.ts
CHANGED
|
@@ -335,6 +335,20 @@ export function safeJsonParse<T>(value: unknown, fallback: T): T {
|
|
|
335
335
|
* Used during WAL initialization and migrations where a stale WAL from a
|
|
336
336
|
* previous crash or HMR restart can briefly lock the database.
|
|
337
337
|
*/
|
|
338
|
+
export function isSqliteBusyError(error: unknown): boolean {
|
|
339
|
+
const candidate = error as { code?: unknown; message?: unknown };
|
|
340
|
+
const code = typeof candidate?.code === "string" ? candidate.code : "";
|
|
341
|
+
const message =
|
|
342
|
+
typeof candidate?.message === "string"
|
|
343
|
+
? candidate.message
|
|
344
|
+
: String(error ?? "");
|
|
345
|
+
return (
|
|
346
|
+
code === "SQLITE_BUSY" ||
|
|
347
|
+
code.startsWith("SQLITE_BUSY_") ||
|
|
348
|
+
/database is locked|SQLITE_BUSY/i.test(message)
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
|
|
338
352
|
export async function retrySqliteBusy<T>(
|
|
339
353
|
fn: () => Promise<T>,
|
|
340
354
|
opts: { maxAttempts?: number; baseDelayMs?: number; rethrow?: boolean } = {},
|
|
@@ -344,10 +358,9 @@ export async function retrySqliteBusy<T>(
|
|
|
344
358
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
345
359
|
try {
|
|
346
360
|
return await fn();
|
|
347
|
-
} catch (e
|
|
361
|
+
} catch (e) {
|
|
348
362
|
last = e;
|
|
349
|
-
|
|
350
|
-
if (msg.includes("SQLITE_BUSY") && attempt < maxAttempts - 1) {
|
|
363
|
+
if (isSqliteBusyError(e) && attempt < maxAttempts - 1) {
|
|
351
364
|
await new Promise((r) => setTimeout(r, baseDelayMs * (attempt + 1)));
|
|
352
365
|
} else {
|
|
353
366
|
break;
|
|
@@ -1588,7 +1601,18 @@ async function createDbExecInternal(
|
|
|
1588
1601
|
const { default: Database } = await import("better-sqlite3");
|
|
1589
1602
|
const sqlite = new Database(sqliteFilenameFromUrl(url));
|
|
1590
1603
|
sqlite.pragma("busy_timeout = 10000");
|
|
1591
|
-
|
|
1604
|
+
try {
|
|
1605
|
+
// Vite can start a replacement Nitro runtime while the previous instance
|
|
1606
|
+
// is still releasing app.db. The 10s busy_timeout can expire during that
|
|
1607
|
+
// handoff, so retry the idempotent WAL negotiation before declaring the
|
|
1608
|
+
// whole auth/database bootstrap failed.
|
|
1609
|
+
await retrySqliteBusy(async () => sqlite.pragma("journal_mode = WAL"), {
|
|
1610
|
+
rethrow: true,
|
|
1611
|
+
});
|
|
1612
|
+
} catch (error) {
|
|
1613
|
+
sqlite.close();
|
|
1614
|
+
throw error;
|
|
1615
|
+
}
|
|
1592
1616
|
if (trackSingletonResources) _sqlite = sqlite;
|
|
1593
1617
|
const execute: DbExec["execute"] = async (sql) => {
|
|
1594
1618
|
const { rawSql, args } = sqlAndArgs(sql);
|
package/src/deploy/build.ts
CHANGED
|
@@ -904,20 +904,48 @@ export function generateWorkerEntry(
|
|
|
904
904
|
for (let i = 0; i < actions.length; i++) {
|
|
905
905
|
const a = actions[i];
|
|
906
906
|
const varName = `action_${i}`;
|
|
907
|
+
const handlerName = `action_handler_${i}`;
|
|
907
908
|
actionImports.push(`import ${varName} from ${JSON.stringify(a.absPath)};`);
|
|
908
909
|
// Mirror the runtime mount (action-routes.ts): `path = http?.path ?? name`.
|
|
909
910
|
const routePath = `/_agent-native/actions/${a.path ?? a.name}`;
|
|
910
911
|
actionRegistrations.push(
|
|
911
|
-
`
|
|
912
|
+
` const ${handlerName} = defineEventHandler(async (event) => {
|
|
913
|
+
const configuredMethod = ${JSON.stringify(a.method.toUpperCase())};
|
|
914
|
+
const requestMethod = event.req.method;
|
|
915
|
+
const isFrontendMutation =
|
|
916
|
+
event.req.headers.get("x-agent-native-frontend") === "1" &&
|
|
917
|
+
["POST", "PUT", "DELETE"].includes(configuredMethod) &&
|
|
918
|
+
["POST", "PUT", "DELETE"].includes(requestMethod);
|
|
919
|
+
if (requestMethod !== configuredMethod && !isFrontendMutation) {
|
|
920
|
+
return new Response(
|
|
921
|
+
JSON.stringify({ error: \`Method not allowed. Use \${configuredMethod}.\` }),
|
|
922
|
+
{ status: 405, headers: { "Content-Type": "application/json" } }
|
|
923
|
+
);
|
|
924
|
+
}
|
|
912
925
|
const params = ${a.method === "get" ? "parseActionSearchParams(event.url.searchParams)" : "(await readBody(event)) ?? {}"};
|
|
913
926
|
try {
|
|
914
|
-
const
|
|
927
|
+
const caller =
|
|
928
|
+
event.req.headers.get("x-agent-native-frontend") === "1"
|
|
929
|
+
? "frontend"
|
|
930
|
+
: "http";
|
|
931
|
+
const result = await ${varName}.run(params, { caller });
|
|
915
932
|
if (typeof result === "string") { try { return JSON.parse(result); } catch { return result; } }
|
|
916
933
|
return result;
|
|
917
934
|
} catch (err) {
|
|
918
935
|
return new Response(JSON.stringify({ error: err?.message || "Action failed" }), { status: err?.message?.startsWith("Invalid action parameters") ? 400 : 500, headers: { "Content-Type": "application/json" } });
|
|
919
936
|
}
|
|
920
|
-
})
|
|
937
|
+
});
|
|
938
|
+
app.on(${JSON.stringify(a.method.toUpperCase())}, ${JSON.stringify(routePath)}, ${handlerName});
|
|
939
|
+
${["post", "put", "delete"]
|
|
940
|
+
.filter(
|
|
941
|
+
(method) =>
|
|
942
|
+
method !== a.method && ["post", "put", "delete"].includes(a.method),
|
|
943
|
+
)
|
|
944
|
+
.map(
|
|
945
|
+
(method) =>
|
|
946
|
+
` app.on(${JSON.stringify(method.toUpperCase())}, ${JSON.stringify(routePath)}, ${handlerName});`,
|
|
947
|
+
)
|
|
948
|
+
.join("\n")}`,
|
|
921
949
|
);
|
|
922
950
|
}
|
|
923
951
|
|
|
@@ -132,7 +132,7 @@ export function findMcpIntegrationForText(
|
|
|
132
132
|
function withUiIntegrations(
|
|
133
133
|
integrations: readonly DefaultMcpIntegration[] = [],
|
|
134
134
|
): DefaultMcpIntegration[] {
|
|
135
|
-
return
|
|
135
|
+
return getDefaultMcpIntegrations(undefined, integrations);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
export function McpIntegrationDialog(
|
package/src/index.browser.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -535,6 +535,9 @@ async function processComment(
|
|
|
535
535
|
console.error("[google-docs] Error sending response:", err);
|
|
536
536
|
}
|
|
537
537
|
},
|
|
538
|
+
// No userId here: `options.ownerEmail` is PII (email), which the
|
|
539
|
+
// terminal event must not carry.
|
|
540
|
+
{ model: options.model, engineName: engine.name },
|
|
538
541
|
);
|
|
539
542
|
}
|
|
540
543
|
|