@agent-native/core 0.119.3 → 0.119.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +21 -0
- package/corpus/core/package.json +3 -3
- package/corpus/core/src/agent/engine/index.ts +2 -0
- package/corpus/core/src/agent/engine/registry.ts +95 -2
- package/corpus/core/src/agent/production-agent.ts +107 -125
- package/corpus/core/src/agent/run-manager.ts +45 -2
- package/corpus/core/src/agent/thread-data-builder.ts +85 -8
- package/corpus/core/src/client/AssistantChat.tsx +37 -9
- package/corpus/core/src/client/chat/message-components.tsx +9 -1
- package/corpus/core/src/client/chat/repo-helpers.ts +77 -0
- package/corpus/core/src/client/chat/tool-call-display.tsx +51 -15
- package/corpus/core/src/scripts/agent-engines/list-agent-engines.ts +8 -0
- package/corpus/core/src/scripts/agent-engines/manage-agent-engine.ts +5 -1
- package/corpus/core/src/scripts/agent-engines/set-agent-engine.ts +9 -1
- package/corpus/core/src/server/agent-chat/framework-prompts.ts +3 -1
- package/corpus/core/src/server/agent-chat/plugin-options.ts +9 -0
- package/corpus/core/src/server/agent-chat-plugin.ts +12 -3
- package/corpus/core/src/templates/chat/.agents/skills/actions/SKILL.md +512 -0
- package/corpus/core/src/templates/chat/.agents/skills/adding-a-feature/SKILL.md +189 -0
- package/corpus/core/src/templates/chat/.agents/skills/agent-native-docs/SKILL.md +115 -0
- package/corpus/core/src/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +177 -0
- package/corpus/core/src/templates/chat/.agents/skills/capture-learnings/SKILL.md +89 -0
- package/corpus/core/src/templates/chat/.agents/skills/create-skill/SKILL.md +221 -0
- package/corpus/core/src/templates/chat/.agents/skills/customizing-agent-native/SKILL.md +220 -0
- package/corpus/core/src/templates/chat/.agents/skills/delegate-to-agent/SKILL.md +263 -0
- package/corpus/core/src/templates/chat/.agents/skills/feature-flags/SKILL.md +169 -0
- package/corpus/core/src/templates/chat/.agents/skills/frontend-design/SKILL.md +160 -0
- package/corpus/core/src/templates/chat/.agents/skills/real-time-sync/SKILL.md +232 -0
- package/corpus/core/src/templates/chat/.agents/skills/security/SKILL.md +280 -0
- package/corpus/core/src/templates/chat/.agents/skills/self-modifying-code/SKILL.md +118 -0
- package/corpus/core/src/templates/chat/.agents/skills/shadcn-ui/SKILL.md +119 -0
- package/corpus/core/src/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +100 -0
- package/corpus/core/src/templates/chat/.env.example +5 -0
- package/corpus/core/src/templates/chat/.ignore +0 -0
- package/corpus/core/src/templates/chat/.oxfmtrc.json +8 -0
- package/corpus/core/src/templates/chat/AGENTS.md +69 -0
- package/corpus/core/src/templates/chat/CHANGELOG.md +10 -0
- package/corpus/core/src/templates/chat/DEVELOPING.md +185 -0
- package/corpus/core/src/templates/chat/README.md +32 -0
- package/corpus/core/src/templates/chat/_gitignore +43 -0
- package/corpus/core/src/templates/chat/actions/hello.ts +13 -0
- package/corpus/core/src/templates/chat/actions/navigate.ts +41 -0
- package/corpus/core/src/templates/chat/actions/run.ts +2 -0
- package/corpus/core/src/templates/chat/actions/view-screen.ts +31 -0
- package/corpus/core/src/templates/chat/app/components/layout/Header.tsx +60 -0
- package/corpus/core/src/templates/chat/app/components/layout/Layout.tsx +185 -0
- package/corpus/core/src/templates/chat/app/components/layout/Sidebar.tsx +450 -0
- package/corpus/core/src/templates/chat/app/components/ui/button.tsx +1 -0
- package/corpus/core/src/templates/chat/app/components/ui/card.tsx +1 -0
- package/corpus/core/src/templates/chat/app/components/ui/dropdown-menu.tsx +1 -0
- package/corpus/core/src/templates/chat/app/components/ui/input.tsx +1 -0
- package/corpus/core/src/templates/chat/app/components/ui/label.tsx +1 -0
- package/corpus/core/src/templates/chat/app/components/ui/sheet.tsx +1 -0
- package/corpus/core/src/templates/chat/app/components/ui/toolkit-provider.tsx +17 -0
- package/corpus/core/src/templates/chat/app/components/ui/tooltip.tsx +1 -0
- package/corpus/core/src/templates/chat/app/design-system.ts +3 -0
- package/corpus/core/src/templates/chat/app/entry.client.tsx +19 -0
- package/corpus/core/src/templates/chat/app/entry.server.tsx +10 -0
- package/corpus/core/src/templates/chat/app/global.css +93 -0
- package/corpus/core/src/templates/chat/app/hooks/use-navigation-state.ts +93 -0
- package/corpus/core/src/templates/chat/app/i18n/ar-SA.ts +68 -0
- package/corpus/core/src/templates/chat/app/i18n/de-DE.ts +71 -0
- package/corpus/core/src/templates/chat/app/i18n/en-US.ts +70 -0
- package/corpus/core/src/templates/chat/app/i18n/es-ES.ts +71 -0
- package/corpus/core/src/templates/chat/app/i18n/fr-FR.ts +71 -0
- package/corpus/core/src/templates/chat/app/i18n/hi-IN.ts +69 -0
- package/corpus/core/src/templates/chat/app/i18n/index.ts +34 -0
- package/corpus/core/src/templates/chat/app/i18n/ja-JP.ts +70 -0
- package/corpus/core/src/templates/chat/app/i18n/ko-KR.ts +70 -0
- package/corpus/core/src/templates/chat/app/i18n/pt-BR.ts +71 -0
- package/corpus/core/src/templates/chat/app/i18n/zh-CN.ts +66 -0
- package/corpus/core/src/templates/chat/app/i18n/zh-TW.ts +66 -0
- package/corpus/core/src/templates/chat/app/i18n-data.ts +556 -0
- package/corpus/core/src/templates/chat/app/lib/agent-page.tsx +49 -0
- package/corpus/core/src/templates/chat/app/lib/app-config.ts +11 -0
- package/corpus/core/src/templates/chat/app/lib/tab-id.ts +1 -0
- package/corpus/core/src/templates/chat/app/lib/utils.ts +1 -0
- package/corpus/core/src/templates/chat/app/root.tsx +173 -0
- package/corpus/core/src/templates/chat/app/routes/_index.tsx +94 -0
- package/corpus/core/src/templates/chat/app/routes/agent.tsx +24 -0
- package/corpus/core/src/templates/chat/app/routes/chat.$threadId.tsx +1 -0
- package/corpus/core/src/templates/chat/app/routes/database.tsx +17 -0
- package/corpus/core/src/templates/chat/app/routes/extensions.$id.$slug.tsx +2 -0
- package/corpus/core/src/templates/chat/app/routes/extensions.$id.tsx +11 -0
- package/corpus/core/src/templates/chat/app/routes/extensions._index.tsx +11 -0
- package/corpus/core/src/templates/chat/app/routes/extensions.tsx +5 -0
- package/corpus/core/src/templates/chat/app/routes/observability.tsx +19 -0
- package/corpus/core/src/templates/chat/app/routes/settings.tsx +89 -0
- package/corpus/core/src/templates/chat/app/routes/team.tsx +11 -0
- package/corpus/core/src/templates/chat/app/routes.ts +4 -0
- package/corpus/core/src/templates/chat/app/vite-env.d.ts +6 -0
- package/corpus/core/src/templates/chat/changelog/2026-06-24-a-new-settings-page-gives-quick-access-to-language-workspace.md +6 -0
- package/corpus/core/src/templates/chat/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +6 -0
- package/corpus/core/src/templates/chat/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/core/src/templates/chat/changelog/2026-06-28-left-sidebar-collapse-motion-and-footer-chrome-are-quieter.md +6 -0
- package/corpus/core/src/templates/chat/changelog/2026-06-29-chat-layouts-adapt-when-the-agent-sidebar-is-open.md +6 -0
- package/corpus/core/src/templates/chat/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/corpus/core/src/templates/chat/changelog/2026-07-10-chat-now-makes-ai-connection-setup-clear-without-shifting-th.md +6 -0
- package/corpus/core/src/templates/chat/changelog/2026-07-13-a-full-agent-page-now-brings-context-files-connections-jobs-.md +6 -0
- package/corpus/core/src/templates/chat/changelog/2026-07-14-chat-opens-reliably-on-hosted-deployments-instead-of-failing.md +6 -0
- package/corpus/core/src/templates/chat/changelog/2026-07-14-fixed-chat-template-startup-with-older-core-versions.md +6 -0
- package/corpus/core/src/templates/chat/changelog/2026-07-15-chat-navigation-focuses-on-chat-and-agent.md +6 -0
- package/corpus/core/src/templates/chat/changelog/2026-07-17-the-agent-chat-sidebar-stays-closed-until-you-open-it-or-sta.md +6 -0
- package/corpus/core/src/templates/chat/changelog/2026-07-22-compact-sidebar-footer.md +6 -0
- package/corpus/core/src/templates/chat/changelog/2026-07-22-full-page-chat-keeps-the-active-conversation-when-moving-to-.md +6 -0
- package/corpus/core/src/templates/chat/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
- package/corpus/core/src/templates/chat/changelog/2026-07-22-recent-chats-are-easier-to-scan-and-expand.md +6 -0
- package/corpus/core/src/templates/chat/changelog/2026-07-23-full-page-chat-is-better-centered-with-quieter-chat-history-.md +6 -0
- package/corpus/core/src/templates/chat/components.json +20 -0
- package/corpus/core/src/templates/chat/learnings.defaults.md +5 -0
- package/corpus/core/src/templates/chat/netlify.toml +10 -0
- package/corpus/core/src/templates/chat/package.json +92 -0
- package/corpus/core/src/templates/chat/public/agent-native-icon-dark.svg +10 -0
- package/corpus/core/src/templates/chat/public/agent-native-icon-light.svg +10 -0
- package/corpus/core/src/templates/chat/public/agent-native-logo-dark.svg +21 -0
- package/corpus/core/src/templates/chat/public/agent-native-logo-light.svg +21 -0
- package/corpus/core/src/templates/chat/public/favicon.svg +1 -0
- package/corpus/core/src/templates/chat/public/icon-180.svg +1 -0
- package/corpus/core/src/templates/chat/public/icon-192.svg +1 -0
- package/corpus/core/src/templates/chat/public/icon-512.svg +1 -0
- package/corpus/core/src/templates/chat/public/manifest.json +21 -0
- package/corpus/core/src/templates/chat/react-router.config.ts +7 -0
- package/corpus/core/src/templates/chat/server/middleware/auth.ts +15 -0
- package/corpus/core/src/templates/chat/server/plugins/agent-chat.ts +21 -0
- package/corpus/core/src/templates/chat/server/plugins/auth.ts +17 -0
- package/corpus/core/src/templates/chat/server/routes/[...page].get.ts +5 -0
- package/corpus/core/src/templates/chat/ssr-entry.ts +15 -0
- package/corpus/core/src/templates/chat/tsconfig.json +21 -0
- package/corpus/core/src/templates/chat/vite.config.ts +19 -0
- package/corpus/templates/analytics/AGENTS.md +19 -11
- package/corpus/templates/analytics/actions/list-data-dictionary.ts +3 -1
- package/corpus/templates/analytics/actions/save-data-dictionary-entry.ts +14 -0
- package/corpus/templates/analytics/actions/search-analytics-query-catalog.ts +41 -0
- package/corpus/templates/analytics/app/components/dashboard/DashboardPanelSkeleton.tsx +13 -0
- package/corpus/templates/analytics/app/components/dashboard/SqlChart.tsx +12 -11
- package/corpus/templates/analytics/app/pages/adhoc/DashboardSkeleton.tsx +3 -3
- package/corpus/templates/analytics/changelog/2026-07-23-dashboard-chart-loading-placeholders-are-easier-to-see-in-da.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-23-routine-analytics-lookups-reuse-existing-query-definitions.md +6 -0
- package/corpus/templates/analytics/server/lib/agent-chat-plan-mode.ts +1 -12
- package/corpus/templates/analytics/server/lib/analytics-query-catalog.ts +405 -0
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +11 -16
- package/corpus/templates/content/changelog/2026-07-23-database-toolbar-sort-and-filter-controls-open-reliably.md +6 -0
- package/corpus/templates/forms/app/lib/public-form-link.ts +14 -0
- package/corpus/templates/forms/app/pages/FormBuilderPage.tsx +6 -14
- package/corpus/templates/forms/changelog/2026-07-23-published-form-links-can-be-copied-without-being-asked-to-re.md +6 -0
- package/corpus/templates/mail/changelog/2026-07-23-scheduled-emails-now-send-only-once-when-multiple-requests-r.md +6 -0
- package/corpus/templates/mail/server/lib/jobs.ts +13 -4
- package/corpus/templates/mail/server/plugins/mail-jobs.ts +1 -1
- package/corpus/templates/slides/actions/patch-deck.ts +2 -1
- package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +7 -18
- package/corpus/templates/slides/app/lib/agent-visible-message.ts +28 -0
- package/corpus/templates/slides/app/pages/Index.tsx +6 -34
- package/corpus/templates/slides/changelog/2026-07-23-full-prompts-stay-visible-in-chat-when-creating-decks-or-add.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-23-opening-or-refining-a-deck-no-longer-crashes-with-a-blank-er.md +6 -0
- package/corpus/templates/slides/shared/aspect-ratios.ts +4 -1
- package/corpus/templates/tasks/.oxfmtrc.json +8 -0
- package/corpus/templates/tasks/AGENTS.md +34 -41
- package/corpus/templates/tasks/README.md +13 -6
- package/corpus/templates/tasks/actions/bulk-delete-inbox-items.ts +10 -8
- package/corpus/templates/tasks/actions/bulk-delete-tasks.ts +10 -8
- package/corpus/templates/tasks/actions/bulk-mark-inbox-items-ready.ts +1 -1
- package/corpus/templates/tasks/actions/bulk-update-tasks.ts +12 -10
- package/corpus/templates/tasks/actions/create-inbox-item.ts +7 -4
- package/corpus/templates/tasks/actions/create-task.ts +2 -1
- package/corpus/templates/tasks/actions/delete-inbox-item.ts +6 -4
- package/corpus/templates/tasks/actions/delete-task.ts +1 -1
- package/corpus/templates/tasks/actions/list-inbox-items.ts +4 -2
- package/corpus/templates/tasks/actions/list-visible-task-fields.ts +3 -1
- package/corpus/templates/tasks/actions/mark-inbox-item-ready.ts +6 -4
- package/corpus/templates/tasks/actions/navigate.ts +16 -14
- package/corpus/templates/tasks/actions/reorder-inbox-items.ts +9 -7
- package/corpus/templates/tasks/actions/update-inbox-item.ts +6 -4
- package/corpus/templates/tasks/actions/update-task.ts +12 -9
- package/corpus/templates/tasks/actions/update-visible-task-fields.ts +10 -8
- package/corpus/templates/tasks/actions/view-screen.ts +1 -1
- package/corpus/templates/tasks/app/components/tasks/fields/TaskFieldsSidebar.tsx +15 -0
- package/corpus/templates/tasks/changelog/2026-07-23-task-detail-extensions.md +6 -0
- package/corpus/templates/tasks/drizzle.config.ts +3 -0
- package/corpus/templates/tasks/package.json +4 -1
- package/corpus/templates/tasks/server/db/schema.ts +0 -10
- package/corpus/templates/tasks/server/db/test-tasks-table.ts +0 -5
- package/corpus/templates/tasks/server/plugins/agent-chat.ts +1 -1
- package/corpus/templates/tasks/server/plugins/db.ts +43 -10
- package/corpus/templates/tasks/server/user-config/store.ts +42 -81
- package/corpus/templates/tasks/tsconfig.json +1 -2
- package/corpus/templates/tasks/vitest.config.ts +10 -1
- package/corpus/toolkit/CHANGELOG.md +13 -0
- package/corpus/toolkit/package.json +1 -1
- package/corpus/toolkit/src/editor/SharedRichEditor.tsx +23 -2
- package/corpus/toolkit/src/editor/SlashCommandMenu.tsx +68 -2
- package/corpus/toolkit/src/editor/index.ts +1 -0
- package/corpus/toolkit/src/editor.css +75 -0
- package/corpus/toolkit/src/ui/button.tsx +3 -2
- package/dist/agent/engine/index.d.ts +1 -1
- package/dist/agent/engine/index.d.ts.map +1 -1
- package/dist/agent/engine/index.js +1 -1
- package/dist/agent/engine/index.js.map +1 -1
- package/dist/agent/engine/registry.d.ts +32 -1
- package/dist/agent/engine/registry.d.ts.map +1 -1
- package/dist/agent/engine/registry.js +75 -3
- package/dist/agent/engine/registry.js.map +1 -1
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +96 -115
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-manager.d.ts +9 -1
- package/dist/agent/run-manager.d.ts.map +1 -1
- package/dist/agent/run-manager.js +26 -0
- package/dist/agent/run-manager.js.map +1 -1
- package/dist/agent/thread-data-builder.d.ts +2 -0
- package/dist/agent/thread-data-builder.d.ts.map +1 -1
- package/dist/agent/thread-data-builder.js +69 -9
- package/dist/agent/thread-data-builder.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +32 -10
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/chat/message-components.d.ts +2 -1
- package/dist/client/chat/message-components.d.ts.map +1 -1
- package/dist/client/chat/message-components.js +9 -3
- package/dist/client/chat/message-components.js.map +1 -1
- package/dist/client/chat/repo-helpers.d.ts +4 -0
- package/dist/client/chat/repo-helpers.d.ts.map +1 -1
- package/dist/client/chat/repo-helpers.js +61 -0
- package/dist/client/chat/repo-helpers.js.map +1 -1
- package/dist/client/chat/tool-call-display.d.ts +2 -1
- package/dist/client/chat/tool-call-display.d.ts.map +1 -1
- package/dist/client/chat/tool-call-display.js +10 -9
- package/dist/client/chat/tool-call-display.js.map +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/observability/routes.d.ts +5 -5
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +7 -7
- package/dist/provider-api/actions/provider-api.d.ts +7 -7
- package/dist/provider-api/corpus-jobs.d.ts +2 -2
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/scripts/agent-engines/list-agent-engines.d.ts.map +1 -1
- package/dist/scripts/agent-engines/list-agent-engines.js +8 -2
- package/dist/scripts/agent-engines/list-agent-engines.js.map +1 -1
- package/dist/scripts/agent-engines/manage-agent-engine.d.ts.map +1 -1
- package/dist/scripts/agent-engines/manage-agent-engine.js +5 -2
- package/dist/scripts/agent-engines/manage-agent-engine.js.map +1 -1
- package/dist/scripts/agent-engines/set-agent-engine.d.ts.map +1 -1
- package/dist/scripts/agent-engines/set-agent-engine.js +9 -2
- package/dist/scripts/agent-engines/set-agent-engine.js.map +1 -1
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/agent-chat/framework-prompts.d.ts.map +1 -1
- package/dist/server/agent-chat/framework-prompts.js +3 -1
- package/dist/server/agent-chat/framework-prompts.js.map +1 -1
- package/dist/server/agent-chat/plugin-options.d.ts +9 -0
- package/dist/server/agent-chat/plugin-options.d.ts.map +1 -1
- package/dist/server/agent-chat/plugin-options.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +11 -2
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/realtime-token.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/package.json +4 -4
- package/src/agent/engine/index.ts +2 -0
- package/src/agent/engine/registry.ts +95 -2
- package/src/agent/production-agent.ts +107 -125
- package/src/agent/run-manager.ts +45 -2
- package/src/agent/thread-data-builder.ts +85 -8
- package/src/client/AssistantChat.tsx +37 -9
- package/src/client/chat/message-components.tsx +9 -1
- package/src/client/chat/repo-helpers.ts +77 -0
- package/src/client/chat/tool-call-display.tsx +51 -15
- package/src/scripts/agent-engines/list-agent-engines.ts +8 -0
- package/src/scripts/agent-engines/manage-agent-engine.ts +5 -1
- package/src/scripts/agent-engines/set-agent-engine.ts +9 -1
- package/src/server/agent-chat/framework-prompts.ts +3 -1
- package/src/server/agent-chat/plugin-options.ts +9 -0
- package/src/server/agent-chat-plugin.ts +12 -3
- package/corpus/templates/tasks/.prettierrc +0 -5
- package/src/templates/chat/actions/hello.spec.ts +0 -23
- package/src/templates/chat/actions/navigate.spec.ts +0 -68
- package/src/templates/chat/actions/view-screen.spec.ts +0 -40
- package/src/templates/chat/app/lib/agent-page.spec.tsx +0 -61
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-options.js","sourceRoot":"","sources":["../../../src/server/agent-chat/plugin-options.ts"],"names":[],"mappings":"","sourcesContent":["import type { ActionEntry } from \"../../agent/production-agent.js\";\nimport type { AgentLoopFinalResponseGuard } from \"../../agent/production-agent.js\";\nimport type {\n AgentChatAttachment,\n AgentChatReference,\n MentionProvider,\n} from \"../../agent/types.js\";\nimport type { ExternalAgentPolicy } from \"../../mcp/external-agent-policy.js\";\nimport type { DatabaseToolsOption } from \"../../scripts/db/tool-mode.js\";\nimport type { PromptExamples } from \"../prompts/index.js\";\n\n/** Shape of a Nitro plugin function: receives the Nitro app instance at\n * startup and may register routes/hooks synchronously or asynchronously. */\nexport type NitroPluginDef = (nitroApp: any) => void | Promise<void>;\n\nexport interface AgentChatPluginOptions {\n /** Template-specific actions (email ops, booking ops, etc.) */\n actions?:\n | Record<string, ActionEntry>\n | (() =>\n | Record<string, ActionEntry>\n | Promise<Record<string, ActionEntry>>);\n /** @deprecated Use `actions` instead */\n scripts?:\n | Record<string, ActionEntry>\n | (() =>\n | Record<string, ActionEntry>\n | Promise<Record<string, ActionEntry>>);\n /** System prompt for the agent. A sensible default is provided. */\n systemPrompt?: string;\n /** Additional system prompt prepended in dev mode */\n devSystemPrompt?: string;\n /** Model to use. Defaults to the resolved engine's default model. */\n model?: string;\n /** Optional per-app agent run chunk budget in milliseconds. Defaults to\n * AGENT_RUN_SOFT_TIMEOUT_MS when set, otherwise no framework-imposed\n * timeout. When reached, long runs continue through the hidden continuation\n * path instead of surfacing a timeout warning. */\n runSoftTimeoutMs?: number;\n /** Optional per-app run-manager no-progress watchdog in milliseconds. */\n runNoProgressTimeoutMs?: number;\n /**\n * Opt this app into Netlify durable background-function agent-chat runs. This\n * gives hosted agent turns the 15-minute async-function budget when the app's\n * Netlify build also emits the background function. Set this to `false` to\n * explicitly disable a stale deploy-wide `AGENT_CHAT_DURABLE_BACKGROUND`\n * flag for this app.\n */\n durableBackgroundRuns?: boolean;\n /** Anthropic API key. Falls back to ANTHROPIC_API_KEY env var */\n apiKey?: string;\n /**\n * Agent engine to use. Can be a pre-constructed AgentEngine, a registered\n * engine name (e.g. \"anthropic\", \"ai-sdk:openai\"), or an object with name\n * and config. Defaults to the \"anthropic\" engine using ANTHROPIC_API_KEY.\n */\n engine?:\n | import(\"../../agent/engine/types.js\").AgentEngine\n | string\n | { name: string; config: Record<string, unknown> };\n /** Route path. Default: /_agent-native/agent-chat */\n path?: string;\n /** Custom mention providers for @-tagging template entities */\n mentionProviders?:\n | Record<string, MentionProvider>\n | (() =>\n | Record<string, MentionProvider>\n | Promise<Record<string, MentionProvider>>);\n /** App ID used to exclude self from agent discovery (e.g., \"mail\", \"calendar\") */\n appId?: string;\n /** Optional MCP server branding surfaced during the initialize handshake. */\n mcpServerInfo?: {\n /** Human-facing title. Defaults to the capitalized app id/name. */\n title?: string;\n /** Host-facing description. Defaults to \"Agent-native <app> agent\". */\n description?: string;\n /** Canonical app URL. Relative URLs are resolved against the request origin. */\n websiteUrl?: string;\n /** App icons. Relative `src` values are resolved against the request origin. */\n icons?: Array<{\n src: string;\n mimeType?: string;\n sizes?: string[];\n theme?: \"light\" | \"dark\";\n }>;\n };\n /**\n * Optional callback to resolve the org ID for the current request.\n * When provided, the resolved value is set as AGENT_ORG_ID env var so\n * that db-query/db-exec automatically scope by org_id in addition to\n * owner_email.\n *\n * If not provided, the framework automatically uses `session.orgId` from\n * Better Auth's active organization. Only provide this callback when you\n * need custom org resolution logic (e.g., Atlassian org mapping).\n */\n resolveOrgId?: (event: any) => string | null | Promise<string | null>;\n /**\n * Optional owner resolver for public/anonymous chat surfaces. When the\n * normal app session is missing, this callback may return a synthetic\n * owner id for a narrowly-scoped public request (for example, a public\n * shared document page). Anonymous requests use a read-only tool set by\n * default so public viewers cannot mutate app data through the agent.\n */\n anonymousOwner?: (event: any) => string | null | Promise<string | null>;\n /**\n * Keep anonymous-owner requests on read-only template actions. Defaults to\n * true. Only disable for single-tenant apps that intentionally allow public\n * agent mutations.\n */\n anonymousReadOnly?: boolean;\n /**\n * Optional auth adapter for the HTTP action route\n * (`/_agent-native/actions/*`). Its `resolveCaller` runs before the\n * cookie/bearer `getSession` chain, letting an app accept caller identities\n * `getSession` doesn't understand (e.g. an A2A JWT verified with\n * `verifyA2AToken`) declaratively, instead of pre-seeding request context\n * from a Nitro `request` hook.\n *\n * Returning `null` defers to the normal chain; THROWING hard-rejects with a\n * 401 (an invalid/forged credential must not fall through to a same-origin\n * session cookie). A resolved caller's org comes exclusively from the\n * verified credential — the returned `orgId` or the owner-email membership\n * lookup — never from the request's session cookie.\n * See {@link import(\"../action-routes.js\").ActionRouteAuthAdapter}.\n */\n actionRouteAuth?: import(\"../action-routes.js\").ActionRouteAuthAdapter;\n /**\n * Optional callback to append template-specific context to the system\n * prompt on each request. Runs after AGENTS.md / skills / memory are\n * loaded and before the schema block — use it to inject dynamic SQL\n * context like a data dictionary, active feature flags, or whatever\n * the agent should know about *right now* for this user/org.\n *\n * Return `null` or an empty string to skip. The string you return is\n * appended verbatim, so wrap it in your own XML tags (e.g.\n * `<data-dictionary>…</data-dictionary>`) to keep the prompt scannable.\n *\n * Called on every request in every prompt variant (lean, lazy, full).\n * Templates that want to suppress it in a particular mode should return\n * `null` from the callback based on their own logic.\n */\n extraContext?: (\n event: any,\n owner: string,\n ) => string | null | Promise<string | null>;\n /**\n * Optional final-answer guard. Templates can use this to require a\n * corrective retry before accepting a text-only final answer, e.g. forcing\n * real data-source tool calls for analytics requests.\n */\n finalResponseGuard?: AgentLoopFinalResponseGuard;\n /**\n * Optional per-template request normalizer. Runs after authentication and\n * before the model sees the message, so apps can translate chat attachments\n * into template-native file handles while preserving the user's visible text.\n */\n prepareRequest?: (details: {\n event: any;\n ownerEmail: string | null;\n message: string;\n displayMessage?: string;\n attachments: AgentChatAttachment[];\n references: AgentChatReference[];\n threadId?: string;\n internalContinuation?: boolean;\n mode: \"act\" | \"plan\";\n }) =>\n | void\n | {\n message?: string;\n displayMessage?: string;\n attachments?: AgentChatAttachment[];\n }\n | Promise<void | {\n message?: string;\n displayMessage?: string;\n attachments?: AgentChatAttachment[];\n }>;\n /**\n * Use ONLY the template's `systemPrompt` and the actions list — skip the\n * framework prompt wrapper, resource loading (AGENTS.md/LEARNINGS.md/\n * memory), the SQL schema block, and the workspace files/skills/agents\n * inventory. Intended for minimal or voice-first apps where a long,\n * generic preamble adds latency and iteration noise without adding value.\n *\n * When set, the same lean prompt is used in both dev and prod modes. In\n * dev mode the tool registry is ALSO swapped to the template's actions\n * (same set as prod) — the dev-only bash/db-exec/file-system tools\n * and the resource/docs/chat/team/job/browser scripts are dropped. The\n * lean system prompt has no bash-usage guidance, so routing actions\n * through bash would break. If you need the full dev tool surface,\n * leave this off.\n */\n leanPrompt?: boolean;\n /**\n * Skip auto-injecting the workspace files/skills/agents inventory on the\n * first message of a conversation while keeping the normal prompt, resources,\n * and tool surface. Use this for domain-focused apps where broad workspace\n * inventory is mostly latency/noise unless the user explicitly references it.\n *\n * `leanPrompt: true` and the default `lazyContext` mode imply this because\n * those catalogs are already discoverable through resources, docs-search,\n * tool-search, and the compact resource indexes. Set `false` explicitly only\n * when a workspace-wide inventory is central to the app's first-turn job.\n */\n skipFilesContext?: boolean;\n /**\n * Initial native tool schemas to send to the LLM provider. When set, the\n * agent starts with only these tools plus `tool-search`; the live registry\n * remains searchable, and matching schemas from `tool-search` results are\n * loaded into the next model request. Use this for domain-focused apps that\n * have a few common actions and many rare framework utilities. Common\n * discovery and resource-reading tools are promoted automatically when\n * present. Provider, MCP, extension, and code-execution schemas stay behind\n * tool-search unless the app explicitly includes them in this list.\n */\n initialToolNames?: string[];\n /**\n * Use a compact system prompt with on-demand context loading. The system\n * prompt includes essential behavioral rules and action signatures, but\n * defers verbose framework details, SQL schema, skills, learnings, and\n * memory behind tools (`get-framework-context`, `db-schema`,\n * `resources` (action: read)). The agent fetches these on-demand when needed.\n *\n * This reduces the system prompt by ~60-70%, significantly improving\n * time-to-first-token and reducing \"thinking\" time. The agent retains\n * all capabilities — it just loads context lazily instead of upfront.\n *\n * Defaults to `true`. Set to `false` to use the original full prompt.\n * Ignored when `leanPrompt` is set (lean mode is even more minimal).\n */\n lazyContext?: boolean;\n /**\n * In dev mode, register the template's actions as native tools the agent\n * can call directly with structured JSON args — skipping the default\n * `bash(command=\"pnpm action <name> ...\")` indirection.\n *\n * The default dev behavior shells out because it \"mirrors how Claude Code\n * works locally\" and reduces empty-object tool calls for templates with\n * simple string args. But templates whose actions take structured data\n * (objects, arrays, nested JSON) can't round-trip those cleanly through\n * the CLI parser — stringified JSON on the way in, loss of type fidelity\n * on the way out.\n *\n * Set to `true` to get the same tool surface in dev that production uses.\n * `leanPrompt: true` implies this already (lean mode has no bash-usage\n * guidance, so actions must be native). Set this flag without\n * `leanPrompt` when you want native actions AND the full system prompt.\n *\n * Defaults to `false`.\n */\n nativeActionsInDev?: boolean;\n /**\n * Expose raw SQL/native database tools to the app agent.\n *\n * Defaults to `\"read\"`: `db-schema`/`db-query` are available for inspection,\n * while writes route through typed app actions. Set to `\"write\"` (also\n * `true`) to expose `db-exec`/`db-patch` for scoped raw SQL maintenance.\n * Set to `\"off\"` (also `false`) for chat-first apps that want agents to use\n * typed actions only.\n */\n databaseTools?: DatabaseToolsOption;\n /**\n * Expose framework extension management actions (`create-extension`,\n * `update-extension`, `list-extensions`, etc.) to the app agent. Defaults to\n * true. Set to false for apps that do not want the LLM to create or manage\n * sandboxed extension mini-apps, even though the core extension routes may\n * still be mounted for other surfaces.\n */\n extensionTools?: boolean;\n /**\n * Optional A2A-only deterministic response path. Runs after inbound A2A text\n * and user context are resolved, but before an agent engine/model is loaded.\n * Return a message to complete the A2A task without invoking the LLM, or\n * null/undefined to continue through the normal agent loop.\n */\n a2aMessageFallback?: (details: {\n message: import(\"../../a2a/types.js\").Message;\n text: string;\n context: import(\"../../a2a/types.js\").A2AHandlerContext;\n userEmail: string | undefined;\n }) =>\n | import(\"../../a2a/types.js\").Message\n | string\n | null\n | undefined\n | Promise<import(\"../../a2a/types.js\").Message | string | null | undefined>;\n /**\n * Optional injectable prompt examples for core rules (rule 5 auto-refresh\n * examples and rule 8 external provider names). When absent, generic\n * placeholders are used so no template-specific names appear in the core\n * prompt by default.\n *\n * - `providerActions`: external provider action names this template exposes\n * (e.g. `[\"warehouse-query\", \"crm-records\"]` for a template).\n * - `appActions`: representative template action names for rule 5's refresh\n * examples (e.g. `[\"log-meal\", \"update-form\"]` for a forms template).\n */\n promptExamples?: PromptExamples;\n /**\n * Curated allow-list of action names to serve external **connector** clients\n * on a hosted multi-tenant deployment.\n *\n * Whenever this list is non-empty it is active by default for **every**\n * caller (hosted connectors, code/stdio clients, and the local CLI): external\n * MCP clients see (and can call) only these actions plus the builtin\n * cross-app tools (`list_apps`, `open_app`, `ask_app`, `create_embed_session`).\n * Calls to any tool outside the list are rejected with \"Unknown tool\".\n * This prevents the full ~105-tool catalog from bloating external-agent\n * context windows and removes footguns (db-exec, seed-*, extension suite,\n * browser-session tools) from connectors. It is no longer gated behind an\n * environment variable, and the catalog is never inferred from the client.\n *\n * `tool-search` stays available for discovery; a trimmed action still needs\n * the connector catalog, authenticated-read policy, or full-catalog opt-in\n * before an external caller can execute it.\n * Callers who need the full surface up front opt in explicitly with\n * `agent-native connect --full-catalog` (embeds a `catalog_scope: \"full\"`\n * claim in their connect-minted JWT) or the deployment-wide\n * `AGENT_NATIVE_MCP_FULL_CATALOG=1` env override.\n *\n * Declare here rather than in MCPConfig directly; the plugin copies it through.\n */\n connectorCatalog?: string[];\n\n /**\n * Default authenticated external-agent policy. In `auto` read mode, every\n * action explicitly marked as GET + readOnly + publicAgent.requiresAuth is\n * added to the connector surface automatically. Writes remain ask_app-only\n * unless `writes: \"allowlisted\"` is explicitly selected.\n */\n externalAgents?: ExternalAgentPolicy;\n\n /**\n * Skip mounting the remote MCP protocol route.\n *\n * Most apps should leave this off so agent chat, A2A, and MCP share one\n * runtime. Hosted apps with a dedicated early MCP plugin can set this to\n * true so their external connector does not depend on the heavier chat\n * plugin initialization path.\n */\n disableMcp?: boolean;\n\n /**\n * Code-execution capability for the production agent.\n *\n * - `\"off\"` (default) — no code-execution tools in production.\n * - `\"sandboxed\"` — registers the `run-code` tool (isolated Node.js sandbox\n * with a bridge to allowlisted registered tools). Safe for shared or\n * hosted deployments.\n * - `\"trusted\"` — registers both the full coding tool registry\n * (bash / read / edit / write) and the `run-code` sandbox. Only use in\n * single-tenant or operator-controlled deployments where full shell access\n * to the host machine is intentional.\n *\n * The `AGENT_PROD_CODE_EXECUTION` environment variable (`\"trusted\"`,\n * `\"sandboxed\"`, or `\"off\"`) takes precedence over this option, allowing\n * per-deployment overrides without code changes.\n *\n * Dev-mode behavior is unchanged — both the coding tools and `run-code` are\n * always available when the environment allows toggling.\n */\n codeExecution?: {\n production?: \"off\" | \"sandboxed\" | \"trusted\";\n /**\n * Extra registered-tool names the sandbox bridge may forward (beyond the\n * default allowlist: provider-api-request, provider-api-docs,\n * provider-api-catalog, web-request).\n */\n bridgeTools?: string[];\n };\n\n /**\n * App-level default tool-call limits. Individual actions override these with\n * their own `timeoutMs` / `maxResultChars` declarations.\n */\n toolLimits?: { timeoutMs?: number; maxResultChars?: number };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"plugin-options.js","sourceRoot":"","sources":["../../../src/server/agent-chat/plugin-options.ts"],"names":[],"mappings":"","sourcesContent":["import type { ActionEntry } from \"../../agent/production-agent.js\";\nimport type { AgentLoopFinalResponseGuard } from \"../../agent/production-agent.js\";\nimport type {\n AgentChatAttachment,\n AgentChatReference,\n MentionProvider,\n} from \"../../agent/types.js\";\nimport type { ExternalAgentPolicy } from \"../../mcp/external-agent-policy.js\";\nimport type { DatabaseToolsOption } from \"../../scripts/db/tool-mode.js\";\nimport type { PromptExamples } from \"../prompts/index.js\";\n\n/** Shape of a Nitro plugin function: receives the Nitro app instance at\n * startup and may register routes/hooks synchronously or asynchronously. */\nexport type NitroPluginDef = (nitroApp: any) => void | Promise<void>;\n\nexport interface AgentChatPluginOptions {\n /** Template-specific actions (email ops, booking ops, etc.) */\n actions?:\n | Record<string, ActionEntry>\n | (() =>\n | Record<string, ActionEntry>\n | Promise<Record<string, ActionEntry>>);\n /** @deprecated Use `actions` instead */\n scripts?:\n | Record<string, ActionEntry>\n | (() =>\n | Record<string, ActionEntry>\n | Promise<Record<string, ActionEntry>>);\n /** System prompt for the agent. A sensible default is provided. */\n systemPrompt?: string;\n /** Additional system prompt prepended in dev mode */\n devSystemPrompt?: string;\n /** Model to use. Defaults to the resolved engine's default model. */\n model?: string;\n /** Optional per-app agent run chunk budget in milliseconds. Defaults to\n * AGENT_RUN_SOFT_TIMEOUT_MS when set, otherwise no framework-imposed\n * timeout. When reached, long runs continue through the hidden continuation\n * path instead of surfacing a timeout warning. */\n runSoftTimeoutMs?: number;\n /** Optional per-app run-manager no-progress watchdog in milliseconds. */\n runNoProgressTimeoutMs?: number;\n /**\n * Opt this app into Netlify durable background-function agent-chat runs. This\n * gives hosted agent turns the 15-minute async-function budget when the app's\n * Netlify build also emits the background function. Set this to `false` to\n * explicitly disable a stale deploy-wide `AGENT_CHAT_DURABLE_BACKGROUND`\n * flag for this app.\n */\n durableBackgroundRuns?: boolean;\n /** Anthropic API key. Falls back to ANTHROPIC_API_KEY env var */\n apiKey?: string;\n /**\n * Agent engine to use. Can be a pre-constructed AgentEngine, a registered\n * engine name (e.g. \"anthropic\", \"ai-sdk:openai\"), or an object with name\n * and config. Defaults to the \"anthropic\" engine using ANTHROPIC_API_KEY.\n */\n engine?:\n | import(\"../../agent/engine/types.js\").AgentEngine\n | string\n | { name: string; config: Record<string, unknown> };\n /** Route path. Default: /_agent-native/agent-chat */\n path?: string;\n /** Custom mention providers for @-tagging template entities */\n mentionProviders?:\n | Record<string, MentionProvider>\n | (() =>\n | Record<string, MentionProvider>\n | Promise<Record<string, MentionProvider>>);\n /** App ID used to exclude self from agent discovery (e.g., \"mail\", \"calendar\") */\n appId?: string;\n /** Optional MCP server branding surfaced during the initialize handshake. */\n mcpServerInfo?: {\n /** Human-facing title. Defaults to the capitalized app id/name. */\n title?: string;\n /** Host-facing description. Defaults to \"Agent-native <app> agent\". */\n description?: string;\n /** Canonical app URL. Relative URLs are resolved against the request origin. */\n websiteUrl?: string;\n /** App icons. Relative `src` values are resolved against the request origin. */\n icons?: Array<{\n src: string;\n mimeType?: string;\n sizes?: string[];\n theme?: \"light\" | \"dark\";\n }>;\n };\n /**\n * Optional callback to resolve the org ID for the current request.\n * When provided, the resolved value is set as AGENT_ORG_ID env var so\n * that db-query/db-exec automatically scope by org_id in addition to\n * owner_email.\n *\n * If not provided, the framework automatically uses `session.orgId` from\n * Better Auth's active organization. Only provide this callback when you\n * need custom org resolution logic (e.g., Atlassian org mapping).\n */\n resolveOrgId?: (event: any) => string | null | Promise<string | null>;\n /**\n * Optional owner resolver for public/anonymous chat surfaces. When the\n * normal app session is missing, this callback may return a synthetic\n * owner id for a narrowly-scoped public request (for example, a public\n * shared document page). Anonymous requests use a read-only tool set by\n * default so public viewers cannot mutate app data through the agent.\n */\n anonymousOwner?: (event: any) => string | null | Promise<string | null>;\n /**\n * Keep anonymous-owner requests on read-only template actions. Defaults to\n * true. Only disable for single-tenant apps that intentionally allow public\n * agent mutations.\n */\n anonymousReadOnly?: boolean;\n /**\n * Optional auth adapter for the HTTP action route\n * (`/_agent-native/actions/*`). Its `resolveCaller` runs before the\n * cookie/bearer `getSession` chain, letting an app accept caller identities\n * `getSession` doesn't understand (e.g. an A2A JWT verified with\n * `verifyA2AToken`) declaratively, instead of pre-seeding request context\n * from a Nitro `request` hook.\n *\n * Returning `null` defers to the normal chain; THROWING hard-rejects with a\n * 401 (an invalid/forged credential must not fall through to a same-origin\n * session cookie). A resolved caller's org comes exclusively from the\n * verified credential — the returned `orgId` or the owner-email membership\n * lookup — never from the request's session cookie.\n * See {@link import(\"../action-routes.js\").ActionRouteAuthAdapter}.\n */\n actionRouteAuth?: import(\"../action-routes.js\").ActionRouteAuthAdapter;\n /**\n * Optional callback to append template-specific context to the system\n * prompt on each request. Runs after AGENTS.md / skills / memory are\n * loaded and before the schema block — use it to inject dynamic SQL\n * context like a data dictionary, active feature flags, or whatever\n * the agent should know about *right now* for this user/org.\n *\n * Return `null` or an empty string to skip. The string you return is\n * appended verbatim, so wrap it in your own XML tags (e.g.\n * `<data-dictionary>…</data-dictionary>`) to keep the prompt scannable.\n *\n * Called on every request in every prompt variant (lean, lazy, full).\n * Templates that want to suppress it in a particular mode should return\n * `null` from the callback based on their own logic.\n */\n extraContext?: (\n event: any,\n owner: string,\n ) => string | null | Promise<string | null>;\n /**\n * Optional final-answer guard. Templates can use this to require a\n * corrective retry before accepting a text-only final answer, e.g. forcing\n * real data-source tool calls for analytics requests.\n */\n finalResponseGuard?: AgentLoopFinalResponseGuard;\n /**\n * Optional per-template request normalizer. Runs after authentication and\n * before the model sees the message, so apps can translate chat attachments\n * into template-native file handles while preserving the user's visible text.\n */\n prepareRequest?: (details: {\n event: any;\n ownerEmail: string | null;\n message: string;\n displayMessage?: string;\n attachments: AgentChatAttachment[];\n references: AgentChatReference[];\n threadId?: string;\n internalContinuation?: boolean;\n mode: \"act\" | \"plan\";\n }) =>\n | void\n | {\n message?: string;\n displayMessage?: string;\n attachments?: AgentChatAttachment[];\n }\n | Promise<void | {\n message?: string;\n displayMessage?: string;\n attachments?: AgentChatAttachment[];\n }>;\n /**\n * Use ONLY the template's `systemPrompt` and the actions list — skip the\n * framework prompt wrapper, resource loading (AGENTS.md/LEARNINGS.md/\n * memory), the SQL schema block, and the workspace files/skills/agents\n * inventory. Intended for minimal or voice-first apps where a long,\n * generic preamble adds latency and iteration noise without adding value.\n *\n * When set, the same lean prompt is used in both dev and prod modes. In\n * dev mode the tool registry is ALSO swapped to the template's actions\n * (same set as prod) — the dev-only bash/db-exec/file-system tools\n * and the resource/docs/chat/team/job/browser scripts are dropped. The\n * lean system prompt has no bash-usage guidance, so routing actions\n * through bash would break. If you need the full dev tool surface,\n * leave this off.\n */\n leanPrompt?: boolean;\n /**\n * Skip auto-injecting the workspace files/skills/agents inventory on the\n * first message of a conversation while keeping the normal prompt, resources,\n * and tool surface. Use this for domain-focused apps where broad workspace\n * inventory is mostly latency/noise unless the user explicitly references it.\n *\n * `leanPrompt: true` and the default `lazyContext` mode imply this because\n * those catalogs are already discoverable through resources, docs-search,\n * tool-search, and the compact resource indexes. Set `false` explicitly only\n * when a workspace-wide inventory is central to the app's first-turn job.\n */\n skipFilesContext?: boolean;\n /**\n * Initial native tool schemas to send to the LLM provider. When set, the\n * agent starts with only these tools plus `tool-search`; the live registry\n * remains searchable, and matching schemas from `tool-search` results are\n * loaded into the next model request. Use this for domain-focused apps that\n * have a few common actions and many rare framework utilities. Common\n * discovery and resource-reading tools are promoted automatically when\n * present. Provider, MCP, extension, and code-execution schemas stay behind\n * tool-search unless the app explicitly includes them in this list.\n */\n initialToolNames?: string[];\n /**\n * Controls whether broad provider/corpus tools and their workflow prompt are\n * loaded into the first model request. Use `\"lazy\"` for apps that can answer\n * ordinary lookups from a compact curated tool set; corpus tools remain\n * discoverable through tool-search and the full retry surface.\n *\n * @default \"initial\"\n */\n corpusTools?: \"initial\" | \"lazy\";\n /**\n * Use a compact system prompt with on-demand context loading. The system\n * prompt includes essential behavioral rules and action signatures, but\n * defers verbose framework details, SQL schema, skills, learnings, and\n * memory behind tools (`get-framework-context`, `db-schema`,\n * `resources` (action: read)). The agent fetches these on-demand when needed.\n *\n * This reduces the system prompt by ~60-70%, significantly improving\n * time-to-first-token and reducing \"thinking\" time. The agent retains\n * all capabilities — it just loads context lazily instead of upfront.\n *\n * Defaults to `true`. Set to `false` to use the original full prompt.\n * Ignored when `leanPrompt` is set (lean mode is even more minimal).\n */\n lazyContext?: boolean;\n /**\n * In dev mode, register the template's actions as native tools the agent\n * can call directly with structured JSON args — skipping the default\n * `bash(command=\"pnpm action <name> ...\")` indirection.\n *\n * The default dev behavior shells out because it \"mirrors how Claude Code\n * works locally\" and reduces empty-object tool calls for templates with\n * simple string args. But templates whose actions take structured data\n * (objects, arrays, nested JSON) can't round-trip those cleanly through\n * the CLI parser — stringified JSON on the way in, loss of type fidelity\n * on the way out.\n *\n * Set to `true` to get the same tool surface in dev that production uses.\n * `leanPrompt: true` implies this already (lean mode has no bash-usage\n * guidance, so actions must be native). Set this flag without\n * `leanPrompt` when you want native actions AND the full system prompt.\n *\n * Defaults to `false`.\n */\n nativeActionsInDev?: boolean;\n /**\n * Expose raw SQL/native database tools to the app agent.\n *\n * Defaults to `\"read\"`: `db-schema`/`db-query` are available for inspection,\n * while writes route through typed app actions. Set to `\"write\"` (also\n * `true`) to expose `db-exec`/`db-patch` for scoped raw SQL maintenance.\n * Set to `\"off\"` (also `false`) for chat-first apps that want agents to use\n * typed actions only.\n */\n databaseTools?: DatabaseToolsOption;\n /**\n * Expose framework extension management actions (`create-extension`,\n * `update-extension`, `list-extensions`, etc.) to the app agent. Defaults to\n * true. Set to false for apps that do not want the LLM to create or manage\n * sandboxed extension mini-apps, even though the core extension routes may\n * still be mounted for other surfaces.\n */\n extensionTools?: boolean;\n /**\n * Optional A2A-only deterministic response path. Runs after inbound A2A text\n * and user context are resolved, but before an agent engine/model is loaded.\n * Return a message to complete the A2A task without invoking the LLM, or\n * null/undefined to continue through the normal agent loop.\n */\n a2aMessageFallback?: (details: {\n message: import(\"../../a2a/types.js\").Message;\n text: string;\n context: import(\"../../a2a/types.js\").A2AHandlerContext;\n userEmail: string | undefined;\n }) =>\n | import(\"../../a2a/types.js\").Message\n | string\n | null\n | undefined\n | Promise<import(\"../../a2a/types.js\").Message | string | null | undefined>;\n /**\n * Optional injectable prompt examples for core rules (rule 5 auto-refresh\n * examples and rule 8 external provider names). When absent, generic\n * placeholders are used so no template-specific names appear in the core\n * prompt by default.\n *\n * - `providerActions`: external provider action names this template exposes\n * (e.g. `[\"warehouse-query\", \"crm-records\"]` for a template).\n * - `appActions`: representative template action names for rule 5's refresh\n * examples (e.g. `[\"log-meal\", \"update-form\"]` for a forms template).\n */\n promptExamples?: PromptExamples;\n /**\n * Curated allow-list of action names to serve external **connector** clients\n * on a hosted multi-tenant deployment.\n *\n * Whenever this list is non-empty it is active by default for **every**\n * caller (hosted connectors, code/stdio clients, and the local CLI): external\n * MCP clients see (and can call) only these actions plus the builtin\n * cross-app tools (`list_apps`, `open_app`, `ask_app`, `create_embed_session`).\n * Calls to any tool outside the list are rejected with \"Unknown tool\".\n * This prevents the full ~105-tool catalog from bloating external-agent\n * context windows and removes footguns (db-exec, seed-*, extension suite,\n * browser-session tools) from connectors. It is no longer gated behind an\n * environment variable, and the catalog is never inferred from the client.\n *\n * `tool-search` stays available for discovery; a trimmed action still needs\n * the connector catalog, authenticated-read policy, or full-catalog opt-in\n * before an external caller can execute it.\n * Callers who need the full surface up front opt in explicitly with\n * `agent-native connect --full-catalog` (embeds a `catalog_scope: \"full\"`\n * claim in their connect-minted JWT) or the deployment-wide\n * `AGENT_NATIVE_MCP_FULL_CATALOG=1` env override.\n *\n * Declare here rather than in MCPConfig directly; the plugin copies it through.\n */\n connectorCatalog?: string[];\n\n /**\n * Default authenticated external-agent policy. In `auto` read mode, every\n * action explicitly marked as GET + readOnly + publicAgent.requiresAuth is\n * added to the connector surface automatically. Writes remain ask_app-only\n * unless `writes: \"allowlisted\"` is explicitly selected.\n */\n externalAgents?: ExternalAgentPolicy;\n\n /**\n * Skip mounting the remote MCP protocol route.\n *\n * Most apps should leave this off so agent chat, A2A, and MCP share one\n * runtime. Hosted apps with a dedicated early MCP plugin can set this to\n * true so their external connector does not depend on the heavier chat\n * plugin initialization path.\n */\n disableMcp?: boolean;\n\n /**\n * Code-execution capability for the production agent.\n *\n * - `\"off\"` (default) — no code-execution tools in production.\n * - `\"sandboxed\"` — registers the `run-code` tool (isolated Node.js sandbox\n * with a bridge to allowlisted registered tools). Safe for shared or\n * hosted deployments.\n * - `\"trusted\"` — registers both the full coding tool registry\n * (bash / read / edit / write) and the `run-code` sandbox. Only use in\n * single-tenant or operator-controlled deployments where full shell access\n * to the host machine is intentional.\n *\n * The `AGENT_PROD_CODE_EXECUTION` environment variable (`\"trusted\"`,\n * `\"sandboxed\"`, or `\"off\"`) takes precedence over this option, allowing\n * per-deployment overrides without code changes.\n *\n * Dev-mode behavior is unchanged — both the coding tools and `run-code` are\n * always available when the environment allows toggling.\n */\n codeExecution?: {\n production?: \"off\" | \"sandboxed\" | \"trusted\";\n /**\n * Extra registered-tool names the sandbox bridge may forward (beyond the\n * default allowlist: provider-api-request, provider-api-docs,\n * provider-api-catalog, web-request).\n */\n bridgeTools?: string[];\n };\n\n /**\n * App-level default tool-call limits. Individual actions override these with\n * their own `timeoutMs` / `maxResultChars` declarations.\n */\n toolLimits?: { timeoutMs?: number; maxResultChars?: number };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-chat-plugin.d.ts","sourceRoot":"","sources":["../../src/server/agent-chat-plugin.ts"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAqH7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAEvE,OAAO,EACL,yBAAyB,EACzB,KAAK,6BAA6B,EACnC,MAAM,+BAA+B,CAAC;AAkCvC,OAAO,EAAE,yBAAyB,EAAE,CAAC;AACrC,YAAY,EAAE,6BAA6B,EAAE,CAAC;AAwE9C,OAAO,EACL,0BAA0B,EAM1B,eAAe,EACf,eAAe,EACf,wBA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EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -825,7 +825,10 @@ export function createAgentChatPlugin(options) {
|
|
|
825
825
|
// that never emit the corpus prompt (no provider/run-code tools
|
|
826
826
|
// registered), so this never silently expands the initial set for
|
|
827
827
|
// apps that don't teach these tools by name.
|
|
828
|
-
const
|
|
828
|
+
const loadCorpusToolsInitially = options?.corpusTools !== "lazy";
|
|
829
|
+
const corpusToolNames = loadCorpusToolsInitially
|
|
830
|
+
? corpusToolNamesTaughtByPrompt(corpusPromptRegistry)
|
|
831
|
+
: [];
|
|
829
832
|
const effectiveInitialToolNames = corpusToolNames.length > 0
|
|
830
833
|
? [...new Set([...templateInitialToolNames, ...corpusToolNames])]
|
|
831
834
|
: templateInitialToolNames;
|
|
@@ -1462,7 +1465,9 @@ export function createAgentChatPlugin(options) {
|
|
|
1462
1465
|
// Dev: actions are invoked via bash — emit `pnpm action name --arg <type>`
|
|
1463
1466
|
// and include discoveredActions too, since those are also missing
|
|
1464
1467
|
// from the dev tool registry.
|
|
1465
|
-
const corpusToolsPrompt =
|
|
1468
|
+
const corpusToolsPrompt = loadCorpusToolsInitially
|
|
1469
|
+
? generateCorpusToolsPrompt(corpusPromptRegistry)
|
|
1470
|
+
: "";
|
|
1466
1471
|
const prodActionsPrompt = generateActionsPrompt(templateScripts, "tool", lazyContext ? effectiveInitialToolNames : undefined) + corpusToolsPrompt;
|
|
1467
1472
|
const devActionsPrompt = generateActionsPrompt({ ...discoveredActions, ...templateScripts }, "cli") + corpusToolsPrompt;
|
|
1468
1473
|
// Build system prompts — dynamic functions that pre-load resources per-request.
|
|
@@ -1745,6 +1750,10 @@ export function createAgentChatPlugin(options) {
|
|
|
1745
1750
|
turnId: typeof run.turnId === "string" && run.turnId
|
|
1746
1751
|
? run.turnId
|
|
1747
1752
|
: undefined,
|
|
1753
|
+
runDurationMs: typeof run.startedAt === "number" &&
|
|
1754
|
+
Number.isFinite(run.startedAt)
|
|
1755
|
+
? Math.max(0, Date.now() - run.startedAt)
|
|
1756
|
+
: undefined,
|
|
1748
1757
|
});
|
|
1749
1758
|
if (!assistantMsg) {
|
|
1750
1759
|
// No content produced — just bump timestamp
|