@agent-native/core 0.132.2 → 0.133.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (437) hide show
  1. package/corpus/README.md +2 -2
  2. package/corpus/core/CHANGELOG.md +181 -0
  3. package/corpus/core/package.json +1 -1
  4. package/corpus/core/src/a2a/correlation.ts +11 -1
  5. package/corpus/core/src/a2a/types.ts +11 -3
  6. package/corpus/core/src/agent/engine/ai-sdk-engine.ts +61 -46
  7. package/corpus/core/src/agent/engine/builder-engine.ts +22 -10
  8. package/corpus/core/src/agent/engine/error-detail.ts +184 -3
  9. package/corpus/core/src/agent/engine/failure-taxonomy.ts +123 -0
  10. package/corpus/core/src/agent/engine/index.ts +8 -0
  11. package/corpus/core/src/agent/engine/registry.ts +92 -8
  12. package/corpus/core/src/agent/engine/translate-ai-sdk.ts +17 -2
  13. package/corpus/core/src/agent/production-agent.ts +13 -33
  14. package/corpus/core/src/agent/run-loop-with-resume.ts +1 -1
  15. package/corpus/core/src/agent/run-manager.ts +43 -14
  16. package/corpus/core/src/agent/run-store.ts +49 -7
  17. package/corpus/core/src/agent/thread-data-builder.ts +36 -4
  18. package/corpus/core/src/cli/templates-meta.ts +13 -0
  19. package/corpus/core/src/cli/workspace-dev.ts +1 -0
  20. package/corpus/core/src/client/error-format.ts +12 -0
  21. package/corpus/core/src/credentials/index.ts +51 -12
  22. package/corpus/core/src/extensions/url-safety.ts +46 -12
  23. package/corpus/core/src/integrations/adapters/slack.ts +32 -10
  24. package/corpus/core/src/integrations/google-docs-poller.ts +12 -1
  25. package/corpus/core/src/integrations/installations-store.ts +30 -0
  26. package/corpus/core/src/integrations/plugin.ts +5 -5
  27. package/corpus/core/src/integrations/types.ts +7 -0
  28. package/corpus/core/src/integrations/webhook-handler.ts +24 -1
  29. package/corpus/core/src/jobs/background-automation-runner.ts +38 -1
  30. package/corpus/core/src/provider-api/index.ts +8 -2
  31. package/corpus/core/src/scripts/call-agent.ts +6 -0
  32. package/corpus/core/src/server/agent-chat-plugin.ts +30 -9
  33. package/corpus/core/src/server/agent-discovery.ts +2 -0
  34. package/corpus/core/src/server/builder-design-systems.ts +21 -0
  35. package/corpus/core/src/server/credential-provider.ts +51 -12
  36. package/corpus/core/src/server/index.ts +1 -0
  37. package/corpus/core/src/server/onboarding-html.ts +37 -2
  38. package/corpus/core/src/shared/reasoning-effort.ts +1 -1
  39. package/corpus/core/src/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +11 -0
  40. package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +6 -2
  41. package/corpus/templates/assets/app/components/layout/Sidebar.tsx +39 -19
  42. package/corpus/templates/assets/changelog/2026-07-31-the-agent-native-logo-stays-visible-when-the-sidebar-is-coll.md +6 -0
  43. package/corpus/templates/brain/app/components/layout/Sidebar.tsx +30 -3
  44. package/corpus/templates/brain/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
  45. package/corpus/templates/calendar/app/components/layout/AppLayout.tsx +1 -1
  46. package/corpus/templates/calendar/app/components/layout/Sidebar.tsx +54 -25
  47. package/corpus/templates/calendar/changelog/2026-07-31-the-agent-native-logo-stays-visible-when-the-sidebar-is-coll.md +6 -0
  48. package/corpus/templates/chat/app/components/layout/Sidebar.tsx +30 -3
  49. package/corpus/templates/chat/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
  50. package/corpus/templates/clips/app/components/library/library-layout.tsx +37 -21
  51. package/corpus/templates/clips/changelog/2026-07-31-the-agent-native-logo-stays-visible-when-the-sidebar-is-coll.md +6 -0
  52. package/corpus/templates/clips/desktop/src/hooks/useMediaDevices.ts +1 -1
  53. package/corpus/templates/clips/desktop/src/lib/media-capture-constraints.ts +1 -1
  54. package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +34 -17
  55. package/corpus/templates/content/changelog/2026-07-31-the-agent-native-logo-stays-visible-when-the-sidebar-is-coll.md +6 -0
  56. package/corpus/templates/design/.agents/skills/design-systems/SKILL.md +6 -2
  57. package/corpus/templates/design/actions/create-design-system.ts +1 -0
  58. package/corpus/templates/design/actions/set-default-design-system.ts +34 -26
  59. package/corpus/templates/design/app/components/layout/Sidebar.tsx +21 -4
  60. package/corpus/templates/design/app/i18n-data.ts +39 -0
  61. package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +229 -12
  62. package/corpus/templates/design/app/pages/DesignSystems.tsx +10 -4
  63. package/corpus/templates/design/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
  64. package/corpus/templates/design/changelog/2026-07-31-design-system-indexing-keeps-your-chosen-name-when-you-uploa.md +6 -0
  65. package/corpus/templates/design/server/lib/builder-design-system-proxy.ts +19 -4
  66. package/corpus/templates/dispatch/AGENTS.md +4 -0
  67. package/corpus/templates/factory/.agents/skills/actions/SKILL.md +562 -0
  68. package/corpus/templates/factory/.agents/skills/adding-a-feature/SKILL.md +198 -0
  69. package/corpus/templates/factory/.agents/skills/agent-native-docs/SKILL.md +115 -0
  70. package/corpus/templates/factory/.agents/skills/agent-native-toolkit/SKILL.md +182 -0
  71. package/corpus/templates/factory/.agents/skills/capture-learnings/SKILL.md +89 -0
  72. package/corpus/templates/factory/.agents/skills/create-skill/SKILL.md +221 -0
  73. package/corpus/templates/factory/.agents/skills/customizing-agent-native/SKILL.md +220 -0
  74. package/corpus/templates/factory/.agents/skills/delegate-to-agent/SKILL.md +263 -0
  75. package/corpus/templates/factory/.agents/skills/factory-graphs/SKILL.md +52 -0
  76. package/corpus/templates/factory/.agents/skills/feature-flags/SKILL.md +169 -0
  77. package/corpus/templates/factory/.agents/skills/frontend-design/SKILL.md +174 -0
  78. package/corpus/templates/factory/.agents/skills/real-time-sync/SKILL.md +232 -0
  79. package/corpus/templates/factory/.agents/skills/security/SKILL.md +324 -0
  80. package/corpus/templates/factory/.agents/skills/self-modifying-code/SKILL.md +119 -0
  81. package/corpus/templates/factory/.agents/skills/shadcn-ui/SKILL.md +123 -0
  82. package/corpus/templates/factory/.agents/skills/sharing/SKILL.md +232 -0
  83. package/corpus/templates/factory/.agents/skills/storing-data/SKILL.md +178 -0
  84. package/corpus/templates/factory/.agents/skills/upgrade-agent-native/SKILL.md +122 -0
  85. package/corpus/templates/factory/.env.example +24 -0
  86. package/corpus/templates/factory/.ignore +0 -0
  87. package/corpus/templates/factory/.oxfmtrc.json +8 -0
  88. package/corpus/templates/factory/AGENTS.md +90 -0
  89. package/corpus/templates/factory/CHANGELOG.md +10 -0
  90. package/corpus/templates/factory/DEVELOPING.md +185 -0
  91. package/corpus/templates/factory/README.md +64 -0
  92. package/corpus/templates/factory/_gitignore +42 -0
  93. package/corpus/templates/factory/actions/add-factory-comment.ts +55 -0
  94. package/corpus/templates/factory/actions/approve-factory-item.ts +214 -0
  95. package/corpus/templates/factory/actions/babysit-pull-request.ts +126 -0
  96. package/corpus/templates/factory/actions/evaluate-triage-item.ts +172 -0
  97. package/corpus/templates/factory/actions/get-factory-graph.ts +62 -0
  98. package/corpus/templates/factory/actions/get-triage-config.ts +42 -0
  99. package/corpus/templates/factory/actions/get-triage-item.ts +74 -0
  100. package/corpus/templates/factory/actions/hello.ts +13 -0
  101. package/corpus/templates/factory/actions/ingest-github-observation.ts +100 -0
  102. package/corpus/templates/factory/actions/list-factories.ts +40 -0
  103. package/corpus/templates/factory/actions/list-factory-comments.ts +40 -0
  104. package/corpus/templates/factory/actions/list-triage-items.ts +85 -0
  105. package/corpus/templates/factory/actions/list-triage-rules.ts +44 -0
  106. package/corpus/templates/factory/actions/navigate.ts +41 -0
  107. package/corpus/templates/factory/actions/poll-slack-channel.ts +118 -0
  108. package/corpus/templates/factory/actions/reconcile-triage-run.ts +179 -0
  109. package/corpus/templates/factory/actions/record-triage-feedback.ts +58 -0
  110. package/corpus/templates/factory/actions/run.ts +2 -0
  111. package/corpus/templates/factory/actions/save-factory-graph.ts +129 -0
  112. package/corpus/templates/factory/actions/save-triage-config.ts +67 -0
  113. package/corpus/templates/factory/actions/save-triage-rule.ts +89 -0
  114. package/corpus/templates/factory/actions/suggest-factory-rules.ts +70 -0
  115. package/corpus/templates/factory/actions/view-screen.ts +73 -0
  116. package/corpus/templates/factory/app/components/factory/FactoryCanvas.tsx +441 -0
  117. package/corpus/templates/factory/app/components/factory/FactoryInspector.tsx +388 -0
  118. package/corpus/templates/factory/app/components/layout/Header.tsx +60 -0
  119. package/corpus/templates/factory/app/components/layout/Layout.tsx +190 -0
  120. package/corpus/templates/factory/app/components/layout/Sidebar.tsx +538 -0
  121. package/corpus/templates/factory/app/components/triage/triage-status-pill.tsx +28 -0
  122. package/corpus/templates/factory/app/components/ui/button.tsx +1 -0
  123. package/corpus/templates/factory/app/components/ui/card.tsx +1 -0
  124. package/corpus/templates/factory/app/components/ui/dropdown-menu.tsx +1 -0
  125. package/corpus/templates/factory/app/components/ui/input.tsx +1 -0
  126. package/corpus/templates/factory/app/components/ui/label.tsx +1 -0
  127. package/corpus/templates/factory/app/components/ui/sheet.tsx +1 -0
  128. package/corpus/templates/factory/app/components/ui/textarea.tsx +1 -0
  129. package/corpus/templates/factory/app/components/ui/toolkit-provider.tsx +17 -0
  130. package/corpus/templates/factory/app/components/ui/tooltip.tsx +1 -0
  131. package/corpus/templates/factory/app/design-system.ts +3 -0
  132. package/corpus/templates/factory/app/entry.client.tsx +22 -0
  133. package/corpus/templates/factory/app/entry.server.tsx +10 -0
  134. package/corpus/templates/factory/app/global.css +93 -0
  135. package/corpus/templates/factory/app/hooks/use-navigation-state.ts +113 -0
  136. package/corpus/templates/factory/app/i18n/en-US.ts +211 -0
  137. package/corpus/templates/factory/app/i18n/index.ts +34 -0
  138. package/corpus/templates/factory/app/i18n-data.ts +556 -0
  139. package/corpus/templates/factory/app/lib/agent-page.tsx +49 -0
  140. package/corpus/templates/factory/app/lib/app-config.ts +11 -0
  141. package/corpus/templates/factory/app/lib/tab-id.ts +1 -0
  142. package/corpus/templates/factory/app/lib/utils.ts +1 -0
  143. package/corpus/templates/factory/app/root.tsx +175 -0
  144. package/corpus/templates/factory/app/routes/_index.tsx +94 -0
  145. package/corpus/templates/factory/app/routes/agent.tsx +24 -0
  146. package/corpus/templates/factory/app/routes/chat.$threadId.tsx +1 -0
  147. package/corpus/templates/factory/app/routes/database.tsx +17 -0
  148. package/corpus/templates/factory/app/routes/extensions.$id.$slug.tsx +2 -0
  149. package/corpus/templates/factory/app/routes/extensions.$id.tsx +11 -0
  150. package/corpus/templates/factory/app/routes/extensions._index.tsx +11 -0
  151. package/corpus/templates/factory/app/routes/extensions.tsx +5 -0
  152. package/corpus/templates/factory/app/routes/factory.tsx +1003 -0
  153. package/corpus/templates/factory/app/routes/observability.tsx +19 -0
  154. package/corpus/templates/factory/app/routes/settings.tsx +89 -0
  155. package/corpus/templates/factory/app/routes/team.tsx +11 -0
  156. package/corpus/templates/factory/app/routes.ts +4 -0
  157. package/corpus/templates/factory/app/vite-env.d.ts +6 -0
  158. package/corpus/templates/factory/changelog/2026-06-24-a-new-settings-page-gives-quick-access-to-language-workspace.md +6 -0
  159. package/corpus/templates/factory/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +6 -0
  160. package/corpus/templates/factory/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
  161. package/corpus/templates/factory/changelog/2026-06-28-left-sidebar-collapse-motion-and-footer-chrome-are-quieter.md +6 -0
  162. package/corpus/templates/factory/changelog/2026-06-29-chat-layouts-adapt-when-the-agent-sidebar-is-open.md +6 -0
  163. package/corpus/templates/factory/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
  164. package/corpus/templates/factory/changelog/2026-07-10-chat-now-makes-ai-connection-setup-clear-without-shifting-th.md +6 -0
  165. package/corpus/templates/factory/changelog/2026-07-13-a-full-agent-page-now-brings-context-files-connections-jobs-.md +6 -0
  166. package/corpus/templates/factory/changelog/2026-07-14-chat-opens-reliably-on-hosted-deployments-instead-of-failing.md +6 -0
  167. package/corpus/templates/factory/changelog/2026-07-14-fixed-chat-template-startup-with-older-core-versions.md +6 -0
  168. package/corpus/templates/factory/changelog/2026-07-15-chat-navigation-focuses-on-chat-and-agent.md +6 -0
  169. package/corpus/templates/factory/changelog/2026-07-17-the-agent-chat-sidebar-stays-closed-until-you-open-it-or-sta.md +6 -0
  170. package/corpus/templates/factory/changelog/2026-07-22-compact-sidebar-footer.md +6 -0
  171. package/corpus/templates/factory/changelog/2026-07-22-full-page-chat-keeps-the-active-conversation-when-moving-to-.md +6 -0
  172. package/corpus/templates/factory/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
  173. package/corpus/templates/factory/changelog/2026-07-22-recent-chats-are-easier-to-scan-and-expand.md +6 -0
  174. package/corpus/templates/factory/changelog/2026-07-23-full-page-chat-is-better-centered-with-quieter-chat-history-.md +6 -0
  175. package/corpus/templates/factory/changelog/2026-07-24-borderless-secondary-surfaces.md +6 -0
  176. package/corpus/templates/factory/changelog/2026-07-24-sidebar-footer-controls-follow-a-consistent-order.md +6 -0
  177. package/corpus/templates/factory/changelog/2026-07-25-settings-navigation-now-keeps-manage-agent-as-a-dedicated-li.md +6 -0
  178. package/corpus/templates/factory/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
  179. package/corpus/templates/factory/changelog/2026-07-31-added-an-inspectable-observe-only-factory-queue-for-slack-.md +6 -0
  180. package/corpus/templates/factory/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
  181. package/corpus/templates/factory/components.json +20 -0
  182. package/corpus/templates/factory/data/sync-config.json +1 -0
  183. package/corpus/templates/factory/learnings.defaults.md +5 -0
  184. package/corpus/templates/factory/netlify.toml +10 -0
  185. package/corpus/templates/factory/package.json +105 -0
  186. package/corpus/templates/factory/public/agent-native-icon-dark.svg +10 -0
  187. package/corpus/templates/factory/public/agent-native-icon-light.svg +10 -0
  188. package/corpus/templates/factory/public/agent-native-logo-dark.svg +21 -0
  189. package/corpus/templates/factory/public/agent-native-logo-light.svg +21 -0
  190. package/corpus/templates/factory/public/favicon.svg +1 -0
  191. package/corpus/templates/factory/public/icon-180.svg +1 -0
  192. package/corpus/templates/factory/public/icon-192.svg +1 -0
  193. package/corpus/templates/factory/public/icon-512.svg +1 -0
  194. package/corpus/templates/factory/public/manifest.json +21 -0
  195. package/corpus/templates/factory/react-router.config.ts +7 -0
  196. package/corpus/templates/factory/server/connectors/credentials.ts +129 -0
  197. package/corpus/templates/factory/server/connectors/slack.ts +129 -0
  198. package/corpus/templates/factory/server/db/index.ts +6 -0
  199. package/corpus/templates/factory/server/db/schema.ts +193 -0
  200. package/corpus/templates/factory/server/factory-graph/contracts.ts +212 -0
  201. package/corpus/templates/factory/server/factory-graph/store.ts +121 -0
  202. package/corpus/templates/factory/server/lib/require-workspace-member.ts +55 -0
  203. package/corpus/templates/factory/server/middleware/auth.ts +15 -0
  204. package/corpus/templates/factory/server/plugins/agent-chat.ts +58 -0
  205. package/corpus/templates/factory/server/plugins/auth.ts +14 -0
  206. package/corpus/templates/factory/server/plugins/factory-migrations.ts +247 -0
  207. package/corpus/templates/factory/server/plugins/factory-scheduler-job.ts +116 -0
  208. package/corpus/templates/factory/server/plugins/integrations.ts +46 -0
  209. package/corpus/templates/factory/server/routes/[...page].get.ts +5 -0
  210. package/corpus/templates/factory/server/routes/_agent-native/factory/builder-callback.post.ts +116 -0
  211. package/corpus/templates/factory/server/triage/ai-services-git.ts +197 -0
  212. package/corpus/templates/factory/server/triage/builder-executor.ts +118 -0
  213. package/corpus/templates/factory/server/triage/contracts.ts +164 -0
  214. package/corpus/templates/factory/server/triage/github-ingestion.ts +35 -0
  215. package/corpus/templates/factory/server/triage/guards.ts +121 -0
  216. package/corpus/templates/factory/server/triage/ids.ts +27 -0
  217. package/corpus/templates/factory/server/triage/pr-babysit.ts +100 -0
  218. package/corpus/templates/factory/server/triage/pr-monitor.ts +220 -0
  219. package/corpus/templates/factory/server/triage/slack-client.ts +55 -0
  220. package/corpus/templates/factory/server/triage/slack-poller.ts +152 -0
  221. package/corpus/templates/factory/ssr-entry.ts +15 -0
  222. package/corpus/templates/factory/tsconfig.json +21 -0
  223. package/corpus/templates/factory/vite.config.ts +19 -0
  224. package/corpus/templates/forms/app/components/layout/Sidebar.tsx +55 -5
  225. package/corpus/templates/forms/changelog/2026-07-31-the-agent-native-logo-stays-visible-when-the-sidebar-is-coll.md +6 -0
  226. package/corpus/templates/macros/app/components/layout/AppLayout.tsx +6 -2
  227. package/corpus/templates/plan/app/components/layout/Sidebar.tsx +21 -6
  228. package/corpus/templates/plan/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
  229. package/corpus/templates/slides/.agents/skills/create-deck/SKILL.md +12 -0
  230. package/corpus/templates/slides/.agents/skills/design-systems/SKILL.md +9 -0
  231. package/corpus/templates/slides/.agents/skills/slide-editing/SKILL.md +11 -0
  232. package/corpus/templates/slides/AGENTS.md +5 -6
  233. package/corpus/templates/slides/actions/_await-fit-check.ts +20 -10
  234. package/corpus/templates/slides/actions/add-slide.ts +17 -4
  235. package/corpus/templates/slides/actions/create-design-system.ts +16 -4
  236. package/corpus/templates/slides/actions/delete-design-system.ts +18 -2
  237. package/corpus/templates/slides/actions/get-layout-overflows.ts +88 -0
  238. package/corpus/templates/slides/actions/import-file.ts +1 -0
  239. package/corpus/templates/slides/actions/index-design-system-with-builder.ts +8 -0
  240. package/corpus/templates/slides/actions/patch-deck.ts +48 -16
  241. package/corpus/templates/slides/actions/set-default-design-system.ts +49 -19
  242. package/corpus/templates/slides/actions/update-slide.ts +13 -3
  243. package/corpus/templates/slides/actions/view-screen.ts +87 -10
  244. package/corpus/templates/slides/app/components/deck/SlideRenderer.tsx +155 -28
  245. package/corpus/templates/slides/app/components/design-system/DesignSystemCard.tsx +21 -17
  246. package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +849 -341
  247. package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +102 -2
  248. package/corpus/templates/slides/app/components/editor/PromptDialog.tsx +13 -16
  249. package/corpus/templates/slides/app/components/editor/SlideEditor.tsx +60 -12
  250. package/corpus/templates/slides/app/components/editor/SlideOverflowWarning.tsx +11 -1
  251. package/corpus/templates/slides/app/components/layout/Sidebar.tsx +66 -19
  252. package/corpus/templates/slides/app/i18n/en-US.ts +23 -0
  253. package/corpus/templates/slides/app/lib/normalize-slide-padding.ts +8 -15
  254. package/corpus/templates/slides/app/pages/DeckEditor.tsx +4 -3
  255. package/corpus/templates/slides/app/pages/DesignSystems.tsx +4 -3
  256. package/corpus/templates/slides/app/pages/Index.tsx +1 -1
  257. package/corpus/templates/slides/changelog/2026-07-31-design-system-details-now-show-their-source-and-indexing-sta.md +6 -0
  258. package/corpus/templates/slides/changelog/2026-07-31-design-system-indexing-keeps-your-chosen-name-when-you-uploa.md +6 -0
  259. package/corpus/templates/slides/changelog/2026-07-31-design-system-setup-keeps-focus-rings-visible-and-uses-a-sim.md +6 -0
  260. package/corpus/templates/slides/changelog/2026-07-31-skip-prompt-is-now-available-in-the-new-deck-prompt-header.md +6 -0
  261. package/corpus/templates/slides/changelog/2026-07-31-slides-now-detect-real-text-and-box-overflow-across-the-deck.md +6 -0
  262. package/corpus/templates/slides/changelog/2026-07-31-the-agent-native-logo-stays-visible-when-the-sidebar-is-coll.md +6 -0
  263. package/corpus/templates/slides/server/handlers/design-systems.ts +1 -0
  264. package/corpus/templates/slides/server/handlers/index-design-system-sources.ts +1 -0
  265. package/corpus/templates/slides/server/lib/builder-design-system-proxy.ts +23 -4
  266. package/corpus/templates/slides/server/plugins/agent-chat.ts +5 -0
  267. package/corpus/templates/slides/server/plugins/creative-context.ts +16 -3
  268. package/corpus/templates/slides/server/workspace-defaults.ts +5 -1
  269. package/corpus/templates/slides/shared/slide-fit.ts +26 -0
  270. package/corpus/templates/tasks/app/components/layout/Sidebar.tsx +30 -3
  271. package/corpus/templates/tasks/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
  272. package/dist/a2a/correlation.d.ts +4 -1
  273. package/dist/a2a/correlation.d.ts.map +1 -1
  274. package/dist/a2a/correlation.js +8 -1
  275. package/dist/a2a/correlation.js.map +1 -1
  276. package/dist/a2a/types.d.ts +11 -3
  277. package/dist/a2a/types.d.ts.map +1 -1
  278. package/dist/a2a/types.js.map +1 -1
  279. package/dist/agent/engine/ai-sdk-engine.d.ts.map +1 -1
  280. package/dist/agent/engine/ai-sdk-engine.js +51 -41
  281. package/dist/agent/engine/ai-sdk-engine.js.map +1 -1
  282. package/dist/agent/engine/builder-engine.d.ts.map +1 -1
  283. package/dist/agent/engine/builder-engine.js +18 -8
  284. package/dist/agent/engine/builder-engine.js.map +1 -1
  285. package/dist/agent/engine/error-detail.d.ts +61 -0
  286. package/dist/agent/engine/error-detail.d.ts.map +1 -1
  287. package/dist/agent/engine/error-detail.js +145 -3
  288. package/dist/agent/engine/error-detail.js.map +1 -1
  289. package/dist/agent/engine/failure-taxonomy.d.ts +24 -0
  290. package/dist/agent/engine/failure-taxonomy.d.ts.map +1 -0
  291. package/dist/agent/engine/failure-taxonomy.js +88 -0
  292. package/dist/agent/engine/failure-taxonomy.js.map +1 -0
  293. package/dist/agent/engine/index.d.ts +2 -1
  294. package/dist/agent/engine/index.d.ts.map +1 -1
  295. package/dist/agent/engine/index.js +2 -1
  296. package/dist/agent/engine/index.js.map +1 -1
  297. package/dist/agent/engine/registry.d.ts +16 -0
  298. package/dist/agent/engine/registry.d.ts.map +1 -1
  299. package/dist/agent/engine/registry.js +71 -6
  300. package/dist/agent/engine/registry.js.map +1 -1
  301. package/dist/agent/engine/translate-ai-sdk.d.ts.map +1 -1
  302. package/dist/agent/engine/translate-ai-sdk.js +14 -2
  303. package/dist/agent/engine/translate-ai-sdk.js.map +1 -1
  304. package/dist/agent/production-agent.d.ts.map +1 -1
  305. package/dist/agent/production-agent.js +13 -24
  306. package/dist/agent/production-agent.js.map +1 -1
  307. package/dist/agent/run-loop-with-resume.js +1 -1
  308. package/dist/agent/run-loop-with-resume.js.map +1 -1
  309. package/dist/agent/run-manager.d.ts.map +1 -1
  310. package/dist/agent/run-manager.js +39 -10
  311. package/dist/agent/run-manager.js.map +1 -1
  312. package/dist/agent/run-store.d.ts +10 -0
  313. package/dist/agent/run-store.d.ts.map +1 -1
  314. package/dist/agent/run-store.js +38 -6
  315. package/dist/agent/run-store.js.map +1 -1
  316. package/dist/agent/thread-data-builder.d.ts.map +1 -1
  317. package/dist/agent/thread-data-builder.js +28 -4
  318. package/dist/agent/thread-data-builder.js.map +1 -1
  319. package/dist/cli/templates-meta.d.ts.map +1 -1
  320. package/dist/cli/templates-meta.js +13 -0
  321. package/dist/cli/templates-meta.js.map +1 -1
  322. package/dist/cli/workspace-dev.d.ts.map +1 -1
  323. package/dist/cli/workspace-dev.js +1 -0
  324. package/dist/cli/workspace-dev.js.map +1 -1
  325. package/dist/client/error-format.d.ts.map +1 -1
  326. package/dist/client/error-format.js +10 -0
  327. package/dist/client/error-format.js.map +1 -1
  328. package/dist/collab/struct-routes.d.ts +1 -1
  329. package/dist/credentials/index.d.ts +9 -2
  330. package/dist/credentials/index.d.ts.map +1 -1
  331. package/dist/credentials/index.js +50 -8
  332. package/dist/credentials/index.js.map +1 -1
  333. package/dist/extensions/url-safety.d.ts.map +1 -1
  334. package/dist/extensions/url-safety.js +38 -12
  335. package/dist/extensions/url-safety.js.map +1 -1
  336. package/dist/file-upload/actions/upload-image.d.ts +1 -1
  337. package/dist/integrations/adapters/slack.d.ts.map +1 -1
  338. package/dist/integrations/adapters/slack.js +25 -8
  339. package/dist/integrations/adapters/slack.js.map +1 -1
  340. package/dist/integrations/google-docs-poller.d.ts.map +1 -1
  341. package/dist/integrations/google-docs-poller.js +13 -1
  342. package/dist/integrations/google-docs-poller.js.map +1 -1
  343. package/dist/integrations/installations-store.d.ts +10 -0
  344. package/dist/integrations/installations-store.d.ts.map +1 -1
  345. package/dist/integrations/installations-store.js +24 -0
  346. package/dist/integrations/installations-store.js.map +1 -1
  347. package/dist/integrations/plugin.d.ts.map +1 -1
  348. package/dist/integrations/plugin.js +6 -5
  349. package/dist/integrations/plugin.js.map +1 -1
  350. package/dist/integrations/types.d.ts +7 -0
  351. package/dist/integrations/types.d.ts.map +1 -1
  352. package/dist/integrations/types.js.map +1 -1
  353. package/dist/integrations/webhook-handler.d.ts.map +1 -1
  354. package/dist/integrations/webhook-handler.js +16 -1
  355. package/dist/integrations/webhook-handler.js.map +1 -1
  356. package/dist/jobs/background-automation-runner.d.ts.map +1 -1
  357. package/dist/jobs/background-automation-runner.js +35 -2
  358. package/dist/jobs/background-automation-runner.js.map +1 -1
  359. package/dist/mcp/screen-memory-stdio.d.ts +7 -7
  360. package/dist/mcp/screen-memory-stdio.d.ts.map +1 -1
  361. package/dist/notifications/routes.d.ts +1 -1
  362. package/dist/observability/routes.d.ts +1 -1
  363. package/dist/provider-api/actions/custom-provider-registration.d.ts +14 -14
  364. package/dist/provider-api/actions/provider-api.d.ts +8 -8
  365. package/dist/provider-api/index.js +7 -3
  366. package/dist/provider-api/index.js.map +1 -1
  367. package/dist/resources/handlers.d.ts +1 -1
  368. package/dist/scripts/call-agent.d.ts.map +1 -1
  369. package/dist/scripts/call-agent.js +6 -1
  370. package/dist/scripts/call-agent.js.map +1 -1
  371. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  372. package/dist/server/agent-chat-plugin.js +25 -7
  373. package/dist/server/agent-chat-plugin.js.map +1 -1
  374. package/dist/server/agent-discovery.d.ts +2 -0
  375. package/dist/server/agent-discovery.d.ts.map +1 -1
  376. package/dist/server/agent-discovery.js.map +1 -1
  377. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  378. package/dist/server/builder-design-systems.d.ts +4 -1
  379. package/dist/server/builder-design-systems.d.ts.map +1 -1
  380. package/dist/server/builder-design-systems.js +11 -1
  381. package/dist/server/builder-design-systems.js.map +1 -1
  382. package/dist/server/credential-provider.d.ts.map +1 -1
  383. package/dist/server/credential-provider.js +49 -12
  384. package/dist/server/credential-provider.js.map +1 -1
  385. package/dist/server/index.d.ts +1 -1
  386. package/dist/server/index.d.ts.map +1 -1
  387. package/dist/server/index.js.map +1 -1
  388. package/dist/server/onboarding-html.d.ts.map +1 -1
  389. package/dist/server/onboarding-html.js +37 -2
  390. package/dist/server/onboarding-html.js.map +1 -1
  391. package/dist/shared/reasoning-effort.d.ts +1 -0
  392. package/dist/shared/reasoning-effort.d.ts.map +1 -1
  393. package/dist/shared/reasoning-effort.js +1 -1
  394. package/dist/shared/reasoning-effort.js.map +1 -1
  395. package/dist/templates/chat/app/components/layout/Sidebar.tsx +30 -3
  396. package/dist/templates/chat/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
  397. package/dist/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +11 -0
  398. package/package.json +1 -1
  399. package/src/a2a/correlation.ts +11 -1
  400. package/src/a2a/types.ts +11 -3
  401. package/src/agent/engine/ai-sdk-engine.ts +61 -46
  402. package/src/agent/engine/builder-engine.ts +22 -10
  403. package/src/agent/engine/error-detail.ts +184 -3
  404. package/src/agent/engine/failure-taxonomy.ts +123 -0
  405. package/src/agent/engine/index.ts +8 -0
  406. package/src/agent/engine/registry.ts +92 -8
  407. package/src/agent/engine/translate-ai-sdk.ts +17 -2
  408. package/src/agent/production-agent.ts +13 -33
  409. package/src/agent/run-loop-with-resume.ts +1 -1
  410. package/src/agent/run-manager.ts +43 -14
  411. package/src/agent/run-store.ts +49 -7
  412. package/src/agent/thread-data-builder.ts +36 -4
  413. package/src/cli/templates-meta.ts +13 -0
  414. package/src/cli/workspace-dev.ts +1 -0
  415. package/src/client/error-format.ts +12 -0
  416. package/src/credentials/index.ts +51 -12
  417. package/src/extensions/url-safety.ts +46 -12
  418. package/src/integrations/adapters/slack.ts +32 -10
  419. package/src/integrations/google-docs-poller.ts +12 -1
  420. package/src/integrations/installations-store.ts +30 -0
  421. package/src/integrations/plugin.ts +5 -5
  422. package/src/integrations/types.ts +7 -0
  423. package/src/integrations/webhook-handler.ts +24 -1
  424. package/src/jobs/background-automation-runner.ts +38 -1
  425. package/src/provider-api/index.ts +8 -2
  426. package/src/scripts/call-agent.ts +6 -0
  427. package/src/server/agent-chat-plugin.ts +30 -9
  428. package/src/server/agent-discovery.ts +2 -0
  429. package/src/server/builder-design-systems.ts +21 -0
  430. package/src/server/credential-provider.ts +51 -12
  431. package/src/server/index.ts +1 -0
  432. package/src/server/onboarding-html.ts +37 -2
  433. package/src/shared/reasoning-effort.ts +1 -1
  434. package/src/templates/chat/app/components/layout/Sidebar.tsx +30 -3
  435. package/src/templates/chat/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
  436. package/src/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +11 -0
  437. package/corpus/templates/clips/desktop/src/lib/media-device-selection.ts +0 -157
