@agent-native/core 0.7.82 → 0.8.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 (265) hide show
  1. package/dist/action.js +1 -1
  2. package/dist/action.js.map +1 -1
  3. package/dist/agent/production-agent.d.ts.map +1 -1
  4. package/dist/agent/production-agent.js +8 -8
  5. package/dist/agent/production-agent.js.map +1 -1
  6. package/dist/agent/run-manager.d.ts +2 -0
  7. package/dist/agent/run-manager.d.ts.map +1 -1
  8. package/dist/agent/run-manager.js +44 -18
  9. package/dist/agent/run-manager.js.map +1 -1
  10. package/dist/agent/types.d.ts +1 -1
  11. package/dist/agent/types.d.ts.map +1 -1
  12. package/dist/agent/types.js.map +1 -1
  13. package/dist/cli/create.d.ts +1 -1
  14. package/dist/cli/create.d.ts.map +1 -1
  15. package/dist/cli/create.js +87 -19
  16. package/dist/cli/create.js.map +1 -1
  17. package/dist/cli/workspacify.d.ts.map +1 -1
  18. package/dist/cli/workspacify.js +12 -9
  19. package/dist/cli/workspacify.js.map +1 -1
  20. package/dist/client/AgentPanel.d.ts +1 -1
  21. package/dist/client/AgentPanel.d.ts.map +1 -1
  22. package/dist/client/AgentPanel.js +22 -1
  23. package/dist/client/AgentPanel.js.map +1 -1
  24. package/dist/client/FeedbackButton.d.ts +3 -2
  25. package/dist/client/FeedbackButton.d.ts.map +1 -1
  26. package/dist/client/FeedbackButton.js +18 -14
  27. package/dist/client/FeedbackButton.js.map +1 -1
  28. package/dist/client/agent-chat-adapter.d.ts.map +1 -1
  29. package/dist/client/agent-chat-adapter.js +254 -29
  30. package/dist/client/agent-chat-adapter.js.map +1 -1
  31. package/dist/client/agent-chat.d.ts +2 -0
  32. package/dist/client/agent-chat.d.ts.map +1 -1
  33. package/dist/client/agent-chat.js +11 -2
  34. package/dist/client/agent-chat.js.map +1 -1
  35. package/dist/client/builder-frame.d.ts +11 -0
  36. package/dist/client/builder-frame.d.ts.map +1 -1
  37. package/dist/client/builder-frame.js +40 -9
  38. package/dist/client/builder-frame.js.map +1 -1
  39. package/dist/client/composer/ComposerPlusMenu.js +1 -1
  40. package/dist/client/composer/ComposerPlusMenu.js.map +1 -1
  41. package/dist/client/composer/PromptComposer.d.ts +2 -0
  42. package/dist/client/composer/PromptComposer.d.ts.map +1 -1
  43. package/dist/client/composer/PromptComposer.js +3 -3
  44. package/dist/client/composer/PromptComposer.js.map +1 -1
  45. package/dist/client/composer/TiptapComposer.d.ts +3 -1
  46. package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
  47. package/dist/client/composer/TiptapComposer.js +25 -13
  48. package/dist/client/composer/TiptapComposer.js.map +1 -1
  49. package/dist/client/composer/types.d.ts +1 -1
  50. package/dist/client/composer/types.d.ts.map +1 -1
  51. package/dist/client/composer/types.js.map +1 -1
  52. package/dist/client/extensions/EmbeddedExtension.d.ts +20 -0
  53. package/dist/client/extensions/EmbeddedExtension.d.ts.map +1 -0
  54. package/dist/client/{tools/EmbeddedTool.js → extensions/EmbeddedExtension.js} +41 -41
  55. package/dist/client/extensions/EmbeddedExtension.js.map +1 -0
  56. package/dist/client/extensions/ExtensionEditor.d.ts +5 -0
  57. package/dist/client/extensions/ExtensionEditor.d.ts.map +1 -0
  58. package/dist/client/extensions/ExtensionEditor.js +129 -0
  59. package/dist/client/extensions/ExtensionEditor.js.map +1 -0
  60. package/dist/client/{tools → extensions}/ExtensionSlot.d.ts +3 -3
  61. package/dist/client/extensions/ExtensionSlot.d.ts.map +1 -0
  62. package/dist/client/{tools → extensions}/ExtensionSlot.js +14 -14
  63. package/dist/client/extensions/ExtensionSlot.js.map +1 -0
  64. package/dist/client/extensions/ExtensionViewer.d.ts +5 -0
  65. package/dist/client/extensions/ExtensionViewer.d.ts.map +1 -0
  66. package/dist/client/{tools/ToolViewer.js → extensions/ExtensionViewer.js} +67 -65
  67. package/dist/client/extensions/ExtensionViewer.js.map +1 -0
  68. package/dist/client/extensions/ExtensionViewerPage.d.ts +2 -0
  69. package/dist/client/extensions/ExtensionViewerPage.d.ts.map +1 -0
  70. package/dist/client/{tools/ToolViewerPage.js → extensions/ExtensionViewerPage.js} +8 -8
  71. package/dist/client/extensions/ExtensionViewerPage.js.map +1 -0
  72. package/dist/client/extensions/ExtensionsListPage.d.ts +2 -0
  73. package/dist/client/extensions/ExtensionsListPage.d.ts.map +1 -0
  74. package/dist/client/extensions/ExtensionsListPage.js +67 -0
  75. package/dist/client/extensions/ExtensionsListPage.js.map +1 -0
  76. package/dist/client/extensions/ExtensionsSidebarSection.d.ts +2 -0
  77. package/dist/client/extensions/ExtensionsSidebarSection.d.ts.map +1 -0
  78. package/dist/client/{tools/ToolsSidebarSection.js → extensions/ExtensionsSidebarSection.js} +58 -58
  79. package/dist/client/extensions/ExtensionsSidebarSection.js.map +1 -0
  80. package/dist/client/{tools/tool-order.d.ts → extensions/extension-order.d.ts} +2 -2
  81. package/dist/client/extensions/extension-order.d.ts.map +1 -0
  82. package/dist/client/{tools/tool-order.js → extensions/extension-order.js} +3 -3
  83. package/dist/client/extensions/extension-order.js.map +1 -0
  84. package/dist/client/{tools → extensions}/iframe-bridge.d.ts +11 -11
  85. package/dist/client/extensions/iframe-bridge.d.ts.map +1 -0
  86. package/dist/client/{tools → extensions}/iframe-bridge.js +24 -24
  87. package/dist/client/extensions/iframe-bridge.js.map +1 -0
  88. package/dist/client/extensions/index.d.ts +14 -0
  89. package/dist/client/extensions/index.d.ts.map +1 -0
  90. package/dist/client/extensions/index.js +19 -0
  91. package/dist/client/extensions/index.js.map +1 -0
  92. package/dist/client/integrations/IntegrationsPanel.d.ts.map +1 -1
  93. package/dist/client/integrations/IntegrationsPanel.js +4 -1
  94. package/dist/client/integrations/IntegrationsPanel.js.map +1 -1
  95. package/dist/client/sse-event-processor.d.ts +2 -1
  96. package/dist/client/sse-event-processor.d.ts.map +1 -1
  97. package/dist/client/sse-event-processor.js +87 -6
  98. package/dist/client/sse-event-processor.js.map +1 -1
  99. package/dist/extensions/actions.d.ts +3 -0
  100. package/dist/extensions/actions.d.ts.map +1 -0
  101. package/dist/{tools → extensions}/actions.js +54 -51
  102. package/dist/extensions/actions.js.map +1 -0
  103. package/dist/{tools → extensions}/fetch-tool.d.ts +4 -0
  104. package/dist/extensions/fetch-tool.d.ts.map +1 -0
  105. package/dist/{tools → extensions}/fetch-tool.js +12 -7
  106. package/dist/extensions/fetch-tool.js.map +1 -0
  107. package/dist/extensions/html-shell.d.ts +56 -0
  108. package/dist/extensions/html-shell.d.ts.map +1 -0
  109. package/dist/{tools → extensions}/html-shell.js +101 -83
  110. package/dist/extensions/html-shell.js.map +1 -0
  111. package/dist/{tools → extensions}/proxy-security.d.ts +2 -2
  112. package/dist/extensions/proxy-security.d.ts.map +1 -0
  113. package/dist/{tools → extensions}/proxy-security.js +3 -3
  114. package/dist/extensions/proxy-security.js.map +1 -0
  115. package/dist/extensions/routes.d.ts +2 -0
  116. package/dist/extensions/routes.d.ts.map +1 -0
  117. package/dist/{tools → extensions}/routes.js +73 -69
  118. package/dist/extensions/routes.js.map +1 -0
  119. package/dist/{tools → extensions}/schema.d.ts +44 -38
  120. package/dist/extensions/schema.d.ts.map +1 -0
  121. package/dist/{tools → extensions}/schema.js +41 -34
  122. package/dist/extensions/schema.js.map +1 -0
  123. package/dist/extensions/slots/routes.d.ts +15 -0
  124. package/dist/extensions/slots/routes.d.ts.map +1 -0
  125. package/dist/{tools → extensions}/slots/routes.js +26 -26
  126. package/dist/extensions/slots/routes.js.map +1 -0
  127. package/dist/{tools → extensions}/slots/schema.d.ts +24 -21
  128. package/dist/extensions/slots/schema.d.ts.map +1 -0
  129. package/dist/extensions/slots/schema.js +79 -0
  130. package/dist/extensions/slots/schema.js.map +1 -0
  131. package/dist/extensions/slots/store.d.ts +66 -0
  132. package/dist/extensions/slots/store.d.ts.map +1 -0
  133. package/dist/extensions/slots/store.js +238 -0
  134. package/dist/extensions/slots/store.js.map +1 -0
  135. package/dist/extensions/store.d.ts +40 -0
  136. package/dist/extensions/store.d.ts.map +1 -0
  137. package/dist/{tools → extensions}/store.js +59 -54
  138. package/dist/extensions/store.js.map +1 -0
  139. package/dist/extensions/theme.d.ts.map +1 -0
  140. package/dist/extensions/theme.js.map +1 -0
  141. package/dist/{tools → extensions}/url-safety.d.ts +5 -3
  142. package/dist/extensions/url-safety.d.ts.map +1 -0
  143. package/dist/{tools → extensions}/url-safety.js +11 -4
  144. package/dist/extensions/url-safety.js.map +1 -0
  145. package/dist/server/action-discovery.d.ts +15 -0
  146. package/dist/server/action-discovery.d.ts.map +1 -1
  147. package/dist/server/action-discovery.js +45 -0
  148. package/dist/server/action-discovery.js.map +1 -1
  149. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  150. package/dist/server/agent-chat-plugin.js +12 -10
  151. package/dist/server/agent-chat-plugin.js.map +1 -1
  152. package/dist/server/auth.d.ts +5 -4
  153. package/dist/server/auth.d.ts.map +1 -1
  154. package/dist/server/auth.js +80 -28
  155. package/dist/server/auth.js.map +1 -1
  156. package/dist/server/core-routes-plugin.d.ts +15 -0
  157. package/dist/server/core-routes-plugin.d.ts.map +1 -1
  158. package/dist/server/core-routes-plugin.js +65 -13
  159. package/dist/server/core-routes-plugin.js.map +1 -1
  160. package/dist/server/csrf.d.ts +3 -2
  161. package/dist/server/csrf.d.ts.map +1 -1
  162. package/dist/server/csrf.js +3 -2
  163. package/dist/server/csrf.js.map +1 -1
  164. package/dist/server/google-oauth.d.ts.map +1 -1
  165. package/dist/server/google-oauth.js +15 -3
  166. package/dist/server/google-oauth.js.map +1 -1
  167. package/dist/server/index.d.ts +2 -2
  168. package/dist/server/index.d.ts.map +1 -1
  169. package/dist/server/index.js +1 -1
  170. package/dist/server/index.js.map +1 -1
  171. package/dist/shared/workspace-app-id.d.ts +1 -1
  172. package/dist/shared/workspace-app-id.d.ts.map +1 -1
  173. package/dist/shared/workspace-app-id.js +5 -1
  174. package/dist/shared/workspace-app-id.js.map +1 -1
  175. package/dist/templates/workspace-root/README.md +5 -4
  176. package/dist/usage/store.d.ts +1 -1
  177. package/dist/usage/store.d.ts.map +1 -1
  178. package/dist/usage/store.js +1 -1
  179. package/dist/usage/store.js.map +1 -1
  180. package/dist/vite/client.d.ts.map +1 -1
  181. package/dist/vite/client.js +17 -1
  182. package/dist/vite/client.js.map +1 -1
  183. package/docs/content/actions.md +10 -10
  184. package/docs/content/extensions.md +230 -0
  185. package/docs/content/key-concepts.md +2 -2
  186. package/docs/content/server.md +13 -13
  187. package/docs/content/sharing.md +2 -2
  188. package/docs/content/template-analytics.md +10 -0
  189. package/docs/content/template-calendar.md +10 -0
  190. package/docs/content/template-clips.md +10 -0
  191. package/docs/content/template-content.md +10 -0
  192. package/docs/content/template-dispatch.md +15 -0
  193. package/docs/content/template-forms.md +10 -0
  194. package/docs/content/template-mail.md +10 -0
  195. package/docs/content/template-slides.md +11 -1
  196. package/docs/content/template-starter.md +10 -0
  197. package/docs/content/template-video.md +10 -0
  198. package/docs/content/what-is-agent-native.md +1 -1
  199. package/package.json +22 -17
  200. package/src/templates/workspace-root/README.md +5 -4
  201. package/dist/client/tools/EmbeddedTool.d.ts +0 -20
  202. package/dist/client/tools/EmbeddedTool.d.ts.map +0 -1
  203. package/dist/client/tools/EmbeddedTool.js.map +0 -1
  204. package/dist/client/tools/ExtensionSlot.d.ts.map +0 -1
  205. package/dist/client/tools/ExtensionSlot.js.map +0 -1
  206. package/dist/client/tools/ToolEditor.d.ts +0 -5
  207. package/dist/client/tools/ToolEditor.d.ts.map +0 -1
  208. package/dist/client/tools/ToolEditor.js +0 -129
  209. package/dist/client/tools/ToolEditor.js.map +0 -1
  210. package/dist/client/tools/ToolViewer.d.ts +0 -5
  211. package/dist/client/tools/ToolViewer.d.ts.map +0 -1
  212. package/dist/client/tools/ToolViewer.js.map +0 -1
  213. package/dist/client/tools/ToolViewerPage.d.ts +0 -2
  214. package/dist/client/tools/ToolViewerPage.d.ts.map +0 -1
  215. package/dist/client/tools/ToolViewerPage.js.map +0 -1
  216. package/dist/client/tools/ToolsListPage.d.ts +0 -2
  217. package/dist/client/tools/ToolsListPage.d.ts.map +0 -1
  218. package/dist/client/tools/ToolsListPage.js +0 -67
  219. package/dist/client/tools/ToolsListPage.js.map +0 -1
  220. package/dist/client/tools/ToolsSidebarSection.d.ts +0 -2
  221. package/dist/client/tools/ToolsSidebarSection.d.ts.map +0 -1
  222. package/dist/client/tools/ToolsSidebarSection.js.map +0 -1
  223. package/dist/client/tools/iframe-bridge.d.ts.map +0 -1
  224. package/dist/client/tools/iframe-bridge.js.map +0 -1
  225. package/dist/client/tools/index.d.ts +0 -8
  226. package/dist/client/tools/index.d.ts.map +0 -1
  227. package/dist/client/tools/index.js +0 -8
  228. package/dist/client/tools/index.js.map +0 -1
  229. package/dist/client/tools/tool-order.d.ts.map +0 -1
  230. package/dist/client/tools/tool-order.js.map +0 -1
  231. package/dist/tools/actions.d.ts +0 -3
  232. package/dist/tools/actions.d.ts.map +0 -1
  233. package/dist/tools/actions.js.map +0 -1
  234. package/dist/tools/fetch-tool.d.ts.map +0 -1
  235. package/dist/tools/fetch-tool.js.map +0 -1
  236. package/dist/tools/html-shell.d.ts +0 -45
  237. package/dist/tools/html-shell.d.ts.map +0 -1
  238. package/dist/tools/html-shell.js.map +0 -1
  239. package/dist/tools/proxy-security.d.ts.map +0 -1
  240. package/dist/tools/proxy-security.js.map +0 -1
  241. package/dist/tools/routes.d.ts +0 -2
  242. package/dist/tools/routes.d.ts.map +0 -1
  243. package/dist/tools/routes.js.map +0 -1
  244. package/dist/tools/schema.d.ts.map +0 -1
  245. package/dist/tools/schema.js.map +0 -1
  246. package/dist/tools/slots/routes.d.ts +0 -15
  247. package/dist/tools/slots/routes.d.ts.map +0 -1
  248. package/dist/tools/slots/routes.js.map +0 -1
  249. package/dist/tools/slots/schema.d.ts.map +0 -1
  250. package/dist/tools/slots/schema.js +0 -76
  251. package/dist/tools/slots/schema.js.map +0 -1
  252. package/dist/tools/slots/store.d.ts +0 -66
  253. package/dist/tools/slots/store.d.ts.map +0 -1
  254. package/dist/tools/slots/store.js +0 -227
  255. package/dist/tools/slots/store.js.map +0 -1
  256. package/dist/tools/store.d.ts +0 -40
  257. package/dist/tools/store.d.ts.map +0 -1
  258. package/dist/tools/store.js.map +0 -1
  259. package/dist/tools/theme.d.ts.map +0 -1
  260. package/dist/tools/theme.js.map +0 -1
  261. package/dist/tools/url-safety.d.ts.map +0 -1
  262. package/dist/tools/url-safety.js.map +0 -1
  263. package/docs/content/tools.md +0 -205
  264. /package/dist/{tools → extensions}/theme.d.ts +0 -0
  265. /package/dist/{tools → extensions}/theme.js +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iframe-bridge.js","sourceRoot":"","sources":["../../../src/client/extensions/iframe-bridge.ts"],"names":[],"mappings":"AAAA,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,KAAK;IACL,MAAM;IACN,KAAK;IACL,OAAO;IACP,QAAQ;IACR,MAAM;CACP,CAAC,CAAC;AAEH,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,YAAY;IACZ,gBAAgB;IAChB,QAAQ;IACR,WAAW;IACX,MAAM;IACN,YAAY;IACZ,QAAQ;IACR,oBAAoB;IACpB,qBAAqB;IACrB,SAAS;IACT,YAAY;IACZ,IAAI;IACJ,SAAS;IACT,mBAAmB;IACnB,SAAS;IACT,iBAAiB;IACjB,kBAAkB;IAClB,mBAAmB;CACpB,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,+BAA+B,CAAC;AAEvD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,sBAAsB,CACpC,IAAY,EACZ,WAAmB;IAEnB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACjE,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IA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,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,aAAa,CAAC,qBAAqB,EAAE,GAAG,CAAC,IAAI,CAAC;SACtD,CAAC;IACJ,CAAC;IAED,6CAA6C;IAC7C,IAAI,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;IACvD,OAAO;QACL,EAAE,EAAE,KAAK;QACT,KAAK,EAAE,aAAa,CAAC,UAAU,EAAE,GAAG,CAAC,IAAI,CAAC;KAC3C,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,MAAc,EAAE,IAAyB;IAC9D,OAAO,WAAW,MAAM,8BAA8B,IAAI,qBAAqB,CAAC;AAClF,CAAC","sourcesContent":["const ALLOWED_METHODS = new Set([\n \"GET\",\n \"POST\",\n \"PUT\",\n \"PATCH\",\n \"DELETE\",\n \"HEAD\",\n]);\n\nconst BLOCKED_HEADERS = new Set([\n \"connection\",\n \"content-length\",\n \"cookie\",\n \"forwarded\",\n \"host\",\n \"keep-alive\",\n \"origin\",\n \"proxy-authenticate\",\n \"proxy-authorization\",\n \"referer\",\n \"set-cookie\",\n \"te\",\n \"trailer\",\n \"transfer-encoding\",\n \"upgrade\",\n \"x-forwarded-for\",\n \"x-forwarded-host\",\n \"x-forwarded-proto\",\n]);\n\nconst HEADER_NAME_RE = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;\n\n/**\n * Path allowlist for the extension postMessage bridge.\n *\n * Extensions can only call paths under `/_agent-native/*` (the framework's own\n * namespace). Template-defined `/api/*` routes are intentionally rejected:\n * those routes are written by app authors who may not consistently apply the\n * `accessFilter`/`assertAccess` access scoping helpers. A shared/org extension\n * running with the viewer's session should not be able to reach surfaces\n * outside the framework's own well-audited namespace.\n *\n * If a template needs a extension to reach a custom route, expose it via an\n * action (`defineAction` auto-mounts under `/_agent-native/actions/<name>`).\n */\nexport function isAllowedExtensionPath(\n path: string,\n extensionId: string,\n): boolean {\n if (!path.startsWith(\"/\") || path.startsWith(\"//\")) return false;\n if (path.includes(\"\\\\\") || path.includes(\"\\0\")) return false;\n\n let pathname: string;\n try {\n const parsed = new URL(path, \"http://agent-native.local\");\n if (parsed.origin !== \"http://agent-native.local\") return false;\n pathname = parsed.pathname;\n } catch {\n return false;\n }\n\n const rawPathname = path.split(\"?\")[0].split(\"#\")[0];\n if (pathname !== rawPathname || pathname.includes(\"..\")) return false;\n\n if (pathname.startsWith(\"/_agent-native/actions/\")) return true;\n if (pathname.startsWith(\"/_agent-native/application-state/\")) return true;\n\n if (pathname === \"/_agent-native/extensions/proxy\") return true;\n if (pathname === \"/_agent-native/extensions/sql/query\") return true;\n if (pathname === \"/_agent-native/extensions/sql/exec\") return true;\n\n const parts = pathname.split(\"/\");\n if (\n parts.length >= 6 &&\n parts.length <= 7 &&\n parts[1] === \"_agent-native\" &&\n parts[2] === \"extensions\" &&\n parts[3] === \"data\"\n ) {\n try {\n return decodeURIComponent(parts[4]) === extensionId;\n } catch {\n return false;\n }\n }\n\n return false;\n}\n\nexport function sanitizeExtensionRequestOptions(value: unknown): RequestInit {\n if (!value || typeof value !== \"object\") return {};\n const raw = value as Record<string, unknown>;\n const method =\n typeof raw.method === \"string\" && raw.method.trim()\n ? raw.method.toUpperCase()\n : \"GET\";\n if (!ALLOWED_METHODS.has(method)) {\n throw new Error(\"Extension request method is not allowed\");\n }\n\n const headers =\n raw.headers && typeof raw.headers === \"object\"\n ? Object.fromEntries(\n Object.entries(raw.headers as Record<string, unknown>)\n .filter(([key, val]) => isAllowedHeader(key) && val !== undefined)\n .map(([key, val]) => [key, String(val)]),\n )\n : undefined;\n const body =\n typeof raw.body === \"string\" ||\n raw.body instanceof Blob ||\n raw.body instanceof FormData\n ? raw.body\n : raw.body === undefined\n ? undefined\n : JSON.stringify(raw.body);\n\n return {\n method,\n headers,\n body: method === \"GET\" || method === \"HEAD\" ? undefined : body,\n };\n}\n\nfunction isAllowedHeader(name: string): boolean {\n const lower = name.toLowerCase();\n return HEADER_NAME_RE.test(name) && !BLOCKED_HEADERS.has(lower);\n}\n\n// ---------------------------------------------------------------------------\n// Role-aware bridge gating (audit H4)\n// ---------------------------------------------------------------------------\n//\n// The host bridge dispatches every iframe postMessage request with the\n// viewer's session cookie. That means a non-author viewer's session can be\n// used to call mutating actions, write SQL, and resolve secret references —\n// the very capabilities that motivate the C1 consent step. After consent has\n// been granted, we still want defense-in-depth: a viewer whose role is\n// \"viewer\" should not be able to (e.g.) chain `appAction('share-resource')`\n// or run `dbExec` writes against their own data through someone else's extension.\n//\n// Role table (lowest tier first):\n//\n// role | appFetch | extensionFetch | extensionData | dbQuery | dbExec | appAction\n// ---------|-----------------|-----------------|----------------|---------|--------|----------\n// viewer | GET only | GET only | get/list only | deny | deny | deny\n// editor | all methods | all methods | get/list/set/ | allow | allow* | allow\n// | | | remove | | |\n// admin | all methods | all methods | all | allow | allow* | allow\n// owner | all methods | all methods | all | allow | allow* | allow\n//\n// * dbExec destructive operations are independently blocked by the SQL\n// blocklist on the server (DROP / TRUNCATE / DELETE without WHERE etc).\n// The role gate sits in front of that — viewers can't reach the SQL\n// surface at all; editors and above hit the SQL gate as well.\n//\n// The SQL helpers are denied entirely for viewers (not just dbExec) because\n// the dbQuery surface in dev mode bypasses the production scoping shim and\n// can leak other users' rows in template tables that aren't in\n// SENSITIVE_SQL_RE.\n\nexport type ExtensionBridgeRole = \"owner\" | \"admin\" | \"editor\" | \"viewer\";\n\nconst READ_METHODS = new Set([\"GET\", \"HEAD\"]);\n\nexport interface BridgePolicyContext {\n /** Resolved role of the viewer on this extension. */\n role: ExtensionBridgeRole;\n /** True when viewer is the extension's owner_email — equivalent to role \"owner\"\n * but cheaper to plumb through from the render binding. */\n isAuthor: boolean;\n}\n\nexport interface BridgePolicyResult {\n ok: boolean;\n /** Human-readable error to send back to the iframe when ok=false. */\n error?: string;\n}\n\n/**\n * Decide whether the iframe is allowed to proxy this request given the\n * viewer's role on the extension. Authors (and owner/admin/editor in general)\n * keep the full bridge surface; viewers get a strictly read-only subset.\n *\n * Called BEFORE the request leaves the parent — so a denial is local-only\n * and never reveals server state to the iframe.\n */\nexport function checkBridgePolicy(\n path: string,\n method: string,\n ctx: BridgePolicyContext,\n): BridgePolicyResult {\n // Authors and the highest non-owner roles get the unrestricted bridge.\n if (ctx.isAuthor || ctx.role === \"owner\" || ctx.role === \"admin\") {\n return { ok: true };\n }\n\n // Editors get write access EXCEPT for the helper-specific destructive\n // operations the server still gates (the SQL blocklist + per-action\n // toolCallable flag, see audit H5).\n if (ctx.role === \"editor\") {\n return { ok: true };\n }\n\n // From here on: role === \"viewer\". Lock down everything beyond reads.\n const upperMethod = method.toUpperCase();\n\n // SQL is denied for viewers entirely (defense-in-depth: dev mode bypasses\n // the production scoping shim).\n if (path === \"/_agent-native/extensions/sql/query\") {\n return {\n ok: false,\n error: deniedMessage(\"dbQuery\", ctx.role),\n };\n }\n if (path === \"/_agent-native/extensions/sql/exec\") {\n return {\n ok: false,\n error: deniedMessage(\"dbExec\", ctx.role),\n };\n }\n\n // Actions are denied entirely for viewers — even GET actions can mutate\n // implicitly (e.g. \"view\" actions that create rows for analytics).\n // toolCallable opt-in (audit H5) is enforced server-side as a second\n // layer.\n if (path.startsWith(\"/_agent-native/actions/\")) {\n return {\n ok: false,\n error: deniedMessage(\"appAction\", ctx.role),\n };\n }\n\n // Extension-data writes/deletes are denied; reads (GET/HEAD) are allowed.\n // Match /_agent-native/extensions/data/<extensionId>/<collection>[/<itemId>].\n if (path.startsWith(\"/_agent-native/extensions/data/\")) {\n if (READ_METHODS.has(upperMethod)) return { ok: true };\n return {\n ok: false,\n error: deniedMessage(\"extensionData.set/remove\", ctx.role),\n };\n }\n\n // extensionFetch — outbound proxy. POSTed JSON body carries the upstream method.\n // The bridge can only see the path here, not the upstream method, so we\n // restrict by REQUEST method (POST to /proxy carries the actual upstream\n // method as { method: 'GET' | ... } in body). For viewers we pre-flight-\n // deny the proxy unless a future code path emits a GET to /proxy/preview.\n // In practice, extensionFetch always POSTs to /proxy, so a viewer's extensionFetch\n // is denied entirely. Adapt this if /proxy gains a GET preview surface.\n if (path === \"/_agent-native/extensions/proxy\") {\n return {\n ok: false,\n error: deniedMessage(\"extensionFetch\", ctx.role),\n };\n }\n\n // application-state — viewers can read but not write.\n if (path.startsWith(\"/_agent-native/application-state/\")) {\n if (READ_METHODS.has(upperMethod)) return { ok: true };\n return {\n ok: false,\n error: deniedMessage(\"appFetch (mutation)\", ctx.role),\n };\n }\n\n // Generic appFetch — reads only for viewers.\n if (READ_METHODS.has(upperMethod)) return { ok: true };\n return {\n ok: false,\n error: deniedMessage(\"appFetch\", ctx.role),\n };\n}\n\nfunction deniedMessage(helper: string, role: ExtensionBridgeRole): string {\n return `Helper '${helper}' is not allowed for role '${role}' on this extension`;\n}\n"]}
