@agent-native/core 0.90.11 → 0.91.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 +22 -0
- package/corpus/core/docs/content/toolkit-settings.mdx +56 -3
- package/corpus/core/package.json +2 -1
- package/corpus/core/src/agent/run-ownership.ts +29 -1
- package/corpus/core/src/changelog/parse.ts +78 -0
- package/corpus/core/src/chat-threads/schema.ts +43 -0
- package/corpus/core/src/chat-threads/store.ts +144 -12
- package/corpus/core/src/cli/workspace-dev.ts +25 -5
- package/corpus/core/src/client/AgentPanel.tsx +79 -14
- package/corpus/core/src/client/AssistantChat.tsx +359 -425
- package/corpus/core/src/client/analytics-session.ts +70 -0
- package/corpus/core/src/client/analytics.ts +175 -49
- package/corpus/core/src/client/chat/message-components.tsx +22 -2
- package/corpus/core/src/client/components/ui/message-scroller.tsx +131 -0
- package/corpus/core/src/client/conversation/AgentConversation.tsx +63 -41
- package/corpus/core/src/client/error-capture.ts +616 -0
- package/corpus/core/src/client/index.ts +12 -0
- package/corpus/core/src/client/session-replay.ts +57 -7
- package/corpus/core/src/client/settings/SettingsPanel.tsx +123 -1
- package/corpus/core/src/client/settings/SettingsTabsPage.tsx +292 -45
- package/corpus/core/src/client/settings/index.ts +1 -0
- package/corpus/core/src/client/sharing/ShareButton.tsx +14 -11
- package/corpus/core/src/client/sharing/ShareDialog.tsx +13 -10
- package/corpus/core/src/mcp/builtin-tools.ts +29 -2
- package/corpus/core/src/server/agent-chat-plugin.ts +174 -79
- package/corpus/core/src/server/onboarding-html.ts +28 -16
- package/corpus/core/src/sharing/actions/list-resource-shares.ts +45 -1
- package/corpus/core/src/sharing/actions/share-resource.ts +9 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +4 -2
- package/corpus/core/src/templates/workspace-core/.agents/skills/changelog/SKILL.md +9 -6
- package/corpus/core/src/vite/client.ts +217 -35
- package/corpus/templates/analytics/.agents/skills/adhoc-analysis/SKILL.md +8 -7
- package/corpus/templates/analytics/.agents/skills/analysis-workspace/SKILL.md +14 -10
- package/corpus/templates/analytics/.agents/skills/bigquery/SKILL.md +15 -15
- package/corpus/templates/analytics/.agents/skills/cross-source-analysis/SKILL.md +1 -0
- package/corpus/templates/analytics/.agents/skills/dashboard-management/SKILL.md +38 -22
- package/corpus/templates/analytics/.agents/skills/data-programs/SKILL.md +114 -61
- package/corpus/templates/analytics/.agents/skills/data-querying/SKILL.md +1 -0
- package/corpus/templates/analytics/.agents/skills/gong/SKILL.md +7 -7
- package/corpus/templates/analytics/.agents/skills/hubspot/SKILL.md +1 -0
- package/corpus/templates/analytics/.agents/skills/prometheus/SKILL.md +1 -1
- package/corpus/templates/analytics/.builder/skills/bigquery/SKILL.md +17 -17
- package/corpus/templates/analytics/.builder/skills/gcloud/SKILL.md +5 -5
- package/corpus/templates/analytics/.builder/skills/github/SKILL.md +7 -7
- package/corpus/templates/analytics/.builder/skills/gong/SKILL.md +12 -12
- package/corpus/templates/analytics/.builder/skills/grafana/SKILL.md +7 -7
- package/corpus/templates/analytics/.builder/skills/sentry/SKILL.md +7 -7
- package/corpus/templates/analytics/.builder/skills/slack/SKILL.md +6 -6
- package/corpus/templates/analytics/.builder/skills/stripe/SKILL.md +7 -7
- package/corpus/templates/analytics/AGENTS.md +47 -2
- package/corpus/templates/analytics/actions/add-status-page-monitor.ts +36 -0
- package/corpus/templates/analytics/actions/capture-test-error.ts +33 -0
- package/corpus/templates/analytics/actions/delete-monitor.ts +24 -0
- package/corpus/templates/analytics/actions/delete-status-page.ts +23 -0
- package/corpus/templates/analytics/actions/get-error-issue.ts +36 -0
- package/corpus/templates/analytics/actions/get-monitor-stats.ts +55 -0
- package/corpus/templates/analytics/actions/get-monitor.ts +27 -0
- package/corpus/templates/analytics/actions/get-public-status-page.ts +41 -0
- package/corpus/templates/analytics/actions/get-status-page.ts +29 -0
- package/corpus/templates/analytics/actions/list-error-issues.ts +40 -0
- package/corpus/templates/analytics/actions/list-monitors.ts +21 -0
- package/corpus/templates/analytics/actions/list-status-pages.ts +21 -0
- package/corpus/templates/analytics/actions/match-error-issues.ts +51 -0
- package/corpus/templates/analytics/actions/navigate.ts +58 -4
- package/corpus/templates/analytics/actions/remove-status-page-monitor.ts +22 -0
- package/corpus/templates/analytics/actions/reorder-status-page-monitors.ts +25 -0
- package/corpus/templates/analytics/actions/resolve-error-issue.ts +38 -0
- package/corpus/templates/analytics/actions/run-monitor-check.ts +23 -0
- package/corpus/templates/analytics/actions/save-analysis.ts +1 -0
- package/corpus/templates/analytics/actions/save-monitor.ts +145 -0
- package/corpus/templates/analytics/actions/save-status-page.ts +47 -0
- package/corpus/templates/analytics/actions/view-screen.ts +212 -0
- package/corpus/templates/analytics/app/components/layout/Header.tsx +1 -0
- package/corpus/templates/analytics/app/components/layout/Layout.tsx +10 -1
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +134 -39
- package/corpus/templates/analytics/app/components/monitoring/PublicStatusView.tsx +351 -0
- package/corpus/templates/analytics/app/components/monitoring/ResponseTimeChart.tsx +174 -0
- package/corpus/templates/analytics/app/components/monitoring/UptimeStatCards.tsx +85 -0
- package/corpus/templates/analytics/app/components/monitoring/UptimeTimelineBars.tsx +106 -0
- package/corpus/templates/analytics/app/components/monitoring/chart-utils.ts +101 -0
- package/corpus/templates/analytics/app/components/monitoring/index.ts +28 -0
- package/corpus/templates/analytics/app/components/monitoring/types.ts +42 -0
- package/corpus/templates/analytics/app/hooks/use-navigation-state.ts +34 -0
- package/corpus/templates/analytics/app/i18n/zh-TW.ts +6 -0
- package/corpus/templates/analytics/app/i18n-data.ts +33 -0
- package/corpus/templates/analytics/app/pages/DataSources.tsx +28 -0
- package/corpus/templates/analytics/app/pages/Settings.tsx +77 -9
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/SqlChartCard.tsx +3 -3
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/dashboard-layout.ts +7 -0
- package/corpus/templates/analytics/app/pages/monitoring/ErrorsPanel.tsx +205 -0
- package/corpus/templates/analytics/app/pages/monitoring/MonitoringPage.tsx +100 -0
- package/corpus/templates/analytics/app/pages/monitoring/UptimePanel.tsx +475 -0
- package/corpus/templates/analytics/app/pages/monitoring/errors/IssueDetail.tsx +372 -0
- package/corpus/templates/analytics/app/pages/monitoring/errors/IssueList.tsx +360 -0
- package/corpus/templates/analytics/app/pages/monitoring/errors/Sparkline.tsx +55 -0
- package/corpus/templates/analytics/app/pages/monitoring/errors/i18n.ts +106 -0
- package/corpus/templates/analytics/app/pages/monitoring/errors/types.ts +75 -0
- package/corpus/templates/analytics/app/pages/monitoring/errors/utils.ts +132 -0
- package/corpus/templates/analytics/app/pages/monitoring/uptime/MonitorDetail.tsx +535 -0
- package/corpus/templates/analytics/app/pages/monitoring/uptime/MonitorFormPage.tsx +1026 -0
- package/corpus/templates/analytics/app/pages/monitoring/uptime/MonitorList.tsx +311 -0
- package/corpus/templates/analytics/app/pages/monitoring/uptime/i18n.ts +235 -0
- package/corpus/templates/analytics/app/pages/monitoring/uptime/status-pages/StatusPageEditor.tsx +661 -0
- package/corpus/templates/analytics/app/pages/monitoring/uptime/status-pages/StatusPagesView.tsx +355 -0
- package/corpus/templates/analytics/app/pages/monitoring/uptime/status-pages/i18n.ts +106 -0
- package/corpus/templates/analytics/app/pages/monitoring/uptime/status-pages/slug.ts +24 -0
- package/corpus/templates/analytics/app/pages/monitoring/uptime/status-pages/types.ts +20 -0
- package/corpus/templates/analytics/app/pages/monitoring/uptime/status-summary.ts +87 -0
- package/corpus/templates/analytics/app/pages/monitoring/uptime/types.ts +161 -0
- package/corpus/templates/analytics/app/pages/monitoring/uptime/utils.ts +210 -0
- package/corpus/templates/analytics/app/pages/sessions/SessionDetailPage.tsx +76 -1
- package/corpus/templates/analytics/app/pages/sessions/SessionDevToolsPanel.tsx +74 -9
- package/corpus/templates/analytics/app/pages/sessions/SessionsPage.tsx +197 -20
- package/corpus/templates/analytics/app/root.tsx +33 -1
- package/corpus/templates/analytics/app/routes/monitoring._index.tsx +10 -0
- package/corpus/templates/analytics/app/routes/status.$slug.tsx +118 -0
- package/corpus/templates/analytics/changelog/2026-07-08-add-uptime-monitors-that-ping-your-urls-and-alert-you-when-t.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-analytics-chats-keep-large-data-dictionaries-compact-so-prov.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-create-public-status-pages-that-share-the-live-health-of-cho.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-dashboard-extension-panels-use-clearer-open-copy.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-error-capture.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-fixed-single-panel-dashboard-drags-so-they-no-longer-rewrite.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-jump-straight-from-an-error-in-a-session-recording-to-its-fu.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-monitor-detail-and-list-now-show-colorful-uptime-timelines-r.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-pinned-ask-chats-now-show-a-pin-icon-in-the-sidebar.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-publish-a-public-uptime-status-page-with-colorful-uptime-tim.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-sessions-now-hide-visitor-emails-in-demo-mode-and-show-clean.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-settings-are-cleaner-searchable-and-alerts-have-their-own-tab.md +5 -0
- package/corpus/templates/analytics/changelog/2026-07-08-sidebar-sections-stay-collapsed-until-opened.md +5 -0
- package/corpus/templates/analytics/changelog/2026-07-08-the-uptime-monitor-list-now-has-a-current-status-overview-wi.md +6 -0
- package/corpus/templates/analytics/docs/error-capture.md +172 -0
- package/corpus/templates/analytics/docs/uptime-monitoring.md +150 -0
- package/corpus/templates/analytics/server/db/schema-errors.ts +150 -0
- package/corpus/templates/analytics/server/db/schema-monitoring.ts +177 -0
- package/corpus/templates/analytics/server/db/schema.ts +6 -0
- package/corpus/templates/analytics/server/jobs/uptime-monitors.ts +123 -0
- package/corpus/templates/analytics/server/lib/agent-chat-plan-mode.ts +41 -0
- package/corpus/templates/analytics/server/lib/data-dictionary-context.ts +55 -12
- package/corpus/templates/analytics/server/lib/error-capture.ts +1331 -0
- package/corpus/templates/analytics/server/lib/first-party-analytics.ts +47 -1
- package/corpus/templates/analytics/server/lib/monitor-stats.ts +494 -0
- package/corpus/templates/analytics/server/lib/status-pages.ts +798 -0
- package/corpus/templates/analytics/server/lib/uptime-monitors.ts +1665 -0
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +7 -37
- package/corpus/templates/analytics/server/plugins/auth.ts +11 -1
- package/corpus/templates/analytics/server/plugins/db.ts +408 -0
- package/corpus/templates/analytics/server/plugins/uptime-monitor-jobs.ts +63 -0
- package/corpus/templates/assets/app/routes/_index.tsx +1 -1
- package/corpus/templates/assets/app/routes/settings.tsx +22 -1
- package/corpus/templates/assets/changelog/2026-07-08-recent-drafts-keep-comfortable-side-padding.md +6 -0
- package/corpus/templates/assets/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/corpus/templates/brain/app/routes/settings.tsx +43 -5
- package/corpus/templates/brain/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/corpus/templates/calendar/app/pages/Settings.tsx +44 -6
- package/corpus/templates/calendar/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/corpus/templates/chat/app/routes/settings.tsx +16 -1
- package/corpus/templates/chat/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/corpus/templates/clips/actions/lib/audio-only-transcription.ts +79 -37
- package/corpus/templates/clips/app/components/player/player-controls.tsx +35 -0
- package/corpus/templates/clips/app/components/player/video-player.tsx +162 -18
- package/corpus/templates/clips/app/routes/_app.settings._index.tsx +63 -6
- package/corpus/templates/clips/app/routes/record.tsx +18 -1
- package/corpus/templates/clips/changelog/2026-07-07-shared-clips-start-playback-reliably-from-the-first-play-click.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-08-chrome-extension-camera-and-microphone-menus-now-show-which-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-08-chrome-extension-copies-new-clip-links-after-saving.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-08-chrome-extension-recordings-now-continue-after-granting-came.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-08-mobile-shared-clips-now-have-loom-style-tap-and-skip-controls.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-08-recordings-and-uploads-copy-links-after-saving.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-08-settings-are-cleaner-searchable-and-collapse-s3-with-builder.md +5 -0
- package/corpus/templates/clips/changelog/2026-07-08-transcripts-are-more-reliable-for-longer-desktop-recordings-.md +6 -0
- package/corpus/templates/clips/chrome-extension/public/manifest.json +1 -0
- package/corpus/templates/clips/chrome-extension/src/background.ts +162 -13
- package/corpus/templates/clips/chrome-extension/src/content-script.ts +14 -0
- package/corpus/templates/clips/chrome-extension/src/offscreen.ts +36 -0
- package/corpus/templates/clips/chrome-extension/src/overlay.ts +99 -25
- package/corpus/templates/clips/chrome-extension/src/permission.ts +63 -14
- package/corpus/templates/clips/chrome-extension/src/popup.ts +123 -23
- package/corpus/templates/content/actions/_builder-cms-read-client.ts +47 -0
- package/corpus/templates/content/actions/_database-source-utils.ts +33 -4
- package/corpus/templates/content/actions/add-content-database-source-field-property.ts +214 -29
- package/corpus/templates/content/actions/attach-content-database-source.ts +3 -0
- package/corpus/templates/content/actions/change-content-database-source-role.ts +1 -0
- package/corpus/templates/content/app/components/editor/DocumentProperties.tsx +42 -32
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +352 -81
- package/corpus/templates/content/app/components/editor/database/settings.tsx +49 -24
- package/corpus/templates/content/app/routes/_app.settings.tsx +19 -1
- package/corpus/templates/content/changelog/2026-07-07-builder-source-tag-fields-now-import-as-multi-select.md +6 -0
- package/corpus/templates/content/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/corpus/templates/content/shared/api.ts +3 -0
- package/corpus/templates/content/shared/properties.ts +42 -0
- package/corpus/templates/design/actions/generate-design.ts +3 -0
- package/corpus/templates/design/actions/get-design-system.ts +147 -1
- package/corpus/templates/design/app/routes/settings.tsx +16 -1
- package/corpus/templates/design/changelog/2026-07-08-design-generation-now-follows-hydrated-builder-design-system.md +6 -0
- package/corpus/templates/design/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/corpus/templates/dispatch/app/routes/settings.tsx +23 -2
- package/corpus/templates/dispatch/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/corpus/templates/forms/app/routes/_app.settings.tsx +16 -1
- package/corpus/templates/forms/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/corpus/templates/macros/app/routes/settings.tsx +16 -1
- package/corpus/templates/macros/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/corpus/templates/mail/app/components/settings/GmailFiltersSection.tsx +1 -1
- package/corpus/templates/mail/app/components/settings/SnippetsSection.tsx +1 -1
- package/corpus/templates/mail/app/pages/SettingsPage.tsx +123 -105
- package/corpus/templates/mail/changelog/2026-07-08-settings-redesigned-with-a-consistent-searchable-layout.md +5 -0
- package/corpus/templates/plan/app/routes/settings.tsx +23 -2
- package/corpus/templates/plan/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/corpus/templates/slides/actions/add-slide.ts +1 -0
- package/corpus/templates/slides/actions/get-design-system.ts +147 -1
- package/corpus/templates/slides/app/pages/Index.tsx +46 -1
- package/corpus/templates/slides/app/routes/settings.tsx +16 -1
- package/corpus/templates/slides/changelog/2026-07-08-deck-generation-now-follows-hydrated-builder-design-system-g.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/dist/agent/run-ownership.d.ts +6 -0
- package/dist/agent/run-ownership.d.ts.map +1 -1
- package/dist/agent/run-ownership.js +11 -1
- package/dist/agent/run-ownership.js.map +1 -1
- package/dist/changelog/parse.d.ts +7 -0
- package/dist/changelog/parse.d.ts.map +1 -1
- package/dist/changelog/parse.js +64 -0
- package/dist/changelog/parse.js.map +1 -1
- package/dist/chat-threads/schema.d.ts +445 -0
- package/dist/chat-threads/schema.d.ts.map +1 -0
- package/dist/chat-threads/schema.js +39 -0
- package/dist/chat-threads/schema.js.map +1 -0
- package/dist/chat-threads/store.d.ts +12 -0
- package/dist/chat-threads/store.d.ts.map +1 -1
- package/dist/chat-threads/store.js +99 -10
- package/dist/chat-threads/store.js.map +1 -1
- package/dist/cli/workspace-dev.d.ts.map +1 -1
- package/dist/cli/workspace-dev.js +20 -5
- package/dist/cli/workspace-dev.js.map +1 -1
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +35 -7
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +105 -183
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/analytics-session.d.ts +3 -0
- package/dist/client/analytics-session.d.ts.map +1 -0
- package/dist/client/analytics-session.js +66 -0
- package/dist/client/analytics-session.js.map +1 -0
- package/dist/client/analytics.d.ts +32 -0
- package/dist/client/analytics.d.ts.map +1 -1
- package/dist/client/analytics.js +116 -46
- package/dist/client/analytics.js.map +1 -1
- package/dist/client/chat/message-components.d.ts +2 -1
- package/dist/client/chat/message-components.d.ts.map +1 -1
- package/dist/client/chat/message-components.js +16 -6
- package/dist/client/chat/message-components.js.map +1 -1
- package/dist/client/components/ui/message-scroller.d.ts +16 -0
- package/dist/client/components/ui/message-scroller.d.ts.map +1 -0
- package/dist/client/components/ui/message-scroller.js +25 -0
- package/dist/client/components/ui/message-scroller.js.map +1 -0
- package/dist/client/conversation/AgentConversation.d.ts +1 -1
- package/dist/client/conversation/AgentConversation.d.ts.map +1 -1
- package/dist/client/conversation/AgentConversation.js +3 -8
- package/dist/client/conversation/AgentConversation.js.map +1 -1
- package/dist/client/error-capture.d.ts +99 -0
- package/dist/client/error-capture.d.ts.map +1 -0
- package/dist/client/error-capture.js +437 -0
- package/dist/client/error-capture.js.map +1 -0
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +3 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/session-replay.d.ts +22 -0
- package/dist/client/session-replay.d.ts.map +1 -1
- package/dist/client/session-replay.js +45 -4
- package/dist/client/session-replay.js.map +1 -1
- package/dist/client/settings/SettingsPanel.d.ts.map +1 -1
- package/dist/client/settings/SettingsPanel.js +100 -5
- package/dist/client/settings/SettingsPanel.js.map +1 -1
- package/dist/client/settings/SettingsTabsPage.d.ts +49 -1
- package/dist/client/settings/SettingsTabsPage.d.ts.map +1 -1
- package/dist/client/settings/SettingsTabsPage.js +131 -19
- package/dist/client/settings/SettingsTabsPage.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.map +1 -1
- package/dist/client/sharing/ShareButton.d.ts.map +1 -1
- package/dist/client/sharing/ShareButton.js +13 -8
- package/dist/client/sharing/ShareButton.js.map +1 -1
- package/dist/client/sharing/ShareDialog.d.ts.map +1 -1
- package/dist/client/sharing/ShareDialog.js +12 -7
- package/dist/client/sharing/ShareDialog.js.map +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/mcp/builtin-tools.d.ts.map +1 -1
- package/dist/mcp/builtin-tools.js +21 -2
- package/dist/mcp/builtin-tools.js.map +1 -1
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/org/schema.d.ts +15 -15
- package/dist/provider-api/corpus-jobs.d.ts +2 -2
- package/dist/resources/handlers.d.ts +3 -3
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +109 -73
- 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/onboarding-html.d.ts.map +1 -1
- package/dist/server/onboarding-html.js +28 -16
- package/dist/server/onboarding-html.js.map +1 -1
- package/dist/sharing/actions/list-resource-shares.js +30 -1
- package/dist/sharing/actions/list-resource-shares.js.map +1 -1
- package/dist/sharing/actions/share-resource.js +6 -0
- package/dist/sharing/actions/share-resource.js.map +1 -1
- package/dist/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +4 -2
- package/dist/templates/workspace-core/.agents/skills/changelog/SKILL.md +9 -6
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +192 -30
- package/dist/vite/client.js.map +1 -1
- package/docs/content/toolkit-settings.mdx +56 -3
- package/package.json +2 -1
- package/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +4 -2
- package/src/templates/workspace-core/.agents/skills/changelog/SKILL.md +9 -6
|
@@ -11,12 +11,12 @@ import { AGENT_CHAT_BACKGROUND_RUN_FIELD, AGENT_CHAT_PROCESS_RUN_PATH, backgroun
|
|
|
11
11
|
import { resolveEngine, createAnthropicEngine, getStoredModelForEngine, normalizeModelForEngine, getAgentEngineEntry, isAgentEnginePackageInstalled, isStoredEngineUsableForRequest, listAgentEngines, registerBuiltinEngines, } from "../agent/engine/index.js";
|
|
12
12
|
import { createProductionAgentHandler, actionsToEngineTools, getActiveRunForThreadAsync, abortRun, subscribeToRun, } from "../agent/production-agent.js";
|
|
13
13
|
import { runAgentLoopDirectWithSoftTimeout } from "../agent/run-loop-with-resume.js";
|
|
14
|
-
import {
|
|
14
|
+
import { callerHasRunAccess, callerHasThreadAccess, } from "../agent/run-ownership.js";
|
|
15
15
|
import { CLAIMED_BACKGROUND_WORKER_FAILED_ERROR_EVENT, ensureTerminalRunEvent, readBackgroundRunClaim, recordRunDiagnostic, RUN_DIAG_STAGE, setRunError, setRunTerminalReason, updateRunStatusIfRunning, } from "../agent/run-store.js";
|
|
16
16
|
import { buildCurrentTimeUserContext, buildRuntimeContextPrompt, } from "../agent/runtime-context.js";
|
|
17
17
|
import { buildAssistantMessage, buildUserMessage, extractThreadMeta, foldAssistantTurn, mergeThreadDataForClientSave, normalizeThreadRepository, upsertUserMessage, } from "../agent/thread-data-builder.js";
|
|
18
18
|
import { attachToolSearch } from "../agent/tool-search.js";
|
|
19
|
-
import { createThread, forkThread, getThread, listThreads, searchThreads, renameThread, createThreadShareLink, getThreadByShareToken, getThreadShareState, revokeThreadShareLink, setThreadArchived, setThreadPinned, setThreadScope, updateThreadData, withThreadDataLock, deleteThread, setThreadQueuedMessages, } from "../chat-threads/store.js";
|
|
19
|
+
import { createThread, forkThread, getThread, registerChatThreadsShareable, resolveThreadAccess, listThreads, searchThreads, renameThread, createThreadShareLink, getThreadByShareToken, getThreadShareState, revokeThreadShareLink, setThreadArchived, setThreadPinned, setThreadScope, updateThreadData, withThreadDataLock, deleteThread, setThreadQueuedMessages, } from "../chat-threads/store.js";
|
|
20
20
|
import { dataWidgetResultSchema } from "../data-widgets/index.js";
|
|
21
21
|
import { createDbAdminAgentTools } from "../db-admin/agent-tools.js";
|
|
22
22
|
import { verifyInternalToken, extractBearerToken, } from "../integrations/internal-token.js";
|
|
@@ -1471,8 +1471,10 @@ async function createChatScriptEntries() {
|
|
|
1471
1471
|
const owner = getRequestRunContext()?.owner ?? getRequestUserEmail() ?? "";
|
|
1472
1472
|
if (!owner)
|
|
1473
1473
|
return "No authenticated user is available.";
|
|
1474
|
-
const thread = await
|
|
1475
|
-
|
|
1474
|
+
const thread = await resolveThreadAccess(owner, id, "editor", {
|
|
1475
|
+
orgId: getRequestOrgId(),
|
|
1476
|
+
});
|
|
1477
|
+
if (!thread) {
|
|
1476
1478
|
return `Chat thread "${id}" not found.`;
|
|
1477
1479
|
}
|
|
1478
1480
|
const title = thread.title || thread.preview || "(untitled)";
|
|
@@ -1482,24 +1484,18 @@ async function createChatScriptEntries() {
|
|
|
1482
1484
|
: "";
|
|
1483
1485
|
if (!nextTitle)
|
|
1484
1486
|
return "Missing required title.";
|
|
1485
|
-
const renamed = await renameThread(id, nextTitle
|
|
1486
|
-
ownerEmail: owner,
|
|
1487
|
-
});
|
|
1487
|
+
const renamed = await renameThread(id, nextTitle);
|
|
1488
1488
|
if (!renamed)
|
|
1489
1489
|
return `Chat thread "${id}" could not be renamed.`;
|
|
1490
1490
|
return `Renamed chat "${title}" to "${nextTitle}".`;
|
|
1491
1491
|
}
|
|
1492
1492
|
if (args.action === "archive") {
|
|
1493
|
-
const archived = await setThreadArchived(id, true
|
|
1494
|
-
ownerEmail: owner,
|
|
1495
|
-
});
|
|
1493
|
+
const archived = await setThreadArchived(id, true);
|
|
1496
1494
|
if (!archived)
|
|
1497
1495
|
return `Chat thread "${id}" could not be archived.`;
|
|
1498
1496
|
return `Archived chat: ${title}`;
|
|
1499
1497
|
}
|
|
1500
|
-
const pinned = await setThreadPinned(id, args.action === "pin"
|
|
1501
|
-
ownerEmail: owner,
|
|
1502
|
-
});
|
|
1498
|
+
const pinned = await setThreadPinned(id, args.action === "pin");
|
|
1503
1499
|
if (!pinned)
|
|
1504
1500
|
return `Chat thread "${id}" could not be updated.`;
|
|
1505
1501
|
return `${args.action === "pin" ? "Pinned" : "Unpinned"} chat: ${title}`;
|
|
@@ -3994,6 +3990,14 @@ export function createAgentChatPlugin(options) {
|
|
|
3994
3990
|
const getUserNameFromEvent = async (event) => {
|
|
3995
3991
|
return (await resolveOwnerContext(event)).name;
|
|
3996
3992
|
};
|
|
3993
|
+
const getOrgIdFromEvent = async (event) => {
|
|
3994
|
+
if (options?.resolveOrgId) {
|
|
3995
|
+
return (await options.resolveOrgId(event)) ?? undefined;
|
|
3996
|
+
}
|
|
3997
|
+
const session = await getSession(event).catch(() => null);
|
|
3998
|
+
return session?.orgId ?? undefined;
|
|
3999
|
+
};
|
|
4000
|
+
registerChatThreadsShareable();
|
|
3997
4001
|
// Auto-mount template actions as HTTP endpoints under /_agent-native/actions/
|
|
3998
4002
|
// Include engine management script so the UI can call manage-agent-engine.
|
|
3999
4003
|
// HTTP/frontend surface keeps the full `*All` sets so actions with
|
|
@@ -4058,13 +4062,6 @@ export function createAgentChatPlugin(options) {
|
|
|
4058
4062
|
if (!thread) {
|
|
4059
4063
|
throw new Error(`Agent chat thread ${threadId} was not found while saving run ${run.runId}.`);
|
|
4060
4064
|
}
|
|
4061
|
-
const runOwner = getRequestRunContext()?.owner ?? getRequestUserEmail();
|
|
4062
|
-
if (runOwner && thread.ownerEmail !== runOwner) {
|
|
4063
|
-
throw createError({
|
|
4064
|
-
statusCode: 404,
|
|
4065
|
-
statusMessage: "Thread not found",
|
|
4066
|
-
});
|
|
4067
|
-
}
|
|
4068
4065
|
const assistantMsg = buildAssistantMessage(run.events ?? [], run.runId, {
|
|
4069
4066
|
suppressInternalContinuation: true,
|
|
4070
4067
|
turnId: typeof run.turnId === "string" && run.turnId
|
|
@@ -4232,7 +4229,14 @@ export function createAgentChatPlugin(options) {
|
|
|
4232
4229
|
thread = await getThread(threadId);
|
|
4233
4230
|
}
|
|
4234
4231
|
}
|
|
4235
|
-
if (!thread
|
|
4232
|
+
if (!thread) {
|
|
4233
|
+
throw createError({
|
|
4234
|
+
statusCode: 404,
|
|
4235
|
+
statusMessage: "Thread not found",
|
|
4236
|
+
});
|
|
4237
|
+
}
|
|
4238
|
+
const access = await resolveThreadAccess(ownerEmail, threadId, "editor", { orgId: getRequestOrgId() });
|
|
4239
|
+
if (!access) {
|
|
4236
4240
|
throw createError({
|
|
4237
4241
|
statusCode: 404,
|
|
4238
4242
|
statusMessage: "Thread not found",
|
|
@@ -4555,6 +4559,18 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
4555
4559
|
if (runCtxForPrepare && details.threadId) {
|
|
4556
4560
|
runCtxForPrepare._requestThreadId = details.threadId;
|
|
4557
4561
|
}
|
|
4562
|
+
if (details.threadId && details.ownerEmail) {
|
|
4563
|
+
const existingThread = await getThread(details.threadId);
|
|
4564
|
+
if (existingThread) {
|
|
4565
|
+
const access = await resolveThreadAccess(details.ownerEmail, details.threadId, "editor", { orgId: await getOrgIdFromEvent(details.event) });
|
|
4566
|
+
if (!access) {
|
|
4567
|
+
throw createError({
|
|
4568
|
+
statusCode: 404,
|
|
4569
|
+
statusMessage: "Thread not found",
|
|
4570
|
+
});
|
|
4571
|
+
}
|
|
4572
|
+
}
|
|
4573
|
+
}
|
|
4558
4574
|
// Drain any parent-completion injections queued by finished sub-agents
|
|
4559
4575
|
// and prepend them to the user message so the orchestrator sees results
|
|
4560
4576
|
// at the start of this turn rather than only after a manual poll.
|
|
@@ -4750,7 +4766,25 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
4750
4766
|
runNoProgressTimeoutMs: options?.runNoProgressTimeoutMs,
|
|
4751
4767
|
durableBackgroundRuns: options?.durableBackgroundRuns,
|
|
4752
4768
|
finalResponseGuard: options?.finalResponseGuard,
|
|
4753
|
-
prepareRequest:
|
|
4769
|
+
prepareRequest: async (details) => {
|
|
4770
|
+
const runCtxForPrepare = ensureRequestRunContext();
|
|
4771
|
+
if (runCtxForPrepare && details.threadId) {
|
|
4772
|
+
runCtxForPrepare._requestThreadId = details.threadId;
|
|
4773
|
+
}
|
|
4774
|
+
if (details.threadId && details.ownerEmail) {
|
|
4775
|
+
const existingThread = await getThread(details.threadId);
|
|
4776
|
+
if (existingThread) {
|
|
4777
|
+
const access = await resolveThreadAccess(details.ownerEmail, details.threadId, "editor", { orgId: await getOrgIdFromEvent(details.event) });
|
|
4778
|
+
if (!access) {
|
|
4779
|
+
throw createError({
|
|
4780
|
+
statusCode: 404,
|
|
4781
|
+
statusMessage: "Thread not found",
|
|
4782
|
+
});
|
|
4783
|
+
}
|
|
4784
|
+
}
|
|
4785
|
+
}
|
|
4786
|
+
return options?.prepareRequest?.(details);
|
|
4787
|
+
},
|
|
4754
4788
|
skipFilesContext,
|
|
4755
4789
|
initialToolNames: options?.initialToolNames,
|
|
4756
4790
|
...(options?.toolLimits ? { toolLimits: options.toolLimits } : {}),
|
|
@@ -5627,17 +5661,15 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
5627
5661
|
const owner = await getOwnerFromEvent(event);
|
|
5628
5662
|
const method = getMethod(event);
|
|
5629
5663
|
const url = event.node?.req?.url || event.path || "";
|
|
5630
|
-
|
|
5631
|
-
//
|
|
5664
|
+
const orgId = await getOrgIdFromEvent(event);
|
|
5665
|
+
// Authorization: a run's events and a thread's active-run status are
|
|
5666
|
+
// visible to anyone with viewer+ access to the thread. Mutating run
|
|
5667
|
+
// controls require editor+ access.
|
|
5632
5668
|
// agent_runs carries no owner column — ownership lives on the
|
|
5633
|
-
// chat_threads row via thread_id.
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
// could stream their live agent turn (assistant text + tool-result
|
|
5638
|
-
// payloads) or abort their run.
|
|
5639
|
-
const ownsThread = (threadId) => callerOwnsThread(owner, threadId);
|
|
5640
|
-
const ownsRun = (runId) => callerOwnsRun(owner, runId);
|
|
5669
|
+
// chat_threads row via thread_id.
|
|
5670
|
+
const canViewThread = (threadId) => callerHasThreadAccess(owner, threadId, "viewer", { orgId });
|
|
5671
|
+
const canViewRun = (runId) => callerHasRunAccess(owner, runId, "viewer", { orgId });
|
|
5672
|
+
const canEditRun = (runId) => callerHasRunAccess(owner, runId, "editor", { orgId });
|
|
5641
5673
|
// Route: GET /runs/list?goalId=agent-team|agent-harness
|
|
5642
5674
|
// Returns background agents in the Code hub-compatible run shape.
|
|
5643
5675
|
const listMatch = url.match(/\/runs\/list(?:[/?]|$)/) ||
|
|
@@ -5690,8 +5722,8 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
5690
5722
|
url.match(/^\/([^/?]+)\/abort/);
|
|
5691
5723
|
if (abortMatch && method === "POST") {
|
|
5692
5724
|
const runId = decodeURIComponent(abortMatch[1]);
|
|
5693
|
-
if (!(await
|
|
5694
|
-
// 404 (not 403) so run existence isn't leaked to
|
|
5725
|
+
if (!(await canEditRun(runId))) {
|
|
5726
|
+
// 404 (not 403) so run existence isn't leaked to unauthorized users.
|
|
5695
5727
|
setResponseStatus(event, 404);
|
|
5696
5728
|
return { error: "Run not found" };
|
|
5697
5729
|
}
|
|
@@ -5738,8 +5770,8 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
5738
5770
|
url.match(/^\/([^/?]+)\/events/);
|
|
5739
5771
|
if (eventsMatch && method === "GET") {
|
|
5740
5772
|
const runId = decodeURIComponent(eventsMatch[1]);
|
|
5741
|
-
if (!(await
|
|
5742
|
-
// 404 (not 403) so run existence isn't leaked to
|
|
5773
|
+
if (!(await canViewRun(runId))) {
|
|
5774
|
+
// 404 (not 403) so run existence isn't leaked to unauthorized users.
|
|
5743
5775
|
setResponseStatus(event, 404);
|
|
5744
5776
|
return { error: "Run not found" };
|
|
5745
5777
|
}
|
|
@@ -5765,11 +5797,11 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
5765
5797
|
setResponseStatus(event, 400);
|
|
5766
5798
|
return { error: "threadId query parameter is required" };
|
|
5767
5799
|
}
|
|
5768
|
-
// Only reveal a thread's active run to
|
|
5769
|
-
// Present
|
|
5770
|
-
// 404 so thread existence isn't leaked and the client
|
|
5771
|
-
// benignly.
|
|
5772
|
-
if (!(await
|
|
5800
|
+
// Only reveal a thread's active run to viewers/editors of the
|
|
5801
|
+
// thread. Present unauthorized users (or unknown threads) as idle
|
|
5802
|
+
// rather than 404 so thread existence isn't leaked and the client
|
|
5803
|
+
// polls benignly.
|
|
5804
|
+
if (!(await canViewThread(threadId))) {
|
|
5773
5805
|
return {
|
|
5774
5806
|
active: false,
|
|
5775
5807
|
threadId,
|
|
@@ -6001,14 +6033,15 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
6001
6033
|
const buildShareUrl = (event, token) => `${getOrigin(event)}${routePath}/shared/${encodeURIComponent(token)}`;
|
|
6002
6034
|
getH3App(nitroApp).use(`${routePath}/threads`, defineEventHandler(async (event) => {
|
|
6003
6035
|
const owner = await getOwnerFromEvent(event);
|
|
6036
|
+
const orgId = await getOrgIdFromEvent(event);
|
|
6004
6037
|
const method = getMethod(event);
|
|
6005
6038
|
const { threadId, tail: threadTail } = parseThreadRoute(event);
|
|
6006
6039
|
const isThreadSubroute = (subroute) => threadTail[0] === subroute;
|
|
6007
6040
|
// ── Specific thread: GET/PUT/DELETE /threads/:id ──
|
|
6008
6041
|
if (threadId) {
|
|
6009
6042
|
if (method === "GET") {
|
|
6010
|
-
const thread = await
|
|
6011
|
-
if (!thread
|
|
6043
|
+
const thread = await resolveThreadAccess(owner, threadId, "viewer", { orgId });
|
|
6044
|
+
if (!thread) {
|
|
6012
6045
|
setResponseStatus(event, 404);
|
|
6013
6046
|
return { error: "Thread not found" };
|
|
6014
6047
|
}
|
|
@@ -6022,8 +6055,8 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
6022
6055
|
// run could clobber the assistant message the server just
|
|
6023
6056
|
// appended (and vice versa).
|
|
6024
6057
|
return await withThreadDataLock(threadId, async () => {
|
|
6025
|
-
const thread = await
|
|
6026
|
-
if (!thread
|
|
6058
|
+
const thread = await resolveThreadAccess(owner, threadId, "editor", { orgId });
|
|
6059
|
+
if (!thread) {
|
|
6027
6060
|
setResponseStatus(event, 404);
|
|
6028
6061
|
return { error: "Thread not found" };
|
|
6029
6062
|
}
|
|
@@ -6089,16 +6122,16 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
6089
6122
|
// queued messages durable across reloads without piggybacking
|
|
6090
6123
|
// on full-thread saves.
|
|
6091
6124
|
if (method === "POST" && isThreadSubroute("queued")) {
|
|
6125
|
+
const thread = await resolveThreadAccess(owner, threadId, "editor", { orgId });
|
|
6126
|
+
if (!thread) {
|
|
6127
|
+
setResponseStatus(event, 404);
|
|
6128
|
+
return { error: "Thread not found" };
|
|
6129
|
+
}
|
|
6092
6130
|
const body = await readBody(event);
|
|
6093
6131
|
const queued = Array.isArray(body?.queuedMessages)
|
|
6094
6132
|
? body.queuedMessages
|
|
6095
6133
|
: [];
|
|
6096
|
-
|
|
6097
|
-
// the thread-data lock) — no separate getThread pre-read on
|
|
6098
|
-
// this debounced hot path.
|
|
6099
|
-
const saved = await setThreadQueuedMessages(threadId, queued, {
|
|
6100
|
-
ownerEmail: owner,
|
|
6101
|
-
});
|
|
6134
|
+
const saved = await setThreadQueuedMessages(threadId, queued);
|
|
6102
6135
|
if (!saved) {
|
|
6103
6136
|
setResponseStatus(event, 404);
|
|
6104
6137
|
return { error: "Thread not found" };
|
|
@@ -6106,8 +6139,8 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
6106
6139
|
return { ok: true };
|
|
6107
6140
|
}
|
|
6108
6141
|
if (method === "POST" && isThreadSubroute("rename")) {
|
|
6109
|
-
const thread = await
|
|
6110
|
-
if (!thread
|
|
6142
|
+
const thread = await resolveThreadAccess(owner, threadId, "editor", { orgId });
|
|
6143
|
+
if (!thread) {
|
|
6111
6144
|
setResponseStatus(event, 404);
|
|
6112
6145
|
return { error: "Thread not found" };
|
|
6113
6146
|
}
|
|
@@ -6119,9 +6152,7 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
6119
6152
|
setResponseStatus(event, 400);
|
|
6120
6153
|
return { error: "Title is required" };
|
|
6121
6154
|
}
|
|
6122
|
-
const renamed = await renameThread(threadId, title
|
|
6123
|
-
ownerEmail: owner,
|
|
6124
|
-
});
|
|
6155
|
+
const renamed = await renameThread(threadId, title);
|
|
6125
6156
|
if (!renamed) {
|
|
6126
6157
|
setResponseStatus(event, 404);
|
|
6127
6158
|
return { error: "Thread not found" };
|
|
@@ -6129,8 +6160,8 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
6129
6160
|
return { ok: true };
|
|
6130
6161
|
}
|
|
6131
6162
|
if (method === "POST" && isThreadSubroute("pin")) {
|
|
6132
|
-
const thread = await
|
|
6133
|
-
if (!thread
|
|
6163
|
+
const thread = await resolveThreadAccess(owner, threadId, "editor", { orgId });
|
|
6164
|
+
if (!thread) {
|
|
6134
6165
|
setResponseStatus(event, 404);
|
|
6135
6166
|
return { error: "Thread not found" };
|
|
6136
6167
|
}
|
|
@@ -6139,9 +6170,7 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
6139
6170
|
setResponseStatus(event, 400);
|
|
6140
6171
|
return { error: "pinned boolean is required" };
|
|
6141
6172
|
}
|
|
6142
|
-
const pinned = await setThreadPinned(threadId, body.pinned
|
|
6143
|
-
ownerEmail: owner,
|
|
6144
|
-
});
|
|
6173
|
+
const pinned = await setThreadPinned(threadId, body.pinned);
|
|
6145
6174
|
if (!pinned) {
|
|
6146
6175
|
setResponseStatus(event, 404);
|
|
6147
6176
|
return { error: "Thread not found" };
|
|
@@ -6149,8 +6178,8 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
6149
6178
|
return { ok: true };
|
|
6150
6179
|
}
|
|
6151
6180
|
if (method === "POST" && isThreadSubroute("archive")) {
|
|
6152
|
-
const thread = await
|
|
6153
|
-
if (!thread
|
|
6181
|
+
const thread = await resolveThreadAccess(owner, threadId, "editor", { orgId });
|
|
6182
|
+
if (!thread) {
|
|
6154
6183
|
setResponseStatus(event, 404);
|
|
6155
6184
|
return { error: "Thread not found" };
|
|
6156
6185
|
}
|
|
@@ -6159,7 +6188,7 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
6159
6188
|
setResponseStatus(event, 400);
|
|
6160
6189
|
return { error: "archived boolean is required" };
|
|
6161
6190
|
}
|
|
6162
|
-
const archived = await setThreadArchived(threadId, body.archived
|
|
6191
|
+
const archived = await setThreadArchived(threadId, body.archived);
|
|
6163
6192
|
if (!archived) {
|
|
6164
6193
|
setResponseStatus(event, 404);
|
|
6165
6194
|
return { error: "Thread not found" };
|
|
@@ -6168,10 +6197,16 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
6168
6197
|
}
|
|
6169
6198
|
// POST /threads/:id/fork — duplicate a thread with all its messages
|
|
6170
6199
|
if (method === "POST" && isThreadSubroute("fork")) {
|
|
6200
|
+
const thread = await resolveThreadAccess(owner, threadId, "viewer", { orgId });
|
|
6201
|
+
if (!thread) {
|
|
6202
|
+
setResponseStatus(event, 404);
|
|
6203
|
+
return { error: "Thread not found" };
|
|
6204
|
+
}
|
|
6171
6205
|
const body = await readBody(event);
|
|
6172
6206
|
const forked = await forkThread(threadId, owner, {
|
|
6173
6207
|
id: body?.id,
|
|
6174
6208
|
source: parseForkSourceFromBody(body?.source),
|
|
6209
|
+
sourceAccessGranted: true,
|
|
6175
6210
|
});
|
|
6176
6211
|
if (!forked) {
|
|
6177
6212
|
setResponseStatus(event, 404);
|
|
@@ -6180,10 +6215,13 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
6180
6215
|
return forked;
|
|
6181
6216
|
}
|
|
6182
6217
|
if (isThreadSubroute("share")) {
|
|
6218
|
+
const thread = await resolveThreadAccess(owner, threadId, "admin", { orgId });
|
|
6219
|
+
if (!thread) {
|
|
6220
|
+
setResponseStatus(event, 404);
|
|
6221
|
+
return { error: "Thread not found" };
|
|
6222
|
+
}
|
|
6183
6223
|
if (method === "GET") {
|
|
6184
|
-
const state = await getThreadShareState(threadId
|
|
6185
|
-
ownerEmail: owner,
|
|
6186
|
-
});
|
|
6224
|
+
const state = await getThreadShareState(threadId);
|
|
6187
6225
|
if (!state) {
|
|
6188
6226
|
setResponseStatus(event, 404);
|
|
6189
6227
|
return { error: "Thread not found" };
|
|
@@ -6191,9 +6229,7 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
6191
6229
|
return { share: state };
|
|
6192
6230
|
}
|
|
6193
6231
|
if (method === "POST") {
|
|
6194
|
-
const link = await createThreadShareLink(threadId
|
|
6195
|
-
ownerEmail: owner,
|
|
6196
|
-
});
|
|
6232
|
+
const link = await createThreadShareLink(threadId);
|
|
6197
6233
|
if (!link) {
|
|
6198
6234
|
setResponseStatus(event, 404);
|
|
6199
6235
|
return { error: "Thread not found" };
|
|
@@ -6204,9 +6240,7 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
6204
6240
|
};
|
|
6205
6241
|
}
|
|
6206
6242
|
if (method === "DELETE") {
|
|
6207
|
-
const state = await revokeThreadShareLink(threadId
|
|
6208
|
-
ownerEmail: owner,
|
|
6209
|
-
});
|
|
6243
|
+
const state = await revokeThreadShareLink(threadId);
|
|
6210
6244
|
if (!state) {
|
|
6211
6245
|
setResponseStatus(event, 404);
|
|
6212
6246
|
return { error: "Thread not found" };
|
|
@@ -6236,6 +6270,7 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
6236
6270
|
if (q) {
|
|
6237
6271
|
const threads = await searchThreads(owner, q, limit, {
|
|
6238
6272
|
scope: scope ?? undefined,
|
|
6273
|
+
orgId,
|
|
6239
6274
|
});
|
|
6240
6275
|
return { threads };
|
|
6241
6276
|
}
|
|
@@ -6245,6 +6280,7 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
6245
6280
|
offset,
|
|
6246
6281
|
scope: scope ?? undefined,
|
|
6247
6282
|
unscopedOnly,
|
|
6283
|
+
orgId,
|
|
6248
6284
|
});
|
|
6249
6285
|
return { threads };
|
|
6250
6286
|
}
|