@agent-native/core 0.114.15 → 0.115.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent-native.eject.json +2 -0
- package/bin/agent-native.js +35 -14
- package/bin/launcher.js +34 -0
- package/corpus/README.md +3 -3
- package/corpus/core/CHANGELOG.md +35 -0
- package/corpus/core/agent-native.eject.json +2 -0
- package/corpus/core/bin/agent-native.js +35 -14
- package/corpus/core/bin/launcher.js +34 -0
- package/corpus/core/docs/content/agent-native-toolkit.mdx +16 -0
- package/corpus/core/docs/content/recurring-jobs.mdx +35 -6
- package/corpus/core/export-snapshot.json +4 -0
- package/corpus/core/package.json +5 -1
- package/corpus/core/src/action.ts +22 -1
- package/corpus/core/src/agent/production-agent.ts +105 -3
- package/corpus/core/src/cli/templates-meta.ts +12 -0
- package/corpus/core/src/client/AssistantChat.tsx +53 -26
- package/corpus/core/src/client/agent-page/AgentJobsTab.tsx +19 -0
- package/corpus/core/src/client/agent-page/use-jobs.ts +1 -0
- package/corpus/core/src/client/chat/message-components.tsx +35 -1
- package/corpus/core/src/client/chat/tool-call-display.tsx +38 -3
- package/corpus/core/src/connections/catalog.ts +20 -1
- package/corpus/core/src/connections/reader.ts +65 -0
- package/corpus/core/src/dashboard-storage/index.ts +27 -0
- package/corpus/core/src/dashboard-storage/panel-source.ts +168 -0
- package/corpus/core/src/dashboard-storage/schema.ts +62 -0
- package/corpus/core/src/dashboard-storage/store.ts +333 -0
- package/corpus/core/src/deploy/build.ts +95 -16
- package/corpus/core/src/eject/provider-api-definitions.ts +1 -0
- package/corpus/core/src/eject/workspace-connections.ts +1 -0
- package/corpus/core/src/extensions/actions.ts +199 -73
- package/corpus/core/src/jobs/actions/list-recurring-jobs.ts +2 -0
- package/corpus/core/src/jobs/scheduler.ts +71 -4
- package/corpus/core/src/jobs/tools.ts +31 -1
- package/corpus/core/src/localization/default-messages.ts +1 -0
- package/corpus/core/src/mcp-client/index.ts +6 -0
- package/corpus/core/src/provider-api/actions/provider-api.ts +1 -1
- package/corpus/core/src/provider-api/index.ts +190 -5
- package/corpus/core/src/secrets/register-framework-secrets.ts +8 -0
- package/corpus/core/src/server/agent-chat/context-tools.ts +9 -0
- package/corpus/core/src/server/agent-chat/framework-prompts.ts +2 -2
- package/corpus/core/src/server/agent-chat-plugin.ts +22 -2
- package/corpus/core/src/server/core-routes-plugin.ts +1 -0
- package/corpus/core/src/server/credential-provider.ts +9 -3
- package/corpus/core/src/server/workspace-provider-oauth.ts +181 -4
- package/corpus/core/src/styles/agent-native.css +45 -2
- package/corpus/core/src/templates/default/.agents/skills/agent-native-docs/SKILL.md +27 -0
- package/corpus/core/src/templates/default/.agents/skills/app-branding/SKILL.md +159 -0
- package/corpus/core/src/templates/default/.agents/skills/app-permissions/SKILL.md +155 -0
- package/corpus/core/src/templates/headless/.agents/skills/agent-native-docs/SKILL.md +27 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +27 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +31 -18
- package/corpus/core/src/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +15 -0
- package/corpus/core/src/triggers/actions.ts +11 -2
- package/corpus/core/src/triggers/dispatcher.ts +20 -1
- package/corpus/core/src/triggers/types.ts +5 -0
- package/corpus/core/src/vite/action-types-plugin.ts +9 -1
- package/corpus/templates/analytics/.agents/skills/agent-native-docs/SKILL.md +115 -0
- package/corpus/templates/analytics/AGENTS.md +11 -11
- package/corpus/templates/analytics/_gitignore +39 -0
- package/corpus/templates/analytics/actions/query-dashboard-panel.ts +30 -0
- package/corpus/templates/analytics/actions/update-dashboard.ts +2 -1
- package/corpus/templates/analytics/app/lib/sql-query.ts +11 -25
- package/corpus/templates/analytics/changelog/2026-07-21-fixed-extension-updates-failing-before-changes-could-be-appl.md +6 -0
- package/corpus/templates/analytics/server/lib/dashboard-panel-query.ts +1 -0
- package/corpus/templates/analytics/server/lib/dashboard-panel-source-resolver.ts +51 -0
- package/corpus/templates/analytics/server/lib/prometheus.ts +1 -1
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +1 -1
- package/corpus/templates/assets/.agents/skills/agent-native-docs/SKILL.md +115 -0
- package/corpus/templates/brain/.agents/skills/agent-native-docs/SKILL.md +115 -0
- package/corpus/templates/calendar/.agents/skills/agent-native-docs/SKILL.md +115 -0
- package/corpus/templates/calendar/_gitignore +39 -0
- package/corpus/templates/chat/.agents/skills/agent-native-docs/SKILL.md +27 -0
- package/corpus/templates/chat/AGENTS.md +1 -1
- package/corpus/templates/clips/.agents/skills/agent-native-docs/SKILL.md +115 -0
- package/corpus/templates/clips/AGENTS.md +7 -0
- package/corpus/templates/clips/actions/prepare-crm-call-evidence.ts +58 -0
- package/corpus/templates/clips/app/components/library/bulk-action-toolbar.tsx +25 -8
- package/corpus/templates/clips/app/components/library/library-grid.tsx +118 -9
- package/corpus/templates/clips/app/components/library/library-layout.tsx +1 -1
- package/corpus/templates/clips/app/components/library/recording-card.tsx +10 -8
- package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +88 -11
- package/corpus/templates/clips/app/i18n/en-US.ts +6 -0
- package/corpus/templates/clips/app/routes/_app.trash.tsx +16 -1
- package/corpus/templates/clips/changelog/2026-07-21-crm-call-evidence-handoff.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-21-recording-retries-and-restarts-keep-their-upload-session-so-.md +6 -0
- package/corpus/templates/clips/chrome-extension/src/background.ts +20 -5
- package/corpus/templates/clips/chrome-extension/src/native-recording-state.ts +19 -0
- package/corpus/templates/clips/chrome-extension/src/offscreen.ts +8 -0
- package/corpus/templates/clips/desktop/src/app.tsx +24 -3
- package/corpus/templates/clips/desktop/src/overlays/recording-pill.tsx +9 -0
- package/corpus/templates/clips/desktop/src-tauri/src/recording_indicator.rs +54 -28
- package/corpus/templates/clips/server/plugins/agent-chat.ts +1 -0
- package/corpus/templates/content/.agents/skills/agent-native-docs/SKILL.md +115 -0
- package/corpus/templates/content/_gitignore +39 -0
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +20 -38
- package/corpus/templates/content/app/components/editor/previewDocumentSaveController.ts +40 -1
- package/corpus/templates/content/learnings.defaults.md +5 -0
- package/corpus/templates/crm/.agents/skills/agent-native-docs/SKILL.md +115 -0
- package/corpus/templates/crm/.agents/skills/agent-native-toolkit/SKILL.md +133 -0
- package/corpus/templates/crm/.agents/skills/crm/SKILL.md +128 -0
- package/corpus/templates/crm/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/corpus/templates/crm/.agents/skills/feature-flags/SKILL.md +169 -0
- package/corpus/templates/crm/.agents/skills/upgrade-agent-native/SKILL.md +100 -0
- package/corpus/templates/crm/.env.example +5 -0
- package/corpus/templates/crm/AGENTS.md +120 -0
- package/corpus/templates/crm/CHANGELOG.md +1 -0
- package/corpus/templates/crm/DEVELOPING.md +66 -0
- package/corpus/templates/crm/README.md +106 -0
- package/corpus/templates/crm/_gitignore +12 -0
- package/corpus/templates/crm/actions/_crm-action-utils.ts +87 -0
- package/corpus/templates/crm/actions/_crm-dashboard.ts +69 -0
- package/corpus/templates/crm/actions/_crm-signal-utils.ts +79 -0
- package/corpus/templates/crm/actions/apply-crm-proposals.ts +203 -0
- package/corpus/templates/crm/actions/attach-call-evidence.ts +170 -0
- package/corpus/templates/crm/actions/configure-crm-connection.ts +126 -0
- package/corpus/templates/crm/actions/configure-native-crm.ts +44 -0
- package/corpus/templates/crm/actions/create-crm-record.ts +148 -0
- package/corpus/templates/crm/actions/create-crm-signal-tracker.ts +58 -0
- package/corpus/templates/crm/actions/delete-staged-dataset.ts +14 -0
- package/corpus/templates/crm/actions/get-crm-automation-recipe.ts +36 -0
- package/corpus/templates/crm/actions/get-crm-dashboard-panel.ts +33 -0
- package/corpus/templates/crm/actions/get-crm-dashboard.ts +14 -0
- package/corpus/templates/crm/actions/get-crm-overview.ts +13 -0
- package/corpus/templates/crm/actions/get-crm-pipeline-data.ts +61 -0
- package/corpus/templates/crm/actions/get-crm-record.ts +75 -0
- package/corpus/templates/crm/actions/install-crm-pipeline-dashboard.ts +81 -0
- package/corpus/templates/crm/actions/list-crm-dashboard-revisions.ts +15 -0
- package/corpus/templates/crm/actions/list-crm-dashboards.ts +15 -0
- package/corpus/templates/crm/actions/list-crm-proposals.ts +31 -0
- package/corpus/templates/crm/actions/list-crm-records.ts +79 -0
- package/corpus/templates/crm/actions/list-crm-saved-views.ts +15 -0
- package/corpus/templates/crm/actions/list-crm-signal-hits.ts +43 -0
- package/corpus/templates/crm/actions/list-crm-signal-trackers.ts +32 -0
- package/corpus/templates/crm/actions/list-crm-tasks.ts +22 -0
- package/corpus/templates/crm/actions/list-staged-datasets.ts +14 -0
- package/corpus/templates/crm/actions/list-workspace-connections.ts +47 -0
- package/corpus/templates/crm/actions/manage-crm-signal-tracker.ts +87 -0
- package/corpus/templates/crm/actions/manage-crm-task.ts +132 -0
- package/corpus/templates/crm/actions/navigate.ts +63 -0
- package/corpus/templates/crm/actions/provider-api-catalog.ts +22 -0
- package/corpus/templates/crm/actions/provider-api-docs.ts +54 -0
- package/corpus/templates/crm/actions/provider-api-request.ts +92 -0
- package/corpus/templates/crm/actions/query-staged-dataset.ts +44 -0
- package/corpus/templates/crm/actions/record-crm-call-insight.ts +160 -0
- package/corpus/templates/crm/actions/record-crm-smart-signal.ts +150 -0
- package/corpus/templates/crm/actions/restore-crm-dashboard-revision.ts +23 -0
- package/corpus/templates/crm/actions/review-crm-signal.ts +31 -0
- package/corpus/templates/crm/actions/run-crm-saved-view-program.ts +103 -0
- package/corpus/templates/crm/actions/run-crm-signal-trackers.ts +275 -0
- package/corpus/templates/crm/actions/run.ts +11 -0
- package/corpus/templates/crm/actions/save-crm-dashboard.ts +51 -0
- package/corpus/templates/crm/actions/save-crm-saved-view.ts +119 -0
- package/corpus/templates/crm/actions/sync-crm.ts +146 -0
- package/corpus/templates/crm/actions/update-crm-record.ts +508 -0
- package/corpus/templates/crm/actions/view-screen.ts +218 -0
- package/corpus/templates/crm/agent-native.app-skill.json +58 -0
- package/corpus/templates/crm/app/components/crm/CreateCrmRecordDialog.tsx +158 -0
- package/corpus/templates/crm/app/components/crm/CrmDashboardPanel.tsx +83 -0
- package/corpus/templates/crm/app/components/crm/CrmSignalsPanel.tsx +225 -0
- package/corpus/templates/crm/app/components/crm/IntelligenceSettings.tsx +413 -0
- package/corpus/templates/crm/app/components/crm/RecordActions.tsx +510 -0
- package/corpus/templates/crm/app/components/crm/RecordGrid.tsx +134 -0
- package/corpus/templates/crm/app/components/crm/RecordWorkspace.tsx +367 -0
- package/corpus/templates/crm/app/components/crm/SavedViewDataProgram.tsx +92 -0
- package/corpus/templates/crm/app/components/crm/Surface.tsx +96 -0
- package/corpus/templates/crm/app/components/crm/WorkOverview.tsx +180 -0
- package/corpus/templates/crm/app/components/layout/CrmLayout.tsx +106 -0
- package/corpus/templates/crm/app/components/layout/CrmSidebar.tsx +84 -0
- package/corpus/templates/crm/app/entry.client.tsx +16 -0
- package/corpus/templates/crm/app/entry.server.tsx +10 -0
- package/corpus/templates/crm/app/global.css +167 -0
- package/corpus/templates/crm/app/hooks/use-navigation-state.ts +60 -0
- package/corpus/templates/crm/app/i18n/en-US.ts +89 -0
- package/corpus/templates/crm/app/i18n/index.ts +34 -0
- package/corpus/templates/crm/app/lib/dashboard.ts +13 -0
- package/corpus/templates/crm/app/lib/navigation.ts +54 -0
- package/corpus/templates/crm/app/lib/tab-id.ts +1 -0
- package/corpus/templates/crm/app/lib/types.ts +172 -0
- package/corpus/templates/crm/app/lib/utils.ts +1 -0
- package/corpus/templates/crm/app/root.tsx +88 -0
- package/corpus/templates/crm/app/routes/_index.tsx +26 -0
- package/corpus/templates/crm/app/routes/accounts.tsx +41 -0
- package/corpus/templates/crm/app/routes/agent.tsx +5 -0
- package/corpus/templates/crm/app/routes/ask.tsx +53 -0
- package/corpus/templates/crm/app/routes/dashboard.tsx +118 -0
- package/corpus/templates/crm/app/routes/opportunities.tsx +41 -0
- package/corpus/templates/crm/app/routes/people.tsx +41 -0
- package/corpus/templates/crm/app/routes/proposals.tsx +266 -0
- package/corpus/templates/crm/app/routes/records.$recordId.tsx +35 -0
- package/corpus/templates/crm/app/routes/settings.tsx +63 -0
- package/corpus/templates/crm/app/routes/setup.tsx +308 -0
- package/corpus/templates/crm/app/routes/tasks.tsx +252 -0
- package/corpus/templates/crm/app/routes/views.tsx +333 -0
- package/corpus/templates/crm/app/routes.ts +17 -0
- package/corpus/templates/crm/app/vite-env.d.ts +6 -0
- package/corpus/templates/crm/changelog/2026-07-21-agent-native-crm.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-21-clips-call-evidence-review-recipe.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-21-crm-can-now-find-and-review-evidence-grounded-call-signals-w.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-21-crm-can-now-manage-keyword-and-smart-call-signal-trackers-fr.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-21-delegated-local-crm-automation.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-21-native-sql.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-21-pipeline-dashboard.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-21-pipeline-dashboards-now-install-correctly-from-the-crm-actio.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-21-salesforce-connection.md +6 -0
- package/corpus/templates/crm/components.json +20 -0
- package/corpus/templates/crm/docs/architecture/crm-contract.md +180 -0
- package/corpus/templates/crm/learnings.defaults.md +5 -0
- package/corpus/templates/crm/package.json +59 -0
- package/corpus/templates/crm/public/favicon.svg +1 -0
- package/corpus/templates/crm/public/icon-180.svg +1 -0
- package/corpus/templates/crm/public/manifest.json +11 -0
- package/corpus/templates/crm/react-router.config.ts +7 -0
- package/corpus/templates/crm/server/crm/adapter.ts +32 -0
- package/corpus/templates/crm/server/crm/crm-field-firewall.ts +64 -0
- package/corpus/templates/crm/server/crm/crm-mirror.ts +711 -0
- package/corpus/templates/crm/server/crm/hubspot-adapter.ts +1143 -0
- package/corpus/templates/crm/server/crm/native-adapter.ts +1715 -0
- package/corpus/templates/crm/server/crm/read-through.ts +207 -0
- package/corpus/templates/crm/server/crm/salesforce-adapter.ts +1255 -0
- package/corpus/templates/crm/server/db/crm-store.ts +1170 -0
- package/corpus/templates/crm/server/db/index.ts +169 -0
- package/corpus/templates/crm/server/db/schema.ts +441 -0
- package/corpus/templates/crm/server/lib/intelligence/default-detectors.ts +65 -0
- package/corpus/templates/crm/server/lib/intelligence/evidence.ts +105 -0
- package/corpus/templates/crm/server/lib/intelligence/keyword-detector.ts +100 -0
- package/corpus/templates/crm/server/lib/intelligence/smart-detector.ts +144 -0
- package/corpus/templates/crm/server/lib/intelligence/summary.ts +141 -0
- package/corpus/templates/crm/server/lib/provider-api.ts +64 -0
- package/corpus/templates/crm/server/middleware/auth.ts +4 -0
- package/corpus/templates/crm/server/plugins/agent-chat.ts +68 -0
- package/corpus/templates/crm/server/plugins/auth.ts +14 -0
- package/corpus/templates/crm/server/plugins/core-routes.ts +17 -0
- package/corpus/templates/crm/server/plugins/db.ts +454 -0
- package/corpus/templates/crm/server/routes/[...page].get.ts +5 -0
- package/corpus/templates/crm/shared/crm-automation-recipes.ts +132 -0
- package/corpus/templates/crm/shared/crm-contract.ts +254 -0
- package/corpus/templates/crm/shared/crm-sales-config.ts +63 -0
- package/corpus/templates/crm/ssr-entry.ts +11 -0
- package/corpus/templates/crm/tsconfig.json +24 -0
- package/corpus/templates/crm/vite.config.ts +15 -0
- package/corpus/templates/crm/vitest.config.ts +5 -0
- package/corpus/templates/design/.agents/skills/agent-native-docs/SKILL.md +115 -0
- package/corpus/templates/dispatch/.agents/skills/agent-native-docs/SKILL.md +115 -0
- package/corpus/templates/forms/.agents/skills/agent-native-docs/SKILL.md +115 -0
- package/corpus/templates/forms/_gitignore +39 -0
- package/corpus/templates/forms/learnings.defaults.md +5 -0
- package/corpus/templates/macros/.agents/skills/agent-native-docs/SKILL.md +115 -0
- package/corpus/templates/macros/_gitignore +39 -0
- package/corpus/templates/macros/learnings.defaults.md +5 -0
- package/corpus/templates/mail/.agents/skills/agent-native-docs/SKILL.md +115 -0
- package/corpus/templates/mail/_gitignore +39 -0
- package/corpus/templates/plan/.agents/skills/agent-native-docs/SKILL.md +115 -0
- package/corpus/templates/slides/.agents/skills/agent-native-docs/SKILL.md +115 -0
- package/corpus/templates/slides/_gitignore +39 -0
- package/corpus/templates/tasks/.agents/skills/agent-native-docs/SKILL.md +27 -0
- package/corpus/templates/tasks/_gitignore +39 -0
- package/corpus/toolkit/CHANGELOG.md +12 -0
- package/corpus/toolkit/README.md +30 -0
- package/corpus/toolkit/agent-native.eject.json +33 -0
- package/corpus/toolkit/package.json +15 -1
- package/corpus/toolkit/src/dashboard/DataTable.tsx +273 -0
- package/corpus/toolkit/src/dashboard/DateRangePicker.tsx +57 -0
- package/corpus/toolkit/src/dashboard/GenericChartPanel.tsx +461 -0
- package/corpus/toolkit/src/dashboard/MetricCard.tsx +54 -0
- package/corpus/toolkit/src/dashboard/StatsCard.tsx +49 -0
- package/corpus/toolkit/src/dashboard/dashboard-layout.ts +329 -0
- package/corpus/toolkit/src/dashboard/index.ts +6 -0
- package/corpus/toolkit/src/index.ts +1 -0
- package/corpus/toolkit/src/ui/calendar.tsx +8 -8
- package/corpus/toolkit/src/ui/date-picker.tsx +4 -1
- package/dist/action.d.ts +14 -1
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js.map +1 -1
- package/dist/agent/production-agent.d.ts +3 -1
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +83 -3
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/cli/templates-meta.d.ts.map +1 -1
- package/dist/cli/templates-meta.js +12 -0
- package/dist/cli/templates-meta.js.map +1 -1
- package/dist/client/AssistantChat.d.ts +4 -0
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +30 -17
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/agent-page/AgentJobsTab.d.ts.map +1 -1
- package/dist/client/agent-page/AgentJobsTab.js +3 -1
- package/dist/client/agent-page/AgentJobsTab.js.map +1 -1
- package/dist/client/agent-page/use-jobs.d.ts +1 -0
- package/dist/client/agent-page/use-jobs.d.ts.map +1 -1
- package/dist/client/agent-page/use-jobs.js.map +1 -1
- package/dist/client/chat/message-components.d.ts +5 -0
- package/dist/client/chat/message-components.d.ts.map +1 -1
- package/dist/client/chat/message-components.js +17 -1
- package/dist/client/chat/message-components.js.map +1 -1
- package/dist/client/chat/tool-call-display.d.ts +3 -1
- package/dist/client/chat/tool-call-display.d.ts.map +1 -1
- package/dist/client/chat/tool-call-display.js +17 -7
- package/dist/client/chat/tool-call-display.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/collab/struct-routes.d.ts +1 -1
- package/dist/connections/catalog.d.ts +17 -3
- package/dist/connections/catalog.d.ts.map +1 -1
- package/dist/connections/catalog.js +16 -1
- package/dist/connections/catalog.js.map +1 -1
- package/dist/connections/reader.d.ts +18 -0
- package/dist/connections/reader.d.ts.map +1 -1
- package/dist/connections/reader.js +41 -0
- package/dist/connections/reader.js.map +1 -1
- package/dist/dashboard-storage/index.d.ts +4 -0
- package/dist/dashboard-storage/index.d.ts.map +1 -0
- package/dist/dashboard-storage/index.js +4 -0
- package/dist/dashboard-storage/index.js.map +1 -0
- package/dist/dashboard-storage/panel-source.d.ts +68 -0
- package/dist/dashboard-storage/panel-source.d.ts.map +1 -0
- package/dist/dashboard-storage/panel-source.js +76 -0
- package/dist/dashboard-storage/panel-source.js.map +1 -0
- package/dist/dashboard-storage/schema.d.ts +562 -0
- package/dist/dashboard-storage/schema.d.ts.map +1 -0
- package/dist/dashboard-storage/schema.js +32 -0
- package/dist/dashboard-storage/schema.js.map +1 -0
- package/dist/dashboard-storage/store.d.ts +62 -0
- package/dist/dashboard-storage/store.d.ts.map +1 -0
- package/dist/dashboard-storage/store.js +227 -0
- package/dist/dashboard-storage/store.js.map +1 -0
- package/dist/deploy/build.d.ts +7 -0
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +78 -14
- package/dist/deploy/build.js.map +1 -1
- package/dist/eject/provider-api-definitions.d.ts +2 -1
- package/dist/eject/provider-api-definitions.d.ts.map +1 -1
- package/dist/eject/provider-api-definitions.js +1 -0
- package/dist/eject/provider-api-definitions.js.map +1 -1
- package/dist/eject/workspace-connections.d.ts.map +1 -1
- package/dist/eject/workspace-connections.js +1 -0
- package/dist/eject/workspace-connections.js.map +1 -1
- package/dist/extensions/actions.d.ts.map +1 -1
- package/dist/extensions/actions.js +165 -67
- package/dist/extensions/actions.js.map +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/jobs/actions/list-recurring-jobs.d.ts +1 -0
- package/dist/jobs/actions/list-recurring-jobs.d.ts.map +1 -1
- package/dist/jobs/actions/list-recurring-jobs.js +1 -0
- package/dist/jobs/actions/list-recurring-jobs.js.map +1 -1
- package/dist/jobs/scheduler.d.ts +17 -2
- package/dist/jobs/scheduler.d.ts.map +1 -1
- package/dist/jobs/scheduler.js +51 -2
- package/dist/jobs/scheduler.js.map +1 -1
- package/dist/jobs/tools.d.ts.map +1 -1
- package/dist/jobs/tools.js +32 -2
- package/dist/jobs/tools.js.map +1 -1
- package/dist/localization/default-messages.d.ts +1 -0
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +1 -0
- package/dist/localization/default-messages.js.map +1 -1
- package/dist/mcp-client/index.d.ts +2 -0
- package/dist/mcp-client/index.d.ts.map +1 -1
- package/dist/mcp-client/index.js +5 -0
- package/dist/mcp-client/index.js.map +1 -1
- package/dist/observability/routes.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +8 -8
- package/dist/provider-api/actions/provider-api.d.ts +8 -6
- package/dist/provider-api/actions/provider-api.d.ts.map +1 -1
- package/dist/provider-api/actions/provider-api.js +1 -1
- package/dist/provider-api/actions/provider-api.js.map +1 -1
- package/dist/provider-api/index.d.ts +11 -7
- package/dist/provider-api/index.d.ts.map +1 -1
- package/dist/provider-api/index.js +143 -5
- package/dist/provider-api/index.js.map +1 -1
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/secrets/register-framework-secrets.d.ts.map +1 -1
- package/dist/secrets/register-framework-secrets.js +7 -0
- package/dist/secrets/register-framework-secrets.js.map +1 -1
- package/dist/server/agent-chat/context-tools.d.ts.map +1 -1
- package/dist/server/agent-chat/context-tools.js +9 -0
- package/dist/server/agent-chat/context-tools.js.map +1 -1
- package/dist/server/agent-chat/framework-prompts.js +2 -2
- package/dist/server/agent-chat/framework-prompts.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +18 -2
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +1 -0
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/credential-provider.d.ts +4 -3
- package/dist/server/credential-provider.d.ts.map +1 -1
- package/dist/server/credential-provider.js +9 -3
- package/dist/server/credential-provider.js.map +1 -1
- package/dist/server/workspace-provider-oauth.d.ts +6 -1
- package/dist/server/workspace-provider-oauth.d.ts.map +1 -1
- package/dist/server/workspace-provider-oauth.js +141 -4
- package/dist/server/workspace-provider-oauth.js.map +1 -1
- package/dist/styles/agent-native.css +45 -2
- package/dist/templates/chat/.agents/skills/agent-native-docs/SKILL.md +27 -0
- package/dist/templates/chat/AGENTS.md +1 -1
- package/dist/templates/default/.agents/skills/agent-native-docs/SKILL.md +27 -0
- package/dist/templates/default/.agents/skills/app-branding/SKILL.md +159 -0
- package/dist/templates/default/.agents/skills/app-permissions/SKILL.md +155 -0
- package/dist/templates/headless/.agents/skills/agent-native-docs/SKILL.md +27 -0
- package/dist/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +27 -0
- package/dist/templates/workspace-core/.agents/skills/extensions/SKILL.md +31 -18
- package/dist/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +15 -0
- package/dist/triggers/actions.d.ts.map +1 -1
- package/dist/triggers/actions.js +10 -2
- package/dist/triggers/actions.js.map +1 -1
- package/dist/triggers/dispatcher.d.ts.map +1 -1
- package/dist/triggers/dispatcher.js +15 -0
- package/dist/triggers/dispatcher.js.map +1 -1
- package/dist/triggers/types.d.ts +5 -0
- package/dist/triggers/types.d.ts.map +1 -1
- package/dist/triggers/types.js.map +1 -1
- package/dist/vite/action-types-plugin.d.ts.map +1 -1
- package/dist/vite/action-types-plugin.js +4 -1
- package/dist/vite/action-types-plugin.js.map +1 -1
- package/docs/content/agent-native-toolkit.mdx +16 -0
- package/docs/content/recurring-jobs.mdx +35 -6
- package/package.json +6 -2
- package/src/action.ts +22 -1
- package/src/agent/production-agent.ts +105 -3
- package/src/cli/templates-meta.ts +12 -0
- package/src/client/AssistantChat.tsx +53 -26
- package/src/client/agent-page/AgentJobsTab.tsx +19 -0
- package/src/client/agent-page/use-jobs.ts +1 -0
- package/src/client/chat/message-components.tsx +35 -1
- package/src/client/chat/tool-call-display.tsx +38 -3
- package/src/connections/catalog.ts +20 -1
- package/src/connections/reader.ts +65 -0
- package/src/dashboard-storage/index.ts +27 -0
- package/src/dashboard-storage/panel-source.ts +168 -0
- package/src/dashboard-storage/schema.ts +62 -0
- package/src/dashboard-storage/store.ts +333 -0
- package/src/deploy/build.ts +95 -16
- package/src/eject/provider-api-definitions.ts +1 -0
- package/src/eject/workspace-connections.ts +1 -0
- package/src/extensions/actions.ts +199 -73
- package/src/jobs/actions/list-recurring-jobs.ts +2 -0
- package/src/jobs/scheduler.ts +71 -4
- package/src/jobs/tools.ts +31 -1
- package/src/localization/default-messages.ts +1 -0
- package/src/mcp-client/index.ts +6 -0
- package/src/provider-api/actions/provider-api.ts +1 -1
- package/src/provider-api/index.ts +190 -5
- package/src/secrets/register-framework-secrets.ts +8 -0
- package/src/server/agent-chat/context-tools.ts +9 -0
- package/src/server/agent-chat/framework-prompts.ts +2 -2
- package/src/server/agent-chat-plugin.ts +22 -2
- package/src/server/core-routes-plugin.ts +1 -0
- package/src/server/credential-provider.ts +9 -3
- package/src/server/workspace-provider-oauth.ts +181 -4
- package/src/styles/agent-native.css +45 -2
- package/src/templates/chat/.agents/skills/agent-native-docs/SKILL.md +27 -0
- package/src/templates/chat/AGENTS.md +1 -1
- package/src/templates/default/.agents/skills/agent-native-docs/SKILL.md +27 -0
- package/src/templates/default/.agents/skills/app-branding/SKILL.md +159 -0
- package/src/templates/default/.agents/skills/app-permissions/SKILL.md +155 -0
- package/src/templates/headless/.agents/skills/agent-native-docs/SKILL.md +27 -0
- package/src/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +27 -0
- package/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +31 -18
- package/src/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +15 -0
- package/src/triggers/actions.ts +11 -2
- package/src/triggers/dispatcher.ts +20 -1
- package/src/triggers/types.ts +5 -0
- package/src/vite/action-types-plugin.ts +9 -1
- package/corpus/templates/analytics/server/handlers/sql-query.ts +0 -36
- package/corpus/templates/analytics/server/routes/api/sql-query.post.ts +0 -1
|
@@ -186,6 +186,24 @@ export declare const PROVIDER_READERS: readonly [{
|
|
|
186
186
|
}];
|
|
187
187
|
readonly operations: readonly [ProviderReaderOperationDescriptor, ProviderReaderOperationDescriptor, ProviderReaderOperationDescriptor];
|
|
188
188
|
readonly notes: "Templates define object allow-lists and property projections; core only documents the reader shape.";
|
|
189
|
+
}, {
|
|
190
|
+
readonly providerId: "salesforce";
|
|
191
|
+
readonly label: "Salesforce reader";
|
|
192
|
+
readonly description: "Normalized metadata for CRM object lookup through template-owned Salesforce integrations.";
|
|
193
|
+
readonly implementationStatus: "template-owned";
|
|
194
|
+
readonly credentialKeys: readonly WorkspaceConnectionCredentialKey[];
|
|
195
|
+
readonly requiredCredentialKeys: readonly string[];
|
|
196
|
+
readonly capabilities: readonly [{
|
|
197
|
+
readonly capability: "search";
|
|
198
|
+
readonly label: "CRM search";
|
|
199
|
+
readonly description: "Search Salesforce CRM records with provider-native SOQL or object filters.";
|
|
200
|
+
}, {
|
|
201
|
+
readonly capability: "crm";
|
|
202
|
+
readonly label: "CRM retrieval";
|
|
203
|
+
readonly description: "Read Salesforce standard and custom CRM objects when a template owns object mapping.";
|
|
204
|
+
}];
|
|
205
|
+
readonly operations: readonly [ProviderReaderOperationDescriptor, ProviderReaderOperationDescriptor, ProviderReaderOperationDescriptor];
|
|
206
|
+
readonly notes: "Templates define object allow-lists, field projections, and API-version selection; core only documents the reader shape.";
|
|
189
207
|
}, {
|
|
190
208
|
readonly providerId: "gmail";
|
|
191
209
|
readonly label: "Gmail reader";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reader.d.ts","sourceRoot":"","sources":["../../src/connections/reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,kDAAkD,EAEvD,KAAK,wCAAwC,EAE7C,KAAK,sCAAsC,EAC5C,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAEL,KAAK,iCAAiC,EACtC,KAAK,uCAAuC,EAC7C,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAEL,KAAK,6BAA6B,EAClC,KAAK,gCAAgC,EACrC,KAAK,6BAA6B,EACnC,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,KAAK,GAAG,YAAY,CAAC;AAEtE,MAAM,MAAM,kCAAkC,GAC1C,eAAe,GACf,gBAAgB,GAChB,QAAQ,CAAC;AAEb,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,6BAA6B,CAAC;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gCAAgC;IAC/C,IAA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,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,GACjB,wBAAwB,GAAG,SAAS,CAKtC;AAED,wBAAgB,sBAAsB,CACpC,gBAAgB,EAAE,wBAAwB,GAAG,6BAA6B,EAC1E,aAAa,EAAE,uBAAuB,GACrC,OAAO,CAUT;AAED,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,4BAA4B,GACpC,qBAAqB,CAsIvB"}
|
|
@@ -211,6 +211,47 @@ export const PROVIDER_READERS = [
|
|
|
211
211
|
],
|
|
212
212
|
notes: "Templates define object allow-lists and property projections; core only documents the reader shape.",
|
|
213
213
|
}),
|
|
214
|
+
defineProviderReader({
|
|
215
|
+
providerId: "salesforce",
|
|
216
|
+
label: "Salesforce reader",
|
|
217
|
+
description: "Normalized metadata for CRM object lookup through template-owned Salesforce integrations.",
|
|
218
|
+
implementationStatus: "template-owned",
|
|
219
|
+
credentialKeys: providerCredentialKeys("salesforce"),
|
|
220
|
+
requiredCredentialKeys: requiredCredentialKeys("salesforce"),
|
|
221
|
+
capabilities: [
|
|
222
|
+
{
|
|
223
|
+
capability: "search",
|
|
224
|
+
label: "CRM search",
|
|
225
|
+
description: "Search Salesforce CRM records with provider-native SOQL or object filters.",
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
capability: "crm",
|
|
229
|
+
label: "CRM retrieval",
|
|
230
|
+
description: "Read Salesforce standard and custom CRM objects when a template owns object mapping.",
|
|
231
|
+
},
|
|
232
|
+
],
|
|
233
|
+
operations: [
|
|
234
|
+
operation("search", "Search Salesforce CRM", "Find CRM records matching text, SOQL, or provider-native filters.", "template-owned", [
|
|
235
|
+
...searchParameters,
|
|
236
|
+
{
|
|
237
|
+
name: "objectType",
|
|
238
|
+
type: "string",
|
|
239
|
+
description: "Optional Salesforce object API name such as Account, Contact, Opportunity, or a custom object.",
|
|
240
|
+
},
|
|
241
|
+
]),
|
|
242
|
+
operation("get", "Get Salesforce CRM object", "Load one Salesforce CRM record by object API name and id.", "template-owned", [
|
|
243
|
+
...getParameters,
|
|
244
|
+
{
|
|
245
|
+
name: "objectType",
|
|
246
|
+
type: "string",
|
|
247
|
+
required: true,
|
|
248
|
+
description: "Salesforce object API name such as Account, Contact, Opportunity, or a custom object.",
|
|
249
|
+
},
|
|
250
|
+
]),
|
|
251
|
+
operation("listRecent", "List recent Salesforce CRM objects", "List recently updated CRM records visible to the connected Salesforce user.", "template-owned", listRecentParameters),
|
|
252
|
+
],
|
|
253
|
+
notes: "Templates define object allow-lists, field projections, and API-version selection; core only documents the reader shape.",
|
|
254
|
+
}),
|
|
214
255
|
defineProviderReader({
|
|
215
256
|
providerId: "gmail",
|
|
216
257
|
label: "Gmail reader",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reader.js","sourceRoot":"","sources":["../../src/connections/reader.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2CAA2C,GAM5C,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,gCAAgC,GAGjC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,8BAA8B,GAI/B,MAAM,cAAc,CAAC;AA+JtB,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IAC1C,IAAI,CAAiC;IACrC,UAAU,CAAS;IACnB,SAAS,CAA2B;IAE7C,YACE,IAAoC,EACpC,OAAe,EACf,OAGC;QAED,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IACrC,CAAC;CACF;AAED,MAAM,UAAU,oBAAoB,CAClC,MAAS;IAET,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,kCAAkC,CAEhD,cAAiB;IACjB,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,MAAM,gBA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rC,cAAc,EAAE,oBAAoB,CAAC,UAAU,CAAC;KACjD,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAC3B,UAAqC;IAErC,OAAO;QACL,GAAG,CAAC,UAAU,CAAC,aAAa,EAAE,cAAc,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAC9D,mBAAmB,CAAC,GAAG,EAAE,OAAO,CAAC,CAClC;QACD,GAAG,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CACvC,mBAAmB,CAAC,GAAG,EAAE,YAAY,CAAC,CACvC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAC1B,GAAqC,EACrC,MAAwD;IAExD,OAAO;QACL,GAAG,EAAE,GAAG,CAAC,GAAG;QACZ,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,MAAM;KACP,CAAC;AACJ,CAAC","sourcesContent":["import {\n resolveWorkspaceConnectionCredentialsForApp,\n type ResolveWorkspaceConnectionCredentialsForAppOptions,\n type WorkspaceConnectionCredentialRef,\n type WorkspaceConnectionCredentialsResolution,\n type WorkspaceConnectionForApp,\n type WorkspaceConnectionPublicCredentialRef,\n} from \"../workspace-connections/index.js\";\nimport {\n resolveWorkspaceConnectionForApp,\n type ResolvedWorkspaceConnectionForApp,\n type ResolveWorkspaceConnectionForAppOptions,\n} from \"../workspace-connections/store.js\";\nimport {\n getWorkspaceConnectionProvider,\n type WorkspaceConnectionCapability,\n type WorkspaceConnectionCredentialKey,\n type WorkspaceConnectionProviderId,\n} from \"./catalog.js\";\n\nexport type ProviderReaderOperation = \"search\" | \"get\" | \"listRecent\";\n\nexport type ProviderReaderImplementationStatus =\n | \"metadata-only\"\n | \"template-owned\"\n | \"shared\";\n\nexport interface ProviderReaderCapability {\n capability: WorkspaceConnectionCapability;\n label: string;\n description: string;\n}\n\nexport interface ProviderReaderOperationParameter {\n name: string;\n type: \"string\" | \"number\" | \"boolean\" | \"string[]\";\n required?: boolean;\n description: string;\n}\n\nexport interface ProviderReaderOperationDescriptor {\n operation: ProviderReaderOperation;\n label: string;\n description: string;\n implementationStatus: ProviderReaderImplementationStatus;\n parameters: readonly ProviderReaderOperationParameter[];\n}\n\nexport interface ProviderReaderDefinition {\n providerId: WorkspaceConnectionProviderId;\n label: string;\n description: string;\n implementationStatus: ProviderReaderImplementationStatus;\n credentialKeys: readonly WorkspaceConnectionCredentialKey[];\n requiredCredentialKeys: readonly string[];\n capabilities: readonly ProviderReaderCapability[];\n operations: readonly ProviderReaderOperationDescriptor[];\n notes?: string;\n}\n\nexport interface ListProviderReadersOptions {\n providerId?: WorkspaceConnectionProviderId;\n capability?: WorkspaceConnectionCapability;\n operation?: ProviderReaderOperation;\n implementationStatus?: ProviderReaderImplementationStatus;\n}\n\nexport type ProviderReaderRuntimeErrorCode =\n | \"unsupported_provider\"\n | \"unsupported_operation\"\n | \"connection_not_available\"\n | \"credentials_unavailable\";\n\nexport interface ProviderReaderRequest<\n TParams extends Record<string, unknown> = Record<string, unknown>,\n> {\n providerId: WorkspaceConnectionProviderId;\n operation: ProviderReaderOperation;\n params?: TParams;\n connectionId?: string | null;\n userEmail?: string | null;\n orgId?: string | null;\n}\n\nexport interface ProviderReaderRuntimeItem {\n id: string;\n type: string;\n title?: string;\n url?: string;\n text?: string;\n metadata?: Record<string, unknown>;\n}\n\nexport interface ProviderReaderRuntimeResponse {\n providerId: WorkspaceConnectionProviderId;\n operation: ProviderReaderOperation;\n connectionId: string;\n items?: ProviderReaderRuntimeItem[];\n item?: ProviderReaderRuntimeItem | null;\n metadata?: Record<string, unknown>;\n}\n\nexport interface ProviderReaderRuntimeConnection {\n id: string;\n provider: string;\n label: string;\n accountId: string | null;\n accountLabel: string | null;\n credentialRefs: WorkspaceConnectionPublicCredentialRef[];\n}\n\nexport interface ProviderReaderCredentialRequirement {\n values: Record<string, string>;\n resolution: WorkspaceConnectionCredentialsResolution;\n}\n\nexport interface ProviderReaderRuntimeContext {\n appId: string;\n providerId: WorkspaceConnectionProviderId;\n reader: ProviderReaderDefinition;\n connection: ProviderReaderRuntimeConnection;\n resolveCredentials(\n keys?: readonly string[],\n ): Promise<WorkspaceConnectionCredentialsResolution>;\n requireCredentials(\n keys?: readonly string[],\n ): Promise<ProviderReaderCredentialRequirement>;\n}\n\nexport type ProviderReaderRuntimeHandler<\n TParams extends Record<string, unknown> = Record<string, unknown>,\n> = (\n params: TParams,\n context: ProviderReaderRuntimeContext,\n) => ProviderReaderRuntimeResponse | Promise<ProviderReaderRuntimeResponse>;\n\nexport interface ProviderReaderRuntimeImplementation<\n TProviderId extends WorkspaceConnectionProviderId =\n WorkspaceConnectionProviderId,\n> {\n providerId: TProviderId;\n operations: Partial<\n Record<ProviderReaderOperation, ProviderReaderRuntimeHandler>\n >;\n}\n\nexport interface ProviderReaderRuntimeConnectionResolverOptions extends Pick<\n ResolveWorkspaceConnectionForAppOptions,\n \"appId\" | \"connectionId\"\n> {\n providerId: WorkspaceConnectionProviderId;\n}\n\nexport interface ProviderReaderRuntimeCredentialsResolverOptions extends Pick<\n ResolveWorkspaceConnectionCredentialsForAppOptions,\n \"appId\" | \"connectionId\" | \"keys\" | \"userEmail\" | \"orgId\"\n> {\n providerId: WorkspaceConnectionProviderId;\n}\n\nexport interface ProviderReaderRuntimeOptions {\n appId: string;\n readers: readonly ProviderReaderRuntimeImplementation[];\n resolveConnection?: (\n options: ProviderReaderRuntimeConnectionResolverOptions,\n ) => Promise<ResolvedWorkspaceConnectionForApp>;\n resolveCredentials?: (\n options: ProviderReaderRuntimeCredentialsResolverOptions,\n ) => Promise<WorkspaceConnectionCredentialsResolution>;\n}\n\nexport interface ProviderReaderRuntime {\n read<TParams extends Record<string, unknown> = Record<string, unknown>>(\n request: ProviderReaderRequest<TParams>,\n ): Promise<ProviderReaderRuntimeResponse>;\n}\n\nexport class ProviderReaderRuntimeError extends Error {\n readonly code: ProviderReaderRuntimeErrorCode;\n readonly providerId: string;\n readonly operation?: ProviderReaderOperation;\n\n constructor(\n code: ProviderReaderRuntimeErrorCode,\n message: string,\n options: {\n providerId: string;\n operation?: ProviderReaderOperation;\n },\n ) {\n super(message);\n this.name = \"ProviderReaderRuntimeError\";\n this.code = code;\n this.providerId = options.providerId;\n this.operation = options.operation;\n }\n}\n\nexport function defineProviderReader<const T extends ProviderReaderDefinition>(\n reader: T,\n): T {\n return reader;\n}\n\nexport function defineProviderReaderImplementation<\n const T extends ProviderReaderRuntimeImplementation,\n>(implementation: T): T {\n return implementation;\n}\n\nconst searchParameters = [\n {\n name: \"query\",\n type: \"string\",\n required: true,\n description: \"Provider-native search text.\",\n },\n {\n name: \"limit\",\n type: \"number\",\n description: \"Maximum normalized results to return.\",\n },\n] as const satisfies readonly ProviderReaderOperationParameter[];\n\nconst getParameters = [\n {\n name: \"id\",\n type: \"string\",\n required: true,\n description: \"Provider-native object identifier.\",\n },\n] as const satisfies readonly ProviderReaderOperationParameter[];\n\nconst listRecentParameters = [\n {\n name: \"limit\",\n type: \"number\",\n description: \"Maximum recent objects to return.\",\n },\n] as const satisfies readonly ProviderReaderOperationParameter[];\n\nfunction operation(\n operationName: ProviderReaderOperation,\n label: string,\n description: string,\n implementationStatus: ProviderReaderImplementationStatus,\n parameters: readonly ProviderReaderOperationParameter[],\n): ProviderReaderOperationDescriptor {\n return {\n operation: operationName,\n label,\n description,\n implementationStatus,\n parameters,\n };\n}\n\nfunction providerCredentialKeys(\n providerId: WorkspaceConnectionProviderId,\n): readonly WorkspaceConnectionCredentialKey[] {\n return getWorkspaceConnectionProvider(providerId)?.credentialKeys ?? [];\n}\n\nfunction requiredCredentialKeys(\n providerId: WorkspaceConnectionProviderId,\n): readonly string[] {\n return providerCredentialKeys(providerId)\n .filter((credential) => credential.required !== false)\n .map((credential) => credential.key);\n}\n\nexport const PROVIDER_READERS = [\n defineProviderReader({\n providerId: \"slack\",\n label: \"Slack reader\",\n description:\n \"Normalized metadata for reading Slack messages and channel history through template-owned Slack implementations.\",\n implementationStatus: \"template-owned\",\n credentialKeys: providerCredentialKeys(\"slack\"),\n requiredCredentialKeys: requiredCredentialKeys(\"slack\"),\n capabilities: [\n {\n capability: \"search\",\n label: \"Message search\",\n description:\n \"Search conversation history using Slack's message search semantics.\",\n },\n {\n capability: \"messages\",\n label: \"Message retrieval\",\n description:\n \"Read individual messages or recent channel activity when a template owns the Slack client.\",\n },\n ],\n operations: [\n operation(\n \"search\",\n \"Search Slack messages\",\n \"Find Slack messages matching text and optional channel filters.\",\n \"template-owned\",\n [\n ...searchParameters,\n {\n name: \"channelId\",\n type: \"string\",\n description: \"Optional Slack channel id to narrow the search.\",\n },\n ],\n ),\n operation(\n \"get\",\n \"Get Slack message\",\n \"Load one Slack message by channel and timestamp/id.\",\n \"template-owned\",\n [\n ...getParameters,\n {\n name: \"channelId\",\n type: \"string\",\n required: true,\n description: \"Slack channel id containing the message.\",\n },\n ],\n ),\n operation(\n \"listRecent\",\n \"List recent Slack messages\",\n \"List recent messages from channels visible to the connected Slack app.\",\n \"template-owned\",\n listRecentParameters,\n ),\n ],\n notes:\n \"Core only exposes the contract; templates still own Slack API calls and provider-specific pagination.\",\n }),\n defineProviderReader({\n providerId: \"github\",\n label: \"GitHub reader\",\n description:\n \"Normalized metadata for reading repositories, issues, pull requests, and code search results.\",\n implementationStatus: \"template-owned\",\n credentialKeys: providerCredentialKeys(\"github\"),\n requiredCredentialKeys: requiredCredentialKeys(\"github\"),\n capabilities: [\n {\n capability: \"search\",\n label: \"Repository search\",\n description:\n \"Search GitHub issues, pull requests, repositories, code, or docs using template-owned clients.\",\n },\n {\n capability: \"code\",\n label: \"Code context\",\n description:\n \"Read code-oriented objects such as repositories, files, issues, and pull requests.\",\n },\n ],\n operations: [\n operation(\n \"search\",\n \"Search GitHub\",\n \"Find repositories, issues, pull requests, code, or documentation matching a query.\",\n \"template-owned\",\n [\n ...searchParameters,\n {\n name: \"owner\",\n type: \"string\",\n description: \"Optional repository owner or organization filter.\",\n },\n {\n name: \"repo\",\n type: \"string\",\n description: \"Optional repository filter.\",\n },\n ],\n ),\n operation(\n \"get\",\n \"Get GitHub object\",\n \"Load one repository, issue, pull request, or file by provider-native id or URL.\",\n \"template-owned\",\n getParameters,\n ),\n operation(\n \"listRecent\",\n \"List recent GitHub activity\",\n \"List recent issues, pull requests, or repository activity visible to the connection.\",\n \"template-owned\",\n listRecentParameters,\n ),\n ],\n notes:\n \"No shared Octokit client is exported from core in this spike; templates remain responsible for API calls.\",\n }),\n defineProviderReader({\n providerId: \"notion\",\n label: \"Notion reader\",\n description:\n \"Normalized metadata for reading Notion pages, databases, and workspace docs.\",\n implementationStatus: \"template-owned\",\n credentialKeys: providerCredentialKeys(\"notion\"),\n requiredCredentialKeys: requiredCredentialKeys(\"notion\"),\n capabilities: [\n {\n capability: \"search\",\n label: \"Page search\",\n description:\n \"Search pages and databases shared with the Notion integration.\",\n },\n {\n capability: \"docs\",\n label: \"Document retrieval\",\n description:\n \"Read Notion page or database metadata through template-owned clients.\",\n },\n ],\n operations: [\n operation(\n \"search\",\n \"Search Notion\",\n \"Find Notion pages or databases matching text and optional object type filters.\",\n \"template-owned\",\n searchParameters,\n ),\n operation(\n \"get\",\n \"Get Notion object\",\n \"Load one Notion page or database by id.\",\n \"template-owned\",\n getParameters,\n ),\n operation(\n \"listRecent\",\n \"List recent Notion objects\",\n \"List recently edited pages or databases visible to the integration.\",\n \"template-owned\",\n listRecentParameters,\n ),\n ],\n notes:\n \"Core does not traverse Notion blocks yet; templates own page hydration and rate-limit behavior.\",\n }),\n defineProviderReader({\n providerId: \"hubspot\",\n label: \"HubSpot reader\",\n description:\n \"Normalized metadata for CRM object lookup through template-owned HubSpot integrations.\",\n implementationStatus: \"template-owned\",\n credentialKeys: providerCredentialKeys(\"hubspot\"),\n requiredCredentialKeys: requiredCredentialKeys(\"hubspot\"),\n capabilities: [\n {\n capability: \"search\",\n label: \"CRM search\",\n description:\n \"Search CRM contacts, companies, deals, tickets, and engagements.\",\n },\n {\n capability: \"crm\",\n label: \"CRM retrieval\",\n description:\n \"Read CRM objects when a template owns HubSpot object mapping.\",\n },\n ],\n operations: [\n operation(\n \"search\",\n \"Search HubSpot CRM\",\n \"Find CRM records matching text or provider-native filters.\",\n \"template-owned\",\n [\n ...searchParameters,\n {\n name: \"objectType\",\n type: \"string\",\n description:\n \"Optional HubSpot object type such as contact, company, deal, or ticket.\",\n },\n ],\n ),\n operation(\n \"get\",\n \"Get HubSpot CRM object\",\n \"Load one CRM record by object type and id.\",\n \"template-owned\",\n [\n ...getParameters,\n {\n name: \"objectType\",\n type: \"string\",\n required: true,\n description:\n \"HubSpot object type such as contact, company, deal, or ticket.\",\n },\n ],\n ),\n operation(\n \"listRecent\",\n \"List recent HubSpot CRM objects\",\n \"List recently updated CRM records visible to the private app token.\",\n \"template-owned\",\n listRecentParameters,\n ),\n ],\n notes:\n \"Templates define object allow-lists and property projections; core only documents the reader shape.\",\n }),\n defineProviderReader({\n providerId: \"gmail\",\n label: \"Gmail reader\",\n description:\n \"Normalized metadata for mailbox search and thread/message reads through app-owned Google OAuth flows.\",\n implementationStatus: \"template-owned\",\n credentialKeys: providerCredentialKeys(\"gmail\"),\n requiredCredentialKeys: requiredCredentialKeys(\"gmail\"),\n capabilities: [\n {\n capability: \"search\",\n label: \"Mailbox search\",\n description: \"Search Gmail messages and threads.\",\n },\n {\n capability: \"messages\",\n label: \"Mail retrieval\",\n description:\n \"Read Gmail messages and threads when a template owns OAuth token handling.\",\n },\n ],\n operations: [\n operation(\n \"search\",\n \"Search Gmail\",\n \"Find Gmail messages or threads matching a query.\",\n \"template-owned\",\n searchParameters,\n ),\n operation(\n \"get\",\n \"Get Gmail message or thread\",\n \"Load one Gmail message or thread by provider-native id.\",\n \"template-owned\",\n getParameters,\n ),\n operation(\n \"listRecent\",\n \"List recent Gmail messages\",\n \"List recent mailbox messages visible to the connected Google account.\",\n \"template-owned\",\n listRecentParameters,\n ),\n ],\n notes:\n \"This is metadata for templates with Google OAuth; core does not expose a shared Gmail network client here.\",\n }),\n defineProviderReader({\n providerId: \"google_drive\",\n label: \"Google Drive reader\",\n description:\n \"Normalized metadata for Drive file search and document lookup through app-owned Google OAuth flows.\",\n implementationStatus: \"template-owned\",\n credentialKeys: providerCredentialKeys(\"google_drive\"),\n requiredCredentialKeys: requiredCredentialKeys(\"google_drive\"),\n capabilities: [\n {\n capability: \"search\",\n label: \"Drive search\",\n description: \"Search files visible to the connected Google account.\",\n },\n {\n capability: \"docs\",\n label: \"Drive document retrieval\",\n description:\n \"Read file metadata or exported document content through template-owned Google clients.\",\n },\n ],\n operations: [\n operation(\n \"search\",\n \"Search Google Drive\",\n \"Find Drive files matching text, MIME type, or folder filters.\",\n \"template-owned\",\n [\n ...searchParameters,\n {\n name: \"mimeType\",\n type: \"string\",\n description: \"Optional MIME type filter.\",\n },\n ],\n ),\n operation(\n \"get\",\n \"Get Google Drive file\",\n \"Load one Drive file by id.\",\n \"template-owned\",\n getParameters,\n ),\n operation(\n \"listRecent\",\n \"List recent Google Drive files\",\n \"List recently modified files visible to the connected Google account.\",\n \"template-owned\",\n listRecentParameters,\n ),\n ],\n notes:\n \"Templates still own file export formats, Docs/Sheets/Slides handling, and OAuth token refresh.\",\n }),\n defineProviderReader({\n providerId: \"generic\",\n label: \"Generic metadata reader\",\n description:\n \"Placeholder reader metadata for custom sources that expose searchable documents through a template-specific adapter.\",\n implementationStatus: \"metadata-only\",\n credentialKeys: providerCredentialKeys(\"generic\"),\n requiredCredentialKeys: requiredCredentialKeys(\"generic\"),\n capabilities: [\n {\n capability: \"search\",\n label: \"Custom search\",\n description:\n \"Describe a template-specific search interface for one-off sources.\",\n },\n {\n capability: \"docs\",\n label: \"Custom document retrieval\",\n description:\n \"Describe a template-specific document retrieval interface.\",\n },\n ],\n operations: [\n operation(\n \"search\",\n \"Search custom source\",\n \"Metadata-only descriptor for searching a custom source.\",\n \"metadata-only\",\n searchParameters,\n ),\n operation(\n \"get\",\n \"Get custom source object\",\n \"Metadata-only descriptor for loading one custom source object by id.\",\n \"metadata-only\",\n getParameters,\n ),\n ],\n notes:\n \"Use this only to document a template-owned adapter; core cannot execute generic provider reads.\",\n }),\n] as const satisfies readonly ProviderReaderDefinition[];\n\nconst READERS_BY_PROVIDER_ID = new Map<\n WorkspaceConnectionProviderId,\n ProviderReaderDefinition\n>(PROVIDER_READERS.map((reader) => [reader.providerId, reader]));\n\nexport function listProviderReaders(\n options: ListProviderReadersOptions = {},\n): ProviderReaderDefinition[] {\n return PROVIDER_READERS.filter((reader) => {\n if (options.providerId && reader.providerId !== options.providerId) {\n return false;\n }\n if (\n options.capability &&\n !reader.capabilities.some(\n (capability) => capability.capability === options.capability,\n )\n ) {\n return false;\n }\n if (\n options.operation &&\n !reader.operations.some(\n (operation) => operation.operation === options.operation,\n )\n ) {\n return false;\n }\n if (\n options.implementationStatus &&\n reader.implementationStatus !== options.implementationStatus\n ) {\n return false;\n }\n return true;\n }).map(cloneProviderReader);\n}\n\nexport function getProviderReader(\n providerId: string,\n): ProviderReaderDefinition | undefined {\n const reader = READERS_BY_PROVIDER_ID.get(\n providerId as WorkspaceConnectionProviderId,\n );\n return reader ? cloneProviderReader(reader) : undefined;\n}\n\nexport function providerReaderSupports(\n providerOrReader: ProviderReaderDefinition | WorkspaceConnectionProviderId,\n operationName: ProviderReaderOperation,\n): boolean {\n const reader =\n typeof providerOrReader === \"string\"\n ? getProviderReader(providerOrReader)\n : providerOrReader;\n return (\n reader?.operations.some(\n (operation) => operation.operation === operationName,\n ) ?? false\n );\n}\n\nexport function createProviderReaderRuntime(\n options: ProviderReaderRuntimeOptions,\n): ProviderReaderRuntime {\n const appId = options.appId.trim();\n if (!appId) {\n throw new Error(\"createProviderReaderRuntime appId is required.\");\n }\n\n const implementations = new Map<\n WorkspaceConnectionProviderId,\n ProviderReaderRuntimeImplementation\n >();\n for (const implementation of options.readers) {\n implementations.set(implementation.providerId, implementation);\n }\n\n const connectionResolver =\n options.resolveConnection ??\n ((resolverOptions: ProviderReaderRuntimeConnectionResolverOptions) =>\n resolveWorkspaceConnectionForApp({\n appId: resolverOptions.appId,\n provider: resolverOptions.providerId,\n connectionId: resolverOptions.connectionId,\n includeDisabled: false,\n requireConnected: true,\n }));\n const credentialsResolver =\n options.resolveCredentials ??\n ((resolverOptions: ProviderReaderRuntimeCredentialsResolverOptions) =>\n resolveWorkspaceConnectionCredentialsForApp({\n appId: resolverOptions.appId,\n provider: resolverOptions.providerId,\n connectionId: resolverOptions.connectionId,\n keys: resolverOptions.keys,\n userEmail: resolverOptions.userEmail,\n orgId: resolverOptions.orgId,\n }));\n\n return {\n async read<\n TParams extends Record<string, unknown> = Record<string, unknown>,\n >(\n request: ProviderReaderRequest<TParams>,\n ): Promise<ProviderReaderRuntimeResponse> {\n const reader = getProviderReader(request.providerId);\n if (!reader) {\n throw new ProviderReaderRuntimeError(\n \"unsupported_provider\",\n `No provider reader metadata is registered for ${request.providerId}.`,\n { providerId: request.providerId, operation: request.operation },\n );\n }\n\n const operation = reader.operations.find(\n (entry) => entry.operation === request.operation,\n );\n if (!operation) {\n throw new ProviderReaderRuntimeError(\n \"unsupported_operation\",\n `${reader.label} does not support ${request.operation}.`,\n { providerId: request.providerId, operation: request.operation },\n );\n }\n\n const implementation = implementations.get(request.providerId);\n if (!implementation) {\n throw new ProviderReaderRuntimeError(\n \"unsupported_provider\",\n `${reader.label} has no runtime implementation registered.`,\n { providerId: request.providerId, operation: request.operation },\n );\n }\n\n const handler = implementation.operations[request.operation];\n if (!handler) {\n throw new ProviderReaderRuntimeError(\n \"unsupported_operation\",\n `${reader.label} has no runtime handler for ${request.operation}.`,\n { providerId: request.providerId, operation: request.operation },\n );\n }\n\n const resolvedConnection = await connectionResolver({\n appId,\n providerId: request.providerId,\n connectionId: request.connectionId?.trim() || undefined,\n });\n if (!resolvedConnection.available || !resolvedConnection.connection) {\n throw new ProviderReaderRuntimeError(\n \"connection_not_available\",\n resolvedConnection.reason,\n { providerId: request.providerId, operation: request.operation },\n );\n }\n\n const connection = publicRuntimeConnection(resolvedConnection.connection);\n const context: ProviderReaderRuntimeContext = {\n appId,\n providerId: request.providerId,\n reader,\n connection,\n resolveCredentials: (keys = reader.requiredCredentialKeys) =>\n credentialsResolver({\n appId,\n providerId: request.providerId,\n connectionId: connection.id,\n keys: [...keys],\n userEmail: request.userEmail,\n orgId: request.orgId,\n }),\n requireCredentials: async (keys = reader.requiredCredentialKeys) => {\n const resolution = await credentialsResolver({\n appId,\n providerId: request.providerId,\n connectionId: connection.id,\n keys: [...keys],\n userEmail: request.userEmail,\n orgId: request.orgId,\n });\n if (!resolution.available) {\n throw new ProviderReaderRuntimeError(\n \"credentials_unavailable\",\n `Missing workspace connection credentials for ${reader.label}: ${resolution.missingKeys.join(\", \")}.`,\n {\n providerId: request.providerId,\n operation: request.operation,\n },\n );\n }\n return { values: resolution.values, resolution };\n },\n };\n\n return handler((request.params ?? {}) as TParams, context);\n },\n };\n}\n\nfunction cloneProviderReader(\n reader: ProviderReaderDefinition,\n): ProviderReaderDefinition {\n return {\n ...reader,\n credentialKeys: reader.credentialKeys.map((credential) => ({\n ...credential,\n })),\n requiredCredentialKeys: [...reader.requiredCredentialKeys],\n capabilities: reader.capabilities.map((capability) => ({\n ...capability,\n })),\n operations: reader.operations.map((operation) => ({\n ...operation,\n parameters: operation.parameters.map((parameter) => ({\n ...parameter,\n })),\n })),\n };\n}\n\nfunction publicRuntimeConnection(\n connection: WorkspaceConnectionForApp,\n): ProviderReaderRuntimeConnection {\n return {\n id: connection.id,\n provider: connection.provider,\n label: connection.label,\n accountId: connection.accountId,\n accountLabel: connection.accountLabel,\n credentialRefs: publicCredentialRefs(connection),\n };\n}\n\nfunction publicCredentialRefs(\n connection: WorkspaceConnectionForApp,\n): WorkspaceConnectionPublicCredentialRef[] {\n return [\n ...(connection.explicitGrant?.credentialRefs ?? []).map((ref) =>\n publicCredentialRef(ref, \"grant\"),\n ),\n ...connection.credentialRefs.map((ref) =>\n publicCredentialRef(ref, \"connection\"),\n ),\n ];\n}\n\nfunction publicCredentialRef(\n ref: WorkspaceConnectionCredentialRef,\n source: WorkspaceConnectionPublicCredentialRef[\"source\"],\n): WorkspaceConnectionPublicCredentialRef {\n return {\n key: ref.key,\n scope: ref.scope,\n provider: ref.provider,\n label: ref.label,\n source,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"reader.js","sourceRoot":"","sources":["../../src/connections/reader.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2CAA2C,GAM5C,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,gCAAgC,GAGjC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,8BAA8B,GAI/B,MAAM,cAAc,CAAC;AA+JtB,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IAC1C,IAAI,CAAiC;IACrC,UAAU,CAAS;IACnB,SAAS,CAA2B;IAE7C,YACE,IAAoC,EACpC,OAAe,EACf,OAGC;QAED,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IACrC,CAAC;CACF;AAED,MAAM,UAAU,oBAAoB,CAClC,MAAS;IAET,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,kCAAkC,CAEhD,cAAiB;IACjB,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,MAAM,gBAAgB,GAAG;IACvB;QACE,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,8BAA8B;KAC5C;IACD;QACE,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,uCAAuC;K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wD;IAExD,OAAO;QACL,GAAG,EAAE,GAAG,CAAC,GAAG;QACZ,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,MAAM;KACP,CAAC;AACJ,CAAC","sourcesContent":["import {\n resolveWorkspaceConnectionCredentialsForApp,\n type ResolveWorkspaceConnectionCredentialsForAppOptions,\n type WorkspaceConnectionCredentialRef,\n type WorkspaceConnectionCredentialsResolution,\n type WorkspaceConnectionForApp,\n type WorkspaceConnectionPublicCredentialRef,\n} from \"../workspace-connections/index.js\";\nimport {\n resolveWorkspaceConnectionForApp,\n type ResolvedWorkspaceConnectionForApp,\n type ResolveWorkspaceConnectionForAppOptions,\n} from \"../workspace-connections/store.js\";\nimport {\n getWorkspaceConnectionProvider,\n type WorkspaceConnectionCapability,\n type WorkspaceConnectionCredentialKey,\n type WorkspaceConnectionProviderId,\n} from \"./catalog.js\";\n\nexport type ProviderReaderOperation = \"search\" | \"get\" | \"listRecent\";\n\nexport type ProviderReaderImplementationStatus =\n | \"metadata-only\"\n | \"template-owned\"\n | \"shared\";\n\nexport interface ProviderReaderCapability {\n capability: WorkspaceConnectionCapability;\n label: string;\n description: string;\n}\n\nexport interface ProviderReaderOperationParameter {\n name: string;\n type: \"string\" | \"number\" | \"boolean\" | \"string[]\";\n required?: boolean;\n description: string;\n}\n\nexport interface ProviderReaderOperationDescriptor {\n operation: ProviderReaderOperation;\n label: string;\n description: string;\n implementationStatus: ProviderReaderImplementationStatus;\n parameters: readonly ProviderReaderOperationParameter[];\n}\n\nexport interface ProviderReaderDefinition {\n providerId: WorkspaceConnectionProviderId;\n label: string;\n description: string;\n implementationStatus: ProviderReaderImplementationStatus;\n credentialKeys: readonly WorkspaceConnectionCredentialKey[];\n requiredCredentialKeys: readonly string[];\n capabilities: readonly ProviderReaderCapability[];\n operations: readonly ProviderReaderOperationDescriptor[];\n notes?: string;\n}\n\nexport interface ListProviderReadersOptions {\n providerId?: WorkspaceConnectionProviderId;\n capability?: WorkspaceConnectionCapability;\n operation?: ProviderReaderOperation;\n implementationStatus?: ProviderReaderImplementationStatus;\n}\n\nexport type ProviderReaderRuntimeErrorCode =\n | \"unsupported_provider\"\n | \"unsupported_operation\"\n | \"connection_not_available\"\n | \"credentials_unavailable\";\n\nexport interface ProviderReaderRequest<\n TParams extends Record<string, unknown> = Record<string, unknown>,\n> {\n providerId: WorkspaceConnectionProviderId;\n operation: ProviderReaderOperation;\n params?: TParams;\n connectionId?: string | null;\n userEmail?: string | null;\n orgId?: string | null;\n}\n\nexport interface ProviderReaderRuntimeItem {\n id: string;\n type: string;\n title?: string;\n url?: string;\n text?: string;\n metadata?: Record<string, unknown>;\n}\n\nexport interface ProviderReaderRuntimeResponse {\n providerId: WorkspaceConnectionProviderId;\n operation: ProviderReaderOperation;\n connectionId: string;\n items?: ProviderReaderRuntimeItem[];\n item?: ProviderReaderRuntimeItem | null;\n metadata?: Record<string, unknown>;\n}\n\nexport interface ProviderReaderRuntimeConnection {\n id: string;\n provider: string;\n label: string;\n accountId: string | null;\n accountLabel: string | null;\n credentialRefs: WorkspaceConnectionPublicCredentialRef[];\n}\n\nexport interface ProviderReaderCredentialRequirement {\n values: Record<string, string>;\n resolution: WorkspaceConnectionCredentialsResolution;\n}\n\nexport interface ProviderReaderRuntimeContext {\n appId: string;\n providerId: WorkspaceConnectionProviderId;\n reader: ProviderReaderDefinition;\n connection: ProviderReaderRuntimeConnection;\n resolveCredentials(\n keys?: readonly string[],\n ): Promise<WorkspaceConnectionCredentialsResolution>;\n requireCredentials(\n keys?: readonly string[],\n ): Promise<ProviderReaderCredentialRequirement>;\n}\n\nexport type ProviderReaderRuntimeHandler<\n TParams extends Record<string, unknown> = Record<string, unknown>,\n> = (\n params: TParams,\n context: ProviderReaderRuntimeContext,\n) => ProviderReaderRuntimeResponse | Promise<ProviderReaderRuntimeResponse>;\n\nexport interface ProviderReaderRuntimeImplementation<\n TProviderId extends WorkspaceConnectionProviderId =\n WorkspaceConnectionProviderId,\n> {\n providerId: TProviderId;\n operations: Partial<\n Record<ProviderReaderOperation, ProviderReaderRuntimeHandler>\n >;\n}\n\nexport interface ProviderReaderRuntimeConnectionResolverOptions extends Pick<\n ResolveWorkspaceConnectionForAppOptions,\n \"appId\" | \"connectionId\"\n> {\n providerId: WorkspaceConnectionProviderId;\n}\n\nexport interface ProviderReaderRuntimeCredentialsResolverOptions extends Pick<\n ResolveWorkspaceConnectionCredentialsForAppOptions,\n \"appId\" | \"connectionId\" | \"keys\" | \"userEmail\" | \"orgId\"\n> {\n providerId: WorkspaceConnectionProviderId;\n}\n\nexport interface ProviderReaderRuntimeOptions {\n appId: string;\n readers: readonly ProviderReaderRuntimeImplementation[];\n resolveConnection?: (\n options: ProviderReaderRuntimeConnectionResolverOptions,\n ) => Promise<ResolvedWorkspaceConnectionForApp>;\n resolveCredentials?: (\n options: ProviderReaderRuntimeCredentialsResolverOptions,\n ) => Promise<WorkspaceConnectionCredentialsResolution>;\n}\n\nexport interface ProviderReaderRuntime {\n read<TParams extends Record<string, unknown> = Record<string, unknown>>(\n request: ProviderReaderRequest<TParams>,\n ): Promise<ProviderReaderRuntimeResponse>;\n}\n\nexport class ProviderReaderRuntimeError extends Error {\n readonly code: ProviderReaderRuntimeErrorCode;\n readonly providerId: string;\n readonly operation?: ProviderReaderOperation;\n\n constructor(\n code: ProviderReaderRuntimeErrorCode,\n message: string,\n options: {\n providerId: string;\n operation?: ProviderReaderOperation;\n },\n ) {\n super(message);\n this.name = \"ProviderReaderRuntimeError\";\n this.code = code;\n this.providerId = options.providerId;\n this.operation = options.operation;\n }\n}\n\nexport function defineProviderReader<const T extends ProviderReaderDefinition>(\n reader: T,\n): T {\n return reader;\n}\n\nexport function defineProviderReaderImplementation<\n const T extends ProviderReaderRuntimeImplementation,\n>(implementation: T): T {\n return implementation;\n}\n\nconst searchParameters = [\n {\n name: \"query\",\n type: \"string\",\n required: true,\n description: \"Provider-native search text.\",\n },\n {\n name: \"limit\",\n type: \"number\",\n description: \"Maximum normalized results to return.\",\n },\n] as const satisfies readonly ProviderReaderOperationParameter[];\n\nconst getParameters = [\n {\n name: \"id\",\n type: \"string\",\n required: true,\n description: \"Provider-native object identifier.\",\n },\n] as const satisfies readonly ProviderReaderOperationParameter[];\n\nconst listRecentParameters = [\n {\n name: \"limit\",\n type: \"number\",\n description: \"Maximum recent objects to return.\",\n },\n] as const satisfies readonly ProviderReaderOperationParameter[];\n\nfunction operation(\n operationName: ProviderReaderOperation,\n label: string,\n description: string,\n implementationStatus: ProviderReaderImplementationStatus,\n parameters: readonly ProviderReaderOperationParameter[],\n): ProviderReaderOperationDescriptor {\n return {\n operation: operationName,\n label,\n description,\n implementationStatus,\n parameters,\n };\n}\n\nfunction providerCredentialKeys(\n providerId: WorkspaceConnectionProviderId,\n): readonly WorkspaceConnectionCredentialKey[] {\n return getWorkspaceConnectionProvider(providerId)?.credentialKeys ?? [];\n}\n\nfunction requiredCredentialKeys(\n providerId: WorkspaceConnectionProviderId,\n): readonly string[] {\n return providerCredentialKeys(providerId)\n .filter((credential) => credential.required !== false)\n .map((credential) => credential.key);\n}\n\nexport const PROVIDER_READERS = [\n defineProviderReader({\n providerId: \"slack\",\n label: \"Slack reader\",\n description:\n \"Normalized metadata for reading Slack messages and channel history through template-owned Slack implementations.\",\n implementationStatus: \"template-owned\",\n credentialKeys: providerCredentialKeys(\"slack\"),\n requiredCredentialKeys: requiredCredentialKeys(\"slack\"),\n capabilities: [\n {\n capability: \"search\",\n label: \"Message search\",\n description:\n \"Search conversation history using Slack's message search semantics.\",\n },\n {\n capability: \"messages\",\n label: \"Message retrieval\",\n description:\n \"Read individual messages or recent channel activity when a template owns the Slack client.\",\n },\n ],\n operations: [\n operation(\n \"search\",\n \"Search Slack messages\",\n \"Find Slack messages matching text and optional channel filters.\",\n \"template-owned\",\n [\n ...searchParameters,\n {\n name: \"channelId\",\n type: \"string\",\n description: \"Optional Slack channel id to narrow the search.\",\n },\n ],\n ),\n operation(\n \"get\",\n \"Get Slack message\",\n \"Load one Slack message by channel and timestamp/id.\",\n \"template-owned\",\n [\n ...getParameters,\n {\n name: \"channelId\",\n type: \"string\",\n required: true,\n description: \"Slack channel id containing the message.\",\n },\n ],\n ),\n operation(\n \"listRecent\",\n \"List recent Slack messages\",\n \"List recent messages from channels visible to the connected Slack app.\",\n \"template-owned\",\n listRecentParameters,\n ),\n ],\n notes:\n \"Core only exposes the contract; templates still own Slack API calls and provider-specific pagination.\",\n }),\n defineProviderReader({\n providerId: \"github\",\n label: \"GitHub reader\",\n description:\n \"Normalized metadata for reading repositories, issues, pull requests, and code search results.\",\n implementationStatus: \"template-owned\",\n credentialKeys: providerCredentialKeys(\"github\"),\n requiredCredentialKeys: requiredCredentialKeys(\"github\"),\n capabilities: [\n {\n capability: \"search\",\n label: \"Repository search\",\n description:\n \"Search GitHub issues, pull requests, repositories, code, or docs using template-owned clients.\",\n },\n {\n capability: \"code\",\n label: \"Code context\",\n description:\n \"Read code-oriented objects such as repositories, files, issues, and pull requests.\",\n },\n ],\n operations: [\n operation(\n \"search\",\n \"Search GitHub\",\n \"Find repositories, issues, pull requests, code, or documentation matching a query.\",\n \"template-owned\",\n [\n ...searchParameters,\n {\n name: \"owner\",\n type: \"string\",\n description: \"Optional repository owner or organization filter.\",\n },\n {\n name: \"repo\",\n type: \"string\",\n description: \"Optional repository filter.\",\n },\n ],\n ),\n operation(\n \"get\",\n \"Get GitHub object\",\n \"Load one repository, issue, pull request, or file by provider-native id or URL.\",\n \"template-owned\",\n getParameters,\n ),\n operation(\n \"listRecent\",\n \"List recent GitHub activity\",\n \"List recent issues, pull requests, or repository activity visible to the connection.\",\n \"template-owned\",\n listRecentParameters,\n ),\n ],\n notes:\n \"No shared Octokit client is exported from core in this spike; templates remain responsible for API calls.\",\n }),\n defineProviderReader({\n providerId: \"notion\",\n label: \"Notion reader\",\n description:\n \"Normalized metadata for reading Notion pages, databases, and workspace docs.\",\n implementationStatus: \"template-owned\",\n credentialKeys: providerCredentialKeys(\"notion\"),\n requiredCredentialKeys: requiredCredentialKeys(\"notion\"),\n capabilities: [\n {\n capability: \"search\",\n label: \"Page search\",\n description:\n \"Search pages and databases shared with the Notion integration.\",\n },\n {\n capability: \"docs\",\n label: \"Document retrieval\",\n description:\n \"Read Notion page or database metadata through template-owned clients.\",\n },\n ],\n operations: [\n operation(\n \"search\",\n \"Search Notion\",\n \"Find Notion pages or databases matching text and optional object type filters.\",\n \"template-owned\",\n searchParameters,\n ),\n operation(\n \"get\",\n \"Get Notion object\",\n \"Load one Notion page or database by id.\",\n \"template-owned\",\n getParameters,\n ),\n operation(\n \"listRecent\",\n \"List recent Notion objects\",\n \"List recently edited pages or databases visible to the integration.\",\n \"template-owned\",\n listRecentParameters,\n ),\n ],\n notes:\n \"Core does not traverse Notion blocks yet; templates own page hydration and rate-limit behavior.\",\n }),\n defineProviderReader({\n providerId: \"hubspot\",\n label: \"HubSpot reader\",\n description:\n \"Normalized metadata for CRM object lookup through template-owned HubSpot integrations.\",\n implementationStatus: \"template-owned\",\n credentialKeys: providerCredentialKeys(\"hubspot\"),\n requiredCredentialKeys: requiredCredentialKeys(\"hubspot\"),\n capabilities: [\n {\n capability: \"search\",\n label: \"CRM search\",\n description:\n \"Search CRM contacts, companies, deals, tickets, and engagements.\",\n },\n {\n capability: \"crm\",\n label: \"CRM retrieval\",\n description:\n \"Read CRM objects when a template owns HubSpot object mapping.\",\n },\n ],\n operations: [\n operation(\n \"search\",\n \"Search HubSpot CRM\",\n \"Find CRM records matching text or provider-native filters.\",\n \"template-owned\",\n [\n ...searchParameters,\n {\n name: \"objectType\",\n type: \"string\",\n description:\n \"Optional HubSpot object type such as contact, company, deal, or ticket.\",\n },\n ],\n ),\n operation(\n \"get\",\n \"Get HubSpot CRM object\",\n \"Load one CRM record by object type and id.\",\n \"template-owned\",\n [\n ...getParameters,\n {\n name: \"objectType\",\n type: \"string\",\n required: true,\n description:\n \"HubSpot object type such as contact, company, deal, or ticket.\",\n },\n ],\n ),\n operation(\n \"listRecent\",\n \"List recent HubSpot CRM objects\",\n \"List recently updated CRM records visible to the private app token.\",\n \"template-owned\",\n listRecentParameters,\n ),\n ],\n notes:\n \"Templates define object allow-lists and property projections; core only documents the reader shape.\",\n }),\n defineProviderReader({\n providerId: \"salesforce\",\n label: \"Salesforce reader\",\n description:\n \"Normalized metadata for CRM object lookup through template-owned Salesforce integrations.\",\n implementationStatus: \"template-owned\",\n credentialKeys: providerCredentialKeys(\"salesforce\"),\n requiredCredentialKeys: requiredCredentialKeys(\"salesforce\"),\n capabilities: [\n {\n capability: \"search\",\n label: \"CRM search\",\n description:\n \"Search Salesforce CRM records with provider-native SOQL or object filters.\",\n },\n {\n capability: \"crm\",\n label: \"CRM retrieval\",\n description:\n \"Read Salesforce standard and custom CRM objects when a template owns object mapping.\",\n },\n ],\n operations: [\n operation(\n \"search\",\n \"Search Salesforce CRM\",\n \"Find CRM records matching text, SOQL, or provider-native filters.\",\n \"template-owned\",\n [\n ...searchParameters,\n {\n name: \"objectType\",\n type: \"string\",\n description:\n \"Optional Salesforce object API name such as Account, Contact, Opportunity, or a custom object.\",\n },\n ],\n ),\n operation(\n \"get\",\n \"Get Salesforce CRM object\",\n \"Load one Salesforce CRM record by object API name and id.\",\n \"template-owned\",\n [\n ...getParameters,\n {\n name: \"objectType\",\n type: \"string\",\n required: true,\n description:\n \"Salesforce object API name such as Account, Contact, Opportunity, or a custom object.\",\n },\n ],\n ),\n operation(\n \"listRecent\",\n \"List recent Salesforce CRM objects\",\n \"List recently updated CRM records visible to the connected Salesforce user.\",\n \"template-owned\",\n listRecentParameters,\n ),\n ],\n notes:\n \"Templates define object allow-lists, field projections, and API-version selection; core only documents the reader shape.\",\n }),\n defineProviderReader({\n providerId: \"gmail\",\n label: \"Gmail reader\",\n description:\n \"Normalized metadata for mailbox search and thread/message reads through app-owned Google OAuth flows.\",\n implementationStatus: \"template-owned\",\n credentialKeys: providerCredentialKeys(\"gmail\"),\n requiredCredentialKeys: requiredCredentialKeys(\"gmail\"),\n capabilities: [\n {\n capability: \"search\",\n label: \"Mailbox search\",\n description: \"Search Gmail messages and threads.\",\n },\n {\n capability: \"messages\",\n label: \"Mail retrieval\",\n description:\n \"Read Gmail messages and threads when a template owns OAuth token handling.\",\n },\n ],\n operations: [\n operation(\n \"search\",\n \"Search Gmail\",\n \"Find Gmail messages or threads matching a query.\",\n \"template-owned\",\n searchParameters,\n ),\n operation(\n \"get\",\n \"Get Gmail message or thread\",\n \"Load one Gmail message or thread by provider-native id.\",\n \"template-owned\",\n getParameters,\n ),\n operation(\n \"listRecent\",\n \"List recent Gmail messages\",\n \"List recent mailbox messages visible to the connected Google account.\",\n \"template-owned\",\n listRecentParameters,\n ),\n ],\n notes:\n \"This is metadata for templates with Google OAuth; core does not expose a shared Gmail network client here.\",\n }),\n defineProviderReader({\n providerId: \"google_drive\",\n label: \"Google Drive reader\",\n description:\n \"Normalized metadata for Drive file search and document lookup through app-owned Google OAuth flows.\",\n implementationStatus: \"template-owned\",\n credentialKeys: providerCredentialKeys(\"google_drive\"),\n requiredCredentialKeys: requiredCredentialKeys(\"google_drive\"),\n capabilities: [\n {\n capability: \"search\",\n label: \"Drive search\",\n description: \"Search files visible to the connected Google account.\",\n },\n {\n capability: \"docs\",\n label: \"Drive document retrieval\",\n description:\n \"Read file metadata or exported document content through template-owned Google clients.\",\n },\n ],\n operations: [\n operation(\n \"search\",\n \"Search Google Drive\",\n \"Find Drive files matching text, MIME type, or folder filters.\",\n \"template-owned\",\n [\n ...searchParameters,\n {\n name: \"mimeType\",\n type: \"string\",\n description: \"Optional MIME type filter.\",\n },\n ],\n ),\n operation(\n \"get\",\n \"Get Google Drive file\",\n \"Load one Drive file by id.\",\n \"template-owned\",\n getParameters,\n ),\n operation(\n \"listRecent\",\n \"List recent Google Drive files\",\n \"List recently modified files visible to the connected Google account.\",\n \"template-owned\",\n listRecentParameters,\n ),\n ],\n notes:\n \"Templates still own file export formats, Docs/Sheets/Slides handling, and OAuth token refresh.\",\n }),\n defineProviderReader({\n providerId: \"generic\",\n label: \"Generic metadata reader\",\n description:\n \"Placeholder reader metadata for custom sources that expose searchable documents through a template-specific adapter.\",\n implementationStatus: \"metadata-only\",\n credentialKeys: providerCredentialKeys(\"generic\"),\n requiredCredentialKeys: requiredCredentialKeys(\"generic\"),\n capabilities: [\n {\n capability: \"search\",\n label: \"Custom search\",\n description:\n \"Describe a template-specific search interface for one-off sources.\",\n },\n {\n capability: \"docs\",\n label: \"Custom document retrieval\",\n description:\n \"Describe a template-specific document retrieval interface.\",\n },\n ],\n operations: [\n operation(\n \"search\",\n \"Search custom source\",\n \"Metadata-only descriptor for searching a custom source.\",\n \"metadata-only\",\n searchParameters,\n ),\n operation(\n \"get\",\n \"Get custom source object\",\n \"Metadata-only descriptor for loading one custom source object by id.\",\n \"metadata-only\",\n getParameters,\n ),\n ],\n notes:\n \"Use this only to document a template-owned adapter; core cannot execute generic provider reads.\",\n }),\n] as const satisfies readonly ProviderReaderDefinition[];\n\nconst READERS_BY_PROVIDER_ID = new Map<\n WorkspaceConnectionProviderId,\n ProviderReaderDefinition\n>(PROVIDER_READERS.map((reader) => [reader.providerId, reader]));\n\nexport function listProviderReaders(\n options: ListProviderReadersOptions = {},\n): ProviderReaderDefinition[] {\n return PROVIDER_READERS.filter((reader) => {\n if (options.providerId && reader.providerId !== options.providerId) {\n return false;\n }\n if (\n options.capability &&\n !reader.capabilities.some(\n (capability) => capability.capability === options.capability,\n )\n ) {\n return false;\n }\n if (\n options.operation &&\n !reader.operations.some(\n (operation) => operation.operation === options.operation,\n )\n ) {\n return false;\n }\n if (\n options.implementationStatus &&\n reader.implementationStatus !== options.implementationStatus\n ) {\n return false;\n }\n return true;\n }).map(cloneProviderReader);\n}\n\nexport function getProviderReader(\n providerId: string,\n): ProviderReaderDefinition | undefined {\n const reader = READERS_BY_PROVIDER_ID.get(\n providerId as WorkspaceConnectionProviderId,\n );\n return reader ? cloneProviderReader(reader) : undefined;\n}\n\nexport function providerReaderSupports(\n providerOrReader: ProviderReaderDefinition | WorkspaceConnectionProviderId,\n operationName: ProviderReaderOperation,\n): boolean {\n const reader =\n typeof providerOrReader === \"string\"\n ? getProviderReader(providerOrReader)\n : providerOrReader;\n return (\n reader?.operations.some(\n (operation) => operation.operation === operationName,\n ) ?? false\n );\n}\n\nexport function createProviderReaderRuntime(\n options: ProviderReaderRuntimeOptions,\n): ProviderReaderRuntime {\n const appId = options.appId.trim();\n if (!appId) {\n throw new Error(\"createProviderReaderRuntime appId is required.\");\n }\n\n const implementations = new Map<\n WorkspaceConnectionProviderId,\n ProviderReaderRuntimeImplementation\n >();\n for (const implementation of options.readers) {\n implementations.set(implementation.providerId, implementation);\n }\n\n const connectionResolver =\n options.resolveConnection ??\n ((resolverOptions: ProviderReaderRuntimeConnectionResolverOptions) =>\n resolveWorkspaceConnectionForApp({\n appId: resolverOptions.appId,\n provider: resolverOptions.providerId,\n connectionId: resolverOptions.connectionId,\n includeDisabled: false,\n requireConnected: true,\n }));\n const credentialsResolver =\n options.resolveCredentials ??\n ((resolverOptions: ProviderReaderRuntimeCredentialsResolverOptions) =>\n resolveWorkspaceConnectionCredentialsForApp({\n appId: resolverOptions.appId,\n provider: resolverOptions.providerId,\n connectionId: resolverOptions.connectionId,\n keys: resolverOptions.keys,\n userEmail: resolverOptions.userEmail,\n orgId: resolverOptions.orgId,\n }));\n\n return {\n async read<\n TParams extends Record<string, unknown> = Record<string, unknown>,\n >(\n request: ProviderReaderRequest<TParams>,\n ): Promise<ProviderReaderRuntimeResponse> {\n const reader = getProviderReader(request.providerId);\n if (!reader) {\n throw new ProviderReaderRuntimeError(\n \"unsupported_provider\",\n `No provider reader metadata is registered for ${request.providerId}.`,\n { providerId: request.providerId, operation: request.operation },\n );\n }\n\n const operation = reader.operations.find(\n (entry) => entry.operation === request.operation,\n );\n if (!operation) {\n throw new ProviderReaderRuntimeError(\n \"unsupported_operation\",\n `${reader.label} does not support ${request.operation}.`,\n { providerId: request.providerId, operation: request.operation },\n );\n }\n\n const implementation = implementations.get(request.providerId);\n if (!implementation) {\n throw new ProviderReaderRuntimeError(\n \"unsupported_provider\",\n `${reader.label} has no runtime implementation registered.`,\n { providerId: request.providerId, operation: request.operation },\n );\n }\n\n const handler = implementation.operations[request.operation];\n if (!handler) {\n throw new ProviderReaderRuntimeError(\n \"unsupported_operation\",\n `${reader.label} has no runtime handler for ${request.operation}.`,\n { providerId: request.providerId, operation: request.operation },\n );\n }\n\n const resolvedConnection = await connectionResolver({\n appId,\n providerId: request.providerId,\n connectionId: request.connectionId?.trim() || undefined,\n });\n if (!resolvedConnection.available || !resolvedConnection.connection) {\n throw new ProviderReaderRuntimeError(\n \"connection_not_available\",\n resolvedConnection.reason,\n { providerId: request.providerId, operation: request.operation },\n );\n }\n\n const connection = publicRuntimeConnection(resolvedConnection.connection);\n const context: ProviderReaderRuntimeContext = {\n appId,\n providerId: request.providerId,\n reader,\n connection,\n resolveCredentials: (keys = reader.requiredCredentialKeys) =>\n credentialsResolver({\n appId,\n providerId: request.providerId,\n connectionId: connection.id,\n keys: [...keys],\n userEmail: request.userEmail,\n orgId: request.orgId,\n }),\n requireCredentials: async (keys = reader.requiredCredentialKeys) => {\n const resolution = await credentialsResolver({\n appId,\n providerId: request.providerId,\n connectionId: connection.id,\n keys: [...keys],\n userEmail: request.userEmail,\n orgId: request.orgId,\n });\n if (!resolution.available) {\n throw new ProviderReaderRuntimeError(\n \"credentials_unavailable\",\n `Missing workspace connection credentials for ${reader.label}: ${resolution.missingKeys.join(\", \")}.`,\n {\n providerId: request.providerId,\n operation: request.operation,\n },\n );\n }\n return { values: resolution.values, resolution };\n },\n };\n\n return handler((request.params ?? {}) as TParams, context);\n },\n };\n}\n\nfunction cloneProviderReader(\n reader: ProviderReaderDefinition,\n): ProviderReaderDefinition {\n return {\n ...reader,\n credentialKeys: reader.credentialKeys.map((credential) => ({\n ...credential,\n })),\n requiredCredentialKeys: [...reader.requiredCredentialKeys],\n capabilities: reader.capabilities.map((capability) => ({\n ...capability,\n })),\n operations: reader.operations.map((operation) => ({\n ...operation,\n parameters: operation.parameters.map((parameter) => ({\n ...parameter,\n })),\n })),\n };\n}\n\nfunction publicRuntimeConnection(\n connection: WorkspaceConnectionForApp,\n): ProviderReaderRuntimeConnection {\n return {\n id: connection.id,\n provider: connection.provider,\n label: connection.label,\n accountId: connection.accountId,\n accountLabel: connection.accountLabel,\n credentialRefs: publicCredentialRefs(connection),\n };\n}\n\nfunction publicCredentialRefs(\n connection: WorkspaceConnectionForApp,\n): WorkspaceConnectionPublicCredentialRef[] {\n return [\n ...(connection.explicitGrant?.credentialRefs ?? []).map((ref) =>\n publicCredentialRef(ref, \"grant\"),\n ),\n ...connection.credentialRefs.map((ref) =>\n publicCredentialRef(ref, \"connection\"),\n ),\n ];\n}\n\nfunction publicCredentialRef(\n ref: WorkspaceConnectionCredentialRef,\n source: WorkspaceConnectionPublicCredentialRef[\"source\"],\n): WorkspaceConnectionPublicCredentialRef {\n return {\n key: ref.key,\n scope: ref.scope,\n provider: ref.provider,\n label: ref.label,\n source,\n };\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { createDashboardStorageSchema, type DashboardStorageSchema, type DashboardStorageSchemaOptions, } from "./schema.js";
|
|
2
|
+
export { createDashboardStorage, DashboardStorageConflictError, type DashboardRecord, type DashboardRevisionRecord, type DashboardStorageOptions, type DashboardWriteInput, } from "./store.js";
|
|
3
|
+
export { createPanelSourceResolverRegistry, createProgramPanelSourceResolver, parseProgramPanelDescriptor, type DashboardPanelColumn, type PanelSourceFailure, type PanelSourceRequest, type PanelSourceResolver, type PanelSourceResolverRegistry, type PanelSourceResponse, type PanelSourceResult, type ProgramPanelContext, type ProgramPanelDescriptor, } from "./panel-source.js";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dashboard-storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,GACnC,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,sBAAsB,EACtB,6BAA6B,EAC7B,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,GACzB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,iCAAiC,EACjC,gCAAgC,EAChC,2BAA2B,EAC3B,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,GAC5B,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { createDashboardStorageSchema, } from "./schema.js";
|
|
2
|
+
export { createDashboardStorage, DashboardStorageConflictError, } from "./store.js";
|
|
3
|
+
export { createPanelSourceResolverRegistry, createProgramPanelSourceResolver, parseProgramPanelDescriptor, } from "./panel-source.js";
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dashboard-storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,GAG7B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,sBAAsB,EACtB,6BAA6B,GAK9B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,iCAAiC,EACjC,gCAAgC,EAChC,2BAA2B,GAU5B,MAAM,mBAAmB,CAAC","sourcesContent":["export {\n createDashboardStorageSchema,\n type DashboardStorageSchema,\n type DashboardStorageSchemaOptions,\n} from \"./schema.js\";\nexport {\n createDashboardStorage,\n DashboardStorageConflictError,\n type DashboardRecord,\n type DashboardRevisionRecord,\n type DashboardStorageOptions,\n type DashboardWriteInput,\n} from \"./store.js\";\nexport {\n createPanelSourceResolverRegistry,\n createProgramPanelSourceResolver,\n parseProgramPanelDescriptor,\n type DashboardPanelColumn,\n type PanelSourceFailure,\n type PanelSourceRequest,\n type PanelSourceResolver,\n type PanelSourceResolverRegistry,\n type PanelSourceResponse,\n type PanelSourceResult,\n type ProgramPanelContext,\n type ProgramPanelDescriptor,\n} from \"./panel-source.js\";\n"]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export interface DashboardPanelColumn {
|
|
2
|
+
name: string;
|
|
3
|
+
type: string;
|
|
4
|
+
}
|
|
5
|
+
export interface PanelSourceRequest<TSource extends string = string> {
|
|
6
|
+
source: TSource;
|
|
7
|
+
query: string;
|
|
8
|
+
}
|
|
9
|
+
export interface PanelSourceResult {
|
|
10
|
+
rows: Record<string, unknown>[];
|
|
11
|
+
schema?: DashboardPanelColumn[];
|
|
12
|
+
truncated?: boolean;
|
|
13
|
+
bytesProcessed?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface PanelSourceFailure {
|
|
16
|
+
error: string;
|
|
17
|
+
message?: string;
|
|
18
|
+
}
|
|
19
|
+
export type PanelSourceResponse = PanelSourceResult | PanelSourceFailure;
|
|
20
|
+
export interface PanelSourceResolver<TSource extends string = string, TContext = unknown> {
|
|
21
|
+
source: TSource;
|
|
22
|
+
resolve(request: PanelSourceRequest<TSource>, context: TContext): Promise<PanelSourceResponse>;
|
|
23
|
+
}
|
|
24
|
+
export interface PanelSourceResolverRegistry<TSource extends string = string, TContext = unknown> {
|
|
25
|
+
readonly sources: readonly TSource[];
|
|
26
|
+
resolve(request: PanelSourceRequest<TSource>, context: TContext): Promise<PanelSourceResponse>;
|
|
27
|
+
}
|
|
28
|
+
export declare function createPanelSourceResolverRegistry<TSource extends string = string, TContext = unknown>(options: {
|
|
29
|
+
resolvers: readonly PanelSourceResolver<TSource, TContext>[];
|
|
30
|
+
}): PanelSourceResolverRegistry<TSource, TContext>;
|
|
31
|
+
export interface ProgramPanelContext {
|
|
32
|
+
userEmail: string;
|
|
33
|
+
orgId?: string | null;
|
|
34
|
+
}
|
|
35
|
+
export interface ProgramPanelDescriptor {
|
|
36
|
+
programId: string;
|
|
37
|
+
params?: Record<string, unknown>;
|
|
38
|
+
}
|
|
39
|
+
export interface ProgramPanelRunResult {
|
|
40
|
+
ok: boolean;
|
|
41
|
+
rows?: Record<string, unknown>[];
|
|
42
|
+
schema?: DashboardPanelColumn[];
|
|
43
|
+
truncated?: boolean;
|
|
44
|
+
lastGoodRun?: {
|
|
45
|
+
rows: Record<string, unknown>[];
|
|
46
|
+
schema: DashboardPanelColumn[];
|
|
47
|
+
truncated?: boolean;
|
|
48
|
+
};
|
|
49
|
+
error?: {
|
|
50
|
+
code: string;
|
|
51
|
+
message: string;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export declare function parseProgramPanelDescriptor(query: string): ProgramPanelDescriptor;
|
|
55
|
+
export declare function createProgramPanelSourceResolver(options: {
|
|
56
|
+
appId: string;
|
|
57
|
+
run?: (args: {
|
|
58
|
+
programId: string;
|
|
59
|
+
appId: string;
|
|
60
|
+
params?: Record<string, unknown>;
|
|
61
|
+
ctx: {
|
|
62
|
+
userEmail: string;
|
|
63
|
+
orgId: string | null;
|
|
64
|
+
};
|
|
65
|
+
triggeredBy: "panel_view";
|
|
66
|
+
}) => Promise<ProgramPanelRunResult>;
|
|
67
|
+
}): PanelSourceResolver<"program", ProgramPanelContext>;
|
|
68
|
+
//# sourceMappingURL=panel-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel-source.d.ts","sourceRoot":"","sources":["../../src/dashboard-storage/panel-source.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IACjE,MAAM,EA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76 @@
|
|
|
1
|
+
import { runDataProgram } from "../data-programs/index.js";
|
|
2
|
+
export function createPanelSourceResolverRegistry(options) {
|
|
3
|
+
const resolvers = new Map();
|
|
4
|
+
for (const resolver of options.resolvers) {
|
|
5
|
+
const source = resolver.source.trim();
|
|
6
|
+
if (!source)
|
|
7
|
+
throw new Error("Panel source resolver requires a source.");
|
|
8
|
+
if (resolvers.has(source)) {
|
|
9
|
+
throw new Error(`Duplicate panel source resolver: ${source}`);
|
|
10
|
+
}
|
|
11
|
+
resolvers.set(source, resolver);
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
sources: [...resolvers.keys()],
|
|
15
|
+
async resolve(request, context) {
|
|
16
|
+
const resolver = resolvers.get(request.source);
|
|
17
|
+
if (!resolver) {
|
|
18
|
+
throw new Error(`Unsupported dashboard panel source: ${request.source}`);
|
|
19
|
+
}
|
|
20
|
+
return resolver.resolve(request, context);
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export function parseProgramPanelDescriptor(query) {
|
|
25
|
+
let value;
|
|
26
|
+
try {
|
|
27
|
+
value = JSON.parse(query);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
throw new Error("Program panel query must be a JSON object.");
|
|
31
|
+
}
|
|
32
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
33
|
+
throw new Error("Program panel query must be a JSON object.");
|
|
34
|
+
}
|
|
35
|
+
const descriptor = value;
|
|
36
|
+
if (typeof descriptor.programId !== "string" ||
|
|
37
|
+
!descriptor.programId.trim()) {
|
|
38
|
+
throw new Error("Program panel query requires a programId.");
|
|
39
|
+
}
|
|
40
|
+
const params = descriptor.params &&
|
|
41
|
+
typeof descriptor.params === "object" &&
|
|
42
|
+
!Array.isArray(descriptor.params)
|
|
43
|
+
? descriptor.params
|
|
44
|
+
: undefined;
|
|
45
|
+
return { programId: descriptor.programId.trim(), params };
|
|
46
|
+
}
|
|
47
|
+
export function createProgramPanelSourceResolver(options) {
|
|
48
|
+
const run = options.run ?? runDataProgram;
|
|
49
|
+
return {
|
|
50
|
+
source: "program",
|
|
51
|
+
async resolve(request, context) {
|
|
52
|
+
const descriptor = parseProgramPanelDescriptor(request.query);
|
|
53
|
+
const result = await run({
|
|
54
|
+
programId: descriptor.programId,
|
|
55
|
+
appId: options.appId,
|
|
56
|
+
params: descriptor.params,
|
|
57
|
+
ctx: {
|
|
58
|
+
userEmail: context.userEmail,
|
|
59
|
+
orgId: context.orgId ?? null,
|
|
60
|
+
},
|
|
61
|
+
triggeredBy: "panel_view",
|
|
62
|
+
});
|
|
63
|
+
if (result.ok) {
|
|
64
|
+
return {
|
|
65
|
+
rows: result.rows ?? [],
|
|
66
|
+
schema: result.schema,
|
|
67
|
+
truncated: result.truncated,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
if (result.lastGoodRun)
|
|
71
|
+
return result.lastGoodRun;
|
|
72
|
+
throw new Error(`${result.error?.code ?? "program_failed"}: ${result.error?.message ?? "Data program failed."}`);
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=panel-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel-source.js","sourceRoot":"","sources":["../../src/dashboard-storage/panel-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAgD3D,MAAM,UAAU,iCAAiC,CAG/C,OAED;IACC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAmD,CAAC;IAC7E,KAAK,MAAM,QAAQ,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;QACzC,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAa,CAAC;QACjD,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QACzE,IAAI,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAA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B,EAAE,CAChG,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { runDataProgram } from \"../data-programs/index.js\";\n\nexport interface DashboardPanelColumn {\n name: string;\n type: string;\n}\n\nexport interface PanelSourceRequest<TSource extends string = string> {\n source: TSource;\n query: string;\n}\n\nexport interface PanelSourceResult {\n rows: Record<string, unknown>[];\n schema?: DashboardPanelColumn[];\n truncated?: boolean;\n bytesProcessed?: number;\n}\n\nexport interface PanelSourceFailure {\n error: string;\n message?: string;\n}\n\nexport type PanelSourceResponse = PanelSourceResult | PanelSourceFailure;\n\nexport interface PanelSourceResolver<\n TSource extends string = string,\n TContext = unknown,\n> {\n source: TSource;\n resolve(\n request: PanelSourceRequest<TSource>,\n context: TContext,\n ): Promise<PanelSourceResponse>;\n}\n\nexport interface PanelSourceResolverRegistry<\n TSource extends string = string,\n TContext = unknown,\n> {\n readonly sources: readonly TSource[];\n resolve(\n request: PanelSourceRequest<TSource>,\n context: TContext,\n ): Promise<PanelSourceResponse>;\n}\n\nexport function createPanelSourceResolverRegistry<\n TSource extends string = string,\n TContext = unknown,\n>(options: {\n resolvers: readonly PanelSourceResolver<TSource, TContext>[];\n}): PanelSourceResolverRegistry<TSource, TContext> {\n const resolvers = new Map<TSource, PanelSourceResolver<TSource, TContext>>();\n for (const resolver of options.resolvers) {\n const source = resolver.source.trim() as TSource;\n if (!source) throw new Error(\"Panel source resolver requires a source.\");\n if (resolvers.has(source)) {\n throw new Error(`Duplicate panel source resolver: ${source}`);\n }\n resolvers.set(source, resolver);\n }\n\n return {\n sources: [...resolvers.keys()],\n async resolve(request, context) {\n const resolver = resolvers.get(request.source);\n if (!resolver) {\n throw new Error(\n `Unsupported dashboard panel source: ${request.source}`,\n );\n }\n return resolver.resolve(request, context);\n },\n };\n}\n\nexport interface ProgramPanelContext {\n userEmail: string;\n orgId?: string | null;\n}\n\nexport interface ProgramPanelDescriptor {\n programId: string;\n params?: Record<string, unknown>;\n}\n\nexport interface ProgramPanelRunResult {\n ok: boolean;\n rows?: Record<string, unknown>[];\n schema?: DashboardPanelColumn[];\n truncated?: boolean;\n lastGoodRun?: {\n rows: Record<string, unknown>[];\n schema: DashboardPanelColumn[];\n truncated?: boolean;\n };\n error?: { code: string; message: string };\n}\n\nexport function parseProgramPanelDescriptor(\n query: string,\n): ProgramPanelDescriptor {\n let value: unknown;\n try {\n value = JSON.parse(query);\n } catch {\n throw new Error(\"Program panel query must be a JSON object.\");\n }\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n throw new Error(\"Program panel query must be a JSON object.\");\n }\n const descriptor = value as Record<string, unknown>;\n if (\n typeof descriptor.programId !== \"string\" ||\n !descriptor.programId.trim()\n ) {\n throw new Error(\"Program panel query requires a programId.\");\n }\n const params =\n descriptor.params &&\n typeof descriptor.params === \"object\" &&\n !Array.isArray(descriptor.params)\n ? (descriptor.params as Record<string, unknown>)\n : undefined;\n return { programId: descriptor.programId.trim(), params };\n}\n\nexport function createProgramPanelSourceResolver(options: {\n appId: string;\n run?: (args: {\n programId: string;\n appId: string;\n params?: Record<string, unknown>;\n ctx: { userEmail: string; orgId: string | null };\n triggeredBy: \"panel_view\";\n }) => Promise<ProgramPanelRunResult>;\n}): PanelSourceResolver<\"program\", ProgramPanelContext> {\n const run = options.run ?? runDataProgram;\n return {\n source: \"program\",\n async resolve(request, context) {\n const descriptor = parseProgramPanelDescriptor(request.query);\n const result = await run({\n programId: descriptor.programId,\n appId: options.appId,\n params: descriptor.params,\n ctx: {\n userEmail: context.userEmail,\n orgId: context.orgId ?? null,\n },\n triggeredBy: \"panel_view\",\n });\n if (result.ok) {\n return {\n rows: result.rows ?? [],\n schema: result.schema,\n truncated: result.truncated,\n };\n }\n if (result.lastGoodRun) return result.lastGoodRun;\n throw new Error(\n `${result.error?.code ?? \"program_failed\"}: ${result.error?.message ?? \"Data program failed.\"}`,\n );\n },\n };\n}\n"]}
|