@@ -0,0 +1,14 @@
1
+ export { ExtensionsSidebarSection } from "./ExtensionsSidebarSection.js";
2
+ export { ExtensionViewer, type ExtensionViewerProps, } from "./ExtensionViewer.js";
3
+ export { ExtensionEditor, type ExtensionEditorProps, } from "./ExtensionEditor.js";
4
+ export { ExtensionsListPage } from "./ExtensionsListPage.js";
5
+ export { ExtensionViewerPage } from "./ExtensionViewerPage.js";
6
+ export { EmbeddedExtension, type EmbeddedExtensionProps, } from "./EmbeddedExtension.js";
7
+ export { ExtensionSlot, type ExtensionSlotProps } from "./ExtensionSlot.js";
8
+ export { ExtensionsSidebarSection as ToolsSidebarSection } from "./ExtensionsSidebarSection.js";
9
+ export { ExtensionViewer as ToolViewer, type ExtensionViewerProps as ToolViewerProps, } from "./ExtensionViewer.js";
10
+ export { ExtensionEditor as ToolEditor, type ExtensionEditorProps as ToolEditorProps, } from "./ExtensionEditor.js";
11
+ export { ExtensionsListPage as ToolsListPage } from "./ExtensionsListPage.js";
12
+ export { ExtensionViewerPage as ToolViewerPage } from "./ExtensionViewerPage.js";
13
+ export { EmbeddedExtension as EmbeddedTool, type EmbeddedExtensionProps as EmbeddedToolProps, } from "./EmbeddedExtension.js";
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/extensions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EACL,eAAe,EACf,KAAK,oBAAoB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,eAAe,EACf,KAAK,oBAAoB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EACL,iBAAiB,EACjB,KAAK,sBAAsB,GAC5B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAQ5E,OAAO,EAAE,wBAAwB,IAAI,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAChG,OAAO,EACL,eAAe,IAAI,UAAU,EAC7B,KAAK,oBAAoB,IAAI,eAAe,GAC7C,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,eAAe,IAAI,UAAU,EAC7B,KAAK,oBAAoB,IAAI,eAAe,GAC7C,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,IAAI,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,mBAAmB,IAAI,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,EACL,iBAAiB,IAAI,YAAY,EACjC,KAAK,sBAAsB,IAAI,iBAAiB,GACjD,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,19 @@
1
+ export { ExtensionsSidebarSection } from "./ExtensionsSidebarSection.js";
2
+ export { ExtensionViewer, } from "./ExtensionViewer.js";
3
+ export { ExtensionEditor, } from "./ExtensionEditor.js";
4
+ export { ExtensionsListPage } from "./ExtensionsListPage.js";
5
+ export { ExtensionViewerPage } from "./ExtensionViewerPage.js";
6
+ export { EmbeddedExtension, } from "./EmbeddedExtension.js";
7
+ export { ExtensionSlot } from "./ExtensionSlot.js";
8
+ // ─────────────────────────────────────────────────────────────────────────────
9
+ // Legacy aliases — these names predate the Tools → Extensions rename. Keep
10
+ // exporting them so deployed templates that haven't been updated still
11
+ // resolve. Use the canonical `Extension*` names in new code.
12
+ // ─────────────────────────────────────────────────────────────────────────────
13
+ export { ExtensionsSidebarSection as ToolsSidebarSection } from "./ExtensionsSidebarSection.js";
14
+ export { ExtensionViewer as ToolViewer, } from "./ExtensionViewer.js";
15
+ export { ExtensionEditor as ToolEditor, } from "./ExtensionEditor.js";
16
+ export { ExtensionsListPage as ToolsListPage } from "./ExtensionsListPage.js";
17
+ export { ExtensionViewerPage as ToolViewerPage } from "./ExtensionViewerPage.js";
18
+ export { EmbeddedExtension as EmbeddedTool, } from "./EmbeddedExtension.js";
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/extensions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EACL,eAAe,GAEhB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,eAAe,GAEhB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EACL,iBAAiB,GAElB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAA2B,MAAM,oBAAoB,CAAC;AAE5E,gFAAgF;AAChF,2EAA2E;AAC3E,uEAAuE;AACvE,6DAA6D;AAC7D,gFAAgF;AAEhF,OAAO,EAAE,wBAAwB,IAAI,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAChG,OAAO,EACL,eAAe,IAAI,UAAU,GAE9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,eAAe,IAAI,UAAU,GAE9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,IAAI,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,mBAAmB,IAAI,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,EACL,iBAAiB,IAAI,YAAY,GAElC,MAAM,wBAAwB,CAAC","sourcesContent":["export { ExtensionsSidebarSection } from \"./ExtensionsSidebarSection.js\";\nexport {\n ExtensionViewer,\n type ExtensionViewerProps,\n} from \"./ExtensionViewer.js\";\nexport {\n ExtensionEditor,\n type ExtensionEditorProps,\n} from \"./ExtensionEditor.js\";\nexport { ExtensionsListPage } from \"./ExtensionsListPage.js\";\nexport { ExtensionViewerPage } from \"./ExtensionViewerPage.js\";\nexport {\n EmbeddedExtension,\n type EmbeddedExtensionProps,\n} from \"./EmbeddedExtension.js\";\nexport { ExtensionSlot, type ExtensionSlotProps } from \"./ExtensionSlot.js\";\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Legacy aliases — these names predate the Tools → Extensions rename. Keep\n// exporting them so deployed templates that haven't been updated still\n// resolve. Use the canonical `Extension*` names in new code.\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport { ExtensionsSidebarSection as ToolsSidebarSection } from \"./ExtensionsSidebarSection.js\";\nexport {\n ExtensionViewer as ToolViewer,\n type ExtensionViewerProps as ToolViewerProps,\n} from \"./ExtensionViewer.js\";\nexport {\n ExtensionEditor as ToolEditor,\n type ExtensionEditorProps as ToolEditorProps,\n} from \"./ExtensionEditor.js\";\nexport { ExtensionsListPage as ToolsListPage } from \"./ExtensionsListPage.js\";\nexport { ExtensionViewerPage as ToolViewerPage } from \"./ExtensionViewerPage.js\";\nexport {\n EmbeddedExtension as EmbeddedTool,\n type EmbeddedExtensionProps as EmbeddedToolProps,\n} from \"./EmbeddedExtension.js\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IntegrationsPanel.d.ts","sourceRoot":"","sources":["../../../src/client/integrations/IntegrationsPanel.tsx"],"names":[],"mappings":"AAmXA,wBAAgB,iBAAiB,4CA4IhC"}
1
+ {"version":3,"file":"IntegrationsPanel.d.ts","sourceRoot":"","sources":["../../../src/client/integrations/IntegrationsPanel.tsx"],"names":[],"mappings":"AA2YA,wBAAgB,iBAAiB,4CA4IhC"}
@@ -138,7 +138,10 @@ function IntegrationDetail({ platform, serverStatus, onBack, onRefresh, }) {
138
138
  }, []);
