@agent-native/core 0.92.12 → 0.94.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 (1836) hide show
  1. package/corpus/README.md +2 -2
  2. package/corpus/core/CHANGELOG.md +64 -0
  3. package/corpus/core/docs/content/a2a-protocol.mdx +21 -5
  4. package/corpus/core/docs/content/actions.mdx +9 -23
  5. package/corpus/core/docs/content/agent-mentions.mdx +31 -29
  6. package/corpus/core/docs/content/agent-native-toolkit.mdx +15 -6
  7. package/corpus/core/docs/content/agent-surfaces.mdx +9 -13
  8. package/corpus/core/docs/content/agent-teams.mdx +1 -0
  9. package/corpus/core/docs/content/authentication.mdx +10 -3
  10. package/corpus/core/docs/content/automation-connectors.mdx +123 -0
  11. package/corpus/core/docs/content/automations.mdx +17 -3
  12. package/corpus/core/docs/content/blueprint-installer.mdx +11 -4
  13. package/corpus/core/docs/content/cli-adapters.mdx +9 -6
  14. package/corpus/core/docs/content/client.mdx +16 -0
  15. package/corpus/core/docs/content/cloneable-saas.mdx +14 -11
  16. package/corpus/core/docs/content/code-agents-ui.mdx +65 -0
  17. package/corpus/core/docs/content/components.mdx +30 -14
  18. package/corpus/core/docs/content/context-awareness.mdx +27 -15
  19. package/corpus/core/docs/content/creating-templates.mdx +15 -9
  20. package/corpus/core/docs/content/cross-app-sso.mdx +16 -6
  21. package/corpus/core/docs/content/data-programs.mdx +1 -1
  22. package/corpus/core/docs/content/database.mdx +17 -5
  23. package/corpus/core/docs/content/deployment.mdx +19 -18
  24. package/corpus/core/docs/content/dispatch.mdx +6 -2
  25. package/corpus/core/docs/content/drop-in-agent.mdx +10 -4
  26. package/corpus/core/docs/content/durable-background-runs.mdx +9 -5
  27. package/corpus/core/docs/content/durable-resume.mdx +9 -4
  28. package/corpus/core/docs/content/embedding-sdk.mdx +26 -8
  29. package/corpus/core/docs/content/evals.mdx +3 -5
  30. package/corpus/core/docs/content/extensions.mdx +23 -2
  31. package/corpus/core/docs/content/external-agents.mdx +25 -34
  32. package/corpus/core/docs/content/faq.mdx +8 -0
  33. package/corpus/core/docs/content/file-uploads.mdx +12 -3
  34. package/corpus/core/docs/content/frames.mdx +16 -0
  35. package/corpus/core/docs/content/generative-ui.mdx +1 -1
  36. package/corpus/core/docs/content/getting-started.mdx +34 -21
  37. package/corpus/core/docs/content/harness-agents.mdx +8 -4
  38. package/corpus/core/docs/content/human-approval.mdx +8 -3
  39. package/corpus/core/docs/content/internationalization.mdx +9 -4
  40. package/corpus/core/docs/content/key-concepts.mdx +13 -20
  41. package/corpus/core/docs/content/local-file-mode.mdx +14 -8
  42. package/corpus/core/docs/content/locales/ar-SA/actions.mdx +2 -2
  43. package/corpus/core/docs/content/locales/ar-SA/agent-native-toolkit.mdx +2 -2
  44. package/corpus/core/docs/content/locales/ar-SA/agent-surfaces.mdx +8 -10
  45. package/corpus/core/docs/content/locales/ar-SA/agent-teams.mdx +1 -0
  46. package/corpus/core/docs/content/locales/ar-SA/authentication.mdx +1 -1
  47. package/corpus/core/docs/content/locales/ar-SA/components.mdx +11 -1
  48. package/corpus/core/docs/content/locales/ar-SA/creating-templates.mdx +3 -7
  49. package/corpus/core/docs/content/locales/ar-SA/cross-app-sso.mdx +16 -6
  50. package/corpus/core/docs/content/locales/ar-SA/deployment.mdx +8 -0
  51. package/corpus/core/docs/content/locales/ar-SA/extensions.mdx +8 -0
  52. package/corpus/core/docs/content/locales/ar-SA/external-agents.mdx +2 -7
  53. package/corpus/core/docs/content/locales/ar-SA/key-concepts.mdx +13 -20
  54. package/corpus/core/docs/content/locales/ar-SA/messaging.mdx +84 -15
  55. package/corpus/core/docs/content/locales/ar-SA/multi-tenancy.mdx +5 -5
  56. package/corpus/core/docs/content/locales/ar-SA/notifications.mdx +18 -10
  57. package/corpus/core/docs/content/locales/ar-SA/processors.mdx +11 -5
  58. package/corpus/core/docs/content/locales/ar-SA/server.mdx +17 -10
  59. package/corpus/core/docs/content/locales/ar-SA/sharing.mdx +10 -10
  60. package/corpus/core/docs/content/locales/ar-SA/skills-guide.mdx +34 -17
  61. package/corpus/core/docs/content/locales/ar-SA/template-assets.mdx +16 -13
  62. package/corpus/core/docs/content/locales/ar-SA/template-brain.mdx +3 -1
  63. package/corpus/core/docs/content/locales/ar-SA/template-clips.mdx +4 -3
  64. package/corpus/core/docs/content/locales/ar-SA/template-design.mdx +4 -1
  65. package/corpus/core/docs/content/locales/ar-SA/template-dispatch.mdx +5 -1
  66. package/corpus/core/docs/content/locales/ar-SA/template-mail.mdx +8 -0
  67. package/corpus/core/docs/content/locales/ar-SA/tracking.mdx +9 -6
  68. package/corpus/core/docs/content/locales/ar-SA/using-your-agent.mdx +0 -7
  69. package/corpus/core/docs/content/locales/ar-SA/voice-input.mdx +6 -0
  70. package/corpus/core/docs/content/locales/ar-SA/workspace-connections.mdx +9 -2
  71. package/corpus/core/docs/content/locales/ar-SA/workspace.mdx +19 -18
  72. package/corpus/core/docs/content/locales/de-DE/actions.mdx +2 -2
  73. package/corpus/core/docs/content/locales/de-DE/agent-native-toolkit.mdx +2 -2
  74. package/corpus/core/docs/content/locales/de-DE/agent-surfaces.mdx +8 -10
  75. package/corpus/core/docs/content/locales/de-DE/agent-teams.mdx +1 -0
  76. package/corpus/core/docs/content/locales/de-DE/authentication.mdx +1 -1
  77. package/corpus/core/docs/content/locales/de-DE/components.mdx +11 -1
  78. package/corpus/core/docs/content/locales/de-DE/creating-templates.mdx +3 -7
  79. package/corpus/core/docs/content/locales/de-DE/cross-app-sso.mdx +16 -6
  80. package/corpus/core/docs/content/locales/de-DE/deployment.mdx +8 -0
  81. package/corpus/core/docs/content/locales/de-DE/extensions.mdx +10 -0
  82. package/corpus/core/docs/content/locales/de-DE/external-agents.mdx +3 -7
  83. package/corpus/core/docs/content/locales/de-DE/key-concepts.mdx +13 -20
  84. package/corpus/core/docs/content/locales/de-DE/messaging.mdx +92 -15
  85. package/corpus/core/docs/content/locales/de-DE/multi-tenancy.mdx +5 -5
  86. package/corpus/core/docs/content/locales/de-DE/notifications.mdx +18 -10
  87. package/corpus/core/docs/content/locales/de-DE/processors.mdx +11 -5
  88. package/corpus/core/docs/content/locales/de-DE/server.mdx +18 -10
  89. package/corpus/core/docs/content/locales/de-DE/sharing.mdx +10 -10
  90. package/corpus/core/docs/content/locales/de-DE/skills-guide.mdx +34 -17
  91. package/corpus/core/docs/content/locales/de-DE/template-assets.mdx +16 -13
  92. package/corpus/core/docs/content/locales/de-DE/template-brain.mdx +3 -1
  93. package/corpus/core/docs/content/locales/de-DE/template-clips.mdx +4 -3
  94. package/corpus/core/docs/content/locales/de-DE/template-design.mdx +4 -1
  95. package/corpus/core/docs/content/locales/de-DE/template-dispatch.mdx +5 -1
  96. package/corpus/core/docs/content/locales/de-DE/template-mail.mdx +8 -0
  97. package/corpus/core/docs/content/locales/de-DE/tracking.mdx +9 -6
  98. package/corpus/core/docs/content/locales/de-DE/using-your-agent.mdx +0 -7
  99. package/corpus/core/docs/content/locales/de-DE/voice-input.mdx +6 -0
  100. package/corpus/core/docs/content/locales/de-DE/workspace-connections.mdx +9 -2
  101. package/corpus/core/docs/content/locales/de-DE/workspace.mdx +19 -18
  102. package/corpus/core/docs/content/locales/es-ES/actions.mdx +2 -2
  103. package/corpus/core/docs/content/locales/es-ES/agent-native-toolkit.mdx +2 -2
  104. package/corpus/core/docs/content/locales/es-ES/agent-surfaces.mdx +8 -10
  105. package/corpus/core/docs/content/locales/es-ES/agent-teams.mdx +1 -0
  106. package/corpus/core/docs/content/locales/es-ES/authentication.mdx +1 -1
  107. package/corpus/core/docs/content/locales/es-ES/components.mdx +11 -1
  108. package/corpus/core/docs/content/locales/es-ES/creating-templates.mdx +3 -7
  109. package/corpus/core/docs/content/locales/es-ES/cross-app-sso.mdx +16 -6
  110. package/corpus/core/docs/content/locales/es-ES/deployment.mdx +8 -0
  111. package/corpus/core/docs/content/locales/es-ES/extensions.mdx +10 -0
  112. package/corpus/core/docs/content/locales/es-ES/external-agents.mdx +3 -7
  113. package/corpus/core/docs/content/locales/es-ES/key-concepts.mdx +13 -20
  114. package/corpus/core/docs/content/locales/es-ES/messaging.mdx +91 -15
  115. package/corpus/core/docs/content/locales/es-ES/multi-tenancy.mdx +5 -5
  116. package/corpus/core/docs/content/locales/es-ES/notifications.mdx +18 -10
  117. package/corpus/core/docs/content/locales/es-ES/processors.mdx +11 -5
  118. package/corpus/core/docs/content/locales/es-ES/server.mdx +17 -10
  119. package/corpus/core/docs/content/locales/es-ES/sharing.mdx +10 -10
  120. package/corpus/core/docs/content/locales/es-ES/skills-guide.mdx +34 -17
  121. package/corpus/core/docs/content/locales/es-ES/template-assets.mdx +16 -13
  122. package/corpus/core/docs/content/locales/es-ES/template-brain.mdx +3 -1
  123. package/corpus/core/docs/content/locales/es-ES/template-clips.mdx +4 -3
  124. package/corpus/core/docs/content/locales/es-ES/template-design.mdx +4 -1
  125. package/corpus/core/docs/content/locales/es-ES/template-dispatch.mdx +5 -1
  126. package/corpus/core/docs/content/locales/es-ES/template-mail.mdx +8 -0
  127. package/corpus/core/docs/content/locales/es-ES/tracking.mdx +9 -6
  128. package/corpus/core/docs/content/locales/es-ES/using-your-agent.mdx +0 -7
  129. package/corpus/core/docs/content/locales/es-ES/voice-input.mdx +6 -0
  130. package/corpus/core/docs/content/locales/es-ES/workspace-connections.mdx +9 -2
  131. package/corpus/core/docs/content/locales/es-ES/workspace.mdx +19 -18
  132. package/corpus/core/docs/content/locales/fr-FR/actions.mdx +2 -2
  133. package/corpus/core/docs/content/locales/fr-FR/agent-native-toolkit.mdx +2 -2
  134. package/corpus/core/docs/content/locales/fr-FR/agent-surfaces.mdx +8 -10
  135. package/corpus/core/docs/content/locales/fr-FR/agent-teams.mdx +1 -0
  136. package/corpus/core/docs/content/locales/fr-FR/authentication.mdx +1 -1
  137. package/corpus/core/docs/content/locales/fr-FR/components.mdx +11 -1
  138. package/corpus/core/docs/content/locales/fr-FR/creating-templates.mdx +3 -7
  139. package/corpus/core/docs/content/locales/fr-FR/cross-app-sso.mdx +16 -6
  140. package/corpus/core/docs/content/locales/fr-FR/deployment.mdx +8 -0
  141. package/corpus/core/docs/content/locales/fr-FR/extensions.mdx +10 -0
  142. package/corpus/core/docs/content/locales/fr-FR/external-agents.mdx +3 -7
  143. package/corpus/core/docs/content/locales/fr-FR/key-concepts.mdx +13 -20
  144. package/corpus/core/docs/content/locales/fr-FR/messaging.mdx +91 -15
  145. package/corpus/core/docs/content/locales/fr-FR/multi-tenancy.mdx +5 -5
  146. package/corpus/core/docs/content/locales/fr-FR/notifications.mdx +18 -10
  147. package/corpus/core/docs/content/locales/fr-FR/processors.mdx +11 -5
  148. package/corpus/core/docs/content/locales/fr-FR/server.mdx +17 -10
  149. package/corpus/core/docs/content/locales/fr-FR/sharing.mdx +10 -10
  150. package/corpus/core/docs/content/locales/fr-FR/skills-guide.mdx +34 -17
  151. package/corpus/core/docs/content/locales/fr-FR/template-assets.mdx +16 -13
  152. package/corpus/core/docs/content/locales/fr-FR/template-brain.mdx +3 -1
  153. package/corpus/core/docs/content/locales/fr-FR/template-clips.mdx +4 -3
  154. package/corpus/core/docs/content/locales/fr-FR/template-design.mdx +4 -1
  155. package/corpus/core/docs/content/locales/fr-FR/template-dispatch.mdx +5 -1
  156. package/corpus/core/docs/content/locales/fr-FR/template-mail.mdx +8 -0
  157. package/corpus/core/docs/content/locales/fr-FR/tracking.mdx +9 -6
  158. package/corpus/core/docs/content/locales/fr-FR/using-your-agent.mdx +0 -7
  159. package/corpus/core/docs/content/locales/fr-FR/voice-input.mdx +6 -0
  160. package/corpus/core/docs/content/locales/fr-FR/workspace-connections.mdx +9 -2
  161. package/corpus/core/docs/content/locales/fr-FR/workspace.mdx +19 -18
  162. package/corpus/core/docs/content/locales/hi-IN/actions.mdx +2 -2
  163. package/corpus/core/docs/content/locales/hi-IN/agent-native-toolkit.mdx +2 -2
  164. package/corpus/core/docs/content/locales/hi-IN/agent-surfaces.mdx +8 -10
  165. package/corpus/core/docs/content/locales/hi-IN/agent-teams.mdx +1 -0
  166. package/corpus/core/docs/content/locales/hi-IN/authentication.mdx +1 -1
  167. package/corpus/core/docs/content/locales/hi-IN/components.mdx +11 -1
  168. package/corpus/core/docs/content/locales/hi-IN/creating-templates.mdx +3 -7
  169. package/corpus/core/docs/content/locales/hi-IN/cross-app-sso.mdx +16 -6
  170. package/corpus/core/docs/content/locales/hi-IN/deployment.mdx +8 -0
  171. package/corpus/core/docs/content/locales/hi-IN/extensions.mdx +8 -0
  172. package/corpus/core/docs/content/locales/hi-IN/external-agents.mdx +2 -7
  173. package/corpus/core/docs/content/locales/hi-IN/key-concepts.mdx +13 -20
  174. package/corpus/core/docs/content/locales/hi-IN/messaging.mdx +81 -15
  175. package/corpus/core/docs/content/locales/hi-IN/multi-tenancy.mdx +5 -5
  176. package/corpus/core/docs/content/locales/hi-IN/notifications.mdx +18 -10
  177. package/corpus/core/docs/content/locales/hi-IN/processors.mdx +11 -5
  178. package/corpus/core/docs/content/locales/hi-IN/server.mdx +17 -10
  179. package/corpus/core/docs/content/locales/hi-IN/sharing.mdx +10 -10
  180. package/corpus/core/docs/content/locales/hi-IN/skills-guide.mdx +34 -17
  181. package/corpus/core/docs/content/locales/hi-IN/template-assets.mdx +16 -13
  182. package/corpus/core/docs/content/locales/hi-IN/template-brain.mdx +3 -1
  183. package/corpus/core/docs/content/locales/hi-IN/template-clips.mdx +4 -3
  184. package/corpus/core/docs/content/locales/hi-IN/template-design.mdx +4 -1
  185. package/corpus/core/docs/content/locales/hi-IN/template-dispatch.mdx +5 -1
  186. package/corpus/core/docs/content/locales/hi-IN/template-mail.mdx +8 -0
  187. package/corpus/core/docs/content/locales/hi-IN/tracking.mdx +9 -6
  188. package/corpus/core/docs/content/locales/hi-IN/using-your-agent.mdx +0 -7
  189. package/corpus/core/docs/content/locales/hi-IN/voice-input.mdx +6 -0
  190. package/corpus/core/docs/content/locales/hi-IN/workspace-connections.mdx +9 -2
  191. package/corpus/core/docs/content/locales/hi-IN/workspace.mdx +19 -18
  192. package/corpus/core/docs/content/locales/ja-JP/actions.mdx +2 -2
  193. package/corpus/core/docs/content/locales/ja-JP/agent-native-toolkit.mdx +2 -2
  194. package/corpus/core/docs/content/locales/ja-JP/agent-surfaces.mdx +8 -10
  195. package/corpus/core/docs/content/locales/ja-JP/agent-teams.mdx +1 -0
  196. package/corpus/core/docs/content/locales/ja-JP/authentication.mdx +1 -1
  197. package/corpus/core/docs/content/locales/ja-JP/components.mdx +11 -1
  198. package/corpus/core/docs/content/locales/ja-JP/creating-templates.mdx +3 -7
  199. package/corpus/core/docs/content/locales/ja-JP/cross-app-sso.mdx +16 -6
  200. package/corpus/core/docs/content/locales/ja-JP/deployment.mdx +8 -0
  201. package/corpus/core/docs/content/locales/ja-JP/extensions.mdx +9 -0
  202. package/corpus/core/docs/content/locales/ja-JP/external-agents.mdx +2 -7
  203. package/corpus/core/docs/content/locales/ja-JP/key-concepts.mdx +13 -20
  204. package/corpus/core/docs/content/locales/ja-JP/messaging.mdx +81 -15
  205. package/corpus/core/docs/content/locales/ja-JP/multi-tenancy.mdx +5 -5
  206. package/corpus/core/docs/content/locales/ja-JP/notifications.mdx +18 -10
  207. package/corpus/core/docs/content/locales/ja-JP/processors.mdx +11 -5
  208. package/corpus/core/docs/content/locales/ja-JP/server.mdx +17 -10
  209. package/corpus/core/docs/content/locales/ja-JP/sharing.mdx +10 -10
  210. package/corpus/core/docs/content/locales/ja-JP/skills-guide.mdx +34 -17
  211. package/corpus/core/docs/content/locales/ja-JP/template-assets.mdx +16 -13
  212. package/corpus/core/docs/content/locales/ja-JP/template-brain.mdx +3 -1
  213. package/corpus/core/docs/content/locales/ja-JP/template-clips.mdx +4 -4
  214. package/corpus/core/docs/content/locales/ja-JP/template-design.mdx +4 -1
  215. package/corpus/core/docs/content/locales/ja-JP/template-dispatch.mdx +5 -1
  216. package/corpus/core/docs/content/locales/ja-JP/template-mail.mdx +8 -0
  217. package/corpus/core/docs/content/locales/ja-JP/tracking.mdx +9 -6
  218. package/corpus/core/docs/content/locales/ja-JP/using-your-agent.mdx +0 -7
  219. package/corpus/core/docs/content/locales/ja-JP/voice-input.mdx +6 -0
  220. package/corpus/core/docs/content/locales/ja-JP/workspace-connections.mdx +9 -2
  221. package/corpus/core/docs/content/locales/ja-JP/workspace.mdx +19 -18
  222. package/corpus/core/docs/content/locales/ko-KR/actions.mdx +2 -2
  223. package/corpus/core/docs/content/locales/ko-KR/agent-native-toolkit.mdx +2 -2
  224. package/corpus/core/docs/content/locales/ko-KR/agent-surfaces.mdx +8 -10
  225. package/corpus/core/docs/content/locales/ko-KR/agent-teams.mdx +1 -0
  226. package/corpus/core/docs/content/locales/ko-KR/authentication.mdx +1 -1
  227. package/corpus/core/docs/content/locales/ko-KR/components.mdx +11 -1
  228. package/corpus/core/docs/content/locales/ko-KR/creating-templates.mdx +3 -7
  229. package/corpus/core/docs/content/locales/ko-KR/cross-app-sso.mdx +16 -6
  230. package/corpus/core/docs/content/locales/ko-KR/deployment.mdx +8 -0
  231. package/corpus/core/docs/content/locales/ko-KR/extensions.mdx +8 -0
  232. package/corpus/core/docs/content/locales/ko-KR/external-agents.mdx +2 -7
  233. package/corpus/core/docs/content/locales/ko-KR/key-concepts.mdx +13 -20
  234. package/corpus/core/docs/content/locales/ko-KR/messaging.mdx +80 -15
  235. package/corpus/core/docs/content/locales/ko-KR/multi-tenancy.mdx +5 -5
  236. package/corpus/core/docs/content/locales/ko-KR/notifications.mdx +18 -10
  237. package/corpus/core/docs/content/locales/ko-KR/processors.mdx +11 -5
  238. package/corpus/core/docs/content/locales/ko-KR/server.mdx +17 -10
  239. package/corpus/core/docs/content/locales/ko-KR/sharing.mdx +10 -10
  240. package/corpus/core/docs/content/locales/ko-KR/skills-guide.mdx +34 -17
  241. package/corpus/core/docs/content/locales/ko-KR/template-assets.mdx +16 -13
  242. package/corpus/core/docs/content/locales/ko-KR/template-brain.mdx +3 -1
  243. package/corpus/core/docs/content/locales/ko-KR/template-clips.mdx +4 -4
  244. package/corpus/core/docs/content/locales/ko-KR/template-design.mdx +4 -1
  245. package/corpus/core/docs/content/locales/ko-KR/template-dispatch.mdx +5 -1
  246. package/corpus/core/docs/content/locales/ko-KR/template-mail.mdx +8 -0
  247. package/corpus/core/docs/content/locales/ko-KR/tracking.mdx +9 -6
  248. package/corpus/core/docs/content/locales/ko-KR/using-your-agent.mdx +0 -7
  249. package/corpus/core/docs/content/locales/ko-KR/voice-input.mdx +6 -0
  250. package/corpus/core/docs/content/locales/ko-KR/workspace-connections.mdx +9 -2
  251. package/corpus/core/docs/content/locales/ko-KR/workspace.mdx +19 -18
  252. package/corpus/core/docs/content/locales/pt-BR/actions.mdx +2 -2
  253. package/corpus/core/docs/content/locales/pt-BR/agent-native-toolkit.mdx +2 -2
  254. package/corpus/core/docs/content/locales/pt-BR/agent-surfaces.mdx +8 -10
  255. package/corpus/core/docs/content/locales/pt-BR/agent-teams.mdx +1 -0
  256. package/corpus/core/docs/content/locales/pt-BR/authentication.mdx +1 -1
  257. package/corpus/core/docs/content/locales/pt-BR/components.mdx +11 -1
  258. package/corpus/core/docs/content/locales/pt-BR/creating-templates.mdx +3 -7
  259. package/corpus/core/docs/content/locales/pt-BR/cross-app-sso.mdx +16 -6
  260. package/corpus/core/docs/content/locales/pt-BR/deployment.mdx +8 -0
  261. package/corpus/core/docs/content/locales/pt-BR/extensions.mdx +9 -0
  262. package/corpus/core/docs/content/locales/pt-BR/external-agents.mdx +3 -7
  263. package/corpus/core/docs/content/locales/pt-BR/key-concepts.mdx +13 -20
  264. package/corpus/core/docs/content/locales/pt-BR/messaging.mdx +88 -15
  265. package/corpus/core/docs/content/locales/pt-BR/multi-tenancy.mdx +5 -5
  266. package/corpus/core/docs/content/locales/pt-BR/notifications.mdx +18 -10
  267. package/corpus/core/docs/content/locales/pt-BR/processors.mdx +11 -5
  268. package/corpus/core/docs/content/locales/pt-BR/server.mdx +17 -10
  269. package/corpus/core/docs/content/locales/pt-BR/sharing.mdx +10 -10
  270. package/corpus/core/docs/content/locales/pt-BR/skills-guide.mdx +34 -17
  271. package/corpus/core/docs/content/locales/pt-BR/template-assets.mdx +16 -13
  272. package/corpus/core/docs/content/locales/pt-BR/template-brain.mdx +3 -1
  273. package/corpus/core/docs/content/locales/pt-BR/template-clips.mdx +4 -3
  274. package/corpus/core/docs/content/locales/pt-BR/template-design.mdx +4 -1
  275. package/corpus/core/docs/content/locales/pt-BR/template-dispatch.mdx +5 -1
  276. package/corpus/core/docs/content/locales/pt-BR/template-mail.mdx +8 -0
  277. package/corpus/core/docs/content/locales/pt-BR/tracking.mdx +9 -6
  278. package/corpus/core/docs/content/locales/pt-BR/using-your-agent.mdx +0 -7
  279. package/corpus/core/docs/content/locales/pt-BR/voice-input.mdx +6 -0
  280. package/corpus/core/docs/content/locales/pt-BR/workspace-connections.mdx +9 -2
  281. package/corpus/core/docs/content/locales/pt-BR/workspace.mdx +19 -18
  282. package/corpus/core/docs/content/locales/zh-CN/actions.mdx +2 -2
  283. package/corpus/core/docs/content/locales/zh-CN/agent-native-toolkit.mdx +2 -2
  284. package/corpus/core/docs/content/locales/zh-CN/agent-surfaces.mdx +8 -10
  285. package/corpus/core/docs/content/locales/zh-CN/agent-teams.mdx +1 -0
  286. package/corpus/core/docs/content/locales/zh-CN/authentication.mdx +1 -1
  287. package/corpus/core/docs/content/locales/zh-CN/components.mdx +11 -1
  288. package/corpus/core/docs/content/locales/zh-CN/creating-templates.mdx +3 -7
  289. package/corpus/core/docs/content/locales/zh-CN/cross-app-sso.mdx +16 -6
  290. package/corpus/core/docs/content/locales/zh-CN/deployment.mdx +8 -0
  291. package/corpus/core/docs/content/locales/zh-CN/extensions.mdx +6 -0
  292. package/corpus/core/docs/content/locales/zh-CN/external-agents.mdx +2 -7
  293. package/corpus/core/docs/content/locales/zh-CN/key-concepts.mdx +13 -20
  294. package/corpus/core/docs/content/locales/zh-CN/messaging.mdx +78 -15
  295. package/corpus/core/docs/content/locales/zh-CN/multi-tenancy.mdx +5 -5
  296. package/corpus/core/docs/content/locales/zh-CN/notifications.mdx +18 -10
  297. package/corpus/core/docs/content/locales/zh-CN/processors.mdx +11 -5
  298. package/corpus/core/docs/content/locales/zh-CN/server.mdx +16 -10
  299. package/corpus/core/docs/content/locales/zh-CN/sharing.mdx +10 -10
  300. package/corpus/core/docs/content/locales/zh-CN/skills-guide.mdx +34 -17
  301. package/corpus/core/docs/content/locales/zh-CN/template-assets.mdx +16 -13
  302. package/corpus/core/docs/content/locales/zh-CN/template-brain.mdx +3 -1
  303. package/corpus/core/docs/content/locales/zh-CN/template-clips.mdx +4 -4
  304. package/corpus/core/docs/content/locales/zh-CN/template-design.mdx +4 -1
  305. package/corpus/core/docs/content/locales/zh-CN/template-dispatch.mdx +5 -1
  306. package/corpus/core/docs/content/locales/zh-CN/template-mail.mdx +8 -0
  307. package/corpus/core/docs/content/locales/zh-CN/tracking.mdx +9 -6
  308. package/corpus/core/docs/content/locales/zh-CN/using-your-agent.mdx +0 -7
  309. package/corpus/core/docs/content/locales/zh-CN/voice-input.mdx +6 -0
  310. package/corpus/core/docs/content/locales/zh-CN/workspace-connections.mdx +9 -2
  311. package/corpus/core/docs/content/locales/zh-CN/workspace.mdx +19 -18
  312. package/corpus/core/docs/content/locales/zh-TW/actions.mdx +2 -2
  313. package/corpus/core/docs/content/locales/zh-TW/agent-native-toolkit.mdx +2 -2
  314. package/corpus/core/docs/content/locales/zh-TW/agent-surfaces.mdx +8 -10
  315. package/corpus/core/docs/content/locales/zh-TW/agent-teams.mdx +1 -0
  316. package/corpus/core/docs/content/locales/zh-TW/authentication.mdx +1 -1
  317. package/corpus/core/docs/content/locales/zh-TW/components.mdx +11 -1
  318. package/corpus/core/docs/content/locales/zh-TW/creating-templates.mdx +3 -7
  319. package/corpus/core/docs/content/locales/zh-TW/cross-app-sso.mdx +16 -6
  320. package/corpus/core/docs/content/locales/zh-TW/deployment.mdx +8 -0
  321. package/corpus/core/docs/content/locales/zh-TW/extensions.mdx +6 -0
  322. package/corpus/core/docs/content/locales/zh-TW/external-agents.mdx +2 -7
  323. package/corpus/core/docs/content/locales/zh-TW/key-concepts.mdx +13 -20
  324. package/corpus/core/docs/content/locales/zh-TW/messaging.mdx +78 -15
  325. package/corpus/core/docs/content/locales/zh-TW/multi-tenancy.mdx +5 -5
  326. package/corpus/core/docs/content/locales/zh-TW/notifications.mdx +18 -10
  327. package/corpus/core/docs/content/locales/zh-TW/processors.mdx +11 -5
  328. package/corpus/core/docs/content/locales/zh-TW/server.mdx +16 -10
  329. package/corpus/core/docs/content/locales/zh-TW/sharing.mdx +10 -10
  330. package/corpus/core/docs/content/locales/zh-TW/skills-guide.mdx +34 -17
  331. package/corpus/core/docs/content/locales/zh-TW/template-assets.mdx +16 -13
  332. package/corpus/core/docs/content/locales/zh-TW/template-brain.mdx +3 -1
  333. package/corpus/core/docs/content/locales/zh-TW/template-clips.mdx +4 -4
  334. package/corpus/core/docs/content/locales/zh-TW/template-design.mdx +4 -1
  335. package/corpus/core/docs/content/locales/zh-TW/template-dispatch.mdx +5 -1
  336. package/corpus/core/docs/content/locales/zh-TW/template-mail.mdx +8 -0
  337. package/corpus/core/docs/content/locales/zh-TW/tracking.mdx +9 -6
  338. package/corpus/core/docs/content/locales/zh-TW/using-your-agent.mdx +0 -7
  339. package/corpus/core/docs/content/locales/zh-TW/voice-input.mdx +6 -0
  340. package/corpus/core/docs/content/locales/zh-TW/workspace-connections.mdx +9 -2
  341. package/corpus/core/docs/content/locales/zh-TW/workspace.mdx +19 -18
  342. package/corpus/core/docs/content/mcp-apps.mdx +14 -32
  343. package/corpus/core/docs/content/mcp-clients.mdx +48 -54
  344. package/corpus/core/docs/content/mcp-protocol.mdx +25 -10
  345. package/corpus/core/docs/content/messaging.mdx +238 -48
  346. package/corpus/core/docs/content/multi-app-workspace.mdx +11 -96
  347. package/corpus/core/docs/content/multi-tenancy.mdx +5 -5
  348. package/corpus/core/docs/content/native-chat-ui.mdx +4 -4
  349. package/corpus/core/docs/content/notifications.mdx +19 -12
  350. package/corpus/core/docs/content/observability.mdx +2 -4
  351. package/corpus/core/docs/content/observational-memory.mdx +7 -3
  352. package/corpus/core/docs/content/onboarding.mdx +9 -2
  353. package/corpus/core/docs/content/plan-plugin.mdx +10 -2
  354. package/corpus/core/docs/content/pr-visual-recap.mdx +1 -1
  355. package/corpus/core/docs/content/processors.mdx +11 -5
  356. package/corpus/core/docs/content/pure-agent-apps.mdx +5 -1
  357. package/corpus/core/docs/content/real-time-collaboration.mdx +30 -67
  358. package/corpus/core/docs/content/recurring-jobs.mdx +8 -6
  359. package/corpus/core/docs/content/routing.mdx +3 -4
  360. package/corpus/core/docs/content/sandbox-adapters.mdx +30 -53
  361. package/corpus/core/docs/content/security.mdx +8 -0
  362. package/corpus/core/docs/content/server.mdx +17 -10
  363. package/corpus/core/docs/content/sharing.mdx +10 -10
  364. package/corpus/core/docs/content/skills-guide.mdx +35 -16
  365. package/corpus/core/docs/content/template-analytics.mdx +11 -8
  366. package/corpus/core/docs/content/template-assets.mdx +16 -13
  367. package/corpus/core/docs/content/template-brain.mdx +3 -1
  368. package/corpus/core/docs/content/template-calendar.mdx +12 -4
  369. package/corpus/core/docs/content/template-chat.mdx +4 -4
  370. package/corpus/core/docs/content/template-clips.mdx +6 -3
  371. package/corpus/core/docs/content/template-content.mdx +23 -18
  372. package/corpus/core/docs/content/template-design.mdx +7 -1
  373. package/corpus/core/docs/content/template-dispatch.mdx +5 -1
  374. package/corpus/core/docs/content/template-mail.mdx +14 -2
  375. package/corpus/core/docs/content/template-plan.mdx +22 -15
  376. package/corpus/core/docs/content/template-slides.mdx +11 -3
  377. package/corpus/core/docs/content/toolkit-agent-ux.mdx +46 -3
  378. package/corpus/core/docs/content/toolkit-collaboration.mdx +58 -4
  379. package/corpus/core/docs/content/toolkit-command-navigation.mdx +8 -2
  380. package/corpus/core/docs/content/toolkit-comments-review.mdx +10 -2
  381. package/corpus/core/docs/content/toolkit-history.mdx +8 -3
  382. package/corpus/core/docs/content/toolkit-observability.mdx +48 -2
  383. package/corpus/core/docs/content/toolkit-org-team.mdx +8 -2
  384. package/corpus/core/docs/content/toolkit-resources.mdx +45 -2
  385. package/corpus/core/docs/content/toolkit-settings.mdx +8 -2
  386. package/corpus/core/docs/content/toolkit-setup-connections.mdx +7 -2
  387. package/corpus/core/docs/content/toolkit-sharing.mdx +46 -3
  388. package/corpus/core/docs/content/toolkit-ui.mdx +82 -11
  389. package/corpus/core/docs/content/tracking.mdx +10 -8
  390. package/corpus/core/docs/content/using-your-agent.mdx +0 -12
  391. package/corpus/core/docs/content/voice-input.mdx +7 -1
  392. package/corpus/core/docs/content/what-is-agent-native.mdx +7 -8
  393. package/corpus/core/docs/content/workspace-connections.mdx +16 -23
  394. package/corpus/core/docs/content/workspace-management.mdx +16 -4
  395. package/corpus/core/docs/content/workspace.mdx +19 -18
  396. package/corpus/core/package.json +5 -1
  397. package/corpus/core/src/a2a/artifact-response.ts +131 -2
  398. package/corpus/core/src/a2a/client.ts +10 -0
  399. package/corpus/core/src/a2a/handlers.ts +40 -76
  400. package/corpus/core/src/a2a/types.ts +2 -0
  401. package/corpus/core/src/agent/context-xray/tokenize.ts +6 -1
  402. package/corpus/core/src/agent/durable-background.ts +24 -0
  403. package/corpus/core/src/agent/engine/ai-sdk-engine.ts +9 -5
  404. package/corpus/core/src/agent/engine/anthropic-engine.ts +2 -4
  405. package/corpus/core/src/agent/engine/builder-engine.ts +5 -7
  406. package/corpus/core/src/agent/engine/index.ts +1 -0
  407. package/corpus/core/src/agent/engine/registry.ts +40 -0
  408. package/corpus/core/src/agent/harness/ai-sdk-adapter.ts +6 -1
  409. package/corpus/core/src/agent/harness/background.ts +96 -19
  410. package/corpus/core/src/agent/harness/index.ts +11 -0
  411. package/corpus/core/src/agent/harness/lifecycle.ts +498 -0
  412. package/corpus/core/src/agent/harness/runner.ts +38 -0
  413. package/corpus/core/src/agent/harness/store.ts +22 -3
  414. package/corpus/core/src/agent/model-config.ts +4 -1
  415. package/corpus/core/src/agent/production-agent.ts +205 -9
  416. package/corpus/core/src/agent/run-manager.ts +135 -11
  417. package/corpus/core/src/agent/run-store.ts +225 -15
  418. package/corpus/core/src/agent/types.ts +23 -0
  419. package/corpus/core/src/application-state/index.ts +1 -0
  420. package/corpus/core/src/application-state/store.ts +32 -0
  421. package/corpus/core/src/audit/record.ts +31 -0
  422. package/corpus/core/src/audit/store.ts +69 -3
  423. package/corpus/core/src/audit/types.ts +13 -0
  424. package/corpus/core/src/automation/index.ts +802 -0
  425. package/corpus/core/src/cli/code-agent-connector.ts +263 -8
  426. package/corpus/core/src/cli/code-agent-executor.ts +15 -1
  427. package/corpus/core/src/cli/create.ts +12 -5
  428. package/corpus/core/src/cli/design-connect.ts +596 -36
  429. package/corpus/core/src/client/AgentPanel.tsx +92 -44
  430. package/corpus/core/src/client/AssistantChat.tsx +324 -149
  431. package/corpus/core/src/client/MultiTabAssistantChat.tsx +36 -40
  432. package/corpus/core/src/client/RunStuckBanner.tsx +69 -20
  433. package/corpus/core/src/client/agent-chat-adapter.ts +54 -5
  434. package/corpus/core/src/client/appearance.ts +8 -5
  435. package/corpus/core/src/client/automation.ts +22 -0
  436. package/corpus/core/src/client/chat/connectors.ts +293 -29
  437. package/corpus/core/src/client/chat/message-components.tsx +23 -1
  438. package/corpus/core/src/client/chat/run-recovery.tsx +67 -50
  439. package/corpus/core/src/client/chat/runtime.ts +126 -25
  440. package/corpus/core/src/client/chat/tool-call-display.tsx +45 -4
  441. package/corpus/core/src/client/composer/RealtimeVoiceMode.tsx +294 -0
  442. package/corpus/core/src/client/composer/TiptapComposer.tsx +29 -20
  443. package/corpus/core/src/client/composer/VoiceButton.tsx +20 -0
  444. package/corpus/core/src/client/composer/index.ts +22 -0
  445. package/corpus/core/src/client/composer/useRealtimeVoiceMode.tsx +640 -0
  446. package/corpus/core/src/client/guided-questions.tsx +12 -3
  447. package/corpus/core/src/client/index.ts +48 -0
  448. package/corpus/core/src/client/integrations/api.ts +295 -0
  449. package/corpus/core/src/client/integrations/index.ts +26 -0
  450. package/corpus/core/src/client/settings/DemoModeSection.tsx +4 -3
  451. package/corpus/core/src/client/settings/SettingsPanel.tsx +4 -0
  452. package/corpus/core/src/client/settings/SettingsTabsPage.tsx +95 -37
  453. package/corpus/core/src/client/transcription/use-live-transcription.ts +68 -5
  454. package/corpus/core/src/client/use-chat-models.ts +17 -17
  455. package/corpus/core/src/client/use-db-sync.ts +108 -7
  456. package/corpus/core/src/client/use-run-stuck-detection.ts +41 -3
  457. package/corpus/core/src/code-agents/background-controller.ts +18 -0
  458. package/corpus/core/src/collab/ydoc-manager.ts +41 -6
  459. package/corpus/core/src/db/migrations.ts +17 -1
  460. package/corpus/core/src/demo/fetch-interceptor.ts +16 -11
  461. package/corpus/core/src/deploy/build.ts +59 -3
  462. package/corpus/core/src/deploy/workspace-deploy.ts +37 -2
  463. package/corpus/core/src/file-upload/types.ts +2 -0
  464. package/corpus/core/src/index.ts +37 -0
  465. package/corpus/core/src/integrations/a2a-continuations-store.ts +6 -4
  466. package/corpus/core/src/integrations/adapters/discord.ts +362 -0
  467. package/corpus/core/src/integrations/adapters/index.ts +29 -0
  468. package/corpus/core/src/integrations/adapters/microsoft-teams.ts +411 -0
  469. package/corpus/core/src/integrations/adapters/slack.ts +900 -27
  470. package/corpus/core/src/integrations/adapters/telegram.ts +54 -15
  471. package/corpus/core/src/integrations/adapters/whatsapp.ts +41 -17
  472. package/corpus/core/src/integrations/awaiting-input-store.ts +130 -0
  473. package/corpus/core/src/integrations/catalog.ts +571 -0
  474. package/corpus/core/src/integrations/computer-supervision-store.ts +423 -0
  475. package/corpus/core/src/integrations/computer-supervision.ts +213 -0
  476. package/corpus/core/src/integrations/controls-store.ts +187 -0
  477. package/corpus/core/src/integrations/index.ts +129 -1
  478. package/corpus/core/src/integrations/installations-store.ts +677 -0
  479. package/corpus/core/src/integrations/integration-memory.ts +187 -0
  480. package/corpus/core/src/integrations/pending-tasks-retry-job.ts +6 -6
  481. package/corpus/core/src/integrations/pending-tasks-store.ts +83 -5
  482. package/corpus/core/src/integrations/plugin.ts +916 -49
  483. package/corpus/core/src/integrations/remote-commands-store.ts +334 -3
  484. package/corpus/core/src/integrations/remote-devices-store.ts +68 -9
  485. package/corpus/core/src/integrations/remote-json-safety.ts +127 -0
  486. package/corpus/core/src/integrations/remote-run-events-store.ts +104 -19
  487. package/corpus/core/src/integrations/remote-types.ts +66 -3
  488. package/corpus/core/src/integrations/scope-store.ts +498 -0
  489. package/corpus/core/src/integrations/slack-manifest.ts +78 -0
  490. package/corpus/core/src/integrations/slack-oauth.ts +343 -0
  491. package/corpus/core/src/integrations/types.ts +179 -0
  492. package/corpus/core/src/integrations/usage-budget-store.ts +906 -0
  493. package/corpus/core/src/integrations/webhook-handler.ts +723 -53
  494. package/corpus/core/src/jobs/scheduler.ts +100 -2
  495. package/corpus/core/src/jobs/tools.ts +45 -9
  496. package/corpus/core/src/localization/default-messages.ts +28 -0
  497. package/corpus/core/src/mcp-client/config.ts +48 -2
  498. package/corpus/core/src/mcp-client/index.ts +35 -2
  499. package/corpus/core/src/mcp-client/tool-policy.ts +182 -0
  500. package/corpus/core/src/provider-api/index.ts +72 -1
  501. package/corpus/core/src/resources/handlers.ts +88 -14
  502. package/corpus/core/src/resources/script-helpers.ts +36 -7
  503. package/corpus/core/src/resources/store.ts +59 -52
  504. package/corpus/core/src/scripts/call-agent.ts +107 -1
  505. package/corpus/core/src/secrets/register-framework-secrets.ts +27 -4
  506. package/corpus/core/src/server/agent-chat-plugin.ts +356 -127
  507. package/corpus/core/src/server/auth.ts +10 -14
  508. package/corpus/core/src/server/builder-design-systems.ts +16 -1
  509. package/corpus/core/src/server/edge.ts +18 -0
  510. package/corpus/core/src/server/index.ts +42 -0
  511. package/corpus/core/src/server/realtime-voice.ts +590 -0
  512. package/corpus/core/src/server/request-context.ts +18 -0
  513. package/corpus/core/src/server/social-og-image.ts +3 -2
  514. package/corpus/core/src/shared/reasoning-effort.ts +61 -19
  515. package/corpus/core/src/styles/agent-conversation.css +17 -0
  516. package/corpus/core/src/styles/agent-native.css +62 -44
  517. package/corpus/core/src/templates/default/.agents/skills/capture-learnings/SKILL.md +22 -9
  518. package/corpus/core/src/templates/default/AGENTS.md +7 -3
  519. package/corpus/core/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +1 -1
  520. package/corpus/core/src/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +22 -9
  521. package/corpus/core/src/templates/workspace-core/.agents/skills/extension-points/SKILL.md +6 -3
  522. package/corpus/core/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +25 -0
  523. package/corpus/core/src/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +15 -0
  524. package/corpus/core/src/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +39 -5
  525. package/corpus/core/src/templates/workspace-core/AGENTS.md +3 -2
  526. package/corpus/core/src/usage/store.ts +37 -2
  527. package/corpus/templates/analytics/.agents/skills/capture-learnings/SKILL.md +22 -9
  528. package/corpus/templates/analytics/.agents/skills/provider-api/SKILL.md +23 -0
  529. package/corpus/templates/analytics/.builder/skills/provider-api/SKILL.md +15 -0
  530. package/corpus/templates/analytics/actions/save-monitor.ts +25 -2
  531. package/corpus/templates/analytics/app/lib/data-sources.ts +28 -0
  532. package/corpus/templates/analytics/changelog/2026-07-10-agent-created-uptime-monitors-now-return-a-direct-link-to-th.md +6 -0
  533. package/corpus/templates/analytics/changelog/2026-07-10-dashboard-email-reports-still-arrive-when-screenshot-capture-temporarily-fails.md +6 -0
  534. package/corpus/templates/analytics/server/jobs/dashboard-report.ts +3 -7
  535. package/corpus/templates/analytics/server/lib/credential-keys.ts +12 -0
  536. package/corpus/templates/analytics/server/lib/dashboard-report.ts +5 -1
  537. package/corpus/templates/analytics/server/lib/provider-credentials.ts +2 -0
  538. package/corpus/templates/analytics/server/routes/api/test-connection.post.ts +16 -0
  539. package/corpus/templates/assets/.agents/skills/capture-learnings/SKILL.md +22 -9
  540. package/corpus/templates/brain/.agents/skills/capture-learnings/SKILL.md +22 -9
  541. package/corpus/templates/brain/app/lib/settings-navigation.ts +22 -0
  542. package/corpus/templates/brain/app/routes/settings.tsx +367 -252
  543. package/corpus/templates/brain/changelog/2026-07-10-brain-settings-now-separate-assistant-behavior-publishing-re.md +6 -0
  544. package/corpus/templates/brain/changelog/2026-07-10-organization-settings-now-opens-directly-from-the-workspace-.md +6 -0
  545. package/corpus/templates/calendar/.agents/skills/capture-learnings/SKILL.md +22 -9
  546. package/corpus/templates/calendar/.agents/skills/event-management/SKILL.md +36 -4
  547. package/corpus/templates/calendar/AGENTS.md +4 -0
  548. package/corpus/templates/calendar/actions/create-event.ts +7 -19
  549. package/corpus/templates/calendar/actions/delete-event.ts +10 -3
  550. package/corpus/templates/calendar/actions/rsvp-event.ts +1 -1
  551. package/corpus/templates/calendar/actions/update-event.ts +4 -3
  552. package/corpus/templates/calendar/app/components/calendar/CommandPalette.tsx +98 -108
  553. package/corpus/templates/calendar/app/components/calendar/CreateEventDialog.tsx +100 -13
  554. package/corpus/templates/calendar/app/components/calendar/DayView.tsx +12 -4
  555. package/corpus/templates/calendar/app/components/calendar/EventAttendeesSection.tsx +97 -90
  556. package/corpus/templates/calendar/app/components/calendar/EventDetailPanel.tsx +3 -3
  557. package/corpus/templates/calendar/app/components/calendar/EventDetailPopover.tsx +86 -8
  558. package/corpus/templates/calendar/app/components/calendar/EventDialog.tsx +3 -1
  559. package/corpus/templates/calendar/app/components/calendar/WeekView.tsx +12 -4
  560. package/corpus/templates/calendar/app/hooks/use-events.ts +1 -0
  561. package/corpus/templates/calendar/app/lib/event-account-selection.ts +36 -0
  562. package/corpus/templates/calendar/app/lib/event-form-initialization.ts +21 -0
  563. package/corpus/templates/calendar/app/lib/event-mutation-inputs.ts +18 -0
  564. package/corpus/templates/calendar/app/pages/CalendarView.tsx +119 -26
  565. package/corpus/templates/calendar/changelog/2026-07-10-choose-which-connected-google-account-receives-a-new-event-w.md +6 -0
  566. package/corpus/templates/calendar/changelog/2026-07-10-event-guest-details-and-option-menus-now-use-valid-accessibl.md +6 -0
  567. package/corpus/templates/calendar/changelog/2026-07-10-natural-language-event-phrases-stay-available-as-quick-creat.md +6 -0
  568. package/corpus/templates/calendar/server/db/schema.ts +2 -0
  569. package/corpus/templates/calendar/server/handlers/bookings.ts +43 -6
  570. package/corpus/templates/calendar/server/handlers/events.ts +28 -9
  571. package/corpus/templates/calendar/server/lib/google-calendar.ts +66 -38
  572. package/corpus/templates/calendar/server/plugins/db.ts +5 -0
  573. package/corpus/templates/chat/.agents/skills/capture-learnings/SKILL.md +22 -9
  574. package/corpus/templates/chat/changelog/2026-07-10-chat-now-makes-ai-connection-setup-clear-without-shifting-th.md +6 -0
  575. package/corpus/templates/clips/.agents/skills/ai-video-tools/SKILL.md +12 -3
  576. package/corpus/templates/clips/.agents/skills/capture-learnings/SKILL.md +22 -9
  577. package/corpus/templates/clips/.agents/skills/meetings/SKILL.md +1 -1
  578. package/corpus/templates/clips/.agents/skills/recording/SKILL.md +17 -1
  579. package/corpus/templates/clips/.agents/skills/video-sharing/SKILL.md +8 -0
  580. package/corpus/templates/clips/AGENTS.md +12 -5
  581. package/corpus/templates/clips/actions/finalize-recording.ts +63 -23
  582. package/corpus/templates/clips/actions/get-recording-player-data.ts +6 -2
  583. package/corpus/templates/clips/actions/lib/ensure-seekable-video.ts +72 -9
  584. package/corpus/templates/clips/actions/list-recordings.ts +19 -3
  585. package/corpus/templates/clips/actions/navigate.ts +2 -0
  586. package/corpus/templates/clips/actions/regenerate-title.ts +53 -7
  587. package/corpus/templates/clips/actions/reprocess-recording.ts +20 -6
  588. package/corpus/templates/clips/actions/request-transcript.ts +168 -72
  589. package/corpus/templates/clips/actions/save-browser-transcript.ts +11 -9
  590. package/corpus/templates/clips/actions/view-screen.ts +57 -5
  591. package/corpus/templates/clips/app/components/layout/Header.tsx +1 -0
  592. package/corpus/templates/clips/app/components/library/empty-state.tsx +2 -0
  593. package/corpus/templates/clips/app/components/library/library-grid.tsx +69 -42
  594. package/corpus/templates/clips/app/components/library/library-layout.tsx +15 -1
  595. package/corpus/templates/clips/app/components/library/recording-card.tsx +81 -68
  596. package/corpus/templates/clips/app/components/library/search-bar.tsx +4 -3
  597. package/corpus/templates/clips/app/components/player/comments-panel.tsx +101 -53
  598. package/corpus/templates/clips/app/components/player/delete-recording-menu.tsx +9 -3
  599. package/corpus/templates/clips/app/components/player/playback-comment-overlay.tsx +102 -0
  600. package/corpus/templates/clips/app/components/player/share-dialog.tsx +1 -1
  601. package/corpus/templates/clips/app/components/player/video-player.tsx +10 -1
  602. package/corpus/templates/clips/app/hooks/use-auto-title.ts +14 -0
  603. package/corpus/templates/clips/app/hooks/use-library.ts +1 -1
  604. package/corpus/templates/clips/app/hooks/use-navigation-state.ts +10 -2
  605. package/corpus/templates/clips/app/i18n/ar-SA.ts +7 -1
  606. package/corpus/templates/clips/app/i18n/de-DE.ts +7 -1
  607. package/corpus/templates/clips/app/i18n/en-US.ts +7 -1
  608. package/corpus/templates/clips/app/i18n/es-ES.ts +7 -1
  609. package/corpus/templates/clips/app/i18n/fr-FR.ts +7 -1
  610. package/corpus/templates/clips/app/i18n/hi-IN.ts +7 -1
  611. package/corpus/templates/clips/app/i18n/ja-JP.ts +7 -1
  612. package/corpus/templates/clips/app/i18n/ko-KR.ts +7 -1
  613. package/corpus/templates/clips/app/i18n/pt-BR.ts +7 -1
  614. package/corpus/templates/clips/app/i18n/zh-CN.ts +8 -1
  615. package/corpus/templates/clips/app/i18n/zh-TW.ts +8 -1
  616. package/corpus/templates/clips/app/lib/recording-visibility.ts +70 -0
  617. package/corpus/templates/clips/app/routes/_app.shared.tsx +20 -0
  618. package/corpus/templates/clips/app/routes/download.tsx +24 -8
  619. package/corpus/templates/clips/app/routes/embed.$shareId.tsx +2 -0
  620. package/corpus/templates/clips/app/routes/r.$recordingId.tsx +115 -2
  621. package/corpus/templates/clips/app/routes/record.tsx +62 -0
  622. package/corpus/templates/clips/app/routes/share.$shareId.tsx +25 -16
  623. package/corpus/templates/clips/changelog/2026-07-10-clips-desktop-is-now-available-for-linux-with-appimage-debia.md +6 -0
  624. package/corpus/templates/clips/changelog/2026-07-10-clips-downloads-updates-sooner-in-the-background-and-offers-.md +6 -0
  625. package/corpus/templates/clips/changelog/2026-07-10-clips-shared-with-you-now-appear-in-a-searchable-shared-with.md +6 -0
  626. package/corpus/templates/clips/changelog/2026-07-10-clips-with-missing-mobile-video-frames-can-be-repaired-witho.md +6 -0
  627. package/corpus/templates/clips/changelog/2026-07-10-comment-replies-now-open-inline-and-focus-immediately-while-.md +6 -0
  628. package/corpus/templates/clips/changelog/2026-07-10-dismissed-upload-warnings-now-keep-recordings-in-clip-drafts.md +6 -0
  629. package/corpus/templates/clips/changelog/2026-07-10-dragging-the-meeting-recorder-no-longer-opens-the-expanded.md +6 -0
  630. package/corpus/templates/clips/changelog/2026-07-10-finishing-meeting-notes-no-longer-opens-your-browser.md +6 -0
  631. package/corpus/templates/clips/changelog/2026-07-10-meeting-recordings-now-keep-microphone-audio-and-recover-tra.md +6 -0
  632. package/corpus/templates/clips/changelog/2026-07-10-mobile-camera-recordings-pause-while-backgrounded.md +6 -0
  633. package/corpus/templates/clips/changelog/2026-07-10-mp4-downloads-now-show-progress-immediately-after-the-option.md +6 -0
  634. package/corpus/templates/clips/changelog/2026-07-10-recording-pages-now-open-as-soon-as-you-stop-with-a-share-li.md +6 -0
  635. package/corpus/templates/clips/changelog/2026-07-10-recording-pause-and-resume-controls-now-respond-reliably-on-.md +6 -0
  636. package/corpus/templates/clips/changelog/2026-07-10-recordings-now-seek-smoothly-downloads-use-the-correct-file-.md +6 -0
  637. package/corpus/templates/clips/changelog/2026-07-10-s3-compatible-storage-now-saves-hosted-recordings-without-re.md +6 -0
  638. package/corpus/templates/clips/changelog/2026-07-10-starting-and-joining-a-meeting-now-closes-the-desktop-popover.md +6 -0
  639. package/corpus/templates/clips/changelog/2026-07-10-timestamped-comments-now-appear-over-the-video-as-playback-r.md +6 -0
  640. package/corpus/templates/clips/changelog/2026-07-10-transcript-backed-titles-and-summaries-now-finish-after-recording.md +6 -0
  641. package/corpus/templates/clips/changelog/2026-07-10-zoom-meetings-now-open-directly-in-the-desktop-app.md +6 -0
  642. package/corpus/templates/clips/chrome-extension/src/overlay.ts +49 -7
  643. package/corpus/templates/clips/desktop/README.md +22 -6
  644. package/corpus/templates/clips/desktop/package.json +1 -1
  645. package/corpus/templates/clips/desktop/src/app.tsx +102 -61
  646. package/corpus/templates/clips/desktop/src/components/ReadinessPanel.tsx +15 -9
  647. package/corpus/templates/clips/desktop/src/hooks/useMeetingTranscription.ts +8 -14
  648. package/corpus/templates/clips/desktop/src/lib/finalization-guard.ts +22 -0
  649. package/corpus/templates/clips/desktop/src/lib/meeting-join-url.ts +33 -0
  650. package/corpus/templates/clips/desktop/src/lib/pause-transition.ts +79 -0
  651. package/corpus/templates/clips/desktop/src/lib/permissions.ts +3 -1
  652. package/corpus/templates/clips/desktop/src/lib/pill-interaction.ts +19 -0
  653. package/corpus/templates/clips/desktop/src/lib/recorder.ts +187 -159
  654. package/corpus/templates/clips/desktop/src/lib/transcription-engine.ts +3 -2
  655. package/corpus/templates/clips/desktop/src/lib/updater.ts +26 -4
  656. package/corpus/templates/clips/desktop/src/overlays/finalizing.tsx +4 -8
  657. package/corpus/templates/clips/desktop/src/overlays/meeting-notification.tsx +3 -2
  658. package/corpus/templates/clips/desktop/src/overlays/recording-pill.tsx +32 -6
  659. package/corpus/templates/clips/desktop/src/overlays/toolbar.tsx +50 -5
  660. package/corpus/templates/clips/desktop/src/styles.css +11 -19
  661. package/corpus/templates/clips/desktop/src-tauri/Cargo.toml +1 -1
  662. package/corpus/templates/clips/desktop/src-tauri/src/clips/mod.rs +2 -2
  663. package/corpus/templates/clips/desktop/src-tauri/src/lib.rs +2 -1
  664. package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +121 -4
  665. package/corpus/templates/clips/desktop/src-tauri/src/native_speech.rs +97 -17
  666. package/corpus/templates/clips/desktop/src-tauri/src/permission_status.rs +11 -7
  667. package/corpus/templates/clips/desktop/src-tauri/src/whisper_speech.rs +80 -5
  668. package/corpus/templates/clips/desktop/src-tauri/tauri.conf.json +1 -1
  669. package/corpus/templates/clips/desktop/src-tauri/tauri.linux.conf.json +11 -0
  670. package/corpus/templates/clips/netlify.toml +3 -0
  671. package/corpus/templates/clips/server/lib/post-finalize-dispatch.ts +106 -0
  672. package/corpus/templates/clips/server/lib/public-agent-context.ts +9 -1
  673. package/corpus/templates/clips/server/lib/resumable-upload-provider.ts +52 -0
  674. package/corpus/templates/clips/server/lib/s3-upload-provider.ts +433 -85
  675. package/corpus/templates/clips/server/lib/video-remux.ts +114 -0
  676. package/corpus/templates/clips/server/routes/api/_agent-native-background/post-finalize-worker.post.ts +109 -0
  677. package/corpus/templates/clips/server/routes/api/clips-updater.json.get.ts +22 -11
  678. package/corpus/templates/clips/server/routes/api/public-recording.get.ts +4 -2
  679. package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/abort.post.ts +47 -5
  680. package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/chunk.post.ts +10 -2
  681. package/corpus/templates/clips/shared/share-loader-response.ts +12 -0
  682. package/corpus/templates/clips/shared/transcript-status.ts +40 -0
  683. package/corpus/templates/clips/vitest.config.ts +23 -0
  684. package/corpus/templates/content/.agents/skills/capture-learnings/SKILL.md +22 -9
  685. package/corpus/templates/content/.agents/skills/content/SKILL.md +57 -5
  686. package/corpus/templates/content/AGENTS.md +65 -55
  687. package/corpus/templates/content/actions/_builder-cms-read-client.ts +10 -16
  688. package/corpus/templates/content/actions/_database-source-utils.ts +58 -11
  689. package/corpus/templates/content/actions/_property-utils.ts +30 -2
  690. package/corpus/templates/content/actions/add-content-database-source-field-property.ts +312 -114
  691. package/corpus/templates/content/actions/submit-content-database-form.ts +497 -0
  692. package/corpus/templates/content/actions/update-content-database-view.ts +8 -1
  693. package/corpus/templates/content/actions/view-screen.ts +4 -1
  694. package/corpus/templates/content/agent-native.app-skill.json +1 -1
  695. package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +28 -9
  696. package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +250 -64
  697. package/corpus/templates/content/app/components/editor/database/FormView.tsx +460 -0
  698. package/corpus/templates/content/app/components/editor/database/navigation-state.ts +3 -0
  699. package/corpus/templates/content/app/components/editor/database/settings.tsx +30 -37
  700. package/corpus/templates/content/app/components/editor/database/shared.tsx +2 -0
  701. package/corpus/templates/content/app/components/editor/database/view-config.ts +29 -1
  702. package/corpus/templates/content/app/components/ui/textarea.tsx +1 -0
  703. package/corpus/templates/content/app/hooks/use-content-database.ts +22 -0
  704. package/corpus/templates/content/app/i18n/zh-TW.ts +21 -0
  705. package/corpus/templates/content/app/i18n-data.ts +225 -0
  706. package/corpus/templates/content/changelog/2026-07-10-builder-backed-properties-now-load-current-source-values-as-.md +6 -0
  707. package/corpus/templates/content/changelog/2026-07-10-builder-database-refreshes-now-stay-explicit-and-accurate.md +6 -0
  708. package/corpus/templates/content/changelog/2026-07-10-database-form-views-now-collect-ordered-required-answers-and.md +6 -0
  709. package/corpus/templates/content/changelog/2026-07-10-database-tables-now-use-a-quieter-more-compact-layout-with-c.md +6 -0
  710. package/corpus/templates/content/changelog/2026-07-10-open-documents-no-longer-make-constant-background-requests-w.md +6 -0
  711. package/corpus/templates/content/changelog/2026-07-10-slack-intake-routes-to-content-database-forms.md +6 -0
  712. package/corpus/templates/content/parity/matrix.md +1 -0
  713. package/corpus/templates/content/parity/matrix.ts +18 -0
  714. package/corpus/templates/content/shared/api.ts +27 -1
  715. package/corpus/templates/content/shared/database-form.ts +53 -0
  716. package/corpus/templates/design/.agents/skills/capture-learnings/SKILL.md +22 -9
  717. package/corpus/templates/design/.agents/skills/design-generation/SKILL.md +26 -0
  718. package/corpus/templates/design/.agents/skills/design-systems/SKILL.md +106 -16
  719. package/corpus/templates/design/AGENTS.md +79 -18
  720. package/corpus/templates/design/DESIGN.md +1 -1
  721. package/corpus/templates/design/DEVELOPING.md +1 -1
  722. package/corpus/templates/design/FIGMA_INTEROPERABILITY.md +116 -0
  723. package/corpus/templates/design/actions/create-design-from-template.ts +220 -0
  724. package/corpus/templates/design/actions/create-design-system.ts +92 -16
  725. package/corpus/templates/design/actions/delete-design-template.ts +28 -0
  726. package/corpus/templates/design/actions/delete-file.ts +7 -0
  727. package/corpus/templates/design/actions/edit-design.ts +3 -0
  728. package/corpus/templates/design/actions/export-design-as-figma-svg.ts +137 -5
  729. package/corpus/templates/design/actions/export-pdf.ts +1 -1
  730. package/corpus/templates/design/actions/generate-design.ts +3 -0
  731. package/corpus/templates/design/actions/get-design-snapshot.ts +9 -0
  732. package/corpus/templates/design/actions/get-figma-connection-status.ts +26 -0
  733. package/corpus/templates/design/actions/get-figma-design-context.ts +138 -0
  734. package/corpus/templates/design/actions/get-figma-styles.ts +2 -2
  735. package/corpus/templates/design/actions/import-figma-clipboard.ts +112 -16
  736. package/corpus/templates/design/actions/import-figma-frame.ts +15 -4
  737. package/corpus/templates/design/actions/index-design-system-with-builder.ts +4 -0
  738. package/corpus/templates/design/actions/list-design-templates.ts +118 -0
  739. package/corpus/templates/design/actions/navigate.ts +16 -2
  740. package/corpus/templates/design/actions/provider-api-request.ts +11 -1
  741. package/corpus/templates/design/actions/save-design-as-template.ts +156 -0
  742. package/corpus/templates/design/actions/set-active-breakpoint.ts +13 -4
  743. package/corpus/templates/design/actions/take-design-screenshot.ts +73 -3
  744. package/corpus/templates/design/actions/update-file.ts +39 -22
  745. package/corpus/templates/design/actions/view-screen.ts +36 -1
  746. package/corpus/templates/design/actions/write-local-file.ts +50 -38
  747. package/corpus/templates/design/app/components/design/AutoLayoutSuggestionDialog.tsx +151 -0
  748. package/corpus/templates/design/app/components/design/CanvasContextMenu.tsx +20 -0
  749. package/corpus/templates/design/app/components/design/DesignCanvas.tsx +383 -29
  750. package/corpus/templates/design/app/components/design/DesignEditorSkeleton.tsx +3 -3
  751. package/corpus/templates/design/app/components/design/DesignImportPanel.tsx +384 -9
  752. package/corpus/templates/design/app/components/design/EditPanel.tsx +105 -32
  753. package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +131 -46
  754. package/corpus/templates/design/app/components/design/TweaksPanel.tsx +6 -0
  755. package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +545 -54
  756. package/corpus/templates/design/app/components/design/bridge/embedded-wheel.bridge.ts +40 -0
  757. package/corpus/templates/design/app/components/design/code-workbench/CodeWorkbench.tsx +1 -0
  758. package/corpus/templates/design/app/components/design/code-workbench/explorer/ExplorerView.tsx +1 -0
  759. package/corpus/templates/design/app/components/design/code-workbench/explorer/FileTree.tsx +5 -1
  760. package/corpus/templates/design/app/components/design/code-workbench/workspace/create-providers.ts +2 -0
  761. package/corpus/templates/design/app/components/design/code-workbench/workspace/localhost-provider.ts +3 -1
  762. package/corpus/templates/design/app/components/design/code-workbench/workspace/types.ts +2 -0
  763. package/corpus/templates/design/app/components/design/edit-panel/element-identity.ts +19 -0
  764. package/corpus/templates/design/app/components/design/edit-panel/frame-presets-panel.tsx +1 -0
  765. package/corpus/templates/design/app/components/design/edit-panel/interaction-state-helpers.ts +27 -0
  766. package/corpus/templates/design/app/components/design/inspector/InteractionStatePanel.tsx +137 -81
  767. package/corpus/templates/design/app/components/design/inspector/frame-size-presets.ts +25 -5
  768. package/corpus/templates/design/app/components/design/multi-screen/chrome-transitions.ts +1 -1
  769. package/corpus/templates/design/app/components/design/multi-screen/frame-geometry.ts +350 -3
  770. package/corpus/templates/design/app/components/design/multi-screen/overview-layout.ts +13 -0
  771. package/corpus/templates/design/app/components/design/multi-screen/types.ts +22 -1
  772. package/corpus/templates/design/app/components/design/types.ts +4 -0
  773. package/corpus/templates/design/app/components/design-system/ProductionDesignSystemShowcase.tsx +208 -0
  774. package/corpus/templates/design/app/components/editor/FigmaLinkComposerBubble.tsx +321 -0
  775. package/corpus/templates/design/app/components/editor/PromptDialog.tsx +24 -4
  776. package/corpus/templates/design/app/components/layout/Layout.tsx +16 -2
  777. package/corpus/templates/design/app/components/layout/Sidebar.tsx +2 -0
  778. package/corpus/templates/design/app/components/templates/TemplatePreview.tsx +72 -0
  779. package/corpus/templates/design/app/global.css +2 -35
  780. package/corpus/templates/design/app/hooks/use-navigation-state.ts +10 -0
  781. package/corpus/templates/design/app/i18n/zh-TW.ts +127 -5
  782. package/corpus/templates/design/app/i18n-breakpoints.ts +209 -0
  783. package/corpus/templates/design/app/i18n-data.ts +1317 -59
  784. package/corpus/templates/design/app/i18n-template-feature.ts +458 -0
  785. package/corpus/templates/design/app/lib/clipboard-content-lineage.ts +64 -0
  786. package/corpus/templates/design/app/lib/design-clipboard-managed-styles.ts +247 -0
  787. package/corpus/templates/design/app/lib/design-clipboard.ts +259 -0
  788. package/corpus/templates/design/app/lib/design-file-upload.ts +87 -0
  789. package/corpus/templates/design/app/lib/design-import.ts +198 -13
  790. package/corpus/templates/design/app/lib/desktop-design-preview.ts +423 -0
  791. package/corpus/templates/design/app/lib/figma-clipboard.ts +74 -8
  792. package/corpus/templates/design/app/lib/figma-connection.ts +161 -0
  793. package/corpus/templates/design/app/lib/figma-svg-copy.ts +814 -22
  794. package/corpus/templates/design/app/lib/figma-url.ts +77 -0
  795. package/corpus/templates/design/app/lib/pending-generation.ts +35 -0
  796. package/corpus/templates/design/app/pages/DesignSystems.tsx +236 -177
  797. package/corpus/templates/design/app/pages/Index.tsx +38 -0
  798. package/corpus/templates/design/app/pages/Templates.tsx +498 -0
  799. package/corpus/templates/design/app/pages/design-editor/auto-layout-suggestion.ts +328 -0
  800. package/corpus/templates/design/app/pages/design-editor/clone-idrefs.ts +113 -0
  801. package/corpus/templates/design/app/pages/design-editor/created-screen-navigation.ts +55 -0
  802. package/corpus/templates/design/app/pages/design-editor/editor-session.ts +32 -0
  803. package/corpus/templates/design/app/pages/design-editor/editor-state.ts +49 -2
  804. package/corpus/templates/design/app/pages/design-editor/export-capture.ts +296 -0
  805. package/corpus/templates/design/app/pages/design-editor/history.ts +101 -2
  806. package/corpus/templates/design/app/pages/design-editor/latest-write-queue.ts +56 -0
  807. package/corpus/templates/design/app/pages/design-editor/layout-operations.ts +28 -1
  808. package/corpus/templates/design/app/pages/design-editor/overview-camera.ts +34 -0
  809. package/corpus/templates/design/app/pages/design-editor/pending-edits.ts +202 -6
  810. package/corpus/templates/design/app/pages/design-editor/pending-structure-verification.ts +92 -0
  811. package/corpus/templates/design/app/pages/design-editor/performance-buffer-guard.ts +80 -0
  812. package/corpus/templates/design/app/pages/design-editor/save-failure.ts +58 -0
  813. package/corpus/templates/design/app/routes/templates.tsx +4 -6
  814. package/corpus/templates/design/changelog/2026-07-10-app-workspaces-now-use-clean-borderless-main-surfaces-throug.md +6 -0
  815. package/corpus/templates/design/changelog/2026-07-10-ask-chat-what-s-in-a-figma-file-or-frame-structure-screensho.md +6 -0
  816. package/corpus/templates/design/changelog/2026-07-10-canvas-edits-now-reject-malformed-html-before-it-can-corrupt.md +6 -0
  817. package/corpus/templates/design/changelog/2026-07-10-complex-designs-now-export-as-valid-secure-svgs-and-crisp-ra.md +6 -0
  818. package/corpus/templates/design/changelog/2026-07-10-complex-figma-masks-arcs-rich-text-transformed-images-and-ad.md +6 -0
  819. package/corpus/templates/design/changelog/2026-07-10-concurrent-agent-and-artboard-edits-no-longer-show-misleadin.md +6 -0
  820. package/corpus/templates/design/changelog/2026-07-10-copied-layers-paste-across-designs-and-browser-tabs.md +6 -0
  821. package/corpus/templates/design/changelog/2026-07-10-copy-and-download-editable-figma-svg.md +6 -0
  822. package/corpus/templates/design/changelog/2026-07-10-copying-design-text-now-pastes-readable-text-into-other-apps.md +6 -0
  823. package/corpus/templates/design/changelog/2026-07-10-deleted-screens-can-be-restored-with-undo-and-removed-again-.md +6 -0
  824. package/corpus/templates/design/changelog/2026-07-10-design-changes-now-save-before-switching-apps-and-retry-when.md +6 -0
  825. package/corpus/templates/design/changelog/2026-07-10-design-stays-usable-on-phones-by-keeping-editor-panels-and-f.md +6 -0
  826. package/corpus/templates/design/changelog/2026-07-10-designs-with-html-examples-inside-alpine-attributes-or-comme.md +6 -0
  827. package/corpus/templates/design/changelog/2026-07-10-download-all-screens-as-one-multi-page-pdf-from-the-overview.md +6 -0
  828. package/corpus/templates/design/changelog/2026-07-10-duplicated-layers-now-keep-labels-aria-relationships-fragmen.md +6 -0
  829. package/corpus/templates/design/changelog/2026-07-10-fig-import-results-stay-compact.md +6 -0
  830. package/corpus/templates/design/changelog/2026-07-10-figma-imports-now-load-real-fonts-fix-rotated-gradient-dashe.md +6 -0
  831. package/corpus/templates/design/changelog/2026-07-10-figma-links-in-chat-and-the-import-tab-now-offer-secure-one-.md +6 -0
  832. package/corpus/templates/design/changelog/2026-07-10-fixed-cmd-z-not-restoring-content-after-an-agent-driven-desi.md +6 -0
  833. package/corpus/templates/design/changelog/2026-07-10-fixed-download-pdf-being-unreachable-from-the-export-panel-e.md +6 -0
  834. package/corpus/templates/design/changelog/2026-07-10-fixed-dragging-a-layer-out-of-an-auto-layout-row-column-no-l.md +6 -0
  835. package/corpus/templates/design/changelog/2026-07-10-fixed-figma-svg-export-text-wrapping-sizing-and-inner-layer.md +6 -0
  836. package/corpus/templates/design/changelog/2026-07-10-fixed-hiding-or-locking-one-layer-no-longer-hides-or-blocks-.md +6 -0
  837. package/corpus/templates/design/changelog/2026-07-10-fixed-png-screenshots-of-tall-screens-being-cropped-to-one-v.md +6 -0
  838. package/corpus/templates/design/changelog/2026-07-10-fixed-png-svg-exports-capturing-broken-layout-when-webfonts-.md +6 -0
  839. package/corpus/templates/design/changelog/2026-07-10-frame-tool-now-offers-standard-ad-unit-size-presets-medium-r.md +6 -0
  840. package/corpus/templates/design/changelog/2026-07-10-full-view-controls-stay-within-their-frame-instead-of-coveri.md +6 -0
  841. package/corpus/templates/design/changelog/2026-07-10-hover-focus-focus-visible-pressed-and-disabled-states-now-pr.md +6 -0
  842. package/corpus/templates/design/changelog/2026-07-10-interactive-designs-no-longer-appear-blank-in-the-canvas-whe.md +6 -0
  843. package/corpus/templates/design/changelog/2026-07-10-layer-drops-now-land-in-the-intended-grid-row-stay-visually-.md +6 -0
  844. package/corpus/templates/design/changelog/2026-07-10-local-code-workspaces-now-keep-unsaved-edits-across-panel-sw.md +6 -0
  845. package/corpus/templates/design/changelog/2026-07-10-local-visual-editing-now-keeps-authenticated-sessions-shared.md +6 -0
  846. package/corpus/templates/design/changelog/2026-07-10-long-overview-editing-sessions-lots-of-pan-zoom-screen-switc.md +6 -0
  847. package/corpus/templates/design/changelog/2026-07-10-long-running-agent-work-no-longer-shows-a-premature-stuck-wa.md +6 -0
  848. package/corpus/templates/design/changelog/2026-07-10-managed-figma-connections-are-recognized-automatically.md +6 -0
  849. package/corpus/templates/design/changelog/2026-07-10-new-designs-can-open-directly-in-the-editor-without-a-pr.md +6 -0
  850. package/corpus/templates/design/changelog/2026-07-10-new-screens-are-selected-and-revealed-immediately.md +6 -0
  851. package/corpus/templates/design/changelog/2026-07-10-new-text-layers-undo-as-one-safe-creation.md +6 -0
  852. package/corpus/templates/design/changelog/2026-07-10-preview-and-apply-inferred-auto-layout-without-changing-yo.md +5 -0
  853. package/corpus/templates/design/changelog/2026-07-10-print-pdf-exports-and-paper-size-presets-letter-a4-now-match.md +6 -0
  854. package/corpus/templates/design/changelog/2026-07-10-rapid-breakpoint-and-edit-scope-changes-no-longer-jump-back-.md +6 -0
  855. package/corpus/templates/design/changelog/2026-07-10-responsive-breakpoint-previews-stay-visible-while-panning-ac.md +6 -0
  856. package/corpus/templates/design/changelog/2026-07-10-responsive-frame-editing.md +6 -0
  857. package/corpus/templates/design/changelog/2026-07-10-reusable-design-templates.md +6 -0
  858. package/corpus/templates/design/changelog/2026-07-10-rich-design-clipboard-markers-are-now-accepted-only-from-the.md +6 -0
  859. package/corpus/templates/design/changelog/2026-07-10-screen-overview-frames-now-use-a-clearer-interact-action-wit.md +6 -0
  860. package/corpus/templates/design/changelog/2026-07-10-start-designs-from-source-linked-material-3-carbon-or-primer.md +6 -0
  861. package/corpus/templates/design/changelog/2026-07-10-tweaks-guidance.md +6 -0
  862. package/corpus/templates/design/changelog/2026-07-10-uploaded-fig-files-can-now-become-editable-design-screens-wi.md +6 -0
  863. package/corpus/templates/design/e2e/helpers.ts +18 -7
  864. package/corpus/templates/design/package.json +2 -0
  865. package/corpus/templates/design/scripts/qa-figma-stress-import.ts +96 -0
  866. package/corpus/templates/design/server/db/index.ts +10 -0
  867. package/corpus/templates/design/server/db/schema.ts +44 -0
  868. package/corpus/templates/design/server/handlers/import-design-file.ts +114 -80
  869. package/corpus/templates/design/server/handlers/index-design-system-with-builder.ts +19 -6
  870. package/corpus/templates/design/server/lib/design-export.ts +240 -3
  871. package/corpus/templates/design/server/lib/design-template-data.ts +89 -0
  872. package/corpus/templates/design/server/lib/design-to-figma-svg.ts +250 -26
  873. package/corpus/templates/design/server/lib/fig-file-decoder.ts +839 -0
  874. package/corpus/templates/design/server/lib/fig-file-import.ts +287 -0
  875. package/corpus/templates/design/server/lib/fig-file-limits.ts +3 -0
  876. package/corpus/templates/design/server/lib/fig-file-to-html.ts +2568 -0
  877. package/corpus/templates/design/server/lib/figma-design-context.ts +359 -0
  878. package/corpus/templates/design/server/lib/figma-node-import.ts +478 -22
  879. package/corpus/templates/design/server/lib/figma-node-to-html.ts +554 -29
  880. package/corpus/templates/design/server/lib/local-figma-qa-upload.ts +112 -0
  881. package/corpus/templates/design/server/lib/verify-write-grant.ts +16 -2
  882. package/corpus/templates/design/server/lib/visible-clipboard-html.ts +13 -3
  883. package/corpus/templates/design/server/plugins/agent-chat.ts +7 -0
  884. package/corpus/templates/design/server/plugins/db.ts +42 -0
  885. package/corpus/templates/design/server/plugins/local-figma-qa-upload.ts +7 -0
  886. package/corpus/templates/design/server/register-secrets.ts +8 -8
  887. package/corpus/templates/design/server/routes/api/qa-figma-import-assets/[assetId].get.ts +46 -0
  888. package/corpus/templates/design/server/source-workspace.ts +131 -13
  889. package/corpus/templates/design/shared/code-layer.ts +105 -28
  890. package/corpus/templates/design/shared/design-system-templates.ts +301 -0
  891. package/corpus/templates/design/shared/design-template-presets.ts +195 -0
  892. package/corpus/templates/design/shared/figma-url.ts +8 -0
  893. package/corpus/templates/design/shared/html-integrity.ts +401 -0
  894. package/corpus/templates/design/shared/interaction-states.ts +318 -23
  895. package/corpus/templates/design/shared/locked-layers.ts +151 -0
  896. package/corpus/templates/dispatch/.agents/skills/capture-learnings/SKILL.md +22 -9
  897. package/corpus/templates/dispatch/AGENTS.md +10 -2
  898. package/corpus/templates/dispatch/actions/view-screen.ts +11 -0
  899. package/corpus/templates/dispatch/app/hooks/use-navigation-state.ts +13 -0
  900. package/corpus/templates/dispatch/app/i18n/zh-TW.ts +51 -0
  901. package/corpus/templates/dispatch/app/i18n-data.ts +572 -1
  902. package/corpus/templates/dispatch/app/routes/operations.tsx +1 -0
  903. package/corpus/templates/dispatch/changelog/2026-07-10-connect-slack-workspaces-with-oauth-and-manage-channel-ident.md +6 -0
  904. package/corpus/templates/dispatch/changelog/2026-07-10-dispatch-now-has-a-cleaner-chat-history-and-quieter-sidebar-.md +6 -0
  905. package/corpus/templates/dispatch/changelog/2026-07-10-microsoft-teams-bots-and-discord-slash-commands-can-now-conn.md +6 -0
  906. package/corpus/templates/dispatch/changelog/2026-07-10-operations-console-brings-agent-monitoring-and-database-inspection-tog.md +6 -0
  907. package/corpus/templates/dispatch/changelog/2026-07-10-slack-and-telegram-now-route-uptime-monitor-requests-to-anal.md +6 -0
  908. package/corpus/templates/forms/.agents/skills/capture-learnings/SKILL.md +22 -9
  909. package/corpus/templates/forms/.agents/skills/form-publishing/SKILL.md +7 -0
  910. package/corpus/templates/forms/AGENTS.md +4 -0
  911. package/corpus/templates/forms/actions/create-form.ts +44 -7
  912. package/corpus/templates/forms/actions/lib/assert-publishable-form.ts +38 -0
  913. package/corpus/templates/forms/actions/patch-form-fields.ts +4 -0
  914. package/corpus/templates/forms/actions/update-form.ts +2 -36
  915. package/corpus/templates/forms/app/i18n/ar-SA.ts +3 -0
  916. package/corpus/templates/forms/app/i18n/de-DE.ts +3 -0
  917. package/corpus/templates/forms/app/i18n/en-US.ts +3 -0
  918. package/corpus/templates/forms/app/i18n/es-ES.ts +3 -0
  919. package/corpus/templates/forms/app/i18n/fr-FR.ts +3 -0
  920. package/corpus/templates/forms/app/i18n/hi-IN.ts +3 -0
  921. package/corpus/templates/forms/app/i18n/ja-JP.ts +3 -0
  922. package/corpus/templates/forms/app/i18n/ko-KR.ts +3 -0
  923. package/corpus/templates/forms/app/i18n/pt-BR.ts +3 -0
  924. package/corpus/templates/forms/app/i18n/zh-CN.ts +2 -0
  925. package/corpus/templates/forms/app/i18n/zh-TW.ts +3 -0
  926. package/corpus/templates/forms/app/pages/FormBuilderPage.tsx +17 -0
  927. package/corpus/templates/forms/changelog/2026-07-10-agent-created-published-forms-now-return-the-anonymous-publi.md +6 -0
  928. package/corpus/templates/forms/changelog/2026-07-10-published-forms-can-no-longer-be-edited-into-an-unusable-emp.md +6 -0
  929. package/corpus/templates/forms/server/handlers/submissions.ts +4 -3
  930. package/corpus/templates/forms/server/plugins/agent-chat.ts +1 -0
  931. package/corpus/templates/forms/shared/types.ts +5 -0
  932. package/corpus/templates/mail/.agents/skills/capture-learnings/SKILL.md +22 -9
  933. package/corpus/templates/mail/actions/get-integration-statuses.ts +36 -0
  934. package/corpus/templates/mail/app/components/email/EmailThread.tsx +3 -2
  935. package/corpus/templates/mail/app/components/email/IntegrationsSidebar.tsx +3 -3
  936. package/corpus/templates/mail/app/components/layout/AppLayout.tsx +2 -2
  937. package/corpus/templates/mail/app/hooks/use-apollo.ts +5 -71
  938. package/corpus/templates/mail/app/hooks/use-draft-queue.ts +1 -1
  939. package/corpus/templates/mail/app/hooks/use-integrations.ts +51 -48
  940. package/corpus/templates/mail/app/lib/integration-status.ts +31 -0
  941. package/corpus/templates/mail/app/lib/sync-invalidation.ts +5 -0
  942. package/corpus/templates/mail/app/pages/SettingsPage.tsx +3 -0
  943. package/corpus/templates/mail/app/root.tsx +22 -12
  944. package/corpus/templates/mail/changelog/2026-07-10-email-content-backgrounds-now-blend-cleanly-with-dark-mode.md +6 -0
  945. package/corpus/templates/mail/changelog/2026-07-10-mail-navigation-now-uses-a-clean-borderless-drawer.md +6 -0
  946. package/corpus/templates/mail/changelog/2026-07-10-mail-settings-now-group-drafting-automation-and-connected-se.md +6 -0
  947. package/corpus/templates/mail/changelog/2026-07-10-organization-settings-now-opens-directly-from-the-workspace-.md +6 -0
  948. package/corpus/templates/plan/.agents/skills/capture-learnings/SKILL.md +22 -9
  949. package/corpus/templates/plan/app/lib/plan-local-bridge.ts +4 -1
  950. package/corpus/templates/plan/changelog/2026-07-10-local-plans-now-keep-valid-content-visible-when-one-generate.md +6 -0
  951. package/corpus/templates/plan/server/lib/local-plan-files.ts +4 -1
  952. package/corpus/templates/slides/.agents/skills/capture-learnings/SKILL.md +22 -9
  953. package/dist/a2a/artifact-response.d.ts.map +1 -1
  954. package/dist/a2a/artifact-response.js +88 -2
  955. package/dist/a2a/artifact-response.js.map +1 -1
  956. package/dist/a2a/client.d.ts +9 -0
  957. package/dist/a2a/client.d.ts.map +1 -1
  958. package/dist/a2a/client.js +1 -0
  959. package/dist/a2a/client.js.map +1 -1
  960. package/dist/a2a/handlers.d.ts.map +1 -1
  961. package/dist/a2a/handlers.js +24 -69
  962. package/dist/a2a/handlers.js.map +1 -1
  963. package/dist/a2a/types.d.ts +2 -0
  964. package/dist/a2a/types.d.ts.map +1 -1
  965. package/dist/a2a/types.js.map +1 -1
  966. package/dist/agent/context-xray/tokenize.d.ts.map +1 -1
  967. package/dist/agent/context-xray/tokenize.js +6 -1
  968. package/dist/agent/context-xray/tokenize.js.map +1 -1
  969. package/dist/agent/durable-background.d.ts +11 -0
  970. package/dist/agent/durable-background.d.ts.map +1 -1
  971. package/dist/agent/durable-background.js +17 -0
  972. package/dist/agent/durable-background.js.map +1 -1
  973. package/dist/agent/engine/ai-sdk-engine.d.ts.map +1 -1
  974. package/dist/agent/engine/ai-sdk-engine.js +8 -3
  975. package/dist/agent/engine/ai-sdk-engine.js.map +1 -1
  976. package/dist/agent/engine/anthropic-engine.d.ts.map +1 -1
  977. package/dist/agent/engine/anthropic-engine.js +2 -4
  978. package/dist/agent/engine/anthropic-engine.js.map +1 -1
  979. package/dist/agent/engine/builder-engine.d.ts +1 -1
  980. package/dist/agent/engine/builder-engine.d.ts.map +1 -1
  981. package/dist/agent/engine/builder-engine.js +2 -3
  982. package/dist/agent/engine/builder-engine.js.map +1 -1
  983. package/dist/agent/engine/index.d.ts +1 -1
  984. package/dist/agent/engine/index.d.ts.map +1 -1
  985. package/dist/agent/engine/index.js +1 -1
  986. package/dist/agent/engine/index.js.map +1 -1
  987. package/dist/agent/engine/registry.d.ts +13 -0
  988. package/dist/agent/engine/registry.d.ts.map +1 -1
  989. package/dist/agent/engine/registry.js +33 -0
  990. package/dist/agent/engine/registry.js.map +1 -1
  991. package/dist/agent/harness/ai-sdk-adapter.d.ts.map +1 -1
  992. package/dist/agent/harness/ai-sdk-adapter.js +3 -1
  993. package/dist/agent/harness/ai-sdk-adapter.js.map +1 -1
  994. package/dist/agent/harness/background.d.ts +9 -9
  995. package/dist/agent/harness/background.d.ts.map +1 -1
  996. package/dist/agent/harness/background.js +77 -19
  997. package/dist/agent/harness/background.js.map +1 -1
  998. package/dist/agent/harness/index.d.ts +1 -0
  999. package/dist/agent/harness/index.d.ts.map +1 -1
  1000. package/dist/agent/harness/index.js +1 -0
  1001. package/dist/agent/harness/index.js.map +1 -1
  1002. package/dist/agent/harness/lifecycle.d.ts +45 -0
  1003. package/dist/agent/harness/lifecycle.d.ts.map +1 -0
  1004. package/dist/agent/harness/lifecycle.js +318 -0
  1005. package/dist/agent/harness/lifecycle.js.map +1 -0
  1006. package/dist/agent/harness/runner.d.ts.map +1 -1
  1007. package/dist/agent/harness/runner.js +29 -1
  1008. package/dist/agent/harness/runner.js.map +1 -1
  1009. package/dist/agent/harness/store.d.ts +2 -0
  1010. package/dist/agent/harness/store.d.ts.map +1 -1
  1011. package/dist/agent/harness/store.js +17 -3
  1012. package/dist/agent/harness/store.js.map +1 -1
  1013. package/dist/agent/model-config.d.ts +2 -2
  1014. package/dist/agent/model-config.d.ts.map +1 -1
  1015. package/dist/agent/model-config.js +4 -1
  1016. package/dist/agent/model-config.js.map +1 -1
  1017. package/dist/agent/production-agent.d.ts +40 -2
  1018. package/dist/agent/production-agent.d.ts.map +1 -1
  1019. package/dist/agent/production-agent.js +150 -9
  1020. package/dist/agent/production-agent.js.map +1 -1
  1021. package/dist/agent/run-manager.d.ts +44 -2
  1022. package/dist/agent/run-manager.d.ts.map +1 -1
  1023. package/dist/agent/run-manager.js +90 -9
  1024. package/dist/agent/run-manager.js.map +1 -1
  1025. package/dist/agent/run-store.d.ts +109 -0
  1026. package/dist/agent/run-store.d.ts.map +1 -1
  1027. package/dist/agent/run-store.js +206 -15
  1028. package/dist/agent/run-store.js.map +1 -1
  1029. package/dist/agent/types.d.ts +22 -0
  1030. package/dist/agent/types.d.ts.map +1 -1
  1031. package/dist/agent/types.js.map +1 -1
  1032. package/dist/application-state/index.d.ts +1 -1
  1033. package/dist/application-state/index.d.ts.map +1 -1
  1034. package/dist/application-state/index.js +1 -1
  1035. package/dist/application-state/index.js.map +1 -1
  1036. package/dist/application-state/store.d.ts +6 -0
  1037. package/dist/application-state/store.d.ts.map +1 -1
  1038. package/dist/application-state/store.js +31 -0
  1039. package/dist/application-state/store.js.map +1 -1
  1040. package/dist/audit/record.d.ts.map +1 -1
  1041. package/dist/audit/record.js +29 -0
  1042. package/dist/audit/record.js.map +1 -1
  1043. package/dist/audit/store.d.ts.map +1 -1
  1044. package/dist/audit/store.js +62 -3
  1045. package/dist/audit/store.js.map +1 -1
  1046. package/dist/audit/types.d.ts +13 -0
  1047. package/dist/audit/types.d.ts.map +1 -1
  1048. package/dist/audit/types.js.map +1 -1
  1049. package/dist/automation/index.d.ts +193 -0
  1050. package/dist/automation/index.d.ts.map +1 -0
  1051. package/dist/automation/index.js +464 -0
  1052. package/dist/automation/index.js.map +1 -0
  1053. package/dist/cli/code-agent-connector.d.ts +9 -0
  1054. package/dist/cli/code-agent-connector.d.ts.map +1 -1
  1055. package/dist/cli/code-agent-connector.js +212 -10
  1056. package/dist/cli/code-agent-connector.js.map +1 -1
  1057. package/dist/cli/code-agent-executor.d.ts +2 -0
  1058. package/dist/cli/code-agent-executor.d.ts.map +1 -1
  1059. package/dist/cli/code-agent-executor.js +8 -1
  1060. package/dist/cli/code-agent-executor.js.map +1 -1
  1061. package/dist/cli/create.d.ts.map +1 -1
  1062. package/dist/cli/create.js +10 -3
  1063. package/dist/cli/create.js.map +1 -1
  1064. package/dist/cli/design-connect.d.ts.map +1 -1
  1065. package/dist/cli/design-connect.js +492 -35
  1066. package/dist/cli/design-connect.js.map +1 -1
  1067. package/dist/client/AgentPanel.d.ts +7 -1
  1068. package/dist/client/AgentPanel.d.ts.map +1 -1
  1069. package/dist/client/AgentPanel.js +38 -13
  1070. package/dist/client/AgentPanel.js.map +1 -1
  1071. package/dist/client/AssistantChat.d.ts +21 -0
  1072. package/dist/client/AssistantChat.d.ts.map +1 -1
  1073. package/dist/client/AssistantChat.js +147 -49
  1074. package/dist/client/AssistantChat.js.map +1 -1
  1075. package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
  1076. package/dist/client/MultiTabAssistantChat.js +17 -38
  1077. package/dist/client/MultiTabAssistantChat.js.map +1 -1
  1078. package/dist/client/RunStuckBanner.d.ts +14 -1
  1079. package/dist/client/RunStuckBanner.d.ts.map +1 -1
  1080. package/dist/client/RunStuckBanner.js +35 -7
  1081. package/dist/client/RunStuckBanner.js.map +1 -1
  1082. package/dist/client/agent-chat-adapter.d.ts +4 -1
  1083. package/dist/client/agent-chat-adapter.d.ts.map +1 -1
  1084. package/dist/client/agent-chat-adapter.js +49 -4
  1085. package/dist/client/agent-chat-adapter.js.map +1 -1
  1086. package/dist/client/appearance.d.ts +4 -2
  1087. package/dist/client/appearance.d.ts.map +1 -1
  1088. package/dist/client/appearance.js +8 -5
  1089. package/dist/client/appearance.js.map +1 -1
  1090. package/dist/client/automation.d.ts +14 -0
  1091. package/dist/client/automation.d.ts.map +1 -0
  1092. package/dist/client/automation.js +9 -0
  1093. package/dist/client/automation.js.map +1 -0
  1094. package/dist/client/chat/connectors.d.ts.map +1 -1
  1095. package/dist/client/chat/connectors.js +206 -28
  1096. package/dist/client/chat/connectors.js.map +1 -1
  1097. package/dist/client/chat/message-components.d.ts.map +1 -1
  1098. package/dist/client/chat/message-components.js +17 -1
  1099. package/dist/client/chat/message-components.js.map +1 -1
  1100. package/dist/client/chat/run-recovery.d.ts +4 -0
  1101. package/dist/client/chat/run-recovery.d.ts.map +1 -1
  1102. package/dist/client/chat/run-recovery.js +12 -10
  1103. package/dist/client/chat/run-recovery.js.map +1 -1
  1104. package/dist/client/chat/runtime.d.ts.map +1 -1
  1105. package/dist/client/chat/runtime.js +84 -24
  1106. package/dist/client/chat/runtime.js.map +1 -1
  1107. package/dist/client/chat/tool-call-display.d.ts +8 -1
  1108. package/dist/client/chat/tool-call-display.d.ts.map +1 -1
  1109. package/dist/client/chat/tool-call-display.js +21 -3
  1110. package/dist/client/chat/tool-call-display.js.map +1 -1
  1111. package/dist/client/composer/RealtimeVoiceMode.d.ts +54 -0
  1112. package/dist/client/composer/RealtimeVoiceMode.d.ts.map +1 -0
  1113. package/dist/client/composer/RealtimeVoiceMode.js +63 -0
  1114. package/dist/client/composer/RealtimeVoiceMode.js.map +1 -0
  1115. package/dist/client/composer/TiptapComposer.d.ts +1 -0
  1116. package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
  1117. package/dist/client/composer/TiptapComposer.js +25 -20
  1118. package/dist/client/composer/TiptapComposer.js.map +1 -1
  1119. package/dist/client/composer/VoiceButton.d.ts.map +1 -1
  1120. package/dist/client/composer/VoiceButton.js +9 -0
  1121. package/dist/client/composer/VoiceButton.js.map +1 -1
  1122. package/dist/client/composer/index.d.ts +2 -0
  1123. package/dist/client/composer/index.d.ts.map +1 -1
  1124. package/dist/client/composer/index.js +2 -0
  1125. package/dist/client/composer/index.js.map +1 -1
  1126. package/dist/client/composer/useRealtimeVoiceMode.d.ts +56 -0
  1127. package/dist/client/composer/useRealtimeVoiceMode.d.ts.map +1 -0
  1128. package/dist/client/composer/useRealtimeVoiceMode.js +492 -0
  1129. package/dist/client/composer/useRealtimeVoiceMode.js.map +1 -0
  1130. package/dist/client/guided-questions.d.ts.map +1 -1
  1131. package/dist/client/guided-questions.js +7 -2
  1132. package/dist/client/guided-questions.js.map +1 -1
  1133. package/dist/client/index.d.ts +3 -1
  1134. package/dist/client/index.d.ts.map +1 -1
  1135. package/dist/client/index.js +3 -1
  1136. package/dist/client/index.js.map +1 -1
  1137. package/dist/client/integrations/api.d.ts +115 -0
  1138. package/dist/client/integrations/api.d.ts.map +1 -0
  1139. package/dist/client/integrations/api.js +123 -0
  1140. package/dist/client/integrations/api.js.map +1 -0
  1141. package/dist/client/integrations/index.d.ts +1 -0
  1142. package/dist/client/integrations/index.d.ts.map +1 -1
  1143. package/dist/client/integrations/index.js +1 -0
  1144. package/dist/client/integrations/index.js.map +1 -1
  1145. package/dist/client/settings/DemoModeSection.d.ts.map +1 -1
  1146. package/dist/client/settings/DemoModeSection.js +4 -3
  1147. package/dist/client/settings/DemoModeSection.js.map +1 -1
  1148. package/dist/client/settings/SettingsPanel.d.ts.map +1 -1
  1149. package/dist/client/settings/SettingsPanel.js +4 -0
  1150. package/dist/client/settings/SettingsPanel.js.map +1 -1
  1151. package/dist/client/settings/SettingsTabsPage.d.ts +10 -3
  1152. package/dist/client/settings/SettingsTabsPage.d.ts.map +1 -1
  1153. package/dist/client/settings/SettingsTabsPage.js +49 -11
  1154. package/dist/client/settings/SettingsTabsPage.js.map +1 -1
  1155. package/dist/client/transcription/use-live-transcription.d.ts.map +1 -1
  1156. package/dist/client/transcription/use-live-transcription.js +59 -5
  1157. package/dist/client/transcription/use-live-transcription.js.map +1 -1
  1158. package/dist/client/use-chat-models.d.ts.map +1 -1
  1159. package/dist/client/use-chat-models.js +6 -14
  1160. package/dist/client/use-chat-models.js.map +1 -1
  1161. package/dist/client/use-db-sync.d.ts.map +1 -1
  1162. package/dist/client/use-db-sync.js +87 -7
  1163. package/dist/client/use-db-sync.js.map +1 -1
  1164. package/dist/client/use-run-stuck-detection.d.ts +16 -1
  1165. package/dist/client/use-run-stuck-detection.d.ts.map +1 -1
  1166. package/dist/client/use-run-stuck-detection.js +23 -4
  1167. package/dist/client/use-run-stuck-detection.js.map +1 -1
  1168. package/dist/code-agents/background-controller.d.ts +1 -1
  1169. package/dist/code-agents/background-controller.d.ts.map +1 -1
  1170. package/dist/code-agents/background-controller.js +17 -1
  1171. package/dist/code-agents/background-controller.js.map +1 -1
  1172. package/dist/collab/routes.d.ts +1 -1
  1173. package/dist/collab/ydoc-manager.d.ts +9 -1
  1174. package/dist/collab/ydoc-manager.d.ts.map +1 -1
  1175. package/dist/collab/ydoc-manager.js +30 -6
  1176. package/dist/collab/ydoc-manager.js.map +1 -1
  1177. package/dist/db/migrations.d.ts.map +1 -1
  1178. package/dist/db/migrations.js +4 -2
  1179. package/dist/db/migrations.js.map +1 -1
  1180. package/dist/demo/fetch-interceptor.d.ts +5 -1
  1181. package/dist/demo/fetch-interceptor.d.ts.map +1 -1
  1182. package/dist/demo/fetch-interceptor.js +16 -12
  1183. package/dist/demo/fetch-interceptor.js.map +1 -1
  1184. package/dist/deploy/build.d.ts.map +1 -1
  1185. package/dist/deploy/build.js +49 -4
  1186. package/dist/deploy/build.js.map +1 -1
  1187. package/dist/deploy/workspace-deploy.d.ts.map +1 -1
  1188. package/dist/deploy/workspace-deploy.js +31 -2
  1189. package/dist/deploy/workspace-deploy.js.map +1 -1
  1190. package/dist/file-upload/types.d.ts +2 -0
  1191. package/dist/file-upload/types.d.ts.map +1 -1
  1192. package/dist/file-upload/types.js.map +1 -1
  1193. package/dist/index.d.ts +2 -0
  1194. package/dist/index.d.ts.map +1 -1
  1195. package/dist/index.js +2 -0
  1196. package/dist/index.js.map +1 -1
  1197. package/dist/integrations/a2a-continuations-store.d.ts.map +1 -1
  1198. package/dist/integrations/a2a-continuations-store.js +6 -4
  1199. package/dist/integrations/a2a-continuations-store.js.map +1 -1
  1200. package/dist/integrations/adapters/discord.d.ts +3 -0
  1201. package/dist/integrations/adapters/discord.d.ts.map +1 -0
  1202. package/dist/integrations/adapters/discord.js +261 -0
  1203. package/dist/integrations/adapters/discord.js.map +1 -0
  1204. package/dist/integrations/adapters/index.d.ts +4 -0
  1205. package/dist/integrations/adapters/index.d.ts.map +1 -0
  1206. package/dist/integrations/adapters/index.js +26 -0
  1207. package/dist/integrations/adapters/index.js.map +1 -0
  1208. package/dist/integrations/adapters/microsoft-teams.d.ts +5 -0
  1209. package/dist/integrations/adapters/microsoft-teams.d.ts.map +1 -0
  1210. package/dist/integrations/adapters/microsoft-teams.js +295 -0
  1211. package/dist/integrations/adapters/microsoft-teams.js.map +1 -0
  1212. package/dist/integrations/adapters/slack.d.ts +10 -2
  1213. package/dist/integrations/adapters/slack.d.ts.map +1 -1
  1214. package/dist/integrations/adapters/slack.js +772 -27
  1215. package/dist/integrations/adapters/slack.js.map +1 -1
  1216. package/dist/integrations/adapters/telegram.d.ts +0 -2
  1217. package/dist/integrations/adapters/telegram.d.ts.map +1 -1
  1218. package/dist/integrations/adapters/telegram.js +49 -15
  1219. package/dist/integrations/adapters/telegram.js.map +1 -1
  1220. package/dist/integrations/adapters/whatsapp.d.ts +0 -2
  1221. package/dist/integrations/adapters/whatsapp.d.ts.map +1 -1
  1222. package/dist/integrations/adapters/whatsapp.js +40 -17
  1223. package/dist/integrations/adapters/whatsapp.js.map +1 -1
  1224. package/dist/integrations/awaiting-input-store.d.ts +27 -0
  1225. package/dist/integrations/awaiting-input-store.d.ts.map +1 -0
  1226. package/dist/integrations/awaiting-input-store.js +112 -0
  1227. package/dist/integrations/awaiting-input-store.js.map +1 -0
  1228. package/dist/integrations/catalog.d.ts +75 -0
  1229. package/dist/integrations/catalog.d.ts.map +1 -0
  1230. package/dist/integrations/catalog.js +451 -0
  1231. package/dist/integrations/catalog.js.map +1 -0
  1232. package/dist/integrations/computer-supervision-store.d.ts +65 -0
  1233. package/dist/integrations/computer-supervision-store.d.ts.map +1 -0
  1234. package/dist/integrations/computer-supervision-store.js +296 -0
  1235. package/dist/integrations/computer-supervision-store.js.map +1 -0
  1236. package/dist/integrations/computer-supervision.d.ts +11 -0
  1237. package/dist/integrations/computer-supervision.d.ts.map +1 -0
  1238. package/dist/integrations/computer-supervision.js +160 -0
  1239. package/dist/integrations/computer-supervision.js.map +1 -0
  1240. package/dist/integrations/controls-store.d.ts +44 -0
  1241. package/dist/integrations/controls-store.d.ts.map +1 -0
  1242. package/dist/integrations/controls-store.js +129 -0
  1243. package/dist/integrations/controls-store.js.map +1 -0
  1244. package/dist/integrations/index.d.ts +19 -4
  1245. package/dist/integrations/index.d.ts.map +1 -1
  1246. package/dist/integrations/index.js +14 -2
  1247. package/dist/integrations/index.js.map +1 -1
  1248. package/dist/integrations/installations-store.d.ts +112 -0
  1249. package/dist/integrations/installations-store.d.ts.map +1 -0
  1250. package/dist/integrations/installations-store.js +493 -0
  1251. package/dist/integrations/installations-store.js.map +1 -0
  1252. package/dist/integrations/integration-memory.d.ts +24 -0
  1253. package/dist/integrations/integration-memory.d.ts.map +1 -0
  1254. package/dist/integrations/integration-memory.js +136 -0
  1255. package/dist/integrations/integration-memory.js.map +1 -0
  1256. package/dist/integrations/pending-tasks-retry-job.d.ts.map +1 -1
  1257. package/dist/integrations/pending-tasks-retry-job.js +6 -5
  1258. package/dist/integrations/pending-tasks-retry-job.js.map +1 -1
  1259. package/dist/integrations/pending-tasks-store.d.ts +17 -0
  1260. package/dist/integrations/pending-tasks-store.d.ts.map +1 -1
  1261. package/dist/integrations/pending-tasks-store.js +71 -5
  1262. package/dist/integrations/pending-tasks-store.js.map +1 -1
  1263. package/dist/integrations/plugin.d.ts.map +1 -1
  1264. package/dist/integrations/plugin.js +725 -38
  1265. package/dist/integrations/plugin.js.map +1 -1
  1266. package/dist/integrations/remote-commands-store.d.ts +15 -1
  1267. package/dist/integrations/remote-commands-store.d.ts.map +1 -1
  1268. package/dist/integrations/remote-commands-store.js +273 -3
  1269. package/dist/integrations/remote-commands-store.js.map +1 -1
  1270. package/dist/integrations/remote-devices-store.d.ts +4 -3
  1271. package/dist/integrations/remote-devices-store.d.ts.map +1 -1
  1272. package/dist/integrations/remote-devices-store.js +49 -2
  1273. package/dist/integrations/remote-devices-store.js.map +1 -1
  1274. package/dist/integrations/remote-json-safety.d.ts +6 -0
  1275. package/dist/integrations/remote-json-safety.d.ts.map +1 -0
  1276. package/dist/integrations/remote-json-safety.js +114 -0
  1277. package/dist/integrations/remote-json-safety.js.map +1 -0
  1278. package/dist/integrations/remote-run-events-store.d.ts +11 -1
  1279. package/dist/integrations/remote-run-events-store.d.ts.map +1 -1
  1280. package/dist/integrations/remote-run-events-store.js +85 -17
  1281. package/dist/integrations/remote-run-events-store.js.map +1 -1
  1282. package/dist/integrations/remote-types.d.ts +54 -3
  1283. package/dist/integrations/remote-types.d.ts.map +1 -1
  1284. package/dist/integrations/remote-types.js.map +1 -1
  1285. package/dist/integrations/scope-store.d.ts +65 -0
  1286. package/dist/integrations/scope-store.d.ts.map +1 -0
  1287. package/dist/integrations/scope-store.js +361 -0
  1288. package/dist/integrations/scope-store.js.map +1 -0
  1289. package/dist/integrations/slack-manifest.d.ts +66 -0
  1290. package/dist/integrations/slack-manifest.d.ts.map +1 -0
  1291. package/dist/integrations/slack-manifest.js +70 -0
  1292. package/dist/integrations/slack-manifest.js.map +1 -0
  1293. package/dist/integrations/slack-oauth.d.ts +99 -0
  1294. package/dist/integrations/slack-oauth.d.ts.map +1 -0
  1295. package/dist/integrations/slack-oauth.js +226 -0
  1296. package/dist/integrations/slack-oauth.js.map +1 -0
  1297. package/dist/integrations/types.d.ts +144 -0
  1298. package/dist/integrations/types.d.ts.map +1 -1
  1299. package/dist/integrations/types.js +16 -1
  1300. package/dist/integrations/types.js.map +1 -1
  1301. package/dist/integrations/usage-budget-store.d.ts +84 -0
  1302. package/dist/integrations/usage-budget-store.d.ts.map +1 -0
  1303. package/dist/integrations/usage-budget-store.js +650 -0
  1304. package/dist/integrations/usage-budget-store.js.map +1 -0
  1305. package/dist/integrations/webhook-handler.d.ts +4 -0
  1306. package/dist/integrations/webhook-handler.d.ts.map +1 -1
  1307. package/dist/integrations/webhook-handler.js +548 -51
  1308. package/dist/integrations/webhook-handler.js.map +1 -1
  1309. package/dist/jobs/scheduler.d.ts +6 -0
  1310. package/dist/jobs/scheduler.d.ts.map +1 -1
  1311. package/dist/jobs/scheduler.js +83 -4
  1312. package/dist/jobs/scheduler.js.map +1 -1
  1313. package/dist/jobs/tools.d.ts.map +1 -1
  1314. package/dist/jobs/tools.js +43 -11
  1315. package/dist/jobs/tools.js.map +1 -1
  1316. package/dist/localization/default-messages.d.ts +26 -0
  1317. package/dist/localization/default-messages.d.ts.map +1 -1
  1318. package/dist/localization/default-messages.js +26 -0
  1319. package/dist/localization/default-messages.js.map +1 -1
  1320. package/dist/mcp-client/config.d.ts.map +1 -1
  1321. package/dist/mcp-client/config.js +44 -3
  1322. package/dist/mcp-client/config.js.map +1 -1
  1323. package/dist/mcp-client/index.d.ts +6 -1
  1324. package/dist/mcp-client/index.d.ts.map +1 -1
  1325. package/dist/mcp-client/index.js +11 -3
  1326. package/dist/mcp-client/index.js.map +1 -1
  1327. package/dist/mcp-client/tool-policy.d.ts +24 -0
  1328. package/dist/mcp-client/tool-policy.d.ts.map +1 -0
  1329. package/dist/mcp-client/tool-policy.js +139 -0
  1330. package/dist/mcp-client/tool-policy.js.map +1 -0
  1331. package/dist/observability/routes.d.ts +1 -1
  1332. package/dist/progress/routes.d.ts +1 -1
  1333. package/dist/provider-api/index.d.ts +4 -4
  1334. package/dist/provider-api/index.d.ts.map +1 -1
  1335. package/dist/provider-api/index.js +72 -1
  1336. package/dist/provider-api/index.js.map +1 -1
  1337. package/dist/resources/handlers.d.ts.map +1 -1
  1338. package/dist/resources/handlers.js +57 -15
  1339. package/dist/resources/handlers.js.map +1 -1
  1340. package/dist/resources/script-helpers.d.ts.map +1 -1
  1341. package/dist/resources/script-helpers.js +34 -8
  1342. package/dist/resources/script-helpers.js.map +1 -1
  1343. package/dist/resources/store.d.ts +10 -0
  1344. package/dist/resources/store.d.ts.map +1 -1
  1345. package/dist/resources/store.js +54 -47
  1346. package/dist/resources/store.js.map +1 -1
  1347. package/dist/scripts/call-agent.d.ts.map +1 -1
  1348. package/dist/scripts/call-agent.js +106 -1
  1349. package/dist/scripts/call-agent.js.map +1 -1
  1350. package/dist/secrets/register-framework-secrets.d.ts +3 -4
  1351. package/dist/secrets/register-framework-secrets.d.ts.map +1 -1
  1352. package/dist/secrets/register-framework-secrets.js +25 -4
  1353. package/dist/secrets/register-framework-secrets.js.map +1 -1
  1354. package/dist/secrets/routes.d.ts +9 -9
  1355. package/dist/server/agent-chat-plugin.d.ts +15 -4
  1356. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  1357. package/dist/server/agent-chat-plugin.js +300 -118
  1358. package/dist/server/agent-chat-plugin.js.map +1 -1
  1359. package/dist/server/auth.d.ts.map +1 -1
  1360. package/dist/server/auth.js +10 -14
  1361. package/dist/server/auth.js.map +1 -1
  1362. package/dist/server/builder-design-systems.d.ts +3 -1
  1363. package/dist/server/builder-design-systems.d.ts.map +1 -1
  1364. package/dist/server/builder-design-systems.js +9 -2
  1365. package/dist/server/builder-design-systems.js.map +1 -1
  1366. package/dist/server/edge.d.ts +1 -1
  1367. package/dist/server/edge.d.ts.map +1 -1
  1368. package/dist/server/edge.js +1 -1
  1369. package/dist/server/edge.js.map +1 -1
  1370. package/dist/server/index.d.ts +4 -2
  1371. package/dist/server/index.d.ts.map +1 -1
  1372. package/dist/server/index.js +4 -2
  1373. package/dist/server/index.js.map +1 -1
  1374. package/dist/server/realtime-voice.d.ts +53 -0
  1375. package/dist/server/realtime-voice.d.ts.map +1 -0
  1376. package/dist/server/realtime-voice.js +404 -0
  1377. package/dist/server/realtime-voice.js.map +1 -0
  1378. package/dist/server/request-context.d.ts +18 -0
  1379. package/dist/server/request-context.d.ts.map +1 -1
  1380. package/dist/server/request-context.js.map +1 -1
  1381. package/dist/server/social-og-image.d.ts.map +1 -1
  1382. package/dist/server/social-og-image.js +3 -2
  1383. package/dist/server/social-og-image.js.map +1 -1
  1384. package/dist/server/transcribe-voice.d.ts +1 -1
  1385. package/dist/shared/reasoning-effort.d.ts +20 -0
  1386. package/dist/shared/reasoning-effort.d.ts.map +1 -1
  1387. package/dist/shared/reasoning-effort.js +52 -18
  1388. package/dist/shared/reasoning-effort.js.map +1 -1
  1389. package/dist/styles/agent-conversation.css +17 -0
  1390. package/dist/styles/agent-native.css +62 -44
  1391. package/dist/templates/default/.agents/skills/capture-learnings/SKILL.md +22 -9
  1392. package/dist/templates/default/AGENTS.md +7 -3
  1393. package/dist/templates/workspace-core/.agents/skills/authentication/SKILL.md +1 -1
  1394. package/dist/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +22 -9
  1395. package/dist/templates/workspace-core/.agents/skills/extension-points/SKILL.md +6 -3
  1396. package/dist/templates/workspace-core/.agents/skills/extensions/SKILL.md +25 -0
  1397. package/dist/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +15 -0
  1398. package/dist/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +39 -5
  1399. package/dist/templates/workspace-core/AGENTS.md +3 -2
  1400. package/dist/usage/store.d.ts +7 -0
  1401. package/dist/usage/store.d.ts.map +1 -1
  1402. package/dist/usage/store.js +24 -3
  1403. package/dist/usage/store.js.map +1 -1
  1404. package/docs/content/a2a-protocol.mdx +21 -5
  1405. package/docs/content/actions.mdx +9 -23
  1406. package/docs/content/agent-mentions.mdx +31 -29
  1407. package/docs/content/agent-native-toolkit.mdx +15 -6
  1408. package/docs/content/agent-surfaces.mdx +9 -13
  1409. package/docs/content/agent-teams.mdx +1 -0
  1410. package/docs/content/authentication.mdx +10 -3
  1411. package/docs/content/automation-connectors.mdx +123 -0
  1412. package/docs/content/automations.mdx +17 -3
  1413. package/docs/content/blueprint-installer.mdx +11 -4
  1414. package/docs/content/cli-adapters.mdx +9 -6
  1415. package/docs/content/client.mdx +16 -0
  1416. package/docs/content/cloneable-saas.mdx +14 -11
  1417. package/docs/content/code-agents-ui.mdx +65 -0
  1418. package/docs/content/components.mdx +30 -14
  1419. package/docs/content/context-awareness.mdx +27 -15
  1420. package/docs/content/creating-templates.mdx +15 -9
  1421. package/docs/content/cross-app-sso.mdx +16 -6
  1422. package/docs/content/data-programs.mdx +1 -1
  1423. package/docs/content/database.mdx +17 -5
  1424. package/docs/content/deployment.mdx +19 -18
  1425. package/docs/content/dispatch.mdx +6 -2
  1426. package/docs/content/drop-in-agent.mdx +10 -4
  1427. package/docs/content/durable-background-runs.mdx +9 -5
  1428. package/docs/content/durable-resume.mdx +9 -4
  1429. package/docs/content/embedding-sdk.mdx +26 -8
  1430. package/docs/content/evals.mdx +3 -5
  1431. package/docs/content/extensions.mdx +23 -2
  1432. package/docs/content/external-agents.mdx +25 -34
  1433. package/docs/content/faq.mdx +8 -0
  1434. package/docs/content/file-uploads.mdx +12 -3
  1435. package/docs/content/frames.mdx +16 -0
  1436. package/docs/content/generative-ui.mdx +1 -1
  1437. package/docs/content/getting-started.mdx +34 -21
  1438. package/docs/content/harness-agents.mdx +8 -4
  1439. package/docs/content/human-approval.mdx +8 -3
  1440. package/docs/content/internationalization.mdx +9 -4
  1441. package/docs/content/key-concepts.mdx +13 -20
  1442. package/docs/content/local-file-mode.mdx +14 -8
  1443. package/docs/content/locales/ar-SA/actions.mdx +2 -2
  1444. package/docs/content/locales/ar-SA/agent-native-toolkit.mdx +2 -2
  1445. package/docs/content/locales/ar-SA/agent-surfaces.mdx +8 -10
  1446. package/docs/content/locales/ar-SA/agent-teams.mdx +1 -0
  1447. package/docs/content/locales/ar-SA/authentication.mdx +1 -1
  1448. package/docs/content/locales/ar-SA/components.mdx +11 -1
  1449. package/docs/content/locales/ar-SA/creating-templates.mdx +3 -7
  1450. package/docs/content/locales/ar-SA/cross-app-sso.mdx +16 -6
  1451. package/docs/content/locales/ar-SA/deployment.mdx +8 -0
  1452. package/docs/content/locales/ar-SA/extensions.mdx +8 -0
  1453. package/docs/content/locales/ar-SA/external-agents.mdx +2 -7
  1454. package/docs/content/locales/ar-SA/key-concepts.mdx +13 -20
  1455. package/docs/content/locales/ar-SA/messaging.mdx +84 -15
  1456. package/docs/content/locales/ar-SA/multi-tenancy.mdx +5 -5
  1457. package/docs/content/locales/ar-SA/notifications.mdx +18 -10
  1458. package/docs/content/locales/ar-SA/processors.mdx +11 -5
  1459. package/docs/content/locales/ar-SA/server.mdx +17 -10
  1460. package/docs/content/locales/ar-SA/sharing.mdx +10 -10
  1461. package/docs/content/locales/ar-SA/skills-guide.mdx +34 -17
  1462. package/docs/content/locales/ar-SA/template-assets.mdx +16 -13
  1463. package/docs/content/locales/ar-SA/template-brain.mdx +3 -1
  1464. package/docs/content/locales/ar-SA/template-clips.mdx +4 -3
  1465. package/docs/content/locales/ar-SA/template-design.mdx +4 -1
  1466. package/docs/content/locales/ar-SA/template-dispatch.mdx +5 -1
  1467. package/docs/content/locales/ar-SA/template-mail.mdx +8 -0
  1468. package/docs/content/locales/ar-SA/tracking.mdx +9 -6
  1469. package/docs/content/locales/ar-SA/using-your-agent.mdx +0 -7
  1470. package/docs/content/locales/ar-SA/voice-input.mdx +6 -0
  1471. package/docs/content/locales/ar-SA/workspace-connections.mdx +9 -2
  1472. package/docs/content/locales/ar-SA/workspace.mdx +19 -18
  1473. package/docs/content/locales/de-DE/actions.mdx +2 -2
  1474. package/docs/content/locales/de-DE/agent-native-toolkit.mdx +2 -2
  1475. package/docs/content/locales/de-DE/agent-surfaces.mdx +8 -10
  1476. package/docs/content/locales/de-DE/agent-teams.mdx +1 -0
  1477. package/docs/content/locales/de-DE/authentication.mdx +1 -1
  1478. package/docs/content/locales/de-DE/components.mdx +11 -1
  1479. package/docs/content/locales/de-DE/creating-templates.mdx +3 -7
  1480. package/docs/content/locales/de-DE/cross-app-sso.mdx +16 -6
  1481. package/docs/content/locales/de-DE/deployment.mdx +8 -0
  1482. package/docs/content/locales/de-DE/extensions.mdx +10 -0
  1483. package/docs/content/locales/de-DE/external-agents.mdx +3 -7
  1484. package/docs/content/locales/de-DE/key-concepts.mdx +13 -20
  1485. package/docs/content/locales/de-DE/messaging.mdx +92 -15
  1486. package/docs/content/locales/de-DE/multi-tenancy.mdx +5 -5
  1487. package/docs/content/locales/de-DE/notifications.mdx +18 -10
  1488. package/docs/content/locales/de-DE/processors.mdx +11 -5
  1489. package/docs/content/locales/de-DE/server.mdx +18 -10
  1490. package/docs/content/locales/de-DE/sharing.mdx +10 -10
  1491. package/docs/content/locales/de-DE/skills-guide.mdx +34 -17
  1492. package/docs/content/locales/de-DE/template-assets.mdx +16 -13
  1493. package/docs/content/locales/de-DE/template-brain.mdx +3 -1
  1494. package/docs/content/locales/de-DE/template-clips.mdx +4 -3
  1495. package/docs/content/locales/de-DE/template-design.mdx +4 -1
  1496. package/docs/content/locales/de-DE/template-dispatch.mdx +5 -1
  1497. package/docs/content/locales/de-DE/template-mail.mdx +8 -0
  1498. package/docs/content/locales/de-DE/tracking.mdx +9 -6
  1499. package/docs/content/locales/de-DE/using-your-agent.mdx +0 -7
  1500. package/docs/content/locales/de-DE/voice-input.mdx +6 -0
  1501. package/docs/content/locales/de-DE/workspace-connections.mdx +9 -2
  1502. package/docs/content/locales/de-DE/workspace.mdx +19 -18
  1503. package/docs/content/locales/es-ES/actions.mdx +2 -2
  1504. package/docs/content/locales/es-ES/agent-native-toolkit.mdx +2 -2
  1505. package/docs/content/locales/es-ES/agent-surfaces.mdx +8 -10
  1506. package/docs/content/locales/es-ES/agent-teams.mdx +1 -0
  1507. package/docs/content/locales/es-ES/authentication.mdx +1 -1
  1508. package/docs/content/locales/es-ES/components.mdx +11 -1
  1509. package/docs/content/locales/es-ES/creating-templates.mdx +3 -7
  1510. package/docs/content/locales/es-ES/cross-app-sso.mdx +16 -6
  1511. package/docs/content/locales/es-ES/deployment.mdx +8 -0
  1512. package/docs/content/locales/es-ES/extensions.mdx +10 -0
  1513. package/docs/content/locales/es-ES/external-agents.mdx +3 -7
  1514. package/docs/content/locales/es-ES/key-concepts.mdx +13 -20
  1515. package/docs/content/locales/es-ES/messaging.mdx +91 -15
  1516. package/docs/content/locales/es-ES/multi-tenancy.mdx +5 -5
  1517. package/docs/content/locales/es-ES/notifications.mdx +18 -10
  1518. package/docs/content/locales/es-ES/processors.mdx +11 -5
  1519. package/docs/content/locales/es-ES/server.mdx +17 -10
  1520. package/docs/content/locales/es-ES/sharing.mdx +10 -10
  1521. package/docs/content/locales/es-ES/skills-guide.mdx +34 -17
  1522. package/docs/content/locales/es-ES/template-assets.mdx +16 -13
  1523. package/docs/content/locales/es-ES/template-brain.mdx +3 -1
  1524. package/docs/content/locales/es-ES/template-clips.mdx +4 -3
  1525. package/docs/content/locales/es-ES/template-design.mdx +4 -1
  1526. package/docs/content/locales/es-ES/template-dispatch.mdx +5 -1
  1527. package/docs/content/locales/es-ES/template-mail.mdx +8 -0
  1528. package/docs/content/locales/es-ES/tracking.mdx +9 -6
  1529. package/docs/content/locales/es-ES/using-your-agent.mdx +0 -7
  1530. package/docs/content/locales/es-ES/voice-input.mdx +6 -0
  1531. package/docs/content/locales/es-ES/workspace-connections.mdx +9 -2
  1532. package/docs/content/locales/es-ES/workspace.mdx +19 -18
  1533. package/docs/content/locales/fr-FR/actions.mdx +2 -2
  1534. package/docs/content/locales/fr-FR/agent-native-toolkit.mdx +2 -2
  1535. package/docs/content/locales/fr-FR/agent-surfaces.mdx +8 -10
  1536. package/docs/content/locales/fr-FR/agent-teams.mdx +1 -0
  1537. package/docs/content/locales/fr-FR/authentication.mdx +1 -1
  1538. package/docs/content/locales/fr-FR/components.mdx +11 -1
  1539. package/docs/content/locales/fr-FR/creating-templates.mdx +3 -7
  1540. package/docs/content/locales/fr-FR/cross-app-sso.mdx +16 -6
  1541. package/docs/content/locales/fr-FR/deployment.mdx +8 -0
  1542. package/docs/content/locales/fr-FR/extensions.mdx +10 -0
  1543. package/docs/content/locales/fr-FR/external-agents.mdx +3 -7
  1544. package/docs/content/locales/fr-FR/key-concepts.mdx +13 -20
  1545. package/docs/content/locales/fr-FR/messaging.mdx +91 -15
  1546. package/docs/content/locales/fr-FR/multi-tenancy.mdx +5 -5
  1547. package/docs/content/locales/fr-FR/notifications.mdx +18 -10
  1548. package/docs/content/locales/fr-FR/processors.mdx +11 -5
  1549. package/docs/content/locales/fr-FR/server.mdx +17 -10
  1550. package/docs/content/locales/fr-FR/sharing.mdx +10 -10
  1551. package/docs/content/locales/fr-FR/skills-guide.mdx +34 -17
  1552. package/docs/content/locales/fr-FR/template-assets.mdx +16 -13
  1553. package/docs/content/locales/fr-FR/template-brain.mdx +3 -1
  1554. package/docs/content/locales/fr-FR/template-clips.mdx +4 -3
  1555. package/docs/content/locales/fr-FR/template-design.mdx +4 -1
  1556. package/docs/content/locales/fr-FR/template-dispatch.mdx +5 -1
  1557. package/docs/content/locales/fr-FR/template-mail.mdx +8 -0
  1558. package/docs/content/locales/fr-FR/tracking.mdx +9 -6
  1559. package/docs/content/locales/fr-FR/using-your-agent.mdx +0 -7
  1560. package/docs/content/locales/fr-FR/voice-input.mdx +6 -0
  1561. package/docs/content/locales/fr-FR/workspace-connections.mdx +9 -2
  1562. package/docs/content/locales/fr-FR/workspace.mdx +19 -18
  1563. package/docs/content/locales/hi-IN/actions.mdx +2 -2
  1564. package/docs/content/locales/hi-IN/agent-native-toolkit.mdx +2 -2
  1565. package/docs/content/locales/hi-IN/agent-surfaces.mdx +8 -10
  1566. package/docs/content/locales/hi-IN/agent-teams.mdx +1 -0
  1567. package/docs/content/locales/hi-IN/authentication.mdx +1 -1
  1568. package/docs/content/locales/hi-IN/components.mdx +11 -1
  1569. package/docs/content/locales/hi-IN/creating-templates.mdx +3 -7
  1570. package/docs/content/locales/hi-IN/cross-app-sso.mdx +16 -6
  1571. package/docs/content/locales/hi-IN/deployment.mdx +8 -0
  1572. package/docs/content/locales/hi-IN/extensions.mdx +8 -0
  1573. package/docs/content/locales/hi-IN/external-agents.mdx +2 -7
  1574. package/docs/content/locales/hi-IN/key-concepts.mdx +13 -20
  1575. package/docs/content/locales/hi-IN/messaging.mdx +81 -15
  1576. package/docs/content/locales/hi-IN/multi-tenancy.mdx +5 -5
  1577. package/docs/content/locales/hi-IN/notifications.mdx +18 -10
  1578. package/docs/content/locales/hi-IN/processors.mdx +11 -5
  1579. package/docs/content/locales/hi-IN/server.mdx +17 -10
  1580. package/docs/content/locales/hi-IN/sharing.mdx +10 -10
  1581. package/docs/content/locales/hi-IN/skills-guide.mdx +34 -17
  1582. package/docs/content/locales/hi-IN/template-assets.mdx +16 -13
  1583. package/docs/content/locales/hi-IN/template-brain.mdx +3 -1
  1584. package/docs/content/locales/hi-IN/template-clips.mdx +4 -3
  1585. package/docs/content/locales/hi-IN/template-design.mdx +4 -1
  1586. package/docs/content/locales/hi-IN/template-dispatch.mdx +5 -1
  1587. package/docs/content/locales/hi-IN/template-mail.mdx +8 -0
  1588. package/docs/content/locales/hi-IN/tracking.mdx +9 -6
  1589. package/docs/content/locales/hi-IN/using-your-agent.mdx +0 -7
  1590. package/docs/content/locales/hi-IN/voice-input.mdx +6 -0
  1591. package/docs/content/locales/hi-IN/workspace-connections.mdx +9 -2
  1592. package/docs/content/locales/hi-IN/workspace.mdx +19 -18
  1593. package/docs/content/locales/ja-JP/actions.mdx +2 -2
  1594. package/docs/content/locales/ja-JP/agent-native-toolkit.mdx +2 -2
  1595. package/docs/content/locales/ja-JP/agent-surfaces.mdx +8 -10
  1596. package/docs/content/locales/ja-JP/agent-teams.mdx +1 -0
  1597. package/docs/content/locales/ja-JP/authentication.mdx +1 -1
  1598. package/docs/content/locales/ja-JP/components.mdx +11 -1
  1599. package/docs/content/locales/ja-JP/creating-templates.mdx +3 -7
  1600. package/docs/content/locales/ja-JP/cross-app-sso.mdx +16 -6
  1601. package/docs/content/locales/ja-JP/deployment.mdx +8 -0
  1602. package/docs/content/locales/ja-JP/extensions.mdx +9 -0
  1603. package/docs/content/locales/ja-JP/external-agents.mdx +2 -7
  1604. package/docs/content/locales/ja-JP/key-concepts.mdx +13 -20
  1605. package/docs/content/locales/ja-JP/messaging.mdx +81 -15
  1606. package/docs/content/locales/ja-JP/multi-tenancy.mdx +5 -5
  1607. package/docs/content/locales/ja-JP/notifications.mdx +18 -10
  1608. package/docs/content/locales/ja-JP/processors.mdx +11 -5
  1609. package/docs/content/locales/ja-JP/server.mdx +17 -10
  1610. package/docs/content/locales/ja-JP/sharing.mdx +10 -10
  1611. package/docs/content/locales/ja-JP/skills-guide.mdx +34 -17
  1612. package/docs/content/locales/ja-JP/template-assets.mdx +16 -13
  1613. package/docs/content/locales/ja-JP/template-brain.mdx +3 -1
  1614. package/docs/content/locales/ja-JP/template-clips.mdx +4 -4
  1615. package/docs/content/locales/ja-JP/template-design.mdx +4 -1
  1616. package/docs/content/locales/ja-JP/template-dispatch.mdx +5 -1
  1617. package/docs/content/locales/ja-JP/template-mail.mdx +8 -0
  1618. package/docs/content/locales/ja-JP/tracking.mdx +9 -6
  1619. package/docs/content/locales/ja-JP/using-your-agent.mdx +0 -7
  1620. package/docs/content/locales/ja-JP/voice-input.mdx +6 -0
  1621. package/docs/content/locales/ja-JP/workspace-connections.mdx +9 -2
  1622. package/docs/content/locales/ja-JP/workspace.mdx +19 -18
  1623. package/docs/content/locales/ko-KR/actions.mdx +2 -2
  1624. package/docs/content/locales/ko-KR/agent-native-toolkit.mdx +2 -2
  1625. package/docs/content/locales/ko-KR/agent-surfaces.mdx +8 -10
  1626. package/docs/content/locales/ko-KR/agent-teams.mdx +1 -0
  1627. package/docs/content/locales/ko-KR/authentication.mdx +1 -1
  1628. package/docs/content/locales/ko-KR/components.mdx +11 -1
  1629. package/docs/content/locales/ko-KR/creating-templates.mdx +3 -7
  1630. package/docs/content/locales/ko-KR/cross-app-sso.mdx +16 -6
  1631. package/docs/content/locales/ko-KR/deployment.mdx +8 -0
  1632. package/docs/content/locales/ko-KR/extensions.mdx +8 -0
  1633. package/docs/content/locales/ko-KR/external-agents.mdx +2 -7
  1634. package/docs/content/locales/ko-KR/key-concepts.mdx +13 -20
  1635. package/docs/content/locales/ko-KR/messaging.mdx +80 -15
  1636. package/docs/content/locales/ko-KR/multi-tenancy.mdx +5 -5
  1637. package/docs/content/locales/ko-KR/notifications.mdx +18 -10
  1638. package/docs/content/locales/ko-KR/processors.mdx +11 -5
  1639. package/docs/content/locales/ko-KR/server.mdx +17 -10
  1640. package/docs/content/locales/ko-KR/sharing.mdx +10 -10
  1641. package/docs/content/locales/ko-KR/skills-guide.mdx +34 -17
  1642. package/docs/content/locales/ko-KR/template-assets.mdx +16 -13
  1643. package/docs/content/locales/ko-KR/template-brain.mdx +3 -1
  1644. package/docs/content/locales/ko-KR/template-clips.mdx +4 -4
  1645. package/docs/content/locales/ko-KR/template-design.mdx +4 -1
  1646. package/docs/content/locales/ko-KR/template-dispatch.mdx +5 -1
  1647. package/docs/content/locales/ko-KR/template-mail.mdx +8 -0
  1648. package/docs/content/locales/ko-KR/tracking.mdx +9 -6
  1649. package/docs/content/locales/ko-KR/using-your-agent.mdx +0 -7
  1650. package/docs/content/locales/ko-KR/voice-input.mdx +6 -0
  1651. package/docs/content/locales/ko-KR/workspace-connections.mdx +9 -2
  1652. package/docs/content/locales/ko-KR/workspace.mdx +19 -18
  1653. package/docs/content/locales/pt-BR/actions.mdx +2 -2
  1654. package/docs/content/locales/pt-BR/agent-native-toolkit.mdx +2 -2
  1655. package/docs/content/locales/pt-BR/agent-surfaces.mdx +8 -10
  1656. package/docs/content/locales/pt-BR/agent-teams.mdx +1 -0
  1657. package/docs/content/locales/pt-BR/authentication.mdx +1 -1
  1658. package/docs/content/locales/pt-BR/components.mdx +11 -1
  1659. package/docs/content/locales/pt-BR/creating-templates.mdx +3 -7
  1660. package/docs/content/locales/pt-BR/cross-app-sso.mdx +16 -6
  1661. package/docs/content/locales/pt-BR/deployment.mdx +8 -0
  1662. package/docs/content/locales/pt-BR/extensions.mdx +9 -0
  1663. package/docs/content/locales/pt-BR/external-agents.mdx +3 -7
  1664. package/docs/content/locales/pt-BR/key-concepts.mdx +13 -20
  1665. package/docs/content/locales/pt-BR/messaging.mdx +88 -15
  1666. package/docs/content/locales/pt-BR/multi-tenancy.mdx +5 -5
  1667. package/docs/content/locales/pt-BR/notifications.mdx +18 -10
  1668. package/docs/content/locales/pt-BR/processors.mdx +11 -5
  1669. package/docs/content/locales/pt-BR/server.mdx +17 -10
  1670. package/docs/content/locales/pt-BR/sharing.mdx +10 -10
  1671. package/docs/content/locales/pt-BR/skills-guide.mdx +34 -17
  1672. package/docs/content/locales/pt-BR/template-assets.mdx +16 -13
  1673. package/docs/content/locales/pt-BR/template-brain.mdx +3 -1
  1674. package/docs/content/locales/pt-BR/template-clips.mdx +4 -3
  1675. package/docs/content/locales/pt-BR/template-design.mdx +4 -1
  1676. package/docs/content/locales/pt-BR/template-dispatch.mdx +5 -1
  1677. package/docs/content/locales/pt-BR/template-mail.mdx +8 -0
  1678. package/docs/content/locales/pt-BR/tracking.mdx +9 -6
  1679. package/docs/content/locales/pt-BR/using-your-agent.mdx +0 -7
  1680. package/docs/content/locales/pt-BR/voice-input.mdx +6 -0
  1681. package/docs/content/locales/pt-BR/workspace-connections.mdx +9 -2
  1682. package/docs/content/locales/pt-BR/workspace.mdx +19 -18
  1683. package/docs/content/locales/zh-CN/actions.mdx +2 -2
  1684. package/docs/content/locales/zh-CN/agent-native-toolkit.mdx +2 -2
  1685. package/docs/content/locales/zh-CN/agent-surfaces.mdx +8 -10
  1686. package/docs/content/locales/zh-CN/agent-teams.mdx +1 -0
  1687. package/docs/content/locales/zh-CN/authentication.mdx +1 -1
  1688. package/docs/content/locales/zh-CN/components.mdx +11 -1
  1689. package/docs/content/locales/zh-CN/creating-templates.mdx +3 -7
  1690. package/docs/content/locales/zh-CN/cross-app-sso.mdx +16 -6
  1691. package/docs/content/locales/zh-CN/deployment.mdx +8 -0
  1692. package/docs/content/locales/zh-CN/extensions.mdx +6 -0
  1693. package/docs/content/locales/zh-CN/external-agents.mdx +2 -7
  1694. package/docs/content/locales/zh-CN/key-concepts.mdx +13 -20
  1695. package/docs/content/locales/zh-CN/messaging.mdx +78 -15
  1696. package/docs/content/locales/zh-CN/multi-tenancy.mdx +5 -5
  1697. package/docs/content/locales/zh-CN/notifications.mdx +18 -10
  1698. package/docs/content/locales/zh-CN/processors.mdx +11 -5
  1699. package/docs/content/locales/zh-CN/server.mdx +16 -10
  1700. package/docs/content/locales/zh-CN/sharing.mdx +10 -10
  1701. package/docs/content/locales/zh-CN/skills-guide.mdx +34 -17
  1702. package/docs/content/locales/zh-CN/template-assets.mdx +16 -13
  1703. package/docs/content/locales/zh-CN/template-brain.mdx +3 -1
  1704. package/docs/content/locales/zh-CN/template-clips.mdx +4 -4
  1705. package/docs/content/locales/zh-CN/template-design.mdx +4 -1
  1706. package/docs/content/locales/zh-CN/template-dispatch.mdx +5 -1
  1707. package/docs/content/locales/zh-CN/template-mail.mdx +8 -0
  1708. package/docs/content/locales/zh-CN/tracking.mdx +9 -6
  1709. package/docs/content/locales/zh-CN/using-your-agent.mdx +0 -7
  1710. package/docs/content/locales/zh-CN/voice-input.mdx +6 -0
  1711. package/docs/content/locales/zh-CN/workspace-connections.mdx +9 -2
  1712. package/docs/content/locales/zh-CN/workspace.mdx +19 -18
  1713. package/docs/content/locales/zh-TW/actions.mdx +2 -2
  1714. package/docs/content/locales/zh-TW/agent-native-toolkit.mdx +2 -2
  1715. package/docs/content/locales/zh-TW/agent-surfaces.mdx +8 -10
  1716. package/docs/content/locales/zh-TW/agent-teams.mdx +1 -0
  1717. package/docs/content/locales/zh-TW/authentication.mdx +1 -1
  1718. package/docs/content/locales/zh-TW/components.mdx +11 -1
  1719. package/docs/content/locales/zh-TW/creating-templates.mdx +3 -7
  1720. package/docs/content/locales/zh-TW/cross-app-sso.mdx +16 -6
  1721. package/docs/content/locales/zh-TW/deployment.mdx +8 -0
  1722. package/docs/content/locales/zh-TW/extensions.mdx +6 -0
  1723. package/docs/content/locales/zh-TW/external-agents.mdx +2 -7
  1724. package/docs/content/locales/zh-TW/key-concepts.mdx +13 -20
  1725. package/docs/content/locales/zh-TW/messaging.mdx +78 -15
  1726. package/docs/content/locales/zh-TW/multi-tenancy.mdx +5 -5
  1727. package/docs/content/locales/zh-TW/notifications.mdx +18 -10
  1728. package/docs/content/locales/zh-TW/processors.mdx +11 -5
  1729. package/docs/content/locales/zh-TW/server.mdx +16 -10
  1730. package/docs/content/locales/zh-TW/sharing.mdx +10 -10
  1731. package/docs/content/locales/zh-TW/skills-guide.mdx +34 -17
  1732. package/docs/content/locales/zh-TW/template-assets.mdx +16 -13
  1733. package/docs/content/locales/zh-TW/template-brain.mdx +3 -1
  1734. package/docs/content/locales/zh-TW/template-clips.mdx +4 -4
  1735. package/docs/content/locales/zh-TW/template-design.mdx +4 -1
  1736. package/docs/content/locales/zh-TW/template-dispatch.mdx +5 -1
  1737. package/docs/content/locales/zh-TW/template-mail.mdx +8 -0
  1738. package/docs/content/locales/zh-TW/tracking.mdx +9 -6
  1739. package/docs/content/locales/zh-TW/using-your-agent.mdx +0 -7
  1740. package/docs/content/locales/zh-TW/voice-input.mdx +6 -0
  1741. package/docs/content/locales/zh-TW/workspace-connections.mdx +9 -2
  1742. package/docs/content/locales/zh-TW/workspace.mdx +19 -18
  1743. package/docs/content/mcp-apps.mdx +14 -32
  1744. package/docs/content/mcp-clients.mdx +48 -54
  1745. package/docs/content/mcp-protocol.mdx +25 -10
  1746. package/docs/content/messaging.mdx +238 -48
  1747. package/docs/content/multi-app-workspace.mdx +11 -96
  1748. package/docs/content/multi-tenancy.mdx +5 -5
  1749. package/docs/content/native-chat-ui.mdx +4 -4
  1750. package/docs/content/notifications.mdx +19 -12
  1751. package/docs/content/observability.mdx +2 -4
  1752. package/docs/content/observational-memory.mdx +7 -3
  1753. package/docs/content/onboarding.mdx +9 -2
  1754. package/docs/content/plan-plugin.mdx +10 -2
  1755. package/docs/content/pr-visual-recap.mdx +1 -1
  1756. package/docs/content/processors.mdx +11 -5
  1757. package/docs/content/pure-agent-apps.mdx +5 -1
  1758. package/docs/content/real-time-collaboration.mdx +30 -67
  1759. package/docs/content/recurring-jobs.mdx +8 -6
  1760. package/docs/content/routing.mdx +3 -4
  1761. package/docs/content/sandbox-adapters.mdx +30 -53
  1762. package/docs/content/security.mdx +8 -0
  1763. package/docs/content/server.mdx +17 -10
  1764. package/docs/content/sharing.mdx +10 -10
  1765. package/docs/content/skills-guide.mdx +35 -16
  1766. package/docs/content/template-analytics.mdx +11 -8
  1767. package/docs/content/template-assets.mdx +16 -13
  1768. package/docs/content/template-brain.mdx +3 -1
  1769. package/docs/content/template-calendar.mdx +12 -4
  1770. package/docs/content/template-chat.mdx +4 -4
  1771. package/docs/content/template-clips.mdx +6 -3
  1772. package/docs/content/template-content.mdx +23 -18
  1773. package/docs/content/template-design.mdx +7 -1
  1774. package/docs/content/template-dispatch.mdx +5 -1
  1775. package/docs/content/template-mail.mdx +14 -2
  1776. package/docs/content/template-plan.mdx +22 -15
  1777. package/docs/content/template-slides.mdx +11 -3
  1778. package/docs/content/toolkit-agent-ux.mdx +46 -3
  1779. package/docs/content/toolkit-collaboration.mdx +58 -4
  1780. package/docs/content/toolkit-command-navigation.mdx +8 -2
  1781. package/docs/content/toolkit-comments-review.mdx +10 -2
  1782. package/docs/content/toolkit-history.mdx +8 -3
  1783. package/docs/content/toolkit-observability.mdx +48 -2
  1784. package/docs/content/toolkit-org-team.mdx +8 -2
  1785. package/docs/content/toolkit-resources.mdx +45 -2
  1786. package/docs/content/toolkit-settings.mdx +8 -2
  1787. package/docs/content/toolkit-setup-connections.mdx +7 -2
  1788. package/docs/content/toolkit-sharing.mdx +46 -3
  1789. package/docs/content/toolkit-ui.mdx +82 -11
  1790. package/docs/content/tracking.mdx +10 -8
  1791. package/docs/content/using-your-agent.mdx +0 -12
  1792. package/docs/content/voice-input.mdx +7 -1
  1793. package/docs/content/what-is-agent-native.mdx +7 -8
  1794. package/docs/content/workspace-connections.mdx +16 -23
  1795. package/docs/content/workspace-management.mdx +16 -4
  1796. package/docs/content/workspace.mdx +19 -18
  1797. package/package.json +5 -1
  1798. package/src/templates/default/.agents/skills/capture-learnings/SKILL.md +22 -9
  1799. package/src/templates/default/AGENTS.md +7 -3
  1800. package/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +1 -1
  1801. package/src/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +22 -9
  1802. package/src/templates/workspace-core/.agents/skills/extension-points/SKILL.md +6 -3
  1803. package/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +25 -0
  1804. package/src/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +15 -0
  1805. package/src/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +39 -5
  1806. package/src/templates/workspace-core/AGENTS.md +3 -2
  1807. package/corpus/core/docs/content/locales/ar-SA/migration-workbench.mdx +0 -76
  1808. package/corpus/core/docs/content/locales/de-DE/migration-workbench.mdx +0 -76
  1809. package/corpus/core/docs/content/locales/es-ES/migration-workbench.mdx +0 -76
  1810. package/corpus/core/docs/content/locales/fr-FR/migration-workbench.mdx +0 -76
  1811. package/corpus/core/docs/content/locales/hi-IN/migration-workbench.mdx +0 -74
  1812. package/corpus/core/docs/content/locales/ja-JP/migration-workbench.mdx +0 -76
  1813. package/corpus/core/docs/content/locales/ko-KR/migration-workbench.mdx +0 -74
  1814. package/corpus/core/docs/content/locales/pt-BR/migration-workbench.mdx +0 -76
  1815. package/corpus/core/docs/content/locales/zh-CN/migration-workbench.mdx +0 -74
  1816. package/corpus/core/docs/content/locales/zh-TW/migration-workbench.mdx +0 -74
  1817. package/corpus/core/docs/content/migration-workbench.mdx +0 -74
  1818. package/corpus/core/docs/content/toolkit-app-adapters.mdx +0 -55
  1819. package/corpus/core/docs/content/toolkit-collaboration-ui.mdx +0 -60
  1820. package/corpus/core/docs/content/toolkit-sharing-ui.mdx +0 -45
  1821. package/corpus/core/docs/content/toolkit-shell-hooks.mdx +0 -36
  1822. package/docs/content/locales/ar-SA/migration-workbench.mdx +0 -76
  1823. package/docs/content/locales/de-DE/migration-workbench.mdx +0 -76
  1824. package/docs/content/locales/es-ES/migration-workbench.mdx +0 -76
  1825. package/docs/content/locales/fr-FR/migration-workbench.mdx +0 -76
  1826. package/docs/content/locales/hi-IN/migration-workbench.mdx +0 -74
  1827. package/docs/content/locales/ja-JP/migration-workbench.mdx +0 -76
  1828. package/docs/content/locales/ko-KR/migration-workbench.mdx +0 -74
  1829. package/docs/content/locales/pt-BR/migration-workbench.mdx +0 -76
  1830. package/docs/content/locales/zh-CN/migration-workbench.mdx +0 -74
  1831. package/docs/content/locales/zh-TW/migration-workbench.mdx +0 -74
  1832. package/docs/content/migration-workbench.mdx +0 -74
  1833. package/docs/content/toolkit-app-adapters.mdx +0 -55
  1834. package/docs/content/toolkit-collaboration-ui.mdx +0 -60
  1835. package/docs/content/toolkit-sharing-ui.mdx +0 -45
  1836. package/docs/content/toolkit-shell-hooks.mdx +0 -36
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/a2a/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAS5D,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IACnC,MAAM,CAAS;IACf,QAAQ,CAAO;IACf,SAAS,CAAS;IAClB,SAAS,CAAS;IAE3B,YAAY,MAAc,EAAE,QAAc,EAAE,SAAiB;QAC3D,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC;QACxC,KAAK,CACH,YAAY,MAAM,4BAA4B,SAAS,mBAAmB,SAAS,GAAG,CACvF,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;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AAC,OAAgB;IAC1C,OAAO,OAAO,CAAC,KAAK;SACjB,MAAM,CAAC,CAAC,CAAC,EAAuC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC;SACrE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;SAClB,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC","sourcesContent":["import * as jose from \"jose\";\n\nimport { ssrfSafeFetch } from \"../extensions/url-safety.js\";\nimport type {\n AgentCard,\n JsonRpcRequest,\n JsonRpcResponse,\n Message,\n Task,\n} from \"./types.js\";\n\nexport class A2ATaskTimeoutError extends Error {\n readonly taskId: string;\n readonly lastTask: Task;\n readonly lastState: string;\n readonly timeoutMs: number;\n\n constructor(taskId: string, lastTask: Task, timeoutMs: number) {\n const lastState = lastTask.status.state;\n super(\n `A2A task ${taskId} did not complete within ${timeoutMs}ms (last state: ${lastState})`,\n );\n this.name = \"A2ATaskTimeoutError\";\n this.taskId = taskId;\n this.lastTask = lastTask;\n this.lastState = lastState;\n this.timeoutMs = timeoutMs;\n }\n}\n\n/**\n * Sign a JWT for A2A cross-app identity verification.\n *\n * Uses an org-level secret by default for direct org-secret workflows. Callers\n * that are doing ordinary hosted cross-app delegation can set\n * `preferGlobalSecret` so deployments with a shared A2A_SECRET don't depend on\n * every app database having an identical org row. The token contains the\n * caller's email as `sub`, so the receiving app can verify who's calling.\n */\nexport async function signA2AToken(\n email: string,\n orgDomain?: string,\n orgSecret?: string,\n options?: {\n expiresIn?: string | number;\n preferGlobalSecret?: boolean;\n audience?: string | string[];\n /**\n * Extra JWT claims to merge alongside `sub` / `org_domain`. Used by the\n * MCP connect flow to add a revocable `jti` and a `scope: \"mcp-connect\"`\n * marker. Reserved claims (`sub`, `org_domain`) cannot be overridden —\n * they are spread last so a caller can never spoof identity via this map.\n */\n extraClaims?: Record<string, unknown>;\n },\n): Promise<string> {\n const secret = options?.preferGlobalSecret\n ? process.env.A2A_SECRET || orgSecret\n : orgSecret || process.env.A2A_SECRET;\n if (!secret) {\n throw new Error(\n \"No A2A secret available. Set an org-level A2A secret in Team settings, \" +\n \"or set A2A_SECRET as an environment variable on all apps that need to verify identity.\",\n );\n }\n\n const appUrl =\n process.env.APP_URL ||\n process.env.BETTER_AUTH_URL ||\n \"http://localhost:3000\";\n\n const jwt = new jose.SignJWT({\n ...(options?.extraClaims ?? {}),\n // `sub` / `org_domain` are spread AFTER extraClaims so a caller-supplied\n // map can never override the verified identity claims.\n sub: email,\n ...(orgDomain ? { org_domain: orgDomain } : {}),\n })\n .setProtectedHeader({ alg: \"HS256\" })\n .setIssuer(appUrl)\n .setIssuedAt()\n .setExpirationTime(options?.expiresIn ?? \"15m\");\n\n if (options?.audience) jwt.setAudience(options.audience);\n\n return jwt.sign(new TextEncoder().encode(secret));\n}\n\nexport function shouldPreferGlobalA2ASecret(orgSecret?: string): boolean {\n return !!process.env.A2A_SECRET?.trim() || !orgSecret;\n}\n\nexport class A2AClient {\n private baseUrl: string;\n private apiKey?: string;\n private apiKeyAttempts: Array<string | undefined>;\n private endpointCandidates: string[] = [];\n private endpointResolved = false;\n private requestTimeoutMs?: number;\n\n constructor(\n baseUrl: string,\n apiKey?: string,\n options?: { requestTimeoutMs?: number; fallbackApiKeys?: string[] },\n ) {\n const normalized = baseUrl.replace(/\\/$/, \"\");\n const explicitEndpoint = splitExplicitA2AEndpoint(normalized);\n this.baseUrl = explicitEndpoint?.baseUrl ?? normalized;\n if (explicitEndpoint) {\n this.endpointCandidates = [explicitEndpoint.endpointUrl];\n this.endpointResolved = true;\n }\n this.apiKey = apiKey;\n this.apiKeyAttempts = uniqueAuthTokens([\n apiKey,\n ...(options?.fallbackApiKeys ?? []),\n ]);\n this.requestTimeoutMs = options?.requestTimeoutMs;\n }\n\n /**\n * Detect which A2A path the target agent uses.\n * Agent-native apps use /_agent-native/a2a, external agents may use /a2a.\n */\n async resolveEndpoint(): Promise<void> {\n await this.ensureEndpointCandidates();\n if (this.endpointCandidates.length <= 1) return;\n\n for (const endpoint of this.endpointCandidates) {\n try {\n const res = await ssrfSafeFetch(\n endpoint,\n { method: \"OPTIONS\" },\n { maxRedirects: 3 },\n );\n if (res.status !== 404 && res.status !== 405) {\n this.endpointCandidates = [endpoint];\n return;\n }\n if (res.status === 405) {\n this.endpointCandidates = [endpoint];\n return;\n }\n } catch {\n // Try the next candidate.\n }\n }\n }\n\n private headers(apiKey = this.apiKey): Record<string, string> {\n const h: Record<string, string> = { \"Content-Type\": \"application/json\" };\n if (apiKey) {\n h[\"Authorization\"] = `Bearer ${apiKey}`;\n }\n return h;\n }\n\n private markApiKeySucceeded(apiKey: string | undefined) {\n this.apiKey = apiKey;\n this.apiKeyAttempts = uniqueAuthTokens([\n apiKey,\n ...this.apiKeyAttempts.filter((token) => token !== apiKey),\n ]);\n }\n\n private async rpc(\n method: string,\n params: Record<string, unknown>,\n ): Promise<JsonRpcResponse> {\n const body: JsonRpcRequest = {\n jsonrpc: \"2.0\",\n id: Date.now(),\n method,\n params,\n };\n\n await this.ensureEndpointCandidates();\n let lastError: Error | null = null;\n\n for (const url of this.endpointCandidates) {\n for (let i = 0; i < this.apiKeyAttempts.length; i++) {\n console.log(`[A2A Client] POST ${url} method=${method}`);\n const startTime = Date.now();\n const res = await this.postJson(url, body, this.apiKeyAttempts[i]);\n console.log(\n `[A2A Client] Response: ${res.status} in ${Date.now() - startTime}ms`,\n );\n\n if (res.ok) {\n this.endpointCandidates = [url];\n this.markApiKeySucceeded(this.apiKeyAttempts[i]);\n return res.json() as Promise<JsonRpcResponse>;\n }\n\n const text = await res.text();\n lastError = new Error(`A2A request failed (${res.status}): ${text}`);\n if (\n i < this.apiKeyAttempts.length - 1 &&\n isA2AAuthRejectionResponse(res.status, text)\n ) {\n continue;\n }\n if (!shouldTryNextEndpoint(res.status)) {\n throw lastError;\n }\n break;\n }\n }\n\n throw lastError ?? new Error(\"No A2A endpoint candidates available\");\n }\n\n async getAgentCard(): Promise<AgentCard> {\n const res = await ssrfSafeFetch(\n `${this.baseUrl}/.well-known/agent-card.json`,\n {},\n { maxRedirects: 3 },\n );\n if (!res.ok) {\n throw new Error(`Failed to fetch agent card (${res.status})`);\n }\n return res.json() as Promise<AgentCard>;\n }\n\n async send(\n message: Message,\n opts?: {\n contextId?: string;\n metadata?: Record<string, unknown>;\n /**\n * If true, ask the server to return the task immediately in `working`\n * state and process the handler in the background. The caller should\n * then poll `getTask(taskId)` until `completed` / `failed` / `canceled`.\n *\n * Use this when you expect the handler may exceed a synchronous\n * serverless request budget.\n */\n async?: boolean;\n },\n ): Promise<Task> {\n const response = await this.rpc(\"message/send\", {\n message,\n contextId: opts?.contextId,\n metadata: opts?.metadata,\n ...(opts?.async ? { async: true } : {}),\n });\n\n if (response.error) {\n throw new Error(\n `A2A error (${response.error.code}): ${response.error.message}`,\n );\n }\n\n return response.result as Task;\n }\n\n /**\n * Poll for a task by id. Used in async mode after `send({ async: true })`.\n */\n async getTask(taskId: string): Promise<Task> {\n const response = await this.rpc(\"tasks/get\", { id: taskId });\n if (response.error) {\n throw new Error(\n `A2A error (${response.error.code}): ${response.error.message}`,\n );\n }\n return response.result as Task;\n }\n\n /**\n * Send a message in async mode and poll until the task reaches a terminal\n * state. This is the recommended path on serverless hosts with short\n * function timeouts (Netlify, Vercel) where a synchronous LLM-driven A2A\n * call can exceed the gateway limit.\n *\n * Each individual fetch returns quickly; long-running work happens on the\n * receiving side and is checked via `tasks/get`.\n */\n async sendAndWait(\n message: Message,\n opts?: {\n contextId?: string;\n metadata?: Record<string, unknown>;\n /** Total time to wait for completion. Default 5 min. */\n timeoutMs?: number;\n /** Poll interval. Default 2s. */\n pollIntervalMs?: number;\n /** Called with each polled task — useful for surfacing progress. */\n onUpdate?: (task: Task) => void;\n },\n ): Promise<Task> {\n const submitted = await this.send(message, {\n contextId: opts?.contextId,\n metadata: opts?.metadata,\n async: true,\n });\n\n const terminalStates = new Set([\"completed\", \"failed\", \"canceled\"]);\n if (terminalStates.has(submitted.status.state)) return submitted;\n\n const timeoutMs = opts?.timeoutMs ?? 5 * 60_000;\n const pollMs = opts?.pollIntervalMs ?? 2_000;\n const deadline = Date.now() + timeoutMs;\n\n let current = submitted;\n while (Date.now() < deadline) {\n await new Promise((r) => setTimeout(r, pollMs));\n try {\n current = await this.getTask(submitted.id);\n opts?.onUpdate?.(current);\n } catch {\n // Transient fetch failure — keep polling until the deadline.\n continue;\n }\n if (terminalStates.has(current.status.state)) return current;\n }\n throw new A2ATaskTimeoutError(submitted.id, current, timeoutMs);\n }\n\n async *stream(\n message: Message,\n opts?: { contextId?: string; metadata?: Record<string, unknown> },\n ): AsyncGenerator<Task> {\n const body: JsonRpcRequest = {\n jsonrpc: \"2.0\",\n id: Date.now(),\n method: \"message/stream\",\n params: {\n message,\n contextId: opts?.contextId,\n metadata: opts?.metadata,\n },\n };\n\n await this.ensureEndpointCandidates();\n let res: Response | null = null;\n let lastError: Error | null = null;\n for (const candidate of this.endpointCandidates) {\n for (let i = 0; i < this.apiKeyAttempts.length; i++) {\n res = await this.postJson(candidate, body, this.apiKeyAttempts[i]);\n if (res.ok) {\n this.endpointCandidates = [candidate];\n this.markApiKeySucceeded(this.apiKeyAttempts[i]);\n break;\n }\n const text = await res.text();\n lastError = new Error(`A2A stream failed (${res.status}): ${text}`);\n if (\n i < this.apiKeyAttempts.length - 1 &&\n isA2AAuthRejectionResponse(res.status, text)\n ) {\n continue;\n }\n if (!shouldTryNextEndpoint(res.status)) throw lastError;\n break;\n }\n if (res?.ok) break;\n }\n if (!res?.ok) {\n throw lastError ?? new Error(\"No A2A endpoint candidates available\");\n }\n\n const reader = res.body?.getReader();\n if (!reader) throw new Error(\"No response body\");\n\n const decoder = new TextDecoder();\n let buffer = \"\";\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split(\"\\n\");\n buffer = lines.pop() ?? \"\";\n\n for (const line of lines) {\n if (!line.startsWith(\"data: \")) continue;\n const json = line.slice(6).trim();\n if (!json) continue;\n\n const response: JsonRpcResponse = JSON.parse(json);\n if (response.error) {\n throw new Error(\n `A2A error (${response.error.code}): ${response.error.message}`,\n );\n }\n if (response.result) {\n yield response.result as Task;\n }\n }\n }\n }\n\n private async ensureEndpointCandidates(): Promise<void> {\n if (this.endpointResolved) return;\n this.endpointResolved = true;\n\n const candidates: string[] = [];\n addDefaultEndpointCandidates(candidates, this.baseUrl);\n\n try {\n const card = await this.getAgentCard();\n const cardUrl = normalizeUrl(card.url, this.baseUrl);\n if (cardUrl) {\n const explicitEndpoint = splitExplicitA2AEndpoint(cardUrl);\n if (explicitEndpoint) {\n candidates.unshift(explicitEndpoint.endpointUrl);\n } else {\n addDefaultEndpointCandidates(candidates, cardUrl);\n }\n }\n } catch {\n // Agent cards are discovery hints. Fall back to conventional endpoints.\n }\n\n this.endpointCandidates = unique(candidates);\n }\n\n private async postJson(\n url: string,\n body: JsonRpcRequest,\n apiKey = this.apiKey,\n ): Promise<Response> {\n const controller = this.requestTimeoutMs\n ? new AbortController()\n : undefined;\n const timer =\n controller && this.requestTimeoutMs\n ? setTimeout(() => controller.abort(), this.requestTimeoutMs)\n : undefined;\n try {\n return await ssrfSafeFetch(\n url,\n {\n method: \"POST\",\n headers: this.headers(apiKey),\n body: JSON.stringify(body),\n signal: controller?.signal,\n },\n { maxRedirects: 3 },\n );\n } finally {\n if (timer) clearTimeout(timer);\n }\n }\n}\n\nfunction splitExplicitA2AEndpoint(\n url: string,\n): { baseUrl: string; endpointUrl: string } | null {\n try {\n const parsed = new URL(url);\n const pathname = parsed.pathname.replace(/\\/$/, \"\");\n if (pathname.endsWith(\"/_agent-native/a2a\")) {\n parsed.pathname = pathname.slice(0, -\"/_agent-native/a2a\".length) || \"/\";\n parsed.search = \"\";\n parsed.hash = \"\";\n return {\n baseUrl: parsed.toString().replace(/\\/$/, \"\"),\n endpointUrl: url,\n };\n }\n if (pathname.endsWith(\"/a2a\")) {\n parsed.pathname = pathname.slice(0, -\"/a2a\".length) || \"/\";\n parsed.search = \"\";\n parsed.hash = \"\";\n return {\n baseUrl: parsed.toString().replace(/\\/$/, \"\"),\n endpointUrl: url,\n };\n }\n } catch {\n // Relative or invalid URLs are handled by the caller's normal fetch path.\n }\n return null;\n}\n\nfunction addDefaultEndpointCandidates(candidates: string[], baseUrl: string) {\n const base = baseUrl.replace(/\\/$/, \"\");\n candidates.push(`${base}/_agent-native/a2a`, `${base}/a2a`);\n}\n\nfunction normalizeUrl(\n value: string | undefined,\n baseUrl: string,\n): string | null {\n if (!value) return null;\n try {\n return new URL(value, `${baseUrl.replace(/\\/$/, \"\")}/`)\n .toString()\n .replace(/\\/$/, \"\");\n } catch {\n return null;\n }\n}\n\nfunction shouldTryNextEndpoint(status: number): boolean {\n return status === 404 || status === 405;\n}\n\nfunction unique(values: string[]): string[] {\n return Array.from(new Set(values));\n}\n\nfunction uniqueAuthTokens(\n values: Array<string | undefined>,\n): Array<string | undefined> {\n const result: Array<string | undefined> = [];\n for (const value of values) {\n if (result.includes(value)) continue;\n result.push(value);\n }\n if (result.length === 0) result.push(undefined);\n return result;\n}\n\nfunction isA2AAuthRejectionResponse(status: number, text: string): boolean {\n return (\n status === 401 ||\n /A2A error \\(-32001\\): (?:Invalid or expired A2A token|Invalid API key|Authentication required)|Invalid or expired A2A token|Invalid API key|Authentication required/i.test(\n text,\n )\n );\n}\n\n/**\n * One-shot convenience function: send a text message and get a text response.\n *\n * When A2A_SECRET is set and userEmail is provided, outbound calls are signed\n * with a JWT so the receiving app can cryptographically verify the caller's\n * identity (instead of blindly trusting metadata).\n */\nexport async function callAgent(\n url: string,\n text: string,\n opts?: {\n apiKey?: string;\n contextId?: string;\n userEmail?: string;\n orgDomain?: string;\n orgSecret?: string;\n /**\n * Use async/poll instead of a single blocking POST. Recommended for\n * cross-app calls that may exceed a synchronous serverless request budget.\n * Defaults to true so callers get safe behavior out of the box.\n */\n async?: boolean;\n /** Total time to wait for the polled task (default 5 min). */\n timeoutMs?: number;\n /** Poll interval for async calls. Primarily useful for tests/retries. */\n pollIntervalMs?: number;\n },\n): Promise<string> {\n const metadata: Record<string, unknown> = {};\n if (opts?.userEmail) metadata.userEmail = opts.userEmail;\n if (opts?.orgDomain) metadata.orgDomain = opts.orgDomain;\n\n // Default to async + poll. The receiving A2A server's `_process-task` route\n // runs the handler in a fresh function execution (cross-platform queue\n // pattern), so async mode now works on every host instead of relying on\n // detached promises that get killed on Netlify/Vercel. Callers that\n // explicitly want a single-shot blocking POST can pass `async: false`.\n const useAsync = opts?.async ?? true;\n const message: Message = {\n role: \"user\",\n parts: [{ type: \"text\", text }],\n };\n\n const apiKeyAttempts = await buildA2AApiKeyAttempts(opts);\n let lastAuthError: unknown;\n\n for (let i = 0; i < apiKeyAttempts.length; i++) {\n try {\n const fallbackApiKeys = apiKeyAttempts\n .slice(i + 1)\n .filter((token): token is string => token !== undefined);\n const client = new A2AClient(url, apiKeyAttempts[i], {\n fallbackApiKeys,\n });\n let task: Task;\n if (useAsync) {\n task = await client.sendAndWait(message, {\n contextId: opts?.contextId,\n metadata,\n timeoutMs: opts?.timeoutMs,\n pollIntervalMs: opts?.pollIntervalMs,\n });\n } else {\n task = await client.send(message, {\n contextId: opts?.contextId,\n metadata,\n });\n }\n\n // Extract text from the response\n const responseMessage = task.status.message;\n if (responseMessage) {\n const textParts = responseMessage.parts\n .filter((p): p is { type: \"text\"; text: string } => p.type === \"text\")\n .map((p) => p.text);\n return textParts.join(\"\\n\");\n }\n\n return \"\";\n } catch (err) {\n if (err instanceof A2ATaskTimeoutError) {\n const recoverableText = extractRecoverableArtifactText(err.lastTask);\n if (recoverableText) return recoverableText;\n }\n if (i < apiKeyAttempts.length - 1 && isA2AAuthRejection(err)) {\n lastAuthError = err;\n continue;\n }\n throw err;\n }\n }\n\n if (lastAuthError) throw lastAuthError;\n return \"\";\n}\n\nasync function buildA2AApiKeyAttempts(opts?: {\n apiKey?: string;\n userEmail?: string;\n orgDomain?: string;\n orgSecret?: string;\n}): Promise<Array<string | undefined>> {\n const attempts: Array<string | undefined> = [];\n const add = (token: string | undefined) => {\n if (token === undefined || attempts.includes(token)) return;\n attempts.push(token);\n };\n\n add(opts?.apiKey);\n\n if (opts?.userEmail && (opts.orgSecret || process.env.A2A_SECRET)) {\n if (process.env.A2A_SECRET?.trim()) {\n try {\n add(\n await signA2AToken(opts.userEmail, opts.orgDomain, opts.orgSecret, {\n preferGlobalSecret: true,\n }),\n );\n } catch {\n // Keep any explicit token attempt, then fall back below.\n }\n }\n\n if (opts.orgSecret) {\n try {\n add(\n await signA2AToken(opts.userEmail, opts.orgDomain, opts.orgSecret, {\n preferGlobalSecret: false,\n }),\n );\n } catch {\n // Fall through to the attempts we already have.\n }\n }\n }\n\n if (attempts.length === 0) attempts.push(undefined);\n return attempts;\n}\n\nfunction isA2AAuthRejection(err: unknown): boolean {\n const message = err instanceof Error ? err.message : String(err ?? \"\");\n return /A2A request failed \\(401\\)|A2A error \\(-32001\\): (?:Invalid or expired A2A token|Invalid API key|Authentication required)|Invalid or expired A2A token|Invalid API key|Authentication required/i.test(\n message,\n );\n}\n\nfunction extractRecoverableArtifactText(task: Task): string {\n if (!task.status.message?.metadata?.agentNativeRecoverableArtifacts) {\n return \"\";\n }\n return extractMessageText(task.status.message);\n}\n\nfunction extractMessageText(message: Message): string {\n return message.parts\n .filter((p): p is { type: \"text\"; text: string } => p.type === \"text\")\n .map((p) => p.text)\n .join(\"\\n\");\n}\n"]}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/a2a/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAS5D,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IACnC,MAAM,CAAS;IACf,QAAQ,CAAO;IACf,SAAS,CAAS;IAClB,SAAS,CAAS;IAE3B,YAAY,MAAc,EAAE,QAAc,EAAE,SAAiB;QAC3D,M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AAED,SAAS,8BAA8B,CAAC,IAAU;IAChD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,+BAA+B,EAAE,CAAC;QACpE,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACjD,CAAC;AAED,SAAS,kBAAkB,CAAC,OAAgB;IAC1C,OAAO,OAAO,CAAC,KAAK;SACjB,MAAM,CAAC,CAAC,CAAC,EAAuC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC;SACrE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;SAClB,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC","sourcesContent":["import * as jose from \"jose\";\n\nimport { ssrfSafeFetch } from \"../extensions/url-safety.js\";\nimport type {\n AgentCard,\n JsonRpcRequest,\n JsonRpcResponse,\n Message,\n Task,\n} from \"./types.js\";\n\nexport class A2ATaskTimeoutError extends Error {\n readonly taskId: string;\n readonly lastTask: Task;\n readonly lastState: string;\n readonly timeoutMs: number;\n\n constructor(taskId: string, lastTask: Task, timeoutMs: number) {\n const lastState = lastTask.status.state;\n super(\n `A2A task ${taskId} did not complete within ${timeoutMs}ms (last state: ${lastState})`,\n );\n this.name = \"A2ATaskTimeoutError\";\n this.taskId = taskId;\n this.lastTask = lastTask;\n this.lastState = lastState;\n this.timeoutMs = timeoutMs;\n }\n}\n\n/**\n * Sign a JWT for A2A cross-app identity verification.\n *\n * Uses an org-level secret by default for direct org-secret workflows. Callers\n * that are doing ordinary hosted cross-app delegation can set\n * `preferGlobalSecret` so deployments with a shared A2A_SECRET don't depend on\n * every app database having an identical org row. The token contains the\n * caller's email as `sub`, so the receiving app can verify who's calling.\n */\nexport async function signA2AToken(\n email: string,\n orgDomain?: string,\n orgSecret?: string,\n options?: {\n expiresIn?: string | number;\n preferGlobalSecret?: boolean;\n audience?: string | string[];\n /**\n * Extra JWT claims to merge alongside `sub` / `org_domain`. Used by the\n * MCP connect flow to add a revocable `jti` and a `scope: \"mcp-connect\"`\n * marker. Reserved claims (`sub`, `org_domain`) cannot be overridden —\n * they are spread last so a caller can never spoof identity via this map.\n */\n extraClaims?: Record<string, unknown>;\n },\n): Promise<string> {\n const secret = options?.preferGlobalSecret\n ? process.env.A2A_SECRET || orgSecret\n : orgSecret || process.env.A2A_SECRET;\n if (!secret) {\n throw new Error(\n \"No A2A secret available. Set an org-level A2A secret in Team settings, \" +\n \"or set A2A_SECRET as an environment variable on all apps that need to verify identity.\",\n );\n }\n\n const appUrl =\n process.env.APP_URL ||\n process.env.BETTER_AUTH_URL ||\n \"http://localhost:3000\";\n\n const jwt = new jose.SignJWT({\n ...(options?.extraClaims ?? {}),\n // `sub` / `org_domain` are spread AFTER extraClaims so a caller-supplied\n // map can never override the verified identity claims.\n sub: email,\n ...(orgDomain ? { org_domain: orgDomain } : {}),\n })\n .setProtectedHeader({ alg: \"HS256\" })\n .setIssuer(appUrl)\n .setIssuedAt()\n .setExpirationTime(options?.expiresIn ?? \"15m\");\n\n if (options?.audience) jwt.setAudience(options.audience);\n\n return jwt.sign(new TextEncoder().encode(secret));\n}\n\nexport function shouldPreferGlobalA2ASecret(orgSecret?: string): boolean {\n return !!process.env.A2A_SECRET?.trim() || !orgSecret;\n}\n\nexport class A2AClient {\n private baseUrl: string;\n private apiKey?: string;\n private apiKeyAttempts: Array<string | undefined>;\n private endpointCandidates: string[] = [];\n private endpointResolved = false;\n private requestTimeoutMs?: number;\n\n constructor(\n baseUrl: string,\n apiKey?: string,\n options?: { requestTimeoutMs?: number; fallbackApiKeys?: string[] },\n ) {\n const normalized = baseUrl.replace(/\\/$/, \"\");\n const explicitEndpoint = splitExplicitA2AEndpoint(normalized);\n this.baseUrl = explicitEndpoint?.baseUrl ?? normalized;\n if (explicitEndpoint) {\n this.endpointCandidates = [explicitEndpoint.endpointUrl];\n this.endpointResolved = true;\n }\n this.apiKey = apiKey;\n this.apiKeyAttempts = uniqueAuthTokens([\n apiKey,\n ...(options?.fallbackApiKeys ?? []),\n ]);\n this.requestTimeoutMs = options?.requestTimeoutMs;\n }\n\n /**\n * Detect which A2A path the target agent uses.\n * Agent-native apps use /_agent-native/a2a, external agents may use /a2a.\n */\n async resolveEndpoint(): Promise<void> {\n await this.ensureEndpointCandidates();\n if (this.endpointCandidates.length <= 1) return;\n\n for (const endpoint of this.endpointCandidates) {\n try {\n const res = await ssrfSafeFetch(\n endpoint,\n { method: \"OPTIONS\" },\n { maxRedirects: 3 },\n );\n if (res.status !== 404 && res.status !== 405) {\n this.endpointCandidates = [endpoint];\n return;\n }\n if (res.status === 405) {\n this.endpointCandidates = [endpoint];\n return;\n }\n } catch {\n // Try the next candidate.\n }\n }\n }\n\n private headers(apiKey = this.apiKey): Record<string, string> {\n const h: Record<string, string> = { \"Content-Type\": \"application/json\" };\n if (apiKey) {\n h[\"Authorization\"] = `Bearer ${apiKey}`;\n }\n return h;\n }\n\n private markApiKeySucceeded(apiKey: string | undefined) {\n this.apiKey = apiKey;\n this.apiKeyAttempts = uniqueAuthTokens([\n apiKey,\n ...this.apiKeyAttempts.filter((token) => token !== apiKey),\n ]);\n }\n\n private async rpc(\n method: string,\n params: Record<string, unknown>,\n ): Promise<JsonRpcResponse> {\n const body: JsonRpcRequest = {\n jsonrpc: \"2.0\",\n id: Date.now(),\n method,\n params,\n };\n\n await this.ensureEndpointCandidates();\n let lastError: Error | null = null;\n\n for (const url of this.endpointCandidates) {\n for (let i = 0; i < this.apiKeyAttempts.length; i++) {\n console.log(`[A2A Client] POST ${url} method=${method}`);\n const startTime = Date.now();\n const res = await this.postJson(url, body, this.apiKeyAttempts[i]);\n console.log(\n `[A2A Client] Response: ${res.status} in ${Date.now() - startTime}ms`,\n );\n\n if (res.ok) {\n this.endpointCandidates = [url];\n this.markApiKeySucceeded(this.apiKeyAttempts[i]);\n return res.json() as Promise<JsonRpcResponse>;\n }\n\n const text = await res.text();\n lastError = new Error(`A2A request failed (${res.status}): ${text}`);\n if (\n i < this.apiKeyAttempts.length - 1 &&\n isA2AAuthRejectionResponse(res.status, text)\n ) {\n continue;\n }\n if (!shouldTryNextEndpoint(res.status)) {\n throw lastError;\n }\n break;\n }\n }\n\n throw lastError ?? new Error(\"No A2A endpoint candidates available\");\n }\n\n async getAgentCard(): Promise<AgentCard> {\n const res = await ssrfSafeFetch(\n `${this.baseUrl}/.well-known/agent-card.json`,\n {},\n { maxRedirects: 3 },\n );\n if (!res.ok) {\n throw new Error(`Failed to fetch agent card (${res.status})`);\n }\n return res.json() as Promise<AgentCard>;\n }\n\n async send(\n message: Message,\n opts?: {\n contextId?: string;\n metadata?: Record<string, unknown>;\n /**\n * If true, ask the server to return the task immediately in `working`\n * state and process the handler in the background. The caller should\n * then poll `getTask(taskId)` until `completed` / `failed` / `canceled`.\n *\n * Use this when you expect the handler may exceed a synchronous\n * serverless request budget.\n */\n async?: boolean;\n },\n ): Promise<Task> {\n const response = await this.rpc(\"message/send\", {\n message,\n contextId: opts?.contextId,\n metadata: opts?.metadata,\n ...(opts?.async ? { async: true } : {}),\n });\n\n if (response.error) {\n throw new Error(\n `A2A error (${response.error.code}): ${response.error.message}`,\n );\n }\n\n return response.result as Task;\n }\n\n /**\n * Poll for a task by id. Used in async mode after `send({ async: true })`.\n */\n async getTask(taskId: string): Promise<Task> {\n const response = await this.rpc(\"tasks/get\", { id: taskId });\n if (response.error) {\n throw new Error(\n `A2A error (${response.error.code}): ${response.error.message}`,\n );\n }\n return response.result as Task;\n }\n\n /**\n * Send a message in async mode and poll until the task reaches a terminal\n * state. This is the recommended path on serverless hosts with short\n * function timeouts (Netlify, Vercel) where a synchronous LLM-driven A2A\n * call can exceed the gateway limit.\n *\n * Each individual fetch returns quickly; long-running work happens on the\n * receiving side and is checked via `tasks/get`.\n */\n async sendAndWait(\n message: Message,\n opts?: {\n contextId?: string;\n metadata?: Record<string, unknown>;\n /** Total time to wait for completion. Default 5 min. */\n timeoutMs?: number;\n /** Poll interval. Default 2s. */\n pollIntervalMs?: number;\n /** Called with each polled task — useful for surfacing progress. */\n onUpdate?: (task: Task) => void;\n },\n ): Promise<Task> {\n const submitted = await this.send(message, {\n contextId: opts?.contextId,\n metadata: opts?.metadata,\n async: true,\n });\n\n const terminalStates = new Set([\"completed\", \"failed\", \"canceled\"]);\n if (terminalStates.has(submitted.status.state)) return submitted;\n\n const timeoutMs = opts?.timeoutMs ?? 5 * 60_000;\n const pollMs = opts?.pollIntervalMs ?? 2_000;\n const deadline = Date.now() + timeoutMs;\n\n let current = submitted;\n while (Date.now() < deadline) {\n await new Promise((r) => setTimeout(r, pollMs));\n try {\n current = await this.getTask(submitted.id);\n opts?.onUpdate?.(current);\n } catch {\n // Transient fetch failure — keep polling until the deadline.\n continue;\n }\n if (terminalStates.has(current.status.state)) return current;\n }\n throw new A2ATaskTimeoutError(submitted.id, current, timeoutMs);\n }\n\n async *stream(\n message: Message,\n opts?: { contextId?: string; metadata?: Record<string, unknown> },\n ): AsyncGenerator<Task> {\n const body: JsonRpcRequest = {\n jsonrpc: \"2.0\",\n id: Date.now(),\n method: \"message/stream\",\n params: {\n message,\n contextId: opts?.contextId,\n metadata: opts?.metadata,\n },\n };\n\n await this.ensureEndpointCandidates();\n let res: Response | null = null;\n let lastError: Error | null = null;\n for (const candidate of this.endpointCandidates) {\n for (let i = 0; i < this.apiKeyAttempts.length; i++) {\n res = await this.postJson(candidate, body, this.apiKeyAttempts[i]);\n if (res.ok) {\n this.endpointCandidates = [candidate];\n this.markApiKeySucceeded(this.apiKeyAttempts[i]);\n break;\n }\n const text = await res.text();\n lastError = new Error(`A2A stream failed (${res.status}): ${text}`);\n if (\n i < this.apiKeyAttempts.length - 1 &&\n isA2AAuthRejectionResponse(res.status, text)\n ) {\n continue;\n }\n if (!shouldTryNextEndpoint(res.status)) throw lastError;\n break;\n }\n if (res?.ok) break;\n }\n if (!res?.ok) {\n throw lastError ?? new Error(\"No A2A endpoint candidates available\");\n }\n\n const reader = res.body?.getReader();\n if (!reader) throw new Error(\"No response body\");\n\n const decoder = new TextDecoder();\n let buffer = \"\";\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split(\"\\n\");\n buffer = lines.pop() ?? \"\";\n\n for (const line of lines) {\n if (!line.startsWith(\"data: \")) continue;\n const json = line.slice(6).trim();\n if (!json) continue;\n\n const response: JsonRpcResponse = JSON.parse(json);\n if (response.error) {\n throw new Error(\n `A2A error (${response.error.code}): ${response.error.message}`,\n );\n }\n if (response.result) {\n yield response.result as Task;\n }\n }\n }\n }\n\n private async ensureEndpointCandidates(): Promise<void> {\n if (this.endpointResolved) return;\n this.endpointResolved = true;\n\n const candidates: string[] = [];\n addDefaultEndpointCandidates(candidates, this.baseUrl);\n\n try {\n const card = await this.getAgentCard();\n const cardUrl = normalizeUrl(card.url, this.baseUrl);\n if (cardUrl) {\n const explicitEndpoint = splitExplicitA2AEndpoint(cardUrl);\n if (explicitEndpoint) {\n candidates.unshift(explicitEndpoint.endpointUrl);\n } else {\n addDefaultEndpointCandidates(candidates, cardUrl);\n }\n }\n } catch {\n // Agent cards are discovery hints. Fall back to conventional endpoints.\n }\n\n this.endpointCandidates = unique(candidates);\n }\n\n private async postJson(\n url: string,\n body: JsonRpcRequest,\n apiKey = this.apiKey,\n ): Promise<Response> {\n const controller = this.requestTimeoutMs\n ? new AbortController()\n : undefined;\n const timer =\n controller && this.requestTimeoutMs\n ? setTimeout(() => controller.abort(), this.requestTimeoutMs)\n : undefined;\n try {\n return await ssrfSafeFetch(\n url,\n {\n method: \"POST\",\n headers: this.headers(apiKey),\n body: JSON.stringify(body),\n signal: controller?.signal,\n },\n { maxRedirects: 3 },\n );\n } finally {\n if (timer) clearTimeout(timer);\n }\n }\n}\n\nfunction splitExplicitA2AEndpoint(\n url: string,\n): { baseUrl: string; endpointUrl: string } | null {\n try {\n const parsed = new URL(url);\n const pathname = parsed.pathname.replace(/\\/$/, \"\");\n if (pathname.endsWith(\"/_agent-native/a2a\")) {\n parsed.pathname = pathname.slice(0, -\"/_agent-native/a2a\".length) || \"/\";\n parsed.search = \"\";\n parsed.hash = \"\";\n return {\n baseUrl: parsed.toString().replace(/\\/$/, \"\"),\n endpointUrl: url,\n };\n }\n if (pathname.endsWith(\"/a2a\")) {\n parsed.pathname = pathname.slice(0, -\"/a2a\".length) || \"/\";\n parsed.search = \"\";\n parsed.hash = \"\";\n return {\n baseUrl: parsed.toString().replace(/\\/$/, \"\"),\n endpointUrl: url,\n };\n }\n } catch {\n // Relative or invalid URLs are handled by the caller's normal fetch path.\n }\n return null;\n}\n\nfunction addDefaultEndpointCandidates(candidates: string[], baseUrl: string) {\n const base = baseUrl.replace(/\\/$/, \"\");\n candidates.push(`${base}/_agent-native/a2a`, `${base}/a2a`);\n}\n\nfunction normalizeUrl(\n value: string | undefined,\n baseUrl: string,\n): string | null {\n if (!value) return null;\n try {\n return new URL(value, `${baseUrl.replace(/\\/$/, \"\")}/`)\n .toString()\n .replace(/\\/$/, \"\");\n } catch {\n return null;\n }\n}\n\nfunction shouldTryNextEndpoint(status: number): boolean {\n return status === 404 || status === 405;\n}\n\nfunction unique(values: string[]): string[] {\n return Array.from(new Set(values));\n}\n\nfunction uniqueAuthTokens(\n values: Array<string | undefined>,\n): Array<string | undefined> {\n const result: Array<string | undefined> = [];\n for (const value of values) {\n if (result.includes(value)) continue;\n result.push(value);\n }\n if (result.length === 0) result.push(undefined);\n return result;\n}\n\nfunction isA2AAuthRejectionResponse(status: number, text: string): boolean {\n return (\n status === 401 ||\n /A2A error \\(-32001\\): (?:Invalid or expired A2A token|Invalid API key|Authentication required)|Invalid or expired A2A token|Invalid API key|Authentication required/i.test(\n text,\n )\n );\n}\n\n/**\n * One-shot convenience function: send a text message and get a text response.\n *\n * When A2A_SECRET is set and userEmail is provided, outbound calls are signed\n * with a JWT so the receiving app can cryptographically verify the caller's\n * identity (instead of blindly trusting metadata).\n */\nexport async function callAgent(\n url: string,\n text: string,\n opts?: {\n apiKey?: string;\n contextId?: string;\n userEmail?: string;\n orgDomain?: string;\n orgSecret?: string;\n /**\n * Use async/poll instead of a single blocking POST. Recommended for\n * cross-app calls that may exceed a synchronous serverless request budget.\n * Defaults to true so callers get safe behavior out of the box.\n */\n async?: boolean;\n /** Total time to wait for the polled task (default 5 min). */\n timeoutMs?: number;\n /** Poll interval for async calls. Primarily useful for tests/retries. */\n pollIntervalMs?: number;\n /**\n * Called with each successfully polled task while an async call is still\n * in flight (see `A2AClient.sendAndWait`). Fires once per real poll\n * round-trip that returns a task — including the terminal poll — so\n * callers can surface genuine remote liveness/progress. Not called when a\n * poll fetch throws (remote unresponsive) or when the task completes\n * synchronously on submit. Only threaded through for async calls.\n */\n onUpdate?: (task: Task) => void;\n },\n): Promise<string> {\n const metadata: Record<string, unknown> = {};\n if (opts?.userEmail) metadata.userEmail = opts.userEmail;\n if (opts?.orgDomain) metadata.orgDomain = opts.orgDomain;\n\n // Default to async + poll. The receiving A2A server's `_process-task` route\n // runs the handler in a fresh function execution (cross-platform queue\n // pattern), so async mode now works on every host instead of relying on\n // detached promises that get killed on Netlify/Vercel. Callers that\n // explicitly want a single-shot blocking POST can pass `async: false`.\n const useAsync = opts?.async ?? true;\n const message: Message = {\n role: \"user\",\n parts: [{ type: \"text\", text }],\n };\n\n const apiKeyAttempts = await buildA2AApiKeyAttempts(opts);\n let lastAuthError: unknown;\n\n for (let i = 0; i < apiKeyAttempts.length; i++) {\n try {\n const fallbackApiKeys = apiKeyAttempts\n .slice(i + 1)\n .filter((token): token is string => token !== undefined);\n const client = new A2AClient(url, apiKeyAttempts[i], {\n fallbackApiKeys,\n });\n let task: Task;\n if (useAsync) {\n task = await client.sendAndWait(message, {\n contextId: opts?.contextId,\n metadata,\n timeoutMs: opts?.timeoutMs,\n pollIntervalMs: opts?.pollIntervalMs,\n onUpdate: opts?.onUpdate,\n });\n } else {\n task = await client.send(message, {\n contextId: opts?.contextId,\n metadata,\n });\n }\n\n // Extract text from the response\n const responseMessage = task.status.message;\n if (responseMessage) {\n const textParts = responseMessage.parts\n .filter((p): p is { type: \"text\"; text: string } => p.type === \"text\")\n .map((p) => p.text);\n return textParts.join(\"\\n\");\n }\n\n return \"\";\n } catch (err) {\n if (err instanceof A2ATaskTimeoutError) {\n const recoverableText = extractRecoverableArtifactText(err.lastTask);\n if (recoverableText) return recoverableText;\n }\n if (i < apiKeyAttempts.length - 1 && isA2AAuthRejection(err)) {\n lastAuthError = err;\n continue;\n }\n throw err;\n }\n }\n\n if (lastAuthError) throw lastAuthError;\n return \"\";\n}\n\nasync function buildA2AApiKeyAttempts(opts?: {\n apiKey?: string;\n userEmail?: string;\n orgDomain?: string;\n orgSecret?: string;\n}): Promise<Array<string | undefined>> {\n const attempts: Array<string | undefined> = [];\n const add = (token: string | undefined) => {\n if (token === undefined || attempts.includes(token)) return;\n attempts.push(token);\n };\n\n add(opts?.apiKey);\n\n if (opts?.userEmail && (opts.orgSecret || process.env.A2A_SECRET)) {\n if (process.env.A2A_SECRET?.trim()) {\n try {\n add(\n await signA2AToken(opts.userEmail, opts.orgDomain, opts.orgSecret, {\n preferGlobalSecret: true,\n }),\n );\n } catch {\n // Keep any explicit token attempt, then fall back below.\n }\n }\n\n if (opts.orgSecret) {\n try {\n add(\n await signA2AToken(opts.userEmail, opts.orgDomain, opts.orgSecret, {\n preferGlobalSecret: false,\n }),\n );\n } catch {\n // Fall through to the attempts we already have.\n }\n }\n }\n\n if (attempts.length === 0) attempts.push(undefined);\n return attempts;\n}\n\nfunction isA2AAuthRejection(err: unknown): boolean {\n const message = err instanceof Error ? err.message : String(err ?? \"\");\n return /A2A request failed \\(401\\)|A2A error \\(-32001\\): (?:Invalid or expired A2A token|Invalid API key|Authentication required)|Invalid or expired A2A token|Invalid API key|Authentication required/i.test(\n message,\n );\n}\n\nfunction extractRecoverableArtifactText(task: Task): string {\n if (!task.status.message?.metadata?.agentNativeRecoverableArtifacts) {\n return \"\";\n }\n return extractMessageText(task.status.message);\n}\n\nfunction extractMessageText(message: Message): string {\n return message.parts\n .filter((p): p is { type: \"text\"; text: string } => p.type === \"text\")\n .map((p) => p.text)\n .join(\"\\n\");\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/a2a/handlers.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,SAAS,EAIT,eAAe,EAGhB,MAAM,YAAY,CAAC;AAsFpB;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,SAAS,EACjB,KAAK,CAAC,EAAE,GAAG,GACV,OAAO,CAAC,IAAI,CAAC,CAwEf;AA8nBD;;;GAGG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,GAAG,EACT,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,SAAS,GAChB,OAAO,CAAC,eAAe,CAAC,CAyC1B"}
1
+ {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/a2a/handlers.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EACV,SAAS,EAIT,eAAe,EAGhB,MAAM,YAAY,CAAC;AAwCpB;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,SAAS,EACjB,KAAK,CAAC,EAAE,GAAG,GACV,OAAO,CAAC,IAAI,CAAC,CAwEf;AAioBD;;;GAGG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,GAAG,EACT,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,SAAS,GAChB,OAAO,CAAC,eAAe,CAAC,CAyC1B"}
@@ -1,6 +1,7 @@
1
1
  import { setResponseHeader, setResponseStatus } from "h3";
2
- import { signInternalToken } from "../integrations/internal-token.js";
2
+ import { AGENT_BACKGROUND_PROCESSOR_A2A, AGENT_BACKGROUND_PROCESSOR_FIELD, dispatchPathTargetsNetlifyBackgroundFunction, isAgentChatDurableBackgroundEnabled, resolveAgentChatProcessRunDispatchPath, } from "../agent/durable-background.js";
3
3
  import { withConfiguredAppBasePath } from "../server/app-base-path.js";
4
+ import { fireInternalDispatch } from "../server/self-dispatch.js";
4
5
  import { agentChat } from "../shared/agent-chat.js";
5
6
  import { hasConfiguredA2ASecret, isA2AProductionRuntime, } from "./auth-policy.js";
6
7
  import { createTask, getTask, getTaskOwner, updateTask, claimA2ATaskForProcessing, getA2ATaskDispatchState, failStuckA2ATask, touchQueuedA2ATaskDispatch, touchProcessingA2ATask, } from "./task-store.js";
@@ -12,73 +13,27 @@ const A2A_QUEUED_DISPATCH_STUCK_AFTER_MS = 10_000;
12
13
  const A2A_PROCESSING_STUCK_AFTER_MS = 5 * 60 * 1000;
13
14
  const A2A_PROCESSING_HEARTBEAT_MS = 30_000;
14
15
  /**
15
- * Resolve the base URL we should fire the A2A processor request to. Mirrors
16
- * the integration-webhook resolveBaseUrl pattern prefer explicit env vars
17
- * (most reliable on serverless), fall back to inbound request headers.
16
+ * Dispatch an async A2A task to a fresh function execution. Apps that opted
17
+ * into durable background runs reuse the emitted Netlify 15-minute worker;
18
+ * other hosts and apps retain the normal portable self-webhook route.
18
19
  */
19
- function resolveSelfBaseUrl(event) {
20
- const fromEnv = process.env.APP_URL ||
21
- process.env.URL ||
22
- process.env.DEPLOY_URL ||
23
- process.env.BETTER_AUTH_URL;
24
- if (fromEnv)
25
- return withConfiguredAppBasePath(String(fromEnv));
26
- if (isA2AProductionRuntime()) {
27
- throw new Error("A2A self-dispatch requires APP_URL, URL, DEPLOY_URL, or BETTER_AUTH_URL in production.");
28
- }
29
- try {
30
- const headers = event?.node?.req?.headers ?? event?.headers;
31
- const get = (name) => {
32
- if (!headers)
33
- return undefined;
34
- if (typeof headers.get === "function") {
35
- return headers.get(name) ?? undefined;
20
+ async function fireProcessTaskDispatch(event, taskId, config) {
21
+ const backgroundPath = resolveAgentChatProcessRunDispatchPath();
22
+ const useBackgroundWorker = isAgentChatDurableBackgroundEnabled({
23
+ appOptIn: config.durableBackgroundRuns === true,
24
+ }) && dispatchPathTargetsNetlifyBackgroundFunction(backgroundPath);
25
+ await fireInternalDispatch({
26
+ event,
27
+ path: useBackgroundWorker ? backgroundPath : A2A_PROCESS_TASK_PATH,
28
+ taskId,
29
+ ...(useBackgroundWorker
30
+ ? {
31
+ body: {
32
+ [AGENT_BACKGROUND_PROCESSOR_FIELD]: AGENT_BACKGROUND_PROCESSOR_A2A,
33
+ },
36
34
  }
37
- const map = headers;
38
- return map[name] ?? map[String(name).toLowerCase()];
39
- };
40
- const proto = get("x-forwarded-proto") || "http";
41
- const host = get("host") || `localhost:${process.env.PORT || 3000}`;
42
- return withConfiguredAppBasePath(`${proto}://${host}`);
43
- }
44
- catch {
45
- return withConfiguredAppBasePath(`http://localhost:${process.env.PORT || 3000}`);
46
- }
47
- }
48
- /**
49
- * Fire-and-forget POST to the A2A processor route on the same deployment.
50
- * Used when an A2A send is requested in async mode — the processor runs the
51
- * handler in a fresh function execution so it gets its own full timeout.
52
- */
53
- async function fireProcessTaskDispatch(event, taskId) {
54
- const baseUrl = resolveSelfBaseUrl(event);
55
- const url = `${baseUrl}${A2A_PROCESS_TASK_PATH}`;
56
- const headers = {
57
- "Content-Type": "application/json",
58
- };
59
- try {
60
- headers["Authorization"] = `Bearer ${signInternalToken(taskId)}`;
61
- }
62
- catch {
63
- // No A2A_SECRET configured — self-fire unsigned. The processor accepts
64
- // unsigned dispatches when no secret is set (mirrors the integration
65
- // webhook flow).
66
- }
67
- // Race the fetch against a short timer. On Netlify Lambda, returning
68
- // immediately can freeze the function before the outbound TCP handshake
69
- // starts, leaving the request stuck. This gives it ~250ms to leave the
70
- // box at the cost of slightly higher response latency on async A2A sends.
71
- const dispatchPromise = fetch(url, {
72
- method: "POST",
73
- headers,
74
- body: JSON.stringify({ taskId }),
75
- }).catch((err) => {
76
- console.error("[a2a] Process-task dispatch fetch failed:", err);
35
+ : {}),
77
36
  });
78
- await Promise.race([
79
- dispatchPromise,
80
- new Promise((resolve) => setTimeout(resolve, 250)),
81
- ]);
82
37
  }
83
38
  /**
84
39
  * Process a previously-enqueued A2A task. Called by the `_process-task`
@@ -375,7 +330,7 @@ async function handleSend(params, config, event) {
375
330
  };
376
331
  const task = await createTask(message, contextId, taskMetadata, ownerEmailForTask);
377
332
  const working = await updateTask(task.id, { state: "working" });
378
- fireProcessTaskDispatch(event, task.id).catch((err) => {
333
+ fireProcessTaskDispatch(event, task.id, config).catch((err) => {
379
334
  console.error("[a2a] Failed to dispatch process-task:", err);
380
335
  });
381
336
  return { ...jsonRpcResult(0, working ?? task), _id: 0 };
@@ -562,7 +517,7 @@ async function handleGet(params, event, config) {
562
517
  if (!task) {
563
518
  return jsonRpcError(0, -32001, "Task not found");
564
519
  }
565
- const taskChanged = await refireStuckAsyncTaskIfNeeded(id, event).catch((err) => {
520
+ const taskChanged = await refireStuckAsyncTaskIfNeeded(id, event, config).catch((err) => {
566
521
  console.error("[a2a] Failed to refire stuck async task:", err);
567
522
  return false;
568
523
  });
@@ -573,7 +528,7 @@ async function handleGet(params, event, config) {
573
528
  }
574
529
  return jsonRpcResult(0, sanitizeTaskForResponse(task));
575
530
  }
576
- async function refireStuckAsyncTaskIfNeeded(taskId, event) {
531
+ async function refireStuckAsyncTaskIfNeeded(taskId, event, config) {
577
532
  const state = await getA2ATaskDispatchState(taskId);
578
533
  if (!state)
579
534
  return false;
@@ -583,7 +538,7 @@ async function refireStuckAsyncTaskIfNeeded(taskId, event) {
583
538
  if ((state.statusState === "submitted" || state.statusState === "working") &&
584
539
  state.updatedAt <= now - A2A_QUEUED_DISPATCH_STUCK_AFTER_MS) {
585
540
  if (await touchQueuedA2ATaskDispatch(taskId)) {
586
- await fireProcessTaskDispatch(event, taskId);
541
+ await fireProcessTaskDispatch(event, taskId, config);
587
542
  return true;
588
543
  }
589
544
  return false;
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../src/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AAK,EAAE,yBAAyB,CAAC,CAAC;YAC7D,CAAC;YACD,8CAA8C;YAC9C,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC;YAC5B,IAAI,CAAC,GAAG,EAAE,CAAC;gBACT,OAAO,YAAY,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,yBAAyB,CAAC,CAAC;YAC7D,CAAC;YACD,iBAAiB,CAAC,KAAK,EAAE,cAAc,EAAE,mBAAmB,CAAC,CAAC;YAC9D,iBAAiB,CAAC,KAAK,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC;YACtD,iBAAiB,CAAC,KAAK,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;YACrD,MAAM,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;YAC/C,OAAO,SAAgB,CAAC,CAAC,gCAAgC;QAC3D,CAAC;QACD,KAAK,WAAW,EAAE,CAAC;YACjB,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;YACtD,OAAO,EAAE,GAAG,MAAM,EAAE,EAAE,EAAqB,CAAC;QAC9C,CAAC;QACD,KAAK,cAAc,EAAE,CAAC;YACpB,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;YACzD,OAAO,EAAE,GAAG,MAAM,EAAE,EAAE,EAAqB,CAAC;QAC9C,CAAC;QACD;YACE,OAAO,YAAY,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,qBAAqB,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IACxE,CAAC;AACH,CAAC","sourcesContent":["import { setResponseHeader, setResponseStatus } from \"h3\";\n\nimport { signInternalToken } from \"../integrations/internal-token.js\";\nimport { withConfiguredAppBasePath } from \"../server/app-base-path.js\";\nimport { agentChat } from \"../shared/agent-chat.js\";\nimport {\n hasConfiguredA2ASecret,\n isA2AProductionRuntime,\n} from \"./auth-policy.js\";\nimport {\n createTask,\n getTask,\n getTaskOwner,\n updateTask,\n claimA2ATaskForProcessing,\n getA2ATaskDispatchState,\n failStuckA2ATask,\n touchQueuedA2ATaskDispatch,\n touchProcessingA2ATask,\n} from \"./task-store.js\";\nimport type {\n A2AConfig,\n A2AHandler,\n A2AHandlerContext,\n A2AHandlerResult,\n JsonRpcResponse,\n Message,\n Artifact,\n} from \"./types.js\";\n\n// Inlined to avoid pulling the entire core-routes-plugin (and its h3\n// transitive deps) into the a2a/handlers test boundary. Must stay in sync\n// with FRAMEWORK_ROUTE_PREFIX in `server/core-routes-plugin.ts`.\nconst A2A_PROCESS_TASK_PATH = \"/_agent-native/a2a/_process-task\";\nconst A2A_QUEUED_DISPATCH_STUCK_AFTER_MS = 10_000;\nconst A2A_PROCESSING_STUCK_AFTER_MS = 5 * 60 * 1000;\nconst A2A_PROCESSING_HEARTBEAT_MS = 30_000;\n\n/**\n * Resolve the base URL we should fire the A2A processor request to. Mirrors\n * the integration-webhook resolveBaseUrl pattern — prefer explicit env vars\n * (most reliable on serverless), fall back to inbound request headers.\n */\nfunction resolveSelfBaseUrl(event: any | undefined): string {\n const fromEnv =\n process.env.APP_URL ||\n process.env.URL ||\n process.env.DEPLOY_URL ||\n process.env.BETTER_AUTH_URL;\n if (fromEnv) return withConfiguredAppBasePath(String(fromEnv));\n if (isA2AProductionRuntime()) {\n throw new Error(\n \"A2A self-dispatch requires APP_URL, URL, DEPLOY_URL, or BETTER_AUTH_URL in production.\",\n );\n }\n\n try {\n const headers = event?.node?.req?.headers ?? event?.headers;\n const get = (name: string): string | undefined => {\n if (!headers) return undefined;\n if (typeof headers.get === \"function\") {\n return headers.get(name) ?? undefined;\n }\n const map = headers as Record<string, string | undefined>;\n return map[name] ?? map[String(name).toLowerCase()];\n };\n const proto = get(\"x-forwarded-proto\") || \"http\";\n const host = get(\"host\") || `localhost:${process.env.PORT || 3000}`;\n return withConfiguredAppBasePath(`${proto}://${host}`);\n } catch {\n return withConfiguredAppBasePath(\n `http://localhost:${process.env.PORT || 3000}`,\n );\n }\n}\n\n/**\n * Fire-and-forget POST to the A2A processor route on the same deployment.\n * Used when an A2A send is requested in async mode — the processor runs the\n * handler in a fresh function execution so it gets its own full timeout.\n */\nasync function fireProcessTaskDispatch(\n event: any,\n taskId: string,\n): Promise<void> {\n const baseUrl = resolveSelfBaseUrl(event);\n const url = `${baseUrl}${A2A_PROCESS_TASK_PATH}`;\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n };\n try {\n headers[\"Authorization\"] = `Bearer ${signInternalToken(taskId)}`;\n } catch {\n // No A2A_SECRET configured — self-fire unsigned. The processor accepts\n // unsigned dispatches when no secret is set (mirrors the integration\n // webhook flow).\n }\n // Race the fetch against a short timer. On Netlify Lambda, returning\n // immediately can freeze the function before the outbound TCP handshake\n // starts, leaving the request stuck. This gives it ~250ms to leave the\n // box at the cost of slightly higher response latency on async A2A sends.\n const dispatchPromise = fetch(url, {\n method: \"POST\",\n headers,\n body: JSON.stringify({ taskId }),\n }).catch((err) => {\n console.error(\"[a2a] Process-task dispatch fetch failed:\", err);\n });\n await Promise.race([\n dispatchPromise,\n new Promise<void>((resolve) => setTimeout(resolve, 250)),\n ]);\n}\n\n/**\n * Process a previously-enqueued A2A task. Called by the `_process-task`\n * route in `server.ts`, in a fresh function execution. Atomically claims the\n * task, reconstructs the caller's request context from the task's metadata,\n * runs the handler, and persists the outcome.\n *\n * Idempotent on duplicate dispatches: the atomic claim returns null if some\n * other invocation already picked the task up, in which case we no-op.\n */\nexport async function processA2ATaskFromQueue(\n taskId: string,\n config: A2AConfig,\n event?: any,\n): Promise<void> {\n const claimed = await claimA2ATaskForProcessing(taskId);\n if (!claimed) {\n // Already in flight, terminal, or missing. Nothing to do.\n return;\n }\n\n const message = claimed.history?.[0];\n if (!message) {\n await updateTask(taskId, {\n state: \"failed\",\n message: {\n role: \"agent\",\n parts: [{ type: \"text\", text: \"Task is missing its inbound message\" }],\n },\n });\n return;\n }\n\n const meta = (claimed.metadata ?? {}) as Record<string, unknown>;\n const processorMeta = (meta.__a2a_processor ?? {}) as Record<string, unknown>;\n const verifiedEmail = processorMeta.verifiedEmail as string | undefined;\n const orgDomainHint = processorMeta.orgDomainHint as string | undefined;\n const contextId =\n (processorMeta.contextId as string | null | undefined) ?? undefined;\n const callerMetadata =\n (processorMeta.callerMetadata as\n | Record<string, unknown>\n | null\n | undefined) ?? undefined;\n\n const resolvedOrgId = await resolveVerifiedA2AOrgId(\n verifiedEmail,\n orgDomainHint,\n );\n\n const { runWithRequestContext } =\n await import(\"../server/request-context.js\");\n const heartbeat = setInterval(() => {\n touchProcessingA2ATask(taskId).catch((err) =>\n console.error(\"[a2a] Failed to heartbeat async task:\", err),\n );\n }, A2A_PROCESSING_HEARTBEAT_MS);\n (\n heartbeat as ReturnType<typeof setInterval> & { unref?: () => void }\n ).unref?.();\n try {\n await runWithRequestContext(\n { userEmail: verifiedEmail, orgId: resolvedOrgId },\n () =>\n runHandlerAndPersist(\n taskId,\n message,\n config,\n contextId,\n callerMetadata,\n event,\n ),\n );\n } catch (err: any) {\n try {\n await updateTask(taskId, {\n state: \"failed\",\n message: {\n role: \"agent\",\n parts: [{ type: \"text\", text: err?.message ?? \"Handler crashed\" }],\n },\n });\n } catch {}\n } finally {\n clearInterval(heartbeat);\n }\n}\n\n/**\n * Default A2A handler that delegates to agentChat.call().\n * Used when no custom handler is provided in A2AConfig.\n */\nconst defaultHandler: A2AHandler = async (\n message: Message,\n _context: A2AHandlerContext,\n): Promise<A2AHandlerResult> => {\n // Extract text from message parts\n const text = message.parts\n .filter((p): p is { type: \"text\"; text: string } => p.type === \"text\")\n .map((p) => p.text)\n .join(\"\\n\");\n\n if (!text) {\n return {\n message: {\n role: \"agent\",\n parts: [{ type: \"text\", text: \"No text content in message\" }],\n },\n };\n }\n\n // A2A note: this message arrived from a different app — the caller cannot\n // see this app's local state (open deck, selected slide, etc.). They only\n // see whatever this agent puts into the reply text. So:\n // 1) include any concrete result (deck/document/dashboard URL, ID, value)\n // explicitly in the reply — the caller can't navigate locally.\n // 2) URLs must be fully-qualified — relative paths resolve against the\n // caller's host and 404.\n // We prepend a one-line hint to the user message so the agent knows.\n const baseUrl = process.env.APP_URL || process.env.URL || \"\";\n const appBaseUrl = baseUrl ? withConfiguredAppBasePath(baseUrl) : \"\";\n const augmentedText = baseUrl\n ? `[Cross-app A2A request — the caller is on a different host (${appBaseUrl} is yours, theirs is different). Include the concrete result (URL, ID, value) explicitly in your reply text; the caller can't see your local UI state. Any URL MUST be fully-qualified, never a relative path.]\\n\\n${text}`\n : text;\n\n const result = await agentChat.call(augmentedText);\n\n const artifacts: Artifact[] = [];\n if (result.filesChanged.length > 0) {\n artifacts.push({\n name: \"files-changed\",\n description: \"Files modified by the agent\",\n parts: [{ type: \"data\", data: { files: result.filesChanged } }],\n });\n }\n\n return {\n message: {\n role: \"agent\",\n parts: [\n { type: \"text\", text: result.response },\n ...(result.warnings?.length\n ? [\n {\n type: \"text\" as const,\n text: `\\n\\nWarnings:\\n${result.warnings.join(\"\\n\")}`,\n },\n ]\n : []),\n ],\n },\n artifacts: artifacts.length > 0 ? artifacts : undefined,\n };\n};\n\nfunction getHandler(config: A2AConfig): A2AHandler {\n return config.handler ?? defaultHandler;\n}\n\nfunction jsonRpcError(\n id: string | number | null,\n code: number,\n message: string,\n): JsonRpcResponse {\n return { jsonrpc: \"2.0\", id, error: { code, message } };\n}\n\nfunction jsonRpcResult(id: string | number, result: unknown): JsonRpcResponse {\n return { jsonrpc: \"2.0\", id, result };\n}\n\nfunction makeHandlerContext(\n taskId: string,\n contextId?: string,\n metadata?: Record<string, unknown>,\n event?: any,\n): {\n context: A2AHandlerContext;\n artifacts: Artifact[];\n} {\n const artifacts: Artifact[] = [];\n const context: A2AHandlerContext = {\n taskId,\n contextId,\n metadata,\n event,\n writeArtifact(name, content, mimeType) {\n const artifact: Artifact = {\n name,\n parts: mimeType\n ? [\n {\n type: \"file\",\n file: {\n name,\n mimeType,\n bytes: Buffer.from(content).toString(\"base64\"),\n },\n },\n ]\n : [{ type: \"text\", text: content }],\n };\n artifacts.push(artifact);\n return name;\n },\n };\n return { context, artifacts };\n}\n\n/**\n * Resolve org context from A2A metadata / event context and wrap `fn`\n * inside `runWithRequestContext` so downstream actions see the org.\n */\nasync function withA2ARequestContext<T>(\n _metadata: Record<string, unknown> | undefined,\n event: any | undefined,\n fn: () => Promise<T>,\n): Promise<T> {\n const { runWithRequestContext } =\n await import(\"../server/request-context.js\");\n\n const verifiedEmail =\n (event?.context?.__a2aVerifiedEmail as string | undefined) ?? undefined;\n // Only trust the org domain from the cryptographically verified JWT claim on\n // the event context. metadata.orgDomain is caller-supplied and must not be\n // used for org resolution — an unauthenticated caller could forge it and\n // gain access to another org's data.\n const orgDomain =\n (event?.context?.__a2aOrgDomain as string | undefined) ?? undefined;\n\n const resolvedOrgId = await resolveVerifiedA2AOrgId(verifiedEmail, orgDomain);\n\n return runWithRequestContext(\n { userEmail: verifiedEmail, orgId: resolvedOrgId },\n fn,\n ) as Promise<T>;\n}\n\nasync function resolveVerifiedA2AOrgId(\n verifiedEmail: string | undefined,\n verifiedOrgDomain: string | undefined,\n): Promise<string | undefined> {\n if (verifiedOrgDomain) {\n try {\n const { resolveOrgByDomain } = await import(\"../org/context.js\");\n const org = await resolveOrgByDomain(verifiedOrgDomain);\n if (org) return org.orgId;\n } catch {\n // Org tables may not exist — continue without org context\n }\n }\n\n if (verifiedEmail) {\n try {\n const { resolveOrgIdForEmail } = await import(\"../org/context.js\");\n return (await resolveOrgIdForEmail(verifiedEmail)) ?? undefined;\n } catch {\n // Org tables may not exist — continue without org context\n }\n }\n\n return undefined;\n}\n\n/**\n * Run the handler against the message and persist the outcome to the task store.\n * Used in sync mode (awaited inline) and in async mode (called by the\n * `_process-task` processor route in a fresh function execution).\n */\nasync function runHandlerAndPersist(\n taskId: string,\n message: Message,\n config: A2AConfig,\n contextId: string | undefined,\n metadata: Record<string, unknown> | undefined,\n event?: any,\n): Promise<void> {\n const { context, artifacts } = makeHandlerContext(\n taskId,\n contextId,\n metadata,\n event,\n );\n try {\n const result = getHandler(config)(message, context);\n\n if (\n result &&\n typeof result === \"object\" &&\n Symbol.asyncIterator in result\n ) {\n let lastMessage: Message | undefined;\n for await (const msg of result as AsyncGenerator<Message>) {\n lastMessage = msg;\n }\n await updateTask(taskId, {\n state: \"completed\",\n message: lastMessage,\n artifacts: artifacts.length > 0 ? artifacts : undefined,\n });\n return;\n }\n\n const handlerResult = await (result as Promise<A2AHandlerResult>);\n const allArtifacts = [...artifacts, ...(handlerResult.artifacts ?? [])];\n await updateTask(taskId, {\n state: \"completed\",\n message: handlerResult.message,\n artifacts: allArtifacts.length > 0 ? allArtifacts : undefined,\n });\n } catch (err: any) {\n await updateTask(taskId, {\n state: \"failed\",\n message: {\n role: \"agent\",\n parts: [{ type: \"text\", text: err?.message ?? \"Handler failed\" }],\n },\n });\n }\n}\n\nasync function handleSend(\n params: Record<string, unknown>,\n config: A2AConfig,\n event?: any,\n): Promise<JsonRpcResponse & { _id: string | number }> {\n const message = params.message as Message;\n if (!message || !message.role || !Array.isArray(message.parts)) {\n return {\n ...jsonRpcError(\n 0,\n -32602,\n \"Invalid params: message with role and parts required\",\n ),\n _id: 0,\n };\n }\n\n const contextId = params.contextId as string | undefined;\n const metadata = params.metadata as Record<string, unknown> | undefined;\n\n // The JWT-verified caller email (set by mountA2A in server.ts) is the\n // single source of truth for task ownership — bound at creation, checked\n // on every subsequent tasks/get and tasks/cancel call. Caller-supplied\n // metadata.userEmail is NEVER used for ownership; that would re-introduce\n // the IDOR class fixed here.\n const ownerEmailForTask =\n (event?.context?.__a2aVerifiedEmail as string | undefined) ?? null;\n\n // Async mode: return the task immediately in `working` state, run the\n // handler in the background, and let the caller poll `tasks/get`. This is\n // the workaround for synchronous serverless request timeouts when the handler\n // runs LLM + tool loops that can exceed a single HTTP invocation budget.\n // SECURITY: only honor the explicit top-level `params.async`. The\n // metadata.async fallback was caller-controlled and could force async\n // dispatch (which has weaker auth than the sync path) on otherwise sync\n // requests. Async is also refused entirely when no auth is configured in\n // production — see the additional gate below.\n const asyncMode =\n params.async === true || (event && event.context?.__a2aForceAsync === true);\n\n if (asyncMode) {\n // Refuse async mode entirely when no auth is configured in production.\n // The async dispatch path self-fires the `_process-task` route, which\n // accepts unsigned dispatches when A2A_SECRET is unset — that combined\n // with the lack of caller identity here would let any unauthenticated\n // attacker queue and trigger handler runs. In production, require some\n // form of auth so the verifiedEmail is bound to the task.\n const hasA2ASecret = hasConfiguredA2ASecret();\n const hasApiKey = !!(config.apiKeyEnv && process.env[config.apiKeyEnv]);\n if (isA2AProductionRuntime() && !hasA2ASecret && !hasApiKey) {\n return {\n ...jsonRpcError(\n 0,\n -32001,\n \"A2A async mode is not available — A2A_SECRET or apiKeyEnv must be configured.\",\n ),\n _id: 0,\n };\n }\n // Resolve identity up front (cheap), bake it into the task's metadata,\n // and dispatch the actual handler run to a SEPARATE function execution.\n // On serverless hosts (Netlify, Vercel, Cloudflare) detached promises get\n // killed when the response is flushed, so we self-fire a webhook to a\n // dedicated processor route — same cross-platform pattern the integration\n // webhook queue uses. The processor reconstructs the request context from\n // the task metadata and runs the handler with its own full timeout.\n const verifiedEmail =\n (event?.context?.__a2aVerifiedEmail as string | undefined) ?? undefined;\n // Only trust the verified org domain from the JWT claim — do not fall back\n // to metadata.orgDomain which is caller-supplied and unverified.\n const orgDomainHint =\n (event?.context?.__a2aOrgDomain as string | undefined) ?? undefined;\n\n const taskMetadata: Record<string, unknown> = {\n ...(metadata ?? {}),\n __a2a_processor: {\n verifiedEmail,\n orgDomainHint,\n contextId: contextId ?? null,\n callerMetadata: metadata ?? null,\n },\n };\n const task = await createTask(\n message,\n contextId,\n taskMetadata,\n ownerEmailForTask,\n );\n const working = await updateTask(task.id, { state: \"working\" });\n\n fireProcessTaskDispatch(event, task.id).catch((err) => {\n console.error(\"[a2a] Failed to dispatch process-task:\", err);\n });\n\n return { ...jsonRpcResult(0, working ?? task), _id: 0 };\n }\n\n return withA2ARequestContext(metadata, event, async () => {\n const task = await createTask(\n message,\n contextId,\n undefined,\n ownerEmailForTask,\n );\n await updateTask(task.id, { state: \"working\" });\n\n const ctx = makeHandlerContext(task.id, contextId, metadata, event);\n\n try {\n const result = getHandler(config)(message, ctx.context);\n\n if (\n result &&\n typeof result === \"object\" &&\n Symbol.asyncIterator in result\n ) {\n let lastMessage: Message | undefined;\n for await (const msg of result as AsyncGenerator<Message>) {\n lastMessage = msg;\n }\n const updated = await updateTask(task.id, {\n state: \"completed\",\n message: lastMessage,\n artifacts: ctx.artifacts.length > 0 ? ctx.artifacts : undefined,\n });\n return { ...jsonRpcResult(0, updated), _id: 0 };\n }\n\n const handlerResult = await (result as Promise<A2AHandlerResult>);\n const allArtifacts = [\n ...ctx.artifacts,\n ...(handlerResult.artifacts ?? []),\n ];\n const updated = await updateTask(task.id, {\n state: \"completed\",\n message: handlerResult.message,\n artifacts: allArtifacts.length > 0 ? allArtifacts : undefined,\n });\n return { ...jsonRpcResult(0, updated), _id: 0 };\n } catch (err: any) {\n await updateTask(task.id, {\n state: \"failed\",\n message: {\n role: \"agent\",\n parts: [{ type: \"text\", text: err.message ?? \"Handler failed\" }],\n },\n });\n return {\n ...jsonRpcError(0, -32000, err.message ?? \"Handler failed\"),\n _id: 0,\n };\n }\n });\n}\n\nasync function handleStream(\n params: Record<string, unknown>,\n config: A2AConfig,\n res: { write: (chunk: string) => void; end: () => void },\n event?: any,\n): Promise<void> {\n const message = params.message as Message;\n if (!message || !message.role || !Array.isArray(message.parts)) {\n res.write(\n `data: ${JSON.stringify(jsonRpcError(0, -32602, \"Invalid params\"))}\\n\\n`,\n );\n res.end();\n return;\n }\n\n const contextId = params.contextId as string | undefined;\n const metadata = params.metadata as Record<string, unknown> | undefined;\n const ownerEmailForTask =\n (event?.context?.__a2aVerifiedEmail as string | undefined) ?? null;\n\n await withA2ARequestContext(metadata, event, async () => {\n const task = await createTask(\n message,\n contextId,\n undefined,\n ownerEmailForTask,\n );\n\n await updateTask(task.id, { state: \"working\" });\n\n const { context, artifacts } = makeHandlerContext(\n task.id,\n contextId,\n metadata,\n event,\n );\n\n try {\n const result = getHandler(config)(message, context);\n\n if (\n result &&\n typeof result === \"object\" &&\n Symbol.asyncIterator in result\n ) {\n for await (const msg of result as AsyncGenerator<Message>) {\n const intermediate = await updateTask(task.id, {\n state: \"working\",\n message: msg,\n });\n res.write(\n `data: ${JSON.stringify(jsonRpcResult(0, intermediate))}\\n\\n`,\n );\n }\n } else {\n const handlerResult = await (result as Promise<A2AHandlerResult>);\n const allArtifacts = [...artifacts, ...(handlerResult.artifacts ?? [])];\n const updated = await updateTask(task.id, {\n state: \"completed\",\n message: handlerResult.message,\n artifacts: allArtifacts.length > 0 ? allArtifacts : undefined,\n });\n res.write(`data: ${JSON.stringify(jsonRpcResult(0, updated))}\\n\\n`);\n res.end();\n return;\n }\n\n const allArtifacts = [...artifacts];\n const final = await updateTask(task.id, {\n state: \"completed\",\n artifacts: allArtifacts.length > 0 ? allArtifacts : undefined,\n });\n res.write(`data: ${JSON.stringify(jsonRpcResult(0, final))}\\n\\n`);\n } catch (err: any) {\n await updateTask(task.id, { state: \"failed\" });\n res.write(\n `data: ${JSON.stringify(jsonRpcError(0, -32000, err.message ?? \"Handler failed\"))}\\n\\n`,\n );\n }\n\n res.end();\n });\n}\n\n/**\n * Caller-supplied metadata keys that may contain sensitive bearer / OAuth\n * material. Always stripped from `tasks/get` responses so a leaked task id\n * never discloses an OAuth token even when the original sender carelessly\n * stuffed one into `metadata` (see `production-agent.ts:1144-1156` for the\n * historical googleToken propagation pattern).\n */\nconst SENSITIVE_METADATA_KEYS = new Set([\n \"googleToken\",\n \"userEmail\",\n \"orgDomain\",\n \"accessToken\",\n \"refreshToken\",\n \"apiKey\",\n \"Authorization\",\n \"authorization\",\n \"bearer\",\n]);\n\nfunction sanitizeTaskForResponse(task: any): any {\n if (!task || typeof task !== \"object\") return task;\n if (!task.metadata || typeof task.metadata !== \"object\") return task;\n\n const meta = task.metadata as Record<string, unknown>;\n const publicMeta: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(meta)) {\n if (k === \"__a2a_processor\") continue;\n if (SENSITIVE_METADATA_KEYS.has(k)) continue;\n publicMeta[k] = v;\n }\n return { ...task, metadata: publicMeta };\n}\n\n/**\n * Reject access when the task has a recorded owner that doesn't match the\n * verified caller. Returns a 404-shaped JSON-RPC error to avoid disclosing\n * task existence to the wrong caller (enumeration via UUID lookup).\n *\n * - When the task has no recorded owner (legacy row from before the\n * owner_email migration) we allow access if some verifiable bearer token\n * was presented; otherwise we still reject so an unsigned caller can never\n * read or cancel arbitrary task ids.\n * - When neither A2A_SECRET nor apiKeyEnv is configured AND we're in\n * production, we refuse `tasks/get` and `tasks/cancel` outright — there's\n * no way to authenticate the caller, so the only safe response is \"not\n * found\".\n */\nfunction authorizeTaskAccess(\n taskOwnerEmail: string | null,\n event: any,\n config: A2AConfig,\n): JsonRpcResponse | null {\n const verifiedEmail =\n (event?.context?.__a2aVerifiedEmail as string | undefined) ?? null;\n const hasA2ASecret = hasConfiguredA2ASecret();\n const hasApiKey = !!(config.apiKeyEnv && process.env[config.apiKeyEnv]);\n const inProduction = isA2AProductionRuntime();\n\n if (inProduction && !hasA2ASecret && !hasApiKey) {\n // No way to authenticate the caller in production — refuse access.\n return jsonRpcError(0, -32001, \"Task not found\");\n }\n\n if (taskOwnerEmail) {\n if (!verifiedEmail) {\n return jsonRpcError(0, -32001, \"Task not found\");\n }\n if (verifiedEmail.toLowerCase() !== taskOwnerEmail.toLowerCase()) {\n return jsonRpcError(0, -32001, \"Task not found\");\n }\n }\n // Legacy row (no owner_email recorded). The route-level auth gate is the\n // only thing protecting it — fall through and serve.\n return null;\n}\n\nasync function handleGet(\n params: Record<string, unknown>,\n event: any,\n config: A2AConfig,\n): Promise<JsonRpcResponse> {\n const id = params.id as string;\n if (!id) {\n return jsonRpcError(0, -32602, \"Invalid params: id required\");\n }\n const ownerEmail = await getTaskOwner(id);\n const denied = authorizeTaskAccess(ownerEmail, event, config);\n if (denied) return denied;\n\n const task = await getTask(id);\n if (!task) {\n return jsonRpcError(0, -32001, \"Task not found\");\n }\n const taskChanged = await refireStuckAsyncTaskIfNeeded(id, event).catch(\n (err) => {\n console.error(\"[a2a] Failed to refire stuck async task:\", err);\n return false;\n },\n );\n if (taskChanged) {\n const updated = await getTask(id);\n if (updated) return jsonRpcResult(0, sanitizeTaskForResponse(updated));\n }\n return jsonRpcResult(0, sanitizeTaskForResponse(task));\n}\n\nasync function refireStuckAsyncTaskIfNeeded(\n taskId: string,\n event: any,\n): Promise<boolean> {\n const state = await getA2ATaskDispatchState(taskId);\n if (!state) return false;\n if (!state.metadata?.__a2a_processor) return false;\n\n const now = Date.now();\n if (\n (state.statusState === \"submitted\" || state.statusState === \"working\") &&\n state.updatedAt <= now - A2A_QUEUED_DISPATCH_STUCK_AFTER_MS\n ) {\n if (await touchQueuedA2ATaskDispatch(taskId)) {\n await fireProcessTaskDispatch(event, taskId);\n return true;\n }\n return false;\n }\n\n if (\n state.statusState === \"processing\" &&\n state.updatedAt <= now - A2A_PROCESSING_STUCK_AFTER_MS\n ) {\n // A processor that died mid-handler may have already performed\n // side-effectful work. Retrying from the top can duplicate artifacts, so\n // fail deterministically and let the caller issue an intentional retry.\n const failed = await failStuckA2ATask(\n taskId,\n now - A2A_PROCESSING_STUCK_AFTER_MS,\n \"The async A2A processor timed out before completing. Please retry the request.\",\n );\n return failed;\n }\n\n return false;\n}\n\nasync function handleCancel(\n params: Record<string, unknown>,\n event: any,\n config: A2AConfig,\n): Promise<JsonRpcResponse> {\n const id = params.id as string;\n if (!id) {\n return jsonRpcError(0, -32602, \"Invalid params: id required\");\n }\n const ownerEmail = await getTaskOwner(id);\n const denied = authorizeTaskAccess(ownerEmail, event, config);\n if (denied) return denied;\n\n const task = await updateTask(id, { state: \"canceled\" });\n if (!task) {\n return jsonRpcError(0, -32001, \"Task not found\");\n }\n return jsonRpcResult(0, sanitizeTaskForResponse(task));\n}\n\n/**\n * H3-compatible JSON-RPC handler. Returns JSON directly (H3 serializes it).\n * Streaming is handled via H3's node response when needed.\n */\nexport async function handleJsonRpcH3(\n body: any,\n event: any,\n config: A2AConfig,\n): Promise<JsonRpcResponse> {\n if (!body || body.jsonrpc !== \"2.0\" || !body.method) {\n setResponseStatus(event, 400);\n return jsonRpcError(body?.id ?? null, -32600, \"Invalid JSON-RPC request\");\n }\n\n const params = (body.params as Record<string, unknown>) ?? {};\n const id = body.id;\n\n switch (body.method) {\n case \"message/send\": {\n const result = await handleSend(params, config, event);\n const { _id, ...response } = result;\n return { ...response, id } as JsonRpcResponse;\n }\n case \"message/stream\": {\n if (!config.streaming) {\n return jsonRpcError(id, -32601, \"Streaming not supported\");\n }\n // Use the raw node response for SSE streaming\n const res = event.node?.res;\n if (!res) {\n return jsonRpcError(id, -32000, \"Streaming not available\");\n }\n setResponseHeader(event, \"Content-Type\", \"text/event-stream\");\n setResponseHeader(event, \"Cache-Control\", \"no-cache\");\n setResponseHeader(event, \"Connection\", \"keep-alive\");\n await handleStream(params, config, res, event);\n return undefined as any; // Response already sent via SSE\n }\n case \"tasks/get\": {\n const result = await handleGet(params, event, config);\n return { ...result, id } as JsonRpcResponse;\n }\n case \"tasks/cancel\": {\n const result = await handleCancel(params, event, config);\n return { ...result, id } as JsonRpcResponse;\n }\n default:\n return jsonRpcError(id, -32601, `Method not found: ${body.method}`);\n }\n}\n"]}
1
+ {"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../src/a2a/handlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,IAAI,CAAC;AAE1D,OAAO,EACL,8BAA8B,EAC9B,gCAAgC,EAChC,4CAA4C,EAC5C,mCAAmC,EACnC,sCAAsC,GACvC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OA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KAAK,WAAW,EAAE,CAAC;YACjB,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;YACtD,OAAO,EAAE,GAAG,MAAM,EAAE,EAAE,EAAqB,CAAC;QAC9C,CAAC;QACD,KAAK,cAAc,EAAE,CAAC;YACpB,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;YACzD,OAAO,EAAE,GAAG,MAAM,EAAE,EAAE,EAAqB,CAAC;QAC9C,CAAC;QACD;YACE,OAAO,YAAY,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,qBAAqB,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IACxE,CAAC;AACH,CAAC","sourcesContent":["import { setResponseHeader, setResponseStatus } from \"h3\";\n\nimport {\n AGENT_BACKGROUND_PROCESSOR_A2A,\n AGENT_BACKGROUND_PROCESSOR_FIELD,\n dispatchPathTargetsNetlifyBackgroundFunction,\n isAgentChatDurableBackgroundEnabled,\n resolveAgentChatProcessRunDispatchPath,\n} from \"../agent/durable-background.js\";\nimport { withConfiguredAppBasePath } from \"../server/app-base-path.js\";\nimport { fireInternalDispatch } from \"../server/self-dispatch.js\";\nimport { agentChat } from \"../shared/agent-chat.js\";\nimport {\n hasConfiguredA2ASecret,\n isA2AProductionRuntime,\n} from \"./auth-policy.js\";\nimport {\n createTask,\n getTask,\n getTaskOwner,\n updateTask,\n claimA2ATaskForProcessing,\n getA2ATaskDispatchState,\n failStuckA2ATask,\n touchQueuedA2ATaskDispatch,\n touchProcessingA2ATask,\n} from \"./task-store.js\";\nimport type {\n A2AConfig,\n A2AHandler,\n A2AHandlerContext,\n A2AHandlerResult,\n JsonRpcResponse,\n Message,\n Artifact,\n} from \"./types.js\";\n\n// Inlined to avoid pulling the entire core-routes-plugin (and its h3\n// transitive deps) into the a2a/handlers test boundary. Must stay in sync\n// with FRAMEWORK_ROUTE_PREFIX in `server/core-routes-plugin.ts`.\nconst A2A_PROCESS_TASK_PATH = \"/_agent-native/a2a/_process-task\";\nconst A2A_QUEUED_DISPATCH_STUCK_AFTER_MS = 10_000;\nconst A2A_PROCESSING_STUCK_AFTER_MS = 5 * 60 * 1000;\nconst A2A_PROCESSING_HEARTBEAT_MS = 30_000;\n\n/**\n * Dispatch an async A2A task to a fresh function execution. Apps that opted\n * into durable background runs reuse the emitted Netlify 15-minute worker;\n * other hosts and apps retain the normal portable self-webhook route.\n */\nasync function fireProcessTaskDispatch(\n event: any,\n taskId: string,\n config: A2AConfig,\n): Promise<void> {\n const backgroundPath = resolveAgentChatProcessRunDispatchPath();\n const useBackgroundWorker =\n isAgentChatDurableBackgroundEnabled({\n appOptIn: config.durableBackgroundRuns === true,\n }) && dispatchPathTargetsNetlifyBackgroundFunction(backgroundPath);\n\n await fireInternalDispatch({\n event,\n path: useBackgroundWorker ? backgroundPath : A2A_PROCESS_TASK_PATH,\n taskId,\n ...(useBackgroundWorker\n ? {\n body: {\n [AGENT_BACKGROUND_PROCESSOR_FIELD]: AGENT_BACKGROUND_PROCESSOR_A2A,\n },\n }\n : {}),\n });\n}\n\n/**\n * Process a previously-enqueued A2A task. Called by the `_process-task`\n * route in `server.ts`, in a fresh function execution. Atomically claims the\n * task, reconstructs the caller's request context from the task's metadata,\n * runs the handler, and persists the outcome.\n *\n * Idempotent on duplicate dispatches: the atomic claim returns null if some\n * other invocation already picked the task up, in which case we no-op.\n */\nexport async function processA2ATaskFromQueue(\n taskId: string,\n config: A2AConfig,\n event?: any,\n): Promise<void> {\n const claimed = await claimA2ATaskForProcessing(taskId);\n if (!claimed) {\n // Already in flight, terminal, or missing. Nothing to do.\n return;\n }\n\n const message = claimed.history?.[0];\n if (!message) {\n await updateTask(taskId, {\n state: \"failed\",\n message: {\n role: \"agent\",\n parts: [{ type: \"text\", text: \"Task is missing its inbound message\" }],\n },\n });\n return;\n }\n\n const meta = (claimed.metadata ?? {}) as Record<string, unknown>;\n const processorMeta = (meta.__a2a_processor ?? {}) as Record<string, unknown>;\n const verifiedEmail = processorMeta.verifiedEmail as string | undefined;\n const orgDomainHint = processorMeta.orgDomainHint as string | undefined;\n const contextId =\n (processorMeta.contextId as string | null | undefined) ?? undefined;\n const callerMetadata =\n (processorMeta.callerMetadata as\n | Record<string, unknown>\n | null\n | undefined) ?? undefined;\n\n const resolvedOrgId = await resolveVerifiedA2AOrgId(\n verifiedEmail,\n orgDomainHint,\n );\n\n const { runWithRequestContext } =\n await import(\"../server/request-context.js\");\n const heartbeat = setInterval(() => {\n touchProcessingA2ATask(taskId).catch((err) =>\n console.error(\"[a2a] Failed to heartbeat async task:\", err),\n );\n }, A2A_PROCESSING_HEARTBEAT_MS);\n (\n heartbeat as ReturnType<typeof setInterval> & { unref?: () => void }\n ).unref?.();\n try {\n await runWithRequestContext(\n { userEmail: verifiedEmail, orgId: resolvedOrgId },\n () =>\n runHandlerAndPersist(\n taskId,\n message,\n config,\n contextId,\n callerMetadata,\n event,\n ),\n );\n } catch (err: any) {\n try {\n await updateTask(taskId, {\n state: \"failed\",\n message: {\n role: \"agent\",\n parts: [{ type: \"text\", text: err?.message ?? \"Handler crashed\" }],\n },\n });\n } catch {}\n } finally {\n clearInterval(heartbeat);\n }\n}\n\n/**\n * Default A2A handler that delegates to agentChat.call().\n * Used when no custom handler is provided in A2AConfig.\n */\nconst defaultHandler: A2AHandler = async (\n message: Message,\n _context: A2AHandlerContext,\n): Promise<A2AHandlerResult> => {\n // Extract text from message parts\n const text = message.parts\n .filter((p): p is { type: \"text\"; text: string } => p.type === \"text\")\n .map((p) => p.text)\n .join(\"\\n\");\n\n if (!text) {\n return {\n message: {\n role: \"agent\",\n parts: [{ type: \"text\", text: \"No text content in message\" }],\n },\n };\n }\n\n // A2A note: this message arrived from a different app — the caller cannot\n // see this app's local state (open deck, selected slide, etc.). They only\n // see whatever this agent puts into the reply text. So:\n // 1) include any concrete result (deck/document/dashboard URL, ID, value)\n // explicitly in the reply — the caller can't navigate locally.\n // 2) URLs must be fully-qualified — relative paths resolve against the\n // caller's host and 404.\n // We prepend a one-line hint to the user message so the agent knows.\n const baseUrl = process.env.APP_URL || process.env.URL || \"\";\n const appBaseUrl = baseUrl ? withConfiguredAppBasePath(baseUrl) : \"\";\n const augmentedText = baseUrl\n ? `[Cross-app A2A request — the caller is on a different host (${appBaseUrl} is yours, theirs is different). Include the concrete result (URL, ID, value) explicitly in your reply text; the caller can't see your local UI state. Any URL MUST be fully-qualified, never a relative path.]\\n\\n${text}`\n : text;\n\n const result = await agentChat.call(augmentedText);\n\n const artifacts: Artifact[] = [];\n if (result.filesChanged.length > 0) {\n artifacts.push({\n name: \"files-changed\",\n description: \"Files modified by the agent\",\n parts: [{ type: \"data\", data: { files: result.filesChanged } }],\n });\n }\n\n return {\n message: {\n role: \"agent\",\n parts: [\n { type: \"text\", text: result.response },\n ...(result.warnings?.length\n ? [\n {\n type: \"text\" as const,\n text: `\\n\\nWarnings:\\n${result.warnings.join(\"\\n\")}`,\n },\n ]\n : []),\n ],\n },\n artifacts: artifacts.length > 0 ? artifacts : undefined,\n };\n};\n\nfunction getHandler(config: A2AConfig): A2AHandler {\n return config.handler ?? defaultHandler;\n}\n\nfunction jsonRpcError(\n id: string | number | null,\n code: number,\n message: string,\n): JsonRpcResponse {\n return { jsonrpc: \"2.0\", id, error: { code, message } };\n}\n\nfunction jsonRpcResult(id: string | number, result: unknown): JsonRpcResponse {\n return { jsonrpc: \"2.0\", id, result };\n}\n\nfunction makeHandlerContext(\n taskId: string,\n contextId?: string,\n metadata?: Record<string, unknown>,\n event?: any,\n): {\n context: A2AHandlerContext;\n artifacts: Artifact[];\n} {\n const artifacts: Artifact[] = [];\n const context: A2AHandlerContext = {\n taskId,\n contextId,\n metadata,\n event,\n writeArtifact(name, content, mimeType) {\n const artifact: Artifact = {\n name,\n parts: mimeType\n ? [\n {\n type: \"file\",\n file: {\n name,\n mimeType,\n bytes: Buffer.from(content).toString(\"base64\"),\n },\n },\n ]\n : [{ type: \"text\", text: content }],\n };\n artifacts.push(artifact);\n return name;\n },\n };\n return { context, artifacts };\n}\n\n/**\n * Resolve org context from A2A metadata / event context and wrap `fn`\n * inside `runWithRequestContext` so downstream actions see the org.\n */\nasync function withA2ARequestContext<T>(\n _metadata: Record<string, unknown> | undefined,\n event: any | undefined,\n fn: () => Promise<T>,\n): Promise<T> {\n const { runWithRequestContext } =\n await import(\"../server/request-context.js\");\n\n const verifiedEmail =\n (event?.context?.__a2aVerifiedEmail as string | undefined) ?? undefined;\n // Only trust the org domain from the cryptographically verified JWT claim on\n // the event context. metadata.orgDomain is caller-supplied and must not be\n // used for org resolution — an unauthenticated caller could forge it and\n // gain access to another org's data.\n const orgDomain =\n (event?.context?.__a2aOrgDomain as string | undefined) ?? undefined;\n\n const resolvedOrgId = await resolveVerifiedA2AOrgId(verifiedEmail, orgDomain);\n\n return runWithRequestContext(\n { userEmail: verifiedEmail, orgId: resolvedOrgId },\n fn,\n ) as Promise<T>;\n}\n\nasync function resolveVerifiedA2AOrgId(\n verifiedEmail: string | undefined,\n verifiedOrgDomain: string | undefined,\n): Promise<string | undefined> {\n if (verifiedOrgDomain) {\n try {\n const { resolveOrgByDomain } = await import(\"../org/context.js\");\n const org = await resolveOrgByDomain(verifiedOrgDomain);\n if (org) return org.orgId;\n } catch {\n // Org tables may not exist — continue without org context\n }\n }\n\n if (verifiedEmail) {\n try {\n const { resolveOrgIdForEmail } = await import(\"../org/context.js\");\n return (await resolveOrgIdForEmail(verifiedEmail)) ?? undefined;\n } catch {\n // Org tables may not exist — continue without org context\n }\n }\n\n return undefined;\n}\n\n/**\n * Run the handler against the message and persist the outcome to the task store.\n * Used in sync mode (awaited inline) and in async mode (called by the\n * `_process-task` processor route in a fresh function execution).\n */\nasync function runHandlerAndPersist(\n taskId: string,\n message: Message,\n config: A2AConfig,\n contextId: string | undefined,\n metadata: Record<string, unknown> | undefined,\n event?: any,\n): Promise<void> {\n const { context, artifacts } = makeHandlerContext(\n taskId,\n contextId,\n metadata,\n event,\n );\n try {\n const result = getHandler(config)(message, context);\n\n if (\n result &&\n typeof result === \"object\" &&\n Symbol.asyncIterator in result\n ) {\n let lastMessage: Message | undefined;\n for await (const msg of result as AsyncGenerator<Message>) {\n lastMessage = msg;\n }\n await updateTask(taskId, {\n state: \"completed\",\n message: lastMessage,\n artifacts: artifacts.length > 0 ? artifacts : undefined,\n });\n return;\n }\n\n const handlerResult = await (result as Promise<A2AHandlerResult>);\n const allArtifacts = [...artifacts, ...(handlerResult.artifacts ?? [])];\n await updateTask(taskId, {\n state: \"completed\",\n message: handlerResult.message,\n artifacts: allArtifacts.length > 0 ? allArtifacts : undefined,\n });\n } catch (err: any) {\n await updateTask(taskId, {\n state: \"failed\",\n message: {\n role: \"agent\",\n parts: [{ type: \"text\", text: err?.message ?? \"Handler failed\" }],\n },\n });\n }\n}\n\nasync function handleSend(\n params: Record<string, unknown>,\n config: A2AConfig,\n event?: any,\n): Promise<JsonRpcResponse & { _id: string | number }> {\n const message = params.message as Message;\n if (!message || !message.role || !Array.isArray(message.parts)) {\n return {\n ...jsonRpcError(\n 0,\n -32602,\n \"Invalid params: message with role and parts required\",\n ),\n _id: 0,\n };\n }\n\n const contextId = params.contextId as string | undefined;\n const metadata = params.metadata as Record<string, unknown> | undefined;\n\n // The JWT-verified caller email (set by mountA2A in server.ts) is the\n // single source of truth for task ownership — bound at creation, checked\n // on every subsequent tasks/get and tasks/cancel call. Caller-supplied\n // metadata.userEmail is NEVER used for ownership; that would re-introduce\n // the IDOR class fixed here.\n const ownerEmailForTask =\n (event?.context?.__a2aVerifiedEmail as string | undefined) ?? null;\n\n // Async mode: return the task immediately in `working` state, run the\n // handler in the background, and let the caller poll `tasks/get`. This is\n // the workaround for synchronous serverless request timeouts when the handler\n // runs LLM + tool loops that can exceed a single HTTP invocation budget.\n // SECURITY: only honor the explicit top-level `params.async`. The\n // metadata.async fallback was caller-controlled and could force async\n // dispatch (which has weaker auth than the sync path) on otherwise sync\n // requests. Async is also refused entirely when no auth is configured in\n // production — see the additional gate below.\n const asyncMode =\n params.async === true || (event && event.context?.__a2aForceAsync === true);\n\n if (asyncMode) {\n // Refuse async mode entirely when no auth is configured in production.\n // The async dispatch path self-fires the `_process-task` route, which\n // accepts unsigned dispatches when A2A_SECRET is unset — that combined\n // with the lack of caller identity here would let any unauthenticated\n // attacker queue and trigger handler runs. In production, require some\n // form of auth so the verifiedEmail is bound to the task.\n const hasA2ASecret = hasConfiguredA2ASecret();\n const hasApiKey = !!(config.apiKeyEnv && process.env[config.apiKeyEnv]);\n if (isA2AProductionRuntime() && !hasA2ASecret && !hasApiKey) {\n return {\n ...jsonRpcError(\n 0,\n -32001,\n \"A2A async mode is not available — A2A_SECRET or apiKeyEnv must be configured.\",\n ),\n _id: 0,\n };\n }\n // Resolve identity up front (cheap), bake it into the task's metadata,\n // and dispatch the actual handler run to a SEPARATE function execution.\n // On serverless hosts (Netlify, Vercel, Cloudflare) detached promises get\n // killed when the response is flushed, so we self-fire a webhook to a\n // dedicated processor route — same cross-platform pattern the integration\n // webhook queue uses. The processor reconstructs the request context from\n // the task metadata and runs the handler with its own full timeout.\n const verifiedEmail =\n (event?.context?.__a2aVerifiedEmail as string | undefined) ?? undefined;\n // Only trust the verified org domain from the JWT claim — do not fall back\n // to metadata.orgDomain which is caller-supplied and unverified.\n const orgDomainHint =\n (event?.context?.__a2aOrgDomain as string | undefined) ?? undefined;\n\n const taskMetadata: Record<string, unknown> = {\n ...(metadata ?? {}),\n __a2a_processor: {\n verifiedEmail,\n orgDomainHint,\n contextId: contextId ?? null,\n callerMetadata: metadata ?? null,\n },\n };\n const task = await createTask(\n message,\n contextId,\n taskMetadata,\n ownerEmailForTask,\n );\n const working = await updateTask(task.id, { state: \"working\" });\n\n fireProcessTaskDispatch(event, task.id, config).catch((err) => {\n console.error(\"[a2a] Failed to dispatch process-task:\", err);\n });\n\n return { ...jsonRpcResult(0, working ?? task), _id: 0 };\n }\n\n return withA2ARequestContext(metadata, event, async () => {\n const task = await createTask(\n message,\n contextId,\n undefined,\n ownerEmailForTask,\n );\n await updateTask(task.id, { state: \"working\" });\n\n const ctx = makeHandlerContext(task.id, contextId, metadata, event);\n\n try {\n const result = getHandler(config)(message, ctx.context);\n\n if (\n result &&\n typeof result === \"object\" &&\n Symbol.asyncIterator in result\n ) {\n let lastMessage: Message | undefined;\n for await (const msg of result as AsyncGenerator<Message>) {\n lastMessage = msg;\n }\n const updated = await updateTask(task.id, {\n state: \"completed\",\n message: lastMessage,\n artifacts: ctx.artifacts.length > 0 ? ctx.artifacts : undefined,\n });\n return { ...jsonRpcResult(0, updated), _id: 0 };\n }\n\n const handlerResult = await (result as Promise<A2AHandlerResult>);\n const allArtifacts = [\n ...ctx.artifacts,\n ...(handlerResult.artifacts ?? []),\n ];\n const updated = await updateTask(task.id, {\n state: \"completed\",\n message: handlerResult.message,\n artifacts: allArtifacts.length > 0 ? allArtifacts : undefined,\n });\n return { ...jsonRpcResult(0, updated), _id: 0 };\n } catch (err: any) {\n await updateTask(task.id, {\n state: \"failed\",\n message: {\n role: \"agent\",\n parts: [{ type: \"text\", text: err.message ?? \"Handler failed\" }],\n },\n });\n return {\n ...jsonRpcError(0, -32000, err.message ?? \"Handler failed\"),\n _id: 0,\n };\n }\n });\n}\n\nasync function handleStream(\n params: Record<string, unknown>,\n config: A2AConfig,\n res: { write: (chunk: string) => void; end: () => void },\n event?: any,\n): Promise<void> {\n const message = params.message as Message;\n if (!message || !message.role || !Array.isArray(message.parts)) {\n res.write(\n `data: ${JSON.stringify(jsonRpcError(0, -32602, \"Invalid params\"))}\\n\\n`,\n );\n res.end();\n return;\n }\n\n const contextId = params.contextId as string | undefined;\n const metadata = params.metadata as Record<string, unknown> | undefined;\n const ownerEmailForTask =\n (event?.context?.__a2aVerifiedEmail as string | undefined) ?? null;\n\n await withA2ARequestContext(metadata, event, async () => {\n const task = await createTask(\n message,\n contextId,\n undefined,\n ownerEmailForTask,\n );\n\n await updateTask(task.id, { state: \"working\" });\n\n const { context, artifacts } = makeHandlerContext(\n task.id,\n contextId,\n metadata,\n event,\n );\n\n try {\n const result = getHandler(config)(message, context);\n\n if (\n result &&\n typeof result === \"object\" &&\n Symbol.asyncIterator in result\n ) {\n for await (const msg of result as AsyncGenerator<Message>) {\n const intermediate = await updateTask(task.id, {\n state: \"working\",\n message: msg,\n });\n res.write(\n `data: ${JSON.stringify(jsonRpcResult(0, intermediate))}\\n\\n`,\n );\n }\n } else {\n const handlerResult = await (result as Promise<A2AHandlerResult>);\n const allArtifacts = [...artifacts, ...(handlerResult.artifacts ?? [])];\n const updated = await updateTask(task.id, {\n state: \"completed\",\n message: handlerResult.message,\n artifacts: allArtifacts.length > 0 ? allArtifacts : undefined,\n });\n res.write(`data: ${JSON.stringify(jsonRpcResult(0, updated))}\\n\\n`);\n res.end();\n return;\n }\n\n const allArtifacts = [...artifacts];\n const final = await updateTask(task.id, {\n state: \"completed\",\n artifacts: allArtifacts.length > 0 ? allArtifacts : undefined,\n });\n res.write(`data: ${JSON.stringify(jsonRpcResult(0, final))}\\n\\n`);\n } catch (err: any) {\n await updateTask(task.id, { state: \"failed\" });\n res.write(\n `data: ${JSON.stringify(jsonRpcError(0, -32000, err.message ?? \"Handler failed\"))}\\n\\n`,\n );\n }\n\n res.end();\n });\n}\n\n/**\n * Caller-supplied metadata keys that may contain sensitive bearer / OAuth\n * material. Always stripped from `tasks/get` responses so a leaked task id\n * never discloses an OAuth token even when the original sender carelessly\n * stuffed one into `metadata` (see `production-agent.ts:1144-1156` for the\n * historical googleToken propagation pattern).\n */\nconst SENSITIVE_METADATA_KEYS = new Set([\n \"googleToken\",\n \"userEmail\",\n \"orgDomain\",\n \"accessToken\",\n \"refreshToken\",\n \"apiKey\",\n \"Authorization\",\n \"authorization\",\n \"bearer\",\n]);\n\nfunction sanitizeTaskForResponse(task: any): any {\n if (!task || typeof task !== \"object\") return task;\n if (!task.metadata || typeof task.metadata !== \"object\") return task;\n\n const meta = task.metadata as Record<string, unknown>;\n const publicMeta: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(meta)) {\n if (k === \"__a2a_processor\") continue;\n if (SENSITIVE_METADATA_KEYS.has(k)) continue;\n publicMeta[k] = v;\n }\n return { ...task, metadata: publicMeta };\n}\n\n/**\n * Reject access when the task has a recorded owner that doesn't match the\n * verified caller. Returns a 404-shaped JSON-RPC error to avoid disclosing\n * task existence to the wrong caller (enumeration via UUID lookup).\n *\n * - When the task has no recorded owner (legacy row from before the\n * owner_email migration) we allow access if some verifiable bearer token\n * was presented; otherwise we still reject so an unsigned caller can never\n * read or cancel arbitrary task ids.\n * - When neither A2A_SECRET nor apiKeyEnv is configured AND we're in\n * production, we refuse `tasks/get` and `tasks/cancel` outright — there's\n * no way to authenticate the caller, so the only safe response is \"not\n * found\".\n */\nfunction authorizeTaskAccess(\n taskOwnerEmail: string | null,\n event: any,\n config: A2AConfig,\n): JsonRpcResponse | null {\n const verifiedEmail =\n (event?.context?.__a2aVerifiedEmail as string | undefined) ?? null;\n const hasA2ASecret = hasConfiguredA2ASecret();\n const hasApiKey = !!(config.apiKeyEnv && process.env[config.apiKeyEnv]);\n const inProduction = isA2AProductionRuntime();\n\n if (inProduction && !hasA2ASecret && !hasApiKey) {\n // No way to authenticate the caller in production — refuse access.\n return jsonRpcError(0, -32001, \"Task not found\");\n }\n\n if (taskOwnerEmail) {\n if (!verifiedEmail) {\n return jsonRpcError(0, -32001, \"Task not found\");\n }\n if (verifiedEmail.toLowerCase() !== taskOwnerEmail.toLowerCase()) {\n return jsonRpcError(0, -32001, \"Task not found\");\n }\n }\n // Legacy row (no owner_email recorded). The route-level auth gate is the\n // only thing protecting it — fall through and serve.\n return null;\n}\n\nasync function handleGet(\n params: Record<string, unknown>,\n event: any,\n config: A2AConfig,\n): Promise<JsonRpcResponse> {\n const id = params.id as string;\n if (!id) {\n return jsonRpcError(0, -32602, \"Invalid params: id required\");\n }\n const ownerEmail = await getTaskOwner(id);\n const denied = authorizeTaskAccess(ownerEmail, event, config);\n if (denied) return denied;\n\n const task = await getTask(id);\n if (!task) {\n return jsonRpcError(0, -32001, \"Task not found\");\n }\n const taskChanged = await refireStuckAsyncTaskIfNeeded(\n id,\n event,\n config,\n ).catch((err) => {\n console.error(\"[a2a] Failed to refire stuck async task:\", err);\n return false;\n });\n if (taskChanged) {\n const updated = await getTask(id);\n if (updated) return jsonRpcResult(0, sanitizeTaskForResponse(updated));\n }\n return jsonRpcResult(0, sanitizeTaskForResponse(task));\n}\n\nasync function refireStuckAsyncTaskIfNeeded(\n taskId: string,\n event: any,\n config: A2AConfig,\n): Promise<boolean> {\n const state = await getA2ATaskDispatchState(taskId);\n if (!state) return false;\n if (!state.metadata?.__a2a_processor) return false;\n\n const now = Date.now();\n if (\n (state.statusState === \"submitted\" || state.statusState === \"working\") &&\n state.updatedAt <= now - A2A_QUEUED_DISPATCH_STUCK_AFTER_MS\n ) {\n if (await touchQueuedA2ATaskDispatch(taskId)) {\n await fireProcessTaskDispatch(event, taskId, config);\n return true;\n }\n return false;\n }\n\n if (\n state.statusState === \"processing\" &&\n state.updatedAt <= now - A2A_PROCESSING_STUCK_AFTER_MS\n ) {\n // A processor that died mid-handler may have already performed\n // side-effectful work. Retrying from the top can duplicate artifacts, so\n // fail deterministically and let the caller issue an intentional retry.\n const failed = await failStuckA2ATask(\n taskId,\n now - A2A_PROCESSING_STUCK_AFTER_MS,\n \"The async A2A processor timed out before completing. Please retry the request.\",\n );\n return failed;\n }\n\n return false;\n}\n\nasync function handleCancel(\n params: Record<string, unknown>,\n event: any,\n config: A2AConfig,\n): Promise<JsonRpcResponse> {\n const id = params.id as string;\n if (!id) {\n return jsonRpcError(0, -32602, \"Invalid params: id required\");\n }\n const ownerEmail = await getTaskOwner(id);\n const denied = authorizeTaskAccess(ownerEmail, event, config);\n if (denied) return denied;\n\n const task = await updateTask(id, { state: \"canceled\" });\n if (!task) {\n return jsonRpcError(0, -32001, \"Task not found\");\n }\n return jsonRpcResult(0, sanitizeTaskForResponse(task));\n}\n\n/**\n * H3-compatible JSON-RPC handler. Returns JSON directly (H3 serializes it).\n * Streaming is handled via H3's node response when needed.\n */\nexport async function handleJsonRpcH3(\n body: any,\n event: any,\n config: A2AConfig,\n): Promise<JsonRpcResponse> {\n if (!body || body.jsonrpc !== \"2.0\" || !body.method) {\n setResponseStatus(event, 400);\n return jsonRpcError(body?.id ?? null, -32600, \"Invalid JSON-RPC request\");\n }\n\n const params = (body.params as Record<string, unknown>) ?? {};\n const id = body.id;\n\n switch (body.method) {\n case \"message/send\": {\n const result = await handleSend(params, config, event);\n const { _id, ...response } = result;\n return { ...response, id } as JsonRpcResponse;\n }\n case \"message/stream\": {\n if (!config.streaming) {\n return jsonRpcError(id, -32601, \"Streaming not supported\");\n }\n // Use the raw node response for SSE streaming\n const res = event.node?.res;\n if (!res) {\n return jsonRpcError(id, -32000, \"Streaming not available\");\n }\n setResponseHeader(event, \"Content-Type\", \"text/event-stream\");\n setResponseHeader(event, \"Cache-Control\", \"no-cache\");\n setResponseHeader(event, \"Connection\", \"keep-alive\");\n await handleStream(params, config, res, event);\n return undefined as any; // Response already sent via SSE\n }\n case \"tasks/get\": {\n const result = await handleGet(params, event, config);\n return { ...result, id } as JsonRpcResponse;\n }\n case \"tasks/cancel\": {\n const result = await handleCancel(params, event, config);\n return { ...result, id } as JsonRpcResponse;\n }\n default:\n return jsonRpcError(id, -32601, `Method not found: ${body.method}`);\n }\n}\n"]}
@@ -118,5 +118,7 @@ export interface A2AConfig {
118
118
  handler?: A2AHandler;
119
119
  apiKeyEnv?: string;
120
120
  streaming?: boolean;
121
+ /** Route async A2A work through the app's durable background worker when available. */
122
+ durableBackgroundRuns?: boolean;
121
123
  }
122
124
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/a2a/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAI5D,MAAM,WAAW,QAAQ;I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