@agent-native/core 0.132.2 → 0.133.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +161 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/a2a/correlation.ts +11 -1
- package/corpus/core/src/a2a/types.ts +11 -3
- package/corpus/core/src/agent/engine/ai-sdk-engine.ts +33 -46
- package/corpus/core/src/agent/engine/builder-engine.ts +22 -10
- package/corpus/core/src/agent/engine/error-detail.ts +184 -3
- package/corpus/core/src/agent/engine/failure-taxonomy.ts +123 -0
- package/corpus/core/src/agent/engine/index.ts +8 -0
- package/corpus/core/src/agent/engine/registry.ts +92 -8
- package/corpus/core/src/agent/engine/translate-ai-sdk.ts +17 -2
- package/corpus/core/src/agent/production-agent.ts +13 -33
- package/corpus/core/src/agent/run-loop-with-resume.ts +1 -1
- package/corpus/core/src/agent/run-manager.ts +43 -14
- package/corpus/core/src/agent/run-store.ts +30 -3
- package/corpus/core/src/agent/thread-data-builder.ts +36 -4
- package/corpus/core/src/cli/templates-meta.ts +13 -0
- package/corpus/core/src/cli/workspace-dev.ts +1 -0
- package/corpus/core/src/client/error-format.ts +12 -0
- package/corpus/core/src/credentials/index.ts +51 -12
- package/corpus/core/src/extensions/url-safety.ts +46 -12
- package/corpus/core/src/integrations/adapters/slack.ts +32 -10
- package/corpus/core/src/integrations/google-docs-poller.ts +12 -1
- package/corpus/core/src/integrations/installations-store.ts +30 -0
- package/corpus/core/src/integrations/plugin.ts +5 -5
- package/corpus/core/src/integrations/types.ts +7 -0
- package/corpus/core/src/integrations/webhook-handler.ts +24 -1
- package/corpus/core/src/jobs/background-automation-runner.ts +38 -1
- package/corpus/core/src/provider-api/index.ts +8 -2
- package/corpus/core/src/scripts/call-agent.ts +6 -0
- package/corpus/core/src/server/agent-chat-plugin.ts +30 -9
- package/corpus/core/src/server/agent-discovery.ts +2 -0
- package/corpus/core/src/server/builder-design-systems.ts +21 -0
- package/corpus/core/src/server/credential-provider.ts +51 -12
- package/corpus/core/src/server/index.ts +1 -0
- package/corpus/core/src/server/onboarding-html.ts +37 -2
- package/corpus/core/src/shared/reasoning-effort.ts +1 -1
- package/corpus/core/src/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +11 -0
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +6 -2
- package/corpus/templates/assets/app/components/layout/Sidebar.tsx +39 -19
- package/corpus/templates/assets/changelog/2026-07-31-the-agent-native-logo-stays-visible-when-the-sidebar-is-coll.md +6 -0
- package/corpus/templates/brain/app/components/layout/Sidebar.tsx +30 -3
- package/corpus/templates/brain/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
- package/corpus/templates/calendar/app/components/layout/AppLayout.tsx +1 -1
- package/corpus/templates/calendar/app/components/layout/Sidebar.tsx +54 -25
- package/corpus/templates/calendar/changelog/2026-07-31-the-agent-native-logo-stays-visible-when-the-sidebar-is-coll.md +6 -0
- package/corpus/templates/chat/app/components/layout/Sidebar.tsx +30 -3
- package/corpus/templates/chat/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
- package/corpus/templates/clips/app/components/library/library-layout.tsx +37 -21
- package/corpus/templates/clips/changelog/2026-07-31-the-agent-native-logo-stays-visible-when-the-sidebar-is-coll.md +6 -0
- package/corpus/templates/clips/desktop/src/hooks/useMediaDevices.ts +1 -1
- package/corpus/templates/clips/desktop/src/lib/media-capture-constraints.ts +1 -1
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +34 -17
- package/corpus/templates/content/changelog/2026-07-31-the-agent-native-logo-stays-visible-when-the-sidebar-is-coll.md +6 -0
- package/corpus/templates/design/.agents/skills/design-systems/SKILL.md +6 -2
- package/corpus/templates/design/actions/create-design-system.ts +1 -0
- package/corpus/templates/design/actions/set-default-design-system.ts +34 -26
- package/corpus/templates/design/app/components/layout/Sidebar.tsx +21 -4
- package/corpus/templates/design/app/i18n-data.ts +39 -0
- package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +229 -12
- package/corpus/templates/design/app/pages/DesignSystems.tsx +10 -4
- package/corpus/templates/design/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
- package/corpus/templates/design/changelog/2026-07-31-design-system-indexing-keeps-your-chosen-name-when-you-uploa.md +6 -0
- package/corpus/templates/design/server/lib/builder-design-system-proxy.ts +19 -4
- package/corpus/templates/dispatch/AGENTS.md +4 -0
- package/corpus/templates/factory/.agents/skills/actions/SKILL.md +562 -0
- package/corpus/templates/factory/.agents/skills/adding-a-feature/SKILL.md +198 -0
- package/corpus/templates/factory/.agents/skills/agent-native-docs/SKILL.md +115 -0
- package/corpus/templates/factory/.agents/skills/agent-native-toolkit/SKILL.md +182 -0
- package/corpus/templates/factory/.agents/skills/capture-learnings/SKILL.md +89 -0
- package/corpus/templates/factory/.agents/skills/create-skill/SKILL.md +221 -0
- package/corpus/templates/factory/.agents/skills/customizing-agent-native/SKILL.md +220 -0
- package/corpus/templates/factory/.agents/skills/delegate-to-agent/SKILL.md +263 -0
- package/corpus/templates/factory/.agents/skills/factory-graphs/SKILL.md +52 -0
- package/corpus/templates/factory/.agents/skills/feature-flags/SKILL.md +169 -0
- package/corpus/templates/factory/.agents/skills/frontend-design/SKILL.md +174 -0
- package/corpus/templates/factory/.agents/skills/real-time-sync/SKILL.md +232 -0
- package/corpus/templates/factory/.agents/skills/security/SKILL.md +324 -0
- package/corpus/templates/factory/.agents/skills/self-modifying-code/SKILL.md +119 -0
- package/corpus/templates/factory/.agents/skills/shadcn-ui/SKILL.md +123 -0
- package/corpus/templates/factory/.agents/skills/sharing/SKILL.md +232 -0
- package/corpus/templates/factory/.agents/skills/storing-data/SKILL.md +178 -0
- package/corpus/templates/factory/.agents/skills/upgrade-agent-native/SKILL.md +122 -0
- package/corpus/templates/factory/.env.example +24 -0
- package/corpus/templates/factory/.ignore +0 -0
- package/corpus/templates/factory/.oxfmtrc.json +8 -0
- package/corpus/templates/factory/AGENTS.md +90 -0
- package/corpus/templates/factory/CHANGELOG.md +10 -0
- package/corpus/templates/factory/DEVELOPING.md +185 -0
- package/corpus/templates/factory/README.md +64 -0
- package/corpus/templates/factory/_gitignore +42 -0
- package/corpus/templates/factory/actions/add-factory-comment.ts +55 -0
- package/corpus/templates/factory/actions/approve-factory-item.ts +214 -0
- package/corpus/templates/factory/actions/babysit-pull-request.ts +126 -0
- package/corpus/templates/factory/actions/evaluate-triage-item.ts +172 -0
- package/corpus/templates/factory/actions/get-factory-graph.ts +62 -0
- package/corpus/templates/factory/actions/get-triage-config.ts +42 -0
- package/corpus/templates/factory/actions/get-triage-item.ts +74 -0
- package/corpus/templates/factory/actions/hello.ts +13 -0
- package/corpus/templates/factory/actions/ingest-github-observation.ts +100 -0
- package/corpus/templates/factory/actions/list-factories.ts +40 -0
- package/corpus/templates/factory/actions/list-factory-comments.ts +40 -0
- package/corpus/templates/factory/actions/list-triage-items.ts +85 -0
- package/corpus/templates/factory/actions/list-triage-rules.ts +44 -0
- package/corpus/templates/factory/actions/navigate.ts +41 -0
- package/corpus/templates/factory/actions/poll-slack-channel.ts +118 -0
- package/corpus/templates/factory/actions/reconcile-triage-run.ts +179 -0
- package/corpus/templates/factory/actions/record-triage-feedback.ts +58 -0
- package/corpus/templates/factory/actions/run.ts +2 -0
- package/corpus/templates/factory/actions/save-factory-graph.ts +129 -0
- package/corpus/templates/factory/actions/save-triage-config.ts +67 -0
- package/corpus/templates/factory/actions/save-triage-rule.ts +89 -0
- package/corpus/templates/factory/actions/suggest-factory-rules.ts +70 -0
- package/corpus/templates/factory/actions/view-screen.ts +73 -0
- package/corpus/templates/factory/app/components/factory/FactoryCanvas.tsx +441 -0
- package/corpus/templates/factory/app/components/factory/FactoryInspector.tsx +388 -0
- package/corpus/templates/factory/app/components/layout/Header.tsx +60 -0
- package/corpus/templates/factory/app/components/layout/Layout.tsx +190 -0
- package/corpus/templates/factory/app/components/layout/Sidebar.tsx +538 -0
- package/corpus/templates/factory/app/components/triage/triage-status-pill.tsx +28 -0
- package/corpus/templates/factory/app/components/ui/button.tsx +1 -0
- package/corpus/templates/factory/app/components/ui/card.tsx +1 -0
- package/corpus/templates/factory/app/components/ui/dropdown-menu.tsx +1 -0
- package/corpus/templates/factory/app/components/ui/input.tsx +1 -0
- package/corpus/templates/factory/app/components/ui/label.tsx +1 -0
- package/corpus/templates/factory/app/components/ui/sheet.tsx +1 -0
- package/corpus/templates/factory/app/components/ui/textarea.tsx +1 -0
- package/corpus/templates/factory/app/components/ui/toolkit-provider.tsx +17 -0
- package/corpus/templates/factory/app/components/ui/tooltip.tsx +1 -0
- package/corpus/templates/factory/app/design-system.ts +3 -0
- package/corpus/templates/factory/app/entry.client.tsx +22 -0
- package/corpus/templates/factory/app/entry.server.tsx +10 -0
- package/corpus/templates/factory/app/global.css +93 -0
- package/corpus/templates/factory/app/hooks/use-navigation-state.ts +113 -0
- package/corpus/templates/factory/app/i18n/en-US.ts +211 -0
- package/corpus/templates/factory/app/i18n/index.ts +34 -0
- package/corpus/templates/factory/app/i18n-data.ts +556 -0
- package/corpus/templates/factory/app/lib/agent-page.tsx +49 -0
- package/corpus/templates/factory/app/lib/app-config.ts +11 -0
- package/corpus/templates/factory/app/lib/tab-id.ts +1 -0
- package/corpus/templates/factory/app/lib/utils.ts +1 -0
- package/corpus/templates/factory/app/root.tsx +175 -0
- package/corpus/templates/factory/app/routes/_index.tsx +94 -0
- package/corpus/templates/factory/app/routes/agent.tsx +24 -0
- package/corpus/templates/factory/app/routes/chat.$threadId.tsx +1 -0
- package/corpus/templates/factory/app/routes/database.tsx +17 -0
- package/corpus/templates/factory/app/routes/extensions.$id.$slug.tsx +2 -0
- package/corpus/templates/factory/app/routes/extensions.$id.tsx +11 -0
- package/corpus/templates/factory/app/routes/extensions._index.tsx +11 -0
- package/corpus/templates/factory/app/routes/extensions.tsx +5 -0
- package/corpus/templates/factory/app/routes/factory.tsx +1003 -0
- package/corpus/templates/factory/app/routes/observability.tsx +19 -0
- package/corpus/templates/factory/app/routes/settings.tsx +89 -0
- package/corpus/templates/factory/app/routes/team.tsx +11 -0
- package/corpus/templates/factory/app/routes.ts +4 -0
- package/corpus/templates/factory/app/vite-env.d.ts +6 -0
- package/corpus/templates/factory/changelog/2026-06-24-a-new-settings-page-gives-quick-access-to-language-workspace.md +6 -0
- package/corpus/templates/factory/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +6 -0
- package/corpus/templates/factory/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/factory/changelog/2026-06-28-left-sidebar-collapse-motion-and-footer-chrome-are-quieter.md +6 -0
- package/corpus/templates/factory/changelog/2026-06-29-chat-layouts-adapt-when-the-agent-sidebar-is-open.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/corpus/templates/factory/changelog/2026-07-10-chat-now-makes-ai-connection-setup-clear-without-shifting-th.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-13-a-full-agent-page-now-brings-context-files-connections-jobs-.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-14-chat-opens-reliably-on-hosted-deployments-instead-of-failing.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-14-fixed-chat-template-startup-with-older-core-versions.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-15-chat-navigation-focuses-on-chat-and-agent.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-17-the-agent-chat-sidebar-stays-closed-until-you-open-it-or-sta.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-22-compact-sidebar-footer.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-22-full-page-chat-keeps-the-active-conversation-when-moving-to-.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-22-recent-chats-are-easier-to-scan-and-expand.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-23-full-page-chat-is-better-centered-with-quieter-chat-history-.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-24-borderless-secondary-surfaces.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-24-sidebar-footer-controls-follow-a-consistent-order.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-25-settings-navigation-now-keeps-manage-agent-as-a-dedicated-li.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-31-added-an-inspectable-observe-only-factory-queue-for-slack-.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
- package/corpus/templates/factory/components.json +20 -0
- package/corpus/templates/factory/data/sync-config.json +1 -0
- package/corpus/templates/factory/learnings.defaults.md +5 -0
- package/corpus/templates/factory/netlify.toml +10 -0
- package/corpus/templates/factory/package.json +105 -0
- package/corpus/templates/factory/public/agent-native-icon-dark.svg +10 -0
- package/corpus/templates/factory/public/agent-native-icon-light.svg +10 -0
- package/corpus/templates/factory/public/agent-native-logo-dark.svg +21 -0
- package/corpus/templates/factory/public/agent-native-logo-light.svg +21 -0
- package/corpus/templates/factory/public/favicon.svg +1 -0
- package/corpus/templates/factory/public/icon-180.svg +1 -0
- package/corpus/templates/factory/public/icon-192.svg +1 -0
- package/corpus/templates/factory/public/icon-512.svg +1 -0
- package/corpus/templates/factory/public/manifest.json +21 -0
- package/corpus/templates/factory/react-router.config.ts +7 -0
- package/corpus/templates/factory/server/connectors/credentials.ts +129 -0
- package/corpus/templates/factory/server/connectors/slack.ts +129 -0
- package/corpus/templates/factory/server/db/index.ts +6 -0
- package/corpus/templates/factory/server/db/schema.ts +193 -0
- package/corpus/templates/factory/server/factory-graph/contracts.ts +212 -0
- package/corpus/templates/factory/server/factory-graph/store.ts +121 -0
- package/corpus/templates/factory/server/lib/require-workspace-member.ts +55 -0
- package/corpus/templates/factory/server/middleware/auth.ts +15 -0
- package/corpus/templates/factory/server/plugins/agent-chat.ts +58 -0
- package/corpus/templates/factory/server/plugins/auth.ts +14 -0
- package/corpus/templates/factory/server/plugins/factory-migrations.ts +247 -0
- package/corpus/templates/factory/server/plugins/factory-scheduler-job.ts +116 -0
- package/corpus/templates/factory/server/plugins/integrations.ts +46 -0
- package/corpus/templates/factory/server/routes/[...page].get.ts +5 -0
- package/corpus/templates/factory/server/routes/_agent-native/factory/builder-callback.post.ts +116 -0
- package/corpus/templates/factory/server/triage/ai-services-git.ts +197 -0
- package/corpus/templates/factory/server/triage/builder-executor.ts +118 -0
- package/corpus/templates/factory/server/triage/contracts.ts +164 -0
- package/corpus/templates/factory/server/triage/github-ingestion.ts +35 -0
- package/corpus/templates/factory/server/triage/guards.ts +121 -0
- package/corpus/templates/factory/server/triage/ids.ts +27 -0
- package/corpus/templates/factory/server/triage/pr-babysit.ts +100 -0
- package/corpus/templates/factory/server/triage/pr-monitor.ts +220 -0
- package/corpus/templates/factory/server/triage/slack-client.ts +55 -0
- package/corpus/templates/factory/server/triage/slack-poller.ts +152 -0
- package/corpus/templates/factory/ssr-entry.ts +15 -0
- package/corpus/templates/factory/tsconfig.json +21 -0
- package/corpus/templates/factory/vite.config.ts +19 -0
- package/corpus/templates/forms/app/components/layout/Sidebar.tsx +55 -5
- package/corpus/templates/forms/changelog/2026-07-31-the-agent-native-logo-stays-visible-when-the-sidebar-is-coll.md +6 -0
- package/corpus/templates/macros/app/components/layout/AppLayout.tsx +6 -2
- package/corpus/templates/plan/app/components/layout/Sidebar.tsx +21 -6
- package/corpus/templates/plan/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
- package/corpus/templates/slides/.agents/skills/create-deck/SKILL.md +12 -0
- package/corpus/templates/slides/.agents/skills/design-systems/SKILL.md +9 -0
- package/corpus/templates/slides/.agents/skills/slide-editing/SKILL.md +11 -0
- package/corpus/templates/slides/AGENTS.md +5 -6
- package/corpus/templates/slides/actions/_await-fit-check.ts +20 -10
- package/corpus/templates/slides/actions/add-slide.ts +17 -4
- package/corpus/templates/slides/actions/create-design-system.ts +16 -4
- package/corpus/templates/slides/actions/delete-design-system.ts +18 -2
- package/corpus/templates/slides/actions/get-layout-overflows.ts +88 -0
- package/corpus/templates/slides/actions/import-file.ts +1 -0
- package/corpus/templates/slides/actions/index-design-system-with-builder.ts +8 -0
- package/corpus/templates/slides/actions/patch-deck.ts +48 -16
- package/corpus/templates/slides/actions/set-default-design-system.ts +49 -19
- package/corpus/templates/slides/actions/update-slide.ts +13 -3
- package/corpus/templates/slides/actions/view-screen.ts +87 -10
- package/corpus/templates/slides/app/components/deck/SlideRenderer.tsx +155 -28
- package/corpus/templates/slides/app/components/design-system/DesignSystemCard.tsx +21 -17
- package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +849 -341
- package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +102 -2
- package/corpus/templates/slides/app/components/editor/PromptDialog.tsx +13 -16
- package/corpus/templates/slides/app/components/editor/SlideEditor.tsx +60 -12
- package/corpus/templates/slides/app/components/editor/SlideOverflowWarning.tsx +11 -1
- package/corpus/templates/slides/app/components/layout/Sidebar.tsx +66 -19
- package/corpus/templates/slides/app/i18n/en-US.ts +23 -0
- package/corpus/templates/slides/app/lib/normalize-slide-padding.ts +8 -15
- package/corpus/templates/slides/app/pages/DeckEditor.tsx +4 -3
- package/corpus/templates/slides/app/pages/DesignSystems.tsx +4 -3
- package/corpus/templates/slides/app/pages/Index.tsx +1 -1
- package/corpus/templates/slides/changelog/2026-07-31-design-system-details-now-show-their-source-and-indexing-sta.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-31-design-system-indexing-keeps-your-chosen-name-when-you-uploa.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-31-design-system-setup-keeps-focus-rings-visible-and-uses-a-sim.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-31-skip-prompt-is-now-available-in-the-new-deck-prompt-header.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-31-slides-now-detect-real-text-and-box-overflow-across-the-deck.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-31-the-agent-native-logo-stays-visible-when-the-sidebar-is-coll.md +6 -0
- package/corpus/templates/slides/server/handlers/design-systems.ts +1 -0
- package/corpus/templates/slides/server/handlers/index-design-system-sources.ts +1 -0
- package/corpus/templates/slides/server/lib/builder-design-system-proxy.ts +23 -4
- package/corpus/templates/slides/server/plugins/agent-chat.ts +5 -0
- package/corpus/templates/slides/server/plugins/creative-context.ts +16 -3
- package/corpus/templates/slides/server/workspace-defaults.ts +5 -1
- package/corpus/templates/slides/shared/slide-fit.ts +26 -0
- package/corpus/templates/tasks/app/components/layout/Sidebar.tsx +30 -3
- package/corpus/templates/tasks/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
- package/dist/a2a/correlation.d.ts +4 -1
- package/dist/a2a/correlation.d.ts.map +1 -1
- package/dist/a2a/correlation.js +8 -1
- package/dist/a2a/correlation.js.map +1 -1
- package/dist/a2a/types.d.ts +11 -3
- package/dist/a2a/types.d.ts.map +1 -1
- package/dist/a2a/types.js.map +1 -1
- package/dist/agent/engine/ai-sdk-engine.d.ts.map +1 -1
- package/dist/agent/engine/ai-sdk-engine.js +27 -41
- package/dist/agent/engine/ai-sdk-engine.js.map +1 -1
- package/dist/agent/engine/builder-engine.d.ts.map +1 -1
- package/dist/agent/engine/builder-engine.js +18 -8
- package/dist/agent/engine/builder-engine.js.map +1 -1
- package/dist/agent/engine/error-detail.d.ts +61 -0
- package/dist/agent/engine/error-detail.d.ts.map +1 -1
- package/dist/agent/engine/error-detail.js +145 -3
- package/dist/agent/engine/error-detail.js.map +1 -1
- package/dist/agent/engine/failure-taxonomy.d.ts +24 -0
- package/dist/agent/engine/failure-taxonomy.d.ts.map +1 -0
- package/dist/agent/engine/failure-taxonomy.js +88 -0
- package/dist/agent/engine/failure-taxonomy.js.map +1 -0
- package/dist/agent/engine/index.d.ts +2 -1
- package/dist/agent/engine/index.d.ts.map +1 -1
- package/dist/agent/engine/index.js +2 -1
- package/dist/agent/engine/index.js.map +1 -1
- package/dist/agent/engine/registry.d.ts +16 -0
- package/dist/agent/engine/registry.d.ts.map +1 -1
- package/dist/agent/engine/registry.js +71 -6
- package/dist/agent/engine/registry.js.map +1 -1
- package/dist/agent/engine/translate-ai-sdk.d.ts.map +1 -1
- package/dist/agent/engine/translate-ai-sdk.js +14 -2
- package/dist/agent/engine/translate-ai-sdk.js.map +1 -1
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +13 -24
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-loop-with-resume.js +1 -1
- package/dist/agent/run-loop-with-resume.js.map +1 -1
- package/dist/agent/run-manager.d.ts.map +1 -1
- package/dist/agent/run-manager.js +39 -10
- package/dist/agent/run-manager.js.map +1 -1
- package/dist/agent/run-store.d.ts +10 -0
- package/dist/agent/run-store.d.ts.map +1 -1
- package/dist/agent/run-store.js +20 -3
- package/dist/agent/run-store.js.map +1 -1
- package/dist/agent/thread-data-builder.d.ts.map +1 -1
- package/dist/agent/thread-data-builder.js +28 -4
- package/dist/agent/thread-data-builder.js.map +1 -1
- package/dist/cli/templates-meta.d.ts.map +1 -1
- package/dist/cli/templates-meta.js +13 -0
- package/dist/cli/templates-meta.js.map +1 -1
- package/dist/cli/workspace-dev.d.ts.map +1 -1
- package/dist/cli/workspace-dev.js +1 -0
- package/dist/cli/workspace-dev.js.map +1 -1
- package/dist/client/error-format.d.ts.map +1 -1
- package/dist/client/error-format.js +10 -0
- package/dist/client/error-format.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/credentials/index.d.ts +9 -2
- package/dist/credentials/index.d.ts.map +1 -1
- package/dist/credentials/index.js +50 -8
- package/dist/credentials/index.js.map +1 -1
- package/dist/extensions/url-safety.d.ts.map +1 -1
- package/dist/extensions/url-safety.js +38 -12
- package/dist/extensions/url-safety.js.map +1 -1
- package/dist/integrations/adapters/slack.d.ts.map +1 -1
- package/dist/integrations/adapters/slack.js +25 -8
- package/dist/integrations/adapters/slack.js.map +1 -1
- package/dist/integrations/google-docs-poller.d.ts.map +1 -1
- package/dist/integrations/google-docs-poller.js +13 -1
- package/dist/integrations/google-docs-poller.js.map +1 -1
- package/dist/integrations/installations-store.d.ts +10 -0
- package/dist/integrations/installations-store.d.ts.map +1 -1
- package/dist/integrations/installations-store.js +24 -0
- package/dist/integrations/installations-store.js.map +1 -1
- package/dist/integrations/plugin.d.ts.map +1 -1
- package/dist/integrations/plugin.js +6 -5
- package/dist/integrations/plugin.js.map +1 -1
- package/dist/integrations/types.d.ts +7 -0
- package/dist/integrations/types.d.ts.map +1 -1
- package/dist/integrations/types.js.map +1 -1
- package/dist/integrations/webhook-handler.d.ts.map +1 -1
- package/dist/integrations/webhook-handler.js +16 -1
- package/dist/integrations/webhook-handler.js.map +1 -1
- package/dist/jobs/background-automation-runner.d.ts.map +1 -1
- package/dist/jobs/background-automation-runner.js +35 -2
- package/dist/jobs/background-automation-runner.js.map +1 -1
- package/dist/mcp/screen-memory-stdio.d.ts +7 -7
- package/dist/mcp/screen-memory-stdio.d.ts.map +1 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/routes.d.ts +3 -3
- package/dist/provider-api/actions/custom-provider-registration.d.ts +14 -14
- package/dist/provider-api/actions/provider-api.d.ts +8 -8
- package/dist/provider-api/index.js +7 -3
- package/dist/provider-api/index.js.map +1 -1
- package/dist/scripts/call-agent.d.ts.map +1 -1
- package/dist/scripts/call-agent.js +6 -1
- package/dist/scripts/call-agent.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +25 -7
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-discovery.d.ts +2 -0
- package/dist/server/agent-discovery.d.ts.map +1 -1
- package/dist/server/agent-discovery.js.map +1 -1
- package/dist/server/builder-design-systems.d.ts +4 -1
- package/dist/server/builder-design-systems.d.ts.map +1 -1
- package/dist/server/builder-design-systems.js +11 -1
- package/dist/server/builder-design-systems.js.map +1 -1
- package/dist/server/credential-provider.d.ts.map +1 -1
- package/dist/server/credential-provider.js +49 -12
- package/dist/server/credential-provider.js.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/onboarding-html.d.ts.map +1 -1
- package/dist/server/onboarding-html.js +37 -2
- package/dist/server/onboarding-html.js.map +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/shared/reasoning-effort.d.ts +1 -0
- package/dist/shared/reasoning-effort.d.ts.map +1 -1
- package/dist/shared/reasoning-effort.js +1 -1
- package/dist/shared/reasoning-effort.js.map +1 -1
- package/dist/templates/chat/app/components/layout/Sidebar.tsx +30 -3
- package/dist/templates/chat/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
- package/dist/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +11 -0
- package/package.json +1 -1
- package/src/a2a/correlation.ts +11 -1
- package/src/a2a/types.ts +11 -3
- package/src/agent/engine/ai-sdk-engine.ts +33 -46
- package/src/agent/engine/builder-engine.ts +22 -10
- package/src/agent/engine/error-detail.ts +184 -3
- package/src/agent/engine/failure-taxonomy.ts +123 -0
- package/src/agent/engine/index.ts +8 -0
- package/src/agent/engine/registry.ts +92 -8
- package/src/agent/engine/translate-ai-sdk.ts +17 -2
- package/src/agent/production-agent.ts +13 -33
- package/src/agent/run-loop-with-resume.ts +1 -1
- package/src/agent/run-manager.ts +43 -14
- package/src/agent/run-store.ts +30 -3
- package/src/agent/thread-data-builder.ts +36 -4
- package/src/cli/templates-meta.ts +13 -0
- package/src/cli/workspace-dev.ts +1 -0
- package/src/client/error-format.ts +12 -0
- package/src/credentials/index.ts +51 -12
- package/src/extensions/url-safety.ts +46 -12
- package/src/integrations/adapters/slack.ts +32 -10
- package/src/integrations/google-docs-poller.ts +12 -1
- package/src/integrations/installations-store.ts +30 -0
- package/src/integrations/plugin.ts +5 -5
- package/src/integrations/types.ts +7 -0
- package/src/integrations/webhook-handler.ts +24 -1
- package/src/jobs/background-automation-runner.ts +38 -1
- package/src/provider-api/index.ts +8 -2
- package/src/scripts/call-agent.ts +6 -0
- package/src/server/agent-chat-plugin.ts +30 -9
- package/src/server/agent-discovery.ts +2 -0
- package/src/server/builder-design-systems.ts +21 -0
- package/src/server/credential-provider.ts +51 -12
- package/src/server/index.ts +1 -0
- package/src/server/onboarding-html.ts +37 -2
- package/src/shared/reasoning-effort.ts +1 -1
- package/src/templates/chat/app/components/layout/Sidebar.tsx +30 -3
- package/src/templates/chat/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
- package/src/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +11 -0
- package/corpus/templates/clips/desktop/src/lib/media-device-selection.ts +0 -157
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-detail.js","sourceRoot":"","sources":["../../../src/agent/engine/error-detail.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAClC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAEjC,MAAM,UAAU,uBAAuB,CACrC,GAAY,EACZ,QAAQ,GAAW,uBAAuB;IAE1C,MAAM,IAAI,GACR,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,eAAe,CAAC,CAAC;IACtE,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,IAAI,GAAG,IAAI,GAAG,CAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC,IAAI,KAAK,GAAa,GAAkC,EAAE,KAAK,CAAC;IAChE,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,MAAM,GAAG,QAAQ,EAAE,CAAC;QACxE,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,MAAM;QAC3B,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAChB,MAAM,IAAI,GAAI,KAA4B,CAAC,IAAI,CAAC;QAChD,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,MAAM,IAAI,GAAG,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;aACrE,IAAI,EAAE;aACN,KAAK,CAAC,CAAC,EAAE,oBAAoB,CAAC,CAAC;QAClC,IAAI,IAAI;YAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,KAAK,GAAI,KAA6B,CAAC,KAAK,CAAC;IAC/C,CAAC;IACD,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,YAAY,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5E,CAAC","sourcesContent":["/**\n * Compose an error's message with its `cause` chain.\n *\n * Provider SDKs collapse the real failure into a generic wrapper message —\n * the Anthropic SDK reports every transport failure as exactly\n * \"Connection error.\" and undici reports \"fetch failed\" — and keep the actual\n * reason (ECONNRESET, UND_ERR_SOCKET, TLS failure, request too large) only on\n * `.cause`. Recording `err.message` alone makes every one of them\n * indistinguishable after the fact, which is how a whole class of production\n * failures becomes undiagnosable.\n *\n * Classification (`isConnectionError`, `isRetryableError`) must keep matching\n * on the bare `err.message` — this is for the RECORDED detail only.\n */\nconst DEFAULT_MAX_CAUSE_LINKS = 4;\nconst MAX_CAUSE_LINK_CHARS = 200;\n\nexport function describeErrorWithCauses(\n err: unknown,\n maxLinks: number = DEFAULT_MAX_CAUSE_LINKS,\n): string {\n const head =\n err instanceof Error ? err.message : String(err ?? \"Unknown error\");\n const links: string[] = [];\n const seen = new Set<unknown>([err]);\n let cause: unknown = (err as { cause?: unknown } | null)?.cause;\n while (cause !== undefined && cause !== null && links.length < maxLinks) {\n if (seen.has(cause)) break;\n seen.add(cause);\n const code = (cause as { code?: unknown }).code;\n const message = cause instanceof Error ? cause.message : String(cause);\n const text = (typeof code === \"string\" ? `${code} ${message}` : message)\n .trim()\n .slice(0, MAX_CAUSE_LINK_CHARS);\n if (text) links.push(text);\n cause = (cause as { cause?: unknown }).cause;\n }\n return links.length > 0 ? `${head} (cause: ${links.join(\" <- \")})` : head;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"error-detail.js","sourceRoot":"","sources":["../../../src/agent/engine/error-detail.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAClC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAEjC,MAAM,UAAU,uBAAuB,CACrC,GAAY,EACZ,QAAQ,GAAW,uBAAuB;IAE1C,MAAM,IAAI,GACR,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,eAAe,CAAC,CAAC;IACtE,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,IAAI,GAAG,IAAI,GAAG,CAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC,IAAI,KAAK,GAAa,GAAkC,EAAE,KAAK,CAAC;IAChE,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,MAAM,GAAG,QAAQ,EAAE,CAAC;QACxE,IAAI,IAAI,CAAC,GA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5E,yEAAyE;IACzE,2EAA2E;IAC3E,oDAAoD;IACpD,IACE,GAAG,CAAC,QAAQ,CAAC,oCAAoC,CAAC;QAClD,GAAG,CAAC,QAAQ,CAAC,4BAA4B,CAAC;QAC1C,CAAC,GAAG,CAAC,QAAQ,CAAC,kBAAkB,CAAC;YAC/B,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,EACtD,CAAC;QACD,OAAO,uBAAuB,CAAC;IACjC,CAAC;IACD,IAAI,GAAG,CAAC,QAAQ,CAAC,+BAA+B,CAAC,IAAI,GAAG,KAAK,cAAc,EAAE,CAAC;QAC5E,OAAO,sBAAsB,CAAC;IAChC,CAAC;IACD,IACE,wGAAwG,CAAC,IAAI,CAC3G,OAAO,CACR,EACD,CAAC;QACD,OAAO,wBAAwB,CAAC;IAClC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["/**\n * Compose an error's message with its `cause` chain.\n *\n * Provider SDKs collapse the real failure into a generic wrapper message —\n * the Anthropic SDK reports every transport failure as exactly\n * \"Connection error.\" and undici reports \"fetch failed\" — and keep the actual\n * reason (ECONNRESET, UND_ERR_SOCKET, TLS failure, request too large) only on\n * `.cause`. Recording `err.message` alone makes every one of them\n * indistinguishable after the fact, which is how a whole class of production\n * failures becomes undiagnosable.\n */\nconst DEFAULT_MAX_CAUSE_LINKS = 4;\nconst MAX_CAUSE_LINK_CHARS = 200;\n\nexport function describeErrorWithCauses(\n err: unknown,\n maxLinks: number = DEFAULT_MAX_CAUSE_LINKS,\n): string {\n const head =\n err instanceof Error ? err.message : String(err ?? \"Unknown error\");\n const links: string[] = [];\n const seen = new Set<unknown>([err]);\n let cause: unknown = (err as { cause?: unknown } | null)?.cause;\n while (cause !== undefined && cause !== null && links.length < maxLinks) {\n if (seen.has(cause)) break;\n seen.add(cause);\n const code = (cause as { code?: unknown }).code;\n const message = cause instanceof Error ? cause.message : String(cause);\n const text = (typeof code === \"string\" ? `${code} ${message}` : message)\n .trim()\n .slice(0, MAX_CAUSE_LINK_CHARS);\n if (text) links.push(text);\n cause = (cause as { cause?: unknown }).cause;\n }\n return links.length > 0 ? `${head} (cause: ${links.join(\" <- \")})` : head;\n}\n\n/**\n * The single provider-transport-failure classifier. Every layer that decides\n * \"is this a network blip?\" — engine error codes, run-level retry, Sentry\n * suppression — must call THIS, on `describeErrorWithCauses(err)` rather than\n * on a bare `err.message`.\n *\n * Four divergent copies of this predicate existed, and they disagreed on\n * exactly the string production actually throws. The AI SDK's `RetryError`\n * reports `\"Failed after 2 attempts. Last error: Cannot connect to API: …\"`,\n * so a copy anchored with `startsWith` scored it as unclassified while a copy\n * using `includes` scored it as retryable. The result was a split brain: the\n * agent loop retried the turn, but the run persisted `error_code = 'unknown'`,\n * which the client does not list as auto-recoverable — so a transient TLS\n * reset ended the user's chat with a dead error instead of resuming. That one\n * mismatch accounted for ~150 failed production runs in a week.\n *\n * Substring matching is deliberate: the real message is always a provider SDK\n * wrapper around the transport error, never bare, and the wrapper prefix\n * differs per SDK and per version.\n */\nexport function isProviderConnectionErrorMessage(message: string): boolean {\n const normalized = message.toLowerCase();\n return (\n normalized.includes(\"connection error\") ||\n normalized.includes(\"cannot connect to api\")\n );\n}\n\n/** `isProviderConnectionErrorMessage` over an error's full cause chain. */\nexport function isProviderConnectionError(err: unknown): boolean {\n return isProviderConnectionErrorMessage(describeErrorWithCauses(err));\n}\n\n/** Classification fields an AI SDK provider failure carries. */\nexport interface ProviderErrorClassification {\n errorCode?: string;\n statusCode?: number;\n providerRetryable?: boolean;\n}\n\n/**\n * Classify a provider error from the AI SDK, whichever way it surfaced.\n *\n * `streamText` does not throw for a failed provider request — it emits an\n * `error` part on `fullStream` — so there are two arrival paths, and only the\n * thrown one used to be classified. The stream-part path discarded\n * `statusCode`, `errorCode`, and `isRetryable` entirely, which is why every\n * provider HTTP failure on an ai-sdk engine landed as `unknown`: a 429 was only\n * retried if its prose happened to contain \"rate_limit\", and a\n * 100%-reproducible config 400 was indistinguishable from any other unclassified\n * failure, so it had no signature to alert on. Both call sites go through here.\n *\n * `timedOut` is the caller's own first-event deadline, which only the streaming\n * path can know.\n */\nexport function classifyProviderError(\n err: unknown,\n timedOut = false,\n): ProviderErrorClassification {\n // The AI SDK wraps exhausted retries in RetryError and keeps the final\n // APICallError on `lastError`.\n const wrapped = err as { lastError?: unknown } | null;\n const providerError = (\n wrapped?.lastError instanceof Error ? wrapped.lastError : err\n ) as {\n statusCode?: unknown;\n isRetryable?: unknown;\n message?: unknown;\n } | null;\n\n const statusCode =\n typeof providerError?.statusCode === \"number\"\n ? providerError.statusCode\n : undefined;\n\n // Classify on the cause chain of the ORIGINAL error, not the unwrapped one:\n // when RetryError does not expose `lastError` as an Error the unwrap falls\n // back to the wrapper, whose message (\"Failed after 2 attempts. Last error:\n // …\") only *embeds* the transport failure. Matching the wrapper is the point.\n const described = describeErrorWithCauses(err);\n const isConnectionError =\n !timedOut &&\n statusCode === undefined &&\n (isProviderConnectionErrorMessage(described) ||\n isProviderConnectionErrorMessage(\n typeof providerError?.message === \"string\"\n ? providerError.message\n : String(providerError),\n ));\n\n const providerRetryable =\n typeof providerError?.isRetryable === \"boolean\"\n ? providerError.isRetryable\n : isConnectionError || timedOut\n ? true\n : undefined;\n\n return {\n // Tag every known status as `http_<status>` (not just 401) so a rate limit\n // surfaces as `http_429`: the structured statusCode drives turn-level\n // retries, but run-level continuation keys off the errorCode.\n ...(statusCode !== undefined\n ? { errorCode: `http_${statusCode}`, statusCode }\n : isConnectionError || timedOut\n ? { errorCode: \"provider_network_error\" }\n : // Nothing structured — fall back to reading the message, so a\n // stream-part 529/timeout is not silently unclassified.\n (() => {\n const code = classifyTerminalErrorCode(described);\n return code ? { errorCode: code } : {};\n })()),\n ...(providerRetryable !== undefined ? { providerRetryable } : {}),\n };\n}\n\n/**\n * Last-resort error code for a terminal error that reached persistence with no\n * structured code. Persisting `\"unknown\"` is not a neutral default: the client\n * auto-recovers a fixed list of transport codes, so an unclassified transient\n * blip ends the user's chat while the identical failure carrying its real code\n * resumes. Over four days that gap was 28% of ALL production chat turns.\n *\n * The invariant is NOT \"only transport failures may be named\". It is: a code\n * returned here must be absent from the client's recoverable list unless a\n * fresh attempt genuinely helps. Naming a deterministic failure is what stops\n * it from reaching the user as raw provider text and hiding inside `unknown`;\n * naming it *recoverable* is what buys a retry spiral. Those are different\n * decisions, and `error-detail.spec.ts` asserts the deterministic codes below\n * stay non-recoverable.\n */\nexport function classifyTerminalErrorCode(\n message: string | undefined,\n): string | undefined {\n if (!message) return undefined;\n const msg = message.toLowerCase();\n if (isProviderConnectionErrorMessage(msg)) return \"provider_network_error\";\n // Word-bounded: request ids and hashes routinely contain a bare \"529\".\n if (msg.includes(\"overloaded\") || /\\b529\\b/.test(msg)) {\n return \"overloaded_error\";\n }\n if (msg.includes(\"too many requests\") || /\\b429\\b/.test(msg)) {\n return \"http_429\";\n }\n if (\n msg.includes(\"timed out\") ||\n msg.includes(\"timeout\") ||\n msg.includes(\"too much time has passed without sending any data\")\n ) {\n return \"timeout\";\n }\n if (msg.includes(\"stream ended without a stop event\")) {\n return \"builder_gateway_network_error\";\n }\n // Deterministic below this line — named so they stop landing in `unknown`,\n // never retried. Both were measured against the 13 prod app DBs over\n // 2026-07-24..31: 27 turns/week and 14 turns/week respectively, each with\n // exactly 1.00 runs/turn, i.e. the chat died on the first attempt showing\n // the raw provider sentence.\n //\n // The request side already avoids emitting reasoning_effort alongside tools\n // (see ai-sdk-engine.ts). This classifies the failure for the paths that\n // still reach the provider — another gateway, a stale deploy — so it reads\n // as a configuration problem rather than a mystery.\n if (\n msg.includes(\"reasoning_effort are not supported\") ||\n msg.includes(\"reasoning_effort to 'none'\") ||\n (msg.includes(\"reasoning_effort\") &&\n (msg.includes(\"tools\") || msg.includes(\"function\")))\n ) {\n return \"provider_config_error\";\n }\n if (msg.includes(\"missing authentication header\") || msg === \"unauthorized\") {\n return \"authentication_error\";\n }\n if (\n /(?:err_)?ssl|tlsv?\\d|tls handshake|ssl routines|econnreset|econnrefused|und_err_socket|socket hang up/i.test(\n message,\n )\n ) {\n return \"provider_network_error\";\n }\n return undefined;\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const AGENT_FAILURE_TAXONOMY_CODES: readonly ["provider_network_error", "provider_config_error", "overloaded_error", "authentication_error", "unknown"];
|
|
2
|
+
export type AgentFailureTaxonomyCode = (typeof AGENT_FAILURE_TAXONOMY_CODES)[number];
|
|
3
|
+
export type AgentFailureRegime = "interactive" | "scheduled";
|
|
4
|
+
export interface AgentFailureTaxonomy {
|
|
5
|
+
code: AgentFailureTaxonomyCode;
|
|
6
|
+
label: string;
|
|
7
|
+
regime: AgentFailureRegime;
|
|
8
|
+
source: "error_code" | "error_detail" | "unknown";
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Classify the production failure families used by the Factory triage queue.
|
|
12
|
+
* The regime is deliberately derived from the durable run id, not inferred
|
|
13
|
+
* from prose: scheduled runs use the `job-` namespace and interactive runs do
|
|
14
|
+
* not. This keeps a healthy chat sample from hiding a scheduled outage.
|
|
15
|
+
*/
|
|
16
|
+
export declare function classifyAgentFailure(input: {
|
|
17
|
+
runId?: unknown;
|
|
18
|
+
errorCode?: unknown;
|
|
19
|
+
errorDetail?: unknown;
|
|
20
|
+
terminalReason?: unknown;
|
|
21
|
+
terminalEvent?: unknown;
|
|
22
|
+
regime?: AgentFailureRegime;
|
|
23
|
+
}): AgentFailureTaxonomy;
|
|
24
|
+
//# sourceMappingURL=failure-taxonomy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"failure-taxonomy.d.ts","sourceRoot":"","sources":["../../../src/agent/engine/failure-taxonomy.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,4BAA4B,YACvC,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,SAAS,CACD,CAAC;AAEX,MAAM,MAAM,wBAAwB,GAClC,CAAC,OAAO,4BAA4B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhD,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG,WAAW,CAAC;AAE7D,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,wBAAwB,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,kBAAkB,CAAC;IAC3B,MAAM,EAAE,YAAY,GAAG,cAAc,GAAG,SAAS,CAAC;CACnD;AA6CD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,kBAAkB,CAAC;CAC7B,GAAG,oBAAoB,CA4CvB"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { classifyTerminalErrorCode } from "./error-detail.js";
|
|
2
|
+
export const AGENT_FAILURE_TAXONOMY_CODES = [
|
|
3
|
+
"provider_network_error",
|
|
4
|
+
"provider_config_error",
|
|
5
|
+
"overloaded_error",
|
|
6
|
+
"authentication_error",
|
|
7
|
+
"unknown",
|
|
8
|
+
];
|
|
9
|
+
const LABELS = {
|
|
10
|
+
provider_network_error: "SSL/TLS provider transport drop",
|
|
11
|
+
provider_config_error: "Model reasoning_effort with tools",
|
|
12
|
+
overloaded_error: "Provider overloaded_error",
|
|
13
|
+
authentication_error: "Missing provider authentication",
|
|
14
|
+
unknown: "Unclassified failure",
|
|
15
|
+
};
|
|
16
|
+
function knownCode(value) {
|
|
17
|
+
const normalized = typeof value === "string" ? value.trim().toLowerCase() : "";
|
|
18
|
+
if (normalized === "provider_network_error" ||
|
|
19
|
+
normalized === "connection_error" ||
|
|
20
|
+
normalized === "network_error" ||
|
|
21
|
+
normalized === "ssl_error" ||
|
|
22
|
+
normalized === "tls_error") {
|
|
23
|
+
return "provider_network_error";
|
|
24
|
+
}
|
|
25
|
+
if (normalized === "provider_config_error" ||
|
|
26
|
+
normalized === "reasoning_effort_tools") {
|
|
27
|
+
return "provider_config_error";
|
|
28
|
+
}
|
|
29
|
+
if (normalized === "overloaded_error" ||
|
|
30
|
+
normalized === "provider_overloaded") {
|
|
31
|
+
return "overloaded_error";
|
|
32
|
+
}
|
|
33
|
+
if (normalized === "authentication_error" ||
|
|
34
|
+
normalized === "missing_authentication_header" ||
|
|
35
|
+
normalized === "http_401" ||
|
|
36
|
+
normalized === "unauthorized") {
|
|
37
|
+
return "authentication_error";
|
|
38
|
+
}
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Classify the production failure families used by the Factory triage queue.
|
|
43
|
+
* The regime is deliberately derived from the durable run id, not inferred
|
|
44
|
+
* from prose: scheduled runs use the `job-` namespace and interactive runs do
|
|
45
|
+
* not. This keeps a healthy chat sample from hiding a scheduled outage.
|
|
46
|
+
*/
|
|
47
|
+
export function classifyAgentFailure(input) {
|
|
48
|
+
const regime = input.regime ??
|
|
49
|
+
(typeof input.runId === "string" && input.runId.startsWith("job-")
|
|
50
|
+
? "scheduled"
|
|
51
|
+
: "interactive");
|
|
52
|
+
const explicit = knownCode(input.errorCode);
|
|
53
|
+
if (explicit) {
|
|
54
|
+
return {
|
|
55
|
+
code: explicit,
|
|
56
|
+
label: LABELS[explicit],
|
|
57
|
+
regime,
|
|
58
|
+
source: "error_code",
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const evidence = [
|
|
62
|
+
input.errorCode,
|
|
63
|
+
input.errorDetail,
|
|
64
|
+
input.terminalReason,
|
|
65
|
+
input.terminalEvent,
|
|
66
|
+
].filter((value) => value !== undefined && value !== null);
|
|
67
|
+
for (const value of evidence) {
|
|
68
|
+
const text = typeof value === "string"
|
|
69
|
+
? value
|
|
70
|
+
: (JSON.stringify(value) ?? String(value));
|
|
71
|
+
const classified = knownCode(classifyTerminalErrorCode(text));
|
|
72
|
+
if (classified) {
|
|
73
|
+
return {
|
|
74
|
+
code: classified,
|
|
75
|
+
label: LABELS[classified],
|
|
76
|
+
regime,
|
|
77
|
+
source: "error_detail",
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
code: "unknown",
|
|
83
|
+
label: LABELS.unknown,
|
|
84
|
+
regime,
|
|
85
|
+
source: "unknown",
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=failure-taxonomy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"failure-taxonomy.js","sourceRoot":"","sources":["../../../src/agent/engine/failure-taxonomy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,wBAAwB;IACxB,uBAAuB;IACvB,kBAAkB;IAClB,sBAAsB;IACtB,SAAS;CACD,CAAC;AAcX,MAAM,MAAM,GAA6C;IACvD,sBAAsB,EAAE,iCAAiC;IACzD,qBAAqB,EAAE,mCAAmC;IAC1D,gBAAgB,EAAE,2BAA2B;IAC7C,oBAAoB,EAAE,iCAAiC;IACvD,OAAO,EAAE,sBAAsB;CAChC,CAAC;AAEF,SAAS,SAAS,CAAC,KAAc;IAC/B,MAAM,UAAU,GACd,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9D,IACE,UAAU,KAAK,wBAAwB;QACvC,UAAU,KAAK,kBAAkB;QACjC,UAAU,KAAK,eAAe;QAC9B,UAAU,KAAK,WAAW;QAC1B,UAAU,KAAK,WAAW,EAC1B,CAAC;QACD,OAA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KAAK,KAAK,QAAQ;YACvB,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAC/C,MAAM,UAAU,GAAG,SAAS,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9D,IAAI,UAAU,EAAE,CAAC;YACf,OAAO;gBACL,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC;gBACzB,MAAM;gBACN,MAAM,EAAE,cAAc;aACvB,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO;QACL,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,MAAM,CAAC,OAAO;QACrB,MAAM;QACN,MAAM,EAAE,SAAS;KAClB,CAAC;AACJ,CAAC","sourcesContent":["import { classifyTerminalErrorCode } from \"./error-detail.js\";\n\nexport const AGENT_FAILURE_TAXONOMY_CODES = [\n \"provider_network_error\",\n \"provider_config_error\",\n \"overloaded_error\",\n \"authentication_error\",\n \"unknown\",\n] as const;\n\nexport type AgentFailureTaxonomyCode =\n (typeof AGENT_FAILURE_TAXONOMY_CODES)[number];\n\nexport type AgentFailureRegime = \"interactive\" | \"scheduled\";\n\nexport interface AgentFailureTaxonomy {\n code: AgentFailureTaxonomyCode;\n label: string;\n regime: AgentFailureRegime;\n source: \"error_code\" | \"error_detail\" | \"unknown\";\n}\n\nconst LABELS: Record<AgentFailureTaxonomyCode, string> = {\n provider_network_error: \"SSL/TLS provider transport drop\",\n provider_config_error: \"Model reasoning_effort with tools\",\n overloaded_error: \"Provider overloaded_error\",\n authentication_error: \"Missing provider authentication\",\n unknown: \"Unclassified failure\",\n};\n\nfunction knownCode(value: unknown): AgentFailureTaxonomyCode | undefined {\n const normalized =\n typeof value === \"string\" ? value.trim().toLowerCase() : \"\";\n if (\n normalized === \"provider_network_error\" ||\n normalized === \"connection_error\" ||\n normalized === \"network_error\" ||\n normalized === \"ssl_error\" ||\n normalized === \"tls_error\"\n ) {\n return \"provider_network_error\";\n }\n if (\n normalized === \"provider_config_error\" ||\n normalized === \"reasoning_effort_tools\"\n ) {\n return \"provider_config_error\";\n }\n if (\n normalized === \"overloaded_error\" ||\n normalized === \"provider_overloaded\"\n ) {\n return \"overloaded_error\";\n }\n if (\n normalized === \"authentication_error\" ||\n normalized === \"missing_authentication_header\" ||\n normalized === \"http_401\" ||\n normalized === \"unauthorized\"\n ) {\n return \"authentication_error\";\n }\n return undefined;\n}\n\n/**\n * Classify the production failure families used by the Factory triage queue.\n * The regime is deliberately derived from the durable run id, not inferred\n * from prose: scheduled runs use the `job-` namespace and interactive runs do\n * not. This keeps a healthy chat sample from hiding a scheduled outage.\n */\nexport function classifyAgentFailure(input: {\n runId?: unknown;\n errorCode?: unknown;\n errorDetail?: unknown;\n terminalReason?: unknown;\n terminalEvent?: unknown;\n regime?: AgentFailureRegime;\n}): AgentFailureTaxonomy {\n const regime =\n input.regime ??\n (typeof input.runId === \"string\" && input.runId.startsWith(\"job-\")\n ? \"scheduled\"\n : \"interactive\");\n const explicit = knownCode(input.errorCode);\n if (explicit) {\n return {\n code: explicit,\n label: LABELS[explicit],\n regime,\n source: \"error_code\",\n };\n }\n\n const evidence = [\n input.errorCode,\n input.errorDetail,\n input.terminalReason,\n input.terminalEvent,\n ].filter((value) => value !== undefined && value !== null);\n for (const value of evidence) {\n const text =\n typeof value === \"string\"\n ? value\n : (JSON.stringify(value) ?? String(value));\n const classified = knownCode(classifyTerminalErrorCode(text));\n if (classified) {\n return {\n code: classified,\n label: LABELS[classified],\n regime,\n source: \"error_detail\",\n };\n }\n }\n\n return {\n code: \"unknown\",\n label: LABELS.unknown,\n regime,\n source: \"unknown\",\n };\n}\n"]}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* Public exports for the pluggable agent engine system.
|
|
3
3
|
*/
|
|
4
4
|
export type { AgentEngine, EngineCapabilities, EngineTool, EngineMessage, EngineContentPart, EngineTextPart, EngineImagePart, EngineToolCallPart, EngineToolResultPart, EngineThinkingPart, EngineEvent, EngineStreamOptions, } from "./types.js";
|
|
5
|
-
export { registerAgentEngine, getAgentEngineEntry, listAgentEngines, resolveEngine, getConfiguredEngineNameForRequest, getStoredModelForEngine, normalizeModelForEngine, resolveEnginePreservesCustomModels, type NormalizeModelOptions, detectEngineFromEnv, detectEngineFromEnvForRequest, detectEngineFromUserSecrets, isAgentEngineSettingConfigured, isAgentEnginePackageInstalled, isStoredEngineUsable, isStoredEngineUsableForRequest, isResolvedEngineUsableForRequest, type AgentEngineEntry, type ResolveEngineConfig, } from "./registry.js";
|
|
5
|
+
export { registerAgentEngine, getAgentEngineEntry, listAgentEngines, resolveEngine, getConfiguredEngineNameForRequest, getStoredModelForEngine, normalizeModelForEngine, resolveDelegatedRunModel, resolveEnginePreservesCustomModels, type NormalizeModelOptions, detectEngineFromEnv, detectEngineFromEnvForRequest, detectEngineFromUserSecrets, isAgentEngineSettingConfigured, isAgentEnginePackageInstalled, isStoredEngineUsable, isStoredEngineUsableForRequest, isResolvedEngineUsableForRequest, type AgentEngineEntry, type ResolveEngineConfig, } from "./registry.js";
|
|
6
6
|
export { createBuilderEngine, BUILDER_DEFAULT_MODEL, BUILDER_SUPPORTED_MODELS, BUILDER_CAPABILITIES, } from "./builder-engine.js";
|
|
7
7
|
export { createAnthropicEngine, ANTHROPIC_DEFAULT_MODEL, ANTHROPIC_SUPPORTED_MODELS, ANTHROPIC_CAPABILITIES, } from "./anthropic-engine.js";
|
|
8
8
|
export { createAISDKEngine, type AISDKProvider } from "./ai-sdk-engine.js";
|
|
9
9
|
export { registerBuiltinEngines } from "./builtin.js";
|
|
10
|
+
export { AGENT_FAILURE_TAXONOMY_CODES, classifyAgentFailure, type AgentFailureRegime, type AgentFailureTaxonomy, type AgentFailureTaxonomyCode, } from "./failure-taxonomy.js";
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/engine/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EACV,WAAW,EACX,kBAAkB,EAClB,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,WAAW,EACX,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,iCAAiC,EACjC,uBAAuB,EACvB,uBAAuB,EACvB,kCAAkC,EAClC,KAAK,qBAAqB,EAC1B,mBAAmB,EACnB,6BAA6B,EAC7B,2BAA2B,EAC3B,8BAA8B,EAC9B,6BAA6B,EAC7B,oBAAoB,EACpB,8BAA8B,EAC9B,gCAAgC,EAChC,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,GACzB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/engine/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EACV,WAAW,EACX,kBAAkB,EAClB,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,WAAW,EACX,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,iCAAiC,EACjC,uBAAuB,EACvB,uBAAuB,EACvB,wBAAwB,EACxB,kCAAkC,EAClC,KAAK,qBAAqB,EAC1B,mBAAmB,EACnB,6BAA6B,EAC7B,2BAA2B,EAC3B,8BAA8B,EAC9B,6BAA6B,EAC7B,oBAAoB,EACpB,8BAA8B,EAC9B,gCAAgC,EAChC,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,GACzB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,EACpB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,GAC9B,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Public exports for the pluggable agent engine system.
|
|
3
3
|
*/
|
|
4
|
-
export { registerAgentEngine, getAgentEngineEntry, listAgentEngines, resolveEngine, getConfiguredEngineNameForRequest, getStoredModelForEngine, normalizeModelForEngine, resolveEnginePreservesCustomModels, detectEngineFromEnv, detectEngineFromEnvForRequest, detectEngineFromUserSecrets, isAgentEngineSettingConfigured, isAgentEnginePackageInstalled, isStoredEngineUsable, isStoredEngineUsableForRequest, isResolvedEngineUsableForRequest, } from "./registry.js";
|
|
4
|
+
export { registerAgentEngine, getAgentEngineEntry, listAgentEngines, resolveEngine, getConfiguredEngineNameForRequest, getStoredModelForEngine, normalizeModelForEngine, resolveDelegatedRunModel, resolveEnginePreservesCustomModels, detectEngineFromEnv, detectEngineFromEnvForRequest, detectEngineFromUserSecrets, isAgentEngineSettingConfigured, isAgentEnginePackageInstalled, isStoredEngineUsable, isStoredEngineUsableForRequest, isResolvedEngineUsableForRequest, } from "./registry.js";
|
|
5
5
|
export { createBuilderEngine, BUILDER_DEFAULT_MODEL, BUILDER_SUPPORTED_MODELS, BUILDER_CAPABILITIES, } from "./builder-engine.js";
|
|
6
6
|
export { createAnthropicEngine, ANTHROPIC_DEFAULT_MODEL, ANTHROPIC_SUPPORTED_MODELS, ANTHROPIC_CAPABILITIES, } from "./anthropic-engine.js";
|
|
7
7
|
export { createAISDKEngine } from "./ai-sdk-engine.js";
|
|
8
8
|
export { registerBuiltinEngines } from "./builtin.js";
|
|
9
|
+
export { AGENT_FAILURE_TAXONOMY_CODES, classifyAgentFailure, } from "./failure-taxonomy.js";
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/agent/engine/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAiBH,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,iCAAiC,EACjC,uBAAuB,EACvB,uBAAuB,EACvB,kCAAkC,EAElC,mBAAmB,EACnB,6BAA6B,EAC7B,2BAA2B,EAC3B,8BAA8B,EAC9B,6BAA6B,EAC7B,oBAAoB,EACpB,8BAA8B,EAC9B,gCAAgC,GAGjC,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAsB,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC","sourcesContent":["/**\n * Public exports for the pluggable agent engine system.\n */\n\nexport type {\n AgentEngine,\n EngineCapabilities,\n EngineTool,\n EngineMessage,\n EngineContentPart,\n EngineTextPart,\n EngineImagePart,\n EngineToolCallPart,\n EngineToolResultPart,\n EngineThinkingPart,\n EngineEvent,\n EngineStreamOptions,\n} from \"./types.js\";\n\nexport {\n registerAgentEngine,\n getAgentEngineEntry,\n listAgentEngines,\n resolveEngine,\n getConfiguredEngineNameForRequest,\n getStoredModelForEngine,\n normalizeModelForEngine,\n resolveEnginePreservesCustomModels,\n type NormalizeModelOptions,\n detectEngineFromEnv,\n detectEngineFromEnvForRequest,\n detectEngineFromUserSecrets,\n isAgentEngineSettingConfigured,\n isAgentEnginePackageInstalled,\n isStoredEngineUsable,\n isStoredEngineUsableForRequest,\n isResolvedEngineUsableForRequest,\n type AgentEngineEntry,\n type ResolveEngineConfig,\n} from \"./registry.js\";\n\nexport {\n createBuilderEngine,\n BUILDER_DEFAULT_MODEL,\n BUILDER_SUPPORTED_MODELS,\n BUILDER_CAPABILITIES,\n} from \"./builder-engine.js\";\n\nexport {\n createAnthropicEngine,\n ANTHROPIC_DEFAULT_MODEL,\n ANTHROPIC_SUPPORTED_MODELS,\n ANTHROPIC_CAPABILITIES,\n} from \"./anthropic-engine.js\";\nexport { createAISDKEngine, type AISDKProvider } from \"./ai-sdk-engine.js\";\nexport { registerBuiltinEngines } from \"./builtin.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/agent/engine/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAiBH,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,iCAAiC,EACjC,uBAAuB,EACvB,uBAAuB,EACvB,wBAAwB,EACxB,kCAAkC,EAElC,mBAAmB,EACnB,6BAA6B,EAC7B,2BAA2B,EAC3B,8BAA8B,EAC9B,6BAA6B,EAC7B,oBAAoB,EACpB,8BAA8B,EAC9B,gCAAgC,GAGjC,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAsB,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,GAIrB,MAAM,uBAAuB,CAAC","sourcesContent":["/**\n * Public exports for the pluggable agent engine system.\n */\n\nexport type {\n AgentEngine,\n EngineCapabilities,\n EngineTool,\n EngineMessage,\n EngineContentPart,\n EngineTextPart,\n EngineImagePart,\n EngineToolCallPart,\n EngineToolResultPart,\n EngineThinkingPart,\n EngineEvent,\n EngineStreamOptions,\n} from \"./types.js\";\n\nexport {\n registerAgentEngine,\n getAgentEngineEntry,\n listAgentEngines,\n resolveEngine,\n getConfiguredEngineNameForRequest,\n getStoredModelForEngine,\n normalizeModelForEngine,\n resolveDelegatedRunModel,\n resolveEnginePreservesCustomModels,\n type NormalizeModelOptions,\n detectEngineFromEnv,\n detectEngineFromEnvForRequest,\n detectEngineFromUserSecrets,\n isAgentEngineSettingConfigured,\n isAgentEnginePackageInstalled,\n isStoredEngineUsable,\n isStoredEngineUsableForRequest,\n isResolvedEngineUsableForRequest,\n type AgentEngineEntry,\n type ResolveEngineConfig,\n} from \"./registry.js\";\n\nexport {\n createBuilderEngine,\n BUILDER_DEFAULT_MODEL,\n BUILDER_SUPPORTED_MODELS,\n BUILDER_CAPABILITIES,\n} from \"./builder-engine.js\";\n\nexport {\n createAnthropicEngine,\n ANTHROPIC_DEFAULT_MODEL,\n ANTHROPIC_SUPPORTED_MODELS,\n ANTHROPIC_CAPABILITIES,\n} from \"./anthropic-engine.js\";\nexport { createAISDKEngine, type AISDKProvider } from \"./ai-sdk-engine.js\";\nexport { registerBuiltinEngines } from \"./builtin.js\";\nexport {\n AGENT_FAILURE_TAXONOMY_CODES,\n classifyAgentFailure,\n type AgentFailureRegime,\n type AgentFailureTaxonomy,\n type AgentFailureTaxonomyCode,\n} from \"./failure-taxonomy.js\";\n"]}
|
|
@@ -55,6 +55,21 @@ export interface NormalizeModelOptions {
|
|
|
55
55
|
preserveCustomModels?: boolean;
|
|
56
56
|
}
|
|
57
57
|
export declare function normalizeModelForEngine(engine: Pick<AgentEngine, "name" | "defaultModel" | "supportedModels" | "preserveCustomModels">, model: string | null | undefined, options?: NormalizeModelOptions): string;
|
|
58
|
+
type ModelResolvableEngine = Pick<AgentEngine, "name" | "defaultModel" | "supportedModels" | "preserveCustomModels">;
|
|
59
|
+
/**
|
|
60
|
+
* Model for a delegated (A2A) run, in strict precedence: the receiving app's
|
|
61
|
+
* explicit configuration, then its own stored setting, then the caller's hint,
|
|
62
|
+
* then the engine default. An app that pins a model keeps it; a hint only fills
|
|
63
|
+
* the gap where the receiver would otherwise take a default it never chose.
|
|
64
|
+
*
|
|
65
|
+
* A rejected hint is logged and dropped — a delegated run must never fail over
|
|
66
|
+
* a preference.
|
|
67
|
+
*/
|
|
68
|
+
export declare function resolveDelegatedRunModel(engine: ModelResolvableEngine, options: {
|
|
69
|
+
explicitModel?: string | null;
|
|
70
|
+
storedModel?: string | null;
|
|
71
|
+
callerModelHint?: string | null;
|
|
72
|
+
}): string;
|
|
58
73
|
/**
|
|
59
74
|
* Whether models saved or read for this engine ENTRY should be preserved
|
|
60
75
|
* verbatim instead of normalized against the built-in catalog.
|
|
@@ -206,4 +221,5 @@ export declare function resolveEngine(config: ResolveEngineConfig): Promise<Agen
|
|
|
206
221
|
export declare function getStoredModelForEngine(engine: AgentEngine | string, options?: {
|
|
207
222
|
appId?: string;
|
|
208
223
|
}): Promise<string | undefined>;
|
|
224
|
+
export {};
|
|
209
225
|
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/agent/engine/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/agent/engine/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAmBH,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAIlE,MAAM,WAAW,gBAAgB;IAC/B,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,+DAA+D;IAC/D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,0BAA0B;IAC1B,YAAY,EAAE,kBAAkB,CAAC;IACjC,2BAA2B;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,6DAA6D;IAC7D,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,4CAA4C;IAC5C,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,WAAW,CAAC;CACtD;AAKD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAajE;AAED,uEAAuE;AACvE,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,GACX,gBAAgB,GAAG,SAAS,CAE9B;AAED,yCAAyC;AACzC,wBAAgB,gBAAgB,IAAI,gBAAgB,EAAE,CAErD;AA0ED,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,gBAAgB,GACtB,OAAO,CAOT;AA4DD,MAAM,WAAW,qBAAqB;IACpC;;;;;;;;;;;;OAYG;I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ST;AAED;;;;;;;GAOG;AACH,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,OAAO,EACf,KAAK,EAAE,gBAAgB,GACtB,OAAO,CAAC,OAAO,CAAC,CASlB;AAED;;;;;GAKG;AACH,wBAAsB,gCAAgC,CACpD,MAAM,EAAE,WAAW,EACnB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,GAChC,OAAO,CAAC,OAAO,CAAC,CAuBlB;AAED,MAAM,WAAW,mBAAmB;IAClC,0EAA0E;IAC1E,YAAY,CAAC,EACT,MAAM,GACN,WAAW,GACX;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;IACtD,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;GASG;AACH,wBAAsB,iCAAiC,CACrD,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAC/B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA0B7B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,WAAW,CAAC,CAoItB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,WAAW,GAAG,MAAM,EAC5B,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAC/B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAgC7B"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Built-in engines (anthropic, ai-sdk) are auto-registered by builtin.ts.
|
|
9
9
|
*/
|
|
10
10
|
import { createRequire } from "node:module";
|
|
11
|
-
import { assertCredentialStoreReadable, canUseDeployCredentialFallbackForRequest, getProviderCredentialAuthFailure, readDeployCredentialEnv, resolveBuilderCredentialsDetailed, resolveSecret, } from "../../server/credential-provider.js";
|
|
11
|
+
import { assertCredentialStoreReadable, canUseDeployCredentialFallbackForRequest, getBuilderCredentialAuthFailure, getProviderCredentialAuthFailure, readDeployCredentialEnv, resolveBuilderCredentialsDetailed, resolveSecret, } from "../../server/credential-provider.js";
|
|
12
12
|
import { getSetting } from "../../settings/store.js";
|
|
13
13
|
import { getAgentAppModelDefaultForCurrentRequest } from "../app-model-defaults.js";
|
|
14
14
|
import { normalizeOpenAiBaseUrl, OPENAI_BASE_URL_ENV_VAR, } from "./openai-compatible-endpoint.js";
|
|
@@ -183,6 +183,52 @@ export function normalizeModelForEngine(engine, model, options = {}) {
|
|
|
183
183
|
return (findLatestSupportedVersionMatch(candidate, engine.supportedModels) ??
|
|
184
184
|
engine.defaultModel);
|
|
185
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Bound an untrusted, caller-supplied model preference to this engine's own
|
|
188
|
+
* catalog. Returns `undefined` — never a substitute — when the hint names
|
|
189
|
+
* anything the engine does not already offer, so a peer can never move the run
|
|
190
|
+
* to a different provider, an unknown id, or a capability tier this engine was
|
|
191
|
+
* not going to serve on its own.
|
|
192
|
+
*/
|
|
193
|
+
function resolveModelHintForEngine(engine, hint) {
|
|
194
|
+
const candidate = typeof hint === "string" ? hint.trim() : "";
|
|
195
|
+
if (!candidate || candidate === "auto")
|
|
196
|
+
return undefined;
|
|
197
|
+
// An engine with no catalog, or one that passes custom ids through verbatim
|
|
198
|
+
// (an OpenAI-compatible gateway), cannot prove membership — so it takes no
|
|
199
|
+
// hint at all rather than forwarding an unverifiable id to a provider.
|
|
200
|
+
if (engine.preserveCustomModels || engine.supportedModels.length === 0) {
|
|
201
|
+
return undefined;
|
|
202
|
+
}
|
|
203
|
+
const normalized = normalizeModelForEngine(engine, candidate);
|
|
204
|
+
// `normalizeModelForEngine` answers `defaultModel` both for "this IS the
|
|
205
|
+
// default" and for "no idea what this is", so an unmatched hint is only
|
|
206
|
+
// distinguishable by re-checking the raw candidate. Anything else it returns
|
|
207
|
+
// is a real catalog hit.
|
|
208
|
+
const matched = normalized === engine.defaultModel
|
|
209
|
+
? engine.supportedModels.includes(candidate)
|
|
210
|
+
: engine.supportedModels.includes(normalized);
|
|
211
|
+
return matched ? normalized : undefined;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Model for a delegated (A2A) run, in strict precedence: the receiving app's
|
|
215
|
+
* explicit configuration, then its own stored setting, then the caller's hint,
|
|
216
|
+
* then the engine default. An app that pins a model keeps it; a hint only fills
|
|
217
|
+
* the gap where the receiver would otherwise take a default it never chose.
|
|
218
|
+
*
|
|
219
|
+
* A rejected hint is logged and dropped — a delegated run must never fail over
|
|
220
|
+
* a preference.
|
|
221
|
+
*/
|
|
222
|
+
export function resolveDelegatedRunModel(engine, options) {
|
|
223
|
+
const own = options.explicitModel ?? options.storedModel;
|
|
224
|
+
if (own)
|
|
225
|
+
return normalizeModelForEngine(engine, own);
|
|
226
|
+
const hinted = resolveModelHintForEngine(engine, options.callerModelHint);
|
|
227
|
+
if (!hinted && options.callerModelHint) {
|
|
228
|
+
console.log(`[a2a] Ignoring caller model hint "${options.callerModelHint}" — not offered by engine ${engine.name}`);
|
|
229
|
+
}
|
|
230
|
+
return normalizeModelForEngine(engine, hinted ?? engine.defaultModel);
|
|
231
|
+
}
|
|
186
232
|
/**
|
|
187
233
|
* Whether models saved or read for this engine ENTRY should be preserved
|
|
188
234
|
* verbatim instead of normalized against the built-in catalog.
|
|
@@ -258,26 +304,45 @@ export function detectEngineFromEnv() {
|
|
|
258
304
|
}
|
|
259
305
|
return null;
|
|
260
306
|
}
|
|
261
|
-
async function envKeyUsableForEntry(
|
|
307
|
+
async function envKeyUsableForEntry(key) {
|
|
262
308
|
if (!(canUseDeployCredentialFallbackForRequest(key) &&
|
|
263
309
|
!!readDeployCredentialEnv(key))) {
|
|
264
310
|
return false;
|
|
265
311
|
}
|
|
266
|
-
if (entry.name === "builder") {
|
|
267
|
-
return true;
|
|
268
|
-
}
|
|
269
312
|
const value = readDeployCredentialEnv(key);
|
|
270
313
|
if (!value)
|
|
271
314
|
return false;
|
|
272
315
|
return !(await getProviderCredentialAuthFailure({ key, value }));
|
|
273
316
|
}
|
|
317
|
+
/**
|
|
318
|
+
* Builder's deploy-env fallback is checked as a pair, not per-key: the
|
|
319
|
+
* auth-failure marker is fingerprinted from privateKey+publicKey together
|
|
320
|
+
* (see `builderCredentialFingerprint`), so a single-key lookup can never
|
|
321
|
+
* match it. Without this, a rejected deploy-level Builder key would keep
|
|
322
|
+
* reporting "usable" through this env-only path forever — the same class of
|
|
323
|
+
* bug as the per-scope check in `credential-provider.ts`'s
|
|
324
|
+
* `isCompleteBuilderConnection`.
|
|
325
|
+
*/
|
|
326
|
+
async function hasUsableBuilderEnvKeys() {
|
|
327
|
+
const privateKey = canUseDeployCredentialFallbackForRequest("BUILDER_PRIVATE_KEY")
|
|
328
|
+
? readDeployCredentialEnv("BUILDER_PRIVATE_KEY")
|
|
329
|
+
: null;
|
|
330
|
+
const publicKey = canUseDeployCredentialFallbackForRequest("BUILDER_PUBLIC_KEY")
|
|
331
|
+
? readDeployCredentialEnv("BUILDER_PUBLIC_KEY")
|
|
332
|
+
: null;
|
|
333
|
+
if (!privateKey || !publicKey)
|
|
334
|
+
return false;
|
|
335
|
+
return !(await getBuilderCredentialAuthFailure({ privateKey, publicKey }));
|
|
336
|
+
}
|
|
274
337
|
async function hasUsableEnvKeys(entry) {
|
|
275
338
|
if (!isAgentEnginePackageInstalled(entry))
|
|
276
339
|
return false;
|
|
277
340
|
if (entry.requiredEnvVars.length === 0)
|
|
278
341
|
return false;
|
|
342
|
+
if (entry.name === "builder")
|
|
343
|
+
return hasUsableBuilderEnvKeys();
|
|
279
344
|
for (const key of entry.requiredEnvVars) {
|
|
280
|
-
if (!(await envKeyUsableForEntry(
|
|
345
|
+
if (!(await envKeyUsableForEntry(key)))
|
|
281
346
|
return false;
|
|
282
347
|
}
|
|
283
348
|
return true;
|