package/corpus/README.md CHANGED
@@ -28,6 +28,6 @@ rg -n "defineAction|useActionQuery" node_modules/@agent-native/core/corpus
28
28
 
29
29
  ## Generated Counts
30
30
 
31
- - core files: 1645
31
+ - core files: 1646
32
32
  - toolkit files: 168
33
- - template files: 7237
33
+ - template files: 7413
@@ -1,5 +1,186 @@
1
1
  # @agent-native/core
2
2
 
3
+ ## 0.133.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 1c08605: Fail closed when an `ai-sdk:*` engine has no provider key, instead of sending an
8
+ unauthenticated request. The provider factory was previously built with no
9
+ `apiKey`, so the SDK omitted the Authorization header and the gateway's 401 came
10
+ back as `http_401` "Missing Authentication header" — a transport error naming the
11
+ wrong cause, which a scheduled job then retried on every tick forever. It now
12
+ reports `missing_credentials` and names the env var it wants, matching what
13
+ `builder-engine` and `anthropic-engine` already did.
14
+
15
+ Also stop reaping in-process background automations (scheduler and trigger runs)
16
+ at the tight 45s post-claim stale window. That window exists to reach a durable
17
+ successor sooner, but these runs carry no `dispatch_payload` and have no
18
+ successor to reach, so an early reap killed still-working jobs that nothing could
19
+ recover. They now get the 90s background window, and the recovery path reports
20
+ `not_redispatchable` rather than `payload_missing`, which read as data loss for
21
+ the one case where nothing was ever lost.
22
+
23
+ ## 0.133.0
24
+
25
+ ### Minor Changes
26
+
27
+ - eecd3ad: Expose the measured agent failure taxonomy and let thread diagnostics separate interactive runs from scheduled `job-` runs.
28
+
29
+ ### Patch Changes
30
+
31
+ - eecd3ad: Let a delegated A2A run inherit the caller's model when the receiving app never
32
+ picked one. A cross-app turn resolved its model entirely on the receiving side,
33
+ and the stored lookup is scoped to the receiver's own app id — so selecting
34
+ Sonnet in Slides still ran any question Slides delegated to Analytics on
35
+ Analytics' default. Nothing in the request carried the caller's choice.
36
+
37
+ `call-agent` now sends the model it is running on as `callerModel` in the
38
+ existing A2A correlation metadata, and the receiver applies it strictly last
39
+ before its default: explicit config, then its own stored setting, then the
40
+ hint. An app that deliberately pins a model keeps it; the hint only fills the
41
+ gap where the receiver would otherwise take a default it never chose.
42
+
43
+ The hint is a preference, never an authorization. It is bounded to the
44
+ receiver's already-resolved engine catalog by `resolveDelegatedRunModel`, so a
45
+ peer cannot move the run to another provider, an unknown id, or a capability
46
+ tier the engine does not offer; engines that cannot prove membership (empty
47
+ catalog, OpenAI-compatible gateway) take no hint at all. A rejected hint is
48
+ logged and dropped rather than failing the delegated run, and it stays out of
49
+ every identity, org, access, and approval path.
50
+
51
+ - eecd3ad: Classify AI SDK provider failures that arrive as a stream part, not a throw.
52
+ `streamText` does not throw for a failed provider request — it emits an `error`
53
+ part on `fullStream` — so provider HTTP failures had two arrival paths and only
54
+ the thrown one was classified. The stream-part path built a bare stop event from
55
+ the message alone, discarding the `APICallError`'s `statusCode` and
56
+ `isRetryable`. Everything downstream then had nothing structured to read: a 429
57
+ or 503 was retried only if its prose happened to contain "rate_limit" or
58
+ "overloaded", and the run persisted `error_code = 'unknown'`.
59
+
60
+ That is also why a 100%-reproducible config 400 could run for three days across
61
+ five apps without anyone noticing: it was indistinguishable in the outcome
62
+ tables from every other unclassified failure, so it had no signature to alert
63
+ on.
64
+
65
+ Both paths now share one `classifyProviderError` helper — status code →
66
+ `http_<status>`, transport failure → `provider_network_error`, `isRetryable`
67
+ passed through, and a message-based fallback when the provider sent nothing
68
+ structured. Every ai-sdk provider (openai, anthropic, google, openrouter, groq,
69
+ mistral, cohere, ollama) gets correct classification at once.
70
+
71
+ - eecd3ad: Recover chats from transient provider failures instead of ending them. A
72
+ provider transport blip reached persistence with no structured error code and
73
+ was stored as `unknown`, which the client does not list as auto-recoverable —
74
+ so the turn died where the identical failure carrying its real code resumes. In
75
+ production this was measurable: `unknown` runs averaged exactly 1.00 runs per
76
+ turn (no recovery was ever attempted), against 2.0 for `provider_network_error`
77
+ and 1.5 for `http_429` on the same underlying errors.
78
+
79
+ Four divergent copies of the connection-error predicate had drifted apart, and
80
+ they disagreed on the exact string the AI SDK actually throws — `RetryError`
81
+ reports `"Failed after 2 attempts. Last error: Cannot connect to API: …"`, which
82
+ a copy anchored with `startsWith` scored as unclassified while a copy using
83
+ `includes` scored as retryable. They are now one exported classifier in
84
+ `engine/error-detail.ts`, matched against the error's full cause chain, and
85
+ applied both where the error event is built (the code the client reads) and
86
+ where the run's terminal code is persisted. Transport and capacity failures map
87
+ to their real codes; deterministic failures stay unmapped so a broken request
88
+ still stops the chat instead of spiralling.
89
+
90
+ Also stop sending `reasoning_effort` alongside function tools for GPT models on
91
+ the Builder gateway. The gateway routes them to Chat Completions, which rejects
92
+ that combination outright, so every agent turn on a `gpt-5.x` model failed
93
+ deterministically. Omitting the field does not help — only the explicit `"none"`
94
+ clears it, matching the guard the AI SDK engine already had.
95
+
96
+ - eecd3ad: Fail closed instead of silently ignoring a broken cross-isolate Stop check: a rejected abort-state read in the agent run manager no longer gets coerced into "not aborted" forever — sustained read failures now self-abort the run with a distinct, typed error. Also add the same fail-closed handling to two `isTurnAborted` call sites in the background-dispatch path that were missing it, matching the existing sibling call sites.
97
+ - eecd3ad: Stop raw provider error text (a JSON error body, an SSL handshake failure) from
98
+ being persisted as the visible assistant reply. The server-side rebuild of an
99
+ assistant message (`buildAssistantMessage`, used by every background/durable
100
+ run, reconnect-after-disconnect, poller-triggered turn, and webhook-triggered
101
+ turn) appended `event.error` verbatim, unlike the live client which already
102
+ routes it through `normalizeChatError`/`formatChatErrorText` for friendly copy.
103
+ The rebuild now uses that same layer, so persisted text always matches what a
104
+ live client would have shown, and the raw diagnostic is kept only in
105
+ `runError.details`.
106
+ - eecd3ad: Name the two deterministic provider failures that were ending chats as `unknown`: a model rejecting tools alongside `reasoning_effort`, and a missing authentication header. Both now carry a real error code and user-facing copy that says what to change, and both stay non-recoverable so nothing retries a failure a retry cannot fix.
107
+ - eecd3ad: Preserve Builder design-system source provenance on local proxy references.
108
+ - eecd3ad: Keep the signup email visible when an email-verification link opens a new tab, so the follow-up sign-in targets the verified account instead of a browser-autofilled address.
109
+ - eecd3ad: Fix a split-brain in credential resolution: `resolveCredential` (and its diagnostic sibling `describeCredentialScopeGap`) only ever searched the single org on `ctx.orgId`. Interactive requests always populate it, but CLI runs, cron/recurring jobs, and any other caller built from `getCredentialContext()` outside a request event do not — so an org-scoped key that shows "Ready" in Settings silently missed at runtime for those callers. Both functions now fall back to resolving the caller's org from their email when `ctx.orgId` is unset, and a membership lookup that fails to read now throws a retryable error instead of being reported as "not configured". `resolveRequiredCredential` in the provider-api layer now also appends the scope-gap diagnostic to its error, matching `resolveAnyCredential`.
110
+ - eecd3ad: Mark exhausted in-process agent-loop budgets as non-recoverable so the client does not restart the same exhausted run.
111
+ - eecd3ad: Run scheduled jobs, automations, and Google Docs comment replies under the background timeout regime instead of the interactive one. They were inheriting the 40s soft timeout, a 30s no-progress backstop, and 6 continuations meant for a synchronous request, so work that legitimately spends minutes across many tool calls died in the first gap longer than 30s and was recorded as `no_progress`.
112
+ - eecd3ad: Stop scheduled jobs and event automations from being killed mid-run as
113
+ "background_worker_never_started". `runBackgroundAutomation` (shared by
114
+ `jobs/scheduler.ts` and `triggers/dispatcher.ts`) executes entirely
115
+ in-process — there is no HTTP self-dispatch — but still marked its run row
116
+ `dispatch_mode = 'background'` for the wider stale window, without ever
117
+ calling `claimBackgroundRun` the way a genuine HTTP background worker does.
118
+ That left the row parked at the transient `'background'` state for the run's
119
+ entire life, indistinguishable from a lost HTTP handoff: the unclaimed-
120
+ background-run sweep reaps any such row past its 25s grace window, so a
121
+ single tool call running past 25s (routine for a report or analytics job)
122
+ got the still-executing run errored out from under it, discarding whatever
123
+ it later completed with.
124
+
125
+ The runner now self-claims its row into `'background-processing'`
126
+ immediately after inserting it — the same claimed state a real HTTP worker
127
+ reaches — which removes it from the unclaimed-sweep's eligibility (it filters
128
+ on `dispatch_mode = 'background'` exactly) and puts it under the wider,
129
+ heartbeat-driven stale window instead, with the correct `stale_run` code if
130
+ it ever genuinely dies.
131
+
132
+ - eecd3ad: Stop resending a Builder credential the gateway already rejected. Every non-Builder provider already skipped a key marked bad by an auth failure; Builder credential selection (`resolveScopedBuilderCredentials`/`resolveBuilderCredentialsDetailed` in user/org/workspace/solo scope and the deploy-env fallback, plus `hasUsableBuilderConnection` and the env-detection path in the engine registry) now consults that same marker and falls through to the next scope instead of resending the identical known-bad key on every live and scheduled turn.
133
+ - eecd3ad: Fix the Slack bot answering as the wrong app and silently dropping mentions
134
+
135
+ Outbound Slack delivery never passed an app id, so token resolution fell back
136
+ to a team-only lookup that took whichever installation was updated most
137
+ recently. A workspace with two connected Slack apps posted as whichever one
138
+ reconnected last. Outbound targets can now name an installation, and an
139
+ ambiguous tenant is reported instead of resolved to an arbitrary app.
140
+
141
+ Webhook dispatch also discarded a definitive `failed` outcome and answered the
142
+ platform 200 regardless, leaving a queued task nobody was running behind an
143
+ in-progress indicator that never resolved. That failure is now surfaced to the
144
+ user, and stuck-task recovery sweeps every dispatch mode rather than only
145
+ durable scopes — portable dispatch is the mode most likely to strand a task,
146
+ since its self-dispatch dies with the container.
147
+
148
+ - eecd3ad: Stop a retry storm from deleting the answer the user already read. A rebuild
149
+ correctly refuses to apply a _trailing_ `clear` — there is no successor chunk to
150
+ re-emit what it wipes — but it only skipped the clear at the very last index.
151
+ Each failed engine attempt emits its own `clear`, so three failures in a row is
152
+ the ordinary shape, and the rebuild still applied the first two, splicing every
153
+ text and reasoning part out of the run. When the run had made no tool calls this
154
+ emptied the content entirely and the builder returned null, so the user's
155
+ message was persisted with no assistant reply at all. The whole trailing run of
156
+ clears is now skipped; a `clear` with real events after it still applies.
157
+
158
+ Also make `terminal_reason` write-once on an already-terminal row. Three writers
159
+ in three isolates race on that column — the mid-run checkpoint, the run-manager's
160
+ finalization, and the background worker's failure path — with no ordering
161
+ between them, and last-writer-wins let a late checkpoint relabel a run another
162
+ isolate had already finalized. That produced impossible rows (`status='errored'`
163
+ carrying a continuation reason, no `error_code`, no terminal event) and
164
+ misattributed 130 production runs to a failure mode they never hit. A row that
165
+ is still `running` has no honest reason yet and stays writable.
166
+
167
+ - eecd3ad: Stop the unclaimed-background-run sweep from destroying the runs it exists to
168
+ recover. Its redispatch asserted `payloadRef: true` without checking the row
169
+ still carried a `dispatch_payload`, but sweep eligibility never implied one —
170
+ a background row can reach the grace window having never had a payload at all.
171
+ The redispatched worker then could not rehydrate a request body and failed the
172
+ run as `dispatch_payload_missing`, a reason that reads like data loss for what
173
+ is really an un-redispatchable handoff. That path accounted for 98 failed
174
+ production runs, every one of them a scheduled job.
175
+
176
+ `listUnclaimedBackgroundRunRows` now reports payload presence per row (it
177
+ reports rather than filters, so a payload-less row stays visible to the slow
178
+ sweep and cannot be stranded in `running` forever). The fast sweep skips those
179
+ rows, and the slow sweep sends them straight to its existing loud reap instead
180
+ of waiting out the redispatch bound first — the run still fails, because
181
+ nothing can rehydrate it, but with its true cause
182
+ (`background_worker_never_started`, which the client treats as recoverable).
183
+
3
184
  ## 0.132.2
