@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":"plugin.js","sourceRoot":"","sources":["../../src/integrations/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAA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,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,EAAE,CACjC,OAAO,OAAO,CAAC,GAAG,KAAK,UAAU;YAC/B,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;YACnB,CAAC,CAAE,OAAkC,CAAC,IAAI,CAAC,CAAC;QAChD,MAAM,KAAK,GAAG,SAAS,CAAC,mBAAmB,CAAC,IAAI,MAAM,CAAC;QACvD,MAAM,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,gBAAgB,CAAC;QACnD,OAAO,yBAAyB,CAAC,GAAG,KAAK,MAAM,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,yBAAyB,CAAC,uBAAuB,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["import { defineEventHandler, setResponseStatus, getMethod, getQuery } from \"h3\";\nimport { getRequestHeader } from \"h3\";\nimport { createRemoteJWKSet, jwtVerify } from \"jose\";\n\nimport { getOrgContext, resolveOrgIdForEmail } from \"../org/context.js\";\nimport { loadResourcesForPrompt } from \"../server/agent-chat-plugin.js\";\nimport { withConfiguredAppBasePath } from \"../server/app-base-path.js\";\nimport { getSession } from \"../server/auth.js\";\nimport { FRAMEWORK_ROUTE_PREFIX } from \"../server/core-routes-plugin.js\";\nimport { resolveSecret } from \"../server/credential-provider.js\";\nimport {\n getH3App,\n markDefaultPluginProvided,\n} from \"../server/framework-request-handler.js\";\nimport { readBody } from \"../server/h3-helpers.js\";\nimport { runWithRequestContext } from \"../server/request-context.js\";\nimport {\n processA2AContinuationById,\n processDueA2AContinuations,\n} from \"./a2a-continuation-processor.js\";\nimport { failA2AContinuation } from \"./a2a-continuations-store.js\";\nimport { emailAdapter } from \"./adapters/email.js\";\nimport { googleDocsAdapter } from \"./adapters/google-docs.js\";\nimport { slackAdapter } from \"./adapters/slack.js\";\nimport { telegramAdapter } from \"./adapters/telegram.js\";\nimport { whatsappAdapter } from \"./adapters/whatsapp.js\";\nimport { getIntegrationConfig, saveIntegrationConfig } from \"./config-store.js\";\nimport {\n startGoogleDocsPoller,\n handlePushNotification,\n} from \"./google-docs-poller.js\";\nimport { extractBearerToken, verifyInternalToken } from \"./internal-token.js\";\nimport { startPendingTasksRetryJob } from \"./pending-tasks-retry-job.js\";\nimport {\n claimPendingTask,\n markTaskCompleted,\n markTaskFailed,\n} from \"./pending-tasks-store.js\";\nimport {\n claimNextRemoteCommand,\n enqueueRemoteCommand as enqueueRemoteCommandRow,\n isRemoteCommandKind,\n listRemoteCommandsForOwner,\n updateRemoteCommandResult,\n} from \"./remote-commands-store.js\";\nimport {\n authenticateRemoteDeviceToken,\n createRemoteDevice,\n getRemoteDeviceForOwner,\n listRemoteDevicesForOwner,\n revokeRemoteDeviceForOwner,\n toPublicRemoteDevice,\n unregisterRemoteDevice,\n updateRemoteDeviceDetails,\n} from \"./remote-devices-store.js\";\nimport {\n listRemotePushNotificationsForOwner,\n listRemotePushRegistrationsForOwner,\n queueRemotePushNotifications,\n toPublicRemotePushRegistration,\n unregisterRemotePushRegistrationForOwner,\n upsertRemotePushRegistration,\n} from \"./remote-push-store.js\";\nimport { startRemoteCommandsRetryJob } from \"./remote-retry-job.js\";\nimport {\n insertRemoteRunEvents,\n listRemoteRunEvents,\n} from \"./remote-run-events-store.js\";\nimport type {\n RemoteCommand,\n RemoteCommandKind,\n RemoteDevice,\n} from \"./remote-types.js\";\nimport { getTaskQueueStats } from \"./task-queue-stats.js\";\nimport type {\n PlatformAdapter,\n IntegrationsPluginOptions,\n IntegrationStatus,\n} from \"./types.js\";\nimport { handleWebhook, processIntegrationTask } from \"./webhook-handler.js\";\n\ntype NitroPluginDef = (nitroApp: any) => void | Promise<void>;\n\nlet a2aContinuationRetryInterval: ReturnType<typeof setInterval> | null = null;\n\nfunction startA2AContinuationRetryJob(\n adapters: Map<string, PlatformAdapter>,\n): void {\n if (a2aContinuationRetryInterval) return;\n const initialTimer = setTimeout(() => {\n processDueA2AContinuations({ adapters }).catch((err) => {\n console.error(\"[integrations] A2A continuation retry job failed:\", err);\n });\n }, 10_000);\n unrefTimer(initialTimer);\n a2aContinuationRetryInterval = setInterval(() => {\n processDueA2AContinuations({ adapters }).catch((err) => {\n console.error(\"[integrations] A2A continuation retry job failed:\", err);\n });\n }, 60_000);\n unrefTimer(a2aContinuationRetryInterval);\n}\n\nfunction unrefTimer(timer: ReturnType<typeof setInterval>): void {\n (timer as unknown as { unref?: () => void }).unref?.();\n}\n\n// ─── Google Pub/Sub OIDC verifier (for Drive changes.watch push) ────────────\n// Cache Google's public keys for OIDC verification. jose handles TTL +\n// refresh internally — same pattern as templates/mail/.../gmail/push.post.ts.\n// Used to verify Google Pub/Sub push notifications carry a valid bearer token\n// signed by a configured service account. Without this, the webhook is wide\n// open to anonymous callers who can force a Drive sync (H7 in the audit).\nconst GOOGLE_JWKS = createRemoteJWKSet(\n new URL(\"https://www.googleapis.com/oauth2/v3/certs\"),\n);\nconst GOOGLE_ISSUERS = [\"https://accounts.google.com\", \"accounts.google.com\"];\n\n/**\n * Verify a Pub/Sub OIDC bearer token. Throws on any verification failure.\n * Requires GOOGLE_DOCS_PUSH_AUDIENCE and GOOGLE_DOCS_PUSH_SIGNER_EMAIL to be\n * set; if either is missing in production, the webhook handler refuses the\n * request entirely (so a misconfigured deployment fails closed, surfacing in\n * Pub/Sub's delivery metrics).\n */\nasync function verifyGoogleDocsPushToken(authHeader: string): Promise<void> {\n if (!authHeader.startsWith(\"Bearer \")) {\n throw new Error(\"missing bearer token\");\n }\n const token = authHeader.slice(7);\n const audience = process.env.GOOGLE_DOCS_PUSH_AUDIENCE;\n if (!audience) {\n throw new Error(\"GOOGLE_DOCS_PUSH_AUDIENCE not configured\");\n }\n const { payload } = await jwtVerify(token, GOOGLE_JWKS, {\n issuer: GOOGLE_ISSUERS,\n audience,\n });\n if (payload.email_verified !== true) {\n throw new Error(\"email_verified claim is not true\");\n }\n // Pin to a specific service account — without this, any Google-issued\n // token with the right audience could trigger a Drive sync.\n const expectedSigner = process.env.GOOGLE_DOCS_PUSH_SIGNER_EMAIL;\n if (!expectedSigner) {\n throw new Error(\"GOOGLE_DOCS_PUSH_SIGNER_EMAIL not configured\");\n }\n if (payload.email !== expectedSigner) {\n throw new Error(`unexpected signer: ${String(payload.email)}`);\n }\n}\n\n/** Built-in adapters, instantiated lazily */\nfunction getDefaultAdapters(): PlatformAdapter[] {\n return [\n slackAdapter(),\n telegramAdapter(),\n whatsappAdapter(),\n googleDocsAdapter(),\n emailAdapter(),\n ];\n}\n\nconst INTEGRATION_SYSTEM_PROMPT = `You are an AI agent responding via a messaging platform integration (Slack, Telegram, WhatsApp, etc.).\n\nYou have the same capabilities as the web chat agent. Use your tools to help the user.\n\nKeep responses concise — messaging platforms have character limits and users expect shorter replies than in a web interface. Use markdown sparingly (bold and lists are fine, but avoid complex formatting that may not render well on all platforms).\n\nIf a task requires many steps, summarize what you did rather than streaming every detail.`;\n\ntype RemoteCodeCommandEnvelope = {\n kind?: unknown;\n ownerEmail?: unknown;\n orgId?: unknown;\n command?: unknown;\n source?: unknown;\n};\n\ntype IntegrationCredentialContext = {\n userEmail: string;\n orgId?: string;\n isIntegrationCaller?: boolean;\n};\n\nconst REMOTE_DEVICE_ONLINE_MS = 90_000;\n\nexport async function enqueueRemoteCommand(\n envelope: RemoteCodeCommandEnvelope,\n): Promise<Record<string, unknown>> {\n const ownerEmail = readString(envelope.ownerEmail);\n if (!ownerEmail) throw new Error(\"ownerEmail is required\");\n const hasOrgId = Object.prototype.hasOwnProperty.call(envelope, \"orgId\");\n const orgId = hasOrgId ? (readString(envelope.orgId) ?? null) : undefined;\n const command = readObject(envelope.command);\n if (!command) throw new Error(\"command is required\");\n const commandType = readString(command.type);\n const commands = await listRemoteCommandsForOwner({\n ownerEmail,\n ...(hasOrgId ? { orgId } : {}),\n limit: 50,\n });\n\n if (commandType === \"list\") {\n return {\n ok: true,\n runs: commands.map(remoteCommandToRunSummary).filter(Boolean),\n hostOnline: await hasOnlineRemoteDevice(ownerEmail, orgId),\n };\n }\n\n if (commandType === \"status\") {\n const runRef = readString(command.runRef);\n const run = runRef\n ? commands.map(remoteCommandToRunSummary).find((item) => {\n const candidate = item as Record<string, unknown>;\n return candidate.id === runRef || candidate.runId === runRef;\n })\n : undefined;\n const hostOnline = await hasOnlineRemoteDevice(ownerEmail, orgId);\n return {\n ok: true,\n hostOnline,\n hostStatus: hostOnline ? \"online\" : \"offline\",\n ...(run ? { run } : {}),\n };\n }\n\n const devices = await listRemoteDevicesForOwner({\n ownerEmail,\n ...(hasOrgId ? { orgId } : {}),\n status: \"active\",\n limit: 10,\n });\n const requestedDeviceId =\n readString(command.hostId) ?? readString(command.deviceId);\n const device =\n (requestedDeviceId\n ? devices.find((candidate) => candidate.id === requestedDeviceId)\n : undefined) ?? devices[0];\n if (!device) {\n return {\n ok: false,\n hostOnline: false,\n hostStatus: \"offline\",\n error: \"No paired computer is available for code-agent commands.\",\n };\n }\n\n const source = readObject(envelope.source);\n const kind = remoteCodeCommandKind(commandType);\n if (!kind) throw new Error(`Unsupported code-agent command: ${commandType}`);\n const row = await enqueueRemoteCommandRow({\n deviceId: device.id,\n ownerEmail,\n orgId: device.orgId ?? orgId ?? null,\n kind,\n params: remoteCodeCommandParams(command),\n platform: readString(source?.platform) ?? null,\n externalThreadId: readString(source?.externalThreadId) ?? null,\n });\n const hostOnline = isRemoteDeviceOnline(device);\n return {\n ok: true,\n commandId: row.id,\n requestId: row.id,\n hostOnline,\n hostStatus: hostOnline ? \"online\" : \"offline\",\n message:\n commandType === \"create\"\n ? hostOnline\n ? `Queued code run (${row.id}).`\n : `Queued code run (${row.id}). Your computer looks offline or asleep, so it will pick this up when it wakes.`\n : undefined,\n };\n}\n\nfunction remoteCodeCommandKind(\n commandType: string | undefined,\n): RemoteCommandKind | null {\n switch (commandType) {\n case \"create\":\n return \"create-run\";\n case \"continue\":\n return \"append-followup\";\n case \"approve\":\n return \"approve\";\n case \"deny\":\n return \"deny\";\n case \"stop\":\n return \"stop\";\n default:\n return null;\n }\n}\n\nfunction remoteCodeCommandParams(\n command: Record<string, unknown>,\n): Record<string, unknown> {\n const type = readString(command.type);\n if (type === \"create\") {\n return {\n prompt: readString(command.prompt) ?? \"\",\n title: readString(command.title),\n cwd: readString(command.cwd),\n goalId: readString(command.goalId) ?? \"task\",\n permissionMode: readString(command.permissionMode),\n };\n }\n if (type === \"continue\") {\n return {\n runId: readString(command.runRef) ?? readString(command.runId),\n prompt: readString(command.text) ?? readString(command.prompt),\n permissionMode: readString(command.permissionMode),\n };\n }\n if (type === \"approve\" || type === \"deny\") {\n const id = readString(command.approvalId) ?? readString(command.runId);\n return { runId: id, approvalId: id };\n }\n if (type === \"stop\") {\n return { runId: readString(command.runRef) ?? readString(command.runId) };\n }\n return {};\n}\n\nfunction enqueueBodyToRemoteCodeCommand(\n body: Record<string, unknown>,\n): Record<string, unknown> | null {\n const direct = readObject(body.command);\n if (body.kind === \"code-agent\" && direct) return direct;\n\n const operation = readString(body.operation) ?? readString(body.type);\n const payload = readObject(body.payload) ?? body;\n if (!operation?.startsWith(\"code-agent.\")) return null;\n\n if (operation === \"code-agent.run.create\") {\n return {\n type: \"create\",\n prompt: payload.prompt,\n title: payload.title,\n hostId: payload.hostId,\n deviceId: payload.deviceId,\n cwd: payload.cwd,\n goalId: payload.goalId,\n permissionMode: payload.permissionMode,\n };\n }\n if (operation === \"code-agent.run.follow-up\") {\n return {\n type: \"continue\",\n runRef: payload.runId,\n text: payload.prompt ?? payload.message,\n hostId: payload.hostId,\n deviceId: payload.deviceId,\n permissionMode: payload.permissionMode,\n };\n }\n if (operation === \"code-agent.pending-command.decide\") {\n return {\n type: payload.decision === \"deny\" ? \"deny\" : \"approve\",\n approvalId: payload.commandId ?? payload.runId,\n runId: payload.runId,\n hostId: payload.hostId,\n deviceId: payload.deviceId,\n };\n }\n if (operation === \"code-agent.run.stop\") {\n return {\n type: \"stop\",\n runRef: payload.runId,\n hostId: payload.hostId,\n deviceId: payload.deviceId,\n };\n }\n return null;\n}\n\nfunction remoteCommandToRunSummary(\n command: RemoteCommand,\n): Record<string, unknown> | null {\n const result = readObject(command.result);\n const nestedResult = readObject(result?.result) ?? result;\n const run = readObject(nestedResult?.run);\n if (run) {\n return {\n ...run,\n commandId: command.id,\n hostId: command.deviceId,\n status: readString(run.status) ?? command.status,\n updatedAt: readString(run.updatedAt) ?? command.updatedAt,\n };\n }\n if (command.kind !== \"create-run\") return null;\n const params = readObject(command.params) ?? {};\n return {\n id: command.id,\n runId: command.id,\n hostId: command.deviceId,\n title:\n readString(params.title) ?? readString(params.prompt) ?? \"Queued run\",\n prompt: readString(params.prompt),\n status: command.status === \"failed\" ? \"errored\" : \"queued\",\n createdAt: command.createdAt,\n updatedAt: command.updatedAt,\n metadata: { remoteCommandId: command.id },\n };\n}\n\nfunction readObject(value: unknown): Record<string, unknown> | null {\n return value && typeof value === \"object\" && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : null;\n}\n\nfunction readString(value: unknown): string | undefined {\n return typeof value === \"string\" && value.trim() ? value.trim() : undefined;\n}\n\nfunction isRemoteDeviceOnline(device: { lastSeenAt: number | null }): boolean {\n return typeof device.lastSeenAt === \"number\"\n ? Date.now() - device.lastSeenAt <= REMOTE_DEVICE_ONLINE_MS\n : false;\n}\n\nasync function hasOnlineRemoteDevice(\n ownerEmail: string,\n orgId: string | null | undefined,\n): Promise<boolean> {\n const hasOrgId = orgId !== undefined;\n const devices = await listRemoteDevicesForOwner({\n ownerEmail,\n ...(hasOrgId ? { orgId } : {}),\n status: \"active\",\n limit: 10,\n });\n return devices.some(isRemoteDeviceOnline);\n}\n\nfunction remoteDeviceToHost(device: RemoteDevice): Record<string, unknown> {\n const online = device.status === \"active\" && isRemoteDeviceOnline(device);\n return {\n id: device.id,\n name: device.label,\n label: device.label,\n status:\n device.status === \"active\" ? (online ? \"online\" : \"offline\") : \"revoked\",\n lastSeenAt: device.lastSeenAt\n ? new Date(device.lastSeenAt).toISOString()\n : undefined,\n platform: device.platform ?? \"desktop\",\n appVersion: device.appVersion ?? undefined,\n hostName: device.hostName ?? undefined,\n metadata: device.metadata ?? undefined,\n device: toPublicRemoteDevice(device),\n };\n}\n\nfunction mountedPathParts(event: any, mountSuffix: string): string[] {\n const rawPath = String(\n event.path ?? event.url?.pathname ?? event.node?.req?.url ?? \"/\",\n ).split(\"?\")[0];\n const normalized = rawPath.replace(/^\\/+/, \"\");\n const marker = mountSuffix.replace(/^\\/+/, \"\");\n const markerIndex = normalized.indexOf(marker);\n const suffix =\n markerIndex >= 0\n ? normalized.slice(markerIndex + marker.length)\n : normalized;\n return suffix\n .split(\"/\")\n .filter(Boolean)\n .map((part) => decodeURIComponent(part));\n}\n\nfunction remoteCommandPushPayload(\n command: RemoteCommand,\n): Record<string, unknown> {\n const result = readObject(command.result);\n const status = command.status;\n const title =\n status === \"completed\"\n ? \"Remote run completed\"\n : status === \"failed\"\n ? \"Remote run failed\"\n : \"Remote run updated\";\n return {\n title,\n body: command.errorMessage ?? readString(result?.message),\n commandId: command.id,\n hostId: command.deviceId,\n kind: command.kind,\n status,\n result: command.result,\n updatedAt: command.updatedAt,\n };\n}\n\n/**\n * Creates a Nitro plugin that mounts messaging platform integration webhook routes.\n *\n * Routes:\n * POST /_agent-native/integrations/:platform/webhook — receive platform webhooks\n * GET /_agent-native/integrations/status — all integrations status\n * GET /_agent-native/integrations/:platform/status — single platform status\n * POST /_agent-native/integrations/:platform/enable — enable integration\n * POST /_agent-native/integrations/:platform/disable — disable integration\n * POST /_agent-native/integrations/:platform/setup — platform-specific setup\n */\nexport function createIntegrationsPlugin(\n options?: IntegrationsPluginOptions,\n): NitroPluginDef {\n return async (nitroApp: any) => {\n markDefaultPluginProvided(nitroApp, \"integrations\");\n const adapters = options?.adapters ?? getDefaultAdapters();\n const adapterMap = new Map<string, PlatformAdapter>();\n for (const adapter of adapters) {\n adapterMap.set(adapter.platform, adapter);\n }\n\n const model = options?.model;\n // Read the API key at REQUEST time, not plugin-init time. On Netlify\n // Lambda the plugin module loads in a context where env vars from the\n // site's runtime config may not yet be populated, so capturing at\n // init can leave us with an empty string forever. The getter\n // re-resolves on every webhook so freshly-set secrets work without\n // a redeploy.\n const getApiKey = () => options?.apiKey ?? \"\";\n\n // Build the system prompt\n const baseSystemPrompt = options?.systemPrompt ?? INTEGRATION_SYSTEM_PROMPT;\n\n // Resolve actions — auto-include call-agent so the integration agent can\n // delegate to other A2A apps, matching the behavior of the agent-chat plugin.\n const localActions = options?.actions ?? {};\n let callAgentEntry: Record<string, unknown> = {};\n try {\n const mod = await import(\"../scripts/call-agent.js\");\n callAgentEntry = {\n \"call-agent\": {\n tool: mod.tool,\n run: (args: Record<string, string>, context: unknown) =>\n mod.run(args, context as any, options?.appId),\n },\n };\n } catch {\n // call-agent script not available — skip\n }\n const actions = {\n ...localActions,\n ...callAgentEntry,\n } as typeof localActions;\n\n const h3 = getH3App(nitroApp);\n const P = `${FRAMEWORK_ROUTE_PREFIX}/integrations`;\n\n async function requireSession(event: any): Promise<boolean> {\n const session = await getSession(event).catch(() => null);\n if (session?.email) return true;\n setResponseStatus(event, 401);\n return false;\n }\n\n async function requireSessionContext(\n event: any,\n ): Promise<{ ownerEmail: string; orgId: string | null } | null> {\n const session = await getSession(event).catch(() => null);\n if (!session?.email) {\n setResponseStatus(event, 401);\n return null;\n }\n const orgCtx = await getOrgContext(event).catch(() => null);\n return {\n ownerEmail: session.email,\n orgId: orgCtx?.orgId ?? session.orgId ?? null,\n };\n }\n\n function toCredentialContext(\n ctx: { ownerEmail: string; orgId: string | null },\n opts?: { isIntegrationCaller?: boolean },\n ): IntegrationCredentialContext {\n return {\n userEmail: ctx.ownerEmail,\n ...(ctx.orgId ? { orgId: ctx.orgId } : {}),\n ...(opts?.isIntegrationCaller ? { isIntegrationCaller: true } : {}),\n };\n }\n\n async function credentialContextForIntegrationConfig(\n config: Awaited<ReturnType<typeof getIntegrationConfig>>,\n ): Promise<IntegrationCredentialContext | null> {\n const ownerEmail =\n typeof config?.owner === \"string\" ? config.owner.trim() : \"\";\n if (!ownerEmail) return null;\n const orgId = await resolveOrgIdForEmail(ownerEmail).catch(() => null);\n return {\n userEmail: ownerEmail,\n ...(orgId ? { orgId } : {}),\n isIntegrationCaller: true,\n };\n }\n\n async function withCredentialContext<T>(\n context: IntegrationCredentialContext | null,\n fn: () => Promise<T>,\n ): Promise<T> {\n if (!context) return fn();\n return runWithRequestContext(context, fn);\n }\n\n async function requireRemoteDevice(event: any) {\n const token = extractBearerToken(\n getRequestHeader(event, \"authorization\"),\n );\n const device = await authenticateRemoteDeviceToken(token);\n if (device) return device;\n setResponseStatus(event, 401);\n return null;\n }\n\n /**\n * Gate destructive integration writes (enable/disable, setup,\n * setIntegrationConfig…) behind an org-owner/admin check.\n *\n * `integration_configs` is keyed `(platform, config_key)` with no\n * owner column in the PRIMARY KEY — so this row is effectively\n * deployment-wide. Any signed-in user toggling /enable or /disable\n * would otherwise affect every other user (a regular org member could\n * disable Slack/email org-wide, write a malicious allowlist for\n * inbound email, etc.). This check enforces that only owners and\n * admins of the user's active org may mutate integration config.\n *\n * Solo / no-org sessions (i.e. ctx.orgId == null) are allowed — that's\n * the local-dev / single-user case where there's no privilege gradient\n * to enforce. The deployment is single-tenant by definition there.\n *\n * Returns an `{ ok: true }` on pass, or `{ ok: false, error }` with the\n * status already set on the event. The error string lines up with the\n * status code (401 → \"unauthorized\"; 403 → admin-required message).\n */\n async function checkOrgAdmin(\n event: any,\n ): Promise<{ ok: true } | { ok: false; error: string }> {\n const session = await getSession(event).catch(() => null);\n if (!session?.email) {\n setResponseStatus(event, 401);\n return { ok: false, error: \"unauthorized\" };\n }\n const ctx = await getOrgContext(event).catch(() => null);\n // Solo (no org membership) — single-tenant flow, allow.\n if (!ctx?.orgId) return { ok: true };\n if (ctx.role === \"owner\" || ctx.role === \"admin\") return { ok: true };\n setResponseStatus(event, 403);\n return {\n ok: false,\n error:\n \"Only organization owners and admins can mutate integration config\",\n };\n }\n\n // ─── Status endpoint (all integrations) ───────────────────────\n h3.use(\n `${P}/status`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"GET\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const baseUrl = getBaseUrl(event);\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const credentialContext = toCredentialContext(ctx);\n const statuses: IntegrationStatus[] = [];\n for (const adapter of adapters) {\n const status = await withCredentialContext(credentialContext, () =>\n adapter.getStatus(baseUrl),\n );\n const config = await getIntegrationConfig(adapter.platform);\n status.enabled = !!config?.configData?.enabled;\n status.webhookUrl = `${baseUrl}${P}/${adapter.platform}/webhook`;\n if (!status.requiredEnvKeys) {\n try {\n status.requiredEnvKeys = adapter.getRequiredEnvKeys();\n } catch {\n status.requiredEnvKeys = [];\n }\n }\n statuses.push(status);\n }\n return statuses;\n }),\n );\n\n // ─── Task queue status (observability) ───────────────────────\n // GET /_agent-native/integrations/task-queue/status\n // Returns counts + recent failures for the integration_pending_tasks\n // queue. Requires a normal session — this exposes operational data, not\n // platform secrets. If the queue table doesn't exist yet (no inbound\n // webhook has been processed), returns zeroed stats rather than 500.\n h3.use(\n `${P}/task-queue/status`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"GET\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n if (!(await requireSession(event))) return { error: \"unauthorized\" };\n try {\n return await getTaskQueueStats();\n } catch (err: any) {\n setResponseStatus(event, 500);\n return { error: err?.message ?? String(err) };\n }\n }),\n );\n\n // ─── Remote relay endpoints ──────────────────────────────────\n // These routes allow a signed-in browser session to enqueue work for a\n // registered remote device, and the device to claim/complete that work\n // using its one-time-issued bearer token. State lives entirely in SQL so\n // long polling can safely degrade to short polling on serverless hosts.\n h3.use(\n `${P}/remote/register`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"POST\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const body = (await readBody(event)) as {\n label?: unknown;\n platform?: unknown;\n appVersion?: unknown;\n version?: unknown;\n hostName?: unknown;\n hostname?: unknown;\n metadata?: unknown;\n };\n const label =\n typeof body.label === \"string\" && body.label.trim()\n ? body.label.trim().slice(0, 200)\n : \"Remote device\";\n const { device, token } = await createRemoteDevice({\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n label,\n platform: readString(body.platform),\n appVersion: readString(body.appVersion) ?? readString(body.version),\n hostName: readString(body.hostName) ?? readString(body.hostname),\n metadata: readObject(body.metadata),\n });\n return { device: toPublicRemoteDevice(device), token };\n }),\n );\n\n h3.use(\n `${P}/remote/hosts`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"GET\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const devices = await listRemoteDevicesForOwner({\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n limit: 50,\n });\n const hosts = devices.map(remoteDeviceToHost);\n const parts = mountedPathParts(event, \"remote/hosts\");\n if (parts[0]) {\n const host = hosts.find((candidate) => candidate.id === parts[0]);\n if (!host) {\n setResponseStatus(event, 404);\n return { error: \"host not found\" };\n }\n return { host, device: host.device };\n }\n return { hosts, devices: hosts };\n }),\n );\n\n h3.use(\n `${P}/remote/devices`,\n defineEventHandler(async (event) => {\n const method = getMethod(event);\n if (method !== \"GET\" && method !== \"DELETE\" && method !== \"POST\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const parts = mountedPathParts(event, \"remote/devices\");\n\n if (method === \"GET\") {\n if (!parts[0]) {\n const devices = await listRemoteDevicesForOwner({\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n limit: 100,\n });\n return {\n devices: devices.map(toPublicRemoteDevice),\n hosts: devices.map(remoteDeviceToHost),\n };\n }\n const device = await getRemoteDeviceForOwner({\n id: parts[0],\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n });\n if (!device) {\n setResponseStatus(event, 404);\n return { error: \"device not found\" };\n }\n return {\n device: toPublicRemoteDevice(device),\n host: remoteDeviceToHost(device),\n };\n }\n\n const id = parts[0];\n const action = parts[1];\n if (!id || (method === \"POST\" && action !== \"revoke\")) {\n setResponseStatus(event, 404);\n return { error: \"not found\" };\n }\n const device = await revokeRemoteDeviceForOwner({\n id,\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n });\n if (!device) {\n setResponseStatus(event, 404);\n return { error: \"device not found\" };\n }\n return { ok: true, device: toPublicRemoteDevice(device) };\n }),\n );\n\n h3.use(\n `${P}/remote/unregister`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"POST\" && getMethod(event) !== \"DELETE\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const device = await requireRemoteDevice(event);\n if (!device) return { error: \"unauthorized\" };\n await unregisterRemoteDevice(device.id);\n return { ok: true, deviceId: device.id };\n }),\n );\n\n h3.use(\n `${P}/remote/heartbeat`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"POST\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const device = await requireRemoteDevice(event);\n if (!device) return { error: \"unauthorized\" };\n const body = (await readBody(event)) as Record<string, unknown>;\n const updated = await updateRemoteDeviceDetails({\n id: device.id,\n label: readString(body.label),\n platform: readString(body.platform),\n appVersion: readString(body.appVersion) ?? readString(body.version),\n hostName: readString(body.hostName) ?? readString(body.hostname),\n metadata: readObject(body.metadata),\n });\n return {\n ok: true,\n device: updated ? toPublicRemoteDevice(updated) : null,\n };\n }),\n );\n\n h3.use(\n `${P}/remote/push/register`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"POST\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const body = (await readBody(event)) as Record<string, unknown>;\n const token = readString(body.token);\n if (!token) {\n setResponseStatus(event, 400);\n return { error: \"token required\" };\n }\n const registration = await upsertRemotePushRegistration({\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n provider: readString(body.provider) ?? \"unknown\",\n token,\n platform: readString(body.platform),\n clientDeviceId:\n readString(body.clientDeviceId) ?? readString(body.deviceId),\n label: readString(body.label),\n });\n return {\n registration: toPublicRemotePushRegistration(registration),\n };\n }),\n );\n\n h3.use(\n `${P}/remote/push/registrations`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"GET\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const registrations = await listRemotePushRegistrationsForOwner({\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n includeInactive: getQuery(event).includeInactive === \"true\",\n limit: 100,\n });\n return {\n registrations: registrations.map(toPublicRemotePushRegistration),\n };\n }),\n );\n\n h3.use(\n `${P}/remote/push/unregister`,\n defineEventHandler(async (event) => {\n const method = getMethod(event);\n if (method !== \"POST\" && method !== \"DELETE\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const body = (await readBody(event)) as Record<string, unknown>;\n const removed = await unregisterRemotePushRegistrationForOwner({\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n id: readString(body.id) ?? readString(body.registrationId),\n token: readString(body.token),\n });\n if (!removed) {\n setResponseStatus(event, 404);\n return { error: \"registration not found\" };\n }\n return { ok: true };\n }),\n );\n\n h3.use(\n `${P}/remote/push/notifications`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"GET\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const query = getQuery(event);\n const status =\n query.status === \"delivered\" ||\n query.status === \"failed\" ||\n query.status === \"pending\"\n ? query.status\n : undefined;\n const notifications = await listRemotePushNotificationsForOwner({\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n status,\n limit: Number(query.limit ?? 50) || 50,\n });\n return { notifications };\n }),\n );\n\n h3.use(\n `${P}/remote/runs`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"GET\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const parts = mountedPathParts(event, \"remote/runs\");\n const commands = await listRemoteCommandsForOwner({\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n limit: 100,\n });\n\n if (parts.length === 0) {\n return {\n runs: commands.map(remoteCommandToRunSummary).filter(Boolean),\n };\n }\n\n const runId = decodeURIComponent(parts[0] ?? \"\");\n const match = commands.find((command) => {\n const run = remoteCommandToRunSummary(command);\n return (\n command.id === runId || run?.id === runId || run?.runId === runId\n );\n });\n if (!match) {\n setResponseStatus(event, 404);\n return { error: \"run not found\" };\n }\n const run = remoteCommandToRunSummary(match);\n\n if (parts[1] === \"transcript\") {\n const remoteRunId =\n readString(run?.runId) ??\n readString(run?.id) ??\n readString(match.id);\n const events = remoteRunId\n ? await listRemoteRunEvents({\n deviceId: match.deviceId,\n remoteRunId,\n limit: 1000,\n })\n : [];\n return {\n run,\n events: events.map((event) => event.event),\n };\n }\n\n if (parts.length === 1) return { run };\n setResponseStatus(event, 404);\n return { error: \"not found\" };\n }),\n );\n\n h3.use(\n `${P}/remote/enqueue`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"POST\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const body = (await readBody(event)) as {\n deviceId?: unknown;\n kind?: unknown;\n params?: unknown;\n platform?: unknown;\n externalThreadId?: unknown;\n operation?: unknown;\n payload?: unknown;\n command?: unknown;\n source?: unknown;\n };\n const highLevel = enqueueBodyToRemoteCodeCommand(body);\n if (highLevel) {\n return enqueueRemoteCommand({\n kind: \"code-agent\",\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId ?? undefined,\n command: highLevel,\n source: body.source ?? {\n platform:\n typeof body.platform === \"string\" ? body.platform : \"mobile\",\n externalThreadId:\n typeof body.externalThreadId === \"string\"\n ? body.externalThreadId\n : \"mobile\",\n },\n });\n }\n if (typeof body.deviceId !== \"string\" || !body.deviceId.trim()) {\n setResponseStatus(event, 400);\n return { error: \"deviceId required\" };\n }\n if (!isRemoteCommandKind(body.kind)) {\n setResponseStatus(event, 400);\n return { error: \"invalid command kind\" };\n }\n const device = await getRemoteDeviceForOwner({\n id: body.deviceId,\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n });\n if (!device) {\n setResponseStatus(event, 404);\n return { error: \"device not found\" };\n }\n if (device.status !== \"active\") {\n setResponseStatus(event, 410);\n return { error: \"device revoked\" };\n }\n const command = await enqueueRemoteCommandRow({\n deviceId: device.id,\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n kind: body.kind,\n params: body.params ?? {},\n platform: typeof body.platform === \"string\" ? body.platform : null,\n externalThreadId:\n typeof body.externalThreadId === \"string\"\n ? body.externalThreadId\n : null,\n });\n return { command };\n }),\n );\n\n h3.use(\n `${P}/remote/poll`,\n defineEventHandler(async (event) => {\n const method = getMethod(event);\n if (method !== \"POST\" && method !== \"GET\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const device = await requireRemoteDevice(event);\n if (!device) return { error: \"unauthorized\" };\n const query = getQuery(event);\n const body =\n method === \"POST\"\n ? ((await readBody(event)) as { waitMs?: unknown })\n : {};\n const requestedWait =\n Number(body.waitMs ?? query.waitMs ?? query.wait_ms ?? 25_000) || 0;\n const waitMs = Math.max(0, Math.min(25_000, requestedWait));\n const deadline = Date.now() + waitMs;\n\n while (true) {\n const command = await claimNextRemoteCommand(device.id);\n if (command) return { command };\n const remaining = deadline - Date.now();\n if (remaining <= 0) return { command: null };\n await sleep(Math.min(1000, remaining));\n }\n }),\n );\n\n h3.use(\n `${P}/remote/result`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"POST\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const device = await requireRemoteDevice(event);\n if (!device) return { error: \"unauthorized\" };\n const body = (await readBody(event)) as {\n commandId?: unknown;\n status?: unknown;\n result?: unknown;\n errorMessage?: unknown;\n };\n if (typeof body.commandId !== \"string\" || !body.commandId.trim()) {\n setResponseStatus(event, 400);\n return { error: \"commandId required\" };\n }\n if (\n body.status !== \"running\" &&\n body.status !== \"completed\" &&\n body.status !== \"failed\"\n ) {\n setResponseStatus(event, 400);\n return { error: \"invalid command status\" };\n }\n const command = await updateRemoteCommandResult({\n deviceId: device.id,\n commandId: body.commandId,\n status: body.status,\n result: body.result,\n errorMessage:\n typeof body.errorMessage === \"string\" ? body.errorMessage : null,\n });\n if (!command) {\n setResponseStatus(event, 404);\n return { error: \"command not found\" };\n }\n if (command.status === \"completed\" || command.status === \"failed\") {\n await queueRemotePushNotifications({\n ownerEmail: device.ownerEmail,\n orgId: device.orgId,\n payload: remoteCommandPushPayload(command),\n }).catch((err) => {\n console.error(\"[integrations] remote push queue failed:\", err);\n });\n }\n return { command };\n }),\n );\n\n h3.use(\n `${P}/remote/run-events`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"POST\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const device = await requireRemoteDevice(event);\n if (!device) return { error: \"unauthorized\" };\n const body = (await readBody(event)) as {\n remoteRunId?: unknown;\n runId?: unknown;\n events?: unknown;\n };\n const remoteRunId =\n typeof body.remoteRunId === \"string\" && body.remoteRunId.trim()\n ? body.remoteRunId.trim()\n : typeof body.runId === \"string\" && body.runId.trim()\n ? body.runId.trim()\n : \"\";\n if (!remoteRunId) {\n setResponseStatus(event, 400);\n return { error: \"remoteRunId required\" };\n }\n if (!Array.isArray(body.events)) {\n setResponseStatus(event, 400);\n return { error: \"events required\" };\n }\n const events = body.events\n .slice(0, 1000)\n .map((entry, index) => {\n const value = entry as { seq?: unknown; event?: unknown };\n const rawEvent =\n value && typeof value === \"object\" && \"event\" in value\n ? value.event\n : entry;\n return {\n seq:\n value && typeof value === \"object\" && \"seq\" in value\n ? Number(value.seq)\n : index,\n event: rawEvent ?? null,\n };\n })\n .filter((entry) => Number.isInteger(entry.seq) && entry.seq >= 0);\n if (events.length !== body.events.length) {\n setResponseStatus(event, 400);\n return { error: \"invalid event sequence\" };\n }\n const result = await insertRemoteRunEvents({\n deviceId: device.id,\n remoteRunId,\n events,\n });\n return { ok: true, ...result };\n }),\n );\n\n // ─── Process pending task (cross-platform task queue) ────────\n // POST /_agent-native/integrations/process-task\n // Internal endpoint invoked via fire-and-forget self-webhook from the\n // public webhook handler. Auth: HMAC bearer signed with A2A_SECRET.\n // Each invocation runs the agent loop in a fresh function execution.\n h3.use(\n `${P}/process-task`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"POST\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n\n const body = (await readBody(event)) as { taskId?: string };\n const taskId = body?.taskId;\n if (!taskId) {\n setResponseStatus(event, 400);\n return { error: \"taskId required\" };\n }\n\n // Auth: HMAC token bound to the task id.\n //\n // In production we MUST require A2A_SECRET — a publicly-callable\n // process-task endpoint lets attackers re-trigger any queued task\n // by guessing or sniffing its id (C3 in the webhook security audit).\n // The atomic SQL claim only prevents *double*-processing, not the\n // first attacker-driven processing.\n //\n // In dev we keep the loose posture so contributors don't have to\n // configure A2A_SECRET to play with the integration locally.\n if (!process.env.A2A_SECRET) {\n if (process.env.NODE_ENV === \"production\") {\n setResponseStatus(event, 503);\n return {\n error:\n \"A2A_SECRET not configured — internal token signing is required to process integration tasks in production.\",\n };\n }\n // Dev: fall through unsigned (the atomic claim still gates double-processing).\n } else {\n const tok = extractBearerToken(\n getRequestHeader(event, \"authorization\"),\n );\n if (!tok || !verifyInternalToken(taskId, tok)) {\n setResponseStatus(event, 401);\n return { error: \"Invalid or expired internal token\" };\n }\n }\n\n // Atomic claim: only one invocation gets to process this task\n const task = await claimPendingTask(taskId);\n if (!task) {\n setResponseStatus(event, 200);\n return { ok: true, skipped: \"already-claimed-or-missing\" };\n }\n\n try {\n const adapter = adapterMap.get(task.platform);\n if (!adapter) {\n await markTaskFailed(taskId, `Unknown platform: ${task.platform}`);\n setResponseStatus(event, 404);\n return { error: \"Unknown platform\" };\n }\n const resources = await loadResourcesForPrompt(\n task.ownerEmail,\n true,\n options?.appId,\n );\n await processIntegrationTask(task, {\n adapter,\n systemPrompt: baseSystemPrompt + resources,\n actions,\n model,\n apiKey: getApiKey(),\n engine: options?.engine,\n ownerEmail: task.ownerEmail,\n });\n await markTaskCompleted(taskId);\n await processDueA2AContinuations({\n adapters: adapterMap,\n limit: 2,\n }).catch((err) => {\n console.error(\n \"[integrations] A2A continuation opportunistic sweep failed:\",\n err,\n );\n });\n return { ok: true, taskId };\n } catch (err: any) {\n await markTaskFailed(\n taskId,\n err?.message\n ? String(err.message).slice(0, 1000)\n : \"processor failed\",\n );\n // Log the detail server-side; never return the raw error message\n // to the caller. Raw messages have leaked DB error codes, schema\n // names, and stack hints in the past (L3 in the webhook security\n // audit). Sentry / log providers still see the full error.\n console.error(\"[integrations] process-task failure:\", err);\n setResponseStatus(event, 500);\n return { error: \"Internal task failed\" };\n }\n }),\n );\n\n // ─── Process deferred A2A continuation ──────────────────────────\n // POST /_agent-native/integrations/process-a2a-continuation\n // Internal endpoint invoked when call-agent timed out inside an\n // integration processor but the remote A2A task kept running.\n h3.use(\n `${P}/process-a2a-continuation`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"POST\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n\n const body = (await readBody(event)) as { continuationId?: string };\n const continuationId = body?.continuationId;\n if (!continuationId) {\n setResponseStatus(event, 400);\n return { error: \"continuationId required\" };\n }\n\n if (!process.env.A2A_SECRET) {\n if (process.env.NODE_ENV === \"production\") {\n setResponseStatus(event, 503);\n return {\n error:\n \"A2A_SECRET not configured — internal token signing is required to process A2A continuations in production.\",\n };\n }\n } else {\n const tok = extractBearerToken(\n getRequestHeader(event, \"authorization\"),\n );\n if (!tok || !verifyInternalToken(continuationId, tok)) {\n setResponseStatus(event, 401);\n return { error: \"Invalid or expired internal token\" };\n }\n }\n\n try {\n await processA2AContinuationById(continuationId, {\n adapters: adapterMap,\n });\n } catch (err: any) {\n // Mark the continuation failed so it isn't left dangling, and surface\n // a 500 to the caller instead of leaking an unhandled rejection.\n await failA2AContinuation(\n continuationId,\n err?.message?.slice(0, 500) || \"continuation processing failed\",\n ).catch(() => {});\n console.error(\n \"[integrations] process-a2a-continuation failure:\",\n err,\n );\n setResponseStatus(event, 500);\n return { error: \"Failed to process A2A continuation\" };\n }\n return { ok: true, continuationId };\n }),\n );\n\n // ─── Per-platform catch-all ───────────────────────────────────\n // Handles: webhook, status, enable, disable, setup for each platform\n h3.use(\n `${P}`,\n defineEventHandler(async (event) => {\n const method = getMethod(event);\n // event.path is stripped to the remainder after the mount prefix\n const raw = (event.path || \"/\").split(\"?\")[0].replace(/^\\//, \"\");\n const parts = raw.split(\"/\").filter(Boolean);\n\n // Already handled by the dedicated /status route above\n if (parts[0] === \"status\" && parts.length === 1) return;\n // Already handled by the dedicated /task-queue/status route above\n if (parts[0] === \"task-queue\") return;\n // Already handled by the dedicated /remote/* routes above\n if (parts[0] === \"remote\") return;\n // Already handled by the dedicated /process-task route above\n if (parts[0] === \"process-task\") return;\n // Already handled by the dedicated /process-a2a-continuation route above\n if (parts[0] === \"process-a2a-continuation\") return;\n\n const platform = parts[0];\n const action = parts[1]; // webhook, status, enable, disable, setup\n\n if (!platform) {\n setResponseStatus(event, 404);\n return { error: \"Platform required\" };\n }\n\n const adapter = adapterMap.get(platform);\n if (!adapter) {\n setResponseStatus(event, 404);\n return { error: `Unknown platform: ${platform}` };\n }\n\n // Set params for handlers that read them\n if (event.context) {\n event.context.params = {\n ...event.context.params,\n platform,\n };\n }\n\n // ─── GET /:platform/status ─────────────────────────────\n if (action === \"status\" && method === \"GET\") {\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const baseUrl = getBaseUrl(event);\n const status = await withCredentialContext(\n toCredentialContext(ctx),\n () => adapter.getStatus(baseUrl),\n );\n const config = await getIntegrationConfig(platform);\n status.enabled = !!config?.configData?.enabled;\n status.webhookUrl = `${baseUrl}${P}/${platform}/webhook`;\n if (!status.requiredEnvKeys) {\n try {\n status.requiredEnvKeys = adapter.getRequiredEnvKeys();\n } catch {\n status.requiredEnvKeys = [];\n }\n }\n return status;\n }\n\n // ─── POST /:platform/webhook ───────────────────────────\n if (action === \"webhook\" && method === \"POST\") {\n // Google Docs push notifications bypass the normal webhook flow —\n // they're opaque \"something changed\" pings, not message payloads.\n // We MUST verify the Pub/Sub OIDC token here. Without it, anyone\n // could POST any body to this URL and force a Drive changes pull\n // (H7 in the webhook security audit).\n if (platform === \"google-docs\") {\n const audience = process.env.GOOGLE_DOCS_PUSH_AUDIENCE;\n if (!audience) {\n if (process.env.NODE_ENV === \"production\") {\n // Fail closed in prod so a misconfigured deployment surfaces\n // in Pub/Sub's delivery metrics rather than silently\n // accepting anonymous requests.\n setResponseStatus(event, 503);\n return {\n ok: false,\n error:\n \"google-docs push endpoint disabled (audience not configured)\",\n };\n }\n // Dev: keep the loose posture so contributors can play with the\n // integration locally without configuring Pub/Sub.\n handlePushNotification().catch((err) => {\n console.error(\"[google-docs] Push handler error:\", err);\n });\n return \"ok\";\n }\n const authHeader = getRequestHeader(event, \"authorization\") || \"\";\n try {\n await verifyGoogleDocsPushToken(authHeader);\n } catch (err: any) {\n console.warn(\n `[google-docs] OIDC verify failed: ${err?.message ?? String(err)}`,\n );\n setResponseStatus(event, 401);\n return { ok: false, error: \"unauthorized\" };\n }\n handlePushNotification().catch((err) => {\n console.error(\"[google-docs] Push handler error:\", err);\n });\n return \"ok\";\n }\n\n const config = await getIntegrationConfig(platform);\n const credentialContext =\n await credentialContextForIntegrationConfig(config);\n\n // Handle platform verification challenges (e.g. Slack url_verification)\n // before checking enable state or parsing the message.\n const verification = await withCredentialContext(\n credentialContext,\n () => adapter.handleVerification(event),\n );\n if (verification.handled) {\n return verification.response ?? \"ok\";\n }\n\n if (!config?.configData?.enabled) {\n setResponseStatus(event, 404);\n return { error: `Integration ${platform} is not enabled` };\n }\n\n // Verify the webhook signature BEFORE parsing. We pre-parse the\n // body here (so handleWebhook can skip its second readBody, which\n // hangs on streaming providers), and that means handleWebhook's\n // own verifyWebhook step is bypassed. Without this call anyone\n // could POST a forged Slack/Telegram/email payload.\n const isValid = await withCredentialContext(credentialContext, () =>\n adapter.verifyWebhook(event),\n );\n if (!isValid) {\n setResponseStatus(event, 401);\n return { error: \"Invalid webhook signature\" };\n }\n\n const incoming = await withCredentialContext(credentialContext, () =>\n adapter.parseIncomingMessage(event),\n );\n if (!incoming) {\n setResponseStatus(event, 200);\n return \"ok\";\n }\n let owner = `integration@${platform}`;\n if (options?.resolveOwner) {\n try {\n owner = await options.resolveOwner(incoming);\n } catch (err) {\n console.error(\n `[integrations] resolveOwner failed, using default:`,\n err,\n );\n }\n }\n const resources = await loadResourcesForPrompt(\n owner,\n true,\n options?.appId,\n );\n const systemPrompt = baseSystemPrompt + resources;\n const result = await handleWebhook(event, {\n adapter,\n systemPrompt,\n actions,\n model,\n apiKey: getApiKey(),\n engine: options?.engine,\n appId: options?.appId,\n ownerEmail: owner,\n beforeProcess: options?.beforeProcess,\n incoming,\n });\n setResponseStatus(event, result.status);\n return result.body;\n }\n\n // ─── POST /:platform/enable ────────────────────────────\n if (action === \"enable\" && method === \"POST\") {\n const adminCheck = await checkOrgAdmin(event);\n if (adminCheck.ok === false) return { error: adminCheck.error };\n // Stamp the org-admin who toggled this so downstream code can\n // tell who is responsible — useful for audit logs even though\n // the row itself remains deployment-wide.\n const session = await getSession(event).catch(() => null);\n await saveIntegrationConfig(\n platform,\n { enabled: true },\n \"default\",\n session?.email,\n );\n return { ok: true, platform, enabled: true };\n }\n\n // ─── POST /:platform/disable ───────────────────────────\n if (action === \"disable\" && method === \"POST\") {\n const adminCheck = await checkOrgAdmin(event);\n if (adminCheck.ok === false) return { error: adminCheck.error };\n const session = await getSession(event).catch(() => null);\n await saveIntegrationConfig(\n platform,\n { enabled: false },\n \"default\",\n session?.email,\n );\n return { ok: true, platform, enabled: false };\n }\n\n // ─── POST /:platform/setup ─────────────────────────────\n if (action === \"setup\" && method === \"POST\") {\n const adminCheck = await checkOrgAdmin(event);\n if (adminCheck.ok === false) return { error: adminCheck.error };\n if (platform === \"telegram\") {\n const baseUrl = getBaseUrl(event);\n const webhookUrl = `${baseUrl}${P}/telegram/webhook`;\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const token = await withCredentialContext(\n toCredentialContext(ctx),\n () => resolveSecret(\"TELEGRAM_BOT_TOKEN\"),\n );\n if (!token) {\n setResponseStatus(event, 400);\n return {\n error:\n \"TELEGRAM_BOT_TOKEN not configured. Save it in settings.\",\n };\n }\n try {\n const res = await fetch(\n `https://api.telegram.org/bot${token}/setWebhook`,\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ url: webhookUrl }),\n },\n );\n const data = await res.json();\n return { ok: true, platform, webhookUrl, result: data };\n } catch (err: any) {\n setResponseStatus(event, 500);\n return { error: err.message };\n }\n }\n return { ok: true, platform, message: \"No setup required\" };\n }\n\n setResponseStatus(event, 404);\n return { error: \"Not found\" };\n }),\n );\n\n // ─── Start pending-tasks retry sweeper ────────────────────────\n // Sweeps the integration_pending_tasks queue every 60s and re-fires the\n // processor for any tasks that got stuck (initial dispatch lost or\n // processor killed mid-flight). No-ops gracefully if the queue table\n // hasn't been created yet on this deployment.\n startPendingTasksRetryJob({\n webhookBaseUrl: process.env.WEBHOOK_BASE_URL,\n });\n startA2AContinuationRetryJob(adapterMap);\n startRemoteCommandsRetryJob();\n\n // ─── Start Google Docs poller/push ────────────────────────────\n if (adapterMap.has(\"google-docs\")) {\n // Defer startup slightly so the server is fully ready\n setTimeout(() => {\n // We don't know the base URL at plugin init time — it depends on\n // the incoming request. For push mode, the webhook URL needs to be\n // resolved. We pass it as a special option; the poller will attempt\n // to register a watch when the first request reveals the base URL,\n // or use the WEBHOOK_BASE_URL env var if set.\n const baseUrl = process.env.WEBHOOK_BASE_URL;\n const webhookUrl = baseUrl\n ? `${withConfiguredAppBasePath(baseUrl)}${P}/google-docs/webhook`\n : undefined;\n\n startGoogleDocsPoller({\n systemPrompt: baseSystemPrompt,\n actions,\n model: model ?? \"\",\n apiKey: getApiKey(),\n ownerEmail: \"integration@google-docs\",\n webhookUrl,\n });\n }, 2000);\n }\n\n if (process.env.DEBUG)\n console.log(\n `[integrations] Mounted integration routes for: ${adapters.map((a) => a.platform).join(\", \")}`,\n );\n };\n}\n\n/**\n * Default integrations plugin — auto-mounts all adapters.\n */\nexport const defaultIntegrationsPlugin = createIntegrationsPlugin();\n\n/** Extract base URL from the request */\nfunction getBaseUrl(event: any): string {\n try {\n const headers = event.node?.req?.headers || event.headers || {};\n const getHeader = (name: string) =>\n typeof headers.get === \"function\"\n ? headers.get(name)\n : (headers as Record<string, string>)[name];\n const proto = getHeader(\"x-forwarded-proto\") || \"http\";\n const host = getHeader(\"host\") || \"localhost:3000\";\n return withConfiguredAppBasePath(`${proto}://${host}`);\n } catch {\n return withConfiguredAppBasePath(\"http://localhost:3000\");\n }\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n"]}
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/integrations/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACR,YAAY,GACb,MAAM,IAAI,CAAC;AACZ,OAAO,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EACL,QAAQ,EACR,yBAAyB,GAC1B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,EACd,uBAAuB,GACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAA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Status,\n setResponseHeader,\n getMethod,\n getQuery,\n sendRedirect,\n} from \"h3\";\nimport { getRequestHeader } from \"h3\";\nimport { createRemoteJWKSet, jwtVerify } from \"jose\";\n\nimport { abortRun } from \"../agent/run-manager.js\";\nimport { getOrgContext, resolveOrgIdForEmail } from \"../org/context.js\";\nimport { loadResourcesForPrompt } from \"../server/agent-chat-plugin.js\";\nimport { withConfiguredAppBasePath } from \"../server/app-base-path.js\";\nimport { getSession } from \"../server/auth.js\";\nimport { FRAMEWORK_ROUTE_PREFIX } from \"../server/core-routes-plugin.js\";\nimport { resolveSecret } from \"../server/credential-provider.js\";\nimport {\n getH3App,\n markDefaultPluginProvided,\n} from \"../server/framework-request-handler.js\";\nimport {\n decodeOAuthState,\n encodeOAuthState,\n oauthCallbackResponse,\n oauthErrorPage,\n resolveOAuthRedirectUri,\n} from \"../server/google-oauth.js\";\nimport { readBody } from \"../server/h3-helpers.js\";\nimport { runWithRequestContext } from \"../server/request-context.js\";\nimport {\n processA2AContinuationById,\n processDueA2AContinuations,\n} from \"./a2a-continuation-processor.js\";\nimport { failA2AContinuation } from \"./a2a-continuations-store.js\";\nimport { discordAdapter } from \"./adapters/discord.js\";\nimport { emailAdapter } from \"./adapters/email.js\";\nimport { googleDocsAdapter } from \"./adapters/google-docs.js\";\nimport { microsoftTeamsAdapter } from \"./adapters/microsoft-teams.js\";\nimport { slackAdapter } from \"./adapters/slack.js\";\nimport { telegramAdapter } from \"./adapters/telegram.js\";\nimport { whatsappAdapter } from \"./adapters/whatsapp.js\";\nimport {\n createComputerApprovalRequest,\n decideComputerApproval,\n listComputerApprovalsForOwner,\n} from \"./computer-supervision-store.js\";\nimport { ComputerSupervisionError } from \"./computer-supervision.js\";\nimport { getIntegrationConfig, saveIntegrationConfig } from \"./config-store.js\";\nimport { claimIntegrationControl } from \"./controls-store.js\";\nimport {\n startGoogleDocsPoller,\n handlePushNotification,\n} from \"./google-docs-poller.js\";\nimport {\n disconnectIntegrationInstallation,\n listIntegrationInstallations,\n resolveIntegrationTokenBundle,\n updateIntegrationInstallation,\n upsertIntegrationInstallation,\n} from \"./installations-store.js\";\nimport {\n forgetIntegrationMemory,\n integrationMemoryActions,\n listIntegrationMemory,\n rememberForIntegrationScope,\n} from \"./integration-memory.js\";\nimport {\n extractBearerToken,\n signInternalToken,\n verifyInternalToken,\n} from \"./internal-token.js\";\nimport { startPendingTasksRetryJob } from \"./pending-tasks-retry-job.js\";\nimport {\n claimPendingTask,\n getNextPendingTaskIdForThread,\n insertPendingTask,\n MAX_PENDING_TASK_ATTEMPTS,\n markTaskCompleted,\n markTaskFailed,\n markTaskRetryable,\n} from \"./pending-tasks-store.js\";\nimport {\n claimNextComputerCommand,\n claimNextRemoteCommand,\n enqueueComputerCommand,\n enqueueRemoteCommand as enqueueRemoteCommandRow,\n isRemoteCommandKind,\n listRemoteCommandsForOwner,\n updateRemoteCommandResult,\n} from \"./remote-commands-store.js\";\nimport {\n authenticateRemoteDeviceToken,\n createRemoteDevice,\n getRemoteComputerCapabilities,\n getRemoteDeviceForOwner,\n listRemoteDevicesForOwner,\n revokeRemoteDeviceForOwner,\n toPublicRemoteDevice,\n unregisterRemoteDevice,\n updateRemoteDeviceDetails,\n} from \"./remote-devices-store.js\";\nimport {\n listRemotePushNotificationsForOwner,\n listRemotePushRegistrationsForOwner,\n queueRemotePushNotifications,\n toPublicRemotePushRegistration,\n unregisterRemotePushRegistrationForOwner,\n upsertRemotePushRegistration,\n} from \"./remote-push-store.js\";\nimport { startRemoteCommandsRetryJob } from \"./remote-retry-job.js\";\nimport {\n insertRemoteRunEvents,\n listRemoteRunEvents,\n} from \"./remote-run-events-store.js\";\nimport type {\n ComputerCommandEnvelope,\n ComputerOperationClass,\n RemoteCommand,\n RemoteCommandKind,\n RemoteDevice,\n} from \"./remote-types.js\";\nimport { listIntegrationScopes, saveIntegrationScope } from \"./scope-store.js\";\nimport { buildSlackAgentManifest } from \"./slack-manifest.js\";\nimport {\n assertSlackInstallAccess,\n buildSlackAuthorizeUrl,\n exchangeSlackOAuthCode,\n slackOAuthResponseToInstallation,\n testSlackAuth,\n} from \"./slack-oauth.js\";\nimport { getTaskQueueStats } from \"./task-queue-stats.js\";\nimport type {\n PlatformAdapter,\n IntegrationsPluginOptions,\n IntegrationStatus,\n IntegrationExecutionContext,\n} from \"./types.js\";\nimport {\n listIntegrationUsageBudgets,\n saveIntegrationUsageBudget,\n} from \"./usage-budget-store.js\";\nimport { handleWebhook, processIntegrationTask } from \"./webhook-handler.js\";\n\ntype NitroPluginDef = (nitroApp: any) => void | Promise<void>;\n\nlet a2aContinuationRetryInterval: ReturnType<typeof setInterval> | null = null;\n\nfunction startA2AContinuationRetryJob(\n adapters: Map<string, PlatformAdapter>,\n): void {\n if (a2aContinuationRetryInterval) return;\n const initialTimer = setTimeout(() => {\n processDueA2AContinuations({ adapters }).catch((err) => {\n console.error(\"[integrations] A2A continuation retry job failed:\", err);\n });\n }, 10_000);\n unrefTimer(initialTimer);\n a2aContinuationRetryInterval = setInterval(() => {\n processDueA2AContinuations({ adapters }).catch((err) => {\n console.error(\"[integrations] A2A continuation retry job failed:\", err);\n });\n }, 60_000);\n unrefTimer(a2aContinuationRetryInterval);\n}\n\nfunction unrefTimer(timer: ReturnType<typeof setInterval>): void {\n (timer as unknown as { unref?: () => void }).unref?.();\n}\n\n// ─── Google Pub/Sub OIDC verifier (for Drive changes.watch push) ────────────\n// Cache Google's public keys for OIDC verification. jose handles TTL +\n// refresh internally — same pattern as templates/mail/.../gmail/push.post.ts.\n// Used to verify Google Pub/Sub push notifications carry a valid bearer token\n// signed by a configured service account. Without this, the webhook is wide\n// open to anonymous callers who can force a Drive sync (H7 in the audit).\nconst GOOGLE_JWKS = createRemoteJWKSet(\n new URL(\"https://www.googleapis.com/oauth2/v3/certs\"),\n);\nconst GOOGLE_ISSUERS = [\"https://accounts.google.com\", \"accounts.google.com\"];\n\n/**\n * Verify a Pub/Sub OIDC bearer token. Throws on any verification failure.\n * Requires GOOGLE_DOCS_PUSH_AUDIENCE and GOOGLE_DOCS_PUSH_SIGNER_EMAIL to be\n * set; if either is missing in production, the webhook handler refuses the\n * request entirely (so a misconfigured deployment fails closed, surfacing in\n * Pub/Sub's delivery metrics).\n */\nasync function verifyGoogleDocsPushToken(authHeader: string): Promise<void> {\n if (!authHeader.startsWith(\"Bearer \")) {\n throw new Error(\"missing bearer token\");\n }\n const token = authHeader.slice(7);\n const audience = process.env.GOOGLE_DOCS_PUSH_AUDIENCE;\n if (!audience) {\n throw new Error(\"GOOGLE_DOCS_PUSH_AUDIENCE not configured\");\n }\n const { payload } = await jwtVerify(token, GOOGLE_JWKS, {\n issuer: GOOGLE_ISSUERS,\n audience,\n });\n if (payload.email_verified !== true) {\n throw new Error(\"email_verified claim is not true\");\n }\n // Pin to a specific service account — without this, any Google-issued\n // token with the right audience could trigger a Drive sync.\n const expectedSigner = process.env.GOOGLE_DOCS_PUSH_SIGNER_EMAIL;\n if (!expectedSigner) {\n throw new Error(\"GOOGLE_DOCS_PUSH_SIGNER_EMAIL not configured\");\n }\n if (payload.email !== expectedSigner) {\n throw new Error(`unexpected signer: ${String(payload.email)}`);\n }\n}\n\n/** Built-in adapters, instantiated lazily */\nfunction getDefaultAdapters(): PlatformAdapter[] {\n return [\n slackAdapter(),\n telegramAdapter(),\n whatsappAdapter(),\n microsoftTeamsAdapter(),\n discordAdapter(),\n googleDocsAdapter(),\n emailAdapter(),\n ];\n}\n\nconst INTEGRATION_SYSTEM_PROMPT = `You are an AI agent responding via a messaging platform integration (Slack, Microsoft Teams, Discord interactions, Telegram, WhatsApp, etc.).\n\nYou have the same capabilities as the web chat agent. Use your tools to help the user.\n\nKeep responses concise — messaging platforms have character limits and users expect shorter replies than in a web interface. Use markdown sparingly (bold and lists are fine, but avoid complex formatting that may not render well on all platforms).\n\nIf a task requires many steps, summarize what you did rather than streaming every detail.`;\n\ntype RemoteCodeCommandEnvelope = {\n kind?: unknown;\n ownerEmail?: unknown;\n orgId?: unknown;\n command?: unknown;\n source?: unknown;\n};\n\ntype IntegrationCredentialContext = {\n userEmail: string;\n orgId?: string;\n isIntegrationCaller?: boolean;\n};\n\nconst REMOTE_DEVICE_ONLINE_MS = 90_000;\n\nexport async function enqueueRemoteCommand(\n envelope: RemoteCodeCommandEnvelope,\n): Promise<Record<string, unknown>> {\n const ownerEmail = readString(envelope.ownerEmail);\n if (!ownerEmail) throw new Error(\"ownerEmail is required\");\n const hasOrgId = Object.prototype.hasOwnProperty.call(envelope, \"orgId\");\n const orgId = hasOrgId ? (readString(envelope.orgId) ?? null) : undefined;\n const command = readObject(envelope.command);\n if (!command) throw new Error(\"command is required\");\n const commandType = readString(command.type);\n const commands = await listRemoteCommandsForOwner({\n ownerEmail,\n ...(hasOrgId ? { orgId } : {}),\n limit: 50,\n });\n\n if (commandType === \"list\") {\n return {\n ok: true,\n runs: commands.map(remoteCommandToRunSummary).filter(Boolean),\n hostOnline: await hasOnlineRemoteDevice(ownerEmail, orgId),\n };\n }\n\n if (commandType === \"status\") {\n const runRef = readString(command.runRef);\n const run = runRef\n ? commands.map(remoteCommandToRunSummary).find((item) => {\n const candidate = item as Record<string, unknown>;\n return candidate.id === runRef || candidate.runId === runRef;\n })\n : undefined;\n const hostOnline = await hasOnlineRemoteDevice(ownerEmail, orgId);\n return {\n ok: true,\n hostOnline,\n hostStatus: hostOnline ? \"online\" : \"offline\",\n ...(run ? { run } : {}),\n };\n }\n\n const devices = await listRemoteDevicesForOwner({\n ownerEmail,\n ...(hasOrgId ? { orgId } : {}),\n status: \"active\",\n limit: 10,\n });\n const requestedDeviceId =\n readString(command.hostId) ?? readString(command.deviceId);\n const device =\n (requestedDeviceId\n ? devices.find((candidate) => candidate.id === requestedDeviceId)\n : undefined) ?? devices[0];\n if (!device) {\n return {\n ok: false,\n hostOnline: false,\n hostStatus: \"offline\",\n error: \"No paired computer is available for code-agent commands.\",\n };\n }\n\n const source = readObject(envelope.source);\n const kind = remoteCodeCommandKind(commandType);\n if (!kind) throw new Error(`Unsupported code-agent command: ${commandType}`);\n const row = await enqueueRemoteCommandRow({\n deviceId: device.id,\n ownerEmail,\n orgId: device.orgId ?? orgId ?? null,\n kind,\n params: remoteCodeCommandParams(command),\n platform: readString(source?.platform) ?? null,\n externalThreadId: readString(source?.externalThreadId) ?? null,\n });\n const hostOnline = isRemoteDeviceOnline(device);\n return {\n ok: true,\n commandId: row.id,\n requestId: row.id,\n hostOnline,\n hostStatus: hostOnline ? \"online\" : \"offline\",\n message:\n commandType === \"create\"\n ? hostOnline\n ? `Queued code run (${row.id}).`\n : `Queued code run (${row.id}). Your computer looks offline or asleep, so it will pick this up when it wakes.`\n : undefined,\n };\n}\n\nfunction remoteCodeCommandKind(\n commandType: string | undefined,\n): RemoteCommandKind | null {\n switch (commandType) {\n case \"create\":\n return \"create-run\";\n case \"continue\":\n return \"append-followup\";\n case \"approve\":\n return \"approve\";\n case \"deny\":\n return \"deny\";\n case \"stop\":\n return \"stop\";\n default:\n return null;\n }\n}\n\nfunction remoteCodeCommandParams(\n command: Record<string, unknown>,\n): Record<string, unknown> {\n const type = readString(command.type);\n if (type === \"create\") {\n return {\n prompt: readString(command.prompt) ?? \"\",\n title: readString(command.title),\n cwd: readString(command.cwd),\n goalId: readString(command.goalId) ?? \"task\",\n permissionMode: readString(command.permissionMode),\n };\n }\n if (type === \"continue\") {\n return {\n runId: readString(command.runRef) ?? readString(command.runId),\n prompt: readString(command.text) ?? readString(command.prompt),\n permissionMode: readString(command.permissionMode),\n };\n }\n if (type === \"approve\" || type === \"deny\") {\n const id = readString(command.approvalId) ?? readString(command.runId);\n return { runId: id, approvalId: id };\n }\n if (type === \"stop\") {\n return { runId: readString(command.runRef) ?? readString(command.runId) };\n }\n return {};\n}\n\nfunction enqueueBodyToRemoteCodeCommand(\n body: Record<string, unknown>,\n): Record<string, unknown> | null {\n const direct = readObject(body.command);\n if (body.kind === \"code-agent\" && direct) return direct;\n\n const operation = readString(body.operation) ?? readString(body.type);\n const payload = readObject(body.payload) ?? body;\n if (!operation?.startsWith(\"code-agent.\")) return null;\n\n if (operation === \"code-agent.run.create\") {\n return {\n type: \"create\",\n prompt: payload.prompt,\n title: payload.title,\n hostId: payload.hostId,\n deviceId: payload.deviceId,\n cwd: payload.cwd,\n goalId: payload.goalId,\n permissionMode: payload.permissionMode,\n };\n }\n if (operation === \"code-agent.run.follow-up\") {\n return {\n type: \"continue\",\n runRef: payload.runId,\n text: payload.prompt ?? payload.message,\n hostId: payload.hostId,\n deviceId: payload.deviceId,\n permissionMode: payload.permissionMode,\n };\n }\n if (operation === \"code-agent.pending-command.decide\") {\n return {\n type: payload.decision === \"deny\" ? \"deny\" : \"approve\",\n approvalId: payload.commandId ?? payload.runId,\n runId: payload.runId,\n hostId: payload.hostId,\n deviceId: payload.deviceId,\n };\n }\n if (operation === \"code-agent.run.stop\") {\n return {\n type: \"stop\",\n runRef: payload.runId,\n hostId: payload.hostId,\n deviceId: payload.deviceId,\n };\n }\n return null;\n}\n\nfunction remoteCommandToRunSummary(\n command: RemoteCommand,\n): Record<string, unknown> | null {\n const result = readObject(command.result);\n const nestedResult = readObject(result?.result) ?? result;\n const run = readObject(nestedResult?.run);\n if (run) {\n return {\n ...run,\n commandId: command.id,\n hostId: command.deviceId,\n status: readString(run.status) ?? command.status,\n updatedAt: readString(run.updatedAt) ?? command.updatedAt,\n };\n }\n if (command.kind !== \"create-run\") return null;\n const params = readObject(command.params) ?? {};\n return {\n id: command.id,\n runId: command.id,\n hostId: command.deviceId,\n title:\n readString(params.title) ?? readString(params.prompt) ?? \"Queued run\",\n prompt: readString(params.prompt),\n status: command.status === \"failed\" ? \"errored\" : \"queued\",\n createdAt: command.createdAt,\n updatedAt: command.updatedAt,\n metadata: { remoteCommandId: command.id },\n };\n}\n\nfunction readObject(value: unknown): Record<string, unknown> | null {\n return value && typeof value === \"object\" && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : null;\n}\n\nfunction readString(value: unknown): string | undefined {\n return typeof value === \"string\" && value.trim() ? value.trim() : undefined;\n}\n\nfunction isRemoteDeviceOnline(device: { lastSeenAt: number | null }): boolean {\n return typeof device.lastSeenAt === \"number\"\n ? Date.now() - device.lastSeenAt <= REMOTE_DEVICE_ONLINE_MS\n : false;\n}\n\nasync function hasOnlineRemoteDevice(\n ownerEmail: string,\n orgId: string | null | undefined,\n): Promise<boolean> {\n const hasOrgId = orgId !== undefined;\n const devices = await listRemoteDevicesForOwner({\n ownerEmail,\n ...(hasOrgId ? { orgId } : {}),\n status: \"active\",\n limit: 10,\n });\n return devices.some(isRemoteDeviceOnline);\n}\n\nfunction remoteDeviceToHost(device: RemoteDevice): Record<string, unknown> {\n const online = device.status === \"active\" && isRemoteDeviceOnline(device);\n return {\n id: device.id,\n name: device.label,\n label: device.label,\n status:\n device.status === \"active\" ? (online ? \"online\" : \"offline\") : \"revoked\",\n lastSeenAt: device.lastSeenAt\n ? new Date(device.lastSeenAt).toISOString()\n : undefined,\n platform: device.platform ?? \"desktop\",\n appVersion: device.appVersion ?? undefined,\n hostName: device.hostName ?? undefined,\n metadata: device.metadata ?? undefined,\n device: toPublicRemoteDevice(device),\n };\n}\n\nfunction mountedPathParts(event: any, mountSuffix: string): string[] {\n const rawPath = String(\n event.path ?? event.url?.pathname ?? event.node?.req?.url ?? \"/\",\n ).split(\"?\")[0];\n const normalized = rawPath.replace(/^\\/+/, \"\");\n const marker = mountSuffix.replace(/^\\/+/, \"\");\n const markerIndex = normalized.indexOf(marker);\n const suffix =\n markerIndex >= 0\n ? normalized.slice(markerIndex + marker.length)\n : normalized;\n return suffix\n .split(\"/\")\n .filter(Boolean)\n .map((part) => decodeURIComponent(part));\n}\n\nfunction remoteCommandPushPayload(\n command: RemoteCommand,\n): Record<string, unknown> {\n const result = readObject(command.result);\n const status = command.status;\n const title =\n status === \"completed\"\n ? \"Remote run completed\"\n : status === \"failed\"\n ? \"Remote run failed\"\n : \"Remote run updated\";\n return {\n title,\n body: command.errorMessage ?? readString(result?.message),\n commandId: command.id,\n hostId: command.deviceId,\n kind: command.kind,\n status,\n result: command.result,\n updatedAt: command.updatedAt,\n };\n}\n\n/**\n * Creates a Nitro plugin that mounts messaging platform integration webhook routes.\n *\n * Routes:\n * POST /_agent-native/integrations/:platform/webhook — receive platform webhooks\n * GET /_agent-native/integrations/status — all integrations status\n * GET /_agent-native/integrations/:platform/status — single platform status\n * POST /_agent-native/integrations/:platform/enable — enable integration\n * POST /_agent-native/integrations/:platform/disable — disable integration\n * POST /_agent-native/integrations/:platform/setup — platform-specific setup\n */\nexport function createIntegrationsPlugin(\n options?: IntegrationsPluginOptions,\n): NitroPluginDef {\n return async (nitroApp: any) => {\n markDefaultPluginProvided(nitroApp, \"integrations\");\n const adapters = options?.adapters ?? getDefaultAdapters();\n const adapterMap = new Map<string, PlatformAdapter>();\n for (const adapter of adapters) {\n adapterMap.set(adapter.platform, adapter);\n }\n\n const model = options?.model;\n // Read the API key at REQUEST time, not plugin-init time. On Netlify\n // Lambda the plugin module loads in a context where env vars from the\n // site's runtime config may not yet be populated, so capturing at\n // init can leave us with an empty string forever. The getter\n // re-resolves on every webhook so freshly-set secrets work without\n // a redeploy.\n const getApiKey = () => options?.apiKey ?? \"\";\n\n // Build the system prompt\n const baseSystemPrompt = options?.systemPrompt ?? INTEGRATION_SYSTEM_PROMPT;\n\n // Resolve actions — auto-include call-agent so the integration agent can\n // delegate to other A2A apps, matching the behavior of the agent-chat plugin.\n const localActions = options?.actions ?? {};\n let callAgentEntry: Record<string, unknown> = {};\n try {\n const mod = await import(\"../scripts/call-agent.js\");\n callAgentEntry = {\n \"call-agent\": {\n tool: mod.tool,\n run: (args: Record<string, string>, context: unknown) =>\n mod.run(args, context as any, options?.appId),\n },\n };\n } catch {\n // call-agent script not available — skip\n }\n const actions = {\n ...integrationMemoryActions(),\n ...localActions,\n ...callAgentEntry,\n } as typeof localActions;\n\n const h3 = getH3App(nitroApp);\n const P = `${FRAMEWORK_ROUTE_PREFIX}/integrations`;\n\n async function requireSession(event: any): Promise<boolean> {\n const session = await getSession(event).catch(() => null);\n if (session?.email) return true;\n setResponseStatus(event, 401);\n return false;\n }\n\n async function requireSessionContext(\n event: any,\n ): Promise<{ ownerEmail: string; orgId: string | null } | null> {\n const session = await getSession(event).catch(() => null);\n if (!session?.email) {\n setResponseStatus(event, 401);\n return null;\n }\n const orgCtx = await getOrgContext(event).catch(() => null);\n return {\n ownerEmail: session.email,\n orgId: orgCtx?.orgId ?? session.orgId ?? null,\n };\n }\n\n function toCredentialContext(\n ctx: { ownerEmail: string; orgId: string | null },\n opts?: { isIntegrationCaller?: boolean },\n ): IntegrationCredentialContext {\n return {\n userEmail: ctx.ownerEmail,\n ...(ctx.orgId ? { orgId: ctx.orgId } : {}),\n ...(opts?.isIntegrationCaller ? { isIntegrationCaller: true } : {}),\n };\n }\n\n async function credentialContextForIntegrationConfig(\n config: Awaited<ReturnType<typeof getIntegrationConfig>>,\n ): Promise<IntegrationCredentialContext | null> {\n const ownerEmail =\n typeof config?.owner === \"string\" ? config.owner.trim() : \"\";\n if (!ownerEmail) return null;\n const orgId = await resolveOrgIdForEmail(ownerEmail).catch(() => null);\n return {\n userEmail: ownerEmail,\n ...(orgId ? { orgId } : {}),\n isIntegrationCaller: true,\n };\n }\n\n async function withCredentialContext<T>(\n context: IntegrationCredentialContext | null,\n fn: () => Promise<T>,\n ): Promise<T> {\n if (!context) return fn();\n return runWithRequestContext(context, fn);\n }\n\n async function requireRemoteDevice(event: any) {\n const token = extractBearerToken(\n getRequestHeader(event, \"authorization\"),\n );\n const device = await authenticateRemoteDeviceToken(token);\n if (device) return device;\n setResponseStatus(event, 401);\n return null;\n }\n\n /**\n * Gate destructive integration writes (enable/disable, setup,\n * setIntegrationConfig…) behind an org-owner/admin check.\n *\n * `integration_configs` is keyed `(platform, config_key)` with no\n * owner column in the PRIMARY KEY — so this row is effectively\n * deployment-wide. Any signed-in user toggling /enable or /disable\n * would otherwise affect every other user (a regular org member could\n * disable Slack/email org-wide, write a malicious allowlist for\n * inbound email, etc.). This check enforces that only owners and\n * admins of the user's active org may mutate integration config.\n *\n * Solo / no-org sessions (i.e. ctx.orgId == null) are allowed — that's\n * the local-dev / single-user case where there's no privilege gradient\n * to enforce. The deployment is single-tenant by definition there.\n *\n * Returns an `{ ok: true }` on pass, or `{ ok: false, error }` with the\n * status already set on the event. The error string lines up with the\n * status code (401 → \"unauthorized\"; 403 → admin-required message).\n */\n async function checkOrgAdmin(\n event: any,\n ): Promise<{ ok: true } | { ok: false; error: string }> {\n const session = await getSession(event).catch(() => null);\n if (!session?.email) {\n setResponseStatus(event, 401);\n return { ok: false, error: \"unauthorized\" };\n }\n const ctx = await getOrgContext(event).catch(() => null);\n // Solo (no org membership) — single-tenant flow, allow.\n if (!ctx?.orgId) return { ok: true };\n if (ctx.role === \"owner\" || ctx.role === \"admin\") return { ok: true };\n setResponseStatus(event, 403);\n return {\n ok: false,\n error:\n \"Only organization owners and admins can mutate integration config\",\n };\n }\n\n // ─── Status endpoint (all integrations) ───────────────────────\n h3.use(\n `${P}/status`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"GET\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const baseUrl = getBaseUrl(event);\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const credentialContext = toCredentialContext(ctx);\n const statuses: IntegrationStatus[] = [];\n for (const adapter of adapters) {\n const status = await withCredentialContext(credentialContext, () =>\n adapter.getStatus(baseUrl),\n );\n const config = await getIntegrationConfig(adapter.platform);\n status.enabled = !!config?.configData?.enabled;\n status.webhookUrl = `${baseUrl}${P}/${adapter.platform}/webhook`;\n if (!status.requiredEnvKeys) {\n try {\n status.requiredEnvKeys = adapter.getRequiredEnvKeys();\n } catch {\n status.requiredEnvKeys = [];\n }\n }\n statuses.push(status);\n }\n return statuses;\n }),\n );\n\n // ─── Task queue status (observability) ───────────────────────\n // GET /_agent-native/integrations/task-queue/status\n // Returns counts + recent failures for the integration_pending_tasks\n // queue. Requires a normal session — this exposes operational data, not\n // platform secrets. If the queue table doesn't exist yet (no inbound\n // webhook has been processed), returns zeroed stats rather than 500.\n h3.use(\n `${P}/task-queue/status`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"GET\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n if (!(await requireSession(event))) return { error: \"unauthorized\" };\n try {\n return await getTaskQueueStats();\n } catch (err: any) {\n setResponseStatus(event, 500);\n return { error: err?.message ?? String(err) };\n }\n }),\n );\n\n // ─── Remote relay endpoints ──────────────────────────────────\n // These routes allow a signed-in browser session to enqueue work for a\n // registered remote device, and the device to claim/complete that work\n // using its one-time-issued bearer token. State lives entirely in SQL so\n // long polling can safely degrade to short polling on serverless hosts.\n h3.use(\n `${P}/remote/register`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"POST\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const body = (await readBody(event)) as {\n label?: unknown;\n platform?: unknown;\n appVersion?: unknown;\n version?: unknown;\n hostName?: unknown;\n hostname?: unknown;\n metadata?: unknown;\n };\n const label =\n typeof body.label === \"string\" && body.label.trim()\n ? body.label.trim().slice(0, 200)\n : \"Remote device\";\n const { device, token } = await createRemoteDevice({\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n label,\n platform: readString(body.platform),\n appVersion: readString(body.appVersion) ?? readString(body.version),\n hostName: readString(body.hostName) ?? readString(body.hostname),\n metadata: readObject(body.metadata),\n });\n return { device: toPublicRemoteDevice(device), token };\n }),\n );\n\n h3.use(\n `${P}/remote/hosts`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"GET\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const devices = await listRemoteDevicesForOwner({\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n limit: 50,\n });\n const hosts = devices.map(remoteDeviceToHost);\n const parts = mountedPathParts(event, \"remote/hosts\");\n if (parts[0]) {\n const host = hosts.find((candidate) => candidate.id === parts[0]);\n if (!host) {\n setResponseStatus(event, 404);\n return { error: \"host not found\" };\n }\n return { host, device: host.device };\n }\n return { hosts, devices: hosts };\n }),\n );\n\n h3.use(\n `${P}/remote/devices`,\n defineEventHandler(async (event) => {\n const method = getMethod(event);\n if (method !== \"GET\" && method !== \"DELETE\" && method !== \"POST\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const parts = mountedPathParts(event, \"remote/devices\");\n\n if (method === \"GET\") {\n if (!parts[0]) {\n const devices = await listRemoteDevicesForOwner({\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n limit: 100,\n });\n return {\n devices: devices.map(toPublicRemoteDevice),\n hosts: devices.map(remoteDeviceToHost),\n };\n }\n const device = await getRemoteDeviceForOwner({\n id: parts[0],\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n });\n if (!device) {\n setResponseStatus(event, 404);\n return { error: \"device not found\" };\n }\n return {\n device: toPublicRemoteDevice(device),\n host: remoteDeviceToHost(device),\n };\n }\n\n const id = parts[0];\n const action = parts[1];\n if (!id || (method === \"POST\" && action !== \"revoke\")) {\n setResponseStatus(event, 404);\n return { error: \"not found\" };\n }\n const device = await revokeRemoteDeviceForOwner({\n id,\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n });\n if (!device) {\n setResponseStatus(event, 404);\n return { error: \"device not found\" };\n }\n return { ok: true, device: toPublicRemoteDevice(device) };\n }),\n );\n\n h3.use(\n `${P}/remote/unregister`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"POST\" && getMethod(event) !== \"DELETE\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const device = await requireRemoteDevice(event);\n if (!device) return { error: \"unauthorized\" };\n await unregisterRemoteDevice(device.id);\n return { ok: true, deviceId: device.id };\n }),\n );\n\n h3.use(\n `${P}/remote/heartbeat`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"POST\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const device = await requireRemoteDevice(event);\n if (!device) return { error: \"unauthorized\" };\n const body = (await readBody(event)) as Record<string, unknown>;\n const updated = await updateRemoteDeviceDetails({\n id: device.id,\n label: readString(body.label),\n platform: readString(body.platform),\n appVersion: readString(body.appVersion) ?? readString(body.version),\n hostName: readString(body.hostName) ?? readString(body.hostname),\n metadata: readObject(body.metadata),\n });\n return {\n ok: true,\n device: updated ? toPublicRemoteDevice(updated) : null,\n };\n }),\n );\n\n h3.use(\n `${P}/remote/push/register`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"POST\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const body = (await readBody(event)) as Record<string, unknown>;\n const token = readString(body.token);\n if (!token) {\n setResponseStatus(event, 400);\n return { error: \"token required\" };\n }\n const registration = await upsertRemotePushRegistration({\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n provider: readString(body.provider) ?? \"unknown\",\n token,\n platform: readString(body.platform),\n clientDeviceId:\n readString(body.clientDeviceId) ?? readString(body.deviceId),\n label: readString(body.label),\n });\n return {\n registration: toPublicRemotePushRegistration(registration),\n };\n }),\n );\n\n h3.use(\n `${P}/remote/push/registrations`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"GET\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const registrations = await listRemotePushRegistrationsForOwner({\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n includeInactive: getQuery(event).includeInactive === \"true\",\n limit: 100,\n });\n return {\n registrations: registrations.map(toPublicRemotePushRegistration),\n };\n }),\n );\n\n h3.use(\n `${P}/remote/push/unregister`,\n defineEventHandler(async (event) => {\n const method = getMethod(event);\n if (method !== \"POST\" && method !== \"DELETE\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const body = (await readBody(event)) as Record<string, unknown>;\n const removed = await unregisterRemotePushRegistrationForOwner({\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n id: readString(body.id) ?? readString(body.registrationId),\n token: readString(body.token),\n });\n if (!removed) {\n setResponseStatus(event, 404);\n return { error: \"registration not found\" };\n }\n return { ok: true };\n }),\n );\n\n h3.use(\n `${P}/remote/push/notifications`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"GET\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const query = getQuery(event);\n const status =\n query.status === \"delivered\" ||\n query.status === \"failed\" ||\n query.status === \"pending\"\n ? query.status\n : undefined;\n const notifications = await listRemotePushNotificationsForOwner({\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n status,\n limit: Number(query.limit ?? 50) || 50,\n });\n return { notifications };\n }),\n );\n\n h3.use(\n `${P}/remote/runs`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"GET\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const parts = mountedPathParts(event, \"remote/runs\");\n const commands = await listRemoteCommandsForOwner({\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n limit: 100,\n });\n\n if (parts.length === 0) {\n return {\n runs: commands.map(remoteCommandToRunSummary).filter(Boolean),\n };\n }\n\n const runId = decodeURIComponent(parts[0] ?? \"\");\n const match = commands.find((command) => {\n const run = remoteCommandToRunSummary(command);\n return (\n command.id === runId || run?.id === runId || run?.runId === runId\n );\n });\n if (!match) {\n setResponseStatus(event, 404);\n return { error: \"run not found\" };\n }\n const run = remoteCommandToRunSummary(match);\n\n if (parts[1] === \"transcript\") {\n const remoteRunId =\n readString(run?.runId) ??\n readString(run?.id) ??\n readString(match.id);\n const events = remoteRunId\n ? await listRemoteRunEvents({\n deviceId: match.deviceId,\n remoteRunId,\n limit: 1000,\n })\n : [];\n return {\n run,\n events: events.map((event) => event.event),\n };\n }\n\n if (parts.length === 1) return { run };\n setResponseStatus(event, 404);\n return { error: \"not found\" };\n }),\n );\n\n h3.use(\n `${P}/remote/computer/approvals`,\n defineEventHandler(async (event) => {\n const method = getMethod(event);\n if (method !== \"GET\" && method !== \"POST\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const parts = mountedPathParts(event, \"remote/computer/approvals\");\n if (method === \"GET\") {\n if (parts.length > 0) {\n setResponseStatus(event, 404);\n return { error: \"not found\" };\n }\n const query = getQuery(event);\n const status = readComputerApprovalStatus(query.status);\n return {\n approvals: await listComputerApprovalsForOwner({\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n deviceId: readString(query.deviceId),\n taskId: readString(query.taskId),\n runId: readString(query.runId),\n status,\n limit: Number(query.limit ?? 100) || 100,\n }),\n };\n }\n const body = (await readBody(event)) as Record<string, unknown>;\n if (parts[0] && parts[1] === \"decision\" && parts.length === 2) {\n const decision =\n body.decision === \"approved\" || body.decision === \"denied\"\n ? body.decision\n : null;\n const actionHash = readString(body.actionHash);\n if (!decision || !actionHash) {\n setResponseStatus(event, 400);\n return { error: \"decision and actionHash required\" };\n }\n const approval = await decideComputerApproval({\n id: decodeURIComponent(parts[0]),\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n actionHash,\n decision,\n decidedBy: ctx.ownerEmail,\n result: readObject(body.result),\n });\n if (!approval) {\n setResponseStatus(event, 404);\n return { error: \"approval not found or no longer pending\" };\n }\n return { approval };\n }\n if (parts.length > 0) {\n setResponseStatus(event, 404);\n return { error: \"not found\" };\n }\n const deviceId = readString(body.deviceId);\n if (!deviceId || !body.envelope) {\n setResponseStatus(event, 400);\n return { error: \"deviceId and envelope required\" };\n }\n try {\n const approval = await createComputerApprovalRequest({\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n deviceId,\n envelope: body.envelope as ComputerCommandEnvelope,\n });\n return { approval };\n } catch (error) {\n return computerSupervisionRouteError(event, error);\n }\n }),\n );\n\n h3.use(\n `${P}/remote/computer/commands`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"POST\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const body = (await readBody(event)) as Record<string, unknown>;\n const deviceId = readString(body.deviceId);\n if (!deviceId || !body.envelope) {\n setResponseStatus(event, 400);\n return { error: \"deviceId and envelope required\" };\n }\n try {\n const command = await enqueueComputerCommand({\n deviceId,\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n envelope: body.envelope as ComputerCommandEnvelope,\n platform: readString(body.platform),\n });\n return { command };\n } catch (error) {\n return computerSupervisionRouteError(event, error);\n }\n }),\n );\n\n h3.use(\n `${P}/remote/enqueue`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"POST\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const body = (await readBody(event)) as {\n deviceId?: unknown;\n kind?: unknown;\n params?: unknown;\n platform?: unknown;\n externalThreadId?: unknown;\n operation?: unknown;\n payload?: unknown;\n command?: unknown;\n source?: unknown;\n };\n const highLevel = enqueueBodyToRemoteCodeCommand(body);\n if (highLevel) {\n return enqueueRemoteCommand({\n kind: \"code-agent\",\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId ?? undefined,\n command: highLevel,\n source: body.source ?? {\n platform:\n typeof body.platform === \"string\" ? body.platform : \"mobile\",\n externalThreadId:\n typeof body.externalThreadId === \"string\"\n ? body.externalThreadId\n : \"mobile\",\n },\n });\n }\n if (typeof body.deviceId !== \"string\" || !body.deviceId.trim()) {\n setResponseStatus(event, 400);\n return { error: \"deviceId required\" };\n }\n if (!isRemoteCommandKind(body.kind)) {\n setResponseStatus(event, 400);\n return { error: \"invalid command kind\" };\n }\n const device = await getRemoteDeviceForOwner({\n id: body.deviceId,\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n });\n if (!device) {\n setResponseStatus(event, 404);\n return { error: \"device not found\" };\n }\n if (device.status !== \"active\") {\n setResponseStatus(event, 410);\n return { error: \"device revoked\" };\n }\n const command = await enqueueRemoteCommandRow({\n deviceId: device.id,\n ownerEmail: ctx.ownerEmail,\n orgId: ctx.orgId,\n kind: body.kind,\n params: body.params ?? {},\n platform: typeof body.platform === \"string\" ? body.platform : null,\n externalThreadId:\n typeof body.externalThreadId === \"string\"\n ? body.externalThreadId\n : null,\n });\n return { command };\n }),\n );\n\n h3.use(\n `${P}/remote/poll`,\n defineEventHandler(async (event) => {\n const method = getMethod(event);\n if (method !== \"POST\" && method !== \"GET\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const device = await requireRemoteDevice(event);\n if (!device) return { error: \"unauthorized\" };\n const query = getQuery(event);\n const body =\n method === \"POST\"\n ? ((await readBody(event)) as {\n waitMs?: unknown;\n computerCapabilities?: unknown;\n })\n : {};\n let pollingDevice = device;\n if (\n method === \"POST\" &&\n Object.prototype.hasOwnProperty.call(body, \"computerCapabilities\")\n ) {\n const computerCapabilities = readComputerCapabilities(\n body.computerCapabilities,\n );\n const updated = await updateRemoteDeviceDetails({\n id: device.id,\n metadata: {\n ...(device.metadata ?? {}),\n computerCapabilities,\n },\n });\n if (updated) pollingDevice = updated;\n }\n const requestedWait =\n Number(body.waitMs ?? query.waitMs ?? query.wait_ms ?? 25_000) || 0;\n const waitMs = Math.max(0, Math.min(25_000, requestedWait));\n const deadline = Date.now() + waitMs;\n\n while (true) {\n const operationClasses =\n advertisedComputerOperationClasses(pollingDevice);\n const computerCommand =\n operationClasses.length > 0\n ? await claimNextComputerCommand({\n deviceId: pollingDevice.id,\n ownerEmail: pollingDevice.ownerEmail,\n orgId: pollingDevice.orgId,\n operationClasses,\n })\n : null;\n const command =\n computerCommand ?? (await claimNextRemoteCommand(pollingDevice.id));\n if (command) return { command };\n const remaining = deadline - Date.now();\n if (remaining <= 0) return { command: null };\n await sleep(Math.min(1000, remaining));\n }\n }),\n );\n\n h3.use(\n `${P}/remote/result`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"POST\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const device = await requireRemoteDevice(event);\n if (!device) return { error: \"unauthorized\" };\n const body = (await readBody(event)) as {\n commandId?: unknown;\n status?: unknown;\n result?: unknown;\n errorMessage?: unknown;\n };\n if (typeof body.commandId !== \"string\" || !body.commandId.trim()) {\n setResponseStatus(event, 400);\n return { error: \"commandId required\" };\n }\n if (\n body.status !== \"running\" &&\n body.status !== \"completed\" &&\n body.status !== \"failed\"\n ) {\n setResponseStatus(event, 400);\n return { error: \"invalid command status\" };\n }\n const command = await updateRemoteCommandResult({\n deviceId: device.id,\n commandId: body.commandId,\n status: body.status,\n result: body.result,\n errorMessage:\n typeof body.errorMessage === \"string\" ? body.errorMessage : null,\n });\n if (!command) {\n setResponseStatus(event, 404);\n return { error: \"command not found\" };\n }\n if (command.status === \"completed\" || command.status === \"failed\") {\n await queueRemotePushNotifications({\n ownerEmail: device.ownerEmail,\n orgId: device.orgId,\n payload: remoteCommandPushPayload(command),\n }).catch((err) => {\n console.error(\"[integrations] remote push queue failed:\", err);\n });\n }\n return { command };\n }),\n );\n\n h3.use(\n `${P}/remote/run-events`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"POST\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const device = await requireRemoteDevice(event);\n if (!device) return { error: \"unauthorized\" };\n const body = (await readBody(event)) as {\n remoteRunId?: unknown;\n runId?: unknown;\n events?: unknown;\n };\n const remoteRunId =\n typeof body.remoteRunId === \"string\" && body.remoteRunId.trim()\n ? body.remoteRunId.trim()\n : typeof body.runId === \"string\" && body.runId.trim()\n ? body.runId.trim()\n : \"\";\n if (!remoteRunId) {\n setResponseStatus(event, 400);\n return { error: \"remoteRunId required\" };\n }\n if (!Array.isArray(body.events)) {\n setResponseStatus(event, 400);\n return { error: \"events required\" };\n }\n const events = body.events\n .slice(0, 1000)\n .map((entry, index) => {\n const value = entry as { seq?: unknown; event?: unknown };\n const rawEvent =\n value && typeof value === \"object\" && \"event\" in value\n ? value.event\n : entry;\n return {\n seq:\n value && typeof value === \"object\" && \"seq\" in value\n ? Number(value.seq)\n : index,\n event: rawEvent ?? null,\n };\n })\n .filter((entry) => Number.isInteger(entry.seq) && entry.seq >= 0);\n if (events.length !== body.events.length) {\n setResponseStatus(event, 400);\n return { error: \"invalid event sequence\" };\n }\n const result = await insertRemoteRunEvents({\n deviceId: device.id,\n remoteRunId,\n events,\n });\n return { ok: true, ...result };\n }),\n );\n\n // ─── Process pending task (cross-platform task queue) ────────\n // POST /_agent-native/integrations/process-task\n // Internal endpoint invoked via fire-and-forget self-webhook from the\n // public webhook handler. Auth: HMAC bearer signed with A2A_SECRET.\n // Each invocation runs the agent loop in a fresh function execution.\n h3.use(\n `${P}/process-task`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"POST\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n\n const body = (await readBody(event)) as { taskId?: string };\n const taskId = body?.taskId;\n if (!taskId) {\n setResponseStatus(event, 400);\n return { error: \"taskId required\" };\n }\n\n // Auth: HMAC token bound to the task id.\n //\n // In production we MUST require A2A_SECRET — a publicly-callable\n // process-task endpoint lets attackers re-trigger any queued task\n // by guessing or sniffing its id (C3 in the webhook security audit).\n // The atomic SQL claim only prevents *double*-processing, not the\n // first attacker-driven processing.\n //\n // In dev we keep the loose posture so contributors don't have to\n // configure A2A_SECRET to play with the integration locally.\n if (!process.env.A2A_SECRET) {\n if (process.env.NODE_ENV === \"production\") {\n setResponseStatus(event, 503);\n return {\n error:\n \"A2A_SECRET not configured — internal token signing is required to process integration tasks in production.\",\n };\n }\n // Dev: fall through unsigned (the atomic claim still gates double-processing).\n } else {\n const tok = extractBearerToken(\n getRequestHeader(event, \"authorization\"),\n );\n if (!tok || !verifyInternalToken(taskId, tok)) {\n setResponseStatus(event, 401);\n return { error: \"Invalid or expired internal token\" };\n }\n }\n\n // Atomic claim: only one invocation gets to process this task\n const task = await claimPendingTask(taskId);\n if (!task) {\n setResponseStatus(event, 200);\n return { ok: true, skipped: \"already-claimed-or-missing\" };\n }\n\n try {\n const adapter = adapterMap.get(task.platform);\n if (!adapter) {\n await markTaskFailed(taskId, `Unknown platform: ${task.platform}`);\n setResponseStatus(event, 404);\n return { error: \"Unknown platform\" };\n }\n await runWithRequestContext(\n {\n userEmail: task.ownerEmail,\n ...(task.orgId ? { orgId: task.orgId } : {}),\n isIntegrationCaller: true,\n },\n async () => {\n const resources = await loadResourcesForPrompt(\n task.ownerEmail,\n true,\n options?.appId,\n task.orgId,\n );\n await processIntegrationTask(task, {\n adapter,\n systemPrompt: baseSystemPrompt + resources,\n actions,\n model,\n apiKey: getApiKey(),\n engine: options?.engine,\n ownerEmail: task.ownerEmail,\n appId: options?.appId,\n });\n },\n );\n await markTaskCompleted(taskId);\n const nextTaskId = await getNextPendingTaskIdForThread(\n task.platform,\n task.externalThreadId,\n );\n if (nextTaskId) {\n const nextToken = signInternalToken(nextTaskId);\n void fetch(`${getBaseUrl(event)}${P}/process-task`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n ...(nextToken ? { Authorization: `Bearer ${nextToken}` } : {}),\n },\n body: JSON.stringify({ taskId: nextTaskId }),\n }).catch((err) => {\n console.error(\n \"[integrations] Failed to dispatch queued thread turn:\",\n err,\n );\n });\n }\n await processDueA2AContinuations({\n adapters: adapterMap,\n limit: 2,\n }).catch((err) => {\n console.error(\n \"[integrations] A2A continuation opportunistic sweep failed:\",\n err,\n );\n });\n return { ok: true, taskId };\n } catch (err: any) {\n const errorMessage = err?.message\n ? String(err.message).slice(0, 1000)\n : \"processor failed\";\n if (task.attempts >= MAX_PENDING_TASK_ATTEMPTS) {\n await markTaskFailed(taskId, errorMessage);\n } else {\n await markTaskRetryable(taskId, errorMessage);\n }\n // Log the detail server-side; never return the raw error message\n // to the caller. Raw messages have leaked DB error codes, schema\n // names, and stack hints in the past (L3 in the webhook security\n // audit). Sentry / log providers still see the full error.\n console.error(\"[integrations] process-task failure:\", err);\n setResponseStatus(event, 500);\n return { error: \"Internal task failed\" };\n }\n }),\n );\n\n // ─── Process deferred A2A continuation ──────────────────────────\n // POST /_agent-native/integrations/process-a2a-continuation\n // Internal endpoint invoked when call-agent timed out inside an\n // integration processor but the remote A2A task kept running.\n h3.use(\n `${P}/process-a2a-continuation`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"POST\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n\n const body = (await readBody(event)) as { continuationId?: string };\n const continuationId = body?.continuationId;\n if (!continuationId) {\n setResponseStatus(event, 400);\n return { error: \"continuationId required\" };\n }\n\n if (!process.env.A2A_SECRET) {\n if (process.env.NODE_ENV === \"production\") {\n setResponseStatus(event, 503);\n return {\n error:\n \"A2A_SECRET not configured — internal token signing is required to process A2A continuations in production.\",\n };\n }\n } else {\n const tok = extractBearerToken(\n getRequestHeader(event, \"authorization\"),\n );\n if (!tok || !verifyInternalToken(continuationId, tok)) {\n setResponseStatus(event, 401);\n return { error: \"Invalid or expired internal token\" };\n }\n }\n\n try {\n await processA2AContinuationById(continuationId, {\n adapters: adapterMap,\n });\n } catch (err: any) {\n // Mark the continuation failed so it isn't left dangling, and surface\n // a 500 to the caller instead of leaking an unhandled rejection.\n await failA2AContinuation(\n continuationId,\n err?.message?.slice(0, 500) || \"continuation processing failed\",\n ).catch(() => {});\n console.error(\n \"[integrations] process-a2a-continuation failure:\",\n err,\n );\n setResponseStatus(event, 500);\n return { error: \"Failed to process A2A continuation\" };\n }\n return { ok: true, continuationId };\n }),\n );\n\n // ─── Slack native action controls ─────────────────────────────\n h3.use(\n `${P}/slack/interactions`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"POST\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const adapter = adapterMap.get(\"slack\");\n if (!adapter) {\n setResponseStatus(event, 404);\n return \"ok\";\n }\n // handleVerification caches the exact raw form bytes even though the\n // body is not JSON; verifyWebhook then validates Slack's HMAC before\n // any action value is parsed.\n await adapter.handleVerification(event);\n if (!(await adapter.verifyWebhook(event))) {\n setResponseStatus(event, 401);\n return { error: \"Invalid webhook signature\" };\n }\n try {\n const raw = String(event.context?.__rawBody ?? \"\");\n const encoded = new URLSearchParams(raw).get(\"payload\");\n const payload = encoded ? JSON.parse(encoded) : null;\n const action = payload?.actions?.[0];\n const actionKind =\n action?.action_id === \"agent_native_approve\"\n ? \"approve\"\n : action?.action_id === \"agent_native_deny\"\n ? \"deny\"\n : action?.action_id === \"agent_native_cancel\"\n ? \"cancel\"\n : null;\n if (!actionKind || typeof action?.value !== \"string\") return \"ok\";\n const requesterId = payload?.user?.id;\n const teamId = payload?.team?.id ?? payload?.user?.team_id;\n const channelId =\n payload?.channel?.id ?? payload?.container?.channel_id;\n const messageTs = payload?.container?.message_ts;\n if (!requesterId || !teamId || !channelId || !messageTs) {\n return \"ok\";\n }\n const control = await claimIntegrationControl({\n id: action.value,\n action: actionKind,\n requesterId,\n teamId,\n apiAppId:\n typeof payload?.api_app_id === \"string\" ? payload.api_app_id : \"\",\n channelId,\n messageTs,\n });\n if (!control) return \"ok\";\n if (actionKind === \"cancel\") {\n if (control.runId) abortRun(control.runId, \"slack_cancel\");\n return \"ok\";\n }\n if (actionKind === \"deny\") return \"ok\";\n if (!control.approvalKey) return \"ok\";\n\n const taskId = `task-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;\n const incoming = {\n ...control.incoming,\n text: \"The requester approved the pending action. Continue the task.\",\n approvedToolCalls: [control.approvalKey],\n timestamp: Date.now(),\n platformContext: {\n ...control.incoming.platformContext,\n eventId: `control:${control.id}`,\n },\n };\n await insertPendingTask({\n id: taskId,\n platform: incoming.platform,\n externalThreadId: incoming.externalThreadId,\n payload: JSON.stringify({ incoming }),\n ownerEmail: control.ownerEmail,\n orgId: control.orgId,\n externalEventKey: `control:${control.id}`,\n });\n const processUrl = `${getBaseUrl(event)}${P}/process-task`;\n const token = signInternalToken(taskId);\n void fetch(processUrl, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n ...(token ? { Authorization: `Bearer ${token}` } : {}),\n },\n body: JSON.stringify({ taskId }),\n }).catch((err) => {\n console.error(\"[slack] Approval dispatch failed:\", err);\n });\n } catch (err) {\n console.error(\"[slack] Interaction handling failed:\", err);\n }\n return \"ok\";\n }),\n );\n\n // ─── Managed integration installations ───────────────────────\n h3.use(\n `${P}/installations`,\n defineEventHandler(async (event) => {\n const method = getMethod(event);\n if (method !== \"GET\" && method !== \"POST\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const session = await getSession(event).catch(() => null);\n if (!session?.email) {\n setResponseStatus(event, 401);\n return { error: \"unauthorized\" };\n }\n const org = await getOrgContext(event).catch(() => null);\n const actor = {\n userEmail: session.email,\n orgId: org?.orgId ?? session.orgId ?? null,\n isOrgAdmin: org?.role === \"owner\" || org?.role === \"admin\",\n };\n if (method === \"GET\") {\n const query = getQuery(event);\n return {\n installations: await listIntegrationInstallations(\n actor,\n typeof query.platform === \"string\" ? query.platform : undefined,\n ),\n };\n }\n const body = (await readBody(event)) as {\n id?: unknown;\n action?: unknown;\n };\n const id = typeof body.id === \"string\" ? body.id : \"\";\n if (!id) {\n setResponseStatus(event, 400);\n return { error: \"installation id required\" };\n }\n if (body.action === \"disconnect\") {\n return {\n installation: await disconnectIntegrationInstallation(id, actor),\n };\n }\n if (body.action === \"test\") {\n const installation = (\n await listIntegrationInstallations(actor, \"slack\")\n ).find((item) => item.id === id);\n if (!installation) {\n setResponseStatus(event, 404);\n return { error: \"installation not found\" };\n }\n const bundle = await resolveIntegrationTokenBundle(\n installation.platform,\n installation.installationKey,\n );\n if (!bundle) {\n const updated = await updateIntegrationInstallation(id, actor, {\n health: \"revoked\",\n status: \"revoked\",\n lastError: \"token_unavailable\",\n healthCheckedAt: Date.now(),\n });\n return { installation: updated };\n }\n const health = await testSlackAuth(bundle.accessToken);\n const updated = await updateIntegrationInstallation(id, actor, {\n health: health.health,\n status: health.health === \"revoked\" ? \"revoked\" : \"connected\",\n lastError: health.error,\n healthCheckedAt: health.checkedAt,\n ...(health.ok ? { lastHealthyAt: health.checkedAt } : {}),\n });\n return { installation: updated };\n }\n setResponseStatus(event, 400);\n return { error: \"unsupported installation action\" };\n }),\n );\n\n h3.use(\n `${P}/scopes`,\n defineEventHandler(async (event) => {\n const method = getMethod(event);\n if (method !== \"GET\" && method !== \"POST\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const access = { ownerEmail: ctx.ownerEmail, orgId: ctx.orgId };\n if (method === \"GET\") {\n const query = getQuery(event);\n return {\n scopes: await listIntegrationScopes(access, {\n platform:\n typeof query.platform === \"string\" ? query.platform : undefined,\n tenantId:\n typeof query.tenantId === \"string\" ? query.tenantId : undefined,\n }),\n };\n }\n const admin = await checkOrgAdmin(event);\n if (!admin.ok) return { error: admin.error };\n try {\n const body = (await readBody(event)) as Parameters<\n typeof saveIntegrationScope\n >[0];\n return { scope: await saveIntegrationScope(body, access) };\n } catch (err) {\n setResponseStatus(event, 400);\n return {\n error: err instanceof Error ? err.message : \"invalid scope\",\n };\n }\n }),\n );\n\n h3.use(\n `${P}/budgets`,\n defineEventHandler(async (event) => {\n const method = getMethod(event);\n if (method !== \"GET\" && method !== \"POST\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const access = { ownerEmail: ctx.ownerEmail, orgId: ctx.orgId };\n if (method === \"GET\") {\n return { budgets: await listIntegrationUsageBudgets(access) };\n }\n const admin = await checkOrgAdmin(event);\n if (!admin.ok) return { error: admin.error };\n try {\n const body = (await readBody(event)) as Parameters<\n typeof saveIntegrationUsageBudget\n >[0];\n return {\n budget: await saveIntegrationUsageBudget(body, access),\n };\n } catch (err) {\n setResponseStatus(event, 400);\n return {\n error: err instanceof Error ? err.message : \"invalid budget\",\n };\n }\n }),\n );\n\n h3.use(\n `${P}/memory`,\n defineEventHandler(async (event) => {\n const method = getMethod(event);\n if (method !== \"GET\" && method !== \"POST\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const access = { ownerEmail: ctx.ownerEmail, orgId: ctx.orgId };\n const query = getQuery(event);\n const body =\n method === \"POST\"\n ? ((await readBody(event)) as Record<string, unknown>)\n : null;\n const scopeId =\n typeof query.scopeId === \"string\"\n ? query.scopeId\n : typeof body?.scopeId === \"string\"\n ? body.scopeId\n : \"\";\n const scope = (await listIntegrationScopes(access)).find(\n (item) => item.id === scopeId,\n );\n if (!scope) {\n setResponseStatus(event, 404);\n return { error: \"integration scope not found\" };\n }\n if (method === \"GET\") {\n return { memories: await listIntegrationMemory(scope.id) };\n }\n const admin = await checkOrgAdmin(event);\n if (!admin.ok) return { error: admin.error };\n if (body?.action === \"remember\") {\n return {\n memory: await rememberForIntegrationScope(\n {\n name: String(body.name ?? \"\"),\n description: String(body.description ?? \"\"),\n content: String(body.content ?? \"\"),\n },\n scope.id,\n ),\n };\n }\n if (body?.action === \"forget\") {\n return {\n memory: await forgetIntegrationMemory(\n { name: String(body.name ?? \"\") },\n scope.id,\n ),\n };\n }\n setResponseStatus(event, 400);\n return { error: \"unsupported memory action\" };\n }),\n );\n\n // ─── Managed Slack OAuth ──────────────────────────────────────\n h3.use(\n `${P}/slack/manifest`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"GET\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const oauthRedirectUrl = resolveOAuthRedirectUri(\n event,\n `${P}/slack/oauth/callback`,\n );\n const eventsRequestUrl = resolveOAuthRedirectUri(\n event,\n `${P}/slack/webhook`,\n );\n const interactivityRequestUrl = resolveOAuthRedirectUri(\n event,\n `${P}/slack/interactions`,\n );\n if (\n !oauthRedirectUrl ||\n !eventsRequestUrl ||\n !interactivityRequestUrl\n ) {\n setResponseStatus(event, 400);\n return { error: \"Slack manifest URLs are not allowed.\" };\n }\n setResponseHeader(\n event,\n \"content-disposition\",\n 'attachment; filename=\"agent-native-slack-manifest.json\"',\n );\n return buildSlackAgentManifest({\n oauthRedirectUrl,\n eventsRequestUrl,\n interactivityRequestUrl,\n });\n }),\n );\n\n h3.use(\n `${P}/slack/oauth/install`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"GET\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const session = await getSession(event).catch(() => null);\n if (!session?.email) {\n setResponseStatus(event, 401);\n return { error: \"Sign in before connecting Slack.\" };\n }\n const org = await getOrgContext(event).catch(() => null);\n try {\n assertSlackInstallAccess({\n email: session.email,\n orgId: org?.orgId ?? session.orgId ?? null,\n orgRole: org?.role ?? null,\n });\n } catch (err) {\n setResponseStatus(event, 403);\n return {\n error: err instanceof Error ? err.message : \"Slack access denied\",\n };\n }\n const clientId = await resolveSecret(\"SLACK_CLIENT_ID\");\n const clientSecret = await resolveSecret(\"SLACK_CLIENT_SECRET\");\n const signingSecret = await resolveSecret(\"SLACK_SIGNING_SECRET\");\n if (!clientId || !clientSecret || !signingSecret) {\n setResponseStatus(event, 503);\n return {\n error:\n \"Slack OAuth is not configured. Add the Slack client id, client secret, and signing secret first.\",\n };\n }\n const redirectUri = resolveOAuthRedirectUri(\n event,\n `${P}/slack/oauth/callback`,\n );\n if (!redirectUri) {\n setResponseStatus(event, 400);\n return { error: \"Slack OAuth redirect URL is not allowed.\" };\n }\n const query = getQuery(event);\n const state = encodeOAuthState({\n redirectUri,\n owner: session.email,\n orgId: org?.orgId ?? session.orgId ?? undefined,\n app: \"agent-native:slack\",\n addAccount: true,\n returnUrl:\n typeof query.return === \"string\" ? query.return : \"/messaging\",\n });\n return sendRedirect(\n event,\n buildSlackAuthorizeUrl({ clientId, redirectUri, state }),\n 302,\n );\n }),\n );\n\n h3.use(\n `${P}/slack/oauth/callback`,\n defineEventHandler(async (event) => {\n if (getMethod(event) !== \"GET\") {\n setResponseStatus(event, 405);\n return { error: \"Method not allowed\" };\n }\n const query = getQuery(event);\n if (typeof query.error === \"string\") {\n return oauthErrorPage(\"Slack authorization was canceled or denied.\");\n }\n const fallbackRedirect = resolveOAuthRedirectUri(\n event,\n `${P}/slack/oauth/callback`,\n );\n if (!fallbackRedirect) {\n return oauthErrorPage(\"Slack OAuth redirect URL is not allowed.\");\n }\n const state = decodeOAuthState(\n typeof query.state === \"string\" ? query.state : undefined,\n fallbackRedirect,\n );\n const session = await getSession(event).catch(() => null);\n const org = await getOrgContext(event).catch(() => null);\n if (\n state.app !== \"agent-native:slack\" ||\n !session?.email ||\n !state.owner ||\n session.email.toLowerCase() !== state.owner.toLowerCase() ||\n (state.orgId ?? null) !== (org?.orgId ?? session.orgId ?? null)\n ) {\n return oauthErrorPage(\n \"Your Slack install session expired or changed. Sign in and start again.\",\n );\n }\n const code = typeof query.code === \"string\" ? query.code : null;\n if (!code) return oauthErrorPage(\"Slack did not return an OAuth code.\");\n try {\n const access = assertSlackInstallAccess({\n email: session.email,\n orgId: org?.orgId ?? session.orgId ?? null,\n orgRole: org?.role ?? null,\n });\n const clientId = await resolveSecret(\"SLACK_CLIENT_ID\");\n const clientSecret = await resolveSecret(\"SLACK_CLIENT_SECRET\");\n if (!clientId || !clientSecret) {\n return oauthErrorPage(\"Slack OAuth is not configured.\");\n }\n return await runWithRequestContext(\n {\n userEmail: access.ownerEmail,\n orgId: access.orgId ?? undefined,\n },\n async () => {\n const oauth = await exchangeSlackOAuthCode({\n code,\n clientId,\n clientSecret,\n redirectUri: state.redirectUri,\n });\n const health = await testSlackAuth(oauth.access_token || \"\");\n if (!health.ok) {\n return oauthErrorPage(\n \"Slack connected, but the bot token could not be verified. Please retry.\",\n );\n }\n if (\n oauth.team?.id &&\n health.teamId &&\n oauth.team.id !== health.teamId\n ) {\n return oauthErrorPage(\n \"Slack returned inconsistent workspace details. Please retry.\",\n );\n }\n const input = slackOAuthResponseToInstallation(oauth, access);\n const installation = await upsertIntegrationInstallation({\n ...input,\n health: health.health,\n healthCheckedAt: health.checkedAt,\n lastHealthyAt: health.checkedAt,\n });\n await saveIntegrationConfig(\n \"slack\",\n { enabled: true, managedOAuth: true },\n \"default\",\n access.ownerEmail,\n );\n return oauthCallbackResponse(\n event,\n installation.teamName || installation.enterpriseName || \"Slack\",\n {\n addAccount: true,\n appName: \"Agent Native\",\n returnUrl: state.returnUrl || \"/messaging\",\n },\n );\n },\n );\n } catch (err) {\n console.error(\"[slack] OAuth callback failed:\", err);\n return oauthErrorPage(\"Slack connection failed. Please try again.\");\n }\n }),\n );\n\n // ─── Per-platform catch-all ───────────────────────────────────\n // Handles: webhook, status, enable, disable, setup for each platform\n h3.use(\n `${P}`,\n defineEventHandler(async (event) => {\n const method = getMethod(event);\n // event.path is stripped to the remainder after the mount prefix\n const raw = (event.path || \"/\").split(\"?\")[0].replace(/^\\//, \"\");\n const parts = raw.split(\"/\").filter(Boolean);\n\n // Already handled by the dedicated /status route above\n if (parts[0] === \"status\" && parts.length === 1) return;\n // Already handled by the dedicated /task-queue/status route above\n if (parts[0] === \"task-queue\") return;\n // Already handled by the dedicated /remote/* routes above\n if (parts[0] === \"remote\") return;\n // Already handled by the dedicated /process-task route above\n if (parts[0] === \"process-task\") return;\n // Already handled by the dedicated /process-a2a-continuation route above\n if (parts[0] === \"process-a2a-continuation\") return;\n // These are framework-owned control-plane routes, not integration\n // platforms. The dedicated handlers above normally return a response\n // before this catch-all runs, but keeping them reserved here prevents\n // an unexpected mount fall-through from turning a valid control-plane\n // request into a misleading \"Unknown platform\" response.\n if (\n parts[0] === \"installations\" ||\n parts[0] === \"scopes\" ||\n parts[0] === \"budgets\" ||\n parts[0] === \"memory\"\n ) {\n setResponseStatus(event, 404);\n return { error: \"Not found\" };\n }\n\n const platform = parts[0];\n const action = parts[1]; // webhook, status, enable, disable, setup\n\n if (!platform) {\n setResponseStatus(event, 404);\n return { error: \"Platform required\" };\n }\n\n const adapter = adapterMap.get(platform);\n if (!adapter) {\n setResponseStatus(event, 404);\n return { error: `Unknown platform: ${platform}` };\n }\n\n // Set params for handlers that read them\n if (event.context) {\n event.context.params = {\n ...event.context.params,\n platform,\n };\n }\n\n // ─── GET /:platform/status ─────────────────────────────\n if (action === \"status\" && method === \"GET\") {\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const baseUrl = getBaseUrl(event);\n const status = await withCredentialContext(\n toCredentialContext(ctx),\n () => adapter.getStatus(baseUrl),\n );\n const config = await getIntegrationConfig(platform);\n status.enabled = !!config?.configData?.enabled;\n status.webhookUrl = `${baseUrl}${P}/${platform}/webhook`;\n if (!status.requiredEnvKeys) {\n try {\n status.requiredEnvKeys = adapter.getRequiredEnvKeys();\n } catch {\n status.requiredEnvKeys = [];\n }\n }\n return status;\n }\n\n // ─── POST /:platform/webhook ───────────────────────────\n if (action === \"webhook\" && method === \"POST\") {\n // Google Docs push notifications bypass the normal webhook flow —\n // they're opaque \"something changed\" pings, not message payloads.\n // We MUST verify the Pub/Sub OIDC token here. Without it, anyone\n // could POST any body to this URL and force a Drive changes pull\n // (H7 in the webhook security audit).\n if (platform === \"google-docs\") {\n const audience = process.env.GOOGLE_DOCS_PUSH_AUDIENCE;\n if (!audience) {\n if (process.env.NODE_ENV === \"production\") {\n // Fail closed in prod so a misconfigured deployment surfaces\n // in Pub/Sub's delivery metrics rather than silently\n // accepting anonymous requests.\n setResponseStatus(event, 503);\n return {\n ok: false,\n error:\n \"google-docs push endpoint disabled (audience not configured)\",\n };\n }\n // Dev: keep the loose posture so contributors can play with the\n // integration locally without configuring Pub/Sub.\n handlePushNotification().catch((err) => {\n console.error(\"[google-docs] Push handler error:\", err);\n });\n return \"ok\";\n }\n const authHeader = getRequestHeader(event, \"authorization\") || \"\";\n try {\n await verifyGoogleDocsPushToken(authHeader);\n } catch (err: any) {\n console.warn(\n `[google-docs] OIDC verify failed: ${err?.message ?? String(err)}`,\n );\n setResponseStatus(event, 401);\n return { ok: false, error: \"unauthorized\" };\n }\n handlePushNotification().catch((err) => {\n console.error(\"[google-docs] Push handler error:\", err);\n });\n return \"ok\";\n }\n\n const config = await getIntegrationConfig(platform);\n const credentialContext =\n await credentialContextForIntegrationConfig(config);\n\n // Let the adapter cache the raw request and identify setup\n // challenges, but never return a challenge response until the\n // provider signature has been verified.\n const verification = await withCredentialContext(\n credentialContext,\n () => adapter.handleVerification(event),\n );\n\n // Verify the webhook signature BEFORE parsing. We pre-parse the\n // body here (so handleWebhook can skip its second readBody, which\n // hangs on streaming providers), and that means handleWebhook's\n // own verifyWebhook step is bypassed. Without this call anyone\n // could POST a forged Slack/Telegram/email payload.\n const isValid = await withCredentialContext(credentialContext, () =>\n adapter.verifyWebhook(event),\n );\n if (!isValid) {\n setResponseStatus(event, 401);\n return { error: \"Invalid webhook signature\" };\n }\n if (verification.handled) {\n setResponseStatus(event, 200);\n return verification.response ?? \"ok\";\n }\n\n if (!config?.configData?.enabled) {\n setResponseStatus(event, 404);\n return { error: `Integration ${platform} is not enabled` };\n }\n\n const incoming = await withCredentialContext(credentialContext, () =>\n adapter.parseIncomingMessage(event),\n );\n if (!incoming) {\n setResponseStatus(event, 200);\n return \"ok\";\n }\n let executionContext: IntegrationExecutionContext = {\n ownerEmail: `integration@${platform}`,\n orgId: null as string | null,\n principalType: \"service\" as const,\n };\n if (options?.resolveExecutionContext) {\n try {\n executionContext = await withCredentialContext(\n credentialContext,\n () =>\n Promise.resolve(options.resolveExecutionContext!(incoming)),\n );\n } catch (err) {\n console.error(\n `[integrations] resolveExecutionContext denied message:`,\n err,\n );\n setResponseStatus(event, 200);\n return \"ok\";\n }\n } else if (options?.resolveOwner) {\n try {\n executionContext.ownerEmail = await withCredentialContext(\n credentialContext,\n () => Promise.resolve(options.resolveOwner!(incoming)),\n );\n } catch (err) {\n console.error(\n `[integrations] resolveOwner failed, using default:`,\n err,\n );\n }\n }\n if (executionContext.scopeId) {\n incoming.integrationScopeId = executionContext.scopeId;\n }\n const result = await handleWebhook(event, {\n adapter,\n // The processor reloads scoped resources immediately before the\n // agent run. Avoid doing that work on the acknowledgement path,\n // where providers such as Discord enforce a 3-second deadline.\n systemPrompt: baseSystemPrompt,\n actions,\n model,\n apiKey: getApiKey(),\n engine: options?.engine,\n appId: options?.appId,\n ownerEmail: executionContext.ownerEmail,\n orgId: executionContext.orgId,\n principalType: executionContext.principalType,\n beforeProcess: options?.beforeProcess,\n incoming,\n });\n setResponseStatus(event, result.status);\n return result.body;\n }\n\n // ─── POST /:platform/enable ────────────────────────────\n if (action === \"enable\" && method === \"POST\") {\n const adminCheck = await checkOrgAdmin(event);\n if (adminCheck.ok === false) return { error: adminCheck.error };\n // Stamp the org-admin who toggled this so downstream code can\n // tell who is responsible — useful for audit logs even though\n // the row itself remains deployment-wide.\n const session = await getSession(event).catch(() => null);\n await saveIntegrationConfig(\n platform,\n { enabled: true },\n \"default\",\n session?.email,\n );\n return { ok: true, platform, enabled: true };\n }\n\n // ─── POST /:platform/disable ───────────────────────────\n if (action === \"disable\" && method === \"POST\") {\n const adminCheck = await checkOrgAdmin(event);\n if (adminCheck.ok === false) return { error: adminCheck.error };\n const session = await getSession(event).catch(() => null);\n await saveIntegrationConfig(\n platform,\n { enabled: false },\n \"default\",\n session?.email,\n );\n return { ok: true, platform, enabled: false };\n }\n\n // ─── POST /:platform/setup ─────────────────────────────\n if (action === \"setup\" && method === \"POST\") {\n const adminCheck = await checkOrgAdmin(event);\n if (adminCheck.ok === false) return { error: adminCheck.error };\n if (platform === \"telegram\") {\n const baseUrl = getBaseUrl(event);\n const webhookUrl = `${baseUrl}${P}/telegram/webhook`;\n const ctx = await requireSessionContext(event);\n if (!ctx) return { error: \"unauthorized\" };\n const token = await withCredentialContext(\n toCredentialContext(ctx),\n () => resolveSecret(\"TELEGRAM_BOT_TOKEN\"),\n );\n const webhookSecret = await withCredentialContext(\n toCredentialContext(ctx),\n () => resolveSecret(\"TELEGRAM_WEBHOOK_SECRET\"),\n );\n if (!token || !webhookSecret) {\n setResponseStatus(event, 400);\n return {\n error:\n \"TELEGRAM_BOT_TOKEN and TELEGRAM_WEBHOOK_SECRET must be configured before webhook setup.\",\n };\n }\n try {\n const res = await fetch(\n `https://api.telegram.org/bot${token}/setWebhook`,\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n url: webhookUrl,\n secret_token: webhookSecret,\n }),\n },\n );\n const data = await res.json();\n return { ok: true, platform, webhookUrl, result: data };\n } catch (err: any) {\n setResponseStatus(event, 500);\n return { error: err.message };\n }\n }\n return { ok: true, platform, message: \"No setup required\" };\n }\n\n setResponseStatus(event, 404);\n return { error: \"Not found\" };\n }),\n );\n\n // ─── Start pending-tasks retry sweeper ────────────────────────\n // Sweeps the integration_pending_tasks queue every 60s and re-fires the\n // processor for any tasks that got stuck (initial dispatch lost or\n // processor killed mid-flight). No-ops gracefully if the queue table\n // hasn't been created yet on this deployment.\n startPendingTasksRetryJob({\n webhookBaseUrl: process.env.WEBHOOK_BASE_URL,\n });\n startA2AContinuationRetryJob(adapterMap);\n startRemoteCommandsRetryJob();\n\n // ─── Start Google Docs poller/push ────────────────────────────\n if (adapterMap.has(\"google-docs\")) {\n // Defer startup slightly so the server is fully ready\n setTimeout(() => {\n // We don't know the base URL at plugin init time — it depends on\n // the incoming request. For push mode, the webhook URL needs to be\n // resolved. We pass it as a special option; the poller will attempt\n // to register a watch when the first request reveals the base URL,\n // or use the WEBHOOK_BASE_URL env var if set.\n const baseUrl = process.env.WEBHOOK_BASE_URL;\n const webhookUrl = baseUrl\n ? `${withConfiguredAppBasePath(baseUrl)}${P}/google-docs/webhook`\n : undefined;\n\n void startGoogleDocsPoller({\n systemPrompt: baseSystemPrompt,\n actions,\n model: model ?? \"\",\n apiKey: getApiKey(),\n ownerEmail: \"integration@google-docs\",\n webhookUrl,\n });\n }, 2000);\n }\n\n if (process.env.DEBUG)\n console.log(\n `[integrations] Mounted integration routes for: ${adapters.map((a) => a.platform).join(\", \")}`,\n );\n };\n}\n\n/**\n * Default integrations plugin — auto-mounts all adapters.\n */\nexport const defaultIntegrationsPlugin = createIntegrationsPlugin();\n\n/** Extract base URL from the request */\nfunction getBaseUrl(event: any): string {\n try {\n const headers = event.node?.req?.headers || event.headers || {};\n const getHeader = (name: string) =>\n typeof headers.get === \"function\"\n ? headers.get(name)\n : (headers as Record<string, string>)[name];\n const proto = getHeader(\"x-forwarded-proto\") || \"http\";\n const host = getHeader(\"host\") || \"localhost:3000\";\n return withConfiguredAppBasePath(`${proto}://${host}`);\n } catch {\n return withConfiguredAppBasePath(\"http://localhost:3000\");\n }\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nfunction readComputerCapabilities(value: unknown) {\n const input = readObject(value);\n const readSurface = (surface: unknown, desktop = false) => {\n const record = readObject(surface);\n if (!record) return undefined;\n return {\n observe: record.observe === true,\n control: record.control === true,\n ...(desktop\n ? {\n accessibility: record.accessibility === true,\n screenCapture: record.screenCapture === true,\n }\n : {}),\n provider: readString(record.provider) ?? null,\n version: readString(record.version) ?? null,\n };\n };\n return {\n browser: readSurface(input?.browser),\n desktop: readSurface(input?.desktop, true),\n };\n}\n\nfunction advertisedComputerOperationClasses(\n device: Pick<RemoteDevice, \"metadata\">,\n): ComputerOperationClass[] {\n const capabilities = getRemoteComputerCapabilities(device);\n const classes: ComputerOperationClass[] = [];\n if (capabilities?.browser?.observe) classes.push(\"browser.observe\");\n if (capabilities?.browser?.control) classes.push(\"browser.control\");\n if (capabilities?.desktop?.observe) classes.push(\"desktop.observe\");\n if (capabilities?.desktop?.control) classes.push(\"desktop.control\");\n return classes;\n}\n\nfunction readComputerApprovalStatus(value: unknown) {\n return value === \"pending\" ||\n value === \"approved\" ||\n value === \"denied\" ||\n value === \"consumed\" ||\n value === \"expired\"\n ? value\n : undefined;\n}\n\nfunction computerSupervisionRouteError(event: any, error: unknown) {\n if (error instanceof ComputerSupervisionError) {\n const status =\n error.code === \"expired-lease\"\n ? 410\n : error.code === \"replay\"\n ? 409\n : error.code === \"approval-required\" ||\n error.code === \"approval-denied\"\n ? 403\n : 400;\n setResponseStatus(event, status);\n return { error: error.message, code: error.code };\n }\n throw error;\n}\n"]}