139
139
  const isConfigured = serverStatus?.configured ?? false;
140
140
  const isEnabled = serverStatus?.enabled ?? false;
141
- return (_jsxs("div", { children: [_jsxs("button", { onClick: onBack, className: "flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground mb-2", children: [_jsx(IconChevronLeft, { size: 12 }), "Back"] }), _jsxs("div", { className: "flex items-center gap-2 mb-2", children: [_jsx(platform.icon, { size: 18, className: "text-foreground shrink-0" }), _jsxs("div", { children: [_jsx("div", { className: "text-xs font-medium text-foreground", children: platform.label }), _jsx("div", { className: "text-[10px] text-muted-foreground", children: platform.description })] })] }), _jsxs("div", { className: "mb-3", children: [_jsx("div", { className: "text-[10px] font-medium text-muted-foreground mb-1.5", children: "Setup" }), _jsx("ol", { className: "space-y-1", children: platform.setupSteps.map((step, i) => (_jsxs("li", { className: "flex gap-1.5 text-[10px] text-muted-foreground leading-relaxed", children: [_jsxs("span", { className: "shrink-0 text-muted-foreground/50", children: [i + 1, "."] }), step] }, i))) })] }), platform.envVars.length > 0 && (_jsxs("div", { className: "mb-3", children: [_jsx("div", { className: "text-[10px] font-medium text-muted-foreground mb-1", children: "Required secrets" }), _jsx("div", { className: "space-y-0.5", children: platform.envVars.map((v) => (_jsxs("div", { className: "flex items-center gap-1", children: [_jsx("code", { className: "text-[10px] text-foreground bg-muted px-1 py-0.5 rounded", children: v }), isConfigured && (_jsx(IconCircleCheck, { size: 11, className: "text-green-500 shrink-0" }))] }, v))) }), !isConfigured && (_jsx("p", { className: "text-[10px] text-amber-500 mt-1", children: "Set these in your .env file or environment to connect." }))] })), serverStatus?.webhookUrl && !platform.isClient && (_jsxs("div", { className: "mb-3", children: [_jsx("div", { className: "text-[10px] font-medium text-muted-foreground mb-1", children: "Webhook URL" }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsx("code", { className: "flex-1 truncate rounded bg-muted px-1.5 py-0.5 text-[10px] text-foreground", children: serverStatus.webhookUrl }), _jsx("button", { onClick: () => handleCopy(serverStatus.webhookUrl), className: "shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent/50", title: "Copy", children: copied ? _jsx(IconCheck, { size: 12 }) : _jsx(IconCopy, { size: 12 }) })] })] })), platform.docsUrl && (_jsxs("a", { href: platform.docsUrl, target: "_blank", rel: "noopener noreferrer", className: "flex items-center gap-1 text-[10px] text-blue-400 hover:text-blue-300 mb-3", children: ["Documentation", _jsx(IconExternalLink, { size: 10 })] })), serverStatus && !platform.isClient && isConfigured && (_jsx("button", { onClick: handleToggle, disabled: toggling, className: `w-full rounded-md border px-2 py-1.5 text-[11px] font-medium disabled:opacity-50 ${isEnabled
141
+ const serviceAccountEmail = typeof serverStatus?.details?.serviceAccountEmail === "string"
142
+ ? serverStatus.details.serviceAccountEmail
143
+ : null;
144
+ return (_jsxs("div", { children: [_jsxs("button", { onClick: onBack, className: "flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground mb-2", children: [_jsx(IconChevronLeft, { size: 12 }), "Back"] }), _jsxs("div", { className: "flex items-center gap-2 mb-2", children: [_jsx(platform.icon, { size: 18, className: "text-foreground shrink-0" }), _jsxs("div", { children: [_jsx("div", { className: "text-xs font-medium text-foreground", children: platform.label }), _jsx("div", { className: "text-[10px] text-muted-foreground", children: platform.description })] })] }), _jsxs("div", { className: "mb-3", children: [_jsx("div", { className: "text-[10px] font-medium text-muted-foreground mb-1.5", children: "Setup" }), _jsx("ol", { className: "space-y-1", children: platform.setupSteps.map((step, i) => (_jsxs("li", { className: "flex gap-1.5 text-[10px] text-muted-foreground leading-relaxed", children: [_jsxs("span", { className: "shrink-0 text-muted-foreground/50", children: [i + 1, "."] }), step] }, i))) })] }), serviceAccountEmail && (_jsxs("div", { className: "mb-3", children: [_jsx("div", { className: "text-[10px] font-medium text-muted-foreground mb-1", children: "Share documents with" }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsx("code", { className: "flex-1 truncate rounded bg-muted px-1.5 py-0.5 text-[10px] text-foreground", children: serviceAccountEmail }), _jsx("button", { onClick: () => handleCopy(serviceAccountEmail), className: "shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent/50", title: "Copy service account email", children: copied ? _jsx(IconCheck, { size: 12 }) : _jsx(IconCopy, { size: 12 }) })] })] })), platform.envVars.length > 0 && (_jsxs("div", { className: "mb-3", children: [_jsx("div", { className: "text-[10px] font-medium text-muted-foreground mb-1", children: "Required secrets" }), _jsx("div", { className: "space-y-0.5", children: platform.envVars.map((v) => (_jsxs("div", { className: "flex items-center gap-1", children: [_jsx("code", { className: "text-[10px] text-foreground bg-muted px-1 py-0.5 rounded", children: v }), isConfigured && (_jsx(IconCircleCheck, { size: 11, className: "text-green-500 shrink-0" }))] }, v))) }), !isConfigured && (_jsx("p", { className: "text-[10px] text-amber-500 mt-1", children: "Set these in your .env file or environment to connect." }))] })), serverStatus?.webhookUrl && !platform.isClient && (_jsxs("div", { className: "mb-3", children: [_jsx("div", { className: "text-[10px] font-medium text-muted-foreground mb-1", children: "Webhook URL" }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsx("code", { className: "flex-1 truncate rounded bg-muted px-1.5 py-0.5 text-[10px] text-foreground", children: serverStatus.webhookUrl }), _jsx("button", { onClick: () => handleCopy(serverStatus.webhookUrl), className: "shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent/50", title: "Copy", children: copied ? _jsx(IconCheck, { size: 12 }) : _jsx(IconCopy, { size: 12 }) })] })] })), platform.docsUrl && (_jsxs("a", { href: platform.docsUrl, target: "_blank", rel: "noopener noreferrer", className: "flex items-center gap-1 text-[10px] text-blue-400 hover:text-blue-300 mb-3", children: ["Documentation", _jsx(IconExternalLink, { size: 10 })] })), serverStatus && !platform.isClient && isConfigured && (_jsx("button", { onClick: handleToggle, disabled: toggling, className: `w-full rounded-md border px-2 py-1.5 text-[11px] font-medium disabled:opacity-50 ${isEnabled
142
145
  ? "border-border text-foreground hover:bg-accent/50"
143
146
  : "border-green-600/50 text-green-400 hover:bg-green-900/20"}`, children: toggling ? "..." : isEnabled ? "Disable" : "Enable" })), platform.isClient && (_jsx("div", { className: "rounded-md border border-border bg-muted/30 px-2.5 py-2 text-[10px] text-muted-foreground", children: "This agent's A2A endpoint is automatically available. No configuration needed." })), serverStatus?.error && (_jsx("p", { className: "text-[10px] text-destructive mt-2", children: serverStatus.error })), toggleError && (_jsx("p", { className: "text-[10px] text-destructive mt-2", children: toggleError }))] }));
144
147
  }
@@ -1 +1 @@
1
- {"version":3,"file":"IntegrationsPanel.js","sourceRoot":"","sources":["../../../src/client/integrations/IntegrationsPanel.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EACL,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,sBAAsB,EAEtB,QAAQ,EACR,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,oBAAoB,GAErB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAgBjD,MAAM,SAAS,GAAmB;IAChC;QACE,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,kDAAkD;QAC/D,OAAO,EAAE,CAAC,iBAAiB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EAAE,GACF,CACH,KArBI,QAAQ,CAAC,EAAE,CAsBT,CACV,CAAC;oBACJ,CAAC,CAAC,EACF,cAAK,SAAS,EAAC,2FAA2F,gKAIpG,IACF,CACP,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["import React, { useState, useCallback } from \"react\";\nimport {\n IconPlus,\n IconBrandSlack,\n IconBrandTelegram,\n IconBrandWhatsapp,\n IconBrandGoogleDrive,\n IconTerminal2,\n IconBuildingSkyscraper,\n IconMessageCircle,\n IconCopy,\n IconCheck,\n IconChevronLeft,\n IconExternalLink,\n IconCircleCheck,\n} from \"@tabler/icons-react\";\nimport {\n useIntegrationStatus,\n type IntegrationStatus,\n} from \"./useIntegrationStatus.js\";\nimport { agentNativePath } from \"../api-path.js\";\n\n// ─── Platform config ─────────────────────────────────────────────────────────\n\ninterface PlatformInfo {\n id: string;\n label: string;\n icon: React.ComponentType<any>;\n description: string;\n envVars: string[];\n setupSteps: string[];\n docsUrl?: string;\n /** If true, this is a \"client\" integration (user connects TO the agent) rather than a webhook */\n isClient?: boolean;\n}\n\nconst PLATFORMS: PlatformInfo[] = [\n {\n id: \"slack\",\n label: \"Slack\",\n icon: IconBrandSlack,\n description: \"Message your agent from any Slack channel or DM.\",\n envVars: [\"SLACK_BOT_TOKEN\", \"SLACK_SIGNING_SECRET\"],\n setupSteps: [\n \"Create a Slack app at api.slack.com/apps\",\n 'Enable \"Event Subscriptions\" and point to your webhook URL',\n \"Subscribe to message.im and app_mention events\",\n \"Install the app to your workspace\",\n \"Copy the Bot Token and Signing Secret into your environment\",\n ],\n docsUrl: \"https://api.slack.com/apps\",\n },\n {\n id: \"telegram\",\n label: \"Telegram\",\n icon: IconBrandTelegram,\n description: \"Chat with your agent via a Telegram bot.\",\n envVars: [\"TELEGRAM_BOT_TOKEN\"],\n setupSteps: [\n \"Message @BotFather on Telegram to create a new bot\",\n \"Copy the bot token into your environment\",\n 'Click \"Setup webhook\" below to register automatically',\n ],\n },\n {\n id: \"whatsapp\",\n label: \"WhatsApp\",\n icon: IconBrandWhatsapp,\n description: \"Connect your agent to WhatsApp Business.\",\n envVars: [\"WHATSAPP_TOKEN\", \"WHATSAPP_VERIFY_TOKEN\"],\n setupSteps: [\n \"Create a Meta Business app at developers.facebook.com\",\n \"Set up WhatsApp Business API\",\n \"Configure the webhook URL and verify token\",\n \"Copy the access token into your environment\",\n ],\n docsUrl: \"https://developers.facebook.com/docs/whatsapp\",\n },\n {\n id: \"google-docs\",\n label: \"Google Docs\",\n icon: IconBrandGoogleDrive,\n description: \"Tag the agent in Google Doc comments to get responses.\",\n envVars: [\"GOOGLE_SERVICE_ACCOUNT_KEY\"],\n setupSteps: [\n \"Create a Google Cloud service account and download the JSON key\",\n \"Set GOOGLE_SERVICE_ACCOUNT_KEY in your environment (JSON string or file path)\",\n \"Share your Google Docs with the service account email\",\n 'Write a comment containing \"@Agent\" to trigger the agent',\n ],\n },\n {\n id: \"openclaw\",\n label: \"OpenClaw\",\n icon: IconTerminal2,\n description: \"Access this agent from OpenClaw's unified agent interface.\",\n envVars: [],\n isClient: true,\n setupSteps: [\n \"Install OpenClaw: npm install -g openclaw\",\n \"Add this agent's URL as a provider in your OpenClaw config\",\n \"OpenClaw discovers your agent's capabilities via the A2A protocol\",\n ],\n },\n {\n id: \"claude-code\",\n label: \"Claude Code\",\n icon: IconTerminal2,\n description:\n \"Let Claude Code call this agent via A2A for data and actions.\",\n envVars: [],\n isClient: true,\n setupSteps: [\n \"Your agent exposes an A2A endpoint at /.well-known/agent-card.json\",\n \"In Claude Code, reference your agent's URL when asking for data\",\n \"Claude Code will discover and call your agent's skills automatically\",\n ],\n },\n {\n id: \"builder\",\n label: \"Builder.io\",\n icon: IconBuildingSkyscraper,\n description:\n \"One chat interface that orchestrates all your agents together.\",\n envVars: [],\n isClient: true,\n setupSteps: [\n \"Connect your agent-native apps in your Builder.io workspace\",\n \"Builder.io discovers each agent's skills via A2A\",\n \"Chat with one agent that can trigger actions across all your apps\",\n ],\n docsUrl: \"https://www.builder.io\",\n },\n];\n\n// ─── Integration detail view ─────────────────────────────────────────────────\n\nfunction IntegrationDetail({\n platform,\n serverStatus,\n onBack,\n onRefresh,\n}: {\n platform: PlatformInfo;\n serverStatus?: IntegrationStatus;\n onBack: () => void;\n onRefresh: () => void;\n}) {\n const [toggling, setToggling] = useState(false);\n const [copied, setCopied] = useState(false);\n const [toggleError, setToggleError] = useState<string | null>(null);\n\n const handleToggle = useCallback(async () => {\n setToggling(true);\n setToggleError(null);\n try {\n const action = serverStatus?.enabled ? \"disable\" : \"enable\";\n const res = await fetch(\n agentNativePath(`/_agent-native/integrations/${platform.id}/${action}`),\n { method: \"POST\" },\n );\n if (res.ok) {\n onRefresh();\n return;\n }\n // Surface the real reason instead of silently doing nothing.\n // The endpoint returns `{ error }` for known failures (admin gating,\n // missing secrets, etc.); fall back to status text otherwise.\n const data = (await res.json().catch(() => null)) as {\n error?: string;\n } | null;\n setToggleError(\n data?.error ||\n res.statusText ||\n `Couldn't ${action} ${platform.label} (HTTP ${res.status})`,\n );\n } catch (err) {\n setToggleError(\n err instanceof Error\n ? err.message\n : \"Network error reaching the server\",\n );\n } finally {\n setToggling(false);\n }\n }, [platform.id, platform.label, serverStatus?.enabled, onRefresh]);\n\n const handleCopy = useCallback(async (text: string) => {\n await navigator.clipboard.writeText(text);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n }, []);\n\n const isConfigured = serverStatus?.configured ?? false;\n const isEnabled = serverStatus?.enabled ?? false;\n\n return (\n <div>\n <button\n onClick={onBack}\n className=\"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground mb-2\"\n >\n <IconChevronLeft size={12} />\n Back\n </button>\n\n <div className=\"flex items-center gap-2 mb-2\">\n <platform.icon size={18} className=\"text-foreground shrink-0\" />\n <div>\n <div className=\"text-xs font-medium text-foreground\">\n {platform.label}\n </div>\n <div className=\"text-[10px] text-muted-foreground\">\n {platform.description}\n </div>\n </div>\n </div>\n\n {/* Setup steps */}\n <div className=\"mb-3\">\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1.5\">\n Setup\n </div>\n <ol className=\"space-y-1\">\n {platform.setupSteps.map((step, i) => (\n <li\n key={i}\n className=\"flex gap-1.5 text-[10px] text-muted-foreground leading-relaxed\"\n >\n <span className=\"shrink-0 text-muted-foreground/50\">\n {i + 1}.\n </span>\n {step}\n </li>\n ))}\n </ol>\n </div>\n\n {/* Required secrets */}\n {platform.envVars.length > 0 && (\n <div className=\"mb-3\">\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1\">\n Required secrets\n </div>\n <div className=\"space-y-0.5\">\n {platform.envVars.map((v) => (\n <div key={v} className=\"flex items-center gap-1\">\n <code className=\"text-[10px] text-foreground bg-muted px-1 py-0.5 rounded\">\n {v}\n </code>\n {isConfigured && (\n <IconCircleCheck\n size={11}\n className=\"text-green-500 shrink-0\"\n />\n )}\n </div>\n ))}\n </div>\n {!isConfigured && (\n <p className=\"text-[10px] text-amber-500 mt-1\">\n Set these in your .env file or environment to connect.\n </p>\n )}\n </div>\n )}\n\n {/* Webhook URL */}\n {serverStatus?.webhookUrl && !platform.isClient && (\n <div className=\"mb-3\">\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1\">\n Webhook URL\n </div>\n <div className=\"flex items-center gap-1\">\n <code className=\"flex-1 truncate rounded bg-muted px-1.5 py-0.5 text-[10px] text-foreground\">\n {serverStatus.webhookUrl}\n </code>\n <button\n onClick={() => handleCopy(serverStatus.webhookUrl!)}\n className=\"shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent/50\"\n title=\"Copy\"\n >\n {copied ? <IconCheck size={12} /> : <IconCopy size={12} />}\n </button>\n </div>\n </div>\n )}\n\n {/* Docs link */}\n {platform.docsUrl && (\n <a\n href={platform.docsUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-1 text-[10px] text-blue-400 hover:text-blue-300 mb-3\"\n >\n Documentation\n <IconExternalLink size={10} />\n </a>\n )}\n\n {/* Enable/disable for server integrations */}\n {serverStatus && !platform.isClient && isConfigured && (\n <button\n onClick={handleToggle}\n disabled={toggling}\n className={`w-full rounded-md border px-2 py-1.5 text-[11px] font-medium disabled:opacity-50 ${\n isEnabled\n ? \"border-border text-foreground hover:bg-accent/50\"\n : \"border-green-600/50 text-green-400 hover:bg-green-900/20\"\n }`}\n >\n {toggling ? \"...\" : isEnabled ? \"Disable\" : \"Enable\"}\n </button>\n )}\n\n {/* Status for client integrations */}\n {platform.isClient && (\n <div className=\"rounded-md border border-border bg-muted/30 px-2.5 py-2 text-[10px] text-muted-foreground\">\n This agent's A2A endpoint is automatically available. No configuration\n needed.\n </div>\n )}\n\n {serverStatus?.error && (\n <p className=\"text-[10px] text-destructive mt-2\">\n {serverStatus.error}\n </p>\n )}\n\n {toggleError && (\n <p className=\"text-[10px] text-destructive mt-2\">{toggleError}</p>\n )}\n </div>\n );\n}\n\n// ─── Add integration picker ──────────────────────────────────────────────────\n\nfunction AddIntegrationPicker({\n connectedIds,\n onSelect,\n}: {\n connectedIds: Set<string>;\n onSelect: (platform: PlatformInfo) => void;\n}) {\n return (\n <div className=\"space-y-1\">\n {PLATFORMS.filter((p) => !connectedIds.has(p.id)).map((platform) => (\n <button\n key={platform.id}\n onClick={() => onSelect(platform)}\n className=\"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-accent/50\"\n >\n <platform.icon size={14} className=\"shrink-0 text-muted-foreground\" />\n <div className=\"flex-1 min-w-0\">\n <div className=\"text-[11px] font-medium text-foreground\">\n {platform.label}\n </div>\n <div className=\"text-[10px] text-muted-foreground truncate\">\n {platform.description}\n </div>\n </div>\n </button>\n ))}\n </div>\n );\n}\n\n// ─── Main panel ──────────────────────────────────────────────────────────────\n\nexport function IntegrationsPanel() {\n const { statuses, loading, refetch } = useIntegrationStatus();\n const [selectedPlatform, setSelectedPlatform] = useState<PlatformInfo | null>(\n null,\n );\n const [showPicker, setShowPicker] = useState(false);\n\n const statusMap = new Map(statuses.map((s) => [s.platform, s]));\n\n // Show connected (enabled or configured) integrations\n const connectedPlatforms = PLATFORMS.filter((p) => {\n const s = statusMap.get(p.id);\n return s?.configured || s?.enabled;\n });\n\n const connectedIds = new Set(connectedPlatforms.map((p) => p.id));\n\n if (selectedPlatform) {\n return (\n <IntegrationDetail\n platform={selectedPlatform}\n serverStatus={statusMap.get(selectedPlatform.id)}\n onBack={() => setSelectedPlatform(null)}\n onRefresh={refetch}\n />\n );\n }\n\n if (showPicker) {\n return (\n <div>\n <button\n onClick={() => setShowPicker(false)}\n className=\"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground mb-2\"\n >\n <IconChevronLeft size={12} />\n Back\n </button>\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1.5\">\n Add a chat integration\n </div>\n <AddIntegrationPicker\n connectedIds={connectedIds}\n onSelect={(p) => {\n setSelectedPlatform(p);\n setShowPicker(false);\n }}\n />\n </div>\n );\n }\n\n return (\n <div>\n <div className=\"flex items-center justify-between mb-1.5\">\n <div>\n <div className=\"text-xs font-medium text-foreground\">\n Chat Integrations\n </div>\n <div className=\"text-[10px] text-muted-foreground\">\n Talk to this agent from other platforms\n </div>\n </div>\n <button\n onClick={() => setShowPicker(true)}\n className=\"flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent/50\"\n title=\"Add integration\"\n >\n <IconPlus size={12} />\n </button>\n </div>\n\n {loading ? (\n <div className=\"space-y-1.5\">\n <div className=\"h-6 w-full rounded bg-muted/50 animate-pulse\" />\n <div className=\"h-6 w-3/4 rounded bg-muted/50 animate-pulse\" />\n </div>\n ) : connectedPlatforms.length === 0 ? (\n <div className=\"space-y-2\">\n <button\n onClick={() => setShowPicker(true)}\n className=\"flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-[11px] text-muted-foreground hover:text-foreground hover:bg-accent/30\"\n >\n <IconPlus size={12} className=\"shrink-0\" />\n Add integration\n </button>\n <div className=\"rounded-md border border-border bg-muted/30 px-2.5 py-2 text-[10px] text-muted-foreground\">\n For a central Slack or Telegram entrypoint that can route work\n across multiple apps, use the{\" \"}\n <a\n href=\"https://dispatch.agent-native.com\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"no-underline font-medium text-foreground hover:text-foreground/80\"\n >\n dispatch template\n </a>\n .\n </div>\n </div>\n ) : (\n <div className=\"space-y-2\">\n {connectedPlatforms.map((platform) => {\n const s = statusMap.get(platform.id);\n return (\n <button\n key={platform.id}\n onClick={() => setSelectedPlatform(platform)}\n className=\"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-accent/50\"\n >\n <platform.icon\n size={14}\n className=\"shrink-0 text-muted-foreground\"\n />\n <span className=\"flex-1 text-[11px] font-medium text-foreground truncate\">\n {platform.label}\n </span>\n {s && (\n <span\n className={`inline-block h-1.5 w-1.5 rounded-full shrink-0 ${\n s.enabled && s.configured\n ? \"bg-green-500\"\n : s.configured\n ? \"bg-yellow-500\"\n : \"bg-gray-400\"\n }`}\n />\n )}\n </button>\n );\n })}\n <div className=\"rounded-md border border-border bg-muted/30 px-2.5 py-2 text-[10px] text-muted-foreground\">\n Need one shared messaging surface for your workspace? Connect Slack\n or Telegram to a dispatch app and let it delegate to other agents\n over A2A.\n </div>\n </div>\n )}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"IntegrationsPanel.js","sourceRoot":"","sources":["../../../src/client/integrations/IntegrationsPanel.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EACL,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,sBAAsB,EAEtB,QAAQ,EACR,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,oBAAoB,GAErB,MAAM,2BAA2B,CAAC;AACnC,OAAO,E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S,EAAC,2FAA2F,6GAE1E,GAAG,EACjC,YACE,IAAI,EAAC,mCAAmC,EACxC,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,EACzB,SAAS,EAAC,mEAAmE,kCAG3E,SAEA,IACF,CACP,CAAC,CAAC,CAAC,CACF,eAAK,SAAS,EAAC,WAAW,aACvB,kBAAkB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;wBACnC,MAAM,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;wBACrC,OAAO,CACL,kBAEE,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC,QAAQ,CAAC,EAC5C,SAAS,EAAC,oFAAoF,aAE9F,KAAC,QAAQ,CAAC,IAAI,IACZ,IAAI,EAAE,EAAE,EACR,SAAS,EAAC,gCAAgC,GAC1C,EACF,eAAM,SAAS,EAAC,yDAAyD,YACtE,QAAQ,CAAC,KAAK,GACV,EACN,CAAC,IAAI,CACJ,eACE,SAAS,EAAE,kDACT,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,UAAU;wCACvB,CAAC,CAAC,cAAc;wCAChB,CAAC,CAAC,CAAC,CAAC,UAAU;4CACZ,CAAC,CAAC,eAAe;4CACjB,CAAC,CAAC,aACR,EAAE,GACF,CACH,KArBI,QAAQ,CAAC,EAAE,CAsBT,CACV,CAAC;oBACJ,CAAC,CAAC,EACF,cAAK,SAAS,EAAC,2FAA2F,gKAIpG,IACF,CACP,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["import React, { useState, useCallback } from \"react\";\nimport {\n IconPlus,\n IconBrandSlack,\n IconBrandTelegram,\n IconBrandWhatsapp,\n IconBrandGoogleDrive,\n IconTerminal2,\n IconBuildingSkyscraper,\n IconMessageCircle,\n IconCopy,\n IconCheck,\n IconChevronLeft,\n IconExternalLink,\n IconCircleCheck,\n} from \"@tabler/icons-react\";\nimport {\n useIntegrationStatus,\n type IntegrationStatus,\n} from \"./useIntegrationStatus.js\";\nimport { agentNativePath } from \"../api-path.js\";\n\n// ─── Platform config ─────────────────────────────────────────────────────────\n\ninterface PlatformInfo {\n id: string;\n label: string;\n icon: React.ComponentType<any>;\n description: string;\n envVars: string[];\n setupSteps: string[];\n docsUrl?: string;\n /** If true, this is a \"client\" integration (user connects TO the agent) rather than a webhook */\n isClient?: boolean;\n}\n\nconst PLATFORMS: PlatformInfo[] = [\n {\n id: \"slack\",\n label: \"Slack\",\n icon: IconBrandSlack,\n description: \"Message your agent from any Slack channel or DM.\",\n envVars: [\"SLACK_BOT_TOKEN\", \"SLACK_SIGNING_SECRET\"],\n setupSteps: [\n \"Create a Slack app at api.slack.com/apps\",\n 'Enable \"Event Subscriptions\" and point to your webhook URL',\n \"Subscribe to message.im and app_mention events\",\n \"Install the app to your workspace\",\n \"Copy the Bot Token and Signing Secret into your environment\",\n ],\n docsUrl: \"https://api.slack.com/apps\",\n },\n {\n id: \"telegram\",\n label: \"Telegram\",\n icon: IconBrandTelegram,\n description: \"Chat with your agent via a Telegram bot.\",\n envVars: [\"TELEGRAM_BOT_TOKEN\"],\n setupSteps: [\n \"Message @BotFather on Telegram to create a new bot\",\n \"Copy the bot token into your environment\",\n 'Click \"Setup webhook\" below to register automatically',\n ],\n },\n {\n id: \"whatsapp\",\n label: \"WhatsApp\",\n icon: IconBrandWhatsapp,\n description: \"Connect your agent to WhatsApp Business.\",\n envVars: [\"WHATSAPP_TOKEN\", \"WHATSAPP_VERIFY_TOKEN\"],\n setupSteps: [\n \"Create a Meta Business app at developers.facebook.com\",\n \"Set up WhatsApp Business API\",\n \"Configure the webhook URL and verify token\",\n \"Copy the access token into your environment\",\n ],\n docsUrl: \"https://developers.facebook.com/docs/whatsapp\",\n },\n {\n id: \"google-docs\",\n label: \"Google Docs\",\n icon: IconBrandGoogleDrive,\n description: \"Tag the agent in Google Doc comments to get responses.\",\n envVars: [\"GOOGLE_SERVICE_ACCOUNT_KEY\"],\n setupSteps: [\n \"Create a Google Cloud service account and download the JSON key\",\n \"Set GOOGLE_SERVICE_ACCOUNT_KEY in your environment (JSON string or file path)\",\n \"Share your Google Docs with the service account email\",\n 'Write a comment containing \"@Agent\" to trigger the agent',\n ],\n },\n {\n id: \"openclaw\",\n label: \"OpenClaw\",\n icon: IconTerminal2,\n description: \"Access this agent from OpenClaw's unified agent interface.\",\n envVars: [],\n isClient: true,\n setupSteps: [\n \"Install OpenClaw: npm install -g openclaw\",\n \"Add this agent's URL as a provider in your OpenClaw config\",\n \"OpenClaw discovers your agent's capabilities via the A2A protocol\",\n ],\n },\n {\n id: \"claude-code\",\n label: \"Claude Code\",\n icon: IconTerminal2,\n description:\n \"Let Claude Code call this agent via A2A for data and actions.\",\n envVars: [],\n isClient: true,\n setupSteps: [\n \"Your agent exposes an A2A endpoint at /.well-known/agent-card.json\",\n \"In Claude Code, reference your agent's URL when asking for data\",\n \"Claude Code will discover and call your agent's skills automatically\",\n ],\n },\n {\n id: \"builder\",\n label: \"Builder.io\",\n icon: IconBuildingSkyscraper,\n description:\n \"One chat interface that orchestrates all your agents together.\",\n envVars: [],\n isClient: true,\n setupSteps: [\n \"Connect your agent-native apps in your Builder.io workspace\",\n \"Builder.io discovers each agent's skills via A2A\",\n \"Chat with one agent that can trigger actions across all your apps\",\n ],\n docsUrl: \"https://www.builder.io\",\n },\n];\n\n// ─── Integration detail view ─────────────────────────────────────────────────\n\nfunction IntegrationDetail({\n platform,\n serverStatus,\n onBack,\n onRefresh,\n}: {\n platform: PlatformInfo;\n serverStatus?: IntegrationStatus;\n onBack: () => void;\n onRefresh: () => void;\n}) {\n const [toggling, setToggling] = useState(false);\n const [copied, setCopied] = useState(false);\n const [toggleError, setToggleError] = useState<string | null>(null);\n\n const handleToggle = useCallback(async () => {\n setToggling(true);\n setToggleError(null);\n try {\n const action = serverStatus?.enabled ? \"disable\" : \"enable\";\n const res = await fetch(\n agentNativePath(`/_agent-native/integrations/${platform.id}/${action}`),\n { method: \"POST\" },\n );\n if (res.ok) {\n onRefresh();\n return;\n }\n // Surface the real reason instead of silently doing nothing.\n // The endpoint returns `{ error }` for known failures (admin gating,\n // missing secrets, etc.); fall back to status text otherwise.\n const data = (await res.json().catch(() => null)) as {\n error?: string;\n } | null;\n setToggleError(\n data?.error ||\n res.statusText ||\n `Couldn't ${action} ${platform.label} (HTTP ${res.status})`,\n );\n } catch (err) {\n setToggleError(\n err instanceof Error\n ? err.message\n : \"Network error reaching the server\",\n );\n } finally {\n setToggling(false);\n }\n }, [platform.id, platform.label, serverStatus?.enabled, onRefresh]);\n\n const handleCopy = useCallback(async (text: string) => {\n await navigator.clipboard.writeText(text);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n }, []);\n\n const isConfigured = serverStatus?.configured ?? false;\n const isEnabled = serverStatus?.enabled ?? false;\n const serviceAccountEmail =\n typeof serverStatus?.details?.serviceAccountEmail === \"string\"\n ? serverStatus.details.serviceAccountEmail\n : null;\n\n return (\n <div>\n <button\n onClick={onBack}\n className=\"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground mb-2\"\n >\n <IconChevronLeft size={12} />\n Back\n </button>\n\n <div className=\"flex items-center gap-2 mb-2\">\n <platform.icon size={18} className=\"text-foreground shrink-0\" />\n <div>\n <div className=\"text-xs font-medium text-foreground\">\n {platform.label}\n </div>\n <div className=\"text-[10px] text-muted-foreground\">\n {platform.description}\n </div>\n </div>\n </div>\n\n {/* Setup steps */}\n <div className=\"mb-3\">\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1.5\">\n Setup\n </div>\n <ol className=\"space-y-1\">\n {platform.setupSteps.map((step, i) => (\n <li\n key={i}\n className=\"flex gap-1.5 text-[10px] text-muted-foreground leading-relaxed\"\n >\n <span className=\"shrink-0 text-muted-foreground/50\">\n {i + 1}.\n </span>\n {step}\n </li>\n ))}\n </ol>\n </div>\n\n {serviceAccountEmail && (\n <div className=\"mb-3\">\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1\">\n Share documents with\n </div>\n <div className=\"flex items-center gap-1\">\n <code className=\"flex-1 truncate rounded bg-muted px-1.5 py-0.5 text-[10px] text-foreground\">\n {serviceAccountEmail}\n </code>\n <button\n onClick={() => handleCopy(serviceAccountEmail)}\n className=\"shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent/50\"\n title=\"Copy service account email\"\n >\n {copied ? <IconCheck size={12} /> : <IconCopy size={12} />}\n </button>\n </div>\n </div>\n )}\n\n {/* Required secrets */}\n {platform.envVars.length > 0 && (\n <div className=\"mb-3\">\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1\">\n Required secrets\n </div>\n <div className=\"space-y-0.5\">\n {platform.envVars.map((v) => (\n <div key={v} className=\"flex items-center gap-1\">\n <code className=\"text-[10px] text-foreground bg-muted px-1 py-0.5 rounded\">\n {v}\n </code>\n {isConfigured && (\n <IconCircleCheck\n size={11}\n className=\"text-green-500 shrink-0\"\n />\n )}\n </div>\n ))}\n </div>\n {!isConfigured && (\n <p className=\"text-[10px] text-amber-500 mt-1\">\n Set these in your .env file or environment to connect.\n </p>\n )}\n </div>\n )}\n\n {/* Webhook URL */}\n {serverStatus?.webhookUrl && !platform.isClient && (\n <div className=\"mb-3\">\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1\">\n Webhook URL\n </div>\n <div className=\"flex items-center gap-1\">\n <code className=\"flex-1 truncate rounded bg-muted px-1.5 py-0.5 text-[10px] text-foreground\">\n {serverStatus.webhookUrl}\n </code>\n <button\n onClick={() => handleCopy(serverStatus.webhookUrl!)}\n className=\"shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent/50\"\n title=\"Copy\"\n >\n {copied ? <IconCheck size={12} /> : <IconCopy size={12} />}\n </button>\n </div>\n </div>\n )}\n\n {/* Docs link */}\n {platform.docsUrl && (\n <a\n href={platform.docsUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-1 text-[10px] text-blue-400 hover:text-blue-300 mb-3\"\n >\n Documentation\n <IconExternalLink size={10} />\n </a>\n )}\n\n {/* Enable/disable for server integrations */}\n {serverStatus && !platform.isClient && isConfigured && (\n <button\n onClick={handleToggle}\n disabled={toggling}\n className={`w-full rounded-md border px-2 py-1.5 text-[11px] font-medium disabled:opacity-50 ${\n isEnabled\n ? \"border-border text-foreground hover:bg-accent/50\"\n : \"border-green-600/50 text-green-400 hover:bg-green-900/20\"\n }`}\n >\n {toggling ? \"...\" : isEnabled ? \"Disable\" : \"Enable\"}\n </button>\n )}\n\n {/* Status for client integrations */}\n {platform.isClient && (\n <div className=\"rounded-md border border-border bg-muted/30 px-2.5 py-2 text-[10px] text-muted-foreground\">\n This agent's A2A endpoint is automatically available. No configuration\n needed.\n </div>\n )}\n\n {serverStatus?.error && (\n <p className=\"text-[10px] text-destructive mt-2\">\n {serverStatus.error}\n </p>\n )}\n\n {toggleError && (\n <p className=\"text-[10px] text-destructive mt-2\">{toggleError}</p>\n )}\n </div>\n );\n}\n\n// ─── Add integration picker ──────────────────────────────────────────────────\n\nfunction AddIntegrationPicker({\n connectedIds,\n onSelect,\n}: {\n connectedIds: Set<string>;\n onSelect: (platform: PlatformInfo) => void;\n}) {\n return (\n <div className=\"space-y-1\">\n {PLATFORMS.filter((p) => !connectedIds.has(p.id)).map((platform) => (\n <button\n key={platform.id}\n onClick={() => onSelect(platform)}\n className=\"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-accent/50\"\n >\n <platform.icon size={14} className=\"shrink-0 text-muted-foreground\" />\n <div className=\"flex-1 min-w-0\">\n <div className=\"text-[11px] font-medium text-foreground\">\n {platform.label}\n </div>\n <div className=\"text-[10px] text-muted-foreground truncate\">\n {platform.description}\n </div>\n </div>\n </button>\n ))}\n </div>\n );\n}\n\n// ─── Main panel ──────────────────────────────────────────────────────────────\n\nexport function IntegrationsPanel() {\n const { statuses, loading, refetch } = useIntegrationStatus();\n const [selectedPlatform, setSelectedPlatform] = useState<PlatformInfo | null>(\n null,\n );\n const [showPicker, setShowPicker] = useState(false);\n\n const statusMap = new Map(statuses.map((s) => [s.platform, s]));\n\n // Show connected (enabled or configured) integrations\n const connectedPlatforms = PLATFORMS.filter((p) => {\n const s = statusMap.get(p.id);\n return s?.configured || s?.enabled;\n });\n\n const connectedIds = new Set(connectedPlatforms.map((p) => p.id));\n\n if (selectedPlatform) {\n return (\n <IntegrationDetail\n platform={selectedPlatform}\n serverStatus={statusMap.get(selectedPlatform.id)}\n onBack={() => setSelectedPlatform(null)}\n onRefresh={refetch}\n />\n );\n }\n\n if (showPicker) {\n return (\n <div>\n <button\n onClick={() => setShowPicker(false)}\n className=\"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground mb-2\"\n >\n <IconChevronLeft size={12} />\n Back\n </button>\n <div className=\"text-[10px] font-medium text-muted-foreground mb-1.5\">\n Add a chat integration\n </div>\n <AddIntegrationPicker\n connectedIds={connectedIds}\n onSelect={(p) => {\n setSelectedPlatform(p);\n setShowPicker(false);\n }}\n />\n </div>\n );\n }\n\n return (\n <div>\n <div className=\"flex items-center justify-between mb-1.5\">\n <div>\n <div className=\"text-xs font-medium text-foreground\">\n Chat Integrations\n </div>\n <div className=\"text-[10px] text-muted-foreground\">\n Talk to this agent from other platforms\n </div>\n </div>\n <button\n onClick={() => setShowPicker(true)}\n className=\"flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent/50\"\n title=\"Add integration\"\n >\n <IconPlus size={12} />\n </button>\n </div>\n\n {loading ? (\n <div className=\"space-y-1.5\">\n <div className=\"h-6 w-full rounded bg-muted/50 animate-pulse\" />\n <div className=\"h-6 w-3/4 rounded bg-muted/50 animate-pulse\" />\n </div>\n ) : connectedPlatforms.length === 0 ? (\n <div className=\"space-y-2\">\n <button\n onClick={() => setShowPicker(true)}\n className=\"flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-[11px] text-muted-foreground hover:text-foreground hover:bg-accent/30\"\n >\n <IconPlus size={12} className=\"shrink-0\" />\n Add integration\n </button>\n <div className=\"rounded-md border border-border bg-muted/30 px-2.5 py-2 text-[10px] text-muted-foreground\">\n For a central Slack or Telegram entrypoint that can route work\n across multiple apps, use the{\" \"}\n <a\n href=\"https://dispatch.agent-native.com\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"no-underline font-medium text-foreground hover:text-foreground/80\"\n >\n dispatch template\n </a>\n .\n </div>\n </div>\n ) : (\n <div className=\"space-y-2\">\n {connectedPlatforms.map((platform) => {\n const s = statusMap.get(platform.id);\n return (\n <button\n key={platform.id}\n onClick={() => setSelectedPlatform(platform)}\n className=\"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-accent/50\"\n >\n <platform.icon\n size={14}\n className=\"shrink-0 text-muted-foreground\"\n />\n <span className=\"flex-1 text-[11px] font-medium text-foreground truncate\">\n {platform.label}\n </span>\n {s && (\n <span\n className={`inline-block h-1.5 w-1.5 rounded-full shrink-0 ${\n s.enabled && s.configured\n ? \"bg-green-500\"\n : s.configured\n ? \"bg-yellow-500\"\n : \"bg-gray-400\"\n }`}\n />\n )}\n </button>\n );\n })}\n <div className=\"rounded-md border border-border bg-muted/30 px-2.5 py-2 text-[10px] text-muted-foreground\">\n Need one shared messaging surface for your workspace? Connect Slack\n or Telegram to a dispatch app and let it delegate to other agents\n over A2A.\n </div>\n </div>\n )}\n </div>\n );\n}\n"]}
@@ -33,7 +33,7 @@ export interface SSEEvent {
33
33
  recoverable?: boolean;
34
34
  maxIterations?: number;
35
35
  }
36
- export type AgentAutoContinueReason = "run_timeout" | "loop_limit" | "stream_ended";
36
+ export type AgentAutoContinueReason = "run_timeout" | "loop_limit" | "no_progress" | "stream_ended";
37
37
  export declare class AgentAutoContinueSignal extends Error {
38
38
  readonly reason: AgentAutoContinueReason;
39
39
  readonly maxIterations?: number;
@@ -42,6 +42,7 @@ export declare class AgentAutoContinueSignal extends Error {
42
42
  maxIterations?: number;
43
43
  });
44
44
  }
45
+ export declare const SSE_NO_PROGRESS_TIMEOUT_MS = 75000;
45
46
  /**
46
47
  * Process a single SSE event and update the content accumulator.
47
48
  * Returns: "continue" to keep going, "done" to stop, or a yield-ready result.
@@ -1 +1 @@
1
- {"version":3,"file":"sse-event-processor.d.ts","sourceRoot":"","sources":["../../src/client/sse-event-processor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG9D,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IACE,IAAI,EAAE,WAAW,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEN,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IAGjB,SAAS,CAAC,E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,EAAE,WAAW,EAAE,EACtB,eAAe,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,EAClC,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,EAC7B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GACpB,cAAc,CAAC,kBAAkB,CAAC,CAgGpC;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,EAChC,OAAO,EAAE,WAAW,EAAE,EACtB,eAAe,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,EAClC,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,QAAQ,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,IAAI,GACzC,OAAO,CAAC,IAAI,CAAC,CAqEf"}
@@ -9,6 +9,59 @@ export class AgentAutoContinueSignal extends Error {
9
9
  this.maxIterations = options.maxIterations;
10
10
  }
11
11
  }
12
+ export const SSE_NO_PROGRESS_TIMEOUT_MS = 75_000;
13
+ function isAutoRecoverableError(ev, errMsg) {
14
+ const code = String(ev.errorCode ?? "").toLowerCase();
15
+ const msg = errMsg.toLowerCase();
16
+ if (code === "context_length_exceeded" ||
17
+ code === "input_too_long" ||
18
+ code.startsWith("credits-limit") ||
19
+ code === "billing_error" ||
20
+ code === "unauthorized" ||
21
+ code === "authentication_error" ||
22
+ code === "permission_error" ||
23
+ code === "gateway_not_enabled" ||
24
+ code === "missing_api_key" ||
25
+ code === "missing_credentials" ||
26
+ code === "invalid_request_error" ||
27
+ code === "request_too_large" ||
28
+ code === "not_found_error" ||
29
+ code === "model_not_found") {
30
+ return false;
31
+ }
32
+ if (code === "builder_gateway_timeout" ||
33
+ code === "stale_run" ||
34
+ code === "timeout" ||
35
+ code === "timeout_error" ||
36
+ code === "http_408" ||
37
+ code === "http_429" ||
38
+ code === "http_500" ||
39
+ code === "http_502" ||
40
+ code === "http_503" ||
41
+ code === "http_504" ||
42
+ code === "rate_limited" ||
43
+ code === "too_many_concurrent_requests" ||
44
+ code === "overloaded_error") {
45
+ return true;
46
+ }
47
+ if (ev.recoverable === true)
48
+ return true;
49
+ return (msg.includes("overloaded") ||
50
+ msg.includes("rate_limit") ||
51
+ msg.includes("too many requests") ||
52
+ msg.includes("timeout") ||
53
+ msg.includes("gateway timeout") ||
54
+ msg.includes("inactivity timeout") ||
55
+ msg.includes("connection") ||
56
+ msg.includes("network") ||
57
+ msg.includes("stream closed") ||
58
+ msg.includes("stream ended") ||
59
+ msg.includes("temporarily unavailable") ||
60
+ msg.includes("502") ||
61
+ msg.includes("503") ||
62
+ msg.includes("504") ||
63
+ msg.includes("529"));
64
+ }
12
65
  /**
13
66
  * Process a single SSE event and update the content accumulator.
14
67
  * Returns: "continue" to keep going, "done" to stop, or a yield-ready result.
@@ -155,18 +208,22 @@ export function processEvent(ev, content, toolCallCounter, tabId) {
155
208
  if (ev.type === "auto_continue") {
156
209
  const reason = ev.reason === "stream_ended" ||
157
210
  ev.reason === "loop_limit" ||
211
+ ev.reason === "no_progress" ||
158
212
  ev.reason === "run_timeout"
159
213
  ? ev.reason
160
214
  : ev.errorCode === "stream_ended" ||
161
215
  ev.errorCode === "loop_limit" ||
216
+ ev.errorCode === "no_progress" ||
162
217
  ev.errorCode === "run_timeout"
163
218
  ? ev.errorCode
164
219
  : ev.error === "stream_ended" ||
165
220
  ev.error === "loop_limit" ||
221
+ ev.error === "no_progress" ||
166
222
  ev.error === "run_timeout"
167
223
  ? ev.error
168
224
  : ev.status === "stream_ended" ||
169
225
  ev.status === "loop_limit" ||
226
+ ev.status === "no_progress" ||
170
227
  ev.status === "run_timeout"
171
228
  ? ev.status
172
229
  : "run_timeout";
@@ -182,10 +239,17 @@ export function processEvent(ev, content, toolCallCounter, tabId) {
182
239
  }
183
240
  if (ev.type === "error") {
184
241
  const errMsg = ev.error ?? "Unknown error";
185
- if (ev.errorCode === "run_timeout" && ev.recoverable) {
242
+ if ((ev.errorCode === "run_timeout" && ev.recoverable) ||
243
+ isAutoRecoverableError(ev, errMsg)) {
186
244
  return {
187
245
  action: "auto_continue",
188
- autoContinue: { reason: "run_timeout" },
246
+ autoContinue: {
247
+ reason: ev.errorCode === "builder_gateway_timeout" ||
248
+ ev.errorCode === "run_timeout" ||
249
+ errMsg.toLowerCase().includes("timeout")
250
+ ? "run_timeout"
251
+ : "stream_ended",
252
+ },
189
253
  };
190
254
  }
191
255
  const normalized = normalizeChatError(errMsg);
@@ -252,6 +316,7 @@ export async function* readSSEStream(body, content, toolCallCounter, tabId, onSe
252
316
  const reader = body.getReader();
253
317
  const decoder = new TextDecoder();
254
318
  let buf = "";
319
+ let lastMeaningfulEventAt = Date.now();
255
320
  const withRunId = (r) => {
256
321
  if (!runId)
257
322
  return r;
@@ -281,6 +346,7 @@ export async function* readSSEStream(body, content, toolCallCounter, tabId, onSe
281
346
  buf += decoder.decode(value, { stream: true });
282
347
  const lines = buf.split("\n");
283
348
  buf = lines.pop() ?? "";
349
+ let sawDataEvent = false;
284
350
  for (const line of lines) {
285
351
  if (!line.startsWith("data: "))
286
352
  continue;
@@ -294,6 +360,8 @@ export async function* readSSEStream(body, content, toolCallCounter, tabId, onSe
294
360
  catch {
295
361
  continue;
296
362
  }
363
+ sawDataEvent = true;
364
+ lastMeaningfulEventAt = Date.now();
297
365
  // Track sequence number for reconnection
298
366
  if (ev.seq !== undefined && onSeq) {
299
367
  onSeq(ev.seq);
@@ -310,15 +378,20 @@ export async function* readSSEStream(body, content, toolCallCounter, tabId, onSe
310
378
  return;
311
379
  }
312
380
  }
381
+ if (!sawDataEvent &&
382
+ Date.now() - lastMeaningfulEventAt >= SSE_NO_PROGRESS_TIMEOUT_MS) {
383
+ throw new AgentAutoContinueSignal({ reason: "no_progress" });
384
+ }
313
385
  }
314
386
  }
315
387
  finally {
316
388
  reader.releaseLock();
317
389
  }
318
- // Stream ended without explicit done event
319
- if (content.length > 0) {
320
- throw new AgentAutoContinueSignal({ reason: "stream_ended" });
321
- }
390
+ // Stream ended without explicit done event. Even an empty content array is
391
+ // abnormal here: a healthy run emits a terminal `done` event. Treat this as
392
+ // recoverable so the adapter can first reconnect to the run, then continue
393
+ // from durable history if the producer is gone.
394
+ throw new AgentAutoContinueSignal({ reason: "stream_ended" });
322
395
  }
323
396
  /**
324
397
  * Read raw SSE events from a ReadableStream and process them into ContentPart[].
@@ -330,6 +403,7 @@ export async function readSSEStreamRaw(body, content, toolCallCounter, tabId, on
330
403
  const reader = body.getReader();
331
404
  const decoder = new TextDecoder();
332
405
  let buf = "";
406
+ let lastMeaningfulEventAt = Date.now();
333
407
  try {
334
408
  while (true) {
335
409
  const { done, value } = await reader.read();
@@ -339,6 +413,7 @@ export async function readSSEStreamRaw(body, content, toolCallCounter, tabId, on
339
413
  const lines = buf.split("\n");
340
414
  buf = lines.pop() ?? "";
341
415
  let updated = false;
416
+ let sawDataEvent = false;
342
417
  for (const line of lines) {
343
418
  if (!line.startsWith("data: "))
344
419
  continue;
@@ -352,6 +427,8 @@ export async function readSSEStreamRaw(body, content, toolCallCounter, tabId, on
352
427
  catch {
353
428
  continue;
354
429
  }
430
+ sawDataEvent = true;
431
+ lastMeaningfulEventAt = Date.now();
355
432
  const { action } = processEvent(ev, content, toolCallCounter, tabId);
356
433
  if (action === "yield" ||
357
434
  action === "done" ||
@@ -373,6 +450,10 @@ export async function readSSEStreamRaw(body, content, toolCallCounter, tabId, on
373
450
  if (updated) {
374
451
  onUpdate([...content]);
375
452
  }
453
+ if (!sawDataEvent &&
454
+ Date.now() - lastMeaningfulEventAt >= SSE_NO_PROGRESS_TIMEOUT_MS) {
455
+ throw new AgentAutoContinueSignal({ reason: "no_progress" });
456
+ }
376
457
  }
377
458
  }
378
459
  finally {