@agent-native/core 0.96.0 → 0.97.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.
Files changed (450) hide show
  1. package/README.md +6 -0
  2. package/corpus/README.md +2 -2
  3. package/corpus/core/CHANGELOG.md +39 -0
  4. package/corpus/core/docs/content/audit-log.mdx +2 -1
  5. package/corpus/core/docs/content/automations.mdx +7 -7
  6. package/corpus/core/docs/content/creating-templates.mdx +1 -1
  7. package/corpus/core/docs/content/internationalization.mdx +2 -1
  8. package/corpus/core/docs/content/locales/ar-SA/audit-log.mdx +2 -1
  9. package/corpus/core/docs/content/locales/ar-SA/automations.mdx +7 -7
  10. package/corpus/core/docs/content/locales/ar-SA/getting-started.mdx +7 -1
  11. package/corpus/core/docs/content/locales/ar-SA/internationalization.mdx +1 -1
  12. package/corpus/core/docs/content/locales/ar-SA/package-lifecycle.mdx +19 -0
  13. package/corpus/core/docs/content/locales/ar-SA/sandbox-adapters.mdx +18 -7
  14. package/corpus/core/docs/content/locales/ar-SA/security.mdx +8 -0
  15. package/corpus/core/docs/content/locales/de-DE/audit-log.mdx +2 -1
  16. package/corpus/core/docs/content/locales/de-DE/automations.mdx +7 -7
  17. package/corpus/core/docs/content/locales/de-DE/getting-started.mdx +7 -1
  18. package/corpus/core/docs/content/locales/de-DE/internationalization.mdx +1 -1
  19. package/corpus/core/docs/content/locales/de-DE/package-lifecycle.mdx +22 -0
  20. package/corpus/core/docs/content/locales/de-DE/sandbox-adapters.mdx +18 -7
  21. package/corpus/core/docs/content/locales/de-DE/security.mdx +8 -0
  22. package/corpus/core/docs/content/locales/es-ES/audit-log.mdx +2 -1
  23. package/corpus/core/docs/content/locales/es-ES/automations.mdx +7 -7
  24. package/corpus/core/docs/content/locales/es-ES/getting-started.mdx +7 -1
  25. package/corpus/core/docs/content/locales/es-ES/internationalization.mdx +1 -1
  26. package/corpus/core/docs/content/locales/es-ES/package-lifecycle.mdx +22 -0
  27. package/corpus/core/docs/content/locales/es-ES/sandbox-adapters.mdx +18 -7
  28. package/corpus/core/docs/content/locales/es-ES/security.mdx +8 -0
  29. package/corpus/core/docs/content/locales/fr-FR/audit-log.mdx +2 -1
  30. package/corpus/core/docs/content/locales/fr-FR/automations.mdx +7 -7
  31. package/corpus/core/docs/content/locales/fr-FR/getting-started.mdx +7 -1
  32. package/corpus/core/docs/content/locales/fr-FR/internationalization.mdx +1 -1
  33. package/corpus/core/docs/content/locales/fr-FR/package-lifecycle.mdx +21 -0
  34. package/corpus/core/docs/content/locales/fr-FR/sandbox-adapters.mdx +19 -8
  35. package/corpus/core/docs/content/locales/fr-FR/security.mdx +8 -0
  36. package/corpus/core/docs/content/locales/hi-IN/audit-log.mdx +2 -1
  37. package/corpus/core/docs/content/locales/hi-IN/automations.mdx +7 -7
  38. package/corpus/core/docs/content/locales/hi-IN/getting-started.mdx +7 -1
  39. package/corpus/core/docs/content/locales/hi-IN/internationalization.mdx +1 -1
  40. package/corpus/core/docs/content/locales/hi-IN/package-lifecycle.mdx +20 -0
  41. package/corpus/core/docs/content/locales/hi-IN/sandbox-adapters.mdx +18 -7
  42. package/corpus/core/docs/content/locales/hi-IN/security.mdx +8 -0
  43. package/corpus/core/docs/content/locales/ja-JP/audit-log.mdx +2 -1
  44. package/corpus/core/docs/content/locales/ja-JP/automations.mdx +7 -7
  45. package/corpus/core/docs/content/locales/ja-JP/getting-started.mdx +7 -1
  46. package/corpus/core/docs/content/locales/ja-JP/internationalization.mdx +1 -1
  47. package/corpus/core/docs/content/locales/ja-JP/package-lifecycle.mdx +21 -0
  48. package/corpus/core/docs/content/locales/ja-JP/sandbox-adapters.mdx +17 -6
  49. package/corpus/core/docs/content/locales/ja-JP/security.mdx +8 -0
  50. package/corpus/core/docs/content/locales/ko-KR/audit-log.mdx +2 -1
  51. package/corpus/core/docs/content/locales/ko-KR/automations.mdx +7 -7
  52. package/corpus/core/docs/content/locales/ko-KR/getting-started.mdx +7 -1
  53. package/corpus/core/docs/content/locales/ko-KR/internationalization.mdx +1 -1
  54. package/corpus/core/docs/content/locales/ko-KR/package-lifecycle.mdx +20 -0
  55. package/corpus/core/docs/content/locales/ko-KR/sandbox-adapters.mdx +17 -6
  56. package/corpus/core/docs/content/locales/ko-KR/security.mdx +8 -0
  57. package/corpus/core/docs/content/locales/pt-BR/audit-log.mdx +2 -1
  58. package/corpus/core/docs/content/locales/pt-BR/automations.mdx +7 -7
  59. package/corpus/core/docs/content/locales/pt-BR/getting-started.mdx +7 -1
  60. package/corpus/core/docs/content/locales/pt-BR/internationalization.mdx +1 -1
  61. package/corpus/core/docs/content/locales/pt-BR/package-lifecycle.mdx +21 -0
  62. package/corpus/core/docs/content/locales/pt-BR/sandbox-adapters.mdx +18 -7
  63. package/corpus/core/docs/content/locales/pt-BR/security.mdx +8 -0
  64. package/corpus/core/docs/content/locales/zh-CN/audit-log.mdx +2 -1
  65. package/corpus/core/docs/content/locales/zh-CN/automations.mdx +7 -7
  66. package/corpus/core/docs/content/locales/zh-CN/getting-started.mdx +6 -4
  67. package/corpus/core/docs/content/locales/zh-CN/internationalization.mdx +1 -1
  68. package/corpus/core/docs/content/locales/zh-CN/package-lifecycle.mdx +19 -0
  69. package/corpus/core/docs/content/locales/zh-CN/sandbox-adapters.mdx +17 -6
  70. package/corpus/core/docs/content/locales/zh-CN/security.mdx +8 -0
  71. package/corpus/core/docs/content/locales/zh-TW/audit-log.mdx +2 -1
  72. package/corpus/core/docs/content/locales/zh-TW/automations.mdx +7 -7
  73. package/corpus/core/docs/content/locales/zh-TW/getting-started.mdx +6 -4
  74. package/corpus/core/docs/content/locales/zh-TW/internationalization.mdx +1 -1
  75. package/corpus/core/docs/content/locales/zh-TW/package-lifecycle.mdx +19 -0
  76. package/corpus/core/docs/content/locales/zh-TW/sandbox-adapters.mdx +18 -7
  77. package/corpus/core/docs/content/locales/zh-TW/security.mdx +8 -0
  78. package/corpus/core/docs/content/package-lifecycle.mdx +51 -0
  79. package/corpus/core/docs/content/sandbox-adapters.mdx +16 -5
  80. package/corpus/core/package.json +9 -2
  81. package/corpus/core/src/a2a/auth-policy.ts +33 -0
  82. package/corpus/core/src/agent/durable-background.ts +15 -7
  83. package/corpus/core/src/agent/run-store.ts +13 -4
  84. package/corpus/core/src/audit/actions/export-audit-events.ts +162 -0
  85. package/corpus/core/src/audit/store.ts +8 -3
  86. package/corpus/core/src/audit/types.ts +3 -0
  87. package/corpus/core/src/cli/doctor.ts +396 -0
  88. package/corpus/core/src/cli/index.ts +56 -0
  89. package/corpus/core/src/cli/info.ts +3 -3
  90. package/corpus/core/src/cli/package-lifecycle.ts +821 -0
  91. package/corpus/core/src/client/agent-chat-adapter.ts +9 -9
  92. package/corpus/core/src/guards/db-tool-scoping.ts +129 -0
  93. package/corpus/core/src/guards/index.ts +23 -0
  94. package/corpus/core/src/guards/no-drizzle-push.ts +116 -0
  95. package/corpus/core/src/guards/no-env-credentials.ts +229 -0
  96. package/corpus/core/src/guards/no-env-mutation.ts +114 -0
  97. package/corpus/core/src/guards/no-localhost-fallback.ts +124 -0
  98. package/corpus/core/src/guards/no-unscoped-credentials.ts +227 -0
  99. package/corpus/core/src/guards/no-unscoped-queries.ts +834 -0
  100. package/corpus/core/src/guards/scan-utils.ts +105 -0
  101. package/corpus/core/src/guards/types.ts +30 -0
  102. package/corpus/core/src/org/accept-pending.ts +9 -1
  103. package/corpus/core/src/org/migrations.ts +41 -0
  104. package/corpus/core/src/package-lifecycle/index.ts +1 -0
  105. package/corpus/core/src/package-lifecycle/manifest.ts +120 -0
  106. package/corpus/core/src/provider-api/custom-registry.ts +56 -0
  107. package/corpus/core/src/provider-api/index.ts +2 -0
  108. package/corpus/core/src/secrets/storage.ts +47 -27
  109. package/corpus/core/src/server/action-discovery.ts +4 -0
  110. package/corpus/core/src/server/agent-chat-plugin.ts +54 -12
  111. package/corpus/core/src/server/core-routes-plugin.ts +30 -14
  112. package/corpus/core/src/server/csrf.ts +24 -5
  113. package/corpus/core/src/server/framework-request-handler.ts +34 -0
  114. package/corpus/core/src/server/google-realtime-session.ts +1 -36
  115. package/corpus/core/src/server/poll.ts +24 -2
  116. package/corpus/core/src/server/realtime-voice.ts +9 -0
  117. package/corpus/core/src/server/request-origin.ts +63 -0
  118. package/corpus/core/src/server/transcribe-voice.ts +1 -50
  119. package/corpus/core/src/templates/default/package.json +2 -2
  120. package/corpus/core/src/templates/headless/package.json +0 -1
  121. package/corpus/core/src/templates/workspace-core/.agents/skills/audit-log/SKILL.md +3 -0
  122. package/corpus/core/src/templates/workspace-core/.agents/skills/automations/SKILL.md +1 -1
  123. package/corpus/core/src/templates/workspace-core/package.json +0 -1
  124. package/corpus/core/src/templates/workspace-root/package.json +0 -1
  125. package/corpus/core/src/triggers/actions.ts +11 -3
  126. package/corpus/core/src/triggers/types.ts +7 -1
  127. package/corpus/templates/analytics/actions/compose-dashboard.ts +65 -37
  128. package/corpus/templates/analytics/actions/mutate-dashboard.ts +73 -24
  129. package/corpus/templates/analytics/actions/reorder-dashboard-panels.ts +16 -13
  130. package/corpus/templates/analytics/actions/update-dashboard.ts +53 -42
  131. package/corpus/templates/analytics/changelog/2026-07-10-dashboard-edits-from-the-agent-and-the-ui-at-the-same-time-n.md +6 -0
  132. package/corpus/templates/analytics/changelog/2026-07-10-timed-out-bigquery-jobs-are-now-cancelled-so-they-stop-consu.md +6 -0
  133. package/corpus/templates/analytics/package.json +1 -2
  134. package/corpus/templates/analytics/server/lib/bigquery.ts +3 -2
  135. package/corpus/templates/analytics/server/lib/dashboards-store.ts +154 -11
  136. package/corpus/templates/assets/package.json +1 -2
  137. package/corpus/templates/brain/package.json +1 -2
  138. package/corpus/templates/calendar/package.json +1 -2
  139. package/corpus/templates/chat/package.json +1 -2
  140. package/corpus/templates/clips/changelog/2026-07-10-atomic-view-tracking.md +6 -0
  141. package/corpus/templates/clips/chrome-extension/package.json +3 -2
  142. package/corpus/templates/clips/desktop/package.json +6 -4
  143. package/corpus/templates/clips/desktop/src/lib/recorder.ts +26 -13
  144. package/corpus/templates/clips/desktop/src/lib/voice-dictation.ts +4 -1
  145. package/corpus/templates/clips/package.json +1 -2
  146. package/corpus/templates/clips/server/db/schema.ts +29 -17
  147. package/corpus/templates/clips/server/plugins/db.ts +8 -0
  148. package/corpus/templates/clips/server/routes/api/view-event.post.ts +260 -105
  149. package/corpus/templates/content/.agents/skills/notion-integration/SKILL.md +16 -0
  150. package/corpus/templates/content/AGENTS.md +72 -62
  151. package/corpus/templates/content/actions/_content-database-source-adapters.ts +84 -0
  152. package/corpus/templates/content/actions/_database-source-utils.ts +206 -96
  153. package/corpus/templates/content/actions/_notion-database-source-adapter.ts +216 -0
  154. package/corpus/templates/content/actions/_position-utils.ts +76 -0
  155. package/corpus/templates/content/actions/_property-utils.ts +31 -20
  156. package/corpus/templates/content/actions/add-database-item.ts +52 -39
  157. package/corpus/templates/content/actions/attach-content-database-source.ts +95 -11
  158. package/corpus/templates/content/actions/change-content-database-source-role.ts +24 -1
  159. package/corpus/templates/content/actions/configure-document-property.ts +36 -27
  160. package/corpus/templates/content/actions/create-content-database.ts +40 -30
  161. package/corpus/templates/content/actions/create-document.ts +39 -32
  162. package/corpus/templates/content/actions/duplicate-document-property.ts +37 -28
  163. package/corpus/templates/content/actions/list-notion-database-sources.ts +80 -0
  164. package/corpus/templates/content/actions/move-document.ts +64 -48
  165. package/corpus/templates/content/actions/refresh-content-database-source.ts +42 -3
  166. package/corpus/templates/content/actions/share-local-file-document.ts +36 -27
  167. package/corpus/templates/content/actions/suggest-source-join-key.ts +39 -16
  168. package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +89 -23
  169. package/corpus/templates/content/app/components/editor/database/settings.tsx +1 -1
  170. package/corpus/templates/content/app/hooks/use-content-database.ts +18 -1
  171. package/corpus/templates/content/app/i18n/zh-TW.ts +4 -0
  172. package/corpus/templates/content/app/i18n-data.ts +40 -0
  173. package/corpus/templates/content/changelog/2026-07-10-failed-row-creation-and-source-attach-now-show-an-error-inst.md +6 -0
  174. package/corpus/templates/content/changelog/2026-07-10-items-added-at-the-same-time-no-longer-end-up-with-identical.md +6 -0
  175. package/corpus/templates/content/changelog/2026-07-10-notion-databases-can-add-read-only-details-to-content-tables.md +6 -0
  176. package/corpus/templates/content/package.json +1 -2
  177. package/corpus/templates/content/parity/matrix.md +25 -25
  178. package/corpus/templates/content/parity/matrix.ts +1 -0
  179. package/corpus/templates/content/server/routes/api/documents/[id]/move.patch.ts +43 -26
  180. package/corpus/templates/content/shared/api.ts +16 -1
  181. package/corpus/templates/design/.agents/skills/visual-edit/SKILL.md +8 -4
  182. package/corpus/templates/design/AGENTS.md +12 -2
  183. package/corpus/templates/design/DEVELOPING.md +10 -6
  184. package/corpus/templates/design/actions/apply-visual-edit.ts +191 -6
  185. package/corpus/templates/design/actions/duplicate-design.ts +31 -25
  186. package/corpus/templates/design/app/pages/design-editor/pending-edits.ts +5 -1
  187. package/corpus/templates/design/changelog/2026-07-10-duplicating-a-design-can-no-longer-produce-a-copy-with-missi.md +6 -0
  188. package/corpus/templates/design/changelog/2026-07-10-local-visual-edits-can-now-save-safe-leaf-text-class-and.md +6 -0
  189. package/corpus/templates/design/package.json +1 -1
  190. package/corpus/templates/design/shared/local-jsx-visual-edit.ts +388 -0
  191. package/corpus/templates/dispatch/package.json +1 -2
  192. package/corpus/templates/forms/actions/patch-form-fields.ts +82 -44
  193. package/corpus/templates/forms/changelog/2026-07-10-simultaneous-edits-to-different-form-fields-no-longer-overwr.md +6 -0
  194. package/corpus/templates/forms/package.json +1 -2
  195. package/corpus/templates/macros/package.json +1 -2
  196. package/corpus/templates/mail/app/components/email/EmailThread.tsx +3 -1
  197. package/corpus/templates/mail/changelog/2026-07-10-fixed-calendar-rsvp-buttons-in-emails-firing-duplicate-respo.md +6 -0
  198. package/corpus/templates/mail/package.json +1 -2
  199. package/corpus/templates/plan/actions/restore-plan-version.ts +126 -96
  200. package/corpus/templates/plan/changelog/2026-07-10-restoring-a-plan-version-can-no-longer-leave-a-plan-half-res.md +6 -0
  201. package/corpus/templates/plan/package.json +1 -2
  202. package/corpus/templates/plan/server/plans.ts +9 -2
  203. package/corpus/templates/slides/actions/list-decks.ts +28 -0
  204. package/corpus/templates/slides/app/components/deck/MermaidRenderer.tsx +41 -26
  205. package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +4 -8
  206. package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +2 -4
  207. package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +4 -8
  208. package/corpus/templates/slides/app/components/editor/ExportMenu.tsx +5 -12
  209. package/corpus/templates/slides/app/components/editor/HistoryPanel.tsx +3 -6
  210. package/corpus/templates/slides/app/components/editor/ImageDropPromptPopover.tsx +3 -6
  211. package/corpus/templates/slides/app/components/editor/PromptDialog.tsx +2 -5
  212. package/corpus/templates/slides/app/context/DeckContext.tsx +47 -4
  213. package/corpus/templates/slides/app/pages/DeckEditor.tsx +11 -30
  214. package/corpus/templates/slides/app/pages/Index.tsx +2 -3
  215. package/corpus/templates/slides/app/root.tsx +0 -5
  216. package/corpus/templates/slides/changelog/2026-07-10-deck-lists-load-much-faster-and-no-longer-re-download-slide-.md +6 -0
  217. package/corpus/templates/slides/package.json +1 -2
  218. package/dist/a2a/auth-policy.d.ts +19 -0
  219. package/dist/a2a/auth-policy.d.ts.map +1 -1
  220. package/dist/a2a/auth-policy.js +32 -0
  221. package/dist/a2a/auth-policy.js.map +1 -1
  222. package/dist/agent/durable-background.d.ts +8 -5
  223. package/dist/agent/durable-background.d.ts.map +1 -1
  224. package/dist/agent/durable-background.js +15 -8
  225. package/dist/agent/durable-background.js.map +1 -1
  226. package/dist/agent/run-store.d.ts.map +1 -1
  227. package/dist/agent/run-store.js +9 -4
  228. package/dist/agent/run-store.js.map +1 -1
  229. package/dist/audit/actions/export-audit-events.d.ts +27 -0
  230. package/dist/audit/actions/export-audit-events.d.ts.map +1 -0
  231. package/dist/audit/actions/export-audit-events.js +144 -0
  232. package/dist/audit/actions/export-audit-events.js.map +1 -0
  233. package/dist/audit/store.d.ts +1 -0
  234. package/dist/audit/store.d.ts.map +1 -1
  235. package/dist/audit/store.js +8 -3
  236. package/dist/audit/store.js.map +1 -1
  237. package/dist/audit/types.d.ts +3 -0
  238. package/dist/audit/types.d.ts.map +1 -1
  239. package/dist/audit/types.js.map +1 -1
  240. package/dist/cli/doctor.d.ts +83 -0
  241. package/dist/cli/doctor.d.ts.map +1 -0
  242. package/dist/cli/doctor.js +277 -0
  243. package/dist/cli/doctor.js.map +1 -0
  244. package/dist/cli/index.js +50 -0
  245. package/dist/cli/index.js.map +1 -1
  246. package/dist/cli/info.js +3 -3
  247. package/dist/cli/info.js.map +1 -1
  248. package/dist/cli/package-lifecycle.d.ts +50 -0
  249. package/dist/cli/package-lifecycle.d.ts.map +1 -0
  250. package/dist/cli/package-lifecycle.js +560 -0
  251. package/dist/cli/package-lifecycle.js.map +1 -0
  252. package/dist/client/agent-chat-adapter.js +7 -3
  253. package/dist/client/agent-chat-adapter.js.map +1 -1
  254. package/dist/collab/struct-routes.d.ts +1 -1
  255. package/dist/guards/db-tool-scoping.d.ts +38 -0
  256. package/dist/guards/db-tool-scoping.d.ts.map +1 -0
  257. package/dist/guards/db-tool-scoping.js +114 -0
  258. package/dist/guards/db-tool-scoping.js.map +1 -0
  259. package/dist/guards/index.d.ts +23 -0
  260. package/dist/guards/index.d.ts.map +1 -0
  261. package/dist/guards/index.js +19 -0
  262. package/dist/guards/index.js.map +1 -0
  263. package/dist/guards/no-drizzle-push.d.ts +14 -0
  264. package/dist/guards/no-drizzle-push.d.ts.map +1 -0
  265. package/dist/guards/no-drizzle-push.js +97 -0
  266. package/dist/guards/no-drizzle-push.js.map +1 -0
  267. package/dist/guards/no-env-credentials.d.ts +36 -0
  268. package/dist/guards/no-env-credentials.d.ts.map +1 -0
  269. package/dist/guards/no-env-credentials.js +204 -0
  270. package/dist/guards/no-env-credentials.js.map +1 -0
  271. package/dist/guards/no-env-mutation.d.ts +23 -0
  272. package/dist/guards/no-env-mutation.d.ts.map +1 -0
  273. package/dist/guards/no-env-mutation.js +90 -0
  274. package/dist/guards/no-env-mutation.js.map +1 -0
  275. package/dist/guards/no-localhost-fallback.d.ts +30 -0
  276. package/dist/guards/no-localhost-fallback.d.ts.map +1 -0
  277. package/dist/guards/no-localhost-fallback.js +105 -0
  278. package/dist/guards/no-localhost-fallback.js.map +1 -0
  279. package/dist/guards/no-unscoped-credentials.d.ts +28 -0
  280. package/dist/guards/no-unscoped-credentials.d.ts.map +1 -0
  281. package/dist/guards/no-unscoped-credentials.js +199 -0
  282. package/dist/guards/no-unscoped-credentials.js.map +1 -0
  283. package/dist/guards/no-unscoped-queries.d.ts +32 -0
  284. package/dist/guards/no-unscoped-queries.d.ts.map +1 -0
  285. package/dist/guards/no-unscoped-queries.js +720 -0
  286. package/dist/guards/no-unscoped-queries.js.map +1 -0
  287. package/dist/guards/scan-utils.d.ts +28 -0
  288. package/dist/guards/scan-utils.d.ts.map +1 -0
  289. package/dist/guards/scan-utils.js +92 -0
  290. package/dist/guards/scan-utils.js.map +1 -0
  291. package/dist/guards/types.d.ts +28 -0
  292. package/dist/guards/types.d.ts.map +1 -0
  293. package/dist/guards/types.js +11 -0
  294. package/dist/guards/types.js.map +1 -0
  295. package/dist/org/accept-pending.d.ts.map +1 -1
  296. package/dist/org/accept-pending.js +9 -1
  297. package/dist/org/accept-pending.js.map +1 -1
  298. package/dist/org/migrations.d.ts +7 -2
  299. package/dist/org/migrations.d.ts.map +1 -1
  300. package/dist/org/migrations.js +41 -0
  301. package/dist/org/migrations.js.map +1 -1
  302. package/dist/package-lifecycle/index.d.ts +2 -0
  303. package/dist/package-lifecycle/index.d.ts.map +1 -0
  304. package/dist/package-lifecycle/index.js +2 -0
  305. package/dist/package-lifecycle/index.js.map +1 -0
  306. package/dist/package-lifecycle/manifest.d.ts +24 -0
  307. package/dist/package-lifecycle/manifest.d.ts.map +1 -0
  308. package/dist/package-lifecycle/manifest.js +81 -0
  309. package/dist/package-lifecycle/manifest.js.map +1 -0
  310. package/dist/progress/routes.d.ts +1 -1
  311. package/dist/provider-api/custom-registry.d.ts +32 -1
  312. package/dist/provider-api/custom-registry.d.ts.map +1 -1
  313. package/dist/provider-api/custom-registry.js +41 -1
  314. package/dist/provider-api/custom-registry.js.map +1 -1
  315. package/dist/provider-api/index.d.ts +1 -1
  316. package/dist/provider-api/index.d.ts.map +1 -1
  317. package/dist/provider-api/index.js +1 -1
  318. package/dist/provider-api/index.js.map +1 -1
  319. package/dist/secrets/storage.d.ts.map +1 -1
  320. package/dist/secrets/storage.js +45 -27
  321. package/dist/secrets/storage.js.map +1 -1
  322. package/dist/server/action-discovery.d.ts.map +1 -1
  323. package/dist/server/action-discovery.js +4 -0
  324. package/dist/server/action-discovery.js.map +1 -1
  325. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  326. package/dist/server/agent-chat-plugin.js +47 -13
  327. package/dist/server/agent-chat-plugin.js.map +1 -1
  328. package/dist/server/core-routes-plugin.d.ts.map +1 -1
  329. package/dist/server/core-routes-plugin.js +23 -12
  330. package/dist/server/core-routes-plugin.js.map +1 -1
  331. package/dist/server/csrf.d.ts.map +1 -1
  332. package/dist/server/csrf.js +18 -5
  333. package/dist/server/csrf.js.map +1 -1
  334. package/dist/server/framework-request-handler.d.ts.map +1 -1
  335. package/dist/server/framework-request-handler.js +34 -0
  336. package/dist/server/framework-request-handler.js.map +1 -1
  337. package/dist/server/google-realtime-session.d.ts.map +1 -1
  338. package/dist/server/google-realtime-session.js +2 -34
  339. package/dist/server/google-realtime-session.js.map +1 -1
  340. package/dist/server/poll.d.ts.map +1 -1
  341. package/dist/server/poll.js +24 -2
  342. package/dist/server/poll.js.map +1 -1
  343. package/dist/server/realtime-voice.d.ts.map +1 -1
  344. package/dist/server/realtime-voice.js +9 -0
  345. package/dist/server/realtime-voice.js.map +1 -1
  346. package/dist/server/request-origin.d.ts +10 -0
  347. package/dist/server/request-origin.d.ts.map +1 -0
  348. package/dist/server/request-origin.js +60 -0
  349. package/dist/server/request-origin.js.map +1 -0
  350. package/dist/server/transcribe-voice.d.ts.map +1 -1
  351. package/dist/server/transcribe-voice.js +2 -48
  352. package/dist/server/transcribe-voice.js.map +1 -1
  353. package/dist/templates/default/package.json +2 -2
  354. package/dist/templates/headless/package.json +0 -1
  355. package/dist/templates/workspace-core/.agents/skills/audit-log/SKILL.md +3 -0
  356. package/dist/templates/workspace-core/.agents/skills/automations/SKILL.md +1 -1
  357. package/dist/templates/workspace-core/package.json +0 -1
  358. package/dist/templates/workspace-root/package.json +0 -1
  359. package/dist/triggers/actions.d.ts.map +1 -1
  360. package/dist/triggers/actions.js +8 -3
  361. package/dist/triggers/actions.js.map +1 -1
  362. package/dist/triggers/types.d.ts +7 -1
  363. package/dist/triggers/types.d.ts.map +1 -1
  364. package/dist/triggers/types.js.map +1 -1
  365. package/docs/content/audit-log.mdx +2 -1
  366. package/docs/content/automations.mdx +7 -7
  367. package/docs/content/creating-templates.mdx +1 -1
  368. package/docs/content/internationalization.mdx +2 -1
  369. package/docs/content/locales/ar-SA/audit-log.mdx +2 -1
  370. package/docs/content/locales/ar-SA/automations.mdx +7 -7
  371. package/docs/content/locales/ar-SA/getting-started.mdx +7 -1
  372. package/docs/content/locales/ar-SA/internationalization.mdx +1 -1
  373. package/docs/content/locales/ar-SA/package-lifecycle.mdx +19 -0
  374. package/docs/content/locales/ar-SA/sandbox-adapters.mdx +18 -7
  375. package/docs/content/locales/ar-SA/security.mdx +8 -0
  376. package/docs/content/locales/de-DE/audit-log.mdx +2 -1
  377. package/docs/content/locales/de-DE/automations.mdx +7 -7
  378. package/docs/content/locales/de-DE/getting-started.mdx +7 -1
  379. package/docs/content/locales/de-DE/internationalization.mdx +1 -1
  380. package/docs/content/locales/de-DE/package-lifecycle.mdx +22 -0
  381. package/docs/content/locales/de-DE/sandbox-adapters.mdx +18 -7
  382. package/docs/content/locales/de-DE/security.mdx +8 -0
  383. package/docs/content/locales/es-ES/audit-log.mdx +2 -1
  384. package/docs/content/locales/es-ES/automations.mdx +7 -7
  385. package/docs/content/locales/es-ES/getting-started.mdx +7 -1
  386. package/docs/content/locales/es-ES/internationalization.mdx +1 -1
  387. package/docs/content/locales/es-ES/package-lifecycle.mdx +22 -0
  388. package/docs/content/locales/es-ES/sandbox-adapters.mdx +18 -7
  389. package/docs/content/locales/es-ES/security.mdx +8 -0
  390. package/docs/content/locales/fr-FR/audit-log.mdx +2 -1
  391. package/docs/content/locales/fr-FR/automations.mdx +7 -7
  392. package/docs/content/locales/fr-FR/getting-started.mdx +7 -1
  393. package/docs/content/locales/fr-FR/internationalization.mdx +1 -1
  394. package/docs/content/locales/fr-FR/package-lifecycle.mdx +21 -0
  395. package/docs/content/locales/fr-FR/sandbox-adapters.mdx +19 -8
  396. package/docs/content/locales/fr-FR/security.mdx +8 -0
  397. package/docs/content/locales/hi-IN/audit-log.mdx +2 -1
  398. package/docs/content/locales/hi-IN/automations.mdx +7 -7
  399. package/docs/content/locales/hi-IN/getting-started.mdx +7 -1
  400. package/docs/content/locales/hi-IN/internationalization.mdx +1 -1
  401. package/docs/content/locales/hi-IN/package-lifecycle.mdx +20 -0
  402. package/docs/content/locales/hi-IN/sandbox-adapters.mdx +18 -7
  403. package/docs/content/locales/hi-IN/security.mdx +8 -0
  404. package/docs/content/locales/ja-JP/audit-log.mdx +2 -1
  405. package/docs/content/locales/ja-JP/automations.mdx +7 -7
  406. package/docs/content/locales/ja-JP/getting-started.mdx +7 -1
  407. package/docs/content/locales/ja-JP/internationalization.mdx +1 -1
  408. package/docs/content/locales/ja-JP/package-lifecycle.mdx +21 -0
  409. package/docs/content/locales/ja-JP/sandbox-adapters.mdx +17 -6
  410. package/docs/content/locales/ja-JP/security.mdx +8 -0
  411. package/docs/content/locales/ko-KR/audit-log.mdx +2 -1
  412. package/docs/content/locales/ko-KR/automations.mdx +7 -7
  413. package/docs/content/locales/ko-KR/getting-started.mdx +7 -1
  414. package/docs/content/locales/ko-KR/internationalization.mdx +1 -1
  415. package/docs/content/locales/ko-KR/package-lifecycle.mdx +20 -0
  416. package/docs/content/locales/ko-KR/sandbox-adapters.mdx +17 -6
  417. package/docs/content/locales/ko-KR/security.mdx +8 -0
  418. package/docs/content/locales/pt-BR/audit-log.mdx +2 -1
  419. package/docs/content/locales/pt-BR/automations.mdx +7 -7
  420. package/docs/content/locales/pt-BR/getting-started.mdx +7 -1
  421. package/docs/content/locales/pt-BR/internationalization.mdx +1 -1
  422. package/docs/content/locales/pt-BR/package-lifecycle.mdx +21 -0
  423. package/docs/content/locales/pt-BR/sandbox-adapters.mdx +18 -7
  424. package/docs/content/locales/pt-BR/security.mdx +8 -0
  425. package/docs/content/locales/zh-CN/audit-log.mdx +2 -1
  426. package/docs/content/locales/zh-CN/automations.mdx +7 -7
  427. package/docs/content/locales/zh-CN/getting-started.mdx +6 -4
  428. package/docs/content/locales/zh-CN/internationalization.mdx +1 -1
  429. package/docs/content/locales/zh-CN/package-lifecycle.mdx +19 -0
  430. package/docs/content/locales/zh-CN/sandbox-adapters.mdx +17 -6
  431. package/docs/content/locales/zh-CN/security.mdx +8 -0
  432. package/docs/content/locales/zh-TW/audit-log.mdx +2 -1
  433. package/docs/content/locales/zh-TW/automations.mdx +7 -7
  434. package/docs/content/locales/zh-TW/getting-started.mdx +6 -4
  435. package/docs/content/locales/zh-TW/internationalization.mdx +1 -1
  436. package/docs/content/locales/zh-TW/package-lifecycle.mdx +19 -0
  437. package/docs/content/locales/zh-TW/sandbox-adapters.mdx +18 -7
  438. package/docs/content/locales/zh-TW/security.mdx +8 -0
  439. package/docs/content/package-lifecycle.mdx +51 -0
  440. package/docs/content/sandbox-adapters.mdx +16 -5
  441. package/package.json +10 -3
  442. package/src/templates/default/package.json +2 -2
  443. package/src/templates/headless/package.json +0 -1
  444. package/src/templates/workspace-core/.agents/skills/audit-log/SKILL.md +3 -0
  445. package/src/templates/workspace-core/.agents/skills/automations/SKILL.md +1 -1
  446. package/src/templates/workspace-core/package.json +0 -1
  447. package/src/templates/workspace-root/package.json +0 -1
  448. package/corpus/templates/slides/app/components/ui/toast.tsx +0 -1
  449. package/corpus/templates/slides/app/components/ui/toaster.tsx +0 -1
  450. package/corpus/templates/slides/app/hooks/use-toast.ts +0 -1
