@agent-native/core 0.114.16 → 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/corpus/README.md +3 -3
- package/corpus/core/CHANGELOG.md +29 -0
- package/corpus/core/agent-native.eject.json +2 -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/recorder/recorder-engine.ts +88 -11
- 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/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/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/notifications/routes.d.ts +3 -3
- package/dist/observability/routes.d.ts +5 -5
- 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/secrets/routes.d.ts +9 -9
- 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/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/transcribe-voice.d.ts +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
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core/action";
|
|
2
|
+
import { assertAccess } from "@agent-native/core/sharing";
|
|
3
|
+
import { and, eq } from "drizzle-orm";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
|
|
6
|
+
import { getDb, schema } from "../server/db/index.js";
|
|
7
|
+
import { requireCrmScope } from "./_crm-action-utils.js";
|
|
8
|
+
|
|
9
|
+
export default defineAction({
|
|
10
|
+
description:
|
|
11
|
+
"Create or update a local CRM follow-up task. Mirrored provider tasks remain read-only in this phase so they cannot be changed without an explicit provider proposal.",
|
|
12
|
+
schema: z
|
|
13
|
+
.object({
|
|
14
|
+
taskId: z.string().trim().min(1).max(128).optional(),
|
|
15
|
+
recordId: z.string().trim().min(1).max(128).optional(),
|
|
16
|
+
title: z.string().trim().min(1).max(300).optional(),
|
|
17
|
+
description: z.string().trim().max(2_000).optional(),
|
|
18
|
+
status: z.enum(["open", "done", "cancelled"]).optional(),
|
|
19
|
+
dueAt: z.string().datetime({ offset: true }).optional(),
|
|
20
|
+
assignedTo: z.string().trim().max(240).optional(),
|
|
21
|
+
})
|
|
22
|
+
.superRefine((value, issue) => {
|
|
23
|
+
if (!value.taskId && !value.title) {
|
|
24
|
+
issue.addIssue({
|
|
25
|
+
code: "custom",
|
|
26
|
+
message: "title is required when creating a task",
|
|
27
|
+
path: ["title"],
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}),
|
|
31
|
+
audit: {
|
|
32
|
+
target: (_args, result) => {
|
|
33
|
+
const task = result as {
|
|
34
|
+
id: string;
|
|
35
|
+
ownerEmail: string;
|
|
36
|
+
orgId: string | null;
|
|
37
|
+
visibility: "private" | "org";
|
|
38
|
+
};
|
|
39
|
+
return {
|
|
40
|
+
type: "crm-task",
|
|
41
|
+
id: task.id,
|
|
42
|
+
ownerEmail: task.ownerEmail,
|
|
43
|
+
orgId: task.orgId,
|
|
44
|
+
visibility: task.visibility,
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
summary: (args) =>
|
|
48
|
+
args.taskId
|
|
49
|
+
? `Updated CRM task ${args.taskId}`
|
|
50
|
+
: `Created CRM task ${args.title}`,
|
|
51
|
+
},
|
|
52
|
+
run: async (args, ctx) => {
|
|
53
|
+
const db = getDb();
|
|
54
|
+
const now = new Date().toISOString();
|
|
55
|
+
if (args.taskId) {
|
|
56
|
+
await assertAccess("crm-task", args.taskId, "editor");
|
|
57
|
+
const [task] = await db
|
|
58
|
+
.select()
|
|
59
|
+
.from(schema.crmTasks)
|
|
60
|
+
.where(eq(schema.crmTasks.id, args.taskId))
|
|
61
|
+
.limit(1);
|
|
62
|
+
if (!task) throw new Error("CRM task was not found.");
|
|
63
|
+
if (task.authority !== "local") {
|
|
64
|
+
throw new Error(
|
|
65
|
+
"This is a mirrored provider task. Provider task writeback is not available in the initial release; create a CRM proposal or complete it upstream.",
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
if (args.recordId && args.recordId !== task.recordId) {
|
|
69
|
+
await assertAccess("crm-record", args.recordId, "editor");
|
|
70
|
+
}
|
|
71
|
+
await db
|
|
72
|
+
.update(schema.crmTasks)
|
|
73
|
+
.set({
|
|
74
|
+
...(args.recordId !== undefined ? { recordId: args.recordId } : {}),
|
|
75
|
+
...(args.title !== undefined ? { title: args.title } : {}),
|
|
76
|
+
...(args.description !== undefined
|
|
77
|
+
? { description: args.description }
|
|
78
|
+
: {}),
|
|
79
|
+
...(args.status !== undefined ? { status: args.status } : {}),
|
|
80
|
+
...(args.dueAt !== undefined ? { dueAt: args.dueAt } : {}),
|
|
81
|
+
...(args.assignedTo !== undefined
|
|
82
|
+
? { assignedTo: args.assignedTo }
|
|
83
|
+
: {}),
|
|
84
|
+
...(args.status === "done" ? { completedAt: now } : {}),
|
|
85
|
+
...(args.status && args.status !== "done"
|
|
86
|
+
? { completedAt: null }
|
|
87
|
+
: {}),
|
|
88
|
+
updatedAt: now,
|
|
89
|
+
})
|
|
90
|
+
.where(eq(schema.crmTasks.id, args.taskId));
|
|
91
|
+
const [updated] = await db
|
|
92
|
+
.select()
|
|
93
|
+
.from(schema.crmTasks)
|
|
94
|
+
.where(eq(schema.crmTasks.id, args.taskId))
|
|
95
|
+
.limit(1);
|
|
96
|
+
if (!updated)
|
|
97
|
+
throw new Error("CRM task could not be verified after updating.");
|
|
98
|
+
return updated;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (args.recordId)
|
|
102
|
+
await assertAccess("crm-record", args.recordId, "editor");
|
|
103
|
+
const scope = requireCrmScope(ctx);
|
|
104
|
+
const id = crypto.randomUUID();
|
|
105
|
+
await db.insert(schema.crmTasks).values({
|
|
106
|
+
id,
|
|
107
|
+
recordId: args.recordId ?? null,
|
|
108
|
+
title: args.title!,
|
|
109
|
+
description: args.description ?? "",
|
|
110
|
+
status: args.status ?? "open",
|
|
111
|
+
dueAt: args.dueAt ?? null,
|
|
112
|
+
assignedTo: args.assignedTo ?? null,
|
|
113
|
+
authority: "local",
|
|
114
|
+
completedAt: args.status === "done" ? now : null,
|
|
115
|
+
...scope,
|
|
116
|
+
createdAt: now,
|
|
117
|
+
updatedAt: now,
|
|
118
|
+
});
|
|
119
|
+
const [task] = await db
|
|
120
|
+
.select()
|
|
121
|
+
.from(schema.crmTasks)
|
|
122
|
+
.where(
|
|
123
|
+
and(
|
|
124
|
+
eq(schema.crmTasks.id, id),
|
|
125
|
+
eq(schema.crmTasks.ownerEmail, scope.ownerEmail),
|
|
126
|
+
),
|
|
127
|
+
)
|
|
128
|
+
.limit(1);
|
|
129
|
+
if (!task) throw new Error("CRM task could not be verified after saving.");
|
|
130
|
+
return task;
|
|
131
|
+
},
|
|
132
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core/action";
|
|
2
|
+
import { writeAppStateForCurrentTab } from "@agent-native/core/application-state";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
const viewSchema = z.enum([
|
|
6
|
+
"work",
|
|
7
|
+
"account",
|
|
8
|
+
"person",
|
|
9
|
+
"opportunity",
|
|
10
|
+
"record",
|
|
11
|
+
"tasks",
|
|
12
|
+
"proposals",
|
|
13
|
+
"views",
|
|
14
|
+
"dashboard",
|
|
15
|
+
"ask",
|
|
16
|
+
"setup",
|
|
17
|
+
"settings",
|
|
18
|
+
]);
|
|
19
|
+
|
|
20
|
+
const paths = {
|
|
21
|
+
work: "/",
|
|
22
|
+
account: "/accounts",
|
|
23
|
+
person: "/people",
|
|
24
|
+
opportunity: "/opportunities",
|
|
25
|
+
tasks: "/tasks",
|
|
26
|
+
proposals: "/proposals",
|
|
27
|
+
views: "/views",
|
|
28
|
+
dashboard: "/dashboard",
|
|
29
|
+
ask: "/ask",
|
|
30
|
+
setup: "/setup",
|
|
31
|
+
settings: "/settings",
|
|
32
|
+
} as const;
|
|
33
|
+
|
|
34
|
+
export default defineAction({
|
|
35
|
+
description:
|
|
36
|
+
"Navigate the CRM UI to work, records, tasks, proposals, saved views, Ask CRM, setup, or settings.",
|
|
37
|
+
schema: z.object({
|
|
38
|
+
view: viewSchema,
|
|
39
|
+
recordId: z.string().trim().min(1).max(200).optional(),
|
|
40
|
+
viewId: z.string().trim().min(1).max(200).optional(),
|
|
41
|
+
dashboardId: z.string().trim().min(1).max(200).optional(),
|
|
42
|
+
query: z.string().trim().max(200).optional(),
|
|
43
|
+
settingsSection: z.enum(["intelligence"]).optional(),
|
|
44
|
+
}),
|
|
45
|
+
http: false,
|
|
46
|
+
run: async (args) => {
|
|
47
|
+
if (args.view === "record" && !args.recordId) {
|
|
48
|
+
throw new Error("recordId is required when navigating to a CRM record.");
|
|
49
|
+
}
|
|
50
|
+
const basePath =
|
|
51
|
+
args.view === "record"
|
|
52
|
+
? `/records/${encodeURIComponent(args.recordId!)}`
|
|
53
|
+
: args.view === "settings" && args.settingsSection
|
|
54
|
+
? `/settings/${args.settingsSection}`
|
|
55
|
+
: paths[args.view];
|
|
56
|
+
const path =
|
|
57
|
+
args.view === "dashboard" && args.dashboardId
|
|
58
|
+
? `${basePath}?id=${encodeURIComponent(args.dashboardId)}`
|
|
59
|
+
: basePath;
|
|
60
|
+
await writeAppStateForCurrentTab("navigate", { ...args, path });
|
|
61
|
+
return { navigatingTo: path };
|
|
62
|
+
},
|
|
63
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createProviderApiCatalogAction } from "@agent-native/core/provider-api/actions/provider-api";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
CRM_PROVIDER_API_IDS,
|
|
6
|
+
getCrmProviderApiRuntime,
|
|
7
|
+
} from "../server/lib/provider-api.js";
|
|
8
|
+
|
|
9
|
+
const ProviderSchema = z.enum(CRM_PROVIDER_API_IDS);
|
|
10
|
+
|
|
11
|
+
export default createProviderApiCatalogAction(getCrmProviderApiRuntime(), {
|
|
12
|
+
description:
|
|
13
|
+
"List the raw HubSpot and Salesforce API capabilities available through CRM's granted workspace connections. Use before provider-api-request when a CRM convenience action cannot express an endpoint, filter, custom object, pagination mode, or API version. Returns metadata and examples, never secret values.",
|
|
14
|
+
schema: z.object({
|
|
15
|
+
provider: ProviderSchema.optional().describe(
|
|
16
|
+
"Optional provider id to inspect: hubspot or salesforce.",
|
|
17
|
+
),
|
|
18
|
+
}),
|
|
19
|
+
http: { method: "GET" },
|
|
20
|
+
guidance:
|
|
21
|
+
"CRM actions are convenience workflows, not a provider capability limit. For an exact HubSpot or Salesforce endpoint, inspect its catalog and docs before provider-api-request. For broad work, stage a bounded paginated result, reduce it with query-staged-dataset or a data program, and report the scope, row count, pagination status, truncation, and gaps.",
|
|
22
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { createProviderApiDocsAction } from "@agent-native/core/provider-api/actions/provider-api";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
CRM_PROVIDER_API_IDS,
|
|
6
|
+
getCrmProviderApiRuntime,
|
|
7
|
+
} from "../server/lib/provider-api.js";
|
|
8
|
+
|
|
9
|
+
const ProviderSchema = z.enum(CRM_PROVIDER_API_IDS);
|
|
10
|
+
const BooleanFromQuerySchema = z.preprocess(
|
|
11
|
+
(value) => (typeof value === "string" ? value === "true" : value),
|
|
12
|
+
z.boolean(),
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export default createProviderApiDocsAction(getCrmProviderApiRuntime(), {
|
|
16
|
+
description:
|
|
17
|
+
"Inspect HubSpot or Salesforce API documentation before an exact provider-api-request when the endpoint, object schema, field, filter operator, relationship, or pagination contract is uncertain.",
|
|
18
|
+
schema: z.object({
|
|
19
|
+
provider: ProviderSchema.describe("Provider whose API docs to inspect."),
|
|
20
|
+
url: z
|
|
21
|
+
.string()
|
|
22
|
+
.url()
|
|
23
|
+
.optional()
|
|
24
|
+
.describe(
|
|
25
|
+
"Optional public provider docs/spec URL. The provider catalog returns curated starting URLs.",
|
|
26
|
+
),
|
|
27
|
+
maxBytes: z.coerce
|
|
28
|
+
.number()
|
|
29
|
+
.int()
|
|
30
|
+
.min(1_000)
|
|
31
|
+
.max(4 * 1024 * 1024)
|
|
32
|
+
.optional(),
|
|
33
|
+
maxChars: z.coerce.number().int().min(1).max(200_000).optional(),
|
|
34
|
+
responseMode: z
|
|
35
|
+
.enum(["auto", "raw", "text", "markdown", "links", "metadata", "matches"])
|
|
36
|
+
.optional(),
|
|
37
|
+
extract: z.enum(["readability", "all-visible", "none"]).optional(),
|
|
38
|
+
includeLinks: BooleanFromQuerySchema.optional(),
|
|
39
|
+
search: z
|
|
40
|
+
.object({
|
|
41
|
+
query: z.union([z.string(), z.array(z.string())]).optional(),
|
|
42
|
+
queries: z.array(z.string()).optional(),
|
|
43
|
+
terms: z.array(z.string()).optional(),
|
|
44
|
+
regex: z.string().optional(),
|
|
45
|
+
regexFlags: z.string().optional(),
|
|
46
|
+
source: z.enum(["extracted", "raw"]).optional(),
|
|
47
|
+
maxMatches: z.coerce.number().int().min(1).max(500).optional(),
|
|
48
|
+
contextChars: z.coerce.number().int().min(0).max(1_000).optional(),
|
|
49
|
+
caseSensitive: BooleanFromQuerySchema.optional(),
|
|
50
|
+
})
|
|
51
|
+
.optional(),
|
|
52
|
+
}),
|
|
53
|
+
http: { method: "GET" },
|
|
54
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { createProviderApiRequestAction } from "@agent-native/core/provider-api/actions/provider-api";
|
|
2
|
+
import { getCredentialContext } from "@agent-native/core/server/request-context";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
CRM_APP_ID,
|
|
7
|
+
CRM_PROVIDER_API_IDS,
|
|
8
|
+
getCrmProviderApiRuntime,
|
|
9
|
+
} from "../server/lib/provider-api.js";
|
|
10
|
+
|
|
11
|
+
const ProviderSchema = z.enum(CRM_PROVIDER_API_IDS);
|
|
12
|
+
const MethodSchema = z.enum(["GET", "HEAD"]);
|
|
13
|
+
|
|
14
|
+
const PaginationSchema = z
|
|
15
|
+
.object({
|
|
16
|
+
nextCursorPath: z.string().optional(),
|
|
17
|
+
cursorParam: z.string().optional(),
|
|
18
|
+
pageParam: z.string().optional(),
|
|
19
|
+
startPage: z.coerce.number().int().optional(),
|
|
20
|
+
offsetParam: z.string().optional(),
|
|
21
|
+
pageSize: z.coerce.number().int().min(1).optional(),
|
|
22
|
+
maxPages: z.coerce.number().int().min(1).max(200).optional(),
|
|
23
|
+
})
|
|
24
|
+
.optional();
|
|
25
|
+
|
|
26
|
+
export default createProviderApiRequestAction(getCrmProviderApiRuntime(), {
|
|
27
|
+
description:
|
|
28
|
+
"Make an exact read-only authenticated HubSpot or Salesforce GET or HEAD request through a CRM-granted workspace connection. This is the flexible escape hatch for custom object, field, relationship, pagination, and API-version reads that CRM convenience actions do not model. It is host-constrained, access-scoped to the granted connection, and redacts secrets. Provider writes must use revision-aware CRM proposals, never this action. Use stageAs for large results instead of returning raw provider payloads to chat.",
|
|
29
|
+
schema: z
|
|
30
|
+
.object({
|
|
31
|
+
provider: ProviderSchema.describe("CRM provider: hubspot or salesforce."),
|
|
32
|
+
method: MethodSchema.default("GET"),
|
|
33
|
+
path: z
|
|
34
|
+
.string()
|
|
35
|
+
.min(1)
|
|
36
|
+
.describe(
|
|
37
|
+
"Provider API path, or a full URL on the selected connection's allowed provider host.",
|
|
38
|
+
),
|
|
39
|
+
query: z.unknown().optional(),
|
|
40
|
+
headers: z.record(z.string(), z.unknown()).optional(),
|
|
41
|
+
auth: z.enum(["default", "none"]).default("default"),
|
|
42
|
+
connectionId: z
|
|
43
|
+
.string()
|
|
44
|
+
.trim()
|
|
45
|
+
.min(1)
|
|
46
|
+
.optional()
|
|
47
|
+
.describe(
|
|
48
|
+
"Granted workspace connection id. Required for Salesforce so its actor-bound token and instance URL stay coupled.",
|
|
49
|
+
),
|
|
50
|
+
timeoutMs: z.coerce.number().int().min(1_000).max(120_000).optional(),
|
|
51
|
+
maxBytes: z.coerce
|
|
52
|
+
.number()
|
|
53
|
+
.int()
|
|
54
|
+
.min(1_000)
|
|
55
|
+
.max(4 * 1024 * 1024)
|
|
56
|
+
.optional(),
|
|
57
|
+
stageAs: z
|
|
58
|
+
.string()
|
|
59
|
+
.min(1)
|
|
60
|
+
.optional()
|
|
61
|
+
.describe(
|
|
62
|
+
"Store response items as a caller-scoped scratch dataset and return a compact summary.",
|
|
63
|
+
),
|
|
64
|
+
itemsPath: z.string().optional(),
|
|
65
|
+
pagination: PaginationSchema.describe(
|
|
66
|
+
"Server-side query-string pagination for a staged response. Use the provider's catalog/docs to choose its cursor fields.",
|
|
67
|
+
),
|
|
68
|
+
saveToFile: z.string().optional(),
|
|
69
|
+
fetchAllPages: z
|
|
70
|
+
.object({
|
|
71
|
+
cursorPath: z.string(),
|
|
72
|
+
cursorParam: z.string().optional(),
|
|
73
|
+
itemsPath: z.string().optional(),
|
|
74
|
+
maxPages: z.coerce.number().int().min(1).max(50).optional(),
|
|
75
|
+
})
|
|
76
|
+
.optional(),
|
|
77
|
+
})
|
|
78
|
+
.superRefine((value, ctx) => {
|
|
79
|
+
if (value.provider === "salesforce" && !value.connectionId) {
|
|
80
|
+
ctx.addIssue({
|
|
81
|
+
code: "custom",
|
|
82
|
+
path: ["connectionId"],
|
|
83
|
+
message:
|
|
84
|
+
"Salesforce provider reads require the granted workspace connection id.",
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}),
|
|
88
|
+
appId: CRM_APP_ID,
|
|
89
|
+
getOwnerEmail: () => getCredentialContext()?.userEmail ?? null,
|
|
90
|
+
http: false,
|
|
91
|
+
toolCallable: false,
|
|
92
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createQueryStagedDatasetAction } from "@agent-native/core/provider-api/actions/staged-datasets";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
import { CRM_APP_ID } from "../server/lib/provider-api.js";
|
|
5
|
+
|
|
6
|
+
const WhereSchema = z.object({
|
|
7
|
+
column: z.string().min(1),
|
|
8
|
+
op: z.enum([
|
|
9
|
+
"equals",
|
|
10
|
+
"not_equals",
|
|
11
|
+
"contains",
|
|
12
|
+
"not_contains",
|
|
13
|
+
"gt",
|
|
14
|
+
"gte",
|
|
15
|
+
"lt",
|
|
16
|
+
"lte",
|
|
17
|
+
"exists",
|
|
18
|
+
"not_exists",
|
|
19
|
+
]),
|
|
20
|
+
value: z.unknown().optional(),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const AggregateSchema = z.object({
|
|
24
|
+
column: z.string().min(1),
|
|
25
|
+
op: z.enum(["sum", "avg", "count", "min", "max", "count_distinct"]),
|
|
26
|
+
as: z.string().optional(),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export default createQueryStagedDatasetAction({
|
|
30
|
+
description:
|
|
31
|
+
"Filter, project, sort, or aggregate a caller-scoped staged CRM provider dataset without re-fetching the provider. For exhaustive CRM analysis, stage every bounded page first and report the dataset's source scope, row count, pagination status, truncation, and gaps.",
|
|
32
|
+
schema: z.object({
|
|
33
|
+
datasetId: z.string().min(1),
|
|
34
|
+
where: z.array(WhereSchema).optional(),
|
|
35
|
+
groupBy: z.array(z.string().min(1)).optional(),
|
|
36
|
+
aggregate: z.array(AggregateSchema).optional(),
|
|
37
|
+
select: z.array(z.string().min(1)).optional(),
|
|
38
|
+
orderBy: z.string().optional(),
|
|
39
|
+
orderDir: z.enum(["asc", "desc"]).optional(),
|
|
40
|
+
limit: z.coerce.number().int().min(1).max(10_000).optional(),
|
|
41
|
+
}),
|
|
42
|
+
http: false,
|
|
43
|
+
appId: CRM_APP_ID,
|
|
44
|
+
});
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core/action";
|
|
2
|
+
import { accessFilter, assertAccess } from "@agent-native/core/sharing";
|
|
3
|
+
import { and, eq, inArray } from "drizzle-orm";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
|
|
6
|
+
import { isSafeCrmEvidenceExcerpt } from "../server/crm/crm-field-firewall.js";
|
|
7
|
+
import { getDb, schema } from "../server/db/index.js";
|
|
8
|
+
import {
|
|
9
|
+
crmSignalIdempotencyKey,
|
|
10
|
+
signalTupleError,
|
|
11
|
+
} from "./_crm-signal-utils.js";
|
|
12
|
+
|
|
13
|
+
const insightSchema = z.object({
|
|
14
|
+
evidenceId: z.string().trim().min(1).max(128),
|
|
15
|
+
kind: z.enum(["call-summary", "next-step"]),
|
|
16
|
+
label: z.string().trim().min(1).max(120),
|
|
17
|
+
summary: z.string().trim().min(1).max(1_200).refine(isSafeCrmEvidenceExcerpt),
|
|
18
|
+
quote: z
|
|
19
|
+
.string()
|
|
20
|
+
.trim()
|
|
21
|
+
.max(1_200)
|
|
22
|
+
.refine(isSafeCrmEvidenceExcerpt)
|
|
23
|
+
.optional(),
|
|
24
|
+
quoteSeconds: z.coerce.number().finite().min(0).max(86_400),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export default defineAction({
|
|
28
|
+
description:
|
|
29
|
+
"Atomically record a bounded, evidence-cited call recap or next-step set produced through agent chat. No transcript body or raw model response is accepted.",
|
|
30
|
+
schema: z.object({
|
|
31
|
+
runId: z.string().trim().min(1).max(128),
|
|
32
|
+
recordId: z.string().trim().min(1).max(128),
|
|
33
|
+
insights: z.array(insightSchema).min(1).max(20),
|
|
34
|
+
model: z.string().trim().min(1).max(120),
|
|
35
|
+
modelVersion: z.string().trim().max(120).optional(),
|
|
36
|
+
idempotencyKey: z.string().trim().min(1).max(180),
|
|
37
|
+
}),
|
|
38
|
+
run: async (args, ctx) => {
|
|
39
|
+
await Promise.all([
|
|
40
|
+
assertAccess("crm-record", args.recordId, "editor"),
|
|
41
|
+
assertAccess("crm-signal-run", args.runId, "editor"),
|
|
42
|
+
...args.insights.map((item) =>
|
|
43
|
+
assertAccess("crm-call-evidence", item.evidenceId, "viewer"),
|
|
44
|
+
),
|
|
45
|
+
]);
|
|
46
|
+
const db = getDb();
|
|
47
|
+
const [run] = await db
|
|
48
|
+
.select()
|
|
49
|
+
.from(schema.crmSignalRuns)
|
|
50
|
+
.where(
|
|
51
|
+
and(
|
|
52
|
+
eq(schema.crmSignalRuns.id, args.runId),
|
|
53
|
+
accessFilter(schema.crmSignalRuns, schema.crmSignalRunShares),
|
|
54
|
+
),
|
|
55
|
+
)
|
|
56
|
+
.limit(1);
|
|
57
|
+
const evidenceIds = [
|
|
58
|
+
...new Set(args.insights.map((item) => item.evidenceId)),
|
|
59
|
+
];
|
|
60
|
+
const evidence = await db
|
|
61
|
+
.select()
|
|
62
|
+
.from(schema.crmCallEvidence)
|
|
63
|
+
.where(
|
|
64
|
+
and(
|
|
65
|
+
inArray(schema.crmCallEvidence.id, evidenceIds),
|
|
66
|
+
accessFilter(schema.crmCallEvidence, schema.crmCallEvidenceShares),
|
|
67
|
+
),
|
|
68
|
+
)
|
|
69
|
+
.limit(20);
|
|
70
|
+
if (
|
|
71
|
+
!run ||
|
|
72
|
+
run.kind !== "summary" ||
|
|
73
|
+
run.recordId !== args.recordId ||
|
|
74
|
+
evidence.length !== evidenceIds.length ||
|
|
75
|
+
evidence.some((item) => item.recordId !== args.recordId)
|
|
76
|
+
)
|
|
77
|
+
signalTupleError(
|
|
78
|
+
"The summary run, evidence, and record do not form an accessible tuple.",
|
|
79
|
+
);
|
|
80
|
+
const byId = new Map(evidence.map((item) => [item.id, item]));
|
|
81
|
+
const now = new Date().toISOString();
|
|
82
|
+
const rows: Array<typeof schema.crmSignals.$inferInsert> = [];
|
|
83
|
+
for (const [index, item] of args.insights.entries()) {
|
|
84
|
+
const source = byId.get(item.evidenceId)!;
|
|
85
|
+
const excerpt = source.quote.trim() || source.summary.trim();
|
|
86
|
+
if (item.quote && !excerpt.includes(item.quote))
|
|
87
|
+
throw new Error(
|
|
88
|
+
"Every insight quote must be an exact substring of its stored bounded evidence excerpt.",
|
|
89
|
+
);
|
|
90
|
+
const start = source.startSeconds ?? 0;
|
|
91
|
+
if (
|
|
92
|
+
item.quoteSeconds < start ||
|
|
93
|
+
(source.endSeconds !== null && item.quoteSeconds > source.endSeconds)
|
|
94
|
+
)
|
|
95
|
+
throw new Error(
|
|
96
|
+
"Every insight timestamp must fall inside its evidence excerpt.",
|
|
97
|
+
);
|
|
98
|
+
const idem = await crmSignalIdempotencyKey(
|
|
99
|
+
ctx,
|
|
100
|
+
args.recordId,
|
|
101
|
+
`${args.idempotencyKey}:${index}`,
|
|
102
|
+
);
|
|
103
|
+
rows.push({
|
|
104
|
+
id: crypto.randomUUID(),
|
|
105
|
+
runId: args.runId,
|
|
106
|
+
trackerId: null,
|
|
107
|
+
recordId: args.recordId,
|
|
108
|
+
evidenceId: item.evidenceId,
|
|
109
|
+
kind: item.kind,
|
|
110
|
+
label: item.label,
|
|
111
|
+
quote: item.quote ?? "",
|
|
112
|
+
speaker: source.speaker,
|
|
113
|
+
startSeconds: item.quoteSeconds,
|
|
114
|
+
endSeconds: source.endSeconds,
|
|
115
|
+
summary: item.summary,
|
|
116
|
+
confidence: 100,
|
|
117
|
+
detector: "agent",
|
|
118
|
+
model: args.model,
|
|
119
|
+
modelVersion: args.modelVersion ?? null,
|
|
120
|
+
reviewStatus: "unreviewed",
|
|
121
|
+
idempotencyKey: idem.key,
|
|
122
|
+
...idem.scope,
|
|
123
|
+
createdAt: now,
|
|
124
|
+
updatedAt: now,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
const existing = await db
|
|
128
|
+
.select({ key: schema.crmSignals.idempotencyKey })
|
|
129
|
+
.from(schema.crmSignals)
|
|
130
|
+
.where(
|
|
131
|
+
and(
|
|
132
|
+
inArray(
|
|
133
|
+
schema.crmSignals.idempotencyKey,
|
|
134
|
+
rows.map((row) => row.idempotencyKey),
|
|
135
|
+
),
|
|
136
|
+
accessFilter(schema.crmSignals, schema.crmSignalShares),
|
|
137
|
+
),
|
|
138
|
+
);
|
|
139
|
+
const existingKeys = new Set(existing.map((item) => item.key));
|
|
140
|
+
const pending = rows.filter((row) => !existingKeys.has(row.idempotencyKey));
|
|
141
|
+
await db.transaction(async (tx) => {
|
|
142
|
+
if (pending.length) await tx.insert(schema.crmSignals).values(pending);
|
|
143
|
+
await tx
|
|
144
|
+
.update(schema.crmSignalRuns)
|
|
145
|
+
.set({
|
|
146
|
+
status: "completed",
|
|
147
|
+
model: args.model,
|
|
148
|
+
modelVersion: args.modelVersion ?? null,
|
|
149
|
+
completedAt: now,
|
|
150
|
+
updatedAt: now,
|
|
151
|
+
})
|
|
152
|
+
.where(eq(schema.crmSignalRuns.id, args.runId));
|
|
153
|
+
});
|
|
154
|
+
return {
|
|
155
|
+
created: pending.length,
|
|
156
|
+
replayed: rows.length - pending.length,
|
|
157
|
+
signalIds: pending.map((row) => row.id),
|
|
158
|
+
};
|
|
159
|
+
},
|
|
160
|
+
});
|