4
185
 
5
186
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.132.2",
3
+ "version": "0.133.1",
4
4
  "description": "Framework for agent-native application development — where AI agents and UI share SQL state, actions, and context",
5
5
  "homepage": "https://github.com/BuilderIO/agent-native#readme",
6
6
  "bugs": {
@@ -5,6 +5,8 @@ export const MAX_A2A_DELEGATION_HOPS = 3;
5
5
 
6
6
  const APP_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
7
7
  const CORRELATION_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:-]*$/;
8
+ // Model ids also carry `/` (provider-prefixed gateway ids).
9
+ const MODEL_HINT_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:/-]*$/;
8
10
 
9
11
  function boundedIdentifier(
10
12
  value: unknown,
@@ -29,7 +31,10 @@ export function sanitizeA2ACorrelationId(value: unknown): string | undefined {
29
31
  /**
30
32
  * Keep only bounded, opaque ASCII correlation identifiers. These values
31
33
  * remain telemetry hints; authentication continues to come exclusively from
32
- * the verified A2A token/request context.
34
+ * the verified A2A token/request context. `callerModel` is the one value here
35
+ * a receiver may act on, and only as a preference — it never reaches identity,
36
+ * org, access, or approval resolution, and it can only name a model the
37
+ * receiver's own engine already offers (see `resolveDelegatedRunModel`).
33
38
  */
34
39
  export function sanitizeA2ACorrelationMetadata(
35
40
  value: unknown,
@@ -41,6 +46,10 @@ export function sanitizeA2ACorrelationMetadata(
41
46
  const parentRunId = sanitizeA2ACorrelationId(metadata.parentRunId);
42
47
  const parentTurnId = sanitizeA2ACorrelationId(metadata.parentTurnId);
43
48
  const invocationId = sanitizeA2ACorrelationId(metadata.invocationId);
49
+ const callerModel = boundedIdentifier(
50
+ metadata.callerModel,
51
+ MODEL_HINT_PATTERN,
52
+ );
44
53
  const providedDelegationDepth =
45
54
  typeof metadata.delegationDepth === "number" &&
46
55
  Number.isInteger(metadata.delegationDepth) &&
@@ -77,5 +86,6 @@ export function sanitizeA2ACorrelationMetadata(
77
86
  ...(invocationId ? { invocationId } : {}),
78
87
  ...(delegationDepth !== undefined ? { delegationDepth } : {}),
79
88
  ...(visitedApps.length > 0 ? { visitedApps } : {}),
89
+ ...(callerModel ? { callerModel } : {}),
80
90
  };
81
91
  }
@@ -160,9 +160,11 @@ export interface A2ASourceContextReference {
160
160
  }
161
161
 
162
162
  /**
163
- * Telemetry-only cross-app correlation. Receivers must never use these
164
- * caller-supplied values for identity, ownership, org scoping, access, or
165
- * approval decisions.
163
+ * Telemetry-only cross-app correlation, plus `callerModel` a preference
164
+ * hint. Receivers must never use any caller-supplied value here for identity,
165
+ * ownership, org scoping, access, or approval decisions. `callerModel` widens
166
+ * this channel to a preference, never to an authorization: it may at most pick
167
+ * a model the receiver's already-resolved engine advertises.
166
168
  */
167
169
  export interface A2ACorrelationMetadata {
168
170
  callerApp?: string;
@@ -174,6 +176,12 @@ export interface A2ACorrelationMetadata {
174
176
  delegationDepth?: number;
175
177
  /** Bounded app ids already visited, used only for cycle prevention. */
176
178
  visitedApps?: string[];
179
+ /**
180
+ * Model the caller resolved for its own turn. A hint only: the receiver
181
+ * honours it just when it has no model of its own, and only after bounding
182
+ * it to its own engine's catalog.
183
+ */
184
+ callerModel?: string;
177
185
  }
178
186
 
179
187
  // --- Framework config ---
@@ -23,7 +23,14 @@ import {
23
23
  supportsClaudeAdaptiveThinking,
24
24
  } from "../../shared/reasoning-effort.js";
25
25
  import { AI_SDK_MODEL_CONFIG, type AISDKProvider } from "../model-config.js";
26
- import { describeErrorWithCauses } from "./error-detail.js";
26
+ import {
27
+ LLM_MISSING_CREDENTIALS_ERROR_CODE,
28
+ LLM_MISSING_CREDENTIALS_MESSAGE,
29
+ } from "./credential-errors.js";
30
+ import {
31
+ classifyProviderError,
32
+ describeErrorWithCauses,
33
+ } from "./error-detail.js";
27
34
  import {
28
35
  createFirstEventAbortController,
29
36
  FIRST_STREAM_EVENT_TIMEOUT_MS,
@@ -225,6 +232,8 @@ class AISDKEngine implements AgentEngine {
225
232
  private readonly provider: AISDKProvider;
226
233
  private readonly apiKey?: string;
227
234
  private readonly baseUrl?: string;
235
+ /** Empty for providers that need no key (ollama). */
236
+ private readonly requiredEnvVars: readonly string[];
228
237
  private readonly appName?: string;
229
238
  private readonly appUrl?: string;
230
239
 
@@ -240,12 +249,34 @@ class AISDKEngine implements AgentEngine {
240
249
  this.apiKey =
241
250
  config.apiKey ??
242
251
  (config.allowEnvFallback === false ? "" : getProviderApiKey(provider));
252
+ this.requiredEnvVars = PROVIDER_ENV_VARS[provider];
243
253
  this.baseUrl = config.baseUrl;
244
254
  this.appName = config.appName;
245
255
  this.appUrl = config.appUrl;
246
256
  }
247
257
 
248
258
  async *stream(opts: EngineStreamOptions): AsyncIterable<EngineEvent> {
259
+ // An absent key is not an anonymous request. Without this the provider
260
+ // factory is constructed with no `apiKey`, the SDK omits the Authorization
261
+ // header entirely, and the gateway's 401 comes back as
262
+ // "Missing Authentication header" — which `classifyProviderError` codes
263
+ // `http_401`, a transport failure naming the wrong cause. A scheduled job
264
+ // then repeats that doomed unauthenticated request on every tick forever.
265
+ // `builder-engine` and `anthropic-engine` already fail closed here; this
266
+ // engine was the only one that did not.
267
+ //
268
+ // A configured `baseUrl` is exempt: a self-hosted or local gateway may
269
+ // legitimately accept unauthenticated requests.
270
+ if (!this.apiKey && !this.baseUrl && this.requiredEnvVars.length > 0) {
271
+ yield {
272
+ type: "stop",
273
+ reason: "error",
274
+ error: `${LLM_MISSING_CREDENTIALS_MESSAGE} (engine "${this.name}" has no ${this.requiredEnvVars.join(" or ")})`,
275
+ errorCode: LLM_MISSING_CREDENTIALS_ERROR_CODE,
276
+ };
277
+ return;
278
+ }
279
+
249
280
  let aiModule: any;
250
281
  try {
251
282
  aiModule = await import("ai");
@@ -440,6 +471,7 @@ class AISDKEngine implements AgentEngine {
440
471
  // before it, regardless of where `finish` arrives in the stream.
441
472
  let bufferedStop: EngineEvent | undefined;
442
473
  let sawFirstEvent = false;
474
+ let credentialFailureRecorded = false;
443
475
 
444
476
  for await (const part of result.fullStream) {
445
477
  // "start" is a synthetic lifecycle marker the AI SDK enqueues
@@ -453,6 +485,21 @@ class AISDKEngine implements AgentEngine {
453
485
  }
454
486
  for (const event of aiSdkPartToEngineEvents(part)) {
455
487
  observeStreamedToolInput(toolInputs, event);
488
+ if (
489
+ event.type === "stop" &&
490
+ event.reason === "error" &&
491
+ event.statusCode === 401
492
+ ) {
493
+ await recordProviderCredentialAuthFailure({
494
+ key: PROVIDER_ENV_VARS[this.provider][0],
495
+ value: this.apiKey,
496
+ status: event.statusCode,
497
+ code: event.errorCode ?? "http_401",
498
+ message:
499
+ event.error || "The model provider rejected the saved API key.",
500
+ });
501
+ credentialFailureRecorded = true;
502
+ }
456
503
  if (event.type === "stop") {
457
504
  bufferedStop = event;
458
505
  } else {
@@ -491,47 +538,25 @@ class AISDKEngine implements AgentEngine {
491
538
  }
492
539
 
493
540
  yield { type: "assistant-content", parts: assistantContent };
494
- await clearProviderCredentialAuthFailure({
495
- key: PROVIDER_ENV_VARS[this.provider][0],
496
- value: this.apiKey,
497
- });
541
+ if (!credentialFailureRecorded) {
542
+ await clearProviderCredentialAuthFailure({
543
+ key: PROVIDER_ENV_VARS[this.provider][0],
544
+ value: this.apiKey,
545
+ });
546
+ }
498
547
  yield bufferedStop ?? { type: "stop", reason: "end_turn" };
499
548
  } catch (err: any) {
500
549
  const timedOut = firstEventAbort.didTimeout();
501
- // AI SDK wraps exhausted retries in RetryError and keeps the final
502
- // APICallError on `lastError`. Read classification fields from that
503
- // provider error so the retry wrapper does not erase transport status.
504
- const providerError =
505
- err?.lastError instanceof Error ? err.lastError : err;
506
- // Surface structured fields from AI SDK's APICallError so
507
- // isRetryableError can check statusCode/providerRetryable directly
508
- // rather than keyword-matching the message string.
509
- const statusCode: number | undefined =
510
- typeof providerError?.statusCode === "number"
511
- ? providerError.statusCode
512
- : undefined;
513
- const rawMessage: string =
514
- providerError?.message ?? String(providerError);
515
- // Classify on the bare message — the recorded `errorMessage` carries the
516
- // cause chain, which is where the real transport failure lives.
517
550
  const errorMessage = describeErrorWithCauses(err);
518
- const normalizedRawMessage = rawMessage.trim().toLowerCase();
519
- const isConnectionError =
520
- !timedOut &&
521
- statusCode === undefined &&
522
- (normalizedRawMessage === "connection error." ||
523
- normalizedRawMessage.startsWith("cannot connect to api:"));
524
- const providerRetryable: boolean | undefined =
525
- typeof providerError?.isRetryable === "boolean"
526
- ? providerError.isRetryable
527
- : isConnectionError || timedOut
528
- ? true
529
- : undefined;
530
- if (statusCode === 401) {
551
+ // Same classifier the stream-part path uses (translate-ai-sdk.ts) — a
552
+ // provider failure must not be classifiable only when it happens to
553
+ // throw.
554
+ const classification = classifyProviderError(err, timedOut);
555
+ if (classification.statusCode === 401) {
531
556
  await recordProviderCredentialAuthFailure({
532
557
  key: PROVIDER_ENV_VARS[this.provider][0],
533
558
  value: this.apiKey,
534
- status: statusCode,
559
+ status: classification.statusCode,
535
560
  code: "http_401",
536
561
  message: errorMessage,
537
562
  });
@@ -540,17 +565,7 @@ class AISDKEngine implements AgentEngine {
540
565
  type: "stop",
541
566
  reason: "error",
542
567
  error: errorMessage,
543
- // Tag every known status with `http_<status>` (not just 401) so a
544
- // rate limit surfaces as `http_429`. The structured statusCode
545
- // already drives turn-level retries, but the run-level continuation
546
- // logic keys off the errorCode, so this lets a rate-limited turn
547
- // auto-resume too — matching the Builder gateway path.
548
- ...(statusCode !== undefined
549
- ? { errorCode: `http_${statusCode}`, statusCode }
550
- : isConnectionError || timedOut
551
- ? { errorCode: "provider_network_error" }
552
- : {}),
553
- ...(providerRetryable !== undefined ? { providerRetryable } : {}),
568
+ ...classification,
554
569
  };
555
570
  throw err;
556
571
  } finally {
@@ -22,6 +22,7 @@ import {
22
22
  } from "../../server/credential-provider.js";
23
23
  import { applyBuilderUtmTrackingParams } from "../../shared/builder-link-tracking.js";
24
24
  import {
25
+ isGPTReasoningModel,
25
26
  normalizeReasoningEffortForModel,
26
27
  type ReasoningEffort,
27
28
  } from "../../shared/reasoning-effort.js";
@@ -32,7 +33,10 @@ import {
32
33
  LLM_MISSING_CREDENTIALS_ERROR_CODE,
33
34
  LLM_MISSING_CREDENTIALS_MESSAGE,
34
35
  } from "./credential-errors.js";
35
- import { describeErrorWithCauses } from "./error-detail.js";
36
+ import {
37
+ describeErrorWithCauses,
38
+ isProviderConnectionErrorMessage,
39
+ } from "./error-detail.js";
36
40
  import { FIRST_STREAM_EVENT_TIMEOUT_MS } from "./first-event-timeout.js";
37
41
  import { resolveMaxOutputTokensForEngine } from "./output-tokens.js";
38
42
  import {
@@ -235,6 +239,8 @@ class BuilderEngine implements AgentEngine {
235
239
  }
236
240
  }
237
241
 
242
+ const gptToolsRequireExplicitNoReasoning =
243
+ cachedTools.length > 0 && isGPTReasoningModel(opts.model);
238
244
  const body: Record<string, unknown> = {
239
245
  model: opts.model,
240
246
  messages: cachedMessages,
@@ -248,7 +254,21 @@ class BuilderEngine implements AgentEngine {
248
254
  ...(typeof opts.temperature === "number"
249
255
  ? { temperature: opts.temperature }
250
256
  : {}),
251
- ...(reasoningEffort ? { reasoning_effort: reasoningEffort } : {}),
257
+ // OpenAI rejects `reasoning_effort` alongside function tools on Chat
258
+ // Completions ("Function tools with reasoning_effort are not supported
259
+ // for <model> in /v1/chat/completions … or set reasoning_effort to
260
+ // 'none'"), and the gateway routes GPT models there. Every chat on a
261
+ // gpt-5.x model failed deterministically because of this. Omitting the
262
+ // field does NOT help — OpenAI then applies the model's own default
263
+ // effort and rejects identically; only the explicit "none" clears it.
264
+ // Same guard as the ai-sdk engine's forced-Chat-Completions path.
265
+ ...(reasoningEffort || gptToolsRequireExplicitNoReasoning
266
+ ? {
267
+ reasoning_effort: gptToolsRequireExplicitNoReasoning
268
+ ? "none"
269
+ : reasoningEffort,
270
+ }
271
+ : {}),
252
272
  };
253
273
 
254
274
  const gatewayBaseUrl = getBuilderGatewayBaseUrl();
@@ -1137,14 +1157,6 @@ function isBuilderGatewayNetworkError(err: unknown): boolean {
1137
1157
  );
1138
1158
  }
1139
1159
 
1140
- function isProviderConnectionErrorMessage(message: string): boolean {
1141
- const normalized = message.trim().toLowerCase();
1142
- return (
1143
- normalized === "connection error." ||
1144
- normalized.includes("cannot connect to api:")
1145
- );
1146
- }
1147
-
1148
1160
  function captureBuilderGatewayTransportError(
1149
1161
  err: unknown,
1150
1162
  context: {