@@ -2,10 +2,10 @@ import { appBasePath, sendToAgentChat, useT } from "@agent-native/core/client";
2
2
  import { IconLoader2, IconX } from "@tabler/icons-react";
3
3
  import { useEffect, useMemo, useRef, useState } from "react";
4
4
  import { createPortal } from "react-dom";
5
+ import { toast } from "sonner";
5
6
 
6
7
  import { Button } from "@/components/ui/button";
7
8
  import { Textarea } from "@/components/ui/textarea";
8
- import { toast } from "@/hooks/use-toast";
9
9
  import {
10
10
  buildImageDropAgentPayload,
11
11
  readFileAsDataUrl,
@@ -169,16 +169,13 @@ export default function ImageDropPromptPopover({
169
169
  }
170
170
 
171
171
  onClose();
172
- toast({
173
- title: t("raw.sentToAgent"),
172
+ toast.success(t("raw.sentToAgent"), {
174
173
  description: file.name,
175
174
  });
176
175
  } catch (err) {
177
- toast({
178
- title: t("raw.imageUploadFailed"),
176
+ toast.error(t("raw.imageUploadFailed"), {
179
177
  description:
180
178
  err instanceof Error ? err.message : t("raw.imageUploadGenericError"),
181
- variant: "destructive",
182
179
  });
183
180
  } finally {
184
181
  setUploading(false);
@@ -1,8 +1,7 @@
1
1
  import { appBasePath, PromptComposer, useT } from "@agent-native/core/client";
2
2
  import { useState, useEffect, useCallback, useRef } from "react";
3
3
  import { createPortal } from "react-dom";
4
-
5
- import { toast } from "@/hooks/use-toast";
4
+ import { toast } from "sonner";
6
5
 
7
6
  import { GoogleDocImportHint } from "./GoogleDocImportHint";
8
7
 
@@ -151,13 +150,11 @@ export default function PromptPopover({
151
150
  const uploaded = await uploadFiles(files);
152
151
  onSubmit(enrichedText, uploaded);
153
152
  } catch (error) {
154
- toast({
155
- title: t("raw.uploadFailed"),
153
+ toast.error(t("raw.uploadFailed"), {
156
154
  description:
157
155
  error instanceof Error
158
156
  ? error.message
159
157
  : t("raw.uploadAttachedFailed"),
160
- variant: "destructive",
161
158
  });
162
159
  }
163
160
  },
@@ -708,6 +708,36 @@ async function fetchDecksFromAPI(): Promise<Deck[] | null> {
708
708
  }
709
709
  }
710
710
 
711
+ /**
712
+ * Fetch a minimal id-only deck listing (`light: "true"`) for cheap add/remove
713
+ * diffing. Never downloads deck bodies — see `list-decks.ts`. Returns `null`
714
+ * on any failure so callers can skip the diff instead of wiping local state.
715
+ */
716
+ async function fetchDeckListLightFromAPI(): Promise<{ id: string }[] | null> {
717
+ try {
718
+ const result = await callAction<DeckListActionResult>(
719
+ "list-decks",
720
+ { light: "true" },
721
+ { method: "GET" },
722
+ );
723
+ if (!Array.isArray(result?.decks)) {
724
+ console.warn("Failed to fetch deck list: invalid action response");
725
+ return null;
726
+ }
727
+ return result.decks
728
+ .filter(
729
+ (deck): deck is { id: string } =>
730
+ !!deck &&
731
+ typeof deck === "object" &&
732
+ typeof (deck as { id?: unknown }).id === "string",
733
+ )
734
+ .map((deck) => ({ id: deck.id }));
735
+ } catch (err) {
736
+ console.error("Failed to fetch deck list:", err);
737
+ return null;
738
+ }
739
+ }
740
+
711
741
  async function fetchDeckFromAPI(id: string): Promise<Deck | null> {
712
742
  try {
713
743
  const result = await callAction<unknown>(
@@ -1070,8 +1100,14 @@ export function DeckProvider({ children }: { children: ReactNode }) {
1070
1100
  // Re-fetch the deck list and diff it against local state (added/removed
1071
1101
  // decks). Shared by the fallback poll and the SSE resync-on-reconnect path
1072
1102
  // below so both pull from one implementation of "what changed".
1103
+ //
1104
+ // Uses the `light` (id-only) listing — this runs every 15s and previously
1105
+ // downloaded every deck's full slide JSON just to diff ids, even though
1106
+ // existing decks' content was thrown away unused. Only genuinely NEW decks
1107
+ // (rare — usually zero per poll) get a follow-up full fetch so DeckCard can
1108
+ // still render an immediate preview for them.
1073
1109
  const refetchDeckListIfChanged = useCallback(async () => {
1074
- const fresh = await fetchDecksFromAPI();
1110
+ const fresh = await fetchDeckListLightFromAPI();
1075
1111
  // A null result means the fetch failed (network error or non-2xx). Skip
1076
1112
  // the diff so we don't wipe local state on a transient failure.
1077
1113
  if (fresh === null) return;
@@ -1081,18 +1117,25 @@ export function DeckProvider({ children }: { children: ReactNode }) {
1081
1117
  const freshIds = new Set(fresh.map((d) => d.id));
1082
1118
  // Check if deck list changed (added or removed). Optimistic decks still
1083
1119
  // in flight are preserved (not treated as removed).
1084
- const added = fresh.filter((d) => !currentIds.has(d.id));
1120
+ const addedIds = fresh
1121
+ .filter((d) => !currentIds.has(d.id))
1122
+ .map((d) => d.id);
1085
1123
  const removed = currentDecks.filter(
1086
1124
  (d) => !freshIds.has(d.id) && !pending.has(d.id),
1087
1125
  );
1088
- if (added.length === 0 && removed.length === 0) return;
1126
+ if (addedIds.length === 0 && removed.length === 0) return;
1127
+
1128
+ const addedDecks = (
1129
+ await Promise.all(addedIds.map((id) => fetchDeckFromAPI(id)))
1130
+ ).filter((d): d is Deck => d !== null);
1131
+
1089
1132
  lastExternalUpdateRef.current = Date.now();
1090
1133
  setDecks((prev) => {
1091
1134
  const prevIds = new Set(prev.map((d) => d.id));
1092
1135
  // Only add decks that aren't already in prev (prevents duplicates when
1093
1136
  // the closure's deck snapshot is stale compared to `prev`).
1094
1137
  let next = prev.filter((d) => freshIds.has(d.id) || pending.has(d.id));
1095
- for (const a of added) {
1138
+ for (const a of addedDecks) {
1096
1139
  if (!prevIds.has(a.id)) next = [...next, a];
1097
1140
  }
1098
1141
  return next;
@@ -35,6 +35,7 @@ import {
35
35
  } from "react";
36
36
  import type { ComponentType } from "react";
37
37
  import { useParams, useSearchParams, useNavigate } from "react-router";
38
+ import { toast } from "sonner";
38
39
 
39
40
  import { SlideCommentsPanel } from "@/components/comments/SlideCommentsPanel";
40
41
  import { AnimationsPanel } from "@/components/editor/AnimationsPanel";
@@ -51,7 +52,6 @@ import { QuestionFlow } from "@/components/editor/QuestionFlow";
51
52
  import SlideEditor from "@/components/editor/SlideEditor";
52
53
  import { TweaksPanel } from "@/components/editor/TweaksPanel";
53
54
  import { Button } from "@/components/ui/button";
54
- import { ToastAction } from "@/components/ui/toast";
55
55
  import { useDecks } from "@/context/DeckContext";
56
56
  import { useAgentGenerating } from "@/hooks/use-agent-generating";
57
57
  import { useDeckDesignSystem } from "@/hooks/use-deck-design-system";
@@ -61,7 +61,6 @@ import {
61
61
  useSlideComments,
62
62
  type CommentThread,
63
63
  } from "@/hooks/use-slide-comments";
64
- import { toast } from "@/hooks/use-toast";
65
64
  import type { AspectRatio } from "@/lib/aspect-ratios";
66
65
  import { getPreset } from "@/lib/design-systems";
67
66
  import { exportDeckAsPdf } from "@/lib/export-pdf-client";
@@ -396,18 +395,15 @@ export default function DeckEditor() {
396
395
  if (updatedContent !== targetSlide.content) {
397
396
  updateSlide(id, targetSlide.id, { content: updatedContent });
398
397
  }
399
- toast({
400
- title: t("deckEditor.imageAdded"),
398
+ toast.success(t("deckEditor.imageAdded"), {
401
399
  description: file.name,
402
400
  });
403
401
  } catch (error) {
404
- toast({
405
- title: t("deckEditor.imageUploadFailed"),
402
+ toast.error(t("deckEditor.imageUploadFailed"), {
406
403
  description:
407
404
  error instanceof Error
408
405
  ? error.message
409
406
  : t("deckEditor.imageUploadError"),
410
- variant: "destructive",
411
407
  });
412
408
  }
413
409
  },
@@ -482,25 +478,14 @@ export default function DeckEditor() {
482
478
  );
483
479
  })();
484
480
  deleteSlide(deckId, slideId);
485
- const t = toast({
486
- title: `${slideTitle} deleted`,
481
+ toast(`${slideTitle} deleted`, {
487
482
  description: `Press ${shortcutLabel("cmd+z")} or click Undo to restore.`,
488
- action: (
489
- <ToastAction
490
- altText="Undo delete"
491
- data-undo-button
492
- onClick={() => {
493
- undo();
494
- t.dismiss();
495
- }}
496
- >
497
- Undo
498
- </ToastAction>
499
- ),
483
+ duration: 6000,
484
+ action: {
485
+ label: "Undo",
486
+ onClick: () => undo(),
487
+ },
500
488
  });
501
- // Auto-dismiss after 6 seconds (shadcn toast's TOAST_REMOVE_DELAY is
502
- // intentionally enormous, so we trigger it manually).
503
- setTimeout(() => t.dismiss(), 6000);
504
489
  },
505
490
  [deck, deleteSlide, undo],
506
491
  );
@@ -841,23 +826,19 @@ export default function DeckEditor() {
841
826
  try {
842
827
  const slideIds = deck.slides.map((s) => s.id);
843
828
  if (slideIds.length === 0) {
844
- toast({
845
- title: t("deckEditor.exportFailed"),
829
+ toast.error(t("deckEditor.exportFailed"), {
846
830
  description: t("deckEditor.deckHasNoSlides"),
847
- variant: "destructive",
848
831
  });
849
832
  return;
850
833
  }
851
834
  await exportDeckAsPdf(deck.title, slideIds, deck.aspectRatio);
852
835
  } catch (err) {
853
836
  console.error("[pdf-export] failed:", err);
854
- toast({
855
- title: t("deckEditor.exportFailed"),
837
+ toast.error(t("deckEditor.exportFailed"), {
856
838
  description:
857
839
  err instanceof Error
858
840
  ? err.message
859
841
  : t("deckEditor.pdfRenderFailed"),
860
- variant: "destructive",
861
842
  });
862
843
  }
863
844
  }}
@@ -14,6 +14,7 @@ import { IconPlus, IconStack2, IconUserCircle } from "@tabler/icons-react";
14
14
  import { useState, useRef, useCallback, useEffect, useMemo } from "react";
15
15
  import { flushSync } from "react-dom";
16
16
  import { useNavigate, useSearchParams } from "react-router";
17
+ import { toast } from "sonner";
17
18
 
18
19
  import DeckCard from "@/components/deck/DeckCard";
19
20
  import PromptPopover from "@/components/editor/PromptDialog";
@@ -40,7 +41,6 @@ import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
40
41
  import { useDecks } from "@/context/DeckContext";
41
42
  import { useAgentGenerating } from "@/hooks/use-agent-generating";
42
43
  import { useDesignSystems } from "@/hooks/use-design-systems";
43
- import { toast } from "@/hooks/use-toast";
44
44
  import { savePromptToComposerDraft } from "@/lib/composer-draft";
45
45
 
46
46
  const MAX_SOURCE_CONTEXT_CHARS = 60_000;
@@ -451,8 +451,7 @@ export default function Index() {
451
451
  }
452
452
  setNewDeckRetryFiles(filesForGeneration);
453
453
  deleteDeck(deck.id);
454
- toast({
455
- title: t("home.generationStartFailed"),
454
+ toast.error(t("home.generationStartFailed"), {
456
455
  description: t("home.generationStartFailedDescription"),
457
456
  });
458
457
  setShowNewDeckPrompt(true);
@@ -30,7 +30,6 @@ import {
30
30
  import type { LinksFunction } from "react-router";
31
31
 
32
32
  import { Layout as AppLayout } from "@/components/layout/Layout";
33
- import { Toaster } from "@/components/ui/toaster";
34
33
  import { AppToolkitProvider } from "@/components/ui/toolkit-provider";
35
34
  import { DeckProvider } from "@/context/DeckContext";
36
35
  import { useNavigationState } from "@/hooks/use-navigation-state";
@@ -249,10 +248,6 @@ export default function Root() {
249
248
  i18n={{ catalog: i18nCatalog }}
250
249
  >
251
250
  <AppContent />
252
- {/* useToast-based Toaster - separate from AppProviders' sonner Toaster.
253
- Components throughout the app call toast() from @agent-native/toolkit,
254
- which requires this Toaster to be mounted. */}
255
- <Toaster />
256
251
  </AppProviders>
257
252
  </AppToolkitProvider>
258
253
  );
@@ -0,0 +1,6 @@
1
+ ---
2
+ type: improved
3
+ date: 2026-07-10
4
+ ---
5
+
6
+ Deck lists load much faster and no longer re-download slide content in the background
@@ -43,7 +43,7 @@
43
43
  "dotenv": "^17.2.1",
44
44
  "drizzle-orm": "^0.45.2",
45
45
  "fast-xml-parser": "5.7.2",
46
- "h3": "^2.0.1-rc.20",
46
+ "h3": "catalog:",
47
47
  "isbot": "^5",
48
48
  "jspdf": "4.2.1",
49
49
  "jszip": "3.10.1",
@@ -128,7 +128,6 @@
128
128
  "tailwindcss": "catalog:",
129
129
  "three": "^0.176.0",
130
130
  "tsx": "^4.20.3",
131
- "typescript": "catalog:",
132
131
  "typescript-7": "catalog:",
133
132
  "vaul": "^1.1.2",
134
133
  "vite": "catalog:",
@@ -7,4 +7,23 @@
7
7
  export declare function isA2AProductionRuntime(): boolean;
8
8
  export declare function hasConfiguredA2ASecret(): boolean;
9
9
  export declare function shouldAdvertiseJwtA2AAuth(): boolean;
10
+ /**
11
+ * True only when unsigned internal self-dispatch is acceptable: no A2A_SECRET
12
+ * is configured AND we can positively identify a local/dev runtime. Everything
13
+ * else — production, or any UNRECOGNIZED deployed/networked host — must fail
14
+ * closed and require A2A_SECRET. `loopback` should be whether the inbound
15
+ * request arrived over the loopback interface (127.0.0.1/::1); callers that
16
+ * cannot determine the peer address pass `false`.
17
+ *
18
+ * NODE_ENV alone is deliberately NOT a trust grant: a self-hosted deployment
19
+ * that doesn't set NODE_ENV=production and isn't recognized by
20
+ * `isA2AProductionRuntime()` (a bare Docker/VPS/K8s pod) must still fail
21
+ * closed unless the request actually came from loopback or the explicit
22
+ * opt-in flag is set.
23
+ */
24
+ export declare function isTrustedLocalRuntime(opts: {
25
+ loopback: boolean;
26
+ }): boolean;
27
+ /** True if a socket peer address is a loopback/local address. */
28
+ export declare function isLoopbackAddress(addr: string | undefined | null): boolean;
10
29
  //# sourceMappingURL=auth-policy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth-policy.d.ts","sourceRoot":"","sources":["../../src/a2a/auth-policy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAkBhD;AAED,wBAAgB,sBAAsB,IAAI,OAAO,CAEhD;AAED,wBAAgB,yBAAyB,IAAI,OAAO,CAEnD"}
1
+ {"version":3,"file":"auth-policy.d.ts","sourceRoot":"","sources":["../../src/a2a/auth-policy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAkBhD;AAED,wBAAgB,sBAAsB,IAAI,OAAO,CAEhD;AAED,wBAAgB,yBAAyB,IAAI,OAAO,CAEnD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAI1E;AAED,iEAAiE;AACjE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAU1E"}
@@ -31,4 +31,36 @@ export function hasConfiguredA2ASecret() {
31
31
  export function shouldAdvertiseJwtA2AAuth() {
32
32
  return hasConfiguredA2ASecret() || isA2AProductionRuntime();
33
33
  }
34
+ /**
35
+ * True only when unsigned internal self-dispatch is acceptable: no A2A_SECRET
36
+ * is configured AND we can positively identify a local/dev runtime. Everything
37
+ * else — production, or any UNRECOGNIZED deployed/networked host — must fail
38
+ * closed and require A2A_SECRET. `loopback` should be whether the inbound
39
+ * request arrived over the loopback interface (127.0.0.1/::1); callers that
40
+ * cannot determine the peer address pass `false`.
41
+ *
42
+ * NODE_ENV alone is deliberately NOT a trust grant: a self-hosted deployment
43
+ * that doesn't set NODE_ENV=production and isn't recognized by
44
+ * `isA2AProductionRuntime()` (a bare Docker/VPS/K8s pod) must still fail
45
+ * closed unless the request actually came from loopback or the explicit
46
+ * opt-in flag is set.
47
+ */
48
+ export function isTrustedLocalRuntime(opts) {
49
+ if (isA2AProductionRuntime())
50
+ return false;
51
+ if (process.env.A2A_ALLOW_UNSIGNED_INTERNAL === "1")
52
+ return true;
53
+ return opts.loopback === true;
54
+ }
55
+ /** True if a socket peer address is a loopback/local address. */
56
+ export function isLoopbackAddress(addr) {
57
+ if (!addr)
58
+ return false;
59
+ const a = addr.trim();
60
+ return (a === "127.0.0.1" ||
61
+ a === "::1" ||
62
+ a === "::ffff:127.0.0.1" ||
63
+ a.startsWith("127.") ||
64
+ a === "localhost");
65
+ }
34
66
  //# sourceMappingURL=auth-policy.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth-policy.js","sourceRoot":"","sources":["../../src/a2a/auth-policy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB;IACpC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;QAAE,OAAO,IAAI,CAAC;IACvD,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,MAAM,EAAE,CAAC;QAC3E,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IACE,OAAO,CAAC,GAAG,CAAC,wBAAwB;QACpC,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,MAAM,EACpC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,GAAG;QAAE,OAAO,IAAI,CAAC;IAC9C,IAAI,UAAU,IAAI,UAAU;QAAE,OAAO,IAAI,CAAC;IAC1C,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU;QAAE,OAAO,IAAI,CAAC;IAC9D,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;QAC5E,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,sBAAsB;IACpC,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,yBAAyB;IACvC,OAAO,sBAAsB,EAAE,IAAI,sBAAsB,EAAE,CAAC;AAC9D,CAAC","sourcesContent":["/**\n * A2A auth policy helpers shared by discovery, the JSON-RPC gate, and task\n * handlers. Serverless providers do not always expose `NODE_ENV=production`\n * consistently at runtime, so production-like A2A checks also look at the\n * provider flags those platforms set in deployed functions.\n */\nexport function isA2AProductionRuntime(): boolean {\n if (process.env.NODE_ENV === \"production\") return true;\n if (process.env.NETLIFY === \"true\" && process.env.NETLIFY_LOCAL !== \"true\") {\n return true;\n }\n if (\n process.env.AWS_LAMBDA_FUNCTION_NAME &&\n process.env.NETLIFY_LOCAL !== \"true\"\n ) {\n return true;\n }\n if (process.env.CF_PAGES === \"1\") return true;\n if (\"__cf_env\" in globalThis) return true;\n if (process.env.VERCEL || process.env.VERCEL_ENV) return true;\n if (process.env.RENDER || process.env.FLY_APP_NAME || process.env.K_SERVICE) {\n return true;\n }\n return false;\n}\n\nexport function hasConfiguredA2ASecret(): boolean {\n return !!process.env.A2A_SECRET?.trim();\n}\n\nexport function shouldAdvertiseJwtA2AAuth(): boolean {\n return hasConfiguredA2ASecret() || isA2AProductionRuntime();\n}\n"]}
1
+ {"version":3,"file":"auth-policy.js","sourceRoot":"","sources":["../../src/a2a/auth-policy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB;IACpC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;QAAE,OAAO,IAAI,CAAC;IACvD,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,MAAM,EAAE,CAAC;QAC3E,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IACE,OAAO,CAAC,GAAG,CAAC,wBAAwB;QACpC,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,MAAM,EACpC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,GAAG;QAAE,OAAO,IAAI,CAAC;IAC9C,IAAI,UAAU,IAAI,UAAU;QAAE,OAAO,IAAI,CAAC;IAC1C,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU;QAAE,OAAO,IAAI,CAAC;IAC9D,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;QAC5E,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,sBAAsB;IACpC,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,yBAAyB;IACvC,OAAO,sBAAsB,EAAE,IAAI,sBAAsB,EAAE,CAAC;AAC9D,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAA2B;IAC/D,IAAI,sBAAsB,EAAE;QAAE,OAAO,KAAK,CAAC;IAC3C,IAAI,OAAO,CAAC,GAAG,CAAC,2BAA2B,KAAK,GAAG;QAAE,OAAO,IAAI,CAAC;IACjE,OAAO,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC;AAChC,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,iBAAiB,CAAC,IAA+B;IAC/D,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACxB,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IACtB,OAAO,CACL,CAAC,KAAK,WAAW;QACjB,CAAC,KAAK,KAAK;QACX,CAAC,KAAK,kBAAkB;QACxB,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC;QACpB,CAAC,KAAK,WAAW,CAClB,CAAC;AACJ,CAAC","sourcesContent":["/**\n * A2A auth policy helpers shared by discovery, the JSON-RPC gate, and task\n * handlers. Serverless providers do not always expose `NODE_ENV=production`\n * consistently at runtime, so production-like A2A checks also look at the\n * provider flags those platforms set in deployed functions.\n */\nexport function isA2AProductionRuntime(): boolean {\n if (process.env.NODE_ENV === \"production\") return true;\n if (process.env.NETLIFY === \"true\" && process.env.NETLIFY_LOCAL !== \"true\") {\n return true;\n }\n if (\n process.env.AWS_LAMBDA_FUNCTION_NAME &&\n process.env.NETLIFY_LOCAL !== \"true\"\n ) {\n return true;\n }\n if (process.env.CF_PAGES === \"1\") return true;\n if (\"__cf_env\" in globalThis) return true;\n if (process.env.VERCEL || process.env.VERCEL_ENV) return true;\n if (process.env.RENDER || process.env.FLY_APP_NAME || process.env.K_SERVICE) {\n return true;\n }\n return false;\n}\n\nexport function hasConfiguredA2ASecret(): boolean {\n return !!process.env.A2A_SECRET?.trim();\n}\n\nexport function shouldAdvertiseJwtA2AAuth(): boolean {\n return hasConfiguredA2ASecret() || isA2AProductionRuntime();\n}\n\n/**\n * True only when unsigned internal self-dispatch is acceptable: no A2A_SECRET\n * is configured AND we can positively identify a local/dev runtime. Everything\n * else — production, or any UNRECOGNIZED deployed/networked host — must fail\n * closed and require A2A_SECRET. `loopback` should be whether the inbound\n * request arrived over the loopback interface (127.0.0.1/::1); callers that\n * cannot determine the peer address pass `false`.\n *\n * NODE_ENV alone is deliberately NOT a trust grant: a self-hosted deployment\n * that doesn't set NODE_ENV=production and isn't recognized by\n * `isA2AProductionRuntime()` (a bare Docker/VPS/K8s pod) must still fail\n * closed unless the request actually came from loopback or the explicit\n * opt-in flag is set.\n */\nexport function isTrustedLocalRuntime(opts: { loopback: boolean }): boolean {\n if (isA2AProductionRuntime()) return false;\n if (process.env.A2A_ALLOW_UNSIGNED_INTERNAL === \"1\") return true;\n return opts.loopback === true;\n}\n\n/** True if a socket peer address is a loopback/local address. */\nexport function isLoopbackAddress(addr: string | undefined | null): boolean {\n if (!addr) return false;\n const a = addr.trim();\n return (\n a === \"127.0.0.1\" ||\n a === \"::1\" ||\n a === \"::ffff:127.0.0.1\" ||\n a.startsWith(\"127.\") ||\n a === \"localhost\"\n );\n}\n"]}
@@ -192,14 +192,17 @@ export declare function extractProcessRunId(body: unknown): string | null;
192
192
  *
193
193
  * Auth policy mirrors the agent-teams processor exactly:
194
194
  * - `A2A_SECRET` set → require a valid `verifyInternalToken(runId, token)`.
195
- * - no secret but a production runtime refuse (503) never run unsigned in
196
- * prod.
197
- * - no secret + non-prod (local dev) allow unsigned; the SQL atomic claim
198
- * in the worker still prevents double-processing.
195
+ * - no secret → require `isTrustedLocalRuntime({ loopback })` (see
196
+ * auth-policy.ts): refuse (503) unless `A2A_ALLOW_UNSIGNED_INTERNAL=1` is
197
+ * set. This function has no h3 `event` of its own, so callers that CAN
198
+ * see the inbound socket peer (the route handler, which has the event)
199
+ * should compute `loopback` from it and pass it through; callers that
200
+ * can't determine the peer address should omit it (defaults to `false`
201
+ * — never trust unsigned dispatch without an explicit opt-in).
199
202
  *
200
203
  * Extracted from the route handler so the auth + marker-prep decision is unit
201
204
  * testable without booting the whole Nitro plugin. The route only adds body
202
205
  * reading and the final handler invocation around this.
203
206
  */
204
- export declare function prepareProcessRunRequest(body: unknown, authHeader: string | undefined): ProcessRunPreparation;
207
+ export declare function prepareProcessRunRequest(body: unknown, authHeader: string | undefined, loopback?: boolean): ProcessRunPreparation;
205
208
  //# sourceMappingURL=durable-background.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"durable-background.d.ts","sourceRoot":"","sources":["../../src/agent/durable-background.ts"],"names":[],"mappings":"AAgDA;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,2CACE,CAAC;AAE3C;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,4BAA4B,CAAC;AAExE;;;;;;;;;GASG;AACH,eAAO,MAAM,kCAAkC,gDAA0D,CAAC;AAE1G;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC,2BAA2B,CAAC;AACzE,eAAO,MAAM,8BAA8B,QAAQ,CAAC;AACpD,eAAO,MAAM,gCAAgC,UAAU,CAAC;AACxD,eAAO,MAAM,sCAAsC,gCACpB,CAAC;AAiChC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,sCAAsC,IAAI,MAAM,CAQ/D;AAED,wBAAgB,oCAAoC,CAClD,YAAY,EAAE,MAAM,GACnB,MAAM,CAQR;AAED,wBAAgB,4CAA4C,CAC1D,YAAY,EAAE,MAAM,GACnB,OAAO,CAET;AAED;;;GAGG;AACH,eAAO,MAAM,iCAAiC,kCACb,CAAC;AAElC;;;;;;GAMG;AACH,eAAO,MAAM,+BAA+B,oBAAoB,CAAC;AAEjE;;;;GAIG;AACH,wBAAgB,mCAAmC,IAAI,OAAO,CAsB7D;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,6BAA6B,IAAI,OAAO,CAsBvD;AAED,wBAAgB,2CAA2C,CACzD,MAAM,EAAE,OAAO,GACd,OAAO,CAOT;AAED,wBAAgB,2CAA2C,CACzD,OAAO,EAAE,OAAO,GACf,OAAO,CAKT;AAED,wBAAgB,iCAAiC,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAQzE;AAwCD;;;;;;;GAOG;AACH,wBAAgB,mCAAmC,CAAC,OAAO,CAAC,EAAE;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,OAAO,CAWV;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,oCAAoC,qCACb,CAAC;AAiBrC;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,qCAAqC,IAAI,OAAO,CAM/D;AAED,uDAAuD;AACvD,MAAM,MAAM,qBAAqB,GAC7B;IACE,EAAE,EAAE,IAAI,CAAC;IACT,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B,GACD;IACE,EAAE,EAAE,KAAK,CAAC;IACV,2CAA2C;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;OAMG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAAC;AAEN;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAahE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,MAAM,GAAG,SAAS,GAC7B,qBAAqB,CAiDvB"}
1
+ {"version":3,"file":"durable-background.d.ts","sourceRoot":"","sources":["../../src/agent/durable-background.ts"],"names":[],"mappings":"AAgDA;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,2CACE,CAAC;AAE3C;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,4BAA4B,CAAC;AAExE;;;;;;;;;GASG;AACH,eAAO,MAAM,kCAAkC,gDAA0D,CAAC;AAE1G;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC,2BAA2B,CAAC;AACzE,eAAO,MAAM,8BAA8B,QAAQ,CAAC;AACpD,eAAO,MAAM,gCAAgC,UAAU,CAAC;AACxD,eAAO,MAAM,sCAAsC,gCACpB,CAAC;AAiChC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,sCAAsC,IAAI,MAAM,CAQ/D;AAED,wBAAgB,oCAAoC,CAClD,YAAY,EAAE,MAAM,GACnB,MAAM,CAQR;AAED,wBAAgB,4CAA4C,CAC1D,YAAY,EAAE,MAAM,GACnB,OAAO,CAET;AAED;;;GAGG;AACH,eAAO,MAAM,iCAAiC,kCACb,CAAC;AAElC;;;;;;GAMG;AACH,eAAO,MAAM,+BAA+B,oBAAoB,CAAC;AAEjE;;;;GAIG;AACH,wBAAgB,mCAAmC,IAAI,OAAO,CAsB7D;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,6BAA6B,IAAI,OAAO,CAsBvD;AAED,wBAAgB,2CAA2C,CACzD,MAAM,EAAE,OAAO,GACd,OAAO,CAOT;AAED,wBAAgB,2CAA2C,CACzD,OAAO,EAAE,OAAO,GACf,OAAO,CAKT;AAED,wBAAgB,iCAAiC,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAQzE;AAwCD;;;;;;;GAOG;AACH,wBAAgB,mCAAmC,CAAC,OAAO,CAAC,EAAE;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,OAAO,CAWV;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,oCAAoC,qCACb,CAAC;AAiBrC;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,qCAAqC,IAAI,OAAO,CAM/D;AAED,uDAAuD;AACvD,MAAM,MAAM,qBAAqB,GAC7B;IACE,EAAE,EAAE,IAAI,CAAC;IACT,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B,GACD;IACE,EAAE,EAAE,KAAK,CAAC;IACV,2CAA2C;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;OAMG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAAC;AAEN;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAahE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,QAAQ,GAAE,OAAe,GACxB,qBAAqB,CAqDvB"}
@@ -37,7 +37,7 @@
37
37
  * durable dispatch happens to fail still gets a working chat, just without the
38
38
  * 15-min budget.
39
39
  */
40
- import { hasConfiguredA2ASecret, isA2AProductionRuntime, } from "../a2a/auth-policy.js";
40
+ import { hasConfiguredA2ASecret, isTrustedLocalRuntime, } from "../a2a/auth-policy.js";
41
41
  import { extractBearerToken, verifyInternalToken, } from "../integrations/internal-token.js";
42
42
  /**
43
43
  * Framework route the background function actually runs — sibling to
@@ -380,16 +380,19 @@ export function extractProcessRunId(body) {
380
380
  *
381
381
  * Auth policy mirrors the agent-teams processor exactly:
382
382
  * - `A2A_SECRET` set → require a valid `verifyInternalToken(runId, token)`.
383
- * - no secret but a production runtime refuse (503) never run unsigned in
384
- * prod.
385
- * - no secret + non-prod (local dev) allow unsigned; the SQL atomic claim
386
- * in the worker still prevents double-processing.
383
+ * - no secret → require `isTrustedLocalRuntime({ loopback })` (see
384
+ * auth-policy.ts): refuse (503) unless `A2A_ALLOW_UNSIGNED_INTERNAL=1` is
385
+ * set. This function has no h3 `event` of its own, so callers that CAN
386
+ * see the inbound socket peer (the route handler, which has the event)
387
+ * should compute `loopback` from it and pass it through; callers that
388
+ * can't determine the peer address should omit it (defaults to `false`
389
+ * — never trust unsigned dispatch without an explicit opt-in).
387
390
  *
388
391
  * Extracted from the route handler so the auth + marker-prep decision is unit
389
392
  * testable without booting the whole Nitro plugin. The route only adds body
390
393
  * reading and the final handler invocation around this.
391
394
  */
392
- export function prepareProcessRunRequest(body, authHeader) {
395
+ export function prepareProcessRunRequest(body, authHeader, loopback = false) {
393
396
  if (!body || typeof body !== "object") {
394
397
  return {
395
398
  ok: false,
@@ -419,11 +422,15 @@ export function prepareProcessRunRequest(body, authHeader) {
419
422
  };
420
423
  }
421
424
  }
422
- else if (isA2AProductionRuntime()) {
425
+ else if (!isTrustedLocalRuntime({ loopback })) {
426
+ // Callers that can see the h3 `event` (the route handler) pass the real
427
+ // loopback signal; callers without one default to non-loopback. Unsigned
428
+ // dispatch is still allowed via A2A_ALLOW_UNSIGNED_INTERNAL=1 for trusted
429
+ // local/dev setups; see auth-policy.ts `isTrustedLocalRuntime`.
423
430
  return {
424
431
  ok: false,
425
432
  status: 503,
426
- error: "Agent chat background processor not configured — set A2A_SECRET on this deployment.",
433
+ error: "Agent chat background processor not configured — set A2A_SECRET on this deployment (or A2A_ALLOW_UNSIGNED_INTERNAL=1 for trusted local dev).",
427
434
  runId,
428
435
  };
429
436
  }