@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
|
@@ -49,8 +49,8 @@ export declare function handleUpdateResource(event: any): Promise<import("./stor
|
|
|
49
49
|
}>;
|
|
50
50
|
/** DELETE /_agent-native/resources/:id — delete a resource */
|
|
51
51
|
export declare function handleDeleteResource(event: any): Promise<{
|
|
52
|
-
ok?: undefined;
|
|
53
52
|
error: string;
|
|
53
|
+
ok?: undefined;
|
|
54
54
|
} | {
|
|
55
55
|
error?: undefined;
|
|
56
56
|
ok: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-framework-secrets.d.ts","sourceRoot":"","sources":["../../src/secrets/register-framework-secrets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,wBAAgB,wBAAwB,IAAI,IAAI,
|
|
1
|
+
{"version":3,"file":"register-framework-secrets.d.ts","sourceRoot":"","sources":["../../src/secrets/register-framework-secrets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,wBAAgB,wBAAwB,IAAI,IAAI,CAyN/C"}
|
|
@@ -44,6 +44,13 @@ export function registerFrameworkSecrets() {
|
|
|
44
44
|
label: "HubSpot",
|
|
45
45
|
docsUrl: "https://developers.hubspot.com/docs/apps/developer-platform/build-apps/authentication/oauth/oauth-quickstart-guide",
|
|
46
46
|
},
|
|
47
|
+
{
|
|
48
|
+
id: "salesforce",
|
|
49
|
+
credentialPrefix: "SALESFORCE",
|
|
50
|
+
oauthProvider: "salesforce",
|
|
51
|
+
label: "Salesforce",
|
|
52
|
+
docsUrl: "https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_web_server_oauth_flow.htm",
|
|
53
|
+
},
|
|
47
54
|
{
|
|
48
55
|
id: "jira",
|
|
49
56
|
credentialPrefix: "JIRA",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-framework-secrets.js","sourceRoot":"","sources":["../../src/secrets/register-framework-secrets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE1E,MAAM,UAAU,wBAAwB;IACtC,MAAM,uBAAuB,GAAG;QAC9B;YACE,EAAE,EAAE,OAAO;YACX,gBAAgB,EAAE,OAAO;YACzB,aAAa,EAAE,OAAO;YACtB,KAAK,EAAE,OAAO;YACd,OAAO,EAAE,wDAAwD;SAClE;QACD;YACE,EAAE,EAAE,cAAc;YAClB,gBAAgB,EAAE,QAAQ;YAC1B,aAAa,EAAE,QAAQ;YACvB,KAAK,EAAE,cAAc;YACrB,OAAO,EACL,oEAAoE;SACvE;QACD;YACE,EAAE,EAAE,QAAQ;YACZ,gBAAgB,EAAE,QAAQ;YAC1B,aAAa,EAAE,QAAQ;YACvB,KAAK,EAAE,QAAQ;YACf,OAAO,EAAE,6DAA6D;SACvE;QACD;YACE,EAAE,EAAE,SAAS;YACb,gBAAgB,EAAE,SAAS;YAC3B,aAAa,EAAE,SAAS;YACxB,KAAK,EAAE,SAAS;YAChB,OAAO,EACL,oHAAoH;SACvH;QACD;YACE,EAAE,EAAE,MAAM;YACV,gBAAgB,EAAE,MAAM;YACxB,aAAa,EAAE,MAAM;YACrB,KAAK,EAAE,YAAY;YACnB,OAAO,EACL,uEAAuE;SAC1E;QACD;YACE,EAAE,EAAE,QAAQ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,MAAM,KAAK,CAAC,6BAA6B,EAAE;oBAC1D,OAAO,EAAE;wBACP,eAAe,EAAE,KAAK;wBACtB,YAAY,EAAE,iBAAiB;qBAChC;iBACF,CAAC,CAAC;gBACH,OAAO,QAAQ,CAAC,EAAE;oBAChB,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE;oBACd,CAAC,CAAC;wBACE,EAAE,EAAE,KAAK;wBACT,KAAK,EAAE,kCAAkC,QAAQ,CAAC,MAAM,IAAI;qBAC7D,CAAC;YACR,CAAC;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC","sourcesContent":["/**\n * Framework-level secret registrations.\n *\n * Side-effect module — imported by the core-routes plugin at boot so the\n * sidebar settings UI and the `/_agent-native/secrets` list route surface the\n * relevant keys in every template.\n *\n * Each call uses a `getRequiredSecret` guard so a template that has already\n * registered the same key (often with stricter settings like `required: true`)\n * wins — the framework registration is a fallback, not an override.\n *\n * OPENAI_API_KEY is optional framework-wide because it enables the shared\n * realtime speech-to-speech agent mode. Templates can pre-register the same\n * key with stricter requirements; the guard below preserves their definition.\n */\n\nimport { getRequiredSecret, registerRequiredSecret } from \"./register.js\";\n\nexport function registerFrameworkSecrets(): void {\n const workspaceOAuthProviders = [\n {\n id: \"figma\",\n credentialPrefix: \"FIGMA\",\n oauthProvider: \"figma\",\n label: \"Figma\",\n docsUrl: \"https://developers.figma.com/docs/rest-api/oauth-apps/\",\n },\n {\n id: \"google_drive\",\n credentialPrefix: \"GOOGLE\",\n oauthProvider: \"google\",\n label: \"Google Drive\",\n docsUrl:\n \"https://developers.google.com/identity/protocols/oauth2/web-server\",\n },\n {\n id: \"github\",\n credentialPrefix: \"GITHUB\",\n oauthProvider: \"github\",\n label: \"GitHub\",\n docsUrl: \"https://docs.github.com/apps/oauth-apps/building-oauth-apps\",\n },\n {\n id: \"hubspot\",\n credentialPrefix: \"HUBSPOT\",\n oauthProvider: \"hubspot\",\n label: \"HubSpot\",\n docsUrl:\n \"https://developers.hubspot.com/docs/apps/developer-platform/build-apps/authentication/oauth/oauth-quickstart-guide\",\n },\n {\n id: \"jira\",\n credentialPrefix: \"JIRA\",\n oauthProvider: \"jira\",\n label: \"Jira Cloud\",\n docsUrl:\n \"https://developer.atlassian.com/cloud/jira/platform/oauth-2-3lo-apps/\",\n },\n {\n id: \"sentry\",\n credentialPrefix: \"SENTRY\",\n oauthProvider: \"sentry\",\n label: \"Sentry\",\n docsUrl: \"https://docs.sentry.io/api/auth/\",\n },\n {\n id: \"notion\",\n credentialPrefix: \"NOTION\",\n oauthProvider: \"notion\",\n label: \"Notion\",\n docsUrl: \"https://developers.notion.com/docs/authorization\",\n },\n ] as const;\n\n for (const provider of workspaceOAuthProviders) {\n const prefix = provider.credentialPrefix;\n for (const credential of [\n { suffix: \"CLIENT_ID\", label: \"OAuth client ID\" },\n { suffix: \"CLIENT_SECRET\", label: \"OAuth client secret\" },\n ] as const) {\n const key = `${prefix}_${credential.suffix}`;\n if (!getRequiredSecret(key)) {\n registerRequiredSecret({\n key,\n label: `${provider.label} ${credential.label}`,\n description: `Workspace-owned ${provider.label} OAuth application credential. Tokens granted by users are stored separately and encrypted.`,\n docsUrl: provider.docsUrl,\n scope: \"workspace\",\n kind: \"api-key\",\n required: false,\n });\n }\n }\n\n const connectionKey = `${prefix}_CONNECTED`;\n if (!getRequiredSecret(connectionKey)) {\n registerRequiredSecret({\n key: connectionKey,\n label: `${provider.label} account`,\n description: `Connect a ${provider.label} account for scoped workspace imports.`,\n docsUrl: provider.docsUrl,\n scope: \"user\",\n kind: \"oauth\",\n required: false,\n oauthProvider: provider.oauthProvider,\n oauthConnectUrl: `/_agent-native/connections/oauth/${provider.id}/start`,\n });\n }\n }\n\n if (!getRequiredSecret(\"OPENAI_API_KEY\")) {\n registerRequiredSecret({\n key: \"OPENAI_API_KEY\",\n label: \"OpenAI API key\",\n description:\n \"Optional fallback for realtime voice when Builder is not connected, and for OpenAI transcription.\",\n docsUrl: \"https://platform.openai.com/api-keys\",\n scope: \"user\",\n kind: \"api-key\",\n required: false,\n validator: async (value) => {\n const response = await fetch(\"https://api.openai.com/v1/models\", {\n headers: { Authorization: `Bearer ${value}` },\n });\n return response.ok\n ? { ok: true }\n : {\n ok: false,\n error: `OpenAI rejected the key (HTTP ${response.status}).`,\n };\n },\n });\n }\n\n // Web-search tool backends — optional; the tool selects the first\n // configured manual key at call time, then falls back to Builder Connect.\n const webSearchKeys: Array<{\n key: string;\n label: string;\n description: string;\n docsUrl: string;\n }> = [\n {\n key: \"BRAVE_SEARCH_API_KEY\",\n label: \"Brave Search API Key\",\n description:\n \"Enables the web-search agent tool via Brave Search. Optional when Builder.io is connected for managed web search.\",\n docsUrl: \"https://brave.com/search/api/\",\n },\n {\n key: \"TAVILY_API_KEY\",\n label: \"Tavily API Key\",\n description:\n \"Enables the web-search agent tool via Tavily. Used as fallback when BRAVE_SEARCH_API_KEY is not set and before Builder-managed search.\",\n docsUrl: \"https://tavily.com/\",\n },\n {\n key: \"EXA_API_KEY\",\n label: \"Exa API Key\",\n description:\n \"Enables the web-search agent tool via Exa. Used as fallback when Brave and Tavily are not set and before Builder-managed search.\",\n docsUrl: \"https://exa.ai/\",\n },\n {\n key: \"FIRECRAWL_API_KEY\",\n label: \"Firecrawl API Key\",\n description:\n \"Enables the web-search agent tool via Firecrawl. Used as fallback when Brave, Tavily, and Exa are not set and before Builder-managed search.\",\n docsUrl: \"https://firecrawl.dev/\",\n },\n ];\n\n for (const entry of webSearchKeys) {\n if (!getRequiredSecret(entry.key)) {\n registerRequiredSecret({\n key: entry.key,\n label: entry.label,\n description: entry.description,\n docsUrl: entry.docsUrl,\n scope: \"workspace\",\n kind: \"api-key\",\n required: false,\n });\n }\n }\n\n if (!getRequiredSecret(\"GITHUB_TOKEN\")) {\n registerRequiredSecret({\n key: \"GITHUB_TOKEN\",\n label: \"GitHub token\",\n description:\n \"Enables connector-scoped repository file reads and writes for headless/cloud agent runs.\",\n docsUrl:\n \"https://docs.github.com/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens\",\n scope: \"workspace\",\n kind: \"api-key\",\n required: false,\n });\n }\n\n if (!getRequiredSecret(\"FIGMA_ACCESS_TOKEN\")) {\n registerRequiredSecret({\n key: \"FIGMA_ACCESS_TOKEN\",\n label: \"Figma access token\",\n description:\n \"Optional fallback for reading Figma file and node context when the hosted Figma MCP server is unavailable. Generate a personal access token with current_user:read and file_content:read.\",\n docsUrl:\n \"https://developers.figma.com/docs/rest-api/personal-access-tokens/\",\n scope: \"user\",\n kind: \"api-key\",\n required: false,\n validator: async (value) => {\n const response = await fetch(\"https://api.figma.com/v1/me\", {\n headers: {\n \"X-Figma-Token\": value,\n \"User-Agent\": \"AgentNative/1.0\",\n },\n });\n return response.ok\n ? { ok: true }\n : {\n ok: false,\n error: `Figma rejected the token (HTTP ${response.status}).`,\n };\n },\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"register-framework-secrets.js","sourceRoot":"","sources":["../../src/secrets/register-framework-secrets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE1E,MAAM,UAAU,wBAAwB;IACtC,MAAM,uBAAuB,GAAG;QAC9B;YACE,EAAE,EAAE,OAAO;YACX,gBAAgB,EAAE,OAAO;YACzB,aAAa,EAAE,OAAO;YACtB,KAAK,EAAE,OAAO;YACd,OAAO,EAAE,wDAAwD;SAClE;QACD;YACE,EAAE,EAAE,cAAc;YAClB,gBAAgB,EAAE,QAAQ;YAC1B,aAAa,EAAE,QAAQ;YACvB,KAAK,EAAE,cAAc;YACrB,OAAO,EACL,oEAAoE;SACvE;QACD;YACE,EAAE,EAAE,QAAQ;YACZ,gBAAgB,EAAE,QAAQ;YAC1B,aAAa,EAAE,QAAQ;YACvB,KAAK,EAAE,QAAQ;YACf,OAAO,EAAE,6DAA6D;SACvE;QACD;YACE,EAAE,EAAE,SAAS;YACb,gBAAgB,EAAE,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S;YACf,QAAQ,EAAE,KAAK;SAChB,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,EAAE,CAAC;QAC7C,sBAAsB,CAAC;YACrB,GAAG,EAAE,oBAAoB;YACzB,KAAK,EAAE,oBAAoB;YAC3B,WAAW,EACT,2LAA2L;YAC7L,OAAO,EACL,oEAAoE;YACtE,KAAK,EAAE,MAAM;YACb,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,KAAK;YACf,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;gBACzB,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,6BAA6B,EAAE;oBAC1D,OAAO,EAAE;wBACP,eAAe,EAAE,KAAK;wBACtB,YAAY,EAAE,iBAAiB;qBAChC;iBACF,CAAC,CAAC;gBACH,OAAO,QAAQ,CAAC,EAAE;oBAChB,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE;oBACd,CAAC,CAAC;wBACE,EAAE,EAAE,KAAK;wBACT,KAAK,EAAE,kCAAkC,QAAQ,CAAC,MAAM,IAAI;qBAC7D,CAAC;YACR,CAAC;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC","sourcesContent":["/**\n * Framework-level secret registrations.\n *\n * Side-effect module — imported by the core-routes plugin at boot so the\n * sidebar settings UI and the `/_agent-native/secrets` list route surface the\n * relevant keys in every template.\n *\n * Each call uses a `getRequiredSecret` guard so a template that has already\n * registered the same key (often with stricter settings like `required: true`)\n * wins — the framework registration is a fallback, not an override.\n *\n * OPENAI_API_KEY is optional framework-wide because it enables the shared\n * realtime speech-to-speech agent mode. Templates can pre-register the same\n * key with stricter requirements; the guard below preserves their definition.\n */\n\nimport { getRequiredSecret, registerRequiredSecret } from \"./register.js\";\n\nexport function registerFrameworkSecrets(): void {\n const workspaceOAuthProviders = [\n {\n id: \"figma\",\n credentialPrefix: \"FIGMA\",\n oauthProvider: \"figma\",\n label: \"Figma\",\n docsUrl: \"https://developers.figma.com/docs/rest-api/oauth-apps/\",\n },\n {\n id: \"google_drive\",\n credentialPrefix: \"GOOGLE\",\n oauthProvider: \"google\",\n label: \"Google Drive\",\n docsUrl:\n \"https://developers.google.com/identity/protocols/oauth2/web-server\",\n },\n {\n id: \"github\",\n credentialPrefix: \"GITHUB\",\n oauthProvider: \"github\",\n label: \"GitHub\",\n docsUrl: \"https://docs.github.com/apps/oauth-apps/building-oauth-apps\",\n },\n {\n id: \"hubspot\",\n credentialPrefix: \"HUBSPOT\",\n oauthProvider: \"hubspot\",\n label: \"HubSpot\",\n docsUrl:\n \"https://developers.hubspot.com/docs/apps/developer-platform/build-apps/authentication/oauth/oauth-quickstart-guide\",\n },\n {\n id: \"salesforce\",\n credentialPrefix: \"SALESFORCE\",\n oauthProvider: \"salesforce\",\n label: \"Salesforce\",\n docsUrl:\n \"https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_web_server_oauth_flow.htm\",\n },\n {\n id: \"jira\",\n credentialPrefix: \"JIRA\",\n oauthProvider: \"jira\",\n label: \"Jira Cloud\",\n docsUrl:\n \"https://developer.atlassian.com/cloud/jira/platform/oauth-2-3lo-apps/\",\n },\n {\n id: \"sentry\",\n credentialPrefix: \"SENTRY\",\n oauthProvider: \"sentry\",\n label: \"Sentry\",\n docsUrl: \"https://docs.sentry.io/api/auth/\",\n },\n {\n id: \"notion\",\n credentialPrefix: \"NOTION\",\n oauthProvider: \"notion\",\n label: \"Notion\",\n docsUrl: \"https://developers.notion.com/docs/authorization\",\n },\n ] as const;\n\n for (const provider of workspaceOAuthProviders) {\n const prefix = provider.credentialPrefix;\n for (const credential of [\n { suffix: \"CLIENT_ID\", label: \"OAuth client ID\" },\n { suffix: \"CLIENT_SECRET\", label: \"OAuth client secret\" },\n ] as const) {\n const key = `${prefix}_${credential.suffix}`;\n if (!getRequiredSecret(key)) {\n registerRequiredSecret({\n key,\n label: `${provider.label} ${credential.label}`,\n description: `Workspace-owned ${provider.label} OAuth application credential. Tokens granted by users are stored separately and encrypted.`,\n docsUrl: provider.docsUrl,\n scope: \"workspace\",\n kind: \"api-key\",\n required: false,\n });\n }\n }\n\n const connectionKey = `${prefix}_CONNECTED`;\n if (!getRequiredSecret(connectionKey)) {\n registerRequiredSecret({\n key: connectionKey,\n label: `${provider.label} account`,\n description: `Connect a ${provider.label} account for scoped workspace imports.`,\n docsUrl: provider.docsUrl,\n scope: \"user\",\n kind: \"oauth\",\n required: false,\n oauthProvider: provider.oauthProvider,\n oauthConnectUrl: `/_agent-native/connections/oauth/${provider.id}/start`,\n });\n }\n }\n\n if (!getRequiredSecret(\"OPENAI_API_KEY\")) {\n registerRequiredSecret({\n key: \"OPENAI_API_KEY\",\n label: \"OpenAI API key\",\n description:\n \"Optional fallback for realtime voice when Builder is not connected, and for OpenAI transcription.\",\n docsUrl: \"https://platform.openai.com/api-keys\",\n scope: \"user\",\n kind: \"api-key\",\n required: false,\n validator: async (value) => {\n const response = await fetch(\"https://api.openai.com/v1/models\", {\n headers: { Authorization: `Bearer ${value}` },\n });\n return response.ok\n ? { ok: true }\n : {\n ok: false,\n error: `OpenAI rejected the key (HTTP ${response.status}).`,\n };\n },\n });\n }\n\n // Web-search tool backends — optional; the tool selects the first\n // configured manual key at call time, then falls back to Builder Connect.\n const webSearchKeys: Array<{\n key: string;\n label: string;\n description: string;\n docsUrl: string;\n }> = [\n {\n key: \"BRAVE_SEARCH_API_KEY\",\n label: \"Brave Search API Key\",\n description:\n \"Enables the web-search agent tool via Brave Search. Optional when Builder.io is connected for managed web search.\",\n docsUrl: \"https://brave.com/search/api/\",\n },\n {\n key: \"TAVILY_API_KEY\",\n label: \"Tavily API Key\",\n description:\n \"Enables the web-search agent tool via Tavily. Used as fallback when BRAVE_SEARCH_API_KEY is not set and before Builder-managed search.\",\n docsUrl: \"https://tavily.com/\",\n },\n {\n key: \"EXA_API_KEY\",\n label: \"Exa API Key\",\n description:\n \"Enables the web-search agent tool via Exa. Used as fallback when Brave and Tavily are not set and before Builder-managed search.\",\n docsUrl: \"https://exa.ai/\",\n },\n {\n key: \"FIRECRAWL_API_KEY\",\n label: \"Firecrawl API Key\",\n description:\n \"Enables the web-search agent tool via Firecrawl. Used as fallback when Brave, Tavily, and Exa are not set and before Builder-managed search.\",\n docsUrl: \"https://firecrawl.dev/\",\n },\n ];\n\n for (const entry of webSearchKeys) {\n if (!getRequiredSecret(entry.key)) {\n registerRequiredSecret({\n key: entry.key,\n label: entry.label,\n description: entry.description,\n docsUrl: entry.docsUrl,\n scope: \"workspace\",\n kind: \"api-key\",\n required: false,\n });\n }\n }\n\n if (!getRequiredSecret(\"GITHUB_TOKEN\")) {\n registerRequiredSecret({\n key: \"GITHUB_TOKEN\",\n label: \"GitHub token\",\n description:\n \"Enables connector-scoped repository file reads and writes for headless/cloud agent runs.\",\n docsUrl:\n \"https://docs.github.com/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens\",\n scope: \"workspace\",\n kind: \"api-key\",\n required: false,\n });\n }\n\n if (!getRequiredSecret(\"FIGMA_ACCESS_TOKEN\")) {\n registerRequiredSecret({\n key: \"FIGMA_ACCESS_TOKEN\",\n label: \"Figma access token\",\n description:\n \"Optional fallback for reading Figma file and node context when the hosted Figma MCP server is unavailable. Generate a personal access token with current_user:read and file_content:read.\",\n docsUrl:\n \"https://developers.figma.com/docs/rest-api/personal-access-tokens/\",\n scope: \"user\",\n kind: \"api-key\",\n required: false,\n validator: async (value) => {\n const response = await fetch(\"https://api.figma.com/v1/me\", {\n headers: {\n \"X-Figma-Token\": value,\n \"User-Agent\": \"AgentNative/1.0\",\n },\n });\n return response.ok\n ? { ok: true }\n : {\n ok: false,\n error: `Figma rejected the token (HTTP ${response.status}).`,\n };\n },\n });\n }\n}\n"]}
|
package/dist/secrets/routes.d.ts
CHANGED
|
@@ -34,37 +34,37 @@ export declare function createListSecretsHandler(): import("h3").EventHandlerWit
|
|
|
34
34
|
/** POST /_agent-native/secrets/:key — write a secret. */
|
|
35
35
|
export declare function createWriteSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
36
36
|
error: string;
|
|
37
|
-
ok?: undefined;
|
|
38
37
|
status?: undefined;
|
|
38
|
+
ok?: undefined;
|
|
39
39
|
} | {
|
|
40
|
-
error?: undefined;
|
|
41
40
|
ok: boolean;
|
|
42
41
|
status: string;
|
|
42
|
+
error?: undefined;
|
|
43
43
|
} | {
|
|
44
|
-
ok?: undefined;
|
|
45
44
|
error: string;
|
|
46
45
|
removed?: undefined;
|
|
46
|
+
ok?: undefined;
|
|
47
47
|
} | {
|
|
48
|
-
error?: undefined;
|
|
49
48
|
ok: boolean;
|
|
50
49
|
removed: boolean;
|
|
50
|
+
error?: undefined;
|
|
51
51
|
}>>;
|
|
52
52
|
/**
|
|
53
53
|
* POST /_agent-native/secrets/:key/test — re-run the validator against the
|
|
54
54
|
* current stored value without changing anything. Useful for the "Test" button.
|
|
55
55
|
*/
|
|
56
56
|
export declare function createTestSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
57
|
-
ok?: undefined;
|
|
58
57
|
error: string;
|
|
59
58
|
note?: undefined;
|
|
59
|
+
ok?: undefined;
|
|
60
60
|
} | {
|
|
61
|
-
error?: undefined;
|
|
62
61
|
ok: boolean;
|
|
63
62
|
note?: undefined;
|
|
64
|
-
} | {
|
|
65
63
|
error?: undefined;
|
|
64
|
+
} | {
|
|
66
65
|
ok: boolean;
|
|
67
66
|
note: string;
|
|
67
|
+
error?: undefined;
|
|
68
68
|
} | {
|
|
69
69
|
note?: undefined;
|
|
70
70
|
ok: boolean;
|
|
@@ -95,12 +95,12 @@ export interface AdHocSecretPayload {
|
|
|
95
95
|
export declare function createAdHocSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<AdHocSecretPayload[] | {
|
|
96
96
|
error: string;
|
|
97
97
|
} | {
|
|
98
|
-
error?: undefined;
|
|
99
98
|
ok: boolean;
|
|
100
99
|
key: string;
|
|
101
|
-
} | {
|
|
102
100
|
error?: undefined;
|
|
101
|
+
} | {
|
|
103
102
|
ok: boolean;
|
|
104
103
|
removed: boolean;
|
|
104
|
+
error?: undefined;
|
|
105
105
|
}>>;
|
|
106
106
|
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-tools.d.ts","sourceRoot":"","sources":["../../../src/server/agent-chat/context-tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAWnE;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"context-tools.d.ts","sourceRoot":"","sources":["../../../src/server/agent-chat/context-tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAWnE;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAuL7D,CAAC;AAEF,wBAAgB,2BAA2B,IAAI,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CA+BzE;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAsCtE;AAMD,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,OAAO,GACpB,MAAM,CAIR;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAgP5D;AAED,wBAAgB,6BAA6B,IAAI,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAyD3E"}
|
|
@@ -91,6 +91,15 @@ Convert natural language to 5-field cron format:
|
|
|
91
91
|
- "every hour" → \`0 * * * *\`
|
|
92
92
|
- "every monday at 9am" → \`0 9 * * 1\`
|
|
93
93
|
|
|
94
|
+
When a recurring job needs a connected MCP, discover the exact MCP tool names
|
|
95
|
+
available in the current user/org context and pass them in the create call's
|
|
96
|
+
\`mcpTools\` array. Bind only the tools the job needs; do not put an MCP URL,
|
|
97
|
+
OAuth token, or arbitrary endpoint in the instructions. The scheduler resolves
|
|
98
|
+
the selected tools with the job owner's existing connector grant and fails
|
|
99
|
+
clearly if a connector is revoked or a selected tool disappears. For imports,
|
|
100
|
+
normalize the provider response and call the app's bounded idempotent import
|
|
101
|
+
action once with the full batch rather than issuing one write per item.
|
|
102
|
+
|
|
94
103
|
#### Suggesting "Save as automation"
|
|
95
104
|
|
|
96
105
|
When you finish a task that has obvious recurring value — daily inbox triage, weekly metrics summaries, archive sweeps, status digests, anything the user would plausibly want re-run on a fresh cadence — close the response with ONE short line offering to save it. Examples:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-tools.js","sourceRoot":"","sources":["../../../src/server/agent-chat/context-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mCAAmC,EAAE,MAAM,oBAAoB,CAAC;AAEzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,8EAA8E;AAC9E,mEAAmE;AACnE,yEAAyE;AACzE,6EAA6E;AAC7E,sBAAsB;AACtB,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAA2B;IAChE,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;8FAoBoF;IAE5F,cAAc,EAAE;;;;;;;+KAO6J;IAE7K,aAAa,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qiBAiCohB;IAEniB,gBAAgB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;0YAyBsX;IAExY,OAAO,EAAE;;yoBAE8nB;IAEvoB,OAAO,EAAE;;;;;;;;;;;;;;;;;;;2HAmBgH;IAEzH,YAAY,EAAE;;;;;;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HAA0H;yBAC7H;wBACD,WAAW,EAAE;4BACX,IAAI,EAAE,QAAQ;4BACd,WAAW,EACT,8HAA8H;yBACjI;qBACF;oBACD,QAAQ,EAAE,CAAC,QAAQ,CAAC;iBACrB;aACF;YACD,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC;SACxD;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { ACTION_CHAT_UI_DATA_WIDGET_RENDERER } from \"../../action-ui.js\";\nimport type { ActionEntry } from \"../../agent/production-agent.js\";\nimport { dataWidgetResultSchema } from \"../../data-widgets/index.js\";\nimport { getRequestRunContext } from \"../request-context.js\";\n\n// ---------------------------------------------------------------------------\n// Framework-owned \"context\" action entries: get-framework-context,\n// refresh-screen, the URL/ask-question tools, and the native data-widget\n// renderer. These are generic, template-agnostic tools registered into every\n// app's tool surface.\n// ---------------------------------------------------------------------------\n\n/**\n * Verbose framework sections returned by the `get-framework-context` tool.\n * Keyed by topic so the agent can request specific sections.\n * Not template-specific — lives outside buildFrameworkPrompts().\n */\nexport const FRAMEWORK_CONTEXT_SECTIONS: Record<string, string> = {\n embeds: `### Inline Embeds\n\nYou can embed an interactive view inline in your chat reply by writing an \\`embed\\` fenced code block. The chat renderer swaps the fence for a sandboxed iframe pointing at a route inside this app.\n\nSyntax:\n\n\\`\\`\\`\\`\n\\`\\`\\`embed\nsrc: /some/path?param=value\naspect: 16/9\ntitle: Optional label\n\\`\\`\\`\n\\`\\`\\`\\`\n\nKeys:\n- \\`src\\` (required) — **must be a same-origin path starting with \\`/\\`**. Cross-origin URLs are blocked. No \\`javascript:\\` or \\`data:\\` URLs.\n- \\`aspect\\` (optional) — one of \\`16/9\\` (default), \\`4/3\\`, \\`3/2\\`, \\`2/1\\`, \\`21/9\\`, \\`1/1\\`.\n- \\`title\\` (optional) — accessible label / hover tooltip.\n- \\`height\\` (optional) — fixed pixel height when aspect ratio isn't a good fit.\n\nUse for charts, visualizations, previews. Don't use for simple text/tables or external sites.`,\n\n \"chat-history\": `### Chat History\n\nYou can search and restore previous chat conversations using \\`chat-history\\`:\n- \\`chat-history\\` (action: \"search\") — Search or list past chat threads by keyword. Archived threads are excluded by default; pass \\`includeArchived: true\\` to also see them.\n- \\`chat-history\\` (action: \"open\") — Open a chat thread in the UI as a new tab and focus it\n- \\`chat-history\\` (actions: \"rename\", \"pin\", \"unpin\", \"archive\") — Organize a known chat thread by ID. Archiving a thread hides it from the default chat list and search.\n\nWhen the user asks to find a previous conversation, use \\`chat-history\\` with action \"search\" first to find matching threads, then action \"open\" to restore the one they want.`,\n\n \"agent-teams\": `### Agent Teams — Orchestration\n\nYou can delegate to background sub-agents with the \\`agent-teams\\` tool:\n- \\`agent-teams\\` (action: \"spawn\") — Launch a sub-agent on a task. It runs in its own thread with a clean context while you stay available; a live preview card appears in the chat. The spawn result confirms launch only, not completion. Optionally pass a custom agent profile from \\`agents/*.md\\` via the \\`agent\\` parameter.\n- \\`agent-teams\\` (action: \"status\") — Check a running sub-agent's progress.\n- \\`agent-teams\\` (action: \"read-result\") — Read a finished sub-agent's output.\n- \\`agent-teams\\` (action: \"send\") — Message a running sub-agent.\n- \\`agent-teams\\` (action: \"list\") — List sub-agent tasks.\n\nSub-agents inherit all of your template tools but **cannot spawn sub-agents themselves** — only you orchestrate.\n\n**User intent phrases.** If the user asks you to use a \"sub-agent\" or \"background agent\", that is explicit delegation intent. Also treat phrases like \"run these in the background\", \"kick off the rest\", \"run the queued items\", \"batch run these jobs\", \"parallelize this\", or \"start the next batch\" as delegation intent when the context is a set of independent work items.\n\n**Spawn is not completion.** A successful \\`spawn\\` call means the sub-agent started and is running. Tell the user it started, show the task id if useful, and then use \\`status\\`/\\`list\\`/\\`read-result\\` to monitor it. Never say the delegated task \"completed\", \"ran successfully\", or \"finished\" until \\`status\\` or \\`read-result\\` reports \\`completed\\` or \\`errored\\`. If a task is still running, say that plainly.\n\n**Default to doing the work yourself in this thread.** A sub-agent costs real tokens and adds a merge step, so reach for one only when delegation clearly pays for that overhead.\n\n**Delegate ONE sub-agent** when a task is self-contained and heavy: deep research, long multi-step content generation, or a noisy scan whose intermediate steps would clutter this thread. The sub-agent gets its own clean context and hands you back a distilled result.\n\n**Fan out to MULTIPLE sub-agents ONLY** for units of work that are genuinely independent and don't depend on each other's decisions — e.g. research three unrelated competitors, summarize five separate threads, draft sections that don't reference one another. Each gets a distinct slice.\n\n**Do NOT parallelize tightly-coupled work** — one cohesive artifact, edits that must agree with each other, or anything needing a single consistent voice or style. Parallel sub-agents can't see each other's choices and their outputs will clash. For coupled work, do it yourself, or chain sub-agents one at a time, feeding each result into the next.\n\n**Cap fan-out:** aim for 1, use up to ~3, and go beyond that only for clearly independent bulk work. More sub-agents means more tokens and a harder merge.\n\n**Briefing contract.** A sub-agent starts in a fresh thread and can only see the brief you give it — it cannot see this conversation or ask you to clarify before it runs. Make every brief self-contained:\n1. **Objective** — what \"done\" looks like, in a sentence or two.\n2. **Context** — the specific facts it needs from this conversation: IDs, names, the user's actual goal, constraints, prior decisions. Paste the specifics; don't assume it knows them.\n3. **Output format** — what to return and how (e.g. \"a 3-bullet summary with source links\", \"the drafted email body only\") so the result drops cleanly into your synthesis.\n4. **Boundaries** — what NOT to do, and for parallel sub-agents, which slice is theirs so they don't overlap.\n\nPut the objective and output format in \\`task\\`; put longer context in \\`instructions\\`.\n\n**Synthesis discipline.** After the sub-agents you depend on finish, poll \\`status\\`/\\`list\\` until they're complete, then pull each one's output with \\`read-result\\`. Do NOT paste their outputs back to back. Read all results, reconcile any disagreements, de-duplicate, and write ONE integrated answer in your own voice. If two sub-agents conflict, resolve it or flag the discrepancy explicitly rather than presenting both. When findings came from distinct investigations, briefly note which finding came from where so the user can trust the merge.`,\n\n \"recurring-jobs\": `### Recurring Jobs\n\nYou can create recurring jobs that run on a cron schedule. Jobs are resource files under \\`jobs/\\`.\n\n- \\`manage-jobs\\` (action: \"create\") — Create a new recurring job with a cron schedule and instructions\n- \\`manage-jobs\\` (action: \"list\") — List all recurring jobs and their status\n- \\`manage-jobs\\` (action: \"update\") — Update a job's schedule, instructions, or toggle enabled/disabled\n- Delete a job with the \\`resources\\` tool: \\`action: \"delete\"\\`, \\`path: \"jobs/<name>.md\"\\`\n\nConvert natural language to 5-field cron format:\n- \"every morning\" / \"daily at 9am\" → \\`0 9 * * *\\`\n- \"every weekday at 9am\" → \\`0 9 * * 1-5\\`\n- \"every hour\" → \\`0 * * * *\\`\n- \"every monday at 9am\" → \\`0 9 * * 1\\`\n\n#### Suggesting \"Save as automation\"\n\nWhen you finish a task that has obvious recurring value — daily inbox triage, weekly metrics summaries, archive sweeps, status digests, anything the user would plausibly want re-run on a fresh cadence — close the response with ONE short line offering to save it. Examples:\n\n- After \"Summarize my unread emails\": _\"Want me to run this every morning?\"_\n- After \"What's our top traffic source this week\": _\"Want a weekly digest on Mondays?\"_\n- After \"Archive emails older than 30 days\": _\"Should I run this every Sunday?\"_\n\nIf the user says yes, call \\`manage-jobs\\` (action: \"create\") with the original prompt as the job's instructions and the cadence they confirmed.\n\nDo NOT add this offer for one-shot work: lookups (find Alice, what's the schema, who reported X), single drafts/replies, navigation requests, or any task whose value is in the moment. Skip it when the prompt is already explicitly recurring (the user said \"every morning…\" — you'd be asking what they already told you). One short sentence at most; do not turn it into a list of cadence options.`,\n\n builder: `### Connecting Builder.io\n\nWhen the user asks to connect Builder.io or you hit a \"Builder not configured\" error, call the \\`connect-builder\\` tool. It renders a Connect/code-change card inline — do NOT write out multi-step setup instructions yourself. Inspect the returned \\`builderEnabled\\` flag: \\`true\\` means Builder Cloud Agents can take the code-change handoff, while \\`false\\` means this requires a code change and the user should edit locally or use Builder.io to edit this code in the cloud and continue customizing the app any way they like. If Builder Cloud Agents are not available for this workspace, never send the user to Builder org settings or beta settings.`,\n\n browser: `### Browser Automation\n\nYou can activate a real Chrome browser via Builder.io for tasks that need full page rendering:\n- Extracting design tokens from JS-heavy or SPA websites (computed styles, rendered colors/fonts)\n- Taking screenshots of live pages\n- Testing interactive flows on deployed URLs\n- Reading content from pages that require JavaScript execution\n\n**How to use:**\n1. In local development, call \\`set-browser-control\\` with \\`{\"enabled\":true,\"backend\":\"chrome-devtools\"}\\` after confirming once with the user. In production, use \\`activate-browser\\` for Builder-provisioned Chrome.\n2. On your next action, use \\`mcp__chrome-devtools__navigate_page\\`, \\`mcp__chrome-devtools__evaluate_script\\`, \\`mcp__chrome-devtools__take_screenshot\\`, etc.\n3. If Builder is not connected, call \\`connect-builder\\` first\n\n**When to recommend browser automation:**\n- User wants to import a design system from a URL (JS-rendered sites give almost no useful data from plain HTML fetch)\n- User asks you to check how a deployed site looks or behaves\n- Any task involving reading computed/rendered page state\n- When \\`web-request\\` returns minimal/skeleton HTML from a modern SPA\n\nPrefer \\`web-request\\` for simple API calls and static pages. Use browser automation when you need the real rendered page.`,\n\n \"call-agent\": `### call-agent — External Apps Only\n\nThe \\`call-agent\\` tool sends a message to a DIFFERENT, separately-deployed app's agent (A2A protocol). It is **not** for calling actions within the current app.\n\n**NEVER use \\`call-agent\\` to:**\n- Call your own app by name\n- Perform tasks you can accomplish with your own registered tools\n\n**ONLY use \\`call-agent\\` when:**\n- The user explicitly asks you to communicate with a different app\n- You need data that only another deployed app can provide\n- You need brand-consistent generated media and this app does not have a native generation action; call agent \"assets\" and keep returned asset IDs and URLs verbatim\n\nIf \\`call-agent\\` says a downstream agent accepted the subtask and will post its result separately, do not call that same agent again for the same subtask. Continue any remaining work and answer with the completed results you have.`,\n\n memory: `### Structured Memory\n\nYour memory index (\\`memory/MEMORY.md\\`) is loaded at the start of every conversation.\n\n**Tools:**\n- \\`save-memory\\` — Create or update a memory (name, type, description, content)\n- \\`delete-memory\\` — Remove a memory and its index entry\n- \\`resources\\` with \\`action: \"read\"\\` and \\`path: \"memory/<name>.md\"\\` — Read the full content of a specific memory\n\n**Memory types:** user, feedback, project, reference\n\n**When to save (proactively):**\n- User corrects your approach → \\`feedback\\`\n- User shares preferences → \\`user\\`\n- Non-obvious pattern or gotcha → \\`feedback\\`\n- Personal context (contacts, team) → \\`user\\`\n- Project context to track → \\`project\\`\n\n**Rules:**\n- Don't save things obvious from code or standard framework behavior\n- When updating, read first and merge — don't overwrite\n- Keep descriptions concise\n- One memory per logical topic`,\n\n \"sql-tools\": `### SQL Tools\n\nWhen database tools are enabled, \\`db-schema\\` refreshes the schema and \\`db-query\\` runs read-only SELECT queries with current user/org scoping. Raw SQL write tools are only available when the app explicitly opts into database write tools; by default, writes go through typed app actions. Some apps configure database tools as read-only or off; only use tools that are actually present in your tool list.\n\n- \\`db-schema\\` — refresh the full schema with indexes and foreign keys\n- \\`db-query\\` — run a SELECT (read-only; results already filtered to the current user/org)\n- \\`db-exec\\` — only when present: run INSERT / UPDATE / DELETE / REPLACE for scoped maintenance. For normal product data writes, use a typed app action instead.\n- \\`db-patch\\` — only when present: surgical search-and-replace on a large text column. If a typed app action exists for the resource, use that action.\n\n### When to pick which SQL tool\n- A template-specific action exists for the table → use that action (it encodes business rules and pushes live Yjs updates)\n- Read data → \\`db-query\\`. Never re-add \\`WHERE owner_email = ...\\` — scoping already applies it.\n- Raw write tools are present and no app action exists → use \\`db-exec\\` or \\`db-patch\\` only for deliberate maintenance, not normal product workflows.\n\n### External data sources vs the app database\nThe \\`db-*\\` tools ONLY query the app's own SQL database. They do NOT reach external data warehouses. If the user asks about tables NOT in the schema, use the appropriate template action instead.`,\n};\n\nexport function createFrameworkContextEntry(): Record<string, ActionEntry> {\n const topicList = Object.keys(FRAMEWORK_CONTEXT_SECTIONS).join(\", \");\n return {\n \"get-framework-context\": {\n tool: {\n description: `Read detailed framework instructions for a specific capability. Available topics: ${topicList}. Call with topic=\"all\" to get everything.`,\n parameters: {\n type: \"object\" as const,\n properties: {\n topic: {\n type: \"string\",\n description: `Topic to read. One of: ${topicList}, or \"all\" for everything.`,\n },\n },\n required: [\"topic\"],\n },\n },\n run: async (args: Record<string, string>) => {\n const topic = String(args.topic ?? \"all\").toLowerCase();\n if (topic === \"all\") {\n return Object.values(FRAMEWORK_CONTEXT_SECTIONS).join(\"\\n\\n\");\n }\n const section = FRAMEWORK_CONTEXT_SECTIONS[topic];\n if (!section) {\n return `Unknown topic \"${topic}\". Available: ${topicList}`;\n }\n return section;\n },\n readOnly: true,\n },\n };\n}\n\n/**\n * Creates the `refresh-screen` tool. Writes a bump to `application_state`\n * under a well-known key; the client's `useDbSync` watches for this and\n * invalidates react-query caches so the on-screen UI re-fetches its data\n * without a full page reload.\n *\n * This is the standard way for the agent to say \"the data on the screen\n * just changed, please refresh it\" — e.g. after editing a dashboard config,\n * updating a form schema, or mutating a row that the current view renders.\n */\nexport function createRefreshScreenEntry(): Record<string, ActionEntry> {\n return {\n \"refresh-screen\": {\n // Writes __screen_refresh__ to application_state, which emits its own\n // distinct `screen-refresh` poll event. Don't double-emit a generic\n // `action` event on top of that.\n readOnly: true,\n // Refetching volatile on-screen state is the entire point of this\n // tool — an identical repeat call (even with the same scope) is a\n // legitimate re-refresh, not a redundant read to skip.\n dedupe: false,\n tool: {\n description:\n \"Manually refresh the user's current screen. The framework ALREADY auto-refreshes after any successful mutating action tool call (template actions and any enabled raw DB write tools) — you do NOT need to call this after a normal action. Use it only when (a) you mutated data via a path the framework can't detect (e.g. a direct write to an external system the app mirrors), or (b) you want to pass a `scope` hint so the UI narrows which queries to refetch. The UI re-fetches its queries without a full page reload.\",\n parameters: {\n type: \"object\",\n properties: {\n scope: {\n type: \"string\",\n description:\n \"Optional hint describing what changed (e.g. 'dashboard', 'form', 'settings'). Templates may use it to narrow which queries to invalidate; if omitted, all queries are invalidated.\",\n },\n },\n },\n },\n run: async (args) => {\n const { writeAppState } =\n await import(\"../../application-state/script-helpers.js\");\n const nonce = Date.now();\n const scope = typeof args?.scope === \"string\" ? args.scope : undefined;\n await writeAppState(SCREEN_REFRESH_KEY, {\n nonce,\n ...(scope ? { scope } : {}),\n });\n return `refreshed${scope ? ` (scope: ${scope})` : \"\"}`;\n },\n },\n };\n}\n\n/** Well-known application-state key used by the refresh-screen tool. */\nconst SCREEN_REFRESH_KEY = \"__screen_refresh__\";\nconst SAFE_BROWSER_TAB_ID_RE = /^[A-Za-z0-9_-]{1,96}$/;\n\nexport function appStateKeyForBrowserTab(\n key: string,\n browserTabId: unknown,\n): string {\n if (typeof browserTabId !== \"string\") return key;\n const trimmed = browserTabId.trim();\n return SAFE_BROWSER_TAB_ID_RE.test(trimmed) ? `${key}:${trimmed}` : key;\n}\n\n/**\n * Creates the `set-search-params` / `set-url-path` tools. Writes a one-shot\n * URL command to application_state; the client's URLSync component applies\n * it via react-router (no full page reload) and then deletes the command.\n *\n * This is how the agent edits URL state — filter query params, route\n * changes, hash — without needing a per-template navigate action. The\n * current URL is visible to the agent via the auto-injected `<current-url>`\n * block, which includes parsed search params.\n */\nexport function createUrlTools(): Record<string, ActionEntry> {\n return {\n \"set-search-params\": {\n // Writes __set_url__ to application_state, which the app-state watcher\n // already surfaces as a poll event. No need to double-emit.\n readOnly: true,\n tool: {\n description:\n \"Update the URL query string on the user's current page. Use this to change dashboard/list filters, search terms, or any other state the app stores in `?foo=bar` style query params. One-shot — the UI applies it in ~1s without a page reload. See the current URL + parsed search params in the auto-injected `<current-url>` block. Keys are the exact query param names as they appear in the URL (e.g. `f_pubDateStart`, not just `pubDateStart`). Set a value to null or empty string to clear that param. By default merges over existing params — pass `merge: false` to replace them all.\",\n parameters: {\n type: \"object\",\n properties: {\n params: {\n type: \"object\",\n description:\n 'Map of query param → value. Each value is a string, or null/\"\" to clear. Example: {\"f_pubDateStart\": null, \"f_cadence\": \"MONTH\"}.',\n },\n merge: {\n type: \"string\",\n description:\n '\"true\" (default) merges over existing params; \"false\" replaces them entirely.',\n enum: [\"true\", \"false\"],\n },\n },\n required: [\"params\"],\n },\n },\n run: async (args) => {\n const params = (args?.params ?? {}) as unknown as Record<\n string,\n string | null\n >;\n const merge = (args as any)?.merge !== \"false\";\n const { writeAppState } =\n await import(\"../../application-state/script-helpers.js\");\n await writeAppState(\n appStateKeyForBrowserTab(\n \"__set_url__\",\n getRequestRunContext()?.browserTabId,\n ),\n {\n searchParams: params,\n mergeSearchParams: merge,\n // Unique-per-write token. The client's URLSync hook dedups by this\n // so a fire-and-forget DELETE that loses its race against the next\n // polling refetch can't cause the same URL command to be applied\n // repeatedly (which caused the editor to bounce between slides\n // when an agent turn errored partway through).\n _writeId: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,\n },\n );\n const keys = Object.keys(params);\n return `set-search-params: ${keys.length} key${keys.length === 1 ? \"\" : \"s\"}${merge ? \"\" : \" (replace)\"}`;\n },\n },\n \"set-url-path\": {\n // Same as set-search-params — writes application_state, already emits\n // via the app-state watcher.\n readOnly: true,\n tool: {\n description:\n \"Navigate the user to a different pathname, optionally also setting search params. For most template-specific routing prefer the template's `navigate` action if it exists — this is the generic fallback. One-shot, applied by the client without a page reload.\",\n parameters: {\n type: \"object\",\n properties: {\n pathname: {\n type: \"string\",\n description: \"New URL pathname (e.g. '/adhoc/weekly').\",\n },\n params: {\n type: \"object\",\n description:\n 'Optional query params to set alongside the path change. String values set, null/\"\" clears.',\n },\n merge: {\n type: \"string\",\n description:\n '\"true\" (default) merges over existing params; \"false\" starts fresh.',\n enum: [\"true\", \"false\"],\n },\n },\n required: [\"pathname\"],\n },\n },\n run: async (args) => {\n const pathname = String(args?.pathname ?? \"\");\n if (!pathname.startsWith(\"/\")) {\n return \"Error: pathname must start with '/'.\";\n }\n const params = (args?.params ?? {}) as unknown as Record<\n string,\n string | null\n >;\n const merge = (args as any)?.merge !== \"false\";\n const { writeAppState } =\n await import(\"../../application-state/script-helpers.js\");\n await writeAppState(\n appStateKeyForBrowserTab(\n \"__set_url__\",\n getRequestRunContext()?.browserTabId,\n ),\n {\n pathname,\n searchParams: params,\n mergeSearchParams: merge,\n // See note in set-search-params: unique-per-write dedup token so a\n // race between GET and consume-DELETE in URLSync can't re-apply\n // this command.\n _writeId: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,\n },\n );\n return `set-url-path: ${pathname}`;\n },\n },\n \"ask-question\": {\n tool: {\n description:\n \"Ask the user a multiple-choice clarifying question and render it inline in the chat. Use this ONLY when you are genuinely blocked on a decision you cannot resolve from context and a wrong guess would be costly — an ambiguous metric, date range, or grain; a real fork in approach. Present 2-5 concrete options and mark the most likely one recommended. Do NOT use it for confirmations, for things the user already specified, or to dodge easy work you could just do. Ask at most once per turn. Calling this yields the turn: stop and wait for the user's answer.\",\n parameters: {\n type: \"object\",\n properties: {\n question: {\n type: \"string\",\n description:\n \"The complete question to ask the user. Clear, specific, ends with a question mark.\",\n },\n header: {\n type: \"string\",\n description:\n 'Optional very short label (max ~12 chars) shown as a chip/heading above the question, e.g. \"Date range\", \"Approach\", \"Library\".',\n },\n options: {\n type: \"string\",\n description:\n 'A JSON array of 2-4 distinct, mutually-exclusive options (unless `allowMultiple` is true), each `{ \"label\": string, \"value\"?: string, \"description\"?: string, \"preview\"?: string, \"recommended\"?: boolean }`. `label` is 1-5 words; `description` explains the trade-off; `preview` is optional content (mockup, code snippet, short comparison) rendered under the option. `value` defaults to `label` when omitted. Mark the most likely option `\"recommended\": true`. Do NOT add an \"Other\" option — free text is provided automatically when `allowFreeText` is on.',\n },\n allowFreeText: {\n type: \"string\",\n description:\n 'Whether the user may also type a free-text \"Other\" answer. \"true\" (default) or \"false\".',\n enum: [\"true\", \"false\"],\n },\n allowMultiple: {\n type: \"string\",\n description:\n 'Whether the user may select more than one option (multi-select). \"true\" or \"false\" (default).',\n enum: [\"true\", \"false\"],\n },\n },\n required: [\"question\", \"options\"],\n },\n },\n run: async (args) => {\n const question = String(args?.question ?? \"\").trim();\n if (!question) return \"Error: 'question' is required.\";\n const header = String(args?.header ?? \"\").trim();\n const allowMultiple = String(args?.allowMultiple ?? \"\") === \"true\";\n const allowFreeText = String(args?.allowFreeText ?? \"true\") !== \"false\";\n\n let parsedOptions: unknown;\n try {\n parsedOptions = JSON.parse(String(args?.options ?? \"[]\"));\n } catch {\n return \"Error: 'options' must be a JSON array of { label, value?, description?, recommended? }.\";\n }\n if (!Array.isArray(parsedOptions) || parsedOptions.length === 0) {\n return \"Error: 'options' must be a non-empty JSON array of { label, value?, description?, recommended? }.\";\n }\n\n type AskOption = {\n label: string;\n value: string;\n description?: string;\n preview?: string;\n recommended?: boolean;\n };\n const options = parsedOptions\n .map((raw): AskOption | null => {\n const opt = (raw ?? {}) as Record<string, unknown>;\n const label =\n typeof opt.label === \"string\" && opt.label.trim()\n ? opt.label.trim()\n : typeof opt.value === \"string\"\n ? String(opt.value).trim()\n : \"\";\n if (!label) return null;\n const value =\n typeof opt.value === \"string\" && opt.value.trim()\n ? opt.value.trim()\n : label;\n const option: AskOption = { label, value };\n if (typeof opt.description === \"string\" && opt.description.trim()) {\n option.description = opt.description.trim();\n }\n if (typeof opt.preview === \"string\" && opt.preview.trim()) {\n option.preview = opt.preview;\n }\n if (opt.recommended === true) option.recommended = true;\n return option;\n })\n .filter((opt): opt is AskOption => opt !== null);\n if (options.length === 0) {\n return \"Error: 'options' must contain at least one option with a label.\";\n }\n\n // Shape must match the GuidedQuestionFlow renderer in\n // client/guided-questions.tsx: a `text-options` question whose options\n // carry `value`, with `multiSelect` for multi-pick and `allowOther` for\n // free text. The renderer otherwise injects \"Explore\"/\"Decide\" options,\n // which would be noise for a focused clarifying question, so disable them.\n const payload = {\n questions: [\n {\n id: \"q1\",\n type: \"text-options\" as const,\n question,\n ...(header ? { header } : {}),\n required: !allowFreeText,\n multiSelect: allowMultiple,\n allowOther: allowFreeText,\n includeExplore: false,\n includeDecide: false,\n options,\n },\n ],\n };\n\n const { writeAppState } =\n await import(\"../../application-state/script-helpers.js\");\n await writeAppState(\n appStateKeyForBrowserTab(\n \"guided-questions\",\n getRequestRunContext()?.browserTabId,\n ),\n payload,\n );\n return \"Asked the user a clarifying question and rendered it in the chat. Stop here and wait for their answer — do not proceed or assume an answer.\";\n },\n },\n };\n}\n\nexport function createDataWidgetActionEntries(): Record<string, ActionEntry> {\n return {\n \"render-data-widget\": {\n readOnly: true,\n parallelSafe: true,\n chatUI: {\n renderer: ACTION_CHAT_UI_DATA_WIDGET_RENDERER,\n title: \"Data widget\",\n description: \"Render a validated native data table or chart in chat.\",\n },\n tool: {\n description:\n \"Render a native Agent-Native chat data widget from compact, real data you already retrieved or the user provided. Use this for in-chat tables, charts, graphs, trends, and compact reports when no domain-specific action already returns a native widget. Never fabricate rows or metrics just to make a chart.\",\n parameters: {\n type: \"object\",\n properties: {\n widget: {\n type: \"string\",\n enum: [\"data-table\", \"data-chart\", \"data-insights\"],\n description:\n \"Widget kind. Use data-chart for a chart, data-table for a table, or data-insights for a combined summary/chart/table card.\",\n },\n widgetId: {\n type: \"string\",\n description: \"Optional stable widget identifier.\",\n },\n title: {\n type: \"string\",\n description: \"Optional widget title.\",\n },\n summary: {\n type: \"object\",\n description:\n \"Optional scalar summary values for data-insights cards.\",\n },\n display: {\n type: \"object\",\n description:\n \"Optional display metadata: title, description, primaryAction.\",\n },\n table: {\n type: \"object\",\n description:\n \"For data-table/data-insights: { title?, columns: [{ key, label, align? }], rows, totalRows?, sampledRows?, truncated? }.\",\n },\n chartSeries: {\n type: \"object\",\n description:\n \"For data-chart/data-insights: { type: 'bar'|'line'|'area', title?, xKey, series: [{ key, label, color? }], data, sampled? }.\",\n },\n },\n required: [\"widget\"],\n },\n },\n run: async (args) => dataWidgetResultSchema.parse(args),\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"context-tools.js","sourceRoot":"","sources":["../../../src/server/agent-chat/context-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mCAAmC,EAAE,MAAM,oBAAoB,CAAC;AAEzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,8EAA8E;AAC9E,mEAAmE;AACnE,yEAAyE;AACzE,6EAA6E;AAC7E,sBAAsB;AACtB,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,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Q,EAAE;4BACR,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,oCAAoC;yBAClD;wBACD,KAAK,EAAE;4BACL,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,wBAAwB;yBACtC;wBACD,OAAO,EAAE;4BACP,IAAI,EAAE,QAAQ;4BACd,WAAW,EACT,yDAAyD;yBAC5D;wBACD,OAAO,EAAE;4BACP,IAAI,EAAE,QAAQ;4BACd,WAAW,EACT,+DAA+D;yBAClE;wBACD,KAAK,EAAE;4BACL,IAAI,EAAE,QAAQ;4BACd,WAAW,EACT,0HAA0H;yBAC7H;wBACD,WAAW,EAAE;4BACX,IAAI,EAAE,QAAQ;4BACd,WAAW,EACT,8HAA8H;yBACjI;qBACF;oBACD,QAAQ,EAAE,CAAC,QAAQ,CAAC;iBACrB;aACF;YACD,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC;SACxD;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { ACTION_CHAT_UI_DATA_WIDGET_RENDERER } from \"../../action-ui.js\";\nimport type { ActionEntry } from \"../../agent/production-agent.js\";\nimport { dataWidgetResultSchema } from \"../../data-widgets/index.js\";\nimport { getRequestRunContext } from \"../request-context.js\";\n\n// ---------------------------------------------------------------------------\n// Framework-owned \"context\" action entries: get-framework-context,\n// refresh-screen, the URL/ask-question tools, and the native data-widget\n// renderer. These are generic, template-agnostic tools registered into every\n// app's tool surface.\n// ---------------------------------------------------------------------------\n\n/**\n * Verbose framework sections returned by the `get-framework-context` tool.\n * Keyed by topic so the agent can request specific sections.\n * Not template-specific — lives outside buildFrameworkPrompts().\n */\nexport const FRAMEWORK_CONTEXT_SECTIONS: Record<string, string> = {\n embeds: `### Inline Embeds\n\nYou can embed an interactive view inline in your chat reply by writing an \\`embed\\` fenced code block. The chat renderer swaps the fence for a sandboxed iframe pointing at a route inside this app.\n\nSyntax:\n\n\\`\\`\\`\\`\n\\`\\`\\`embed\nsrc: /some/path?param=value\naspect: 16/9\ntitle: Optional label\n\\`\\`\\`\n\\`\\`\\`\\`\n\nKeys:\n- \\`src\\` (required) — **must be a same-origin path starting with \\`/\\`**. Cross-origin URLs are blocked. No \\`javascript:\\` or \\`data:\\` URLs.\n- \\`aspect\\` (optional) — one of \\`16/9\\` (default), \\`4/3\\`, \\`3/2\\`, \\`2/1\\`, \\`21/9\\`, \\`1/1\\`.\n- \\`title\\` (optional) — accessible label / hover tooltip.\n- \\`height\\` (optional) — fixed pixel height when aspect ratio isn't a good fit.\n\nUse for charts, visualizations, previews. Don't use for simple text/tables or external sites.`,\n\n \"chat-history\": `### Chat History\n\nYou can search and restore previous chat conversations using \\`chat-history\\`:\n- \\`chat-history\\` (action: \"search\") — Search or list past chat threads by keyword. Archived threads are excluded by default; pass \\`includeArchived: true\\` to also see them.\n- \\`chat-history\\` (action: \"open\") — Open a chat thread in the UI as a new tab and focus it\n- \\`chat-history\\` (actions: \"rename\", \"pin\", \"unpin\", \"archive\") — Organize a known chat thread by ID. Archiving a thread hides it from the default chat list and search.\n\nWhen the user asks to find a previous conversation, use \\`chat-history\\` with action \"search\" first to find matching threads, then action \"open\" to restore the one they want.`,\n\n \"agent-teams\": `### Agent Teams — Orchestration\n\nYou can delegate to background sub-agents with the \\`agent-teams\\` tool:\n- \\`agent-teams\\` (action: \"spawn\") — Launch a sub-agent on a task. It runs in its own thread with a clean context while you stay available; a live preview card appears in the chat. The spawn result confirms launch only, not completion. Optionally pass a custom agent profile from \\`agents/*.md\\` via the \\`agent\\` parameter.\n- \\`agent-teams\\` (action: \"status\") — Check a running sub-agent's progress.\n- \\`agent-teams\\` (action: \"read-result\") — Read a finished sub-agent's output.\n- \\`agent-teams\\` (action: \"send\") — Message a running sub-agent.\n- \\`agent-teams\\` (action: \"list\") — List sub-agent tasks.\n\nSub-agents inherit all of your template tools but **cannot spawn sub-agents themselves** — only you orchestrate.\n\n**User intent phrases.** If the user asks you to use a \"sub-agent\" or \"background agent\", that is explicit delegation intent. Also treat phrases like \"run these in the background\", \"kick off the rest\", \"run the queued items\", \"batch run these jobs\", \"parallelize this\", or \"start the next batch\" as delegation intent when the context is a set of independent work items.\n\n**Spawn is not completion.** A successful \\`spawn\\` call means the sub-agent started and is running. Tell the user it started, show the task id if useful, and then use \\`status\\`/\\`list\\`/\\`read-result\\` to monitor it. Never say the delegated task \"completed\", \"ran successfully\", or \"finished\" until \\`status\\` or \\`read-result\\` reports \\`completed\\` or \\`errored\\`. If a task is still running, say that plainly.\n\n**Default to doing the work yourself in this thread.** A sub-agent costs real tokens and adds a merge step, so reach for one only when delegation clearly pays for that overhead.\n\n**Delegate ONE sub-agent** when a task is self-contained and heavy: deep research, long multi-step content generation, or a noisy scan whose intermediate steps would clutter this thread. The sub-agent gets its own clean context and hands you back a distilled result.\n\n**Fan out to MULTIPLE sub-agents ONLY** for units of work that are genuinely independent and don't depend on each other's decisions — e.g. research three unrelated competitors, summarize five separate threads, draft sections that don't reference one another. Each gets a distinct slice.\n\n**Do NOT parallelize tightly-coupled work** — one cohesive artifact, edits that must agree with each other, or anything needing a single consistent voice or style. Parallel sub-agents can't see each other's choices and their outputs will clash. For coupled work, do it yourself, or chain sub-agents one at a time, feeding each result into the next.\n\n**Cap fan-out:** aim for 1, use up to ~3, and go beyond that only for clearly independent bulk work. More sub-agents means more tokens and a harder merge.\n\n**Briefing contract.** A sub-agent starts in a fresh thread and can only see the brief you give it — it cannot see this conversation or ask you to clarify before it runs. Make every brief self-contained:\n1. **Objective** — what \"done\" looks like, in a sentence or two.\n2. **Context** — the specific facts it needs from this conversation: IDs, names, the user's actual goal, constraints, prior decisions. Paste the specifics; don't assume it knows them.\n3. **Output format** — what to return and how (e.g. \"a 3-bullet summary with source links\", \"the drafted email body only\") so the result drops cleanly into your synthesis.\n4. **Boundaries** — what NOT to do, and for parallel sub-agents, which slice is theirs so they don't overlap.\n\nPut the objective and output format in \\`task\\`; put longer context in \\`instructions\\`.\n\n**Synthesis discipline.** After the sub-agents you depend on finish, poll \\`status\\`/\\`list\\` until they're complete, then pull each one's output with \\`read-result\\`. Do NOT paste their outputs back to back. Read all results, reconcile any disagreements, de-duplicate, and write ONE integrated answer in your own voice. If two sub-agents conflict, resolve it or flag the discrepancy explicitly rather than presenting both. When findings came from distinct investigations, briefly note which finding came from where so the user can trust the merge.`,\n\n \"recurring-jobs\": `### Recurring Jobs\n\nYou can create recurring jobs that run on a cron schedule. Jobs are resource files under \\`jobs/\\`.\n\n- \\`manage-jobs\\` (action: \"create\") — Create a new recurring job with a cron schedule and instructions\n- \\`manage-jobs\\` (action: \"list\") — List all recurring jobs and their status\n- \\`manage-jobs\\` (action: \"update\") — Update a job's schedule, instructions, or toggle enabled/disabled\n- Delete a job with the \\`resources\\` tool: \\`action: \"delete\"\\`, \\`path: \"jobs/<name>.md\"\\`\n\nConvert natural language to 5-field cron format:\n- \"every morning\" / \"daily at 9am\" → \\`0 9 * * *\\`\n- \"every weekday at 9am\" → \\`0 9 * * 1-5\\`\n- \"every hour\" → \\`0 * * * *\\`\n- \"every monday at 9am\" → \\`0 9 * * 1\\`\n\nWhen a recurring job needs a connected MCP, discover the exact MCP tool names\navailable in the current user/org context and pass them in the create call's\n\\`mcpTools\\` array. Bind only the tools the job needs; do not put an MCP URL,\nOAuth token, or arbitrary endpoint in the instructions. The scheduler resolves\nthe selected tools with the job owner's existing connector grant and fails\nclearly if a connector is revoked or a selected tool disappears. For imports,\nnormalize the provider response and call the app's bounded idempotent import\naction once with the full batch rather than issuing one write per item.\n\n#### Suggesting \"Save as automation\"\n\nWhen you finish a task that has obvious recurring value — daily inbox triage, weekly metrics summaries, archive sweeps, status digests, anything the user would plausibly want re-run on a fresh cadence — close the response with ONE short line offering to save it. Examples:\n\n- After \"Summarize my unread emails\": _\"Want me to run this every morning?\"_\n- After \"What's our top traffic source this week\": _\"Want a weekly digest on Mondays?\"_\n- After \"Archive emails older than 30 days\": _\"Should I run this every Sunday?\"_\n\nIf the user says yes, call \\`manage-jobs\\` (action: \"create\") with the original prompt as the job's instructions and the cadence they confirmed.\n\nDo NOT add this offer for one-shot work: lookups (find Alice, what's the schema, who reported X), single drafts/replies, navigation requests, or any task whose value is in the moment. Skip it when the prompt is already explicitly recurring (the user said \"every morning…\" — you'd be asking what they already told you). One short sentence at most; do not turn it into a list of cadence options.`,\n\n builder: `### Connecting Builder.io\n\nWhen the user asks to connect Builder.io or you hit a \"Builder not configured\" error, call the \\`connect-builder\\` tool. It renders a Connect/code-change card inline — do NOT write out multi-step setup instructions yourself. Inspect the returned \\`builderEnabled\\` flag: \\`true\\` means Builder Cloud Agents can take the code-change handoff, while \\`false\\` means this requires a code change and the user should edit locally or use Builder.io to edit this code in the cloud and continue customizing the app any way they like. If Builder Cloud Agents are not available for this workspace, never send the user to Builder org settings or beta settings.`,\n\n browser: `### Browser Automation\n\nYou can activate a real Chrome browser via Builder.io for tasks that need full page rendering:\n- Extracting design tokens from JS-heavy or SPA websites (computed styles, rendered colors/fonts)\n- Taking screenshots of live pages\n- Testing interactive flows on deployed URLs\n- Reading content from pages that require JavaScript execution\n\n**How to use:**\n1. In local development, call \\`set-browser-control\\` with \\`{\"enabled\":true,\"backend\":\"chrome-devtools\"}\\` after confirming once with the user. In production, use \\`activate-browser\\` for Builder-provisioned Chrome.\n2. On your next action, use \\`mcp__chrome-devtools__navigate_page\\`, \\`mcp__chrome-devtools__evaluate_script\\`, \\`mcp__chrome-devtools__take_screenshot\\`, etc.\n3. If Builder is not connected, call \\`connect-builder\\` first\n\n**When to recommend browser automation:**\n- User wants to import a design system from a URL (JS-rendered sites give almost no useful data from plain HTML fetch)\n- User asks you to check how a deployed site looks or behaves\n- Any task involving reading computed/rendered page state\n- When \\`web-request\\` returns minimal/skeleton HTML from a modern SPA\n\nPrefer \\`web-request\\` for simple API calls and static pages. Use browser automation when you need the real rendered page.`,\n\n \"call-agent\": `### call-agent — External Apps Only\n\nThe \\`call-agent\\` tool sends a message to a DIFFERENT, separately-deployed app's agent (A2A protocol). It is **not** for calling actions within the current app.\n\n**NEVER use \\`call-agent\\` to:**\n- Call your own app by name\n- Perform tasks you can accomplish with your own registered tools\n\n**ONLY use \\`call-agent\\` when:**\n- The user explicitly asks you to communicate with a different app\n- You need data that only another deployed app can provide\n- You need brand-consistent generated media and this app does not have a native generation action; call agent \"assets\" and keep returned asset IDs and URLs verbatim\n\nIf \\`call-agent\\` says a downstream agent accepted the subtask and will post its result separately, do not call that same agent again for the same subtask. Continue any remaining work and answer with the completed results you have.`,\n\n memory: `### Structured Memory\n\nYour memory index (\\`memory/MEMORY.md\\`) is loaded at the start of every conversation.\n\n**Tools:**\n- \\`save-memory\\` — Create or update a memory (name, type, description, content)\n- \\`delete-memory\\` — Remove a memory and its index entry\n- \\`resources\\` with \\`action: \"read\"\\` and \\`path: \"memory/<name>.md\"\\` — Read the full content of a specific memory\n\n**Memory types:** user, feedback, project, reference\n\n**When to save (proactively):**\n- User corrects your approach → \\`feedback\\`\n- User shares preferences → \\`user\\`\n- Non-obvious pattern or gotcha → \\`feedback\\`\n- Personal context (contacts, team) → \\`user\\`\n- Project context to track → \\`project\\`\n\n**Rules:**\n- Don't save things obvious from code or standard framework behavior\n- When updating, read first and merge — don't overwrite\n- Keep descriptions concise\n- One memory per logical topic`,\n\n \"sql-tools\": `### SQL Tools\n\nWhen database tools are enabled, \\`db-schema\\` refreshes the schema and \\`db-query\\` runs read-only SELECT queries with current user/org scoping. Raw SQL write tools are only available when the app explicitly opts into database write tools; by default, writes go through typed app actions. Some apps configure database tools as read-only or off; only use tools that are actually present in your tool list.\n\n- \\`db-schema\\` — refresh the full schema with indexes and foreign keys\n- \\`db-query\\` — run a SELECT (read-only; results already filtered to the current user/org)\n- \\`db-exec\\` — only when present: run INSERT / UPDATE / DELETE / REPLACE for scoped maintenance. For normal product data writes, use a typed app action instead.\n- \\`db-patch\\` — only when present: surgical search-and-replace on a large text column. If a typed app action exists for the resource, use that action.\n\n### When to pick which SQL tool\n- A template-specific action exists for the table → use that action (it encodes business rules and pushes live Yjs updates)\n- Read data → \\`db-query\\`. Never re-add \\`WHERE owner_email = ...\\` — scoping already applies it.\n- Raw write tools are present and no app action exists → use \\`db-exec\\` or \\`db-patch\\` only for deliberate maintenance, not normal product workflows.\n\n### External data sources vs the app database\nThe \\`db-*\\` tools ONLY query the app's own SQL database. They do NOT reach external data warehouses. If the user asks about tables NOT in the schema, use the appropriate template action instead.`,\n};\n\nexport function createFrameworkContextEntry(): Record<string, ActionEntry> {\n const topicList = Object.keys(FRAMEWORK_CONTEXT_SECTIONS).join(\", \");\n return {\n \"get-framework-context\": {\n tool: {\n description: `Read detailed framework instructions for a specific capability. Available topics: ${topicList}. Call with topic=\"all\" to get everything.`,\n parameters: {\n type: \"object\" as const,\n properties: {\n topic: {\n type: \"string\",\n description: `Topic to read. One of: ${topicList}, or \"all\" for everything.`,\n },\n },\n required: [\"topic\"],\n },\n },\n run: async (args: Record<string, string>) => {\n const topic = String(args.topic ?? \"all\").toLowerCase();\n if (topic === \"all\") {\n return Object.values(FRAMEWORK_CONTEXT_SECTIONS).join(\"\\n\\n\");\n }\n const section = FRAMEWORK_CONTEXT_SECTIONS[topic];\n if (!section) {\n return `Unknown topic \"${topic}\". Available: ${topicList}`;\n }\n return section;\n },\n readOnly: true,\n },\n };\n}\n\n/**\n * Creates the `refresh-screen` tool. Writes a bump to `application_state`\n * under a well-known key; the client's `useDbSync` watches for this and\n * invalidates react-query caches so the on-screen UI re-fetches its data\n * without a full page reload.\n *\n * This is the standard way for the agent to say \"the data on the screen\n * just changed, please refresh it\" — e.g. after editing a dashboard config,\n * updating a form schema, or mutating a row that the current view renders.\n */\nexport function createRefreshScreenEntry(): Record<string, ActionEntry> {\n return {\n \"refresh-screen\": {\n // Writes __screen_refresh__ to application_state, which emits its own\n // distinct `screen-refresh` poll event. Don't double-emit a generic\n // `action` event on top of that.\n readOnly: true,\n // Refetching volatile on-screen state is the entire point of this\n // tool — an identical repeat call (even with the same scope) is a\n // legitimate re-refresh, not a redundant read to skip.\n dedupe: false,\n tool: {\n description:\n \"Manually refresh the user's current screen. The framework ALREADY auto-refreshes after any successful mutating action tool call (template actions and any enabled raw DB write tools) — you do NOT need to call this after a normal action. Use it only when (a) you mutated data via a path the framework can't detect (e.g. a direct write to an external system the app mirrors), or (b) you want to pass a `scope` hint so the UI narrows which queries to refetch. The UI re-fetches its queries without a full page reload.\",\n parameters: {\n type: \"object\",\n properties: {\n scope: {\n type: \"string\",\n description:\n \"Optional hint describing what changed (e.g. 'dashboard', 'form', 'settings'). Templates may use it to narrow which queries to invalidate; if omitted, all queries are invalidated.\",\n },\n },\n },\n },\n run: async (args) => {\n const { writeAppState } =\n await import(\"../../application-state/script-helpers.js\");\n const nonce = Date.now();\n const scope = typeof args?.scope === \"string\" ? args.scope : undefined;\n await writeAppState(SCREEN_REFRESH_KEY, {\n nonce,\n ...(scope ? { scope } : {}),\n });\n return `refreshed${scope ? ` (scope: ${scope})` : \"\"}`;\n },\n },\n };\n}\n\n/** Well-known application-state key used by the refresh-screen tool. */\nconst SCREEN_REFRESH_KEY = \"__screen_refresh__\";\nconst SAFE_BROWSER_TAB_ID_RE = /^[A-Za-z0-9_-]{1,96}$/;\n\nexport function appStateKeyForBrowserTab(\n key: string,\n browserTabId: unknown,\n): string {\n if (typeof browserTabId !== \"string\") return key;\n const trimmed = browserTabId.trim();\n return SAFE_BROWSER_TAB_ID_RE.test(trimmed) ? `${key}:${trimmed}` : key;\n}\n\n/**\n * Creates the `set-search-params` / `set-url-path` tools. Writes a one-shot\n * URL command to application_state; the client's URLSync component applies\n * it via react-router (no full page reload) and then deletes the command.\n *\n * This is how the agent edits URL state — filter query params, route\n * changes, hash — without needing a per-template navigate action. The\n * current URL is visible to the agent via the auto-injected `<current-url>`\n * block, which includes parsed search params.\n */\nexport function createUrlTools(): Record<string, ActionEntry> {\n return {\n \"set-search-params\": {\n // Writes __set_url__ to application_state, which the app-state watcher\n // already surfaces as a poll event. No need to double-emit.\n readOnly: true,\n tool: {\n description:\n \"Update the URL query string on the user's current page. Use this to change dashboard/list filters, search terms, or any other state the app stores in `?foo=bar` style query params. One-shot — the UI applies it in ~1s without a page reload. See the current URL + parsed search params in the auto-injected `<current-url>` block. Keys are the exact query param names as they appear in the URL (e.g. `f_pubDateStart`, not just `pubDateStart`). Set a value to null or empty string to clear that param. By default merges over existing params — pass `merge: false` to replace them all.\",\n parameters: {\n type: \"object\",\n properties: {\n params: {\n type: \"object\",\n description:\n 'Map of query param → value. Each value is a string, or null/\"\" to clear. Example: {\"f_pubDateStart\": null, \"f_cadence\": \"MONTH\"}.',\n },\n merge: {\n type: \"string\",\n description:\n '\"true\" (default) merges over existing params; \"false\" replaces them entirely.',\n enum: [\"true\", \"false\"],\n },\n },\n required: [\"params\"],\n },\n },\n run: async (args) => {\n const params = (args?.params ?? {}) as unknown as Record<\n string,\n string | null\n >;\n const merge = (args as any)?.merge !== \"false\";\n const { writeAppState } =\n await import(\"../../application-state/script-helpers.js\");\n await writeAppState(\n appStateKeyForBrowserTab(\n \"__set_url__\",\n getRequestRunContext()?.browserTabId,\n ),\n {\n searchParams: params,\n mergeSearchParams: merge,\n // Unique-per-write token. The client's URLSync hook dedups by this\n // so a fire-and-forget DELETE that loses its race against the next\n // polling refetch can't cause the same URL command to be applied\n // repeatedly (which caused the editor to bounce between slides\n // when an agent turn errored partway through).\n _writeId: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,\n },\n );\n const keys = Object.keys(params);\n return `set-search-params: ${keys.length} key${keys.length === 1 ? \"\" : \"s\"}${merge ? \"\" : \" (replace)\"}`;\n },\n },\n \"set-url-path\": {\n // Same as set-search-params — writes application_state, already emits\n // via the app-state watcher.\n readOnly: true,\n tool: {\n description:\n \"Navigate the user to a different pathname, optionally also setting search params. For most template-specific routing prefer the template's `navigate` action if it exists — this is the generic fallback. One-shot, applied by the client without a page reload.\",\n parameters: {\n type: \"object\",\n properties: {\n pathname: {\n type: \"string\",\n description: \"New URL pathname (e.g. '/adhoc/weekly').\",\n },\n params: {\n type: \"object\",\n description:\n 'Optional query params to set alongside the path change. String values set, null/\"\" clears.',\n },\n merge: {\n type: \"string\",\n description:\n '\"true\" (default) merges over existing params; \"false\" starts fresh.',\n enum: [\"true\", \"false\"],\n },\n },\n required: [\"pathname\"],\n },\n },\n run: async (args) => {\n const pathname = String(args?.pathname ?? \"\");\n if (!pathname.startsWith(\"/\")) {\n return \"Error: pathname must start with '/'.\";\n }\n const params = (args?.params ?? {}) as unknown as Record<\n string,\n string | null\n >;\n const merge = (args as any)?.merge !== \"false\";\n const { writeAppState } =\n await import(\"../../application-state/script-helpers.js\");\n await writeAppState(\n appStateKeyForBrowserTab(\n \"__set_url__\",\n getRequestRunContext()?.browserTabId,\n ),\n {\n pathname,\n searchParams: params,\n mergeSearchParams: merge,\n // See note in set-search-params: unique-per-write dedup token so a\n // race between GET and consume-DELETE in URLSync can't re-apply\n // this command.\n _writeId: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,\n },\n );\n return `set-url-path: ${pathname}`;\n },\n },\n \"ask-question\": {\n tool: {\n description:\n \"Ask the user a multiple-choice clarifying question and render it inline in the chat. Use this ONLY when you are genuinely blocked on a decision you cannot resolve from context and a wrong guess would be costly — an ambiguous metric, date range, or grain; a real fork in approach. Present 2-5 concrete options and mark the most likely one recommended. Do NOT use it for confirmations, for things the user already specified, or to dodge easy work you could just do. Ask at most once per turn. Calling this yields the turn: stop and wait for the user's answer.\",\n parameters: {\n type: \"object\",\n properties: {\n question: {\n type: \"string\",\n description:\n \"The complete question to ask the user. Clear, specific, ends with a question mark.\",\n },\n header: {\n type: \"string\",\n description:\n 'Optional very short label (max ~12 chars) shown as a chip/heading above the question, e.g. \"Date range\", \"Approach\", \"Library\".',\n },\n options: {\n type: \"string\",\n description:\n 'A JSON array of 2-4 distinct, mutually-exclusive options (unless `allowMultiple` is true), each `{ \"label\": string, \"value\"?: string, \"description\"?: string, \"preview\"?: string, \"recommended\"?: boolean }`. `label` is 1-5 words; `description` explains the trade-off; `preview` is optional content (mockup, code snippet, short comparison) rendered under the option. `value` defaults to `label` when omitted. Mark the most likely option `\"recommended\": true`. Do NOT add an \"Other\" option — free text is provided automatically when `allowFreeText` is on.',\n },\n allowFreeText: {\n type: \"string\",\n description:\n 'Whether the user may also type a free-text \"Other\" answer. \"true\" (default) or \"false\".',\n enum: [\"true\", \"false\"],\n },\n allowMultiple: {\n type: \"string\",\n description:\n 'Whether the user may select more than one option (multi-select). \"true\" or \"false\" (default).',\n enum: [\"true\", \"false\"],\n },\n },\n required: [\"question\", \"options\"],\n },\n },\n run: async (args) => {\n const question = String(args?.question ?? \"\").trim();\n if (!question) return \"Error: 'question' is required.\";\n const header = String(args?.header ?? \"\").trim();\n const allowMultiple = String(args?.allowMultiple ?? \"\") === \"true\";\n const allowFreeText = String(args?.allowFreeText ?? \"true\") !== \"false\";\n\n let parsedOptions: unknown;\n try {\n parsedOptions = JSON.parse(String(args?.options ?? \"[]\"));\n } catch {\n return \"Error: 'options' must be a JSON array of { label, value?, description?, recommended? }.\";\n }\n if (!Array.isArray(parsedOptions) || parsedOptions.length === 0) {\n return \"Error: 'options' must be a non-empty JSON array of { label, value?, description?, recommended? }.\";\n }\n\n type AskOption = {\n label: string;\n value: string;\n description?: string;\n preview?: string;\n recommended?: boolean;\n };\n const options = parsedOptions\n .map((raw): AskOption | null => {\n const opt = (raw ?? {}) as Record<string, unknown>;\n const label =\n typeof opt.label === \"string\" && opt.label.trim()\n ? opt.label.trim()\n : typeof opt.value === \"string\"\n ? String(opt.value).trim()\n : \"\";\n if (!label) return null;\n const value =\n typeof opt.value === \"string\" && opt.value.trim()\n ? opt.value.trim()\n : label;\n const option: AskOption = { label, value };\n if (typeof opt.description === \"string\" && opt.description.trim()) {\n option.description = opt.description.trim();\n }\n if (typeof opt.preview === \"string\" && opt.preview.trim()) {\n option.preview = opt.preview;\n }\n if (opt.recommended === true) option.recommended = true;\n return option;\n })\n .filter((opt): opt is AskOption => opt !== null);\n if (options.length === 0) {\n return \"Error: 'options' must contain at least one option with a label.\";\n }\n\n // Shape must match the GuidedQuestionFlow renderer in\n // client/guided-questions.tsx: a `text-options` question whose options\n // carry `value`, with `multiSelect` for multi-pick and `allowOther` for\n // free text. The renderer otherwise injects \"Explore\"/\"Decide\" options,\n // which would be noise for a focused clarifying question, so disable them.\n const payload = {\n questions: [\n {\n id: \"q1\",\n type: \"text-options\" as const,\n question,\n ...(header ? { header } : {}),\n required: !allowFreeText,\n multiSelect: allowMultiple,\n allowOther: allowFreeText,\n includeExplore: false,\n includeDecide: false,\n options,\n },\n ],\n };\n\n const { writeAppState } =\n await import(\"../../application-state/script-helpers.js\");\n await writeAppState(\n appStateKeyForBrowserTab(\n \"guided-questions\",\n getRequestRunContext()?.browserTabId,\n ),\n payload,\n );\n return \"Asked the user a clarifying question and rendered it in the chat. Stop here and wait for their answer — do not proceed or assume an answer.\";\n },\n },\n };\n}\n\nexport function createDataWidgetActionEntries(): Record<string, ActionEntry> {\n return {\n \"render-data-widget\": {\n readOnly: true,\n parallelSafe: true,\n chatUI: {\n renderer: ACTION_CHAT_UI_DATA_WIDGET_RENDERER,\n title: \"Data widget\",\n description: \"Render a validated native data table or chart in chat.\",\n },\n tool: {\n description:\n \"Render a native Agent-Native chat data widget from compact, real data you already retrieved or the user provided. Use this for in-chat tables, charts, graphs, trends, and compact reports when no domain-specific action already returns a native widget. Never fabricate rows or metrics just to make a chart.\",\n parameters: {\n type: \"object\",\n properties: {\n widget: {\n type: \"string\",\n enum: [\"data-table\", \"data-chart\", \"data-insights\"],\n description:\n \"Widget kind. Use data-chart for a chart, data-table for a table, or data-insights for a combined summary/chart/table card.\",\n },\n widgetId: {\n type: \"string\",\n description: \"Optional stable widget identifier.\",\n },\n title: {\n type: \"string\",\n description: \"Optional widget title.\",\n },\n summary: {\n type: \"object\",\n description:\n \"Optional scalar summary values for data-insights cards.\",\n },\n display: {\n type: \"object\",\n description:\n \"Optional display metadata: title, description, primaryAction.\",\n },\n table: {\n type: \"object\",\n description:\n \"For data-table/data-insights: { title?, columns: [{ key, label, align? }], rows, totalRows?, sampledRows?, truncated? }.\",\n },\n chartSeries: {\n type: \"object\",\n description:\n \"For data-chart/data-insights: { type: 'bar'|'line'|'area', title?, xKey, series: [{ key, label, color? }], data, sampled? }.\",\n },\n },\n required: [\"widget\"],\n },\n },\n run: async (args) => dataWidgetResultSchema.parse(args),\n },\n };\n}\n"]}
|
|
@@ -51,7 +51,7 @@ Keep \`create-extension\` payloads compact enough to finish quickly. For complex
|
|
|
51
51
|
|
|
52
52
|
Generated UI content can use appAction(), appFetch(), dbQuery(), extensionFetch(), extensionData, agentNative.ui.output(value, opts?), and agentNative.chat.send(...)/sendToAgentChat(...). Use appAction() for app data writes, and dbQuery() only for read-only inspection of known app SQL tables. It can receive chat inputs through slotContext/window.onSlotContext. Use agentNative.ui.output for passive current values from knobs, sliders, selections, and controls; it writes application state at \`inline-ui:<extensionId>:output\` scoped to the inline extension id returned by \`render-inline-extension\` or \`show-extension-inline\`. When the user later says "use that value", "apply the current setting", or similar, read it with \`readAppState("inline-ui:<id>:output")\` instead of asking them to send it again. Use agentNative.chat.send for visible submit/apply actions that should put a message into chat. Transient extensionData is browser-local and not agent-readable, synced, promoted, or garbage-collected; use application_state/appFetch, appAction, ui.output, or chat.send for anything the agent or app must observe. Use semantic Tailwind classes like bg-background, text-foreground, bg-primary, border-border, and text-muted-foreground so the UI inherits the parent app theme.
|
|
53
53
|
|
|
54
|
-
If the user asks to change, edit, fix, style, rename, or add behavior to an existing extension/widget/dashboard/calculator/mini-app, use the current extension id from \`<current-screen>\` or \`<current-url>\` when present. Call \`get-extension\` only if you need to inspect its content, then \`update-extension\` with
|
|
54
|
+
If the user asks to change, edit, fix, style, rename, or add behavior to an existing extension/widget/dashboard/calculator/mini-app, use the current extension id from \`<current-screen>\` or \`<current-url>\` when present. Call \`get-extension\` only if you need to inspect its content, then call \`update-extension\` with exactly \`id\`, \`operation\`, and \`payloadJson\`; encode the operation payload as a JSON string and never send empty placeholder fields. After one content read, keep the body in working memory and use \`operation="edit"\` with focused \`edits\`/\`patches\` inside \`payloadJson\`; do not loop on repeated \`get-extension\` + \`run-code\` string scans before writing. For a data-only repair, preserve the existing layout, CSS, copy, and interactions. Use \`operation="replace"\` only when the user explicitly requests a broad visual rewrite or supplies a complete replacement body. Use \`operation="metadata"\` for name/description/icon, and use \`set-resource-visibility\` for sharing changes. If a focused patch fails, read the current body and change the target rather than retrying identical arguments. Use \`list-extensions\` only when no current id/name is available. Existing extension edits are SQL data updates, not source-code changes, even when the request says "change the UI" or "fix this". Do **NOT** call \`connect-builder\` for existing extension edits.
|
|
55
55
|
|
|
56
56
|
In Act mode, when in doubt — if the request asks for a new small interactive utility and does not need reuse, choose \`render-inline-extension\`; if it mentions saving/reuse or asks for an extension/widget/dashboard/calculator/mini-app, choose \`create-extension\`. If it references an existing one or the current extension page, choose \`update-extension\`. Do **not** preface the call with planning text like "let me build the dashboard…" — just call the right extension action directly.
|
|
57
57
|
|
|
@@ -92,7 +92,7 @@ Keep the first \`create-extension\` call compact and working. If the request is
|
|
|
92
92
|
|
|
93
93
|
Generated UI can read chat inputs from slotContext/window.onSlotContext, see/update app state through appFetch/appAction, use extensionData, record passive current values through agentNative.ui.output(value, opts?), and send visible results through agentNative.chat.send(...) or sendToAgentChat(...). ui.output writes \`inline-ui:<extensionId>:output\` in application state; when the user asks to use the current slider/selection/value, read \`readAppState("inline-ui:<id>:output")\`. Transient extensionData is browser-local only, so do not rely on it for values the agent or app must observe. Use semantic Tailwind theme classes.
|
|
94
94
|
|
|
95
|
-
If the user asks to change, edit, fix, style, rename, or add behavior to an existing extension/widget/dashboard/calculator/mini-app, use the current extension id from \`<current-screen>\` or \`<current-url>\` when present. Call \`get-extension\` only if you need to inspect its content, then \`update-extension\` with
|
|
95
|
+
If the user asks to change, edit, fix, style, rename, or add behavior to an existing extension/widget/dashboard/calculator/mini-app, use the current extension id from \`<current-screen>\` or \`<current-url>\` when present. Call \`get-extension\` only if you need to inspect its content, then call \`update-extension\` with exactly \`id\`, \`operation\`, and \`payloadJson\`; encode the operation payload as a JSON string and never send empty placeholder fields. After one content read, use \`operation="edit"\` with focused \`edits\`/\`patches\` inside \`payloadJson\`; do not repeatedly re-read and scan the same HTML with \`run-code\` before writing. For a data-only repair, preserve the existing layout, CSS, copy, and interactions. Use \`operation="replace"\` only when the user explicitly requests a broad visual rewrite or supplies a complete replacement body. Use \`operation="metadata"\` for name/description/icon, and use \`set-resource-visibility\` for sharing changes. If a focused patch fails, read the current body and change the target rather than retrying identical arguments. Use \`list-extensions\` only when no current id/name is available. Existing extension edits are SQL data updates, not source-code changes. Do NOT call \`connect-builder\` for them.
|
|
96
96
|
|
|
97
97
|
For existing extensions, use \`get-extension\` or \`update-extension\` directly when \`<current-screen>\` or \`<current-url>\` provides an \`extensionId\`. Use \`list-extensions\` only to browse or resolve an unknown name. Use \`hide-extension\` when the user wants a shared extension removed only from their own view. Do not query the legacy \`tools\` table directly.
|
|
98
98
|
|