@pixelzx/genesis 2026.6.6-1 → 2026.6.7

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 (1890) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/.buildstamp +1 -1
  3. package/dist/abort-FuQvBD6U.js +201 -0
  4. package/dist/abort-cutoff.runtime-DhhkmUom.js +20 -0
  5. package/dist/abort-cutoff.runtime.js +1 -1
  6. package/dist/abort.runtime-B3IgkoFt.js +2 -0
  7. package/dist/abort.runtime.js +1 -1
  8. package/dist/accounts-BPUJOLhQ.js +66 -0
  9. package/dist/accounts-CAneScu8.js +104 -0
  10. package/dist/accounts-CHR1oSF7.js +43 -0
  11. package/dist/accounts-CJ6NSXHe.js +2 -0
  12. package/dist/accounts-DIkEzenx.js +365 -0
  13. package/dist/accounts-DSBZWK21.js +107 -0
  14. package/dist/accounts.runtime-CbxAqfkd.js +2 -0
  15. package/dist/accounts.runtime.js +1 -1
  16. package/dist/acp-cli-ogRPWqZT.js +2217 -0
  17. package/dist/acp-spawn-8dy4yT3V.js +2 -0
  18. package/dist/acp-spawn-BjYzM6z-.js +1093 -0
  19. package/dist/acp-stateful-target-driver-BycE6-83.js +89 -0
  20. package/dist/action-agents-l7277wqt.js +67 -0
  21. package/dist/action-focus-Dl60p5pD.js +132 -0
  22. package/dist/action-help-DxLv4lVR.js +7 -0
  23. package/dist/action-info-DL9E3-WR.js +101 -0
  24. package/dist/action-kill-D9o9OmhF.js +33 -0
  25. package/dist/action-list-CHZdMgmX.js +21 -0
  26. package/dist/action-log-CU2gXtSM.js +30 -0
  27. package/dist/action-send-Bh6VyKBO.js +39 -0
  28. package/dist/action-spawn-CRh30i-w.js +47 -0
  29. package/dist/action-unfocus-DWfvqVUr.js +29 -0
  30. package/dist/actions.runtime-CSqrY29N.js +18 -0
  31. package/dist/actions.runtime-DfxS3edG.js +5 -0
  32. package/dist/actions.runtime.js +1 -1
  33. package/dist/agent-command-VhOY45sc.js +874 -0
  34. package/dist/agent-delivery-KWJUVuVh.js +76 -0
  35. package/dist/agent-harness-runtime-BMQd9IQM.js +144 -0
  36. package/dist/agent-rstdDGqC.js +2 -0
  37. package/dist/agent-runner-utils-B6emOCxL.js +239 -0
  38. package/dist/agent-runner.runtime-Dt9pfuFv.js +3455 -0
  39. package/dist/agent-runner.runtime.js +1 -1
  40. package/dist/agent-runtime-D5sio5gj.js +18 -0
  41. package/dist/agents-DETbymgH.js +5 -0
  42. package/dist/agents-JnpGV0Mg.js +954 -0
  43. package/dist/agents.command-shared-DP-GYkQM.js +40 -0
  44. package/dist/aliases-CjpePDVQ.js +96 -0
  45. package/dist/aliases-Doxg0x1v.js +2 -0
  46. package/dist/api-3RLMm-sv.js +48 -0
  47. package/dist/api-BFMX7Y4G.js +139 -0
  48. package/dist/api-DNZZlJ9_.js +3 -0
  49. package/dist/api-DT7zQn5K.js +5 -0
  50. package/dist/api-Dg7zYoZ_.js +3 -0
  51. package/dist/api-cghJ3F6o.js +4 -0
  52. package/dist/apply-DfMBIGyY.js +508 -0
  53. package/dist/apply.runtime-C0oOWIW8.js +2 -0
  54. package/dist/apply.runtime.js +1 -1
  55. package/dist/approval-client-helpers-D2LpKFDf.js +82 -0
  56. package/dist/approval-delivery-helpers-CmhRlLZJ.js +134 -0
  57. package/dist/approval-gateway-resolver-BjqCdv8k.js +29 -0
  58. package/dist/approval-gateway-runtime-vc_h56PW.js +2 -0
  59. package/dist/approval-handler-runtime-CLi8o4N6.js +439 -0
  60. package/dist/approval-native-helpers-BJTvZT00.js +33 -0
  61. package/dist/approval-native-runtime-BCglJkGQ.js +729 -0
  62. package/dist/approval-renderers-B2Vy1H8m.js +64 -0
  63. package/dist/attempt-execution.runtime-BJ2ggQLO.js +509 -0
  64. package/dist/attempt-execution.runtime.js +1 -1
  65. package/dist/attempt-execution.shared-drVqEuBX.js +22 -0
  66. package/dist/attempt.prompt-helpers-CPOKGBRq.js +221 -0
  67. package/dist/attempt.tool-run-context-b245l8XM.js +933 -0
  68. package/dist/audit-DTHRJzg2.js +939 -0
  69. package/dist/audit-membership-runtime-BJqpONbJ.js +550 -0
  70. package/dist/audit.runtime-CX2MkQvJ.js +7 -0
  71. package/dist/audit.runtime.js +1 -1
  72. package/dist/auth-4Bm-1bcd.js +177 -0
  73. package/dist/auth-BZdTw_F-.js +56 -0
  74. package/dist/auth-CuwCoyT1.js +550 -0
  75. package/dist/auth-DIgzPDDK.js +2 -0
  76. package/dist/auth-order-BY3KAiKC.js +2 -0
  77. package/dist/auth-order-Dg56giIe.js +139 -0
  78. package/dist/base-url-C558HJO5.js +15 -0
  79. package/dist/bash-tools-CfDemvWu.js +2824 -0
  80. package/dist/bash-tools-Dn5gcYvt.js +3 -0
  81. package/dist/bash-tools.exec-runtime-dke732lC.js +829 -0
  82. package/dist/best-effort-delivery-DljQXVME.js +22 -0
  83. package/dist/binding-routing-DR_67bg0.js +85 -0
  84. package/dist/binding-targets-DTa463kX.js +121 -0
  85. package/dist/block-streaming-CSQXIKzf.js +103 -0
  86. package/dist/bluebubbles-Ct06wUcN.js +77 -0
  87. package/dist/brave-web-search-provider-CXpJbGgI.js +111 -0
  88. package/dist/brave-web-search-provider.runtime-wY0sclse.js +229 -0
  89. package/dist/brave-web-search-provider.runtime.js +1 -1
  90. package/dist/brave-web-search-provider.shared-CRDSDuDf.js +174 -0
  91. package/dist/bridge-auth-registry-BorAQxuW.js +23 -0
  92. package/dist/bridge-server-BjsnFWH5.js +113 -0
  93. package/dist/browser-control-auth-K_ABcymZ.js +2 -0
  94. package/dist/browser-node-runtime-Djr0LEX4.js +12 -0
  95. package/dist/browser-profiles-D-JVGcFQ.js +2 -0
  96. package/dist/browser-runtime-Dtu4pSLX.js +387 -0
  97. package/dist/browser-setup-tools-DOMK1dxP.js +13 -0
  98. package/dist/build-DIqCC9wY.js +550 -0
  99. package/dist/build-info.json +3 -3
  100. package/dist/bundled/boot-md/handler.js +3 -3
  101. package/dist/bundled/session-memory/handler.js +1 -1
  102. package/dist/call-CBwbz0Y_.js +3 -0
  103. package/dist/call-CMzLsAeQ.js +331 -0
  104. package/dist/call-status-D_PRqurB.js +33 -0
  105. package/dist/call.runtime-TShzrwtE.js +2 -0
  106. package/dist/call.runtime.js +1 -1
  107. package/dist/capability-cli-eqSRFvPG.js +1401 -0
  108. package/dist/card-command-DgCNU0bS.js +241 -0
  109. package/dist/catalog-provider-BQCfbyPd.js +40 -0
  110. package/dist/catchup-B0RMVns9.js +300 -0
  111. package/dist/channel-35I4A3FQ.js +1802 -0
  112. package/dist/channel-B68Jn_67.js +491 -0
  113. package/dist/channel-BpHCHrCO.js +350 -0
  114. package/dist/channel-CLV2rd5J.js +1174 -0
  115. package/dist/channel-COt8yEeA.js +226 -0
  116. package/dist/channel-CQOr5HA2.js +595 -0
  117. package/dist/channel-CY88u47q.js +1100 -0
  118. package/dist/channel-Cz5FQxuV.js +1320 -0
  119. package/dist/channel-_FIMA_4n.js +840 -0
  120. package/dist/channel-core-DH_fXGdB.js +5 -0
  121. package/dist/channel-inbound-DsSKYRQk.js +31 -0
  122. package/dist/channel-kbFJLAok.js +453 -0
  123. package/dist/channel-plugin-runtime-1zw5fP7e.js +771 -0
  124. package/dist/channel-resolution-BQCJwoVA.js +39 -0
  125. package/dist/channel-runtime-DKTzKZrY.js +425 -0
  126. package/dist/channel-selection-CfVNh5Ma.js +126 -0
  127. package/dist/channel-selection.runtime-5JjJNFm5.js +2 -0
  128. package/dist/channel-selection.runtime.js +1 -1
  129. package/dist/channel-t7y5VhIk.js +297 -0
  130. package/dist/channel.runtime-BxFS1fqc.js +26 -0
  131. package/dist/channel.runtime-C4vTK1SO.js +576 -0
  132. package/dist/channel.runtime-Cb5xElcA.js +42398 -0
  133. package/dist/channel.runtime-Cg2IHutr.js +89 -0
  134. package/dist/channel.runtime-CuDcjlCH.js +4 -0
  135. package/dist/channel.runtime-DhuYxzU_.js +67 -0
  136. package/dist/channel.runtime-LtoAmHpA.js +2364 -0
  137. package/dist/channel.runtime-fe2tuhl7.js +430 -0
  138. package/dist/channel.runtime.js +1 -1
  139. package/dist/channel.setup-De742gXr.js +10 -0
  140. package/dist/channel2.runtime-D0-Q3OqX.js +109 -0
  141. package/dist/channel2.runtime.js +1 -1
  142. package/dist/channels-Dg381GJl.js +733 -0
  143. package/dist/channels-cli-C4Mv5lRD.js +268 -0
  144. package/dist/chat-DraQ_Vnc.js +2830 -0
  145. package/dist/chrome-NuBBXoKP.js +1430 -0
  146. package/dist/chrome-mcp-Bzn6x9ZE.js +2 -0
  147. package/dist/chrome-mcp-JcJrSyd_.js +600 -0
  148. package/dist/chrome.executables-B2fHBMhv.js +541 -0
  149. package/dist/chunk-nFZYBJd4.js +268 -0
  150. package/dist/clawbot-cli-BZ5Ho8RJ.js +9 -0
  151. package/dist/cli/daemon-cli.js +3 -3
  152. package/dist/cli-B8D7xwgW.js +2 -0
  153. package/dist/cli-BbCsXDcy.js +2 -0
  154. package/dist/cli-Ct2Cgbp8.js +154 -0
  155. package/dist/cli-D1e_2N91.js +3726 -0
  156. package/dist/cli-D8pyHyFi.js +72 -0
  157. package/dist/cli-eRz4BLSt.js +2 -0
  158. package/dist/cli-mD8ZWE4Y.js +219 -0
  159. package/dist/cli-runner-BVFPfETV.js +286 -0
  160. package/dist/cli-runner.runtime-CcxMMyO0.js +3 -0
  161. package/dist/cli-runner.runtime-MmlDBELB.js +4 -0
  162. package/dist/cli-runner.runtime.js +1 -1
  163. package/dist/cli-startup-metadata.json +2 -2
  164. package/dist/cli.runtime-CG9Epd6c.js +1261 -0
  165. package/dist/cli.runtime.js +1 -1
  166. package/dist/client-BtyYQE4I.js +713 -0
  167. package/dist/client-XqW1gKEi.js +138 -0
  168. package/dist/client-info-DeQMz3zN.js +52 -0
  169. package/dist/command-auth-C8YZ7xNT.js +409 -0
  170. package/dist/command-auth-CZjLC0A5.js +76 -0
  171. package/dist/command-config-resolution-C42_gG_b.js +2 -0
  172. package/dist/command-config-resolution-DGrpZjql.js +23 -0
  173. package/dist/command-config-resolution.runtime-D8PGJbcf.js +2 -0
  174. package/dist/command-config-resolution.runtime.js +1 -1
  175. package/dist/command-execution-startup-LCePq-pd.js +324 -0
  176. package/dist/command-gates-C1GpyUaI.js +47 -0
  177. package/dist/command-registry-Brd-fdF6.js +9 -0
  178. package/dist/command-registry-C9XhD-0z.js +4 -0
  179. package/dist/command-registry-core-BBFaOPyw.js +106 -0
  180. package/dist/command-secret-gateway-_i9GgsPE.js +528 -0
  181. package/dist/command-status.runtime-C-azOR6K.js +87 -0
  182. package/dist/command-status.runtime.js +1 -1
  183. package/dist/commands-acp-cpGZ404g.js +77 -0
  184. package/dist/commands-compact.runtime-CXWGv2V6.js +10 -0
  185. package/dist/commands-compact.runtime.js +1 -1
  186. package/dist/commands-context-DZzZWgOe.js +38 -0
  187. package/dist/commands-core.runtime-BqbYtFGd.js +2 -0
  188. package/dist/commands-core.runtime.js +1 -1
  189. package/dist/commands-handlers.runtime-BcIJeLbE.js +4599 -0
  190. package/dist/commands-handlers.runtime.js +1 -1
  191. package/dist/commands-models-BScPCL8E.js +327 -0
  192. package/dist/commands-reset-hooks-5uvV2mDE.js +135 -0
  193. package/dist/commands-status-CIyza-rp.js +16 -0
  194. package/dist/commands-status.runtime-CqMsNHJz.js +3 -0
  195. package/dist/commands-status.runtime.js +1 -1
  196. package/dist/commands-subagents-control.runtime-BVTHxVDG.js +2 -0
  197. package/dist/commands-subagents-control.runtime-DdiL_B5Y.js +3 -0
  198. package/dist/commands-subagents-control.runtime.js +1 -1
  199. package/dist/commands-system-prompt-DCmABzHv.js +158 -0
  200. package/dist/commands-system-prompt-DsWVuYqh.js +2 -0
  201. package/dist/commands.runtime-CBu1iNc5.js +167 -0
  202. package/dist/commands.runtime.js +1 -1
  203. package/dist/compact-OC23uUnx.js +1118 -0
  204. package/dist/compact.runtime-BnEUkxbT.js +12 -0
  205. package/dist/compact.runtime.js +1 -1
  206. package/dist/completion-cli-Dazyh2sJ.js +328 -0
  207. package/dist/config-BQkNdc69.js +252 -0
  208. package/dist/config-api-BKYSOnnY.js +2 -0
  209. package/dist/config-cli-DLlHp2db.js +1078 -0
  210. package/dist/config-compat-BIX-j6Si.js +130 -0
  211. package/dist/config-compat-BwlAvvWb.js +126 -0
  212. package/dist/config-guard-MokLrRXO.js +96 -0
  213. package/dist/config-runtime-EDLCUCSu.js +32 -0
  214. package/dist/configure-Bb8n7ry_.js +1252 -0
  215. package/dist/configure-_pHM_yQw.js +2 -0
  216. package/dist/connect-options-3xkNjdH1.js +699 -0
  217. package/dist/control-auth-BXNajQ4N.js +125 -0
  218. package/dist/control-service-89oBONRk.js +156 -0
  219. package/dist/control-ui/assets/agents-BQsvYsmp.js +1052 -0
  220. package/dist/control-ui/assets/canvas-D92UKk4C.js +269 -0
  221. package/dist/control-ui/assets/channels-B23D1XmP.js +463 -0
  222. package/dist/control-ui/assets/cron-CYzrBBv6.js +933 -0
  223. package/dist/control-ui/assets/debug-C8av-vpc.js +94 -0
  224. package/dist/control-ui/assets/index-ChL66WCS.js +6238 -0
  225. package/dist/control-ui/assets/index-Dq9zdUBj.css +1 -0
  226. package/dist/control-ui/assets/instances-qfDdYtE0.js +57 -0
  227. package/dist/control-ui/assets/mcp-CipBqkHK.js +373 -0
  228. package/dist/control-ui/assets/nodes-WP7e87Mm.js +618 -0
  229. package/dist/control-ui/assets/plugins-BZGJKpWs.js +273 -0
  230. package/dist/control-ui/assets/sessions-7NbJpVyg.js +306 -0
  231. package/dist/control-ui/assets/skills-hW_GTRp3.js +323 -0
  232. package/dist/control-ui/assets/wallet-Bga18qp4.js +285 -0
  233. package/dist/control-ui/index.html +2 -2
  234. package/dist/control-ui-nxEuCu7Y.js +1043 -0
  235. package/dist/conversation-id-BXdEWBuk.js +38 -0
  236. package/dist/conversation-id-HnQrCUJb.js +235 -0
  237. package/dist/conversation-runtime-DOPjHG-D.js +31 -0
  238. package/dist/core-BglliBki.js +275 -0
  239. package/dist/create-DcvM0ElD.js +80 -0
  240. package/dist/cron-cli-DbZllbTi.js +713 -0
  241. package/dist/daemon-cli-BCP6oYnN.js +12 -0
  242. package/dist/dashboard-74d-EIMB.js +81 -0
  243. package/dist/dashboard-C0aOhuxv.js +2 -0
  244. package/dist/ddg-client-DUe6RTVg.js +147 -0
  245. package/dist/ddg-search-provider-Bm0jAm4h.js +54 -0
  246. package/dist/delegate-0l_cL2en.js +64 -0
  247. package/dist/deliver-BbAfYPEn.js +3 -0
  248. package/dist/deliver-DmZnoo4L.js +747 -0
  249. package/dist/deliver-runtime-5H2EYniG.js +2 -0
  250. package/dist/delivery-context-DP5JLMHJ.js +40 -0
  251. package/dist/delivery-outbound.runtime-DQEeDEsu.js +6 -0
  252. package/dist/delivery-outbound.runtime.js +1 -1
  253. package/dist/delivery.runtime-Bi7HZGxD.js +253 -0
  254. package/dist/delivery.runtime.js +1 -1
  255. package/dist/detached-task-runtime-DlQ3fJk5.js +73 -0
  256. package/dist/devices-cli-BLCk402O.js +498 -0
  257. package/dist/diagnostics-Ccv6wIwn.js +154 -0
  258. package/dist/direct-dm-lEcFUgjs.js +64 -0
  259. package/dist/directive-handling.fast-lane-Cp4AUlKY.js +66 -0
  260. package/dist/directive-handling.impl-5h27Bn7L.js +703 -0
  261. package/dist/directive-handling.impl-XC63bDbc.js +2 -0
  262. package/dist/directive-handling.model-selection-D0aMABmk.js +114 -0
  263. package/dist/directive-handling.persist.runtime-DDNAkC4Z.js +215 -0
  264. package/dist/directive-handling.persist.runtime.js +1 -1
  265. package/dist/directive-handling.shared-DyVSHQBC.js +56 -0
  266. package/dist/directory-cli-CDvyD_lg.js +240 -0
  267. package/dist/dispatch-Dd327enz.js +1131 -0
  268. package/dist/dispatch-acp-6k3pJubU.js +981 -0
  269. package/dist/dispatch-acp-manager.runtime-B7qhOTmA.js +3 -0
  270. package/dist/dispatch-acp-manager.runtime.js +1 -1
  271. package/dist/dispatch-acp-media.runtime-Dh6QaiKm.js +4 -0
  272. package/dist/dispatch-acp-media.runtime.js +1 -1
  273. package/dist/dispatch-acp-session.runtime-DIcbAze4.js +2 -0
  274. package/dist/dispatch-acp-session.runtime.js +1 -1
  275. package/dist/dispatch-acp.runtime-25XWZDxg.js +19 -0
  276. package/dist/dispatch-acp.runtime.js +1 -1
  277. package/dist/doctor-config-flow-sE-lNSad.js +420 -0
  278. package/dist/doctor-config-preflight-VYCO67J4.js +63 -0
  279. package/dist/doctor-config-preflight-qSk2JNLg.js +2 -0
  280. package/dist/doctor-contract-BAsLLlR_.js +26 -0
  281. package/dist/doctor-device-pairing-BXDxtsmA.js +307 -0
  282. package/dist/doctor-gateway-daemon-flow-CHRWhGJG.js +250 -0
  283. package/dist/doctor-gateway-health-B04Kph1-.js +63 -0
  284. package/dist/doctor-health-contributions-Di1lbh4V.js +493 -0
  285. package/dist/doctor-health-vZ_aKkfh.js +59 -0
  286. package/dist/doctor-prompter-Cr1NyTHN.js +56 -0
  287. package/dist/doctor-sandbox-CrC9AbfL.js +194 -0
  288. package/dist/doctor-state-migrations-tkILPnwB.js +2 -0
  289. package/dist/doctor-workspace-status-CPUsFX3w.js +75 -0
  290. package/dist/dreaming-CeLuSaLi.js +1582 -0
  291. package/dist/dreaming-narrative-gKfNqC2s.js +596 -0
  292. package/dist/dreaming-shared-BLs-EJbE.js +21 -0
  293. package/dist/embedded-gateway-stub.runtime-8jv6iwO4.js +9 -0
  294. package/dist/embedded-gateway-stub.runtime.js +1 -1
  295. package/dist/embeddings-CSeRG-6f.js +215 -0
  296. package/dist/embeddings-http-9k11WSE6.js +205 -0
  297. package/dist/entry.js +2 -2
  298. package/dist/exa-web-search-provider-DeSQ1lkN.js +80 -0
  299. package/dist/exa-web-search-provider.runtime-BHWIPnmu.js +302 -0
  300. package/dist/exa-web-search-provider.runtime-C84CVfco.js +2 -0
  301. package/dist/exa-web-search-provider.runtime.js +1 -1
  302. package/dist/exec-approval-forwarder.runtime-BMw0YxXn.js +3 -0
  303. package/dist/exec-approval-forwarder.runtime.js +1 -1
  304. package/dist/exec-approval-reply-BTNXbvSi.js +2 -0
  305. package/dist/exec-approval-reply-BVINNdDT.js +296 -0
  306. package/dist/exec-approval-session-target-BclZJwRq.js +176 -0
  307. package/dist/exec-approvals-cli-BvRs9Hvl.js +498 -0
  308. package/dist/exec-defaults-BzfzJhdd.js +2 -0
  309. package/dist/exec-defaults-DJtYK-Wg.js +67 -0
  310. package/dist/execute.runtime-C-v-Cnhl.js +1363 -0
  311. package/dist/execute.runtime.js +1 -1
  312. package/dist/extensionAPI.js +3 -3
  313. package/dist/extensions/active-memory/index.js +3 -3
  314. package/dist/extensions/bluebubbles/api.js +3 -3
  315. package/dist/extensions/bluebubbles/channel-plugin-api.js +1 -1
  316. package/dist/extensions/brave/index.js +1 -1
  317. package/dist/extensions/brave/test-api.js +1 -1
  318. package/dist/extensions/brave/web-search-provider.js +1 -1
  319. package/dist/extensions/browser/browser-bridge.js +1 -1
  320. package/dist/extensions/browser/browser-config.js +4 -4
  321. package/dist/extensions/browser/browser-control-auth.js +2 -2
  322. package/dist/extensions/browser/browser-doctor.js +5 -5
  323. package/dist/extensions/browser/browser-host-inspection.js +1 -1
  324. package/dist/extensions/browser/browser-maintenance.js +2 -2
  325. package/dist/extensions/browser/browser-profiles.js +2 -2
  326. package/dist/extensions/browser/browser-runtime-api.js +14 -14
  327. package/dist/extensions/browser/index.js +1 -1
  328. package/dist/extensions/browser/plugin-registration.js +1 -1
  329. package/dist/extensions/browser/register.runtime.js +3 -3
  330. package/dist/extensions/browser/runtime-api.js +15 -15
  331. package/dist/extensions/browser/setup-api.js +2 -2
  332. package/dist/extensions/browser/test-support.js +1 -1
  333. package/dist/extensions/byteplus/index.js +1 -1
  334. package/dist/extensions/byteplus/video-generation-provider.js +1 -1
  335. package/dist/extensions/chutes/api.js +3 -3
  336. package/dist/extensions/chutes/index.js +4 -4
  337. package/dist/extensions/chutes/models.js +1 -1
  338. package/dist/extensions/chutes/onboard.js +2 -2
  339. package/dist/extensions/chutes/provider-catalog.js +1 -1
  340. package/dist/extensions/cloudflare-ai-gateway/api.js +1 -1
  341. package/dist/extensions/cloudflare-ai-gateway/catalog-provider.js +1 -1
  342. package/dist/extensions/cloudflare-ai-gateway/index.js +2 -2
  343. package/dist/extensions/comfy/image-generation-provider.js +2 -2
  344. package/dist/extensions/comfy/index.js +3 -3
  345. package/dist/extensions/comfy/music-generation-provider.js +1 -1
  346. package/dist/extensions/comfy/video-generation-provider.js +2 -2
  347. package/dist/extensions/comfy/workflow-runtime.js +1 -1
  348. package/dist/extensions/deepgram/index.js +1 -1
  349. package/dist/extensions/deepgram/realtime-transcription-provider.js +1 -1
  350. package/dist/extensions/deepgram/test-api.js +1 -1
  351. package/dist/extensions/device-pair/api.js +2 -2
  352. package/dist/extensions/device-pair/index.js +5 -5
  353. package/dist/extensions/device-pair/notify.js +1 -1
  354. package/dist/extensions/device-pair/pair-command-approve.js +1 -1
  355. package/dist/extensions/device-pair/qr-image.js +2 -2
  356. package/dist/extensions/duckduckgo/index.js +1 -1
  357. package/dist/extensions/duckduckgo/web-search-provider.js +1 -1
  358. package/dist/extensions/elevenlabs/config-compat.js +1 -1
  359. package/dist/extensions/elevenlabs/contract-api.js +2 -2
  360. package/dist/extensions/elevenlabs/doctor-contract.js +2 -2
  361. package/dist/extensions/elevenlabs/index.js +2 -2
  362. package/dist/extensions/elevenlabs/realtime-transcription-provider.js +1 -1
  363. package/dist/extensions/elevenlabs/setup-api.js +1 -1
  364. package/dist/extensions/elevenlabs/speech-provider.js +1 -1
  365. package/dist/extensions/elevenlabs/test-api.js +2 -2
  366. package/dist/extensions/exa/index.js +1 -1
  367. package/dist/extensions/exa/test-api.js +1 -1
  368. package/dist/extensions/exa/web-search-provider.js +1 -1
  369. package/dist/extensions/fal/image-generation-provider.js +1 -1
  370. package/dist/extensions/fal/index.js +2 -2
  371. package/dist/extensions/fal/test-api.js +2 -2
  372. package/dist/extensions/fal/video-generation-provider.js +1 -1
  373. package/dist/extensions/firecrawl/api.js +1 -1
  374. package/dist/extensions/github-copilot/api.js +1 -1
  375. package/dist/extensions/github-copilot/auth.js +1 -1
  376. package/dist/extensions/github-copilot/embeddings.js +1 -1
  377. package/dist/extensions/github-copilot/index.js +6 -6
  378. package/dist/extensions/github-copilot/login.js +1 -1
  379. package/dist/extensions/github-copilot/models-defaults.js +1 -1
  380. package/dist/extensions/github-copilot/models.js +1 -1
  381. package/dist/extensions/github-copilot/register.runtime.js +1 -1
  382. package/dist/extensions/github-copilot/replay-policy.js +1 -1
  383. package/dist/extensions/google-meet/index.js +5 -5
  384. package/dist/extensions/huggingface/api.js +3 -3
  385. package/dist/extensions/huggingface/index.js +2 -2
  386. package/dist/extensions/huggingface/models.js +1 -1
  387. package/dist/extensions/huggingface/onboard.js +1 -1
  388. package/dist/extensions/huggingface/provider-catalog.js +2 -2
  389. package/dist/extensions/imessage/api.js +5 -5
  390. package/dist/extensions/imessage/channel-plugin-api.js +1 -1
  391. package/dist/extensions/imessage/contract-api.js +2 -2
  392. package/dist/extensions/imessage/media-contract-api.js +2 -2
  393. package/dist/extensions/imessage/runtime-api.js +5 -5
  394. package/dist/extensions/imessage/test-api.js +2 -2
  395. package/dist/extensions/irc/api.js +2 -2
  396. package/dist/extensions/irc/channel-plugin-api.js +1 -1
  397. package/dist/extensions/kilocode/api.js +2 -2
  398. package/dist/extensions/kilocode/index.js +3 -3
  399. package/dist/extensions/kilocode/onboard.js +2 -2
  400. package/dist/extensions/kilocode/provider-catalog.js +1 -1
  401. package/dist/extensions/kilocode/provider-models.js +1 -1
  402. package/dist/extensions/kilocode/shared.js +1 -1
  403. package/dist/extensions/kimi-coding/index.js +2 -2
  404. package/dist/extensions/kimi-coding/stream.js +1 -1
  405. package/dist/extensions/line/api.js +2 -2
  406. package/dist/extensions/line/channel-plugin-api.js +1 -1
  407. package/dist/extensions/line/contract-api.js +1 -1
  408. package/dist/extensions/line/index.js +1 -1
  409. package/dist/extensions/line/runtime-api.js +7 -7
  410. package/dist/extensions/line/setup-api.js +1 -1
  411. package/dist/extensions/llm-task/index.js +1 -1
  412. package/dist/extensions/lmstudio/api.js +1 -1
  413. package/dist/extensions/lmstudio/index.js +2 -2
  414. package/dist/extensions/lmstudio/memory-embedding-adapter.js +1 -1
  415. package/dist/extensions/lmstudio/runtime-api.js +1 -1
  416. package/dist/extensions/lobster/runtime-api.js +1 -1
  417. package/dist/extensions/mattermost/api.js +1 -1
  418. package/dist/extensions/mattermost/channel-plugin-api.js +1 -1
  419. package/dist/extensions/mattermost/channel-plugin-runtime.js +1 -1
  420. package/dist/extensions/mattermost/policy-api.js +1 -1
  421. package/dist/extensions/mattermost/runtime-api.js +9 -9
  422. package/dist/extensions/mattermost/slash-route-api.js +1 -1
  423. package/dist/extensions/memory-core/api.js +1 -1
  424. package/dist/extensions/memory-core/cli-metadata.js +2 -2
  425. package/dist/extensions/memory-core/index.js +9 -9
  426. package/dist/extensions/memory-core/manager-runtime.js +1 -1
  427. package/dist/extensions/memory-core/runtime-api.js +4 -4
  428. package/dist/extensions/memory-lancedb/cli-metadata.js +1 -1
  429. package/dist/extensions/memory-lancedb/index.js +2 -2
  430. package/dist/extensions/memory-wiki/cli-metadata.js +1 -1
  431. package/dist/extensions/memory-wiki/index.js +1 -1
  432. package/dist/extensions/microsoft/index.js +1 -1
  433. package/dist/extensions/microsoft/speech-provider.js +1 -1
  434. package/dist/extensions/microsoft/test-api.js +1 -1
  435. package/dist/extensions/microsoft/tts.js +1 -1
  436. package/dist/extensions/microsoft-foundry/auth.js +1 -1
  437. package/dist/extensions/microsoft-foundry/cli.js +1 -1
  438. package/dist/extensions/microsoft-foundry/index.js +1 -1
  439. package/dist/extensions/microsoft-foundry/onboard.js +2 -2
  440. package/dist/extensions/microsoft-foundry/provider.js +1 -1
  441. package/dist/extensions/microsoft-foundry/runtime.js +1 -1
  442. package/dist/extensions/microsoft-foundry/shared-runtime.js +2 -2
  443. package/dist/extensions/microsoft-foundry/shared.js +1 -1
  444. package/dist/extensions/minimax/index.js +5 -5
  445. package/dist/extensions/minimax/music-generation-provider.js +1 -1
  446. package/dist/extensions/minimax/provider-registration.js +1 -1
  447. package/dist/extensions/minimax/speech-provider.js +1 -1
  448. package/dist/extensions/minimax/test-api.js +3 -3
  449. package/dist/extensions/minimax/video-generation-provider.js +1 -1
  450. package/dist/extensions/minimax/web-search-provider.js +1 -1
  451. package/dist/extensions/mistral/index.js +2 -2
  452. package/dist/extensions/mistral/provider-compat.js +1 -1
  453. package/dist/extensions/mistral/realtime-transcription-provider.js +1 -1
  454. package/dist/extensions/mistral/test-api.js +1 -1
  455. package/dist/extensions/moonshot/index.js +1 -1
  456. package/dist/extensions/moonshot/test-api.js +1 -1
  457. package/dist/extensions/moonshot/web-search-provider.js +1 -1
  458. package/dist/extensions/msteams/api.js +1 -1
  459. package/dist/extensions/msteams/channel-plugin-api.js +1 -1
  460. package/dist/extensions/msteams/runtime-api.js +4 -4
  461. package/dist/extensions/msteams/test-api.js +1 -1
  462. package/dist/extensions/nextcloud-talk/api.js +1 -1
  463. package/dist/extensions/nextcloud-talk/channel-plugin-api.js +1 -1
  464. package/dist/extensions/nextcloud-talk/runtime-api.js +2 -2
  465. package/dist/extensions/ollama/api.js +3 -3
  466. package/dist/extensions/ollama/index.js +5 -5
  467. package/dist/extensions/ollama/runtime-api.js +1 -1
  468. package/dist/extensions/ollama/web-search-provider.js +1 -1
  469. package/dist/extensions/openai/api.js +4 -4
  470. package/dist/extensions/openai/base-url.js +1 -1
  471. package/dist/extensions/openai/image-generation-provider.js +1 -1
  472. package/dist/extensions/openai/index.js +8 -8
  473. package/dist/extensions/openai/native-web-search.js +1 -1
  474. package/dist/extensions/openai/openai-codex-auth-identity.js +1 -1
  475. package/dist/extensions/openai/openai-codex-device-code.js +1 -1
  476. package/dist/extensions/openai/openai-codex-provider.js +1 -1
  477. package/dist/extensions/openai/openai-codex-shared.js +1 -1
  478. package/dist/extensions/openai/openai-provider.js +1 -1
  479. package/dist/extensions/openai/realtime-provider-shared.js +1 -1
  480. package/dist/extensions/openai/realtime-transcription-provider.js +1 -1
  481. package/dist/extensions/openai/realtime-voice-provider.js +1 -1
  482. package/dist/extensions/openai/register.runtime.js +6 -6
  483. package/dist/extensions/openai/shared.js +1 -1
  484. package/dist/extensions/openai/speech-provider.js +1 -1
  485. package/dist/extensions/openai/test-api.js +5 -5
  486. package/dist/extensions/openai/transport-policy.js +1 -1
  487. package/dist/extensions/openai/video-generation-provider.js +1 -1
  488. package/dist/extensions/opencode/index.js +1 -1
  489. package/dist/extensions/openrouter/api.js +2 -2
  490. package/dist/extensions/openrouter/image-generation-provider.js +1 -1
  491. package/dist/extensions/openrouter/index.js +2 -2
  492. package/dist/extensions/openrouter/register.runtime.js +1 -1
  493. package/dist/extensions/openrouter/speech-provider.js +1 -1
  494. package/dist/extensions/openrouter/test-api.js +2 -2
  495. package/dist/extensions/openshell/index.js +4 -4
  496. package/dist/extensions/perplexity/index.js +1 -1
  497. package/dist/extensions/perplexity/test-api.js +1 -1
  498. package/dist/extensions/perplexity/web-search-provider.js +1 -1
  499. package/dist/extensions/phone-control/index.js +1 -1
  500. package/dist/extensions/runway/index.js +1 -1
  501. package/dist/extensions/runway/video-generation-provider.js +1 -1
  502. package/dist/extensions/signal/api.js +11 -11
  503. package/dist/extensions/signal/channel-plugin-api.js +1 -1
  504. package/dist/extensions/signal/contract-api.js +2 -2
  505. package/dist/extensions/signal/reaction-runtime-api.js +1 -1
  506. package/dist/extensions/signal/runtime-api.js +14 -14
  507. package/dist/extensions/skill-workshop/api.js +1 -1
  508. package/dist/extensions/skill-workshop/index.js +2 -2
  509. package/dist/extensions/speech-core/runtime-api.js +2 -2
  510. package/dist/extensions/stepfun/index.js +1 -1
  511. package/dist/extensions/synology-chat/api.js +1 -1
  512. package/dist/extensions/synology-chat/channel-plugin-api.js +1 -1
  513. package/dist/extensions/talk-voice/index.js +2 -2
  514. package/dist/extensions/tavily/index.js +2 -2
  515. package/dist/extensions/tavily/web-search-provider.js +1 -1
  516. package/dist/extensions/thread-ownership/index.js +2 -2
  517. package/dist/extensions/tlon/api.js +2 -2
  518. package/dist/extensions/tlon/channel-plugin-api.js +1 -1
  519. package/dist/extensions/tlon/runtime-api.js +1 -1
  520. package/dist/extensions/tlon/setup-api.js +2 -2
  521. package/dist/extensions/tlon/test-api.js +1 -1
  522. package/dist/extensions/together/index.js +1 -1
  523. package/dist/extensions/together/video-generation-provider.js +1 -1
  524. package/dist/extensions/twitch/api.js +1 -1
  525. package/dist/extensions/twitch/channel-plugin-api.js +1 -1
  526. package/dist/extensions/twitch/setup-plugin-api.js +1 -1
  527. package/dist/extensions/venice/api.js +3 -3
  528. package/dist/extensions/venice/index.js +4 -4
  529. package/dist/extensions/venice/models.js +1 -1
  530. package/dist/extensions/venice/onboard.js +2 -2
  531. package/dist/extensions/venice/provider-catalog.js +1 -1
  532. package/dist/extensions/voice-call/index.js +3 -3
  533. package/dist/extensions/voice-call/runtime-entry.js +1 -1
  534. package/dist/extensions/voice-call/setup-api.js +2 -2
  535. package/dist/extensions/vydra/image-generation-provider.js +1 -1
  536. package/dist/extensions/vydra/index.js +3 -3
  537. package/dist/extensions/vydra/shared.js +1 -1
  538. package/dist/extensions/vydra/speech-provider.js +1 -1
  539. package/dist/extensions/vydra/video-generation-provider.js +1 -1
  540. package/dist/extensions/xai/api.js +6 -6
  541. package/dist/extensions/xai/code-execution.js +2 -2
  542. package/dist/extensions/xai/image-generation-provider.js +1 -1
  543. package/dist/extensions/xai/index.js +11 -11
  544. package/dist/extensions/xai/model-definitions.js +1 -1
  545. package/dist/extensions/xai/onboard.js +1 -1
  546. package/dist/extensions/xai/provider-catalog.js +1 -1
  547. package/dist/extensions/xai/provider-models.js +1 -1
  548. package/dist/extensions/xai/realtime-transcription-provider.js +1 -1
  549. package/dist/extensions/xai/setup-api.js +1 -1
  550. package/dist/extensions/xai/speech-provider.js +1 -1
  551. package/dist/extensions/xai/stt.js +1 -1
  552. package/dist/extensions/xai/test-api.js +1 -1
  553. package/dist/extensions/xai/tts.js +2 -2
  554. package/dist/extensions/xai/video-generation-provider.js +1 -1
  555. package/dist/extensions/xai/web-search.js +1 -1
  556. package/dist/extensions/xai/x-search.js +3 -3
  557. package/dist/extensions/zai/api.js +1 -1
  558. package/dist/extensions/zai/index.js +2 -2
  559. package/dist/extensions/zai/onboard.js +1 -1
  560. package/dist/extensions/zalo/api.js +3 -3
  561. package/dist/extensions/zalo/channel-plugin-api.js +1 -1
  562. package/dist/extensions/zalo/runtime-api.js +2 -2
  563. package/dist/extensions/zalo/setup-api.js +2 -2
  564. package/dist/extensions/zalouser/api.js +4 -4
  565. package/dist/extensions/zalouser/channel-plugin-api.js +1 -1
  566. package/dist/extensions/zalouser/runtime-api.js +9 -9
  567. package/dist/extensions/zalouser/setup-plugin-api.js +1 -1
  568. package/dist/extensions/zalouser/test-api.js +4 -4
  569. package/dist/fallbacks-B-hX8uqx.js +2 -0
  570. package/dist/fallbacks-C5ybxGTK.js +31 -0
  571. package/dist/fallbacks-shared-CH3k_pWW.js +111 -0
  572. package/dist/format-DUJSy56G.js +176 -0
  573. package/dist/gateway-BIOe8buh.js +115 -0
  574. package/dist/gateway-cli-DwcS5o3b.js +1283 -0
  575. package/dist/gateway-rpc-DE9eTnTH.js +14 -0
  576. package/dist/gateway-rpc.runtime-BYzSLXq5.js +23 -0
  577. package/dist/gateway-rpc.runtime.js +1 -1
  578. package/dist/gateway-runtime-DNBHtXEc.js +15 -0
  579. package/dist/gateway-status-DQ3SCRP6.js +584 -0
  580. package/dist/genesis-tools-B4E1Wx5r.js +9166 -0
  581. package/dist/genesis-tools.runtime-CvLAzIWm.js +2 -0
  582. package/dist/genesis-tools.runtime.js +1 -1
  583. package/dist/get-reply-D9iaq0Co.js +3897 -0
  584. package/dist/get-reply-from-config.runtime-BFrLyjaS.js +2 -0
  585. package/dist/get-reply-from-config.runtime.js +1 -1
  586. package/dist/graph-users-K6q63hQH.js +1337 -0
  587. package/dist/guarded-json-api-BSwHtzk5.js +594 -0
  588. package/dist/health-BLmYYjhC.js +3 -0
  589. package/dist/health-jQBhWAEn.js +469 -0
  590. package/dist/health-route-ByzzS8xk.js +2 -0
  591. package/dist/health-route-CE-2wbny.js +41 -0
  592. package/dist/heartbeat-runner-D4-13meQ.js +5 -0
  593. package/dist/heartbeat-runner-DIprw7jS.js +1292 -0
  594. package/dist/heartbeat-runner.runtime-B_nY5Qgm.js +4 -0
  595. package/dist/heartbeat-runner.runtime.js +1 -1
  596. package/dist/helpers-DEG_RuMc.js +320 -0
  597. package/dist/hooks-cli-DQay0wq5.js +433 -0
  598. package/dist/http-endpoint-helpers-Cj3QINzs.js +41 -0
  599. package/dist/http-headers-CxAw5CS4.js +11 -0
  600. package/dist/http-utils-BdoY-Nqt.js +924 -0
  601. package/dist/identity-DImc-ABG.js +140 -0
  602. package/dist/image-fallbacks-BPxIecDg.js +31 -0
  603. package/dist/image-fallbacks-C9f2oqy9.js +2 -0
  604. package/dist/image-generation-provider-D1MVlkMK.js +529 -0
  605. package/dist/image-generation-provider-D1xp4B37.js +228 -0
  606. package/dist/image-generation-provider-D78SYbpg.js +274 -0
  607. package/dist/image-generation-provider-KrI_cq7u.js +95 -0
  608. package/dist/image-generation-provider-eiDfurMp.js +157 -0
  609. package/dist/image-generation-provider-iM6hlpJY.js +63 -0
  610. package/dist/inbound-reply-dispatch-Cj041nYj.js +73 -0
  611. package/dist/inbound.runtime-BFDKTetv.js +3 -0
  612. package/dist/inbound.runtime-C9MPsVfj.js +4 -0
  613. package/dist/inbound.runtime.js +1 -1
  614. package/dist/index.js +2 -2
  615. package/dist/infra-runtime-D9uudHda.js +39 -0
  616. package/dist/init-BIbgrtP4.js +59 -0
  617. package/dist/install-signal-cli-DX67z7U-.js +202 -0
  618. package/dist/jobs-DWEXUnGc.js +734 -0
  619. package/dist/kimi-web-search-provider-B199pS24.js +80 -0
  620. package/dist/kimi-web-search-provider.runtime-DHuvlTlx.js +261 -0
  621. package/dist/kimi-web-search-provider.runtime-DPkmvLDS.js +2 -0
  622. package/dist/kimi-web-search-provider.runtime.js +1 -1
  623. package/dist/library-B5XEbilF.js +45 -0
  624. package/dist/lifecycle-Cf5XvG8O.js +229 -0
  625. package/dist/lifecycle-CnQRwenx.js +571 -0
  626. package/dist/lifecycle.runtime-CMl4KKk8.js +2 -0
  627. package/dist/lifecycle.runtime.js +1 -1
  628. package/dist/list-AHy8re_f.js +1212 -0
  629. package/dist/list-BTKCVZuV.js +2 -0
  630. package/dist/list-DGTx2Wqw.js +131 -0
  631. package/dist/list-YvfcGz15.js +2 -0
  632. package/dist/list.probe-DG5_xRHp.js +419 -0
  633. package/dist/live-model-switch-CuTctEKz.js +336 -0
  634. package/dist/llm-slug-generator-BruS9kif.js +79 -0
  635. package/dist/llm-slug-generator.js +1 -1
  636. package/dist/load-config-CM6Gosov.js +35 -0
  637. package/dist/local-dispatch.runtime-ZYo4KwzE.js +8 -0
  638. package/dist/local-dispatch.runtime.js +1 -1
  639. package/dist/login-3MD7cKlo.js +108 -0
  640. package/dist/logs-cli-OVNQM7ua.js +265 -0
  641. package/dist/logs-cli.runtime-BxiLcJ_M.js +2 -0
  642. package/dist/logs-cli.runtime.js +1 -1
  643. package/dist/main-session-restart-recovery-DPOV5jrb.js +206 -0
  644. package/dist/managed-image-attachments-6nAXGlI1.js +635 -0
  645. package/dist/managed-image-attachments-DilVoOYk.js +2 -0
  646. package/dist/manager-BtvzSKtj.js +2057 -0
  647. package/dist/manager-DyNLzWfD.js +2 -0
  648. package/dist/manager-Q2pBimx1.js +3114 -0
  649. package/dist/markdown-to-line-BXIakLn2.js +790 -0
  650. package/dist/mcp/plugin-tools-serve.js +1 -1
  651. package/dist/mcp-cli-lQKoKrr8.js +725 -0
  652. package/dist/mcp-http-Bkk3yw83.js +529 -0
  653. package/dist/media-contract-Bc8hq_Hg.js +49 -0
  654. package/dist/media-contract-api-U4NbSFNP.js +2 -0
  655. package/dist/media-runtime-BNkgBOI3.js +329 -0
  656. package/dist/memory-DwnILZlh.js +342 -0
  657. package/dist/memory-core-host-runtime-cli-C8dM34aV.js +9 -0
  658. package/dist/memory-embedding-adapter-B2PHR9-b.js +123 -0
  659. package/dist/message-action-runner-BKUGlEq0.js +2 -0
  660. package/dist/message-action-runner-CXfdJWof.js +1407 -0
  661. package/dist/message-actions-BPS9joyx.js +143 -0
  662. package/dist/message-channel-DGBKBihv.js +56 -0
  663. package/dist/message-gek1bdc3.js +232 -0
  664. package/dist/message-secret-scope-BmZJslJs.js +103 -0
  665. package/dist/message.gateway.runtime-B35cFF_N.js +2 -0
  666. package/dist/message.gateway.runtime.js +1 -1
  667. package/dist/method-scopes-BJj0ofY0.js +233 -0
  668. package/dist/minimax-web-search-provider-C79WAduN.js +53 -0
  669. package/dist/minimax-web-search-provider.runtime-D94jFB6v.js +2 -0
  670. package/dist/minimax-web-search-provider.runtime-ttvn1re5.js +140 -0
  671. package/dist/minimax-web-search-provider.runtime.js +1 -1
  672. package/dist/mock-C9dpEyJ8.js +136 -0
  673. package/dist/model-definitions-taVnM0qU.js +260 -0
  674. package/dist/model-overrides-Hnlrxnm3.js +104 -0
  675. package/dist/model-selection-C0kCM--d.js +213 -0
  676. package/dist/models-C6lJZiG_.js +569 -0
  677. package/dist/models-CQmyBH-d.js +760 -0
  678. package/dist/models-CzCQpmVW.js +157 -0
  679. package/dist/models-DJQoC4Xz.js +47 -0
  680. package/dist/models-auth-status-CUuto1-z.js +217 -0
  681. package/dist/models-cli-DFYsfHFi.js +271 -0
  682. package/dist/models-http-KluTqvju.js +92 -0
  683. package/dist/models.fetch-CUcQFhk9.js +518 -0
  684. package/dist/monitor-Amuhcll1.js +1237 -0
  685. package/dist/monitor-BHYjSOgh.js +671 -0
  686. package/dist/monitor-BNMwiGBd.js +1459 -0
  687. package/dist/monitor-C8QQd5Eg.js +295 -0
  688. package/dist/monitor-DHQTgUJC.js +1661 -0
  689. package/dist/monitor-DrTPiOoO.js +2 -0
  690. package/dist/monitor-Dupjc8yV.js +788 -0
  691. package/dist/monitor-auth-BGCRXS08.js +207 -0
  692. package/dist/monitor-processing-dLJEKLkr.js +1974 -0
  693. package/dist/monitor.runtime-CFCau0j2.js +2 -0
  694. package/dist/monitor.runtime.js +1 -1
  695. package/dist/monitor.webhook-rWET0HrG.js +180 -0
  696. package/dist/msteams-96MqCc3R.js +35 -0
  697. package/dist/music-generation-provider-Bilj-8Yj.js +63 -0
  698. package/dist/music-generation-provider-CHWj4bCX.js +170 -0
  699. package/dist/native-hook-relay-BFWKVZgm.js +519 -0
  700. package/dist/native-web-search-BVgO5cS-.js +64 -0
  701. package/dist/nextcloud-talk-D-FHP_4q.js +17 -0
  702. package/dist/node-cli-COaDl9Gb.js +2276 -0
  703. package/dist/nodes-cli-CdiC2uij.js +1046 -0
  704. package/dist/nodes-utils-Bz4wEuS8.js +84 -0
  705. package/dist/nodes.helpers-B4Yy3f8X.js +34 -0
  706. package/dist/notify-DnBLOswJ.js +315 -0
  707. package/dist/onboard-3Bl_PtFG.js +25 -0
  708. package/dist/onboard-CKxpPa1J.js +25 -0
  709. package/dist/onboard-CnHnAYQA.js +2 -0
  710. package/dist/onboard-DgcU4LaA.js +58 -0
  711. package/dist/onboard-Dgq86QR9.js +29 -0
  712. package/dist/onboard-NAMvzIMs2.js +49 -0
  713. package/dist/onboard-a4m7JstV.js +316 -0
  714. package/dist/onboard-fjFU-IEN.js +70 -0
  715. package/dist/onboard-helpers-CFVEw4kg.js +204 -0
  716. package/dist/onboard-helpers-R0vTUoOE.js +6 -0
  717. package/dist/onboard-interactive-D4Hr2vB6.js +24 -0
  718. package/dist/onboard-non-interactive-DjfjLqF7.js +635 -0
  719. package/dist/onboard-ppjrxdQn.js +25 -0
  720. package/dist/onboard-remote-0UXttO3s.js +2 -0
  721. package/dist/onboard-remote-BmUiJKba.js +193 -0
  722. package/dist/onboard-skills-855xT260.js +2 -0
  723. package/dist/onboard-skills-CF2ndciI.js +134 -0
  724. package/dist/openai-codex-auth-identity-Dxbuu2cd.js +45 -0
  725. package/dist/openai-codex-device-code-CEOVyUYq.js +164 -0
  726. package/dist/openai-codex-provider-B0mTbWAC.js +472 -0
  727. package/dist/openai-codex-shared-DO75K1fy.js +6 -0
  728. package/dist/openai-http-BU5AQc8x.js +500 -0
  729. package/dist/openai-provider-DUFOP6VM.js +313 -0
  730. package/dist/openresponses-http-D1GGTOop.js +1128 -0
  731. package/dist/operator-approvals-client-gp0A73Qi.js +68 -0
  732. package/dist/outbound-media-CYrmm6RY.js +57 -0
  733. package/dist/outbound-runtime-DM3TzNhA.js +5 -0
  734. package/dist/outbound.runtime-DHLRWzbo.js +2 -0
  735. package/dist/outbound.runtime.js +1 -1
  736. package/dist/pair-command-approve-LJICPdqB.js +44 -0
  737. package/dist/perplexity-web-search-provider-ONjsnI0T.js +92 -0
  738. package/dist/perplexity-web-search-provider.runtime-C9SpRyYz.js +324 -0
  739. package/dist/perplexity-web-search-provider.runtime-pVuMPAol.js +2 -0
  740. package/dist/perplexity-web-search-provider.runtime.js +1 -1
  741. package/dist/persistent-bindings.lifecycle-CEOa_phk.js +85 -0
  742. package/dist/persistent-bindings.lifecycle-DACYiSaR.js +2 -0
  743. package/dist/pi-embedded-BlOiwW3D.js +4 -0
  744. package/dist/pi-embedded-mC-TYW4O.js +2905 -0
  745. package/dist/pi-embedded-subscribe.handlers.compaction.runtime-CzPjo_JC.js +23 -0
  746. package/dist/pi-embedded-subscribe.handlers.compaction.runtime.js +1 -1
  747. package/dist/pi-embedded.runtime-DjmvqZCN.js +4 -0
  748. package/dist/pi-embedded.runtime.js +1 -1
  749. package/dist/pi-tool-definition-adapter-CwT_smG_.js +229 -0
  750. package/dist/pi-tools-10IsGyci.js +1057 -0
  751. package/dist/pi-tools.before-tool-call-CX2Ew8CP.js +433 -0
  752. package/dist/pi-tools.before-tool-call-V6qF1pL1.js +2 -0
  753. package/dist/plivo-CAlO-SXr.js +394 -0
  754. package/dist/plugin-DUiUdK8L.js +12195 -0
  755. package/dist/plugin-enabled-Md173mY1.js +140 -0
  756. package/dist/plugin-registration-BUZ1GI8e.js +23 -0
  757. package/dist/plugin-sdk/.boundary-entry-shims.stamp +1 -1
  758. package/dist/plugin-sdk/acp-binding-runtime.js +1 -1
  759. package/dist/plugin-sdk/acp-runtime.js +3 -3
  760. package/dist/plugin-sdk/agent-harness-runtime.js +6 -6
  761. package/dist/plugin-sdk/agent-harness.js +7 -7
  762. package/dist/plugin-sdk/agent-runtime.js +2 -2
  763. package/dist/plugin-sdk/approval-client-runtime.js +2 -2
  764. package/dist/plugin-sdk/approval-delivery-runtime.js +1 -1
  765. package/dist/plugin-sdk/approval-gateway-runtime.js +2 -2
  766. package/dist/plugin-sdk/approval-handler-runtime.js +3 -3
  767. package/dist/plugin-sdk/approval-native-runtime.js +2 -2
  768. package/dist/plugin-sdk/approval-reply-runtime.js +2 -2
  769. package/dist/plugin-sdk/approval-runtime.js +7 -7
  770. package/dist/plugin-sdk/bluebubbles.js +2 -2
  771. package/dist/plugin-sdk/browser-node-runtime.js +4 -4
  772. package/dist/plugin-sdk/browser-setup-tools.js +3 -3
  773. package/dist/plugin-sdk/browser-support.js +7 -7
  774. package/dist/plugin-sdk/channel-core.js +2 -2
  775. package/dist/plugin-sdk/channel-inbound.js +3 -3
  776. package/dist/plugin-sdk/command-auth-native.js +1 -1
  777. package/dist/plugin-sdk/command-auth.js +4 -4
  778. package/dist/plugin-sdk/command-status-runtime.js +1 -1
  779. package/dist/plugin-sdk/compat.js +2 -2
  780. package/dist/plugin-sdk/config-runtime.js +5 -5
  781. package/dist/plugin-sdk/conversation-binding-runtime.js +1 -1
  782. package/dist/plugin-sdk/conversation-runtime.js +4 -4
  783. package/dist/plugin-sdk/core.js +2 -2
  784. package/dist/plugin-sdk/direct-dm.js +1 -1
  785. package/dist/plugin-sdk/gateway-runtime.js +3 -3
  786. package/dist/plugin-sdk/inbound-reply-dispatch.js +1 -1
  787. package/dist/plugin-sdk/index.js +1 -1
  788. package/dist/plugin-sdk/infra-runtime.js +4 -4
  789. package/dist/plugin-sdk/irc.js +2 -2
  790. package/dist/plugin-sdk/markdown-table-runtime.js +1 -1
  791. package/dist/plugin-sdk/matrix.js +1 -1
  792. package/dist/plugin-sdk/mattermost.js +3 -3
  793. package/dist/plugin-sdk/media-runtime.js +1 -1
  794. package/dist/plugin-sdk/memory-core-host-runtime-cli.js +2 -2
  795. package/dist/plugin-sdk/memory-core.js +2 -2
  796. package/dist/plugin-sdk/models-provider-runtime.js +1 -1
  797. package/dist/plugin-sdk/msteams.js +3 -3
  798. package/dist/plugin-sdk/nextcloud-talk.js +2 -2
  799. package/dist/plugin-sdk/nostr.js +1 -1
  800. package/dist/plugin-sdk/outbound-runtime.js +2 -2
  801. package/dist/plugin-sdk/reply-chunking.js +2 -2
  802. package/dist/plugin-sdk/reply-dispatch-runtime.js +2 -2
  803. package/dist/plugin-sdk/reply-runtime.js +5 -5
  804. package/dist/plugin-sdk/routing.js +2 -2
  805. package/dist/plugin-sdk/runtime-secret-resolution.js +1 -1
  806. package/dist/plugin-sdk/runtime.js +2 -2
  807. package/dist/plugin-sdk/sandbox.js +1 -1
  808. package/dist/plugin-sdk/session-store-runtime.js +1 -1
  809. package/dist/plugin-sdk/session-visibility.js +1 -1
  810. package/dist/plugin-sdk/skill-commands-runtime.js +1 -1
  811. package/dist/plugin-sdk/src/gateway/protocol/client-info.d.ts +8 -0
  812. package/dist/plugin-sdk/src/gateway/protocol/schema/logs-chat.d.ts +2 -0
  813. package/dist/plugin-sdk/src/gateway/protocol/schema/protocol-schemas.d.ts +2 -0
  814. package/dist/plugin-sdk/src/gateway/server-broadcast-types.d.ts +11 -0
  815. package/dist/plugin-sdk/testing.js +4 -4
  816. package/dist/plugin-sdk/text-runtime.js +2 -2
  817. package/dist/plugin-sdk/tlon.js +1 -1
  818. package/dist/plugin-sdk/zalo.js +1 -1
  819. package/dist/plugin-sdk/zalouser.js +1 -1
  820. package/dist/plugin-service-ClKtlbqz.js +2893 -0
  821. package/dist/plugins/runtime/index.js +1 -1
  822. package/dist/policy-BxXVdy5R.js +328 -0
  823. package/dist/postinstall-inventory.json +732 -732
  824. package/dist/prepare.runtime-CgeJiFh8.js +815 -0
  825. package/dist/prepare.runtime.js +1 -1
  826. package/dist/probe--ur8kCb3.js +241 -0
  827. package/dist/probe-Afcq8e2r.js +2 -0
  828. package/dist/probe-Bh8UIug9.js +32 -0
  829. package/dist/probe-CY6MUE10.js +1443 -0
  830. package/dist/probe-Cfbju7hl.js +243 -0
  831. package/dist/probe-DHojHKeB.js +2 -0
  832. package/dist/probe-DZZtfovp.js +2205 -0
  833. package/dist/probe-KiWC2F6a.js +45 -0
  834. package/dist/probe-QqjmFXeC.js +74 -0
  835. package/dist/probe.runtime-BYxgJ6xl.js +2 -0
  836. package/dist/probe.runtime.js +1 -1
  837. package/dist/program-BjA_aj2i.js +111 -0
  838. package/dist/prompt-select-styled-D_Li5ANb.js +20 -0
  839. package/dist/protocol-D2Tvt0kQ.js +2479 -0
  840. package/dist/provider-MaVAUyxk.js +70 -0
  841. package/dist/provider-catalog-BATfNRJI.js +11 -0
  842. package/dist/provider-catalog-BqmZljQJ.js +11 -0
  843. package/dist/provider-catalog-DIiNG8du.js +12 -0
  844. package/dist/provider-catalog-aWreWBr_.js +24 -0
  845. package/dist/provider-catalog-k2xN6Dmi.js +26 -0
  846. package/dist/provider-compat-DEtCjlVO.js +37 -0
  847. package/dist/provider-dispatcher-BOzs2ZGG.js +2 -0
  848. package/dist/provider-dispatcher-CLzXvOtY.js +22 -0
  849. package/dist/provider-models-Dr7Yl3OU.js +119 -0
  850. package/dist/provider-models-LgIFG7w_.js +35 -0
  851. package/dist/provider-registration-Ce1hYnYT.js +218 -0
  852. package/dist/pw-ai-qc3NEEdy.js +2511 -0
  853. package/dist/pw-role-snapshot-BDIJ0VPo.js +380 -0
  854. package/dist/qmd-manager-B2ly9K3H.js +1921 -0
  855. package/dist/qr-cli-D2qc34ak.js +349 -0
  856. package/dist/qr-cli-r8cz7XBw.js +2 -0
  857. package/dist/qr-image-DNn2cBT5.js +2 -0
  858. package/dist/queue-BbE1ctBI.js +409 -0
  859. package/dist/reaction-runtime-api-DNwfR7k6.js +116 -0
  860. package/dist/reactions-B8Os6MyX.js +998 -0
  861. package/dist/read-capability-BcetMuEi.js +412 -0
  862. package/dist/realtime-provider-shared-RvhVjejL.js +37 -0
  863. package/dist/realtime-transcription-provider-BbBn8N0w.js +184 -0
  864. package/dist/realtime-transcription-provider-C08pMeeY.js +183 -0
  865. package/dist/realtime-transcription-provider-CB0qNn9C.js +184 -0
  866. package/dist/realtime-transcription-provider-DYOqgmgZ.js +120 -0
  867. package/dist/realtime-transcription-provider-ySxyV6W0.js +172 -0
  868. package/dist/realtime-voice-provider-ByH_v5-M.js +489 -0
  869. package/dist/record-shared-DVnkFx9W.js +10 -0
  870. package/dist/register-service-commands-BXfMmQsa.js +71 -0
  871. package/dist/register.agent-CUXMbAb4.js +248 -0
  872. package/dist/register.configure-B29Tv6Ec.js +15 -0
  873. package/dist/register.maintenance-ePgwbzKN.js +363 -0
  874. package/dist/register.message-BmgFYhw_.js +329 -0
  875. package/dist/register.onboard-BL8ZSfVl.js +88 -0
  876. package/dist/register.runtime-Z_9jSH_w.js +81 -0
  877. package/dist/register.runtime.js +1 -1
  878. package/dist/register.setup-BAQ-rre0.js +150 -0
  879. package/dist/register.status-health-sessions-D5CTwglK.js +1215 -0
  880. package/dist/register.subclis-BAzWCN2M.js +3 -0
  881. package/dist/register.subclis-CMhZ_wr2.js +29 -0
  882. package/dist/register.subclis-core-D_uA6Vtg.js +249 -0
  883. package/dist/replay-policy-Be3VAzMj.js +8 -0
  884. package/dist/reply-chunking-DsNT8-zW.js +3 -0
  885. package/dist/reply-dispatch-runtime-C8Tjbie9.js +13 -0
  886. package/dist/reply-media-paths.runtime-Sf21IJNk.js +146 -0
  887. package/dist/reply-media-paths.runtime-oSGMjdni.js +2 -0
  888. package/dist/reply-media-paths.runtime.js +1 -1
  889. package/dist/reply-payload-transform-DxOTphts.js +720 -0
  890. package/dist/reply-runtime-9GCZm66h.js +11 -0
  891. package/dist/reply.runtime-Ck_EqPGO.js +2 -0
  892. package/dist/reply.runtime.js +1 -1
  893. package/dist/reset-BMP05zhP.js +84 -0
  894. package/dist/reset-authorization-AdwO29Il.js +34 -0
  895. package/dist/response-generator-BKL4tpDF.js +175 -0
  896. package/dist/restart-health-C8OVhvQ6.js +2 -0
  897. package/dist/restart-health-DdG71XEk.js +202 -0
  898. package/dist/root-help-_8BuPuC8.js +44 -0
  899. package/dist/route-reply-C4YpHgPi.js +162 -0
  900. package/dist/route-reply.runtime-hioDUgsc.js +2 -0
  901. package/dist/route-reply.runtime.js +1 -1
  902. package/dist/routes-BbR9Kf9O.js +3341 -0
  903. package/dist/routes-DSDrrbg7.js +2 -0
  904. package/dist/routing-CMekdi78.js +5 -0
  905. package/dist/rpc-B32bpIT7.js +61 -0
  906. package/dist/rpc-context-88y3DNdl.js +17 -0
  907. package/dist/rpc.runtime-BWtvlfeD.js +21 -0
  908. package/dist/rpc.runtime.js +1 -1
  909. package/dist/run-auth-profile.runtime-x8Hbrp4n.js +2 -0
  910. package/dist/run-auth-profile.runtime.js +1 -1
  911. package/dist/run-delivery.runtime-BEhoJYec.js +530 -0
  912. package/dist/run-delivery.runtime.js +1 -1
  913. package/dist/run-embedded.runtime-DtE5YonB.js +4 -0
  914. package/dist/run-embedded.runtime.js +1 -1
  915. package/dist/run-execution-cli.runtime-B7TsaFkb.js +4 -0
  916. package/dist/run-execution-cli.runtime.js +1 -1
  917. package/dist/run-executor.runtime-C6GU_OdI.js +277 -0
  918. package/dist/run-executor.runtime.js +1 -1
  919. package/dist/run-main-DlCyw-yJ.js +567 -0
  920. package/dist/run-subagent-registry.runtime-N6lG2N8U.js +2 -0
  921. package/dist/run-subagent-registry.runtime.js +1 -1
  922. package/dist/run-wait-CT1ADSXM.js +135 -0
  923. package/dist/runtime-BMgYgoRw.js +973 -0
  924. package/dist/runtime-BZIHCyP6.js +9 -0
  925. package/dist/runtime-BfclzCOK.js +72 -0
  926. package/dist/runtime-C5HCPXpN.js +107 -0
  927. package/dist/runtime-api-BwnU0Us4.js +14 -0
  928. package/dist/runtime-api-CTCWdq7l.js +4 -0
  929. package/dist/runtime-api-DEKfCisk.js +9 -0
  930. package/dist/runtime-api-DuV0VsXW.js +9 -0
  931. package/dist/runtime-embedded-pi.runtime-BYOaO_Od.js +2 -0
  932. package/dist/runtime-embedded-pi.runtime.js +1 -1
  933. package/dist/runtime-entry-BIQCiau_.js +2769 -0
  934. package/dist/runtime-internal-CatNPRWm.js +2 -0
  935. package/dist/runtime-options-VPF2fIbl.js +275 -0
  936. package/dist/runtime-provider-CKxDlld3.js +21 -0
  937. package/dist/runtime-schema-C5kNPI-T.js +28588 -0
  938. package/dist/sandbox-24Qv41cI.js +3 -0
  939. package/dist/sandbox-Dl4VHMsp.js +1156 -0
  940. package/dist/sandbox-cli-DKdlzfGK.js +450 -0
  941. package/dist/scan-CsLHQzrX.js +2 -0
  942. package/dist/scan-Db3o5_vf.js +523 -0
  943. package/dist/secrets-cli-DRs2TyS0.js +2101 -0
  944. package/dist/security-cli-Ddj_11Zr.js +486 -0
  945. package/dist/selection-BTcDg98i.js +2 -0
  946. package/dist/selection-CDq8O7Fx.js +7764 -0
  947. package/dist/send-C3Q0rOZU.js +102 -0
  948. package/dist/send-CMRoV9D3.js +534 -0
  949. package/dist/send-DLyeTfOT.js +156 -0
  950. package/dist/send.runtime-11PTjSXY.js +2 -0
  951. package/dist/send.runtime.js +1 -1
  952. package/dist/server-DpmjtgBd.js +77 -0
  953. package/dist/server-context-BuRVihwJ.js +2 -0
  954. package/dist/server-context-Dxt5bPO1.js +847 -0
  955. package/dist/server-iR310jYD.js +13 -0
  956. package/dist/server-middleware-XZQHvHoT.js +120 -0
  957. package/dist/server-node-events-EECL-zPp.js +481 -0
  958. package/dist/server-plugin-bootstrap-BeyQQP6e.js +13176 -0
  959. package/dist/server-plugin-bootstrap-Du2JCynD.js +2 -0
  960. package/dist/server-restart-sentinel-D16NkJS9.js +697 -0
  961. package/dist/server.impl-jeGX0yfZ.js +12894 -0
  962. package/dist/session-DQJLw1_T.js +48 -0
  963. package/dist/session-envelope-BzLkljLE.js +18 -0
  964. package/dist/session-key-B9ng1tKQ.js +65 -0
  965. package/dist/session-kill-http-CrVogPTY.js +110 -0
  966. package/dist/session-meta-Cf_igX65.js +109 -0
  967. package/dist/session-override-tYPL0kPi.js +106 -0
  968. package/dist/session-reset-model.runtime-Bksk4sN9.js +133 -0
  969. package/dist/session-reset-model.runtime.js +1 -1
  970. package/dist/session-reset-service-Coa2y7Dc.js +497 -0
  971. package/dist/session-route-C__jEVZM.js +93 -0
  972. package/dist/session-status.runtime-DGvtIYsy.js +2 -0
  973. package/dist/session-status.runtime.js +1 -1
  974. package/dist/session-store-C7BvEOyw.js +126 -0
  975. package/dist/session-store.runtime-CTnaK0eA.js +2 -0
  976. package/dist/session-store.runtime.js +1 -1
  977. package/dist/session-subagent-reactivation.runtime-CpvLz2Zl.js +2 -0
  978. package/dist/session-subagent-reactivation.runtime.js +1 -1
  979. package/dist/session-tab-registry-9PAkEJgt.js +581 -0
  980. package/dist/session-updates-DFsCLKMJ.js +236 -0
  981. package/dist/session-updates.runtime-GJ8kEPly.js +2 -0
  982. package/dist/session-updates.runtime.js +1 -1
  983. package/dist/session-utils-B1COXii1.js +1009 -0
  984. package/dist/session-visibility-D3BOamfE.js +147 -0
  985. package/dist/sessions-BNIruiEi.js +48 -0
  986. package/dist/sessions-B_sLzSKh.js +281 -0
  987. package/dist/sessions-ChHWG6bX.js +16 -0
  988. package/dist/sessions-helpers-BhxVyCeC.js +305 -0
  989. package/dist/sessions-history-http-Cat6NIOM.js +383 -0
  990. package/dist/sessions-patch-C2VfpT6N.js +309 -0
  991. package/dist/sessions-resolve-CU-TrVC5.js +174 -0
  992. package/dist/sessions-u8wkO5OX.js +2 -0
  993. package/dist/sessions.runtime-B6j-Iope.js +2 -0
  994. package/dist/sessions.runtime.js +1 -1
  995. package/dist/setup-BUlom6Vi.js +421 -0
  996. package/dist/setup-CcVU94hA.js +636 -0
  997. package/dist/setup-api-B7VRJ8uG.js +29 -0
  998. package/dist/setup-core-BSgdsKqw.js +393 -0
  999. package/dist/setup-core-BlfMhY40.js +184 -0
  1000. package/dist/setup-core-ClqXCwnQ.js +176 -0
  1001. package/dist/setup-core-DnkRgrw-.js +171 -0
  1002. package/dist/setup-surface-5pyyPLuU.js +351 -0
  1003. package/dist/setup-surface-6kf03Wwh.js +72 -0
  1004. package/dist/setup-surface-C-CfXHbT.js +286 -0
  1005. package/dist/setup-surface-C2ZP0qfU.js +3 -0
  1006. package/dist/setup-surface-DKyYG10Q2.js +403 -0
  1007. package/dist/setup-surface-DbpW4B-_.js +219 -0
  1008. package/dist/setup.finalize-skT8Gm-r.js +547 -0
  1009. package/dist/setup.gateway-config-CeiELioQ.js +250 -0
  1010. package/dist/shared--LL8Q1-r.js +60 -0
  1011. package/dist/shared-B48XWnaj.js +121 -0
  1012. package/dist/shared-CTrgq8xV.js +217 -0
  1013. package/dist/shared-D7wq6pQ0.js +186 -0
  1014. package/dist/shared-DSeBkiR2.js +198 -0
  1015. package/dist/shared-DWDavHPp.js +76 -0
  1016. package/dist/shared-runtime-D-p9L46W.js +7 -0
  1017. package/dist/short-term-promotion-CkPsM3JU.js +1543 -0
  1018. package/dist/skill-commands-GmJ-uKh9.js +83 -0
  1019. package/dist/skill-commands.runtime-B2kGq_R_.js +2 -0
  1020. package/dist/skill-commands.runtime.js +1 -1
  1021. package/dist/skills-snapshot.runtime-niF0JCHr.js +7 -0
  1022. package/dist/skills-snapshot.runtime.js +1 -1
  1023. package/dist/slash-state-D0qRQzb9.js +1911 -0
  1024. package/dist/speech-provider-CZ0DIWHC.js +209 -0
  1025. package/dist/speech-provider-D01WzRM7.js +216 -0
  1026. package/dist/speech-provider-D4dWoX5q.js +395 -0
  1027. package/dist/speech-provider-DQjPn8BG.js +170 -0
  1028. package/dist/speech-provider-DTfG7isC.js +184 -0
  1029. package/dist/speech-provider-DVMPFaU6.js +103 -0
  1030. package/dist/speech-provider-Jnc9vcw3.js +209 -0
  1031. package/dist/src-DLW1D_bM.js +3974 -0
  1032. package/dist/stage-sandbox-media.runtime-DeLGFWqT.js +232 -0
  1033. package/dist/stage-sandbox-media.runtime.js +1 -1
  1034. package/dist/startup-context-DKWBYxjm.js +312 -0
  1035. package/dist/state-migrations-DdRavjjK.js +820 -0
  1036. package/dist/status-BGTYuDnT.js +397 -0
  1037. package/dist/status-BYp9Gu83.js +209 -0
  1038. package/dist/status-BqydDBcZ.js +3 -0
  1039. package/dist/status-Bx1yRRTV.js +190 -0
  1040. package/dist/status-C6gdYeLs.js +2 -0
  1041. package/dist/status-Cl8Otyr4.js +62 -0
  1042. package/dist/status-DWucT0mf.js +2 -0
  1043. package/dist/status-all-TjyzzieW.js +498 -0
  1044. package/dist/status-json-C6WIXSpl.js +14 -0
  1045. package/dist/status-json-command-CgXgvQow.js +84 -0
  1046. package/dist/status-message-D6O4-pti.js +466 -0
  1047. package/dist/status-message.runtime-CNShQeZy.js +6 -0
  1048. package/dist/status-message.runtime.js +1 -1
  1049. package/dist/status-queue.runtime-K8_F9zMn.js +2 -0
  1050. package/dist/status-queue.runtime.js +1 -1
  1051. package/dist/status-runtime-shared-Be7bmVcF.js +257 -0
  1052. package/dist/status-subagents.runtime-BRV0GKxR.js +18 -0
  1053. package/dist/status-subagents.runtime.js +1 -1
  1054. package/dist/status-text-BIGdXi_0.js +237 -0
  1055. package/dist/status.gateway-connection.runtime-C1Eg5lPs.js +2 -0
  1056. package/dist/status.gateway-connection.runtime.js +1 -1
  1057. package/dist/status.gather-C91OSvDe.js +292 -0
  1058. package/dist/status.gather-DOJX68XV.js +2 -0
  1059. package/dist/status.runtime-BM4ZMHfF.js +2 -0
  1060. package/dist/status.runtime-JhkaEpRc.js +2 -0
  1061. package/dist/status.runtime.js +1 -1
  1062. package/dist/status.scan-36oLz1Hh.js +65 -0
  1063. package/dist/status.scan-overview-CsDwq0xR.js +379 -0
  1064. package/dist/status.scan.fast-json-CS8ga0yM.js +132 -0
  1065. package/dist/status.scan.fast-json-DYvUCNqQ.js +2 -0
  1066. package/dist/status.summary-1hoR3rVk.js +214 -0
  1067. package/dist/status.summary-Bl1Fw7SD.js +2 -0
  1068. package/dist/store-3hbb4lSJ.js +4 -0
  1069. package/dist/store-CEFH-fGo.js +910 -0
  1070. package/dist/store.runtime-ugP7_1Zf.js +2 -0
  1071. package/dist/store.runtime.js +1 -1
  1072. package/dist/stream-CukCyjCc.js +664 -0
  1073. package/dist/stream-Dj22sbqm.js +134 -0
  1074. package/dist/stt-CRYwE4f3.js +66 -0
  1075. package/dist/subagent-announce-Dnuw09in.js +351 -0
  1076. package/dist/subagent-announce-delivery-cCFWE0et.js +726 -0
  1077. package/dist/subagent-announce-output-BtmzvU1a.js +364 -0
  1078. package/dist/subagent-capabilities-Btyd8tu0.js +251 -0
  1079. package/dist/subagent-control-Dlc3kJMb.js +506 -0
  1080. package/dist/subagent-control.runtime-g5fkwkOu.js +3 -0
  1081. package/dist/subagent-control.runtime.js +1 -1
  1082. package/dist/subagent-followup.runtime-CtU5LNEN.js +68 -0
  1083. package/dist/subagent-followup.runtime.js +1 -1
  1084. package/dist/subagent-orphan-recovery-kbEEIccA.js +305 -0
  1085. package/dist/subagent-registry-B5bQOpDI.js +3 -0
  1086. package/dist/subagent-registry-CBu4eX0s.js +1753 -0
  1087. package/dist/subagent-registry.runtime.js +1 -1
  1088. package/dist/subagent-spawn-DhjzC5gY.js +1005 -0
  1089. package/dist/system-cli-A9ux7HV2.js +59 -0
  1090. package/dist/system-prompt-DJq4MtoS.js +640 -0
  1091. package/dist/tables-BStv8EET.js +829 -0
  1092. package/dist/target-id-RoVbMf8U.js +107 -0
  1093. package/dist/targets-RMCdeJGZ.js +207 -0
  1094. package/dist/targets-cmfGv2Db.js +67 -0
  1095. package/dist/targets.runtime-DurrSDqM.js +2 -0
  1096. package/dist/targets.runtime.js +1 -1
  1097. package/dist/task-executor-CtdGnYvb.js +360 -0
  1098. package/dist/task-owner-access-C_gF3pGm.js +74 -0
  1099. package/dist/task-registry-CFNty_H1.js +2366 -0
  1100. package/dist/task-registry-delivery-runtime-C1c7pN3i.js +2 -0
  1101. package/dist/task-registry-delivery-runtime-F6HIzLFD.js +3 -0
  1102. package/dist/task-registry.maintenance-BSO3Pttk.js +2 -0
  1103. package/dist/task-registry.maintenance-Bzw1Ot4Y.js +416 -0
  1104. package/dist/tavily-client-DmRSbaLh.js +2 -0
  1105. package/dist/tavily-client-DyAtAOpD.js +193 -0
  1106. package/dist/tavily-search-provider-Bbgsl7mb.js +62 -0
  1107. package/dist/telegram/audit.js +2 -2
  1108. package/dist/telegram/token.js +2 -2
  1109. package/dist/telnyx-nMo1MXA1.js +260 -0
  1110. package/dist/testing-DLeFUMTf.js +575 -0
  1111. package/dist/text-report-Dr4OMS_k.js +587 -0
  1112. package/dist/text-runtime-Dd2bva2m.js +290 -0
  1113. package/dist/tool-config-shared-DlMaBB10.js +19 -0
  1114. package/dist/tool-policy-pipeline-0FWDoYYr.js +109 -0
  1115. package/dist/tool-resolution-DQTRVob0.js +90 -0
  1116. package/dist/tools-effective-inventory-GNGRMlm8.js +152 -0
  1117. package/dist/tools-invoke-http-IeTKKDtc.js +206 -0
  1118. package/dist/tools.runtime-DNLELnRr.js +4 -0
  1119. package/dist/tools.runtime.js +1 -1
  1120. package/dist/transcript-DWg4ZUcm.js +312 -0
  1121. package/dist/transcript-resolve.runtime-xACsMpzb.js +2 -0
  1122. package/dist/transcript-resolve.runtime.js +1 -1
  1123. package/dist/transcript.runtime-BEXMCmRi.js +2 -0
  1124. package/dist/transcript.runtime.js +1 -1
  1125. package/dist/transport-policy-BzTvyOmg.js +75 -0
  1126. package/dist/trash-EJIRdEEW.js +24 -0
  1127. package/dist/tts-AMFKvIil.js +64 -0
  1128. package/dist/tts-D7c_mBQr.js +183 -0
  1129. package/dist/tui-cli-CeXEjZVR.js +4595 -0
  1130. package/dist/twilio-Bq0EHjSs.js +609 -0
  1131. package/dist/typing-policy-D-cwir-6.js +12 -0
  1132. package/dist/update-cli-6cN0AU-H.js +1759 -0
  1133. package/dist/upgrade-E9pk_ETn.js +1226 -0
  1134. package/dist/video-generation-provider-B2ydEHoH.js +271 -0
  1135. package/dist/video-generation-provider-BIhzvg3t.js +78 -0
  1136. package/dist/video-generation-provider-BiGET6PL.js +187 -0
  1137. package/dist/video-generation-provider-BvIYYRHt.js +254 -0
  1138. package/dist/video-generation-provider-CDMIArvG.js +118 -0
  1139. package/dist/video-generation-provider-CZc8AIXp.js +221 -0
  1140. package/dist/video-generation-provider-DKQZcort.js +281 -0
  1141. package/dist/video-generation-provider-DdGhJ9-8.js +287 -0
  1142. package/dist/video-generation-provider-XpVuorb7.js +264 -0
  1143. package/dist/video-generation-task-status-D44fagYk.js +163 -0
  1144. package/dist/voice-mapping-Ltp5aeXQ.js +41 -0
  1145. package/dist/wait-for-idle-before-flush-B5QDOp0b.js +5986 -0
  1146. package/dist/web-search-gDoNQc1M.js +61 -0
  1147. package/dist/web-search-provider-DI1P7u12.js +163 -0
  1148. package/dist/web-search-provider.runtime-BLHcU_Q5.js +2 -0
  1149. package/dist/web-search-provider.runtime-CExn2tm8.js +185 -0
  1150. package/dist/web-search-provider.runtime.js +1 -1
  1151. package/dist/webhook-shared-1XHBMLp6.js +12 -0
  1152. package/dist/wizard-models-CLDwUX2-.js +334 -0
  1153. package/dist/workflow-runtime-BrBSvDJz.js +485 -0
  1154. package/dist/workspace-run-CQ9bvprq.js +70 -0
  1155. package/dist/x-search-config-COc9ynlq.js +36 -0
  1156. package/dist/x-search-shared-D-WVgH0q.js +75 -0
  1157. package/dist/zalo-js-kA38HR6N.js +1157 -0
  1158. package/package.json +1 -1
  1159. package/dist/abort-D7Eb5Pfs.js +0 -201
  1160. package/dist/abort-cutoff.runtime-W1jPHD1l.js +0 -20
  1161. package/dist/abort.runtime-Uk-fNOr0.js +0 -2
  1162. package/dist/accounts-B0U5s6Hn.js +0 -2
  1163. package/dist/accounts-BuQEZI1m.js +0 -365
  1164. package/dist/accounts-BxrhItqg.js +0 -107
  1165. package/dist/accounts-CJuvMKsE.js +0 -66
  1166. package/dist/accounts-DAo-x54e.js +0 -104
  1167. package/dist/accounts-DoMkWpQd.js +0 -43
  1168. package/dist/accounts.runtime-B4AMDwXM.js +0 -2
  1169. package/dist/acp-cli-Dj3nYrtM.js +0 -2193
  1170. package/dist/acp-spawn-DVm7VQrm.js +0 -1093
  1171. package/dist/acp-spawn-DfcG2y_Y.js +0 -2
  1172. package/dist/acp-stateful-target-driver-BYeTpciM.js +0 -89
  1173. package/dist/action-agents-B9hNk5lN.js +0 -67
  1174. package/dist/action-focus-B6pqXNJ2.js +0 -132
  1175. package/dist/action-help-CPcU40vC.js +0 -7
  1176. package/dist/action-info-D_yE--lC.js +0 -101
  1177. package/dist/action-kill-BJ0225YA.js +0 -33
  1178. package/dist/action-list-BLyN0cUw.js +0 -21
  1179. package/dist/action-log-_sI8lmxG.js +0 -30
  1180. package/dist/action-send-C2RZKCaN.js +0 -39
  1181. package/dist/action-spawn-DtZrqOf-.js +0 -47
  1182. package/dist/action-unfocus-D90uQGIM.js +0 -29
  1183. package/dist/actions.runtime-CwqOsby1.js +0 -5
  1184. package/dist/actions.runtime-DL7IkUaC.js +0 -18
  1185. package/dist/agent-command-ChguXtvw.js +0 -874
  1186. package/dist/agent-delivery-BwzZnRgC.js +0 -76
  1187. package/dist/agent-eujROEra.js +0 -2
  1188. package/dist/agent-harness-runtime-KWYqsYTk.js +0 -144
  1189. package/dist/agent-runner-utils-DyLXFJim.js +0 -239
  1190. package/dist/agent-runner.runtime-Tm2znb5I.js +0 -3455
  1191. package/dist/agent-runtime-DYyI3OTz.js +0 -18
  1192. package/dist/agents-CaKEB08m.js +0 -5
  1193. package/dist/agents-D0LjQ71R.js +0 -954
  1194. package/dist/agents.command-shared-DnntyPTT.js +0 -40
  1195. package/dist/aliases-C1J5Hl0k.js +0 -96
  1196. package/dist/aliases-DE2DzUaH.js +0 -2
  1197. package/dist/api-9ms9Td4v.js +0 -3
  1198. package/dist/api-BgtDxBwP.js +0 -5
  1199. package/dist/api-BpBoWeil.js +0 -3
  1200. package/dist/api-CKbGCnWb.js +0 -139
  1201. package/dist/api-D1axzMqP.js +0 -4
  1202. package/dist/api-j3Hir2UT.js +0 -48
  1203. package/dist/apply-CIz-od94.js +0 -508
  1204. package/dist/apply.runtime-CN-vA6G-.js +0 -2
  1205. package/dist/approval-client-helpers-Dp5QM59V.js +0 -82
  1206. package/dist/approval-delivery-helpers-BS-VOhZN.js +0 -134
  1207. package/dist/approval-gateway-resolver-DIPFgTnx.js +0 -29
  1208. package/dist/approval-gateway-runtime-i0yziXk2.js +0 -2
  1209. package/dist/approval-handler-runtime-7ttgBfc_.js +0 -439
  1210. package/dist/approval-native-helpers-DbgPq2Af.js +0 -33
  1211. package/dist/approval-native-runtime-DT2b3zaN.js +0 -729
  1212. package/dist/approval-renderers-CxKF90_M.js +0 -64
  1213. package/dist/attempt-execution.runtime-CzM8MDim.js +0 -509
  1214. package/dist/attempt-execution.shared-BeCuaCMe.js +0 -22
  1215. package/dist/attempt.prompt-helpers-DfcGwj0J.js +0 -221
  1216. package/dist/attempt.tool-run-context-4cCwC6FC.js +0 -933
  1217. package/dist/audit-EYwFJUbn.js +0 -939
  1218. package/dist/audit-membership-runtime-AIbmS8yN.js +0 -550
  1219. package/dist/audit.runtime-OucPhZPU.js +0 -7
  1220. package/dist/auth-BPy3ID3D.js +0 -2
  1221. package/dist/auth-CYd5Phr-.js +0 -56
  1222. package/dist/auth-D0kGHo1j.js +0 -177
  1223. package/dist/auth-DTPcbxn6.js +0 -550
  1224. package/dist/auth-order-8O0b16i_.js +0 -139
  1225. package/dist/auth-order-CW2AQyNL.js +0 -2
  1226. package/dist/base-url-h8Mhif7l.js +0 -15
  1227. package/dist/bash-tools-8bn5C7K0.js +0 -2824
  1228. package/dist/bash-tools-DZpkBFMY.js +0 -3
  1229. package/dist/bash-tools.exec-runtime-DQVwPD43.js +0 -829
  1230. package/dist/best-effort-delivery-B6BoLJdq.js +0 -22
  1231. package/dist/binding-routing-BMMSo2KY.js +0 -85
  1232. package/dist/binding-targets-Wm55iFsz.js +0 -121
  1233. package/dist/block-streaming-CcRmZONP.js +0 -103
  1234. package/dist/bluebubbles-Cm2jWoAr.js +0 -77
  1235. package/dist/brave-web-search-provider-DXyLEuRX.js +0 -111
  1236. package/dist/brave-web-search-provider.runtime-CH2Ro8gV.js +0 -229
  1237. package/dist/brave-web-search-provider.shared-2wgQI-qy.js +0 -174
  1238. package/dist/bridge-auth-registry-1QsmDpYF.js +0 -23
  1239. package/dist/bridge-server-D3Mo-BM6.js +0 -113
  1240. package/dist/browser-control-auth-BiuDMNP7.js +0 -2
  1241. package/dist/browser-node-runtime-CrigB5UH.js +0 -12
  1242. package/dist/browser-profiles-BJjsWlQ8.js +0 -2
  1243. package/dist/browser-runtime-Dc5sMewB.js +0 -387
  1244. package/dist/browser-setup-tools-CM1H6l0K.js +0 -13
  1245. package/dist/build-8Hzi5z0_.js +0 -550
  1246. package/dist/call-B3rCzXN7.js +0 -3
  1247. package/dist/call-Cmd-rlC2.js +0 -331
  1248. package/dist/call-status-tDrmri32.js +0 -33
  1249. package/dist/call.runtime-B3Hufiov.js +0 -2
  1250. package/dist/capability-cli-Ce3qNXsw.js +0 -1401
  1251. package/dist/card-command-CJdI6sGe.js +0 -241
  1252. package/dist/catalog-provider-DY1ugTDc.js +0 -40
  1253. package/dist/catchup-CPt_Xs3R.js +0 -300
  1254. package/dist/channel-9VLlWEI1.js +0 -350
  1255. package/dist/channel-B-414Az-.js +0 -1100
  1256. package/dist/channel-BEuRg3eQ.js +0 -297
  1257. package/dist/channel-BlN_kpiT.js +0 -840
  1258. package/dist/channel-Bz03tu1a.js +0 -1174
  1259. package/dist/channel-C5Tp1ocZ.js +0 -595
  1260. package/dist/channel-Cp6PItXu.js +0 -1320
  1261. package/dist/channel-CzXZ2Wlv.js +0 -226
  1262. package/dist/channel-DIkT4jcM.js +0 -491
  1263. package/dist/channel-DcywMc0l.js +0 -1802
  1264. package/dist/channel-Dt2V2WJc.js +0 -453
  1265. package/dist/channel-core-BqZwOpId.js +0 -5
  1266. package/dist/channel-inbound-B7Bv-zk9.js +0 -31
  1267. package/dist/channel-plugin-runtime-D2c6-qG7.js +0 -771
  1268. package/dist/channel-resolution-DE2qIsKy.js +0 -39
  1269. package/dist/channel-runtime-CL6Do8kd.js +0 -425
  1270. package/dist/channel-selection-BVycf9oD.js +0 -126
  1271. package/dist/channel-selection.runtime-6URJ5YTl.js +0 -2
  1272. package/dist/channel.runtime-BvuS-PzM.js +0 -2364
  1273. package/dist/channel.runtime-CCct0AmO.js +0 -89
  1274. package/dist/channel.runtime-CSr_Q-Ki.js +0 -26
  1275. package/dist/channel.runtime-DC7FilE-.js +0 -576
  1276. package/dist/channel.runtime-MbysJwT_.js +0 -42398
  1277. package/dist/channel.runtime-RfnLhIct.js +0 -430
  1278. package/dist/channel.runtime-klwS5eJC.js +0 -4
  1279. package/dist/channel.runtime-srmPwBlw.js +0 -67
  1280. package/dist/channel.setup-B2dTQgdm.js +0 -10
  1281. package/dist/channel2.runtime-DPjdUdWe.js +0 -109
  1282. package/dist/channels-Dv75fvTN.js +0 -733
  1283. package/dist/channels-cli-CdOO74YS.js +0 -268
  1284. package/dist/chat-RXBcjTu0.js +0 -2830
  1285. package/dist/chrome-BXAOdA_f.js +0 -1430
  1286. package/dist/chrome-mcp-BxYER6mx.js +0 -600
  1287. package/dist/chrome-mcp-DBAP4O7j.js +0 -2
  1288. package/dist/chrome.executables-DUG48PkZ.js +0 -541
  1289. package/dist/chunk-CW9jTwFk.js +0 -268
  1290. package/dist/clawbot-cli-CFMt_3zm.js +0 -9
  1291. package/dist/cli-BPiKrd4S.js +0 -219
  1292. package/dist/cli-BaH_mH3N.js +0 -154
  1293. package/dist/cli-Bnlo8CdT.js +0 -2
  1294. package/dist/cli-Bv1HNRJ5.js +0 -72
  1295. package/dist/cli-CJjDYqsm.js +0 -3726
  1296. package/dist/cli-D1HCyEF2.js +0 -2
  1297. package/dist/cli-LrPyoM0F.js +0 -2
  1298. package/dist/cli-runner-G69QIenA.js +0 -286
  1299. package/dist/cli-runner.runtime-BLh4ORZH.js +0 -3
  1300. package/dist/cli-runner.runtime-DboAnzrp.js +0 -4
  1301. package/dist/cli.runtime-GlOBpTyx.js +0 -1261
  1302. package/dist/client-ClJyHgmq.js +0 -713
  1303. package/dist/client-PBXIhvrx.js +0 -138
  1304. package/dist/client-info-DZtBR4jU.js +0 -49
  1305. package/dist/command-auth-9KsVrUS6.js +0 -409
  1306. package/dist/command-auth-D11sIoiZ.js +0 -76
  1307. package/dist/command-config-resolution-B9-W4ET0.js +0 -2
  1308. package/dist/command-config-resolution-Wl8868is.js +0 -23
  1309. package/dist/command-config-resolution.runtime-CwcIQOXb.js +0 -2
  1310. package/dist/command-execution-startup-BqLYlG3n.js +0 -324
  1311. package/dist/command-gates-BCh2pNFa.js +0 -47
  1312. package/dist/command-registry-B7IhcWl6.js +0 -4
  1313. package/dist/command-registry-DPR9uz9j.js +0 -9
  1314. package/dist/command-registry-core-B5gwwfVK.js +0 -106
  1315. package/dist/command-secret-gateway-D2Lx9Ky-.js +0 -528
  1316. package/dist/command-status.runtime-CDDbtrG8.js +0 -87
  1317. package/dist/commands-acp-Bt7M70te.js +0 -77
  1318. package/dist/commands-compact.runtime-D5D8CApN.js +0 -10
  1319. package/dist/commands-context-ojGcHTsc.js +0 -38
  1320. package/dist/commands-core.runtime-J-hrpY-n.js +0 -2
  1321. package/dist/commands-handlers.runtime-DQBNyeLG.js +0 -4599
  1322. package/dist/commands-models-83LvrT6B.js +0 -327
  1323. package/dist/commands-reset-hooks-BJ-tN_wz.js +0 -135
  1324. package/dist/commands-status-DWJdDC46.js +0 -16
  1325. package/dist/commands-status.runtime-BwwPceyy.js +0 -3
  1326. package/dist/commands-subagents-control.runtime-DJ396mVU.js +0 -3
  1327. package/dist/commands-subagents-control.runtime-u0Q05DrT.js +0 -2
  1328. package/dist/commands-system-prompt-B2QE_VCG.js +0 -2
  1329. package/dist/commands-system-prompt-amkj1mZm.js +0 -158
  1330. package/dist/commands.runtime-DtaJzRBS.js +0 -167
  1331. package/dist/compact-D0swO4Yn.js +0 -1118
  1332. package/dist/compact.runtime-DoEPFAkB.js +0 -12
  1333. package/dist/completion-cli-Y2gWpjun.js +0 -328
  1334. package/dist/config-Bt-fMiqG.js +0 -252
  1335. package/dist/config-api-DAsbCIov.js +0 -2
  1336. package/dist/config-cli-vQiFMkMf.js +0 -1078
  1337. package/dist/config-compat-B5zS8b4Z.js +0 -130
  1338. package/dist/config-compat-Bc51fcbM.js +0 -126
  1339. package/dist/config-guard-DkhDBkW2.js +0 -96
  1340. package/dist/config-runtime-o9UzLknt.js +0 -32
  1341. package/dist/configure-4GGf_X5o.js +0 -1252
  1342. package/dist/configure-DXNuDvJ5.js +0 -2
  1343. package/dist/connect-options-D4mbwxwf.js +0 -699
  1344. package/dist/control-auth-CW8eEClz.js +0 -125
  1345. package/dist/control-service-v2GS08H6.js +0 -156
  1346. package/dist/control-ui/assets/agents-BskHTW81.js +0 -1052
  1347. package/dist/control-ui/assets/canvas-C0aRpEGd.js +0 -269
  1348. package/dist/control-ui/assets/channels-Cou3VPB8.js +0 -463
  1349. package/dist/control-ui/assets/cron-BTOQWH3p.js +0 -933
  1350. package/dist/control-ui/assets/debug-DFlkgaJr.js +0 -94
  1351. package/dist/control-ui/assets/index-BSKZQZqm.css +0 -1
  1352. package/dist/control-ui/assets/index-yB7WOhLR.js +0 -6210
  1353. package/dist/control-ui/assets/instances-LZGly20d.js +0 -57
  1354. package/dist/control-ui/assets/mcp-D0PCi1zE.js +0 -373
  1355. package/dist/control-ui/assets/nodes-BGzTN7_8.js +0 -618
  1356. package/dist/control-ui/assets/plugins-kalk3SHa.js +0 -273
  1357. package/dist/control-ui/assets/sessions-3I2s2QvS.js +0 -306
  1358. package/dist/control-ui/assets/skills-CVXfvdtq.js +0 -323
  1359. package/dist/control-ui/assets/wallet-0oCbcesL.js +0 -285
  1360. package/dist/control-ui-969zq03L.js +0 -1043
  1361. package/dist/conversation-id-CRePZnKh.js +0 -235
  1362. package/dist/conversation-id-CYPpQ2b_.js +0 -38
  1363. package/dist/conversation-runtime-CsNLbytB.js +0 -31
  1364. package/dist/core-CE92oVKC.js +0 -275
  1365. package/dist/create-5gsvOUrW.js +0 -80
  1366. package/dist/cron-cli-iwMQSWts.js +0 -713
  1367. package/dist/daemon-cli-B2_mPKtr.js +0 -12
  1368. package/dist/dashboard-BgppT7jE.js +0 -2
  1369. package/dist/dashboard-BvirXUKT.js +0 -81
  1370. package/dist/ddg-client-C2_vfwll.js +0 -147
  1371. package/dist/ddg-search-provider-B5vfg-3L.js +0 -54
  1372. package/dist/delegate-CUa3SE1o.js +0 -64
  1373. package/dist/deliver-B8OtkCTN.js +0 -3
  1374. package/dist/deliver-EzzwtNdH.js +0 -747
  1375. package/dist/deliver-runtime-CSD1urwa.js +0 -2
  1376. package/dist/delivery-context-DWhGyo59.js +0 -40
  1377. package/dist/delivery-outbound.runtime-CuQHxHy1.js +0 -6
  1378. package/dist/delivery.runtime-2U6XvLON.js +0 -253
  1379. package/dist/detached-task-runtime-CLeXceLH.js +0 -73
  1380. package/dist/devices-cli-BhL3A8cJ.js +0 -498
  1381. package/dist/diagnostics-CYkTN8yr.js +0 -154
  1382. package/dist/direct-dm-B7BKDOTt.js +0 -64
  1383. package/dist/directive-handling.fast-lane-hTmCaN4B.js +0 -66
  1384. package/dist/directive-handling.impl-CLfhAB3s.js +0 -2
  1385. package/dist/directive-handling.impl-DQCYdyq3.js +0 -703
  1386. package/dist/directive-handling.model-selection-r1oi_Z5Q.js +0 -114
  1387. package/dist/directive-handling.persist.runtime-CKVn6kNl.js +0 -215
  1388. package/dist/directive-handling.shared-DLVXjKip.js +0 -56
  1389. package/dist/directory-cli-Cp5qe7Tb.js +0 -240
  1390. package/dist/dispatch-Dy7iNSXe.js +0 -1131
  1391. package/dist/dispatch-acp-TiM2Vzfh.js +0 -981
  1392. package/dist/dispatch-acp-manager.runtime-IOMdfbvN.js +0 -3
  1393. package/dist/dispatch-acp-media.runtime-D8ZRAL_i.js +0 -4
  1394. package/dist/dispatch-acp-session.runtime-BNf4E79J.js +0 -2
  1395. package/dist/dispatch-acp.runtime-D-O-_uwA.js +0 -19
  1396. package/dist/doctor-config-flow-REpgyGT1.js +0 -420
  1397. package/dist/doctor-config-preflight-DCEuxKBd.js +0 -2
  1398. package/dist/doctor-config-preflight-_gjxioW4.js +0 -63
  1399. package/dist/doctor-contract-U3opYPeO.js +0 -26
  1400. package/dist/doctor-device-pairing-NWw3fVhm.js +0 -307
  1401. package/dist/doctor-gateway-daemon-flow-ciZuB3_y.js +0 -250
  1402. package/dist/doctor-gateway-health-Clb9pKDM.js +0 -63
  1403. package/dist/doctor-health-Dz0Uo3ey.js +0 -59
  1404. package/dist/doctor-health-contributions-B36IgdyB.js +0 -493
  1405. package/dist/doctor-prompter-D6cxwaM6.js +0 -56
  1406. package/dist/doctor-sandbox-CnGh8PIF.js +0 -194
  1407. package/dist/doctor-state-migrations-DlFzkEz6.js +0 -2
  1408. package/dist/doctor-workspace-status-CBsmvySn.js +0 -75
  1409. package/dist/dreaming-CzDMTkOn.js +0 -1582
  1410. package/dist/dreaming-narrative-y806xcaM.js +0 -596
  1411. package/dist/dreaming-shared-C4dysoA0.js +0 -21
  1412. package/dist/embedded-gateway-stub.runtime-CHJcdIyH.js +0 -9
  1413. package/dist/embeddings-CWCkXHbh.js +0 -215
  1414. package/dist/embeddings-http-CdI7ktv7.js +0 -205
  1415. package/dist/exa-web-search-provider-Duy7AQi9.js +0 -80
  1416. package/dist/exa-web-search-provider.runtime-BFsoURiN.js +0 -302
  1417. package/dist/exa-web-search-provider.runtime-DL0X8Ct2.js +0 -2
  1418. package/dist/exec-approval-forwarder.runtime-DTz08HhE.js +0 -3
  1419. package/dist/exec-approval-reply-CKpq6yzn.js +0 -296
  1420. package/dist/exec-approval-reply-CuNQhfNe.js +0 -2
  1421. package/dist/exec-approval-session-target-VmakwuWi.js +0 -176
  1422. package/dist/exec-approvals-cli-D-xC3sec.js +0 -498
  1423. package/dist/exec-defaults-BwOKAzOq.js +0 -2
  1424. package/dist/exec-defaults-C58y025t.js +0 -67
  1425. package/dist/execute.runtime-DOUF94B3.js +0 -1363
  1426. package/dist/fallbacks-5pUORVnh.js +0 -31
  1427. package/dist/fallbacks-WXR5Obc4.js +0 -2
  1428. package/dist/fallbacks-shared-CLY3SckB.js +0 -111
  1429. package/dist/format-Z6ci0mN3.js +0 -176
  1430. package/dist/gateway-Bh4zysny.js +0 -115
  1431. package/dist/gateway-cli-Cn8UyxHT.js +0 -1283
  1432. package/dist/gateway-rpc-DWqAmWHZ.js +0 -14
  1433. package/dist/gateway-rpc.runtime-8RQQdisU.js +0 -23
  1434. package/dist/gateway-runtime-CqSQCYo0.js +0 -15
  1435. package/dist/gateway-status-CRk9P_mQ.js +0 -584
  1436. package/dist/genesis-tools-Bczkn4pa.js +0 -9166
  1437. package/dist/genesis-tools.runtime-DybZ3Sbd.js +0 -2
  1438. package/dist/get-reply-BFleeJ4f.js +0 -3897
  1439. package/dist/get-reply-from-config.runtime-D3inD3tz.js +0 -2
  1440. package/dist/graph-users-6xhmlyu_.js +0 -1337
  1441. package/dist/guarded-json-api-BzmpX7Bh.js +0 -594
  1442. package/dist/health-CMBrLjD5.js +0 -3
  1443. package/dist/health-CYhGu11X.js +0 -469
  1444. package/dist/health-route-C6jiKkgE.js +0 -41
  1445. package/dist/health-route-C6s6ENKx.js +0 -2
  1446. package/dist/heartbeat-runner-Dh9Xx9YU.js +0 -1292
  1447. package/dist/heartbeat-runner-zDpniJi_.js +0 -5
  1448. package/dist/heartbeat-runner.runtime-D4lSdsnQ.js +0 -4
  1449. package/dist/helpers-DZTamQ-L.js +0 -320
  1450. package/dist/hooks-cli-DWDRPcaF.js +0 -433
  1451. package/dist/http-endpoint-helpers-BYmpbInx.js +0 -41
  1452. package/dist/http-headers-BWJ-wWSB.js +0 -11
  1453. package/dist/http-utils-DFEeaWER.js +0 -924
  1454. package/dist/identity-JQch7avk.js +0 -140
  1455. package/dist/image-fallbacks-BdpPq4o8.js +0 -2
  1456. package/dist/image-fallbacks-GxUehr7F.js +0 -31
  1457. package/dist/image-generation-provider-Bs8dan-F.js +0 -95
  1458. package/dist/image-generation-provider-Ca75_MHL.js +0 -63
  1459. package/dist/image-generation-provider-Cumlkwcm.js +0 -228
  1460. package/dist/image-generation-provider-DAAncrN2.js +0 -529
  1461. package/dist/image-generation-provider-LZz_eWeh.js +0 -157
  1462. package/dist/image-generation-provider-xE4TSEUN.js +0 -274
  1463. package/dist/inbound-reply-dispatch-DRjQ7qlQ.js +0 -73
  1464. package/dist/inbound.runtime-B3E6TUQ-.js +0 -4
  1465. package/dist/inbound.runtime-BsJCJ9wE.js +0 -3
  1466. package/dist/infra-runtime-pY0nhq7P.js +0 -39
  1467. package/dist/init-BFVKFRp9.js +0 -59
  1468. package/dist/install-signal-cli-Aj1HHG57.js +0 -202
  1469. package/dist/jobs-CzIiEiXa.js +0 -734
  1470. package/dist/kimi-web-search-provider-g6k5oyqw.js +0 -80
  1471. package/dist/kimi-web-search-provider.runtime-B5Y_iP-w.js +0 -2
  1472. package/dist/kimi-web-search-provider.runtime-D9mGNz4w.js +0 -261
  1473. package/dist/library-BpP85Umq.js +0 -45
  1474. package/dist/lifecycle-C69VoOuS.js +0 -229
  1475. package/dist/lifecycle-zC5_kLvH.js +0 -571
  1476. package/dist/lifecycle.runtime-DN9n10Ar.js +0 -2
  1477. package/dist/list-CZePHMYk.js +0 -2
  1478. package/dist/list-D-39rkJG.js +0 -2
  1479. package/dist/list-D9R6bffC.js +0 -1212
  1480. package/dist/list-J_MIp9Cf.js +0 -131
  1481. package/dist/list.probe-BJI7RpM4.js +0 -419
  1482. package/dist/live-model-switch-1UTJZ5QI.js +0 -336
  1483. package/dist/llm-slug-generator-CB-9wD87.js +0 -79
  1484. package/dist/load-config-Cokd9aKd.js +0 -35
  1485. package/dist/local-dispatch.runtime-DfmGw3hN.js +0 -8
  1486. package/dist/login-Ca9f5om9.js +0 -108
  1487. package/dist/logs-cli-Dz0aORYp.js +0 -265
  1488. package/dist/logs-cli.runtime-DgpP6kgG.js +0 -2
  1489. package/dist/main-session-restart-recovery-BdWx2-Ig.js +0 -206
  1490. package/dist/managed-image-attachments-BTEZZFPC.js +0 -2
  1491. package/dist/managed-image-attachments-BXwFe_hB.js +0 -635
  1492. package/dist/manager-49WINgRB.js +0 -3114
  1493. package/dist/manager-CKWINDnN.js +0 -2
  1494. package/dist/manager-DXquZHPE.js +0 -2057
  1495. package/dist/markdown-to-line-DuPPNWHb.js +0 -790
  1496. package/dist/mcp-cli-BgjBxFLB.js +0 -725
  1497. package/dist/mcp-http-CXz6iTV9.js +0 -529
  1498. package/dist/media-contract-api-Dn7Z9fVR.js +0 -2
  1499. package/dist/media-contract-g0U7MSOk.js +0 -49
  1500. package/dist/media-runtime-DKL6xud8.js +0 -329
  1501. package/dist/memory-Cvmtd7SS.js +0 -342
  1502. package/dist/memory-core-host-runtime-cli-DZAsYda3.js +0 -9
  1503. package/dist/memory-embedding-adapter-D58z4Hjn.js +0 -123
  1504. package/dist/message-DqFmV6vo.js +0 -232
  1505. package/dist/message-action-runner-B-6rT67S.js +0 -1407
  1506. package/dist/message-action-runner-Ds9MNZPn.js +0 -2
  1507. package/dist/message-actions-Bvs23y8w.js +0 -143
  1508. package/dist/message-channel-bhWoqTRw.js +0 -56
  1509. package/dist/message-secret-scope-CEVGxySq.js +0 -103
  1510. package/dist/message.gateway.runtime-CT0DJ45B.js +0 -2
  1511. package/dist/method-scopes-DZxEwSC9.js +0 -228
  1512. package/dist/minimax-web-search-provider-4scwuRzS.js +0 -53
  1513. package/dist/minimax-web-search-provider.runtime-Bc1tLmEn.js +0 -140
  1514. package/dist/minimax-web-search-provider.runtime-DirtikTO.js +0 -2
  1515. package/dist/mock-DjlwRj77.js +0 -136
  1516. package/dist/model-definitions-DAfZ2fCD.js +0 -260
  1517. package/dist/model-overrides-C47kuXVC.js +0 -104
  1518. package/dist/model-selection-B0e0JNhN.js +0 -213
  1519. package/dist/models-CEyQw90_.js +0 -47
  1520. package/dist/models-CQV1b487.js +0 -760
  1521. package/dist/models-CXOS_VP1.js +0 -157
  1522. package/dist/models-CfTF8Fbp.js +0 -569
  1523. package/dist/models-auth-status-CtbfpiLe.js +0 -217
  1524. package/dist/models-cli-DKlGXayC.js +0 -271
  1525. package/dist/models-http-DWu9XkAU.js +0 -92
  1526. package/dist/models.fetch-BVY3QlcA.js +0 -518
  1527. package/dist/monitor-BrQZ38sV.js +0 -1661
  1528. package/dist/monitor-C2olcPaB.js +0 -1237
  1529. package/dist/monitor-C32pQJf0.js +0 -788
  1530. package/dist/monitor-DWDZx3af.js +0 -2
  1531. package/dist/monitor-DuB8d2_N.js +0 -671
  1532. package/dist/monitor-DwAHrb0v.js +0 -295
  1533. package/dist/monitor-auth-ym3-n10B.js +0 -207
  1534. package/dist/monitor-fV4pkrv-.js +0 -1459
  1535. package/dist/monitor-processing-Cnjt-86E.js +0 -1974
  1536. package/dist/monitor.runtime-m4hyBv5_.js +0 -2
  1537. package/dist/monitor.webhook-DpQqy92z.js +0 -180
  1538. package/dist/msteams-CEC38YQX.js +0 -35
  1539. package/dist/music-generation-provider-DR8TlAd7.js +0 -63
  1540. package/dist/music-generation-provider-UU2xosmd.js +0 -170
  1541. package/dist/native-hook-relay-ALDxVrJR.js +0 -519
  1542. package/dist/native-web-search-DE6wKTD7.js +0 -64
  1543. package/dist/nextcloud-talk-D6l_ncY6.js +0 -17
  1544. package/dist/node-cli-B4fFzsbt.js +0 -2276
  1545. package/dist/nodes-cli-DPOCIMd6.js +0 -1046
  1546. package/dist/nodes-utils-DXJ9uuER.js +0 -84
  1547. package/dist/nodes.helpers-DYpGCFer.js +0 -34
  1548. package/dist/notify-CDGsB-f1.js +0 -315
  1549. package/dist/onboard-BAKpU8Hh2.js +0 -49
  1550. package/dist/onboard-BPXard5r.js +0 -316
  1551. package/dist/onboard-BhyqJz5g.js +0 -2
  1552. package/dist/onboard-CYwvwcjK.js +0 -25
  1553. package/dist/onboard-DEkkXwRP.js +0 -58
  1554. package/dist/onboard-DcPiUfS6.js +0 -70
  1555. package/dist/onboard-UUvy9YwT.js +0 -29
  1556. package/dist/onboard-g4ijsx6R.js +0 -25
  1557. package/dist/onboard-helpers-DD5g-FbW.js +0 -204
  1558. package/dist/onboard-helpers-DRudISKo.js +0 -6
  1559. package/dist/onboard-iJRhJj4E.js +0 -25
  1560. package/dist/onboard-interactive-DxupaeWe.js +0 -24
  1561. package/dist/onboard-non-interactive-BCIl9AIV.js +0 -635
  1562. package/dist/onboard-remote-By9HP4eT.js +0 -193
  1563. package/dist/onboard-remote-r9H76BMI.js +0 -2
  1564. package/dist/onboard-skills-BbXkZVWi.js +0 -2
  1565. package/dist/onboard-skills-Bj6v5Fc2.js +0 -134
  1566. package/dist/openai-codex-auth-identity-DDVrnkGx.js +0 -45
  1567. package/dist/openai-codex-device-code-vaMr3ktu.js +0 -164
  1568. package/dist/openai-codex-provider-BgIrfq5f.js +0 -472
  1569. package/dist/openai-codex-shared-i8zMv9Wn.js +0 -6
  1570. package/dist/openai-http-3hSjTiC9.js +0 -500
  1571. package/dist/openai-provider-BRJBMcdJ.js +0 -313
  1572. package/dist/openresponses-http-DCEEmL6J.js +0 -1128
  1573. package/dist/operator-approvals-client-gaflvETF.js +0 -68
  1574. package/dist/outbound-media-Bh4sEXyv.js +0 -57
  1575. package/dist/outbound-runtime-CNL02KHG.js +0 -5
  1576. package/dist/outbound.runtime-DNeZz0qd.js +0 -2
  1577. package/dist/pair-command-approve-DVG9ZQOz.js +0 -44
  1578. package/dist/perplexity-web-search-provider-CIwymV16.js +0 -92
  1579. package/dist/perplexity-web-search-provider.runtime-CIrANP8t.js +0 -324
  1580. package/dist/perplexity-web-search-provider.runtime-GuZxipp7.js +0 -2
  1581. package/dist/persistent-bindings.lifecycle-DO0CXQku.js +0 -2
  1582. package/dist/persistent-bindings.lifecycle-yyMTI5wL.js +0 -85
  1583. package/dist/pi-embedded-G_7qiYrd.js +0 -2905
  1584. package/dist/pi-embedded-RNv_18Ql.js +0 -4
  1585. package/dist/pi-embedded-subscribe.handlers.compaction.runtime-B0obozHf.js +0 -23
  1586. package/dist/pi-embedded.runtime-DgLkukEn.js +0 -4
  1587. package/dist/pi-tool-definition-adapter-CAxVoliV.js +0 -229
  1588. package/dist/pi-tools-DLzCdu_A.js +0 -1057
  1589. package/dist/pi-tools.before-tool-call-CXqyPFQ7.js +0 -2
  1590. package/dist/pi-tools.before-tool-call-DgEuyrNS.js +0 -433
  1591. package/dist/plivo-B2yZjL-u.js +0 -394
  1592. package/dist/plugin--KkHkZKl.js +0 -12195
  1593. package/dist/plugin-enabled-DOVricci.js +0 -140
  1594. package/dist/plugin-registration-BsNMVImp.js +0 -23
  1595. package/dist/plugin-service-CAdEnLLQ.js +0 -2892
  1596. package/dist/policy-6PXLgKPZ.js +0 -328
  1597. package/dist/prepare.runtime-asu7nymR.js +0 -815
  1598. package/dist/probe-8nNaZ33e.js +0 -45
  1599. package/dist/probe-BOlTfbzG.js +0 -2
  1600. package/dist/probe-BicpMUHr.js +0 -74
  1601. package/dist/probe-BoAfs3v0.js +0 -243
  1602. package/dist/probe-C2UYvuU1.js +0 -1443
  1603. package/dist/probe-D3-S54s4.js +0 -2
  1604. package/dist/probe-D7gHyiZV.js +0 -241
  1605. package/dist/probe-Dauysr9a.js +0 -32
  1606. package/dist/probe-DqbaFZ8U.js +0 -2205
  1607. package/dist/probe.runtime-D1TENrHH.js +0 -2
  1608. package/dist/program-C_hsOWv5.js +0 -111
  1609. package/dist/prompt-select-styled-CuuJ3YZI.js +0 -20
  1610. package/dist/protocol-DxLbSF2J.js +0 -2477
  1611. package/dist/provider-3GpsNTSy.js +0 -70
  1612. package/dist/provider-catalog-BSXiLKUb.js +0 -24
  1613. package/dist/provider-catalog-BfrRkDb6.js +0 -26
  1614. package/dist/provider-catalog-CQOOAKUd.js +0 -11
  1615. package/dist/provider-catalog-DuplUDCj.js +0 -12
  1616. package/dist/provider-catalog-nmYuB55e.js +0 -11
  1617. package/dist/provider-compat-Cmc7Dpb2.js +0 -37
  1618. package/dist/provider-dispatcher-C98nuGtx.js +0 -2
  1619. package/dist/provider-dispatcher-U0bjp31x.js +0 -22
  1620. package/dist/provider-models-CQ8YMhIq.js +0 -35
  1621. package/dist/provider-models-xoUb7pnU.js +0 -119
  1622. package/dist/provider-registration-B5Xbkn85.js +0 -218
  1623. package/dist/pw-ai-B0xjo-Hb.js +0 -2511
  1624. package/dist/pw-role-snapshot-DfdV7JMN.js +0 -380
  1625. package/dist/qmd-manager-DtShFCys.js +0 -1921
  1626. package/dist/qr-cli-D38r9mtY.js +0 -2
  1627. package/dist/qr-cli-Wbrc0tcy.js +0 -349
  1628. package/dist/qr-image-BQhzr3CC.js +0 -2
  1629. package/dist/queue-DyWzQqJh.js +0 -409
  1630. package/dist/reaction-runtime-api-BZCWmrll.js +0 -116
  1631. package/dist/reactions-BmhlLeFI.js +0 -998
  1632. package/dist/read-capability-B0mVFrNe.js +0 -412
  1633. package/dist/realtime-provider-shared-CKounRGH.js +0 -37
  1634. package/dist/realtime-transcription-provider-BjwZyKME.js +0 -120
  1635. package/dist/realtime-transcription-provider-CSQuayAt.js +0 -183
  1636. package/dist/realtime-transcription-provider-Cr86v5pA.js +0 -184
  1637. package/dist/realtime-transcription-provider-DFdWvvWN.js +0 -184
  1638. package/dist/realtime-transcription-provider-Da6Yg9O_.js +0 -172
  1639. package/dist/realtime-voice-provider-DP4ad0L4.js +0 -489
  1640. package/dist/record-shared-B5MzAU-n.js +0 -10
  1641. package/dist/register-service-commands-B2Ky9P6l.js +0 -71
  1642. package/dist/register.agent-C9UIPMzI.js +0 -248
  1643. package/dist/register.configure-DlvVdJGK.js +0 -15
  1644. package/dist/register.maintenance-4q078BpS.js +0 -363
  1645. package/dist/register.message-Dyafa7wU.js +0 -329
  1646. package/dist/register.onboard-R4VgPeqI.js +0 -88
  1647. package/dist/register.runtime-Eju4Gltw.js +0 -81
  1648. package/dist/register.setup-DCnMQggx.js +0 -150
  1649. package/dist/register.status-health-sessions-DrZEX_C3.js +0 -1215
  1650. package/dist/register.subclis-C8MYnxZ0.js +0 -29
  1651. package/dist/register.subclis-DXRcUQY-.js +0 -3
  1652. package/dist/register.subclis-core-CKrFtMnT.js +0 -249
  1653. package/dist/replay-policy-BXxBsUQj.js +0 -8
  1654. package/dist/reply-chunking-CQ-Mda9f.js +0 -3
  1655. package/dist/reply-dispatch-runtime-DrCMM_h6.js +0 -13
  1656. package/dist/reply-media-paths.runtime-Dm7QsGx1.js +0 -146
  1657. package/dist/reply-media-paths.runtime-N1vQKI2t.js +0 -2
  1658. package/dist/reply-payload-transform-DXQFdUjX.js +0 -720
  1659. package/dist/reply-runtime-BEbR4D-L.js +0 -11
  1660. package/dist/reply.runtime-k1wfQvE8.js +0 -2
  1661. package/dist/reset-PRwf7E1a.js +0 -84
  1662. package/dist/reset-authorization-DnCXXdJm.js +0 -34
  1663. package/dist/response-generator-CfYnwr-R.js +0 -175
  1664. package/dist/restart-health-BjmfJCUM.js +0 -202
  1665. package/dist/restart-health-hw909zlD.js +0 -2
  1666. package/dist/root-help-DetBH1U3.js +0 -44
  1667. package/dist/route-reply-DCdEIaJm.js +0 -162
  1668. package/dist/route-reply.runtime-CCoWkbHJ.js +0 -2
  1669. package/dist/routes-CBHvnNAn.js +0 -3341
  1670. package/dist/routes-CM5XFUol.js +0 -2
  1671. package/dist/routing-DB6Hmk1m.js +0 -5
  1672. package/dist/rpc-DejtQFPW.js +0 -61
  1673. package/dist/rpc-context-C-K-u97k.js +0 -17
  1674. package/dist/rpc.runtime-CvFF6IfX.js +0 -21
  1675. package/dist/run-auth-profile.runtime-CBF7l6AJ.js +0 -2
  1676. package/dist/run-delivery.runtime-mrFGIUBn.js +0 -530
  1677. package/dist/run-embedded.runtime-Bi_aGXZl.js +0 -4
  1678. package/dist/run-execution-cli.runtime-CJ5bRUst.js +0 -4
  1679. package/dist/run-executor.runtime-C2nEQ7H5.js +0 -277
  1680. package/dist/run-main-C4eOl9O3.js +0 -567
  1681. package/dist/run-subagent-registry.runtime-Wv4vcMON.js +0 -2
  1682. package/dist/run-wait-J2xqMO0Y.js +0 -135
  1683. package/dist/runtime-BWI1Yc19.js +0 -9
  1684. package/dist/runtime-BvrYBFWw.js +0 -107
  1685. package/dist/runtime-YN3DqmXj.js +0 -72
  1686. package/dist/runtime-api-B7_47clB.js +0 -9
  1687. package/dist/runtime-api-CCSSXW6u.js +0 -4
  1688. package/dist/runtime-api-CHqMki_k.js +0 -9
  1689. package/dist/runtime-api-FyNFEQa6.js +0 -14
  1690. package/dist/runtime-embedded-pi.runtime-CKKAqNJ9.js +0 -2
  1691. package/dist/runtime-entry-T6UII6Wf.js +0 -2769
  1692. package/dist/runtime-internal-BsETZzZr.js +0 -2
  1693. package/dist/runtime-lZ_xBQn6.js +0 -973
  1694. package/dist/runtime-options-DYh6T1p4.js +0 -275
  1695. package/dist/runtime-provider-C0RXuzkp.js +0 -21
  1696. package/dist/runtime-schema-DjdB9Mgh.js +0 -28588
  1697. package/dist/sandbox-Ctv6fRri.js +0 -3
  1698. package/dist/sandbox-cli-DlgKqSYU.js +0 -450
  1699. package/dist/sandbox-xqJ6gg8T.js +0 -1156
  1700. package/dist/scan-C4AL0vV5.js +0 -2
  1701. package/dist/scan-CiyGLsBp.js +0 -523
  1702. package/dist/secrets-cli-BzZc1dlc.js +0 -2101
  1703. package/dist/security-cli-D7WSpDIp.js +0 -486
  1704. package/dist/selection-BTj1orBr.js +0 -2
  1705. package/dist/selection-Bj9s46tI.js +0 -7764
  1706. package/dist/send-D1BQp5zh.js +0 -102
  1707. package/dist/send-KwF2Hkrg.js +0 -534
  1708. package/dist/send-pMWIOnb1.js +0 -156
  1709. package/dist/send.runtime-BY-fpUGh.js +0 -2
  1710. package/dist/server-4wSXAqKZ.js +0 -77
  1711. package/dist/server-CM6IcXrJ.js +0 -13
  1712. package/dist/server-context-LGN_v6Pr.js +0 -847
  1713. package/dist/server-context-uC_sh4Qx.js +0 -2
  1714. package/dist/server-middleware-DlVw3WGo.js +0 -120
  1715. package/dist/server-node-events-DRqk_sSG.js +0 -481
  1716. package/dist/server-plugin-bootstrap-DT7hMrEB.js +0 -12989
  1717. package/dist/server-plugin-bootstrap-DbgT8s3b.js +0 -2
  1718. package/dist/server-restart-sentinel-DJg1jibz.js +0 -697
  1719. package/dist/server.impl-KfCHHYM3.js +0 -12869
  1720. package/dist/session-D4GawBOc.js +0 -48
  1721. package/dist/session-envelope-BuDz-uci.js +0 -18
  1722. package/dist/session-key-BDzsY9ry.js +0 -65
  1723. package/dist/session-kill-http-BtXfgdg5.js +0 -110
  1724. package/dist/session-meta-DSbdkLPg.js +0 -109
  1725. package/dist/session-override-DvpYNjEy.js +0 -106
  1726. package/dist/session-reset-model.runtime-TJuluskH.js +0 -133
  1727. package/dist/session-reset-service-hc2O1o2q.js +0 -497
  1728. package/dist/session-route-dSc-ZfJV.js +0 -93
  1729. package/dist/session-status.runtime-DBOWNGE0.js +0 -2
  1730. package/dist/session-store-CH0Ic73R.js +0 -126
  1731. package/dist/session-store.runtime-BLzP0kKb.js +0 -2
  1732. package/dist/session-subagent-reactivation.runtime-DLwmbVAj.js +0 -2
  1733. package/dist/session-tab-registry-C30tFUHP.js +0 -581
  1734. package/dist/session-updates-CNv8yQTZ.js +0 -236
  1735. package/dist/session-updates.runtime-BI1pPG-y.js +0 -2
  1736. package/dist/session-utils-BtcpsVXK.js +0 -1009
  1737. package/dist/session-visibility-mu61Cazj.js +0 -147
  1738. package/dist/sessions-BY-N1ODJ.js +0 -2
  1739. package/dist/sessions-BaBnI48b.js +0 -48
  1740. package/dist/sessions-DgCDR090.js +0 -16
  1741. package/dist/sessions-DwbTRE7z.js +0 -281
  1742. package/dist/sessions-helpers-Boau-Mgl.js +0 -305
  1743. package/dist/sessions-history-http-JaZfsaow.js +0 -383
  1744. package/dist/sessions-patch-CGza9U1J.js +0 -309
  1745. package/dist/sessions-resolve-CxsMxrnz.js +0 -174
  1746. package/dist/sessions.runtime-B-dhGJmG.js +0 -2
  1747. package/dist/setup-Dld60Kw0.js +0 -636
  1748. package/dist/setup-XAAowspF.js +0 -421
  1749. package/dist/setup-api-qytGcCw9.js +0 -29
  1750. package/dist/setup-core-4RX2I3E7.js +0 -176
  1751. package/dist/setup-core-BDZ0GEn7.js +0 -171
  1752. package/dist/setup-core-BagQlOhA.js +0 -184
  1753. package/dist/setup-core-DFDx-2sA.js +0 -393
  1754. package/dist/setup-surface-BFIZR2UD.js +0 -286
  1755. package/dist/setup-surface-BNFYOzmc.js +0 -3
  1756. package/dist/setup-surface-C5F8cr6e2.js +0 -403
  1757. package/dist/setup-surface-CArOZxWv.js +0 -72
  1758. package/dist/setup-surface-D5kQP_5C.js +0 -219
  1759. package/dist/setup-surface-uNLwReGA.js +0 -351
  1760. package/dist/setup.finalize-DanHcKdm.js +0 -547
  1761. package/dist/setup.gateway-config-BfYDHl2S.js +0 -250
  1762. package/dist/shared-CHz0sVK9.js +0 -186
  1763. package/dist/shared-CaYwmZh_.js +0 -76
  1764. package/dist/shared-DZLuHh9i.js +0 -121
  1765. package/dist/shared-Doh9gWDF.js +0 -198
  1766. package/dist/shared-IhxU1SqF.js +0 -60
  1767. package/dist/shared-Xx-lZLWj.js +0 -217
  1768. package/dist/shared-runtime-BtwYWnp-.js +0 -7
  1769. package/dist/short-term-promotion-B_3UbQd-.js +0 -1543
  1770. package/dist/skill-commands-X1-SuzeM.js +0 -83
  1771. package/dist/skill-commands.runtime-DtDW-HM9.js +0 -2
  1772. package/dist/skills-snapshot.runtime-CA04_tLs.js +0 -7
  1773. package/dist/slash-state-C5V_rwuh.js +0 -1911
  1774. package/dist/speech-provider-Bs22xK7f.js +0 -216
  1775. package/dist/speech-provider-DH35IJrp.js +0 -395
  1776. package/dist/speech-provider-DJhp-WGc.js +0 -170
  1777. package/dist/speech-provider-TuMZXjYA.js +0 -209
  1778. package/dist/speech-provider-bfFcbOuQ.js +0 -184
  1779. package/dist/speech-provider-eDdGrCL3.js +0 -209
  1780. package/dist/speech-provider-hFc3R_JS.js +0 -103
  1781. package/dist/src-CbvReXTF.js +0 -3974
  1782. package/dist/stage-sandbox-media.runtime-BBZVC4gy.js +0 -232
  1783. package/dist/startup-context-BhbpkDRe.js +0 -312
  1784. package/dist/state-migrations-BcK6CUBE.js +0 -820
  1785. package/dist/status-6TVRvc0X.js +0 -2
  1786. package/dist/status-BXUtOoXd.js +0 -190
  1787. package/dist/status-BYxVnJ4t.js +0 -62
  1788. package/dist/status-CASjTsed.js +0 -3
  1789. package/dist/status-CozhtuYB.js +0 -2
  1790. package/dist/status-DtWC4gU2.js +0 -397
  1791. package/dist/status-all-RMu-gp_i.js +0 -498
  1792. package/dist/status-json-C05vJFn8.js +0 -14
  1793. package/dist/status-json-command-CM9ioz3P.js +0 -84
  1794. package/dist/status-message-CqkaBWzr.js +0 -466
  1795. package/dist/status-message.runtime-qXxrcsiN.js +0 -6
  1796. package/dist/status-queue.runtime-C7PIZ71w.js +0 -2
  1797. package/dist/status-runtime-shared-CilAS_RU.js +0 -257
  1798. package/dist/status-subagents.runtime-_MQiX_ZF.js +0 -18
  1799. package/dist/status-text-Cbbo5gTy.js +0 -237
  1800. package/dist/status-xCBvRTwU.js +0 -209
  1801. package/dist/status.gateway-connection.runtime-CpCUmiCK.js +0 -2
  1802. package/dist/status.gather-B_e7gqcb.js +0 -2
  1803. package/dist/status.gather-DeoHK2V7.js +0 -292
  1804. package/dist/status.runtime-CCrtR3yP.js +0 -2
  1805. package/dist/status.runtime-IgA-WP26.js +0 -2
  1806. package/dist/status.scan-BywaTUGM.js +0 -65
  1807. package/dist/status.scan-overview-Bg0PxIss.js +0 -379
  1808. package/dist/status.scan.fast-json-Bf3f1o0d.js +0 -2
  1809. package/dist/status.scan.fast-json-D7_WMvuZ.js +0 -132
  1810. package/dist/status.summary-BoGDDE4X.js +0 -214
  1811. package/dist/status.summary-b0S78Iju.js +0 -2
  1812. package/dist/store-BXDBdpSq.js +0 -4
  1813. package/dist/store-DOwpgFxf.js +0 -910
  1814. package/dist/store.runtime-1QGWUWou.js +0 -2
  1815. package/dist/stream-BsnsNxOA.js +0 -664
  1816. package/dist/stream-DEH1-1Is.js +0 -134
  1817. package/dist/stt-CJtlkVDc.js +0 -66
  1818. package/dist/subagent-announce-delivery-DwS6sI24.js +0 -726
  1819. package/dist/subagent-announce-gxWOuvuY.js +0 -351
  1820. package/dist/subagent-announce-output-C5ButdYI.js +0 -364
  1821. package/dist/subagent-capabilities-DIIDgPnB.js +0 -251
  1822. package/dist/subagent-control-C-Am1OtB.js +0 -506
  1823. package/dist/subagent-control.runtime-BK2jtN2v.js +0 -3
  1824. package/dist/subagent-followup.runtime-DoLAbwOo.js +0 -68
  1825. package/dist/subagent-orphan-recovery-BzDS5O1i.js +0 -305
  1826. package/dist/subagent-registry-BIgNPHJQ.js +0 -1753
  1827. package/dist/subagent-registry-an_oHM4b.js +0 -3
  1828. package/dist/subagent-spawn-BKFMuv1y.js +0 -1005
  1829. package/dist/system-cli-IAtoOtwN.js +0 -59
  1830. package/dist/system-prompt-D-MqNnG1.js +0 -640
  1831. package/dist/tables-Bfl7YTbb.js +0 -829
  1832. package/dist/target-id-BbLPfw0-.js +0 -107
  1833. package/dist/targets-DWXe3mQm.js +0 -67
  1834. package/dist/targets-bhZeEbJG.js +0 -207
  1835. package/dist/targets.runtime-By8N_Qv0.js +0 -2
  1836. package/dist/task-executor-CL1pQUmi.js +0 -360
  1837. package/dist/task-owner-access-B2tFCiT1.js +0 -74
  1838. package/dist/task-registry-CGDnoG_A.js +0 -2366
  1839. package/dist/task-registry-delivery-runtime-DOHFM4em.js +0 -3
  1840. package/dist/task-registry-delivery-runtime-DSl-VyA2.js +0 -2
  1841. package/dist/task-registry.maintenance-BJzi71wn.js +0 -416
  1842. package/dist/task-registry.maintenance-BxKAIJuE.js +0 -2
  1843. package/dist/tavily-client-CJtIuNuZ.js +0 -193
  1844. package/dist/tavily-client-cnGyIHjo.js +0 -2
  1845. package/dist/tavily-search-provider-BGV8D2VZ.js +0 -62
  1846. package/dist/telnyx-fGTIDZqb.js +0 -260
  1847. package/dist/testing-CqUqcJNQ.js +0 -575
  1848. package/dist/text-report-Cky4UA35.js +0 -587
  1849. package/dist/text-runtime-BOpYwhuR.js +0 -290
  1850. package/dist/tool-config-shared-C0rslp8t.js +0 -19
  1851. package/dist/tool-policy-pipeline-qhEZzHB-.js +0 -109
  1852. package/dist/tool-resolution-CjbwGHcJ.js +0 -90
  1853. package/dist/tools-effective-inventory-C70Ug651.js +0 -152
  1854. package/dist/tools-invoke-http-DcRsw9EO.js +0 -206
  1855. package/dist/tools.runtime-B-fcXtvL.js +0 -4
  1856. package/dist/transcript-CTF8zJ2t.js +0 -312
  1857. package/dist/transcript-resolve.runtime-C41xgFnA.js +0 -2
  1858. package/dist/transcript.runtime-DNBFm0LS.js +0 -2
  1859. package/dist/transport-policy-Ivm5ArSd.js +0 -75
  1860. package/dist/trash-CVoAJSAx.js +0 -24
  1861. package/dist/tts-B5G7JHka.js +0 -64
  1862. package/dist/tts-CWykD0rc.js +0 -183
  1863. package/dist/tui-cli-CNanJyFI.js +0 -4575
  1864. package/dist/twilio-B-dBW4_4.js +0 -609
  1865. package/dist/typing-policy-CCK9_cHb.js +0 -12
  1866. package/dist/update-cli-D-uofyXb.js +0 -1759
  1867. package/dist/upgrade-gspO3C-l.js +0 -1226
  1868. package/dist/video-generation-provider-BoKNqi7G.js +0 -254
  1869. package/dist/video-generation-provider-C2PI4-Wg.js +0 -271
  1870. package/dist/video-generation-provider-CDTvRCSr.js +0 -287
  1871. package/dist/video-generation-provider-CDxxol9M.js +0 -281
  1872. package/dist/video-generation-provider-CgDT1u2M.js +0 -187
  1873. package/dist/video-generation-provider-CtC5lXew.js +0 -78
  1874. package/dist/video-generation-provider-DTD47wPw.js +0 -118
  1875. package/dist/video-generation-provider-DqaWr1z8.js +0 -264
  1876. package/dist/video-generation-provider-yuS2SQIL.js +0 -221
  1877. package/dist/video-generation-task-status-BFReBMsX.js +0 -163
  1878. package/dist/voice-mapping-D2aNmRet.js +0 -41
  1879. package/dist/wait-for-idle-before-flush-BFfZxSMK.js +0 -5986
  1880. package/dist/web-search-njsvDPGV.js +0 -61
  1881. package/dist/web-search-provider-Bb1jo3tv.js +0 -163
  1882. package/dist/web-search-provider.runtime-B8p_cAp6.js +0 -185
  1883. package/dist/web-search-provider.runtime-xlnZGUCc.js +0 -2
  1884. package/dist/webhook-shared-CZt-kRIg.js +0 -12
  1885. package/dist/wizard-models-YsngRy_Q.js +0 -334
  1886. package/dist/workflow-runtime-Be-w_Xn7.js +0 -485
  1887. package/dist/workspace-run-CHsJxomp.js +0 -70
  1888. package/dist/x-search-config-ikE_9hVQ.js +0 -36
  1889. package/dist/x-search-shared-Cl-mTkkU.js +0 -75
  1890. package/dist/zalo-js-D6IiDKzH.js +0 -1157
@@ -1,3974 +0,0 @@
1
- import { a as normalizeLowercaseStringOrEmpty, c as normalizeOptionalString, f as readStringValue, s as normalizeOptionalLowercaseString } from "./string-coerce-DPP_aYVc.js";
2
- import { l as isRecord } from "./utils-CWrkFsp0.js";
3
- import { t as DEFAULT_ACCOUNT_ID } from "./account-id-CTXHUezn.js";
4
- import { d as resolveThreadSessionKeys } from "./session-key-Cj8Hd5K-.js";
5
- import { n as formatAllowlistMatchMeta } from "./allowlist-match-BOHko--Y.js";
6
- import { n as fetchWithSsrFGuard } from "./fetch-guard-CHbFjcDr.js";
7
- import { S as buildMediaPayload } from "./reply-payload-BXIttfWn.js";
8
- import { n as readResponseWithLimit } from "./read-response-with-limit-DVYa0rR2.js";
9
- import "./text-runtime-BOpYwhuR.js";
10
- import "./routing-DB6Hmk1m.js";
11
- import { r as resolveDualTextControlCommandGate } from "./command-gating-D0zXk0d9.js";
12
- import { n as resolveInboundMentionDecision } from "./mention-gating-Bgiswwan.js";
13
- import { n as keepHttpServerTaskAlive } from "./channel-lifecycle.core-pZCLydCB.js";
14
- import { i as mergeAllowlist, o as summarizeMapping } from "./resolve-utils-DSyZKD0I.js";
15
- import { r as resolveDefaultGroupPolicy } from "./runtime-group-policy-DNgAogyB.js";
16
- import { n as isDangerousNameMatchingEnabled } from "./dangerous-name-matching-DNNuwOTm.js";
17
- import { a as resolveSenderScopedGroupPolicy, i as evaluateSenderGroupAccessForPolicy } from "./group-access-B7DPQXCe.js";
18
- import { n as readStoreAllowFromForDmPolicy, o as resolveDmGroupAccessWithLists, s as resolveEffectiveAllowFromLists } from "./dm-policy-shared-Di2wRDuS.js";
19
- import { a as buildPendingHistoryContextFromMap, s as clearHistoryEntriesIfEnabled, u as recordPendingHistoryEntryIfEnabled } from "./history-B7vVBAzi.js";
20
- import "./reply-history-DQUk43L2.js";
21
- import { n as logInboundDrop, r as logTypingFailure } from "./logging-B9oda4JP.js";
22
- import { t as resolveChannelMediaMaxBytes } from "./media-limits-Cfxi-3ow.js";
23
- import { t as createChannelReplyPipeline } from "./channel-reply-pipeline-C6vxIEb-.js";
24
- import { n as createChannelPairingController } from "./channel-pairing-Dq5htPpX.js";
25
- import { n as DEFAULT_WEBHOOK_MAX_BODY_BYTES } from "./http-body-lzZef-oj.js";
26
- import { n as filterSupplementalContextItems, r as shouldIncludeSupplementalContext } from "./context-visibility-GLSC6eV8.js";
27
- import { t as resolveChannelContextVisibilityMode } from "./context-visibility-BxbDYXYz.js";
28
- import { r as dispatchReplyFromConfigWithSettledDispatcher } from "./inbound-reply-dispatch-DRjQ7qlQ.js";
29
- import "./ssrf-runtime-CetK5Qy_.js";
30
- import "./media-runtime-DKL6xud8.js";
31
- import "./channel-inbound-B7Bv-zk9.js";
32
- import { t as resolveInboundSessionEnvelopeContext } from "./session-envelope-BuDz-uci.js";
33
- import { c as createDraftStreamLoop } from "./channel-lifecycle-C5W_VOqY.js";
34
- import { t as getMSTeamsRuntime } from "./runtime-api-B7_47clB.js";
35
- import { A as GRAPH_ROOT, B as isUrlAllowed, C as buildUserAgent, D as formatUnknownError, E as formatMSTeamsSendErrorHint, F as extractHtmlFromAttachment, G as resolveRequestUrl, H as readNestedString, I as extractInlineImageCandidates, J as tryBuildGraphSharesUrlForSharedLink, K as safeFetchWithPolicy, L as inferPlaceholder, M as applyAuthorizationHeaderForUrl, N as encodeGraphShareId, P as estimateBase64DecodedBytes, R as isDownloadableAttachment, S as loadMSTeamsSdkWithAuth, T as classifyMSTeamsSendError, U as resolveAttachmentFetchPolicy, V as normalizeContentType, W as resolveMediaSsrfPolicy, _ as resolveMSTeamsStorePath, a as fetchGraphJson, b as createMSTeamsAdapter, h as resolveMSTeamsCredentials, j as IMG_SRC_RE, k as ATTACHMENT_TAG_RE, q as safeHostForUrl, w as ensureUserAgentHeader, x as createMSTeamsTokenProvider, y as createBotFrameworkJwtValidator, z as isLikelyImageAttachment } from "./graph-users-6xhmlyu_.js";
36
- import { a as resolveMSTeamsRouteConfig, f as resolveMSTeamsChannelAllowlist, i as resolveMSTeamsReplyPolicy, n as resolveMSTeamsAllowlistMatch, p as resolveMSTeamsUserAllowlist, t as isMSTeamsGroupAllowed } from "./policy-6PXLgKPZ.js";
37
- import { C as readJsonFile, S as createMSTeamsConversationStoreFs, T as writeJsonFile, _ as buildFileInfoCard, b as createMSTeamsPollStoreFs, c as renderReplyPayloadsToMessages, d as withRevokedProxyFallback, f as resolveGraphChatId, g as removePendingUploadFs, h as getPendingUploadFs, l as sendMSTeamsMessages, m as removePendingUpload, p as getPendingUpload, s as buildConversationReference, u as AI_GENERATED_ENTITY, v as parseFileConsentInvoke, w as withFileLock, x as extractMSTeamsPollVote, y as uploadToConsentUrl } from "./probe-DqbaFZ8U.js";
38
- import path from "node:path";
39
- import fs from "node:fs/promises";
40
- import { Buffer as Buffer$1 } from "node:buffer";
41
- //#region extensions/msteams/src/feedback-reflection-prompt.ts
42
- /** Max chars of the thumbed-down response to include in the reflection prompt. */
43
- const MAX_RESPONSE_CHARS = 500;
44
- function buildReflectionPrompt(params) {
45
- const parts = ["A user indicated your previous response wasn't helpful."];
46
- if (params.thumbedDownResponse) {
47
- const truncated = params.thumbedDownResponse.length > MAX_RESPONSE_CHARS ? `${params.thumbedDownResponse.slice(0, MAX_RESPONSE_CHARS)}...` : params.thumbedDownResponse;
48
- parts.push(`\nYour response was:\n> ${truncated}`);
49
- }
50
- if (params.userComment) parts.push(`\nUser's comment: "${params.userComment}"`);
51
- parts.push("\nBriefly reflect: what could you improve? Consider tone, length, accuracy, relevance, and specificity. Reply with a single JSON object only, no markdown or prose, using this exact shape:\n{\"learning\":\"...\",\"followUp\":false,\"userMessage\":\"\"}\n- learning: a short internal adjustment note (1-2 sentences) for your future behavior in this conversation.\n- followUp: true only if the user needs a direct follow-up message.\n- userMessage: only the exact user-facing message to send; empty string when followUp is false.");
52
- return parts.join("\n");
53
- }
54
- function parseBooleanLike(value) {
55
- if (typeof value === "boolean") return value;
56
- if (typeof value === "string") {
57
- const normalized = normalizeOptionalLowercaseString(value);
58
- if (normalized === "true" || normalized === "yes") return true;
59
- if (normalized === "false" || normalized === "no") return false;
60
- }
61
- }
62
- function parseStructuredReflectionValue(value) {
63
- if (value == null || typeof value !== "object" || Array.isArray(value)) return null;
64
- const candidate = value;
65
- const learning = typeof candidate.learning === "string" ? candidate.learning.trim() : void 0;
66
- if (!learning) return null;
67
- return {
68
- learning,
69
- followUp: parseBooleanLike(candidate.followUp) ?? false,
70
- userMessage: typeof candidate.userMessage === "string" && candidate.userMessage.trim() ? candidate.userMessage.trim() : void 0
71
- };
72
- }
73
- function parseReflectionResponse(text) {
74
- const trimmed = text.trim();
75
- if (!trimmed) return null;
76
- const candidates = [trimmed, ...trimmed.match(/```(?:json)?\s*([\s\S]*?)```/i)?.slice(1, 2) ?? []];
77
- for (const candidateText of candidates) {
78
- const candidate = candidateText.trim();
79
- if (!candidate) continue;
80
- try {
81
- const parsed = parseStructuredReflectionValue(JSON.parse(candidate));
82
- if (parsed) return parsed;
83
- } catch {}
84
- }
85
- return {
86
- learning: trimmed,
87
- followUp: false
88
- };
89
- }
90
- /** Tracks last reflection time per session to enforce cooldown. */
91
- const lastReflectionBySession = /* @__PURE__ */ new Map();
92
- /** Maximum cooldown entries before pruning expired ones. */
93
- const MAX_COOLDOWN_ENTRIES = 500;
94
- function legacySanitizeSessionKey(sessionKey) {
95
- return sessionKey.replace(/[^a-zA-Z0-9_-]/g, "_");
96
- }
97
- function encodeSessionKey(sessionKey) {
98
- return Buffer.from(sessionKey, "utf8").toString("base64url");
99
- }
100
- function resolveLearningsFilePath(storePath, sessionKey) {
101
- return `${storePath}/${encodeSessionKey(sessionKey)}.learnings.json`;
102
- }
103
- function resolveLegacyLearningsFilePath(storePath, sessionKey) {
104
- return `${storePath}/${legacySanitizeSessionKey(sessionKey)}.learnings.json`;
105
- }
106
- async function readLearningsFile(filePath) {
107
- try {
108
- const content = await fs.readFile(filePath, "utf-8");
109
- const parsed = JSON.parse(content);
110
- return {
111
- exists: true,
112
- learnings: Array.isArray(parsed) ? parsed : []
113
- };
114
- } catch {
115
- return {
116
- exists: false,
117
- learnings: []
118
- };
119
- }
120
- }
121
- /** Prune expired cooldown entries to prevent unbounded memory growth. */
122
- function pruneExpiredCooldowns(cooldownMs) {
123
- if (lastReflectionBySession.size <= MAX_COOLDOWN_ENTRIES) return;
124
- const now = Date.now();
125
- for (const [key, time] of lastReflectionBySession) if (now - time >= cooldownMs) lastReflectionBySession.delete(key);
126
- }
127
- /** Check if a reflection is allowed (cooldown not active). */
128
- function isReflectionAllowed(sessionKey, cooldownMs) {
129
- const cooldown = cooldownMs ?? 3e5;
130
- const lastTime = lastReflectionBySession.get(sessionKey);
131
- if (lastTime == null) return true;
132
- return Date.now() - lastTime >= cooldown;
133
- }
134
- /** Record that a reflection was run for a session. */
135
- function recordReflectionTime(sessionKey, cooldownMs) {
136
- lastReflectionBySession.set(sessionKey, Date.now());
137
- pruneExpiredCooldowns(cooldownMs ?? 3e5);
138
- }
139
- /** Store a learning derived from feedback reflection in a session companion file. */
140
- async function storeSessionLearning(params) {
141
- const learningsFile = resolveLearningsFilePath(params.storePath, params.sessionKey);
142
- const legacyLearningsFile = resolveLegacyLearningsFilePath(params.storePath, params.sessionKey);
143
- const { exists, learnings: existingLearnings } = await readLearningsFile(learningsFile);
144
- const { learnings: legacyLearnings } = exists || legacyLearningsFile === learningsFile ? { learnings: [] } : await readLearningsFile(legacyLearningsFile);
145
- let learnings = exists ? existingLearnings : legacyLearnings;
146
- learnings.push(params.learning);
147
- if (learnings.length > 10) learnings = learnings.slice(-10);
148
- await fs.mkdir(path.dirname(learningsFile), { recursive: true });
149
- await fs.writeFile(learningsFile, JSON.stringify(learnings, null, 2), "utf-8");
150
- if (!exists && legacyLearningsFile !== learningsFile) await fs.rm(legacyLearningsFile, { force: true }).catch(() => void 0);
151
- }
152
- //#endregion
153
- //#region extensions/msteams/src/feedback-reflection.ts
154
- /**
155
- * Background reflection triggered by negative user feedback (thumbs-down).
156
- *
157
- * Flow:
158
- * 1. User thumbs-down -> invoke handler acks immediately
159
- * 2. This module runs in the background (fire-and-forget)
160
- * 3. Reads recent session context
161
- * 4. Sends a synthetic reflection prompt to the agent
162
- * 5. Stores the derived learning in session
163
- * 6. Optionally sends a proactive follow-up to the user
164
- */
165
- function buildFeedbackEvent(params) {
166
- return {
167
- type: "custom",
168
- event: "feedback",
169
- ts: Date.now(),
170
- messageId: params.messageId,
171
- value: params.value,
172
- comment: params.comment,
173
- sessionKey: params.sessionKey,
174
- agentId: params.agentId,
175
- conversationId: params.conversationId
176
- };
177
- }
178
- function buildReflectionContext(params) {
179
- const core = getMSTeamsRuntime();
180
- const envelopeOptions = core.channel.reply.resolveEnvelopeFormatOptions(params.cfg);
181
- const body = core.channel.reply.formatAgentEnvelope({
182
- channel: "Teams",
183
- from: "system",
184
- body: params.reflectionPrompt,
185
- envelope: envelopeOptions
186
- });
187
- return { ctxPayload: core.channel.reply.finalizeInboundContext({
188
- Body: body,
189
- BodyForAgent: params.reflectionPrompt,
190
- RawBody: params.reflectionPrompt,
191
- CommandBody: params.reflectionPrompt,
192
- From: `msteams:system:${params.conversationId}`,
193
- To: `conversation:${params.conversationId}`,
194
- SessionKey: params.sessionKey,
195
- ChatType: "direct",
196
- SenderName: "system",
197
- SenderId: "system",
198
- Provider: "msteams",
199
- Surface: "msteams",
200
- Timestamp: Date.now(),
201
- WasMentioned: true,
202
- CommandAuthorized: false,
203
- OriginatingChannel: "msteams",
204
- OriginatingTo: `conversation:${params.conversationId}`
205
- }) };
206
- }
207
- function createReflectionCaptureDispatcher(params) {
208
- const core = getMSTeamsRuntime();
209
- let response = "";
210
- const { dispatcher, replyOptions } = core.channel.reply.createReplyDispatcherWithTyping({
211
- deliver: async (payload) => {
212
- if (payload.text) response += (response ? "\n" : "") + payload.text;
213
- },
214
- typingCallbacks: {
215
- onReplyStart: async () => {},
216
- onIdle: () => {},
217
- onCleanup: () => {}
218
- },
219
- humanDelay: core.channel.reply.resolveHumanDelayConfig(params.cfg, params.agentId),
220
- onError: (err) => {
221
- params.log.debug?.("reflection reply error", { error: formatUnknownError(err) });
222
- }
223
- });
224
- return {
225
- dispatcher,
226
- replyOptions,
227
- readResponse: () => response
228
- };
229
- }
230
- async function sendReflectionFollowUp(params) {
231
- const proactiveRef = {
232
- ...buildConversationReference(params.conversationRef),
233
- activityId: void 0
234
- };
235
- await params.adapter.continueConversation(params.appId, proactiveRef, async (ctx) => {
236
- await ctx.sendActivity({
237
- type: "message",
238
- text: params.userMessage
239
- });
240
- });
241
- }
242
- /**
243
- * Run a background reflection after negative feedback.
244
- * This is designed to be called fire-and-forget (don't await in the invoke handler).
245
- */
246
- async function runFeedbackReflection(params) {
247
- const { cfg, log, sessionKey } = params;
248
- const cooldownMs = cfg.channels?.msteams?.feedbackReflectionCooldownMs ?? 3e5;
249
- if (!isReflectionAllowed(sessionKey, cooldownMs)) {
250
- log.debug?.("skipping reflection (cooldown active)", { sessionKey });
251
- return;
252
- }
253
- const reflectionPrompt = buildReflectionPrompt({
254
- thumbedDownResponse: params.thumbedDownResponse,
255
- userComment: params.userComment
256
- });
257
- const storePath = getMSTeamsRuntime().channel.session.resolveStorePath(cfg.session?.store, { agentId: params.agentId });
258
- const { ctxPayload } = buildReflectionContext({
259
- cfg,
260
- conversationId: params.conversationId,
261
- sessionKey: params.sessionKey,
262
- reflectionPrompt
263
- });
264
- const capture = createReflectionCaptureDispatcher({
265
- cfg,
266
- agentId: params.agentId,
267
- log
268
- });
269
- try {
270
- await dispatchReplyFromConfigWithSettledDispatcher({
271
- ctxPayload,
272
- cfg,
273
- dispatcher: capture.dispatcher,
274
- onSettled: () => {},
275
- replyOptions: capture.replyOptions
276
- });
277
- } catch (err) {
278
- log.error("reflection dispatch failed", { error: formatUnknownError(err) });
279
- return;
280
- }
281
- const reflectionResponse = capture.readResponse().trim();
282
- if (!reflectionResponse) {
283
- log.debug?.("reflection produced no output");
284
- return;
285
- }
286
- const parsedReflection = parseReflectionResponse(reflectionResponse);
287
- if (!parsedReflection) {
288
- log.debug?.("reflection produced no structured output");
289
- return;
290
- }
291
- recordReflectionTime(sessionKey, cooldownMs);
292
- log.info("reflection complete", {
293
- sessionKey,
294
- responseLength: reflectionResponse.length,
295
- followUp: parsedReflection.followUp
296
- });
297
- try {
298
- await storeSessionLearning({
299
- storePath,
300
- sessionKey: params.sessionKey,
301
- learning: parsedReflection.learning
302
- });
303
- } catch (err) {
304
- log.debug?.("failed to store reflection learning", { error: formatUnknownError(err) });
305
- }
306
- const conversationType = normalizeOptionalLowercaseString(params.conversationRef.conversation?.conversationType);
307
- if (!(conversationType === "personal" && parsedReflection.followUp && Boolean(parsedReflection.userMessage))) {
308
- if (parsedReflection.followUp && conversationType !== "personal") log.debug?.("skipping reflection follow-up outside direct message", {
309
- sessionKey,
310
- conversationType
311
- });
312
- return;
313
- }
314
- try {
315
- await sendReflectionFollowUp({
316
- adapter: params.adapter,
317
- appId: params.appId,
318
- conversationRef: params.conversationRef,
319
- userMessage: parsedReflection.userMessage
320
- });
321
- log.info("sent reflection follow-up", { sessionKey });
322
- } catch (err) {
323
- log.debug?.("failed to send reflection follow-up", { error: formatUnknownError(err) });
324
- }
325
- }
326
- //#endregion
327
- //#region extensions/msteams/src/inbound.ts
328
- /**
329
- * Decode common HTML entities to plain text.
330
- */
331
- function decodeHtmlEntities(html) {
332
- return html.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, "\"").replace(/&#39;/g, "'").replace(/&#x27;/g, "'").replace(/&nbsp;/g, " ").replace(/&amp;/g, "&");
333
- }
334
- /**
335
- * Strip HTML tags, preserving text content.
336
- */
337
- function htmlToPlainText(html) {
338
- return decodeHtmlEntities(html.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim());
339
- }
340
- /**
341
- * Extract quote info from MS Teams HTML reply attachments.
342
- * Teams wraps quoted content in a blockquote with itemtype="http://schema.skype.com/Reply".
343
- */
344
- function extractMSTeamsQuoteInfo(attachments) {
345
- for (const att of attachments) {
346
- let content = "";
347
- if (typeof att.content === "string") content = att.content;
348
- else if (typeof att.content === "object" && att.content !== null) {
349
- const record = att.content;
350
- content = typeof record.text === "string" ? record.text : typeof record.body === "string" ? record.body : "";
351
- }
352
- if (!content) continue;
353
- if (!content.includes("http://schema.skype.com/Reply")) continue;
354
- const senderMatch = /<strong[^>]*itemprop=["']mri["'][^>]*>(.*?)<\/strong>/i.exec(content);
355
- const sender = senderMatch?.[1] ? htmlToPlainText(senderMatch[1]) : void 0;
356
- const bodyMatch = /<p[^>]*itemprop=["']copy["'][^>]*>(.*?)<\/p>/is.exec(content);
357
- const body = bodyMatch?.[1] ? htmlToPlainText(bodyMatch[1]) : void 0;
358
- if (body) return {
359
- sender: sender ?? "unknown",
360
- body
361
- };
362
- }
363
- }
364
- function normalizeMSTeamsConversationId(raw) {
365
- return raw.split(";")[0] ?? raw;
366
- }
367
- function extractMSTeamsConversationMessageId(raw) {
368
- if (!raw) return;
369
- return (/(?:^|;)messageid=([^;]+)/i.exec(raw)?.[1]?.trim() ?? "") || void 0;
370
- }
371
- function parseMSTeamsActivityTimestamp(value) {
372
- if (!value) return;
373
- if (value instanceof Date) return value;
374
- if (typeof value !== "string") return;
375
- const date = new Date(value);
376
- return Number.isNaN(date.getTime()) ? void 0 : date;
377
- }
378
- function stripMSTeamsMentionTags(text) {
379
- return text.replace(/<at[^>]*>.*?<\/at>/gi, "").trim();
380
- }
381
- /**
382
- * Bot Framework uses 'a:xxx' conversation IDs for personal chats, but Graph API
383
- * requires the '19:{userId}_{botAppId}@unq.gbl.spaces' format.
384
- *
385
- * This is the documented Graph API format for 1:1 chat thread IDs between a user
386
- * and a bot/app. See Microsoft docs "Get chat between user and app":
387
- * https://learn.microsoft.com/en-us/graph/api/userscopeteamsappinstallation-get-chat
388
- *
389
- * The format is only synthesized when the Bot Framework conversation ID starts with
390
- * 'a:' (the opaque format used by BF but not recognized by Graph). If the ID already
391
- * has the '19:...' Graph format, it is passed through unchanged.
392
- */
393
- function translateMSTeamsDmConversationIdForGraph(params) {
394
- const { isDirectMessage, conversationId, aadObjectId, appId } = params;
395
- return isDirectMessage && conversationId.startsWith("a:") && aadObjectId && appId ? `19:${aadObjectId}_${appId}@unq.gbl.spaces` : conversationId;
396
- }
397
- function wasMSTeamsBotMentioned(activity) {
398
- const botId = activity.recipient?.id;
399
- if (!botId) return false;
400
- return (activity.entities ?? []).some((e) => e.type === "mention" && e.mentioned?.id === botId);
401
- }
402
- //#endregion
403
- //#region extensions/msteams/src/file-consent-invoke.ts
404
- /**
405
- * Handle fileConsent/invoke activities for large file uploads.
406
- */
407
- async function handleMSTeamsFileConsentInvoke(context, log) {
408
- const expiredUploadMessage = "The file upload request has expired. Please try sending the file again.";
409
- const activity = context.activity;
410
- if (activity.type !== "invoke" || activity.name !== "fileConsent/invoke") return false;
411
- const consentResponse = parseFileConsentInvoke(activity);
412
- if (!consentResponse) {
413
- log.debug?.("invalid file consent invoke", { value: activity.value });
414
- return false;
415
- }
416
- const uploadId = typeof consentResponse.context?.uploadId === "string" ? consentResponse.context.uploadId : void 0;
417
- const inMemoryFile = getPendingUpload(uploadId);
418
- const fsFile = inMemoryFile ? void 0 : await getPendingUploadFs(uploadId);
419
- const pendingFile = inMemoryFile ?? fsFile;
420
- if (pendingFile) {
421
- const pendingConversationId = normalizeMSTeamsConversationId(pendingFile.conversationId);
422
- const invokeConversationId = normalizeMSTeamsConversationId(activity.conversation?.id ?? "");
423
- if (!invokeConversationId || pendingConversationId !== invokeConversationId) {
424
- log.info("file consent conversation mismatch", {
425
- uploadId,
426
- expectedConversationId: pendingConversationId,
427
- receivedConversationId: invokeConversationId || void 0
428
- });
429
- if (consentResponse.action === "accept") await context.sendActivity(expiredUploadMessage);
430
- return true;
431
- }
432
- }
433
- if (consentResponse.action === "accept" && consentResponse.uploadInfo) if (pendingFile) {
434
- log.debug?.("user accepted file consent, uploading", {
435
- uploadId,
436
- filename: pendingFile.filename,
437
- size: pendingFile.buffer.length
438
- });
439
- try {
440
- await uploadToConsentUrl({
441
- url: consentResponse.uploadInfo.uploadUrl,
442
- buffer: pendingFile.buffer,
443
- contentType: pendingFile.contentType
444
- });
445
- const fileInfoCard = buildFileInfoCard({
446
- filename: consentResponse.uploadInfo.name,
447
- contentUrl: consentResponse.uploadInfo.contentUrl,
448
- uniqueId: consentResponse.uploadInfo.uniqueId,
449
- fileType: consentResponse.uploadInfo.fileType
450
- });
451
- if (!pendingFile.consentCardActivityId) await context.sendActivity({
452
- type: "message",
453
- attachments: [fileInfoCard]
454
- });
455
- if (pendingFile.consentCardActivityId) try {
456
- await context.updateActivity({
457
- id: pendingFile.consentCardActivityId,
458
- type: "message",
459
- attachments: [fileInfoCard]
460
- });
461
- } catch {
462
- await context.sendActivity({
463
- type: "message",
464
- attachments: [fileInfoCard]
465
- });
466
- }
467
- log.info("file upload complete", {
468
- uploadId,
469
- filename: consentResponse.uploadInfo.name,
470
- uniqueId: consentResponse.uploadInfo.uniqueId
471
- });
472
- } catch (err) {
473
- log.error("file upload failed", {
474
- uploadId,
475
- error: formatUnknownError(err)
476
- });
477
- await context.sendActivity("File upload failed. Please try again.");
478
- } finally {
479
- removePendingUpload(uploadId);
480
- await removePendingUploadFs(uploadId);
481
- }
482
- } else {
483
- log.debug?.("pending file not found for consent", { uploadId });
484
- await context.sendActivity(expiredUploadMessage);
485
- }
486
- else {
487
- log.debug?.("user declined file consent", { uploadId });
488
- removePendingUpload(uploadId);
489
- await removePendingUploadFs(uploadId);
490
- }
491
- return true;
492
- }
493
- async function respondToMSTeamsFileConsentInvoke(context, log) {
494
- await context.sendActivity({
495
- type: "invokeResponse",
496
- value: { status: 200 }
497
- });
498
- try {
499
- await withRevokedProxyFallback({
500
- run: async () => await handleMSTeamsFileConsentInvoke(context, log),
501
- onRevoked: async () => true,
502
- onRevokedLog: () => {
503
- log.debug?.("turn context revoked during file consent invoke; skipping delayed response");
504
- }
505
- });
506
- } catch (err) {
507
- log.debug?.("file consent handler error", { error: formatUnknownError(err) });
508
- }
509
- }
510
- //#endregion
511
- //#region extensions/msteams/src/monitor-handler/access.ts
512
- async function resolveMSTeamsSenderAccess(params) {
513
- const activity = params.activity;
514
- const msteamsCfg = params.cfg.channels?.msteams;
515
- const conversationId = normalizeMSTeamsConversationId(activity.conversation?.id ?? "unknown");
516
- const convType = normalizeOptionalLowercaseString(activity.conversation?.conversationType);
517
- const isDirectMessage = convType === "personal" || !convType && !activity.conversation?.isGroup;
518
- const senderId = activity.from?.aadObjectId ?? activity.from?.id ?? "unknown";
519
- const senderName = activity.from?.name ?? activity.from?.id ?? senderId;
520
- const pairing = createChannelPairingController({
521
- core: getMSTeamsRuntime(),
522
- channel: "msteams",
523
- accountId: DEFAULT_ACCOUNT_ID
524
- });
525
- const dmPolicy = msteamsCfg?.dmPolicy ?? "pairing";
526
- const storedAllowFrom = await readStoreAllowFromForDmPolicy({
527
- provider: "msteams",
528
- accountId: pairing.accountId,
529
- dmPolicy,
530
- readStore: pairing.readStoreForDmPolicy
531
- });
532
- const configuredDmAllowFrom = msteamsCfg?.allowFrom ?? [];
533
- const groupAllowFrom = msteamsCfg?.groupAllowFrom;
534
- const resolvedAllowFromLists = resolveEffectiveAllowFromLists({
535
- allowFrom: configuredDmAllowFrom,
536
- groupAllowFrom,
537
- storeAllowFrom: storedAllowFrom,
538
- dmPolicy
539
- });
540
- const defaultGroupPolicy = resolveDefaultGroupPolicy(params.cfg);
541
- const groupPolicy = !isDirectMessage && msteamsCfg ? msteamsCfg.groupPolicy ?? defaultGroupPolicy ?? "allowlist" : "disabled";
542
- const effectiveGroupAllowFrom = resolvedAllowFromLists.effectiveGroupAllowFrom;
543
- const allowNameMatching = isDangerousNameMatchingEnabled(msteamsCfg);
544
- const channelGate = resolveMSTeamsRouteConfig({
545
- cfg: msteamsCfg,
546
- teamId: activity.channelData?.team?.id,
547
- teamName: activity.channelData?.team?.name,
548
- conversationId,
549
- channelName: activity.channelData?.channel?.name,
550
- allowNameMatching
551
- });
552
- const senderGroupPolicy = channelGate.allowlistConfigured && effectiveGroupAllowFrom.length === 0 ? groupPolicy : resolveSenderScopedGroupPolicy({
553
- groupPolicy,
554
- groupAllowFrom: effectiveGroupAllowFrom
555
- });
556
- const access = resolveDmGroupAccessWithLists({
557
- isGroup: !isDirectMessage,
558
- dmPolicy,
559
- groupPolicy: senderGroupPolicy,
560
- allowFrom: configuredDmAllowFrom,
561
- groupAllowFrom,
562
- storeAllowFrom: storedAllowFrom,
563
- groupAllowFromFallbackToAllowFrom: false,
564
- isSenderAllowed: (allowFrom) => resolveMSTeamsAllowlistMatch({
565
- allowFrom,
566
- senderId,
567
- senderName,
568
- allowNameMatching
569
- }).allowed
570
- });
571
- return {
572
- msteamsCfg,
573
- pairing,
574
- isDirectMessage,
575
- conversationId,
576
- senderId,
577
- senderName,
578
- dmPolicy,
579
- channelGate,
580
- access,
581
- senderGroupAccess: evaluateSenderGroupAccessForPolicy({
582
- groupPolicy,
583
- groupAllowFrom: effectiveGroupAllowFrom,
584
- senderId,
585
- isSenderAllowed: (_senderId, allowFrom) => resolveMSTeamsAllowlistMatch({
586
- allowFrom,
587
- senderId,
588
- senderName,
589
- allowNameMatching
590
- }).allowed
591
- }),
592
- configuredDmAllowFrom,
593
- effectiveDmAllowFrom: access.effectiveAllowFrom,
594
- effectiveGroupAllowFrom,
595
- allowNameMatching,
596
- groupPolicy
597
- };
598
- }
599
- //#endregion
600
- //#region extensions/msteams/src/attachments/bot-framework.ts
601
- /**
602
- * Bot Framework Service token scope for requesting a token used against
603
- * the Bot Connector (v3) REST endpoints such as `/v3/attachments/{id}`.
604
- */
605
- const BOT_FRAMEWORK_SCOPE = "https://api.botframework.com";
606
- /**
607
- * Detect Bot Framework personal chat ("a:") and MSA orgid ("8:orgid:") conversation
608
- * IDs. These identifiers are not recognized by Graph's `/chats/{id}` endpoint, so we
609
- * must fetch media via the Bot Framework v3 attachments endpoint instead.
610
- *
611
- * Graph-compatible IDs start with `19:` and are left untouched by this detector.
612
- */
613
- function isBotFrameworkPersonalChatId(conversationId) {
614
- if (typeof conversationId !== "string") return false;
615
- const trimmed = conversationId.trim();
616
- return trimmed.startsWith("a:") || trimmed.startsWith("8:orgid:");
617
- }
618
- function normalizeServiceUrl(serviceUrl) {
619
- return serviceUrl.replace(/\/+$/, "");
620
- }
621
- async function fetchBotFrameworkAttachmentInfo(params) {
622
- const url = `${normalizeServiceUrl(params.serviceUrl)}/v3/attachments/${encodeURIComponent(params.attachmentId)}`;
623
- let response;
624
- try {
625
- response = await safeFetchWithPolicy({
626
- url,
627
- policy: params.policy,
628
- fetchFn: params.fetchFn,
629
- resolveFn: params.resolveFn,
630
- requestInit: { headers: ensureUserAgentHeader({ Authorization: `Bearer ${params.accessToken}` }) }
631
- });
632
- } catch (err) {
633
- params.logger?.warn?.("msteams botFramework attachmentInfo fetch failed", { error: err instanceof Error ? err.message : String(err) });
634
- return;
635
- }
636
- if (!response.ok) {
637
- params.logger?.warn?.("msteams botFramework attachmentInfo non-ok", { status: response.status });
638
- return;
639
- }
640
- try {
641
- return await response.json();
642
- } catch (err) {
643
- params.logger?.warn?.("msteams botFramework attachmentInfo parse failed", { error: err instanceof Error ? err.message : String(err) });
644
- return;
645
- }
646
- }
647
- async function fetchBotFrameworkAttachmentView(params) {
648
- const url = `${normalizeServiceUrl(params.serviceUrl)}/v3/attachments/${encodeURIComponent(params.attachmentId)}/views/${encodeURIComponent(params.viewId)}`;
649
- let response;
650
- try {
651
- response = await safeFetchWithPolicy({
652
- url,
653
- policy: params.policy,
654
- fetchFn: params.fetchFn,
655
- resolveFn: params.resolveFn,
656
- requestInit: { headers: ensureUserAgentHeader({ Authorization: `Bearer ${params.accessToken}` }) }
657
- });
658
- } catch (err) {
659
- params.logger?.warn?.("msteams botFramework attachmentView fetch failed", { error: err instanceof Error ? err.message : String(err) });
660
- return;
661
- }
662
- if (!response.ok) {
663
- params.logger?.warn?.("msteams botFramework attachmentView non-ok", { status: response.status });
664
- return;
665
- }
666
- const contentLength = response.headers.get("content-length");
667
- if (contentLength && Number(contentLength) > params.maxBytes) return;
668
- try {
669
- const arrayBuffer = await response.arrayBuffer();
670
- const buffer = Buffer$1.from(arrayBuffer);
671
- if (buffer.byteLength > params.maxBytes) return;
672
- return buffer;
673
- } catch (err) {
674
- params.logger?.warn?.("msteams botFramework attachmentView body read failed", { error: err instanceof Error ? err.message : String(err) });
675
- return;
676
- }
677
- }
678
- /**
679
- * Download media for a single attachment via the Bot Framework v3 attachments
680
- * endpoint. Used for personal DM conversations where the Graph `/chats/{id}`
681
- * path is not usable because the Bot Framework conversation ID (`a:...`) is
682
- * not a valid Graph chat identifier.
683
- */
684
- async function downloadMSTeamsBotFrameworkAttachment(params) {
685
- if (!params.serviceUrl || !params.attachmentId || !params.tokenProvider) return;
686
- const policy = resolveAttachmentFetchPolicy({
687
- allowHosts: params.allowHosts,
688
- authAllowHosts: params.authAllowHosts
689
- });
690
- if (!isUrlAllowed(`${normalizeServiceUrl(params.serviceUrl)}/v3/attachments/${encodeURIComponent(params.attachmentId)}`, policy.allowHosts)) return;
691
- let accessToken;
692
- try {
693
- accessToken = await params.tokenProvider.getAccessToken(BOT_FRAMEWORK_SCOPE);
694
- } catch (err) {
695
- params.logger?.warn?.("msteams botFramework token acquisition failed", { error: err instanceof Error ? err.message : String(err) });
696
- return;
697
- }
698
- if (!accessToken) return;
699
- const info = await fetchBotFrameworkAttachmentInfo({
700
- serviceUrl: params.serviceUrl,
701
- attachmentId: params.attachmentId,
702
- accessToken,
703
- policy,
704
- fetchFn: params.fetchFn,
705
- resolveFn: params.resolveFn,
706
- logger: params.logger
707
- });
708
- if (!info) return;
709
- const views = Array.isArray(info.views) ? info.views : [];
710
- const candidateView = views.find((view) => view?.viewId === "original") ?? views.find((view) => typeof view?.viewId === "string");
711
- const viewId = typeof candidateView?.viewId === "string" && candidateView.viewId ? candidateView.viewId : void 0;
712
- if (!viewId) return;
713
- if (typeof candidateView?.size === "number" && candidateView.size > 0 && candidateView.size > params.maxBytes) return;
714
- const buffer = await fetchBotFrameworkAttachmentView({
715
- serviceUrl: params.serviceUrl,
716
- attachmentId: params.attachmentId,
717
- viewId,
718
- accessToken,
719
- maxBytes: params.maxBytes,
720
- policy,
721
- fetchFn: params.fetchFn,
722
- resolveFn: params.resolveFn,
723
- logger: params.logger
724
- });
725
- if (!buffer) return;
726
- const fileNameHint = typeof params.fileNameHint === "string" && params.fileNameHint || typeof info.name === "string" && info.name || void 0;
727
- const contentTypeHint = typeof params.contentTypeHint === "string" && params.contentTypeHint || typeof info.type === "string" && info.type || void 0;
728
- const mime = await getMSTeamsRuntime().media.detectMime({
729
- buffer,
730
- headerMime: contentTypeHint,
731
- filePath: fileNameHint
732
- });
733
- try {
734
- const originalFilename = params.preserveFilenames ? fileNameHint : void 0;
735
- const saved = await getMSTeamsRuntime().channel.media.saveMediaBuffer(buffer, mime ?? contentTypeHint, "inbound", params.maxBytes, originalFilename);
736
- return {
737
- path: saved.path,
738
- contentType: saved.contentType,
739
- placeholder: inferPlaceholder({
740
- contentType: saved.contentType,
741
- fileName: fileNameHint
742
- })
743
- };
744
- } catch (err) {
745
- params.logger?.warn?.("msteams botFramework save failed", { error: err instanceof Error ? err.message : String(err) });
746
- return;
747
- }
748
- }
749
- /**
750
- * Download media for every attachment referenced by a Bot Framework personal
751
- * chat activity. Returns all successfully fetched media along with diagnostics
752
- * compatible with `downloadMSTeamsGraphMedia`'s result shape so callers can
753
- * reuse the existing logging path.
754
- */
755
- async function downloadMSTeamsBotFrameworkAttachments(params) {
756
- const seen = /* @__PURE__ */ new Set();
757
- const unique = [];
758
- for (const id of params.attachmentIds ?? []) {
759
- if (typeof id !== "string") continue;
760
- const trimmed = id.trim();
761
- if (!trimmed || seen.has(trimmed)) continue;
762
- seen.add(trimmed);
763
- unique.push(trimmed);
764
- }
765
- if (unique.length === 0 || !params.serviceUrl || !params.tokenProvider) return {
766
- media: [],
767
- attachmentCount: unique.length
768
- };
769
- const media = [];
770
- for (const attachmentId of unique) try {
771
- const item = await downloadMSTeamsBotFrameworkAttachment({
772
- serviceUrl: params.serviceUrl,
773
- attachmentId,
774
- tokenProvider: params.tokenProvider,
775
- maxBytes: params.maxBytes,
776
- allowHosts: params.allowHosts,
777
- authAllowHosts: params.authAllowHosts,
778
- fetchFn: params.fetchFn,
779
- resolveFn: params.resolveFn,
780
- fileNameHint: params.fileNameHint,
781
- contentTypeHint: params.contentTypeHint,
782
- preserveFilenames: params.preserveFilenames,
783
- logger: params.logger
784
- });
785
- if (item) media.push(item);
786
- } catch (err) {
787
- params.logger?.warn?.("msteams botFramework attachment download failed", {
788
- error: err instanceof Error ? err.message : String(err),
789
- attachmentId
790
- });
791
- }
792
- return {
793
- media,
794
- attachmentCount: unique.length
795
- };
796
- }
797
- //#endregion
798
- //#region extensions/msteams/src/attachments/remote-media.ts
799
- /**
800
- * Direct fetch path used when the caller's `fetchImpl` has already validated
801
- * the URL against a hostname allowlist (for example `safeFetchWithPolicy`).
802
- *
803
- * Bypasses the strict SSRF dispatcher on `fetchRemoteMedia` because:
804
- * 1. The pinned undici dispatcher used by `fetchRemoteMedia` is incompatible
805
- * with Node 24+'s built-in undici v7 (fails with "invalid onRequestStart
806
- * method"), which silently breaks SharePoint/OneDrive downloads. See
807
- * issue #63396.
808
- * 2. SSRF protection is already enforced by the caller's `fetchImpl`
809
- * (`safeFetch` validates every redirect hop against the hostname
810
- * allowlist before following).
811
- */
812
- async function fetchRemoteMediaDirect(params) {
813
- const response = await params.fetchImpl(params.url, { redirect: "follow" });
814
- if (!response.ok) {
815
- const statusText = response.statusText ? ` ${response.statusText}` : "";
816
- throw new Error(`HTTP ${response.status}${statusText}`);
817
- }
818
- const contentLength = response.headers.get("content-length");
819
- if (contentLength) {
820
- const length = Number(contentLength);
821
- if (Number.isFinite(length) && length > params.maxBytes) throw new Error(`content length ${length} exceeds maxBytes ${params.maxBytes}`);
822
- }
823
- return {
824
- buffer: await readResponseWithLimit(response, params.maxBytes, { onOverflow: ({ size, maxBytes }) => /* @__PURE__ */ new Error(`payload size ${size} exceeds maxBytes ${maxBytes}`) }),
825
- contentType: response.headers.get("content-type") ?? void 0
826
- };
827
- }
828
- async function downloadAndStoreMSTeamsRemoteMedia(params) {
829
- let fetched;
830
- if (params.useDirectFetch && params.fetchImpl) fetched = await fetchRemoteMediaDirect({
831
- url: params.url,
832
- fetchImpl: params.fetchImpl,
833
- maxBytes: params.maxBytes
834
- });
835
- else fetched = await getMSTeamsRuntime().channel.media.fetchRemoteMedia({
836
- url: params.url,
837
- fetchImpl: params.fetchImpl,
838
- filePathHint: params.filePathHint,
839
- maxBytes: params.maxBytes,
840
- ssrfPolicy: params.ssrfPolicy
841
- });
842
- const mime = await getMSTeamsRuntime().media.detectMime({
843
- buffer: fetched.buffer,
844
- headerMime: fetched.contentType ?? params.contentTypeHint,
845
- filePath: params.filePathHint
846
- });
847
- const originalFilename = params.preserveFilenames ? params.filePathHint : void 0;
848
- const saved = await getMSTeamsRuntime().channel.media.saveMediaBuffer(fetched.buffer, mime ?? params.contentTypeHint, "inbound", params.maxBytes, originalFilename);
849
- return {
850
- path: saved.path,
851
- contentType: saved.contentType,
852
- placeholder: params.placeholder ?? inferPlaceholder({
853
- contentType: saved.contentType,
854
- fileName: params.filePathHint
855
- })
856
- };
857
- }
858
- //#endregion
859
- //#region extensions/msteams/src/attachments/download.ts
860
- function resolveDownloadCandidate(att) {
861
- const contentType = normalizeContentType(att.contentType);
862
- const name = normalizeOptionalString(att.name) ?? "";
863
- if (contentType === "application/vnd.microsoft.teams.file.download.info") {
864
- if (!isRecord(att.content)) return null;
865
- const downloadUrl = normalizeOptionalString(att.content.downloadUrl) ?? "";
866
- if (!downloadUrl) return null;
867
- const fileType = normalizeOptionalString(att.content.fileType) ?? "";
868
- const uniqueId = normalizeOptionalString(att.content.uniqueId) ?? "";
869
- const fileName = normalizeOptionalString(att.content.fileName) ?? "";
870
- const fileHint = name || fileName || (uniqueId && fileType ? `${uniqueId}.${fileType}` : "");
871
- return {
872
- url: downloadUrl,
873
- fileHint: fileHint || void 0,
874
- contentTypeHint: void 0,
875
- placeholder: inferPlaceholder({
876
- contentType,
877
- fileName: fileHint,
878
- fileType
879
- })
880
- };
881
- }
882
- const contentUrl = normalizeOptionalString(att.contentUrl) ?? "";
883
- if (!contentUrl) return null;
884
- const sharesUrl = tryBuildGraphSharesUrlForSharedLink(contentUrl);
885
- return {
886
- url: sharesUrl ?? contentUrl,
887
- fileHint: name || void 0,
888
- contentTypeHint: sharesUrl ? void 0 : contentType,
889
- placeholder: inferPlaceholder({
890
- contentType,
891
- fileName: name
892
- })
893
- };
894
- }
895
- function scopeCandidatesForUrl(url) {
896
- try {
897
- const host = normalizeLowercaseStringOrEmpty(new URL(url).hostname);
898
- return host.endsWith("graph.microsoft.com") || host.endsWith("sharepoint.com") || host.endsWith("1drv.ms") || host.includes("sharepoint") ? ["https://graph.microsoft.com", "https://api.botframework.com"] : ["https://api.botframework.com", "https://graph.microsoft.com"];
899
- } catch {
900
- return ["https://api.botframework.com", "https://graph.microsoft.com"];
901
- }
902
- }
903
- function isRedirectStatus(status) {
904
- return status === 301 || status === 302 || status === 303 || status === 307 || status === 308;
905
- }
906
- async function fetchWithAuthFallback(params) {
907
- const firstAttempt = await safeFetchWithPolicy({
908
- url: params.url,
909
- policy: params.policy,
910
- fetchFn: params.fetchFn,
911
- requestInit: params.requestInit,
912
- resolveFn: params.resolveFn
913
- });
914
- if (firstAttempt.ok) return firstAttempt;
915
- if (!params.tokenProvider) return firstAttempt;
916
- if (firstAttempt.status !== 401 && firstAttempt.status !== 403) return firstAttempt;
917
- if (!isUrlAllowed(params.url, params.policy.authAllowHosts)) return firstAttempt;
918
- const scopes = scopeCandidatesForUrl(params.url);
919
- const fetchFn = params.fetchFn ?? fetch;
920
- for (const scope of scopes) try {
921
- const token = await params.tokenProvider.getAccessToken(scope);
922
- const authHeaders = new Headers(params.requestInit?.headers);
923
- authHeaders.set("Authorization", `Bearer ${token}`);
924
- const authAttempt = await safeFetchWithPolicy({
925
- url: params.url,
926
- policy: params.policy,
927
- fetchFn,
928
- requestInit: {
929
- ...params.requestInit,
930
- headers: authHeaders
931
- },
932
- resolveFn: params.resolveFn
933
- });
934
- if (authAttempt.ok) return authAttempt;
935
- if (isRedirectStatus(authAttempt.status)) return authAttempt;
936
- if (authAttempt.status !== 401 && authAttempt.status !== 403) continue;
937
- } catch {}
938
- return firstAttempt;
939
- }
940
- /**
941
- * Download all file attachments from a Teams message (images, documents, etc.).
942
- * Renamed from downloadMSTeamsImageAttachments to support all file types.
943
- */
944
- async function downloadMSTeamsAttachments(params) {
945
- const list = Array.isArray(params.attachments) ? params.attachments : [];
946
- if (list.length === 0) return [];
947
- const policy = resolveAttachmentFetchPolicy({
948
- allowHosts: params.allowHosts,
949
- authAllowHosts: params.authAllowHosts
950
- });
951
- const allowHosts = policy.allowHosts;
952
- const ssrfPolicy = resolveMediaSsrfPolicy(allowHosts);
953
- const candidates = list.filter(isDownloadableAttachment).map(resolveDownloadCandidate).filter(Boolean);
954
- const inlineCandidates = extractInlineImageCandidates(list, {
955
- maxInlineBytes: params.maxBytes,
956
- maxInlineTotalBytes: params.maxBytes
957
- });
958
- const seenUrls = /* @__PURE__ */ new Set();
959
- for (const inline of inlineCandidates) if (inline.kind === "url") {
960
- if (!isUrlAllowed(inline.url, allowHosts)) continue;
961
- if (seenUrls.has(inline.url)) continue;
962
- seenUrls.add(inline.url);
963
- candidates.push({
964
- url: inline.url,
965
- fileHint: inline.fileHint,
966
- contentTypeHint: inline.contentType,
967
- placeholder: inline.placeholder
968
- });
969
- }
970
- if (candidates.length === 0 && inlineCandidates.length === 0) return [];
971
- const out = [];
972
- for (const inline of inlineCandidates) {
973
- if (inline.kind !== "data") continue;
974
- if (inline.data.byteLength > params.maxBytes) continue;
975
- try {
976
- const saved = await getMSTeamsRuntime().channel.media.saveMediaBuffer(inline.data, inline.contentType, "inbound", params.maxBytes);
977
- out.push({
978
- path: saved.path,
979
- contentType: saved.contentType,
980
- placeholder: inline.placeholder
981
- });
982
- } catch (err) {
983
- params.logger?.warn?.("msteams inline attachment decode failed", { error: err instanceof Error ? err.message : String(err) });
984
- }
985
- }
986
- for (const candidate of candidates) {
987
- if (!isUrlAllowed(candidate.url, allowHosts)) continue;
988
- try {
989
- const media = await downloadAndStoreMSTeamsRemoteMedia({
990
- url: candidate.url,
991
- filePathHint: candidate.fileHint ?? candidate.url,
992
- maxBytes: params.maxBytes,
993
- contentTypeHint: candidate.contentTypeHint,
994
- placeholder: candidate.placeholder,
995
- preserveFilenames: params.preserveFilenames,
996
- ssrfPolicy,
997
- useDirectFetch: true,
998
- fetchImpl: (input, init) => fetchWithAuthFallback({
999
- url: resolveRequestUrl(input),
1000
- tokenProvider: params.tokenProvider,
1001
- fetchFn: params.fetchFn,
1002
- requestInit: init,
1003
- resolveFn: params.resolveFn,
1004
- policy
1005
- })
1006
- });
1007
- out.push(media);
1008
- } catch (err) {
1009
- params.logger?.warn?.("msteams attachment download failed", {
1010
- error: err instanceof Error ? err.message : String(err),
1011
- host: safeHostForLog(candidate.url)
1012
- });
1013
- }
1014
- }
1015
- return out;
1016
- }
1017
- function safeHostForLog(url) {
1018
- try {
1019
- return new URL(url).host;
1020
- } catch {
1021
- return "invalid-url";
1022
- }
1023
- }
1024
- //#endregion
1025
- //#region extensions/msteams/src/attachments/graph.ts
1026
- function buildMSTeamsGraphMessageUrls(params) {
1027
- const conversationType = normalizeLowercaseStringOrEmpty(params.conversationType ?? "");
1028
- const messageIdCandidates = /* @__PURE__ */ new Set();
1029
- const pushCandidate = (value) => {
1030
- const trimmed = normalizeOptionalString(value) ?? "";
1031
- if (trimmed) messageIdCandidates.add(trimmed);
1032
- };
1033
- pushCandidate(params.messageId);
1034
- pushCandidate(params.conversationMessageId);
1035
- pushCandidate(readNestedString(params.channelData, ["messageId"]));
1036
- pushCandidate(readNestedString(params.channelData, ["teamsMessageId"]));
1037
- const replyToId = normalizeOptionalString(params.replyToId) ?? "";
1038
- if (conversationType === "channel") {
1039
- const teamId = readNestedString(params.channelData, ["team", "id"]) ?? readNestedString(params.channelData, ["teamId"]);
1040
- const channelId = readNestedString(params.channelData, ["channel", "id"]) ?? readNestedString(params.channelData, ["channelId"]) ?? readNestedString(params.channelData, ["teamsChannelId"]);
1041
- if (!teamId || !channelId) return [];
1042
- const urls = [];
1043
- if (replyToId) for (const candidate of messageIdCandidates) {
1044
- if (candidate === replyToId) continue;
1045
- urls.push(`${GRAPH_ROOT}/teams/${encodeURIComponent(teamId)}/channels/${encodeURIComponent(channelId)}/messages/${encodeURIComponent(replyToId)}/replies/${encodeURIComponent(candidate)}`);
1046
- }
1047
- if (messageIdCandidates.size === 0 && replyToId) messageIdCandidates.add(replyToId);
1048
- for (const candidate of messageIdCandidates) urls.push(`${GRAPH_ROOT}/teams/${encodeURIComponent(teamId)}/channels/${encodeURIComponent(channelId)}/messages/${encodeURIComponent(candidate)}`);
1049
- return Array.from(new Set(urls));
1050
- }
1051
- const chatId = params.conversationId?.trim() || readNestedString(params.channelData, ["chatId"]);
1052
- if (!chatId) return [];
1053
- if (messageIdCandidates.size === 0 && replyToId) messageIdCandidates.add(replyToId);
1054
- const urls = Array.from(messageIdCandidates).map((candidate) => `${GRAPH_ROOT}/chats/${encodeURIComponent(chatId)}/messages/${encodeURIComponent(candidate)}`);
1055
- return Array.from(new Set(urls));
1056
- }
1057
- async function fetchGraphCollection(params) {
1058
- const fetchFn = params.fetchFn ?? fetch;
1059
- const { response, release } = await fetchWithSsrFGuard({
1060
- url: params.url,
1061
- fetchImpl: fetchFn,
1062
- init: { headers: ensureUserAgentHeader({ Authorization: `Bearer ${params.accessToken}` }) },
1063
- policy: params.ssrfPolicy,
1064
- auditContext: "msteams.graph.collection"
1065
- });
1066
- try {
1067
- const status = response.status;
1068
- if (!response.ok) return {
1069
- status,
1070
- items: []
1071
- };
1072
- try {
1073
- const data = await response.json();
1074
- return {
1075
- status,
1076
- items: Array.isArray(data.value) ? data.value : []
1077
- };
1078
- } catch {
1079
- return {
1080
- status,
1081
- items: []
1082
- };
1083
- }
1084
- } finally {
1085
- await release();
1086
- }
1087
- }
1088
- function normalizeGraphAttachment(att) {
1089
- let content = att.content;
1090
- if (typeof content === "string") try {
1091
- content = JSON.parse(content);
1092
- } catch {}
1093
- return {
1094
- contentType: normalizeContentType(att.contentType) ?? void 0,
1095
- contentUrl: att.contentUrl ?? void 0,
1096
- name: att.name ?? void 0,
1097
- thumbnailUrl: att.thumbnailUrl ?? void 0,
1098
- content
1099
- };
1100
- }
1101
- /**
1102
- * Download all hosted content from a Teams message (images, documents, etc.).
1103
- * Renamed from downloadGraphHostedImages to support all file types.
1104
- */
1105
- async function downloadGraphHostedContent(params) {
1106
- const hosted = await fetchGraphCollection({
1107
- url: `${params.messageUrl}/hostedContents`,
1108
- accessToken: params.accessToken,
1109
- fetchFn: params.fetchFn,
1110
- ssrfPolicy: params.ssrfPolicy
1111
- });
1112
- if (hosted.items.length === 0) return {
1113
- media: [],
1114
- status: hosted.status,
1115
- count: 0
1116
- };
1117
- const out = [];
1118
- for (const item of hosted.items) {
1119
- const contentBytes = typeof item.contentBytes === "string" ? item.contentBytes : "";
1120
- let buffer;
1121
- if (contentBytes) {
1122
- if (estimateBase64DecodedBytes(contentBytes) > params.maxBytes) continue;
1123
- try {
1124
- buffer = Buffer.from(contentBytes, "base64");
1125
- } catch (err) {
1126
- params.logger?.warn?.("msteams graph hostedContent base64 decode failed", { error: err instanceof Error ? err.message : String(err) });
1127
- continue;
1128
- }
1129
- } else if (item.id) try {
1130
- const { response: valRes, release } = await fetchWithSsrFGuard({
1131
- url: `${params.messageUrl}/hostedContents/${encodeURIComponent(item.id)}/$value`,
1132
- fetchImpl: params.fetchFn ?? fetch,
1133
- init: { headers: ensureUserAgentHeader({ Authorization: `Bearer ${params.accessToken}` }) },
1134
- policy: params.ssrfPolicy,
1135
- auditContext: "msteams.graph.hostedContent.value"
1136
- });
1137
- try {
1138
- if (!valRes.ok) continue;
1139
- const cl = valRes.headers.get("content-length");
1140
- if (cl && Number(cl) > params.maxBytes) continue;
1141
- const ab = await valRes.arrayBuffer();
1142
- buffer = Buffer.from(ab);
1143
- } finally {
1144
- await release();
1145
- }
1146
- } catch (err) {
1147
- params.logger?.warn?.("msteams graph hostedContent value fetch failed", { error: err instanceof Error ? err.message : String(err) });
1148
- continue;
1149
- }
1150
- else continue;
1151
- if (buffer.byteLength > params.maxBytes) continue;
1152
- const mime = await getMSTeamsRuntime().media.detectMime({
1153
- buffer,
1154
- headerMime: item.contentType ?? void 0
1155
- });
1156
- try {
1157
- const saved = await getMSTeamsRuntime().channel.media.saveMediaBuffer(buffer, mime ?? item.contentType ?? void 0, "inbound", params.maxBytes);
1158
- out.push({
1159
- path: saved.path,
1160
- contentType: saved.contentType,
1161
- placeholder: inferPlaceholder({ contentType: saved.contentType })
1162
- });
1163
- } catch (err) {
1164
- params.logger?.warn?.("msteams graph hostedContent save failed", { error: err instanceof Error ? err.message : String(err) });
1165
- }
1166
- }
1167
- return {
1168
- media: out,
1169
- status: hosted.status,
1170
- count: hosted.items.length
1171
- };
1172
- }
1173
- async function downloadMSTeamsGraphMedia(params) {
1174
- if (!params.messageUrl || !params.tokenProvider) return { media: [] };
1175
- const policy = resolveAttachmentFetchPolicy({
1176
- allowHosts: params.allowHosts,
1177
- authAllowHosts: params.authAllowHosts
1178
- });
1179
- const ssrfPolicy = resolveMediaSsrfPolicy(policy.allowHosts);
1180
- const messageUrl = params.messageUrl;
1181
- const debugLog = params.log ?? params.logger ?? void 0;
1182
- let accessToken;
1183
- try {
1184
- accessToken = await params.tokenProvider.getAccessToken("https://graph.microsoft.com");
1185
- } catch (err) {
1186
- debugLog?.debug?.("graph media token acquisition failed", {
1187
- messageUrl,
1188
- error: err instanceof Error ? err.message : String(err)
1189
- });
1190
- params.logger?.warn?.("msteams graph token acquisition failed", { error: err instanceof Error ? err.message : String(err) });
1191
- return {
1192
- media: [],
1193
- messageUrl,
1194
- tokenError: true
1195
- };
1196
- }
1197
- const fetchFn = params.fetchFn ?? fetch;
1198
- const sharePointMedia = [];
1199
- const downloadedReferenceUrls = /* @__PURE__ */ new Set();
1200
- let messageAttachments = [];
1201
- let messageStatus;
1202
- try {
1203
- const { response: msgRes, release } = await fetchWithSsrFGuard({
1204
- url: messageUrl,
1205
- fetchImpl: fetchFn,
1206
- init: { headers: ensureUserAgentHeader({ Authorization: `Bearer ${accessToken}` }) },
1207
- policy: ssrfPolicy,
1208
- auditContext: "msteams.graph.message"
1209
- });
1210
- try {
1211
- messageStatus = msgRes.status;
1212
- if (msgRes.ok) {
1213
- let msgData;
1214
- try {
1215
- msgData = await msgRes.json();
1216
- } catch (err) {
1217
- debugLog?.debug?.("graph media message parse failed", {
1218
- messageUrl,
1219
- error: err instanceof Error ? err.message : String(err)
1220
- });
1221
- params.logger?.warn?.("msteams graph message parse failed", {
1222
- error: err instanceof Error ? err.message : String(err),
1223
- messageUrl
1224
- });
1225
- msgData = {};
1226
- }
1227
- messageAttachments = Array.isArray(msgData.attachments) ? msgData.attachments : [];
1228
- const spAttachments = messageAttachments.filter((a) => a.contentType === "reference" && a.contentUrl && a.name);
1229
- for (const att of spAttachments) {
1230
- const name = att.name ?? "file";
1231
- const shareUrl = att.contentUrl ?? "";
1232
- if (!shareUrl) continue;
1233
- try {
1234
- const sharesUrl = `${GRAPH_ROOT}/shares/${encodeGraphShareId(shareUrl)}/driveItem/content`;
1235
- if (!isUrlAllowed(sharesUrl, policy.allowHosts)) {
1236
- debugLog?.debug?.("graph media sharepoint url not in allowHosts", {
1237
- messageUrl,
1238
- sharesUrl
1239
- });
1240
- continue;
1241
- }
1242
- const media = await downloadAndStoreMSTeamsRemoteMedia({
1243
- url: sharesUrl,
1244
- filePathHint: name,
1245
- maxBytes: params.maxBytes,
1246
- contentTypeHint: "application/octet-stream",
1247
- preserveFilenames: params.preserveFilenames,
1248
- ssrfPolicy,
1249
- useDirectFetch: true,
1250
- fetchImpl: async (input, init) => {
1251
- const requestUrl = resolveRequestUrl(input);
1252
- const headers = ensureUserAgentHeader(init?.headers);
1253
- applyAuthorizationHeaderForUrl({
1254
- headers,
1255
- url: requestUrl,
1256
- authAllowHosts: policy.authAllowHosts,
1257
- bearerToken: accessToken
1258
- });
1259
- return await safeFetchWithPolicy({
1260
- url: requestUrl,
1261
- policy,
1262
- fetchFn,
1263
- requestInit: {
1264
- ...init,
1265
- headers
1266
- },
1267
- resolveFn: params.resolveFn
1268
- });
1269
- }
1270
- });
1271
- sharePointMedia.push(media);
1272
- downloadedReferenceUrls.add(shareUrl);
1273
- } catch (err) {
1274
- params.logger?.warn?.("msteams SharePoint reference download failed", {
1275
- error: err instanceof Error ? err.message : String(err),
1276
- name
1277
- });
1278
- }
1279
- }
1280
- } else debugLog?.debug?.("graph media message fetch not ok", {
1281
- messageUrl,
1282
- status: messageStatus
1283
- });
1284
- } finally {
1285
- await release();
1286
- }
1287
- } catch (err) {
1288
- debugLog?.debug?.("graph media message fetch failed", {
1289
- messageUrl,
1290
- error: err instanceof Error ? err.message : String(err)
1291
- });
1292
- params.logger?.warn?.("msteams graph message fetch failed", { error: err instanceof Error ? err.message : String(err) });
1293
- }
1294
- const hosted = await downloadGraphHostedContent({
1295
- accessToken,
1296
- messageUrl,
1297
- maxBytes: params.maxBytes,
1298
- fetchFn: params.fetchFn,
1299
- preserveFilenames: params.preserveFilenames,
1300
- ssrfPolicy,
1301
- logger: params.logger
1302
- });
1303
- const normalizedAttachments = messageAttachments.map(normalizeGraphAttachment);
1304
- const filteredAttachments = sharePointMedia.length > 0 ? normalizedAttachments.filter((att) => {
1305
- if (normalizeOptionalLowercaseString(att.contentType) !== "reference") return true;
1306
- const url = typeof att.contentUrl === "string" ? att.contentUrl : "";
1307
- if (!url) return true;
1308
- return !downloadedReferenceUrls.has(url);
1309
- }) : normalizedAttachments;
1310
- let attachmentMedia = [];
1311
- try {
1312
- attachmentMedia = await downloadMSTeamsAttachments({
1313
- attachments: filteredAttachments,
1314
- maxBytes: params.maxBytes,
1315
- tokenProvider: params.tokenProvider,
1316
- allowHosts: policy.allowHosts,
1317
- authAllowHosts: policy.authAllowHosts,
1318
- fetchFn: params.fetchFn,
1319
- resolveFn: params.resolveFn,
1320
- preserveFilenames: params.preserveFilenames,
1321
- logger: params.logger
1322
- });
1323
- } catch (err) {
1324
- params.logger?.warn?.("msteams graph attachment download failed", {
1325
- error: err instanceof Error ? err.message : String(err),
1326
- messageUrl
1327
- });
1328
- }
1329
- return {
1330
- media: [
1331
- ...sharePointMedia,
1332
- ...hosted.media,
1333
- ...attachmentMedia
1334
- ],
1335
- hostedCount: hosted.count,
1336
- attachmentCount: filteredAttachments.length + sharePointMedia.length,
1337
- hostedStatus: hosted.status,
1338
- attachmentStatus: messageStatus,
1339
- messageUrl
1340
- };
1341
- }
1342
- //#endregion
1343
- //#region extensions/msteams/src/attachments/html.ts
1344
- /**
1345
- * Extract every `<attachment id="...">` reference from the HTML attachments in
1346
- * the inbound activity. Returns the complete (non-sliced) list; callers that
1347
- * need a capped diagnostic summary can truncate after calling this helper.
1348
- */
1349
- function extractMSTeamsHtmlAttachmentIds(attachments) {
1350
- const list = Array.isArray(attachments) ? attachments : [];
1351
- if (list.length === 0) return [];
1352
- const ids = /* @__PURE__ */ new Set();
1353
- for (const att of list) {
1354
- const html = extractHtmlFromAttachment(att);
1355
- if (!html) continue;
1356
- ATTACHMENT_TAG_RE.lastIndex = 0;
1357
- let match = ATTACHMENT_TAG_RE.exec(html);
1358
- while (match) {
1359
- const id = match[1]?.trim();
1360
- if (id) ids.add(id);
1361
- match = ATTACHMENT_TAG_RE.exec(html);
1362
- }
1363
- }
1364
- return Array.from(ids);
1365
- }
1366
- function summarizeMSTeamsHtmlAttachments(attachments) {
1367
- const list = Array.isArray(attachments) ? attachments : [];
1368
- if (list.length === 0) return;
1369
- let htmlAttachments = 0;
1370
- let imgTags = 0;
1371
- let dataImages = 0;
1372
- let cidImages = 0;
1373
- const srcHosts = /* @__PURE__ */ new Set();
1374
- let attachmentTags = 0;
1375
- const attachmentIds = /* @__PURE__ */ new Set();
1376
- for (const att of list) {
1377
- const html = extractHtmlFromAttachment(att);
1378
- if (!html) continue;
1379
- htmlAttachments += 1;
1380
- IMG_SRC_RE.lastIndex = 0;
1381
- let match = IMG_SRC_RE.exec(html);
1382
- while (match) {
1383
- imgTags += 1;
1384
- const src = match[1]?.trim();
1385
- if (src) if (src.startsWith("data:")) dataImages += 1;
1386
- else if (src.startsWith("cid:")) cidImages += 1;
1387
- else srcHosts.add(safeHostForUrl(src));
1388
- match = IMG_SRC_RE.exec(html);
1389
- }
1390
- ATTACHMENT_TAG_RE.lastIndex = 0;
1391
- let attachmentMatch = ATTACHMENT_TAG_RE.exec(html);
1392
- while (attachmentMatch) {
1393
- attachmentTags += 1;
1394
- const id = attachmentMatch[1]?.trim();
1395
- if (id) attachmentIds.add(id);
1396
- attachmentMatch = ATTACHMENT_TAG_RE.exec(html);
1397
- }
1398
- }
1399
- if (htmlAttachments === 0) return;
1400
- return {
1401
- htmlAttachments,
1402
- imgTags,
1403
- dataImages,
1404
- cidImages,
1405
- srcHosts: Array.from(srcHosts).slice(0, 5),
1406
- attachmentTags,
1407
- attachmentIds: Array.from(attachmentIds).slice(0, 5)
1408
- };
1409
- }
1410
- function buildMSTeamsAttachmentPlaceholder(attachments, limits) {
1411
- const list = Array.isArray(attachments) ? attachments : [];
1412
- if (list.length === 0) return "";
1413
- const totalImages = list.filter(isLikelyImageAttachment).length + extractInlineImageCandidates(list, limits).length;
1414
- if (totalImages > 0) return `<media:image>${totalImages > 1 ? ` (${totalImages} images)` : ""}`;
1415
- const count = list.length;
1416
- return `<media:document>${count > 1 ? ` (${count} files)` : ""}`;
1417
- }
1418
- //#endregion
1419
- //#region extensions/msteams/src/attachments/payload.ts
1420
- function buildMSTeamsMediaPayload(mediaList) {
1421
- return buildMediaPayload(mediaList, { preserveMediaTypeCardinality: true });
1422
- }
1423
- //#endregion
1424
- //#region extensions/msteams/src/graph-thread.ts
1425
- const teamGroupIdCache = /* @__PURE__ */ new Map();
1426
- const CACHE_TTL_MS = 600 * 1e3;
1427
- /**
1428
- * Strip HTML tags from Teams message content, preserving @mention display names.
1429
- * Teams wraps mentions in <at>Name</at> tags.
1430
- */
1431
- function stripHtmlFromTeamsMessage(html) {
1432
- let text = html.replace(/<at[^>]*>(.*?)<\/at>/gi, "@$1");
1433
- text = text.replace(/<[^>]*>/g, " ");
1434
- text = text.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, "\"").replace(/&#39;/g, "'").replace(/&nbsp;/g, " ");
1435
- return text.replace(/\s+/g, " ").trim();
1436
- }
1437
- /**
1438
- * Resolve the Azure AD group GUID for a Teams conversation team ID.
1439
- * Results are cached with a TTL to avoid repeated Graph API calls.
1440
- */
1441
- async function resolveTeamGroupId(token, conversationTeamId) {
1442
- const cached = teamGroupIdCache.get(conversationTeamId);
1443
- if (cached && cached.expiresAt > Date.now()) return cached.groupId;
1444
- try {
1445
- const groupId = (await fetchGraphJson({
1446
- token,
1447
- path: `/teams/${encodeURIComponent(conversationTeamId)}?$select=id`
1448
- })).id ?? conversationTeamId;
1449
- teamGroupIdCache.set(conversationTeamId, {
1450
- groupId,
1451
- expiresAt: Date.now() + CACHE_TTL_MS
1452
- });
1453
- return groupId;
1454
- } catch {
1455
- return conversationTeamId;
1456
- }
1457
- }
1458
- /**
1459
- * Fetch a single channel message (the parent/root of a thread).
1460
- * Returns undefined on error so callers can degrade gracefully.
1461
- */
1462
- async function fetchChannelMessage(token, groupId, channelId, messageId) {
1463
- const path = `/teams/${encodeURIComponent(groupId)}/channels/${encodeURIComponent(channelId)}/messages/${encodeURIComponent(messageId)}?$select=id,from,body,createdDateTime`;
1464
- try {
1465
- return await fetchGraphJson({
1466
- token,
1467
- path
1468
- });
1469
- } catch {
1470
- return;
1471
- }
1472
- }
1473
- /**
1474
- * Fetch thread replies for a channel message, ordered chronologically.
1475
- *
1476
- * **Limitation:** The Graph API replies endpoint (`/messages/{id}/replies`) does not
1477
- * support `$orderby`, so results are always returned in ascending (oldest-first) order.
1478
- * Combined with the `$top` cap of 50, this means only the **oldest 50 replies** are
1479
- * returned for long threads — newer replies are silently omitted. There is currently no
1480
- * Graph API workaround for this; pagination via `@odata.nextLink` can retrieve more
1481
- * replies but still in ascending order only.
1482
- */
1483
- async function fetchThreadReplies(token, groupId, channelId, messageId, limit = 50) {
1484
- return (await fetchGraphJson({
1485
- token,
1486
- path: `/teams/${encodeURIComponent(groupId)}/channels/${encodeURIComponent(channelId)}/messages/${encodeURIComponent(messageId)}/replies?$top=${Math.min(Math.max(limit, 1), 50)}&$select=id,from,body,createdDateTime`
1487
- })).value ?? [];
1488
- }
1489
- /**
1490
- * Format thread messages into a context string for the agent.
1491
- * Skips the current message (by id) and blank messages.
1492
- */
1493
- function formatThreadContext(messages, currentMessageId) {
1494
- const lines = [];
1495
- for (const msg of messages) {
1496
- if (msg.id && msg.id === currentMessageId) continue;
1497
- const sender = msg.from?.user?.displayName ?? msg.from?.application?.displayName ?? "unknown";
1498
- const contentType = msg.body?.contentType ?? "text";
1499
- const rawContent = msg.body?.content ?? "";
1500
- const content = contentType === "html" ? stripHtmlFromTeamsMessage(rawContent) : rawContent.trim();
1501
- if (!content) continue;
1502
- lines.push(`${sender}: ${content}`);
1503
- }
1504
- return lines.join("\n");
1505
- }
1506
- //#endregion
1507
- //#region extensions/msteams/src/thread-parent-context.ts
1508
- const PARENT_CACHE_TTL_MS = 300 * 1e3;
1509
- const PARENT_CACHE_MAX = 100;
1510
- const parentCache = /* @__PURE__ */ new Map();
1511
- const INJECTED_MAX = 200;
1512
- const injectedParents = /* @__PURE__ */ new Map();
1513
- function touchLru(map, key, value, max) {
1514
- if (map.has(key)) map.delete(key);
1515
- else if (map.size >= max) {
1516
- const firstKey = map.keys().next().value;
1517
- if (firstKey !== void 0) map.delete(firstKey);
1518
- }
1519
- map.set(key, value);
1520
- }
1521
- function buildParentCacheKey(groupId, channelId, parentId) {
1522
- return `${groupId}\u0000${channelId}\u0000${parentId}`;
1523
- }
1524
- /**
1525
- * Fetch a channel parent message with an LRU+TTL cache.
1526
- *
1527
- * Uses the injected `fetchParent` (defaults to `fetchChannelMessage`) so
1528
- * tests can swap in a stub without mocking the Graph transport.
1529
- */
1530
- async function fetchParentMessageCached(token, groupId, channelId, parentId, fetchParent = fetchChannelMessage) {
1531
- const key = buildParentCacheKey(groupId, channelId, parentId);
1532
- const now = Date.now();
1533
- const cached = parentCache.get(key);
1534
- if (cached && cached.expiresAt > now) {
1535
- parentCache.delete(key);
1536
- parentCache.set(key, cached);
1537
- return cached.message;
1538
- }
1539
- const message = await fetchParent(token, groupId, channelId, parentId);
1540
- touchLru(parentCache, key, {
1541
- message,
1542
- expiresAt: now + PARENT_CACHE_TTL_MS
1543
- }, PARENT_CACHE_MAX);
1544
- return message;
1545
- }
1546
- const PARENT_TEXT_MAX_CHARS = 400;
1547
- /**
1548
- * Extract a compact summary (sender + plain-text body) from a Graph parent
1549
- * message. Returns undefined when the parent cannot be summarized (missing
1550
- * or blank body).
1551
- */
1552
- function summarizeParentMessage(message) {
1553
- if (!message) return;
1554
- const sender = message.from?.user?.displayName ?? message.from?.application?.displayName ?? "unknown";
1555
- const contentType = message.body?.contentType ?? "text";
1556
- const raw = message.body?.content ?? "";
1557
- const text = contentType === "html" ? stripHtmlFromTeamsMessage(raw) : raw.replace(/\s+/g, " ").trim();
1558
- if (!text) return;
1559
- return {
1560
- sender,
1561
- text: text.length > PARENT_TEXT_MAX_CHARS ? `${text.slice(0, PARENT_TEXT_MAX_CHARS - 1)}…` : text
1562
- };
1563
- }
1564
- /**
1565
- * Build the single-line `Replying to @sender: body` system event text.
1566
- * Callers should pass this text to `enqueueSystemEvent` together with a
1567
- * stable contextKey derived from the parent id.
1568
- */
1569
- function formatParentContextEvent(summary) {
1570
- return `Replying to @${summary.sender}: ${summary.text}`;
1571
- }
1572
- /**
1573
- * Decide whether a parent context event should be enqueued for the current
1574
- * session. Returns `false` when we already injected the same parent for this
1575
- * session recently (prevents re-prepending identical context on every reply
1576
- * in the thread).
1577
- */
1578
- function shouldInjectParentContext(sessionKey, parentId) {
1579
- const key = sessionKey;
1580
- return injectedParents.get(key) !== parentId;
1581
- }
1582
- /**
1583
- * Record that `parentId` was just injected for `sessionKey` so subsequent
1584
- * replies with the same parent can short-circuit via `shouldInjectParentContext`.
1585
- */
1586
- function markParentContextInjected(sessionKey, parentId) {
1587
- touchLru(injectedParents, sessionKey, parentId, INJECTED_MAX);
1588
- }
1589
- //#endregion
1590
- //#region extensions/msteams/src/streaming-message.ts
1591
- /**
1592
- * Teams streaming message using the streaminfo entity protocol.
1593
- *
1594
- * Follows the official Teams SDK pattern:
1595
- * 1. First chunk → POST a typing activity with streaminfo entity (streamType: "streaming")
1596
- * 2. Subsequent chunks → POST typing activities with streaminfo + incrementing streamSequence
1597
- * 3. Finalize → POST a message activity with streaminfo (streamType: "final")
1598
- *
1599
- * Uses the shared draft-stream-loop for throttling (avoids rate limits).
1600
- */
1601
- /** Default throttle interval between stream updates (ms).
1602
- * Teams docs recommend buffering tokens for 1.5-2s; limit is 1 req/s. */
1603
- const DEFAULT_THROTTLE_MS = 1500;
1604
- /** Minimum chars before sending the first streaming message. */
1605
- const MIN_INITIAL_CHARS = 20;
1606
- /** Teams message text limit. */
1607
- const TEAMS_MAX_CHARS = 4e3;
1608
- /**
1609
- * Stop streaming before Teams expires the content stream server-side.
1610
- * The exact service limit is opaque, so stay comfortably under it.
1611
- */
1612
- const MAX_STREAM_AGE_MS = 45e3;
1613
- function extractId(response) {
1614
- if (response && typeof response === "object" && "id" in response) return readStringValue(response.id);
1615
- }
1616
- function buildStreamInfoEntity(streamId, streamType, streamSequence) {
1617
- const entity = {
1618
- type: "streaminfo",
1619
- streamType
1620
- };
1621
- if (streamId) entity.streamId = streamId;
1622
- if (streamSequence != null) entity.streamSequence = streamSequence;
1623
- return entity;
1624
- }
1625
- var TeamsHttpStream = class {
1626
- constructor(options) {
1627
- this.accumulatedText = "";
1628
- this.streamId = void 0;
1629
- this.sequenceNumber = 0;
1630
- this.stopped = false;
1631
- this.finalized = false;
1632
- this.streamFailed = false;
1633
- this.lastStreamedText = "";
1634
- this.streamStartedAt = void 0;
1635
- this.sendActivity = options.sendActivity;
1636
- this.feedbackLoopEnabled = options.feedbackLoopEnabled ?? false;
1637
- this.onError = options.onError;
1638
- this.loop = createDraftStreamLoop({
1639
- throttleMs: options.throttleMs ?? DEFAULT_THROTTLE_MS,
1640
- isStopped: () => this.stopped,
1641
- sendOrEditStreamMessage: (text) => this.pushStreamChunk(text)
1642
- });
1643
- }
1644
- /**
1645
- * Send an informative status update (blue progress bar in Teams).
1646
- * Call this immediately when a message is received, before LLM starts generating.
1647
- * Establishes the stream so subsequent chunks continue from this stream ID.
1648
- */
1649
- async sendInformativeUpdate(text) {
1650
- if (this.stopped || this.finalized) return;
1651
- this.sequenceNumber++;
1652
- const activity = {
1653
- type: "typing",
1654
- text,
1655
- entities: [buildStreamInfoEntity(this.streamId, "informative", this.sequenceNumber)]
1656
- };
1657
- try {
1658
- const response = await this.sendActivity(activity);
1659
- if (!this.streamId) this.streamId = extractId(response);
1660
- } catch (err) {
1661
- this.onError?.(err);
1662
- }
1663
- }
1664
- /**
1665
- * Ingest partial text from the LLM token stream.
1666
- * Called by onPartialReply — accumulates text and throttles updates.
1667
- */
1668
- update(text) {
1669
- if (this.stopped || this.finalized) return;
1670
- this.accumulatedText = text;
1671
- if (!this.streamId && this.accumulatedText.length < MIN_INITIAL_CHARS) return;
1672
- if (this.accumulatedText.length > TEAMS_MAX_CHARS) {
1673
- this.streamFailed = true;
1674
- this.finalize();
1675
- return;
1676
- }
1677
- if (this.streamStartedAt && Date.now() - this.streamStartedAt >= MAX_STREAM_AGE_MS) {
1678
- this.streamFailed = true;
1679
- this.finalize();
1680
- return;
1681
- }
1682
- this.loop.update(this.accumulatedText);
1683
- }
1684
- /**
1685
- * Finalize the stream — send the final message activity.
1686
- */
1687
- async finalize() {
1688
- if (this.finalized) return;
1689
- this.finalized = true;
1690
- this.stopped = true;
1691
- this.loop.stop();
1692
- await this.loop.waitForInFlight();
1693
- if (!this.accumulatedText.trim()) return;
1694
- if (this.streamFailed) {
1695
- if (this.streamId) try {
1696
- await this.sendActivity({
1697
- type: "message",
1698
- text: this.lastStreamedText || "",
1699
- channelData: { feedbackLoopEnabled: this.feedbackLoopEnabled },
1700
- entities: [AI_GENERATED_ENTITY, buildStreamInfoEntity(this.streamId, "final")]
1701
- });
1702
- } catch {}
1703
- return;
1704
- }
1705
- try {
1706
- const entities = [AI_GENERATED_ENTITY];
1707
- if (this.streamId) entities.push(buildStreamInfoEntity(this.streamId, "final"));
1708
- const finalActivity = {
1709
- type: "message",
1710
- text: this.accumulatedText,
1711
- channelData: { feedbackLoopEnabled: this.feedbackLoopEnabled },
1712
- entities
1713
- };
1714
- await this.sendActivity(finalActivity);
1715
- } catch (err) {
1716
- this.onError?.(err);
1717
- }
1718
- }
1719
- /** Whether streaming successfully delivered content (at least one chunk sent, not failed). */
1720
- get hasContent() {
1721
- return this.accumulatedText.length > 0 && !this.streamFailed;
1722
- }
1723
- /** Whether streaming failed and fallback delivery is needed. */
1724
- get isFailed() {
1725
- return this.streamFailed;
1726
- }
1727
- /** Number of characters successfully streamed before failure. */
1728
- get streamedLength() {
1729
- return this.lastStreamedText.length;
1730
- }
1731
- /** Whether the stream has been finalized. */
1732
- get isFinalized() {
1733
- return this.finalized;
1734
- }
1735
- /** Whether streaming fell back (not used in this implementation). */
1736
- get isFallback() {
1737
- return false;
1738
- }
1739
- /**
1740
- * Send a single streaming chunk as a typing activity with streaminfo.
1741
- * Per the Teams REST API spec:
1742
- * - First chunk: no streamId, streamSequence=1 → returns 201 with { id: streamId }
1743
- * - Subsequent chunks: include streamId, increment streamSequence → returns 202
1744
- */
1745
- async pushStreamChunk(text) {
1746
- if (this.stopped && !this.finalized) return false;
1747
- this.sequenceNumber++;
1748
- const activity = {
1749
- type: "typing",
1750
- text,
1751
- entities: [buildStreamInfoEntity(this.streamId, "streaming", this.sequenceNumber)]
1752
- };
1753
- try {
1754
- const response = await this.sendActivity(activity);
1755
- if (!this.streamStartedAt) this.streamStartedAt = Date.now();
1756
- if (!this.streamId) this.streamId = extractId(response);
1757
- this.lastStreamedText = text;
1758
- return true;
1759
- } catch (err) {
1760
- const axiosData = err?.response;
1761
- const statusCode = axiosData?.status ?? err?.statusCode;
1762
- const responseBody = axiosData?.data ? JSON.stringify(axiosData.data).slice(0, 300) : "";
1763
- const msg = formatUnknownError(err);
1764
- this.onError?.(/* @__PURE__ */ new Error(`stream POST failed (HTTP ${statusCode ?? "?"}): ${msg}${responseBody ? ` body=${responseBody}` : ""}`));
1765
- this.streamFailed = true;
1766
- return false;
1767
- }
1768
- }
1769
- };
1770
- //#endregion
1771
- //#region extensions/msteams/src/reply-stream-controller.ts
1772
- const INFORMATIVE_STATUS_TEXTS = [
1773
- "Thinking...",
1774
- "Working on that...",
1775
- "Checking the details...",
1776
- "Putting an answer together..."
1777
- ];
1778
- function pickInformativeStatusText(random = Math.random) {
1779
- return INFORMATIVE_STATUS_TEXTS[Math.floor(random() * INFORMATIVE_STATUS_TEXTS.length)] ?? INFORMATIVE_STATUS_TEXTS[0];
1780
- }
1781
- function createTeamsReplyStreamController(params) {
1782
- const stream = normalizeOptionalLowercaseString(params.conversationType) === "personal" ? new TeamsHttpStream({
1783
- sendActivity: (activity) => params.context.sendActivity(activity),
1784
- feedbackLoopEnabled: params.feedbackLoopEnabled,
1785
- onError: (err) => {
1786
- params.log.debug?.(`stream error: ${formatUnknownError(err)}`);
1787
- }
1788
- }) : void 0;
1789
- let streamReceivedTokens = false;
1790
- let informativeUpdateSent = false;
1791
- let pendingFinalize;
1792
- return {
1793
- async onReplyStart() {
1794
- if (!stream || informativeUpdateSent) return;
1795
- informativeUpdateSent = true;
1796
- await stream.sendInformativeUpdate(pickInformativeStatusText(params.random));
1797
- },
1798
- onPartialReply(payload) {
1799
- if (!stream || !payload.text) return;
1800
- streamReceivedTokens = true;
1801
- stream.update(payload.text);
1802
- },
1803
- preparePayload(payload) {
1804
- if (!stream || !streamReceivedTokens) return payload;
1805
- const hasMedia = Boolean(payload.mediaUrl || payload.mediaUrls?.length);
1806
- if (stream.isFailed) {
1807
- streamReceivedTokens = false;
1808
- if (!payload.text) return payload;
1809
- const streamedLength = stream.streamedLength;
1810
- if (streamedLength <= 0) return payload;
1811
- const remainingText = payload.text.slice(streamedLength);
1812
- if (!remainingText) return hasMedia ? {
1813
- ...payload,
1814
- text: void 0
1815
- } : void 0;
1816
- return {
1817
- ...payload,
1818
- text: remainingText
1819
- };
1820
- }
1821
- if (!stream.hasContent || stream.isFinalized) return payload;
1822
- streamReceivedTokens = false;
1823
- pendingFinalize = stream.finalize();
1824
- if (!hasMedia) return;
1825
- return {
1826
- ...payload,
1827
- text: void 0
1828
- };
1829
- },
1830
- async finalize() {
1831
- await pendingFinalize;
1832
- await stream?.finalize();
1833
- },
1834
- hasStream() {
1835
- return Boolean(stream);
1836
- },
1837
- isStreamActive() {
1838
- if (!stream) return false;
1839
- if (stream.isFinalized || stream.isFailed) return false;
1840
- return streamReceivedTokens;
1841
- }
1842
- };
1843
- }
1844
- //#endregion
1845
- //#region extensions/msteams/src/reply-dispatcher.ts
1846
- function createMSTeamsReplyDispatcher(params) {
1847
- const core = getMSTeamsRuntime();
1848
- const msteamsCfg = params.cfg.channels?.msteams;
1849
- const conversationType = normalizeOptionalLowercaseString(params.conversationRef.conversation?.conversationType);
1850
- const isTypingSupported = conversationType === "personal" || conversationType === "groupchat";
1851
- /**
1852
- * Keepalive cadence for the typing indicator while the bot is running
1853
- * (including long tool chains). Bot Framework 1:1 TurnContext proxies
1854
- * expire after ~30s of inactivity; sending a typing activity every 8s
1855
- * keeps the proxy alive so the post-tool reply can still land via the
1856
- * turn context. Sits in the middle of the 5-10s range recommended in
1857
- * #59731.
1858
- */
1859
- const TYPING_KEEPALIVE_INTERVAL_MS = 8e3;
1860
- /**
1861
- * TTL ceiling for the typing keepalive loop. The default in
1862
- * createTypingCallbacks is 60s, which is too short for the Teams long tool
1863
- * chains described in #59731 (60s+ total runs are common). Give tool
1864
- * chains up to 10 minutes before auto-stopping the keepalive.
1865
- */
1866
- const TYPING_KEEPALIVE_MAX_DURATION_MS = 10 * 6e4;
1867
- const streamActiveRef = { current: () => false };
1868
- const rawSendTypingIndicator = async () => {
1869
- await withRevokedProxyFallback({
1870
- run: async () => {
1871
- await params.context.sendActivity({ type: "typing" });
1872
- },
1873
- onRevoked: async () => {
1874
- const baseRef = buildConversationReference(params.conversationRef);
1875
- await params.adapter.continueConversation(params.appId, {
1876
- ...baseRef,
1877
- activityId: void 0
1878
- }, async (ctx) => {
1879
- await ctx.sendActivity({ type: "typing" });
1880
- });
1881
- },
1882
- onRevokedLog: () => {
1883
- params.log.debug?.("turn context revoked, sending typing via proactive messaging");
1884
- }
1885
- });
1886
- };
1887
- const sendTypingIndicator = isTypingSupported ? async () => {
1888
- if (streamActiveRef.current()) return;
1889
- await rawSendTypingIndicator();
1890
- } : async () => {};
1891
- const { onModelSelected, typingCallbacks, ...replyPipeline } = createChannelReplyPipeline({
1892
- cfg: params.cfg,
1893
- agentId: params.agentId,
1894
- channel: "msteams",
1895
- accountId: params.accountId,
1896
- typing: {
1897
- start: sendTypingIndicator,
1898
- keepaliveIntervalMs: TYPING_KEEPALIVE_INTERVAL_MS,
1899
- maxDurationMs: TYPING_KEEPALIVE_MAX_DURATION_MS,
1900
- onStartError: (err) => {
1901
- logTypingFailure({
1902
- log: (message) => params.log.debug?.(message),
1903
- channel: "msteams",
1904
- action: "start",
1905
- error: err
1906
- });
1907
- }
1908
- }
1909
- });
1910
- const chunkMode = core.channel.text.resolveChunkMode(params.cfg, "msteams");
1911
- const tableMode = core.channel.text.resolveMarkdownTableMode({
1912
- cfg: params.cfg,
1913
- channel: "msteams"
1914
- });
1915
- const mediaMaxBytes = resolveChannelMediaMaxBytes({
1916
- cfg: params.cfg,
1917
- resolveChannelLimitMb: ({ cfg }) => cfg.channels?.msteams?.mediaMaxMb
1918
- });
1919
- const feedbackLoopEnabled = params.cfg.channels?.msteams?.feedbackEnabled !== false;
1920
- const streamController = createTeamsReplyStreamController({
1921
- conversationType,
1922
- context: params.context,
1923
- feedbackLoopEnabled,
1924
- log: params.log
1925
- });
1926
- streamActiveRef.current = () => streamController.isStreamActive();
1927
- const blockStreamingEnabled = typeof msteamsCfg?.blockStreaming === "boolean" ? msteamsCfg.blockStreaming : false;
1928
- const typingIndicatorEnabled = typeof msteamsCfg?.typingIndicator === "boolean" ? msteamsCfg.typingIndicator : true;
1929
- const pendingMessages = [];
1930
- const sendMessages = async (messages) => {
1931
- return sendMSTeamsMessages({
1932
- replyStyle: params.replyStyle,
1933
- adapter: params.adapter,
1934
- appId: params.appId,
1935
- conversationRef: params.conversationRef,
1936
- context: params.context,
1937
- messages,
1938
- retry: {},
1939
- onRetry: (event) => {
1940
- params.log.debug?.("retrying send", {
1941
- replyStyle: params.replyStyle,
1942
- ...event
1943
- });
1944
- },
1945
- tokenProvider: params.tokenProvider,
1946
- sharePointSiteId: params.sharePointSiteId,
1947
- mediaMaxBytes,
1948
- feedbackLoopEnabled
1949
- });
1950
- };
1951
- const queueDeliveryFailureSystemEvent = (failure) => {
1952
- const classification = classifyMSTeamsSendError(failure.error);
1953
- const errorText = formatUnknownError(failure.error);
1954
- const failedAll = failure.failed >= failure.total;
1955
- const sentences = [
1956
- `Microsoft Teams delivery failed: ${failedAll ? "the previous reply was not delivered" : `${failure.failed} of ${failure.total} message blocks were not delivered`}.`,
1957
- `The user may not have received ${failedAll ? "that reply" : "the full reply"}.`,
1958
- `Error: ${errorText}.`,
1959
- classification.statusCode != null ? `Status: ${classification.statusCode}.` : void 0,
1960
- classification.kind === "transient" || classification.kind === "throttled" ? "Retrying later may succeed." : void 0
1961
- ].filter(Boolean);
1962
- core.system.enqueueSystemEvent(sentences.join(" "), {
1963
- sessionKey: params.sessionKey,
1964
- contextKey: `msteams:delivery-failure:${params.conversationRef.conversation?.id ?? "unknown"}`
1965
- });
1966
- };
1967
- const flushPendingMessages = async () => {
1968
- if (pendingMessages.length === 0) return;
1969
- const toSend = pendingMessages.splice(0);
1970
- const total = toSend.length;
1971
- let ids;
1972
- try {
1973
- ids = await sendMessages(toSend);
1974
- } catch (batchError) {
1975
- ids = [];
1976
- let failed = 0;
1977
- let lastFailedError = batchError;
1978
- for (const msg of toSend) try {
1979
- const msgIds = await sendMessages([msg]);
1980
- ids.push(...msgIds);
1981
- } catch (msgError) {
1982
- failed += 1;
1983
- lastFailedError = msgError;
1984
- params.log.debug?.("individual message send failed, continuing with remaining blocks");
1985
- }
1986
- if (failed > 0) {
1987
- params.log.warn?.(`failed to deliver ${failed} of ${total} message blocks`, {
1988
- failed,
1989
- total
1990
- });
1991
- queueDeliveryFailureSystemEvent({
1992
- failed,
1993
- total,
1994
- error: lastFailedError
1995
- });
1996
- }
1997
- }
1998
- if (ids.length > 0) params.onSentMessageIds?.(ids);
1999
- };
2000
- const { dispatcher, replyOptions, markDispatchIdle: baseMarkDispatchIdle } = core.channel.reply.createReplyDispatcherWithTyping({
2001
- ...replyPipeline,
2002
- humanDelay: core.channel.reply.resolveHumanDelayConfig(params.cfg, params.agentId),
2003
- onReplyStart: async () => {
2004
- await streamController.onReplyStart();
2005
- if (typingIndicatorEnabled) await typingCallbacks?.onReplyStart?.();
2006
- },
2007
- typingCallbacks,
2008
- deliver: async (payload) => {
2009
- const preparedPayload = streamController.preparePayload(payload);
2010
- if (!preparedPayload) return;
2011
- const messages = renderReplyPayloadsToMessages([preparedPayload], {
2012
- textChunkLimit: params.textLimit,
2013
- chunkText: true,
2014
- mediaMode: "split",
2015
- tableMode,
2016
- chunkMode
2017
- });
2018
- pendingMessages.push(...messages);
2019
- if (blockStreamingEnabled) await flushPendingMessages();
2020
- },
2021
- onError: (err, info) => {
2022
- const errMsg = formatUnknownError(err);
2023
- const classification = classifyMSTeamsSendError(err);
2024
- const hint = formatMSTeamsSendErrorHint(classification);
2025
- params.runtime.error?.(`msteams ${info.kind} reply failed: ${errMsg}${hint ? ` (${hint})` : ""}`);
2026
- params.log.error("reply failed", {
2027
- kind: info.kind,
2028
- error: errMsg,
2029
- classification,
2030
- hint
2031
- });
2032
- }
2033
- });
2034
- const markDispatchIdle = () => {
2035
- return flushPendingMessages().catch((err) => {
2036
- const errMsg = formatUnknownError(err);
2037
- const classification = classifyMSTeamsSendError(err);
2038
- const hint = formatMSTeamsSendErrorHint(classification);
2039
- params.runtime.error?.(`msteams flush reply failed: ${errMsg}${hint ? ` (${hint})` : ""}`);
2040
- params.log.error("flush reply failed", {
2041
- error: errMsg,
2042
- classification,
2043
- hint
2044
- });
2045
- }).then(() => {
2046
- return streamController.finalize().catch((err) => {
2047
- params.log.debug?.("stream finalize failed", { error: formatUnknownError(err) });
2048
- });
2049
- }).finally(() => {
2050
- baseMarkDispatchIdle();
2051
- });
2052
- };
2053
- return {
2054
- dispatcher,
2055
- replyOptions: {
2056
- ...replyOptions,
2057
- ...streamController.hasStream() ? { onPartialReply: (payload) => streamController.onPartialReply(payload) } : {},
2058
- disableBlockStreaming: typeof msteamsCfg?.blockStreaming === "boolean" ? !msteamsCfg.blockStreaming : void 0,
2059
- onModelSelected
2060
- },
2061
- markDispatchIdle
2062
- };
2063
- }
2064
- //#endregion
2065
- //#region extensions/msteams/src/sent-message-cache.ts
2066
- const TTL_MS = 1440 * 60 * 1e3;
2067
- const MSTEAMS_SENT_MESSAGES_KEY = Symbol.for("genesis.msteamsSentMessages");
2068
- let sentMessageCache;
2069
- function getSentMessageCache() {
2070
- if (!sentMessageCache) {
2071
- const globalStore = globalThis;
2072
- sentMessageCache = globalStore[MSTEAMS_SENT_MESSAGES_KEY] ?? /* @__PURE__ */ new Map();
2073
- globalStore[MSTEAMS_SENT_MESSAGES_KEY] = sentMessageCache;
2074
- }
2075
- return sentMessageCache;
2076
- }
2077
- function cleanupExpired(scopeKey, entry, now) {
2078
- for (const [id, timestamp] of entry) if (now - timestamp > TTL_MS) entry.delete(id);
2079
- if (entry.size === 0) getSentMessageCache().delete(scopeKey);
2080
- }
2081
- function recordMSTeamsSentMessage(conversationId, messageId) {
2082
- if (!conversationId || !messageId) return;
2083
- const now = Date.now();
2084
- const store = getSentMessageCache();
2085
- let entry = store.get(conversationId);
2086
- if (!entry) {
2087
- entry = /* @__PURE__ */ new Map();
2088
- store.set(conversationId, entry);
2089
- }
2090
- entry.set(messageId, now);
2091
- if (entry.size > 200) cleanupExpired(conversationId, entry, now);
2092
- }
2093
- function wasMSTeamsMessageSent(conversationId, messageId) {
2094
- const entry = getSentMessageCache().get(conversationId);
2095
- if (!entry) return false;
2096
- cleanupExpired(conversationId, entry, Date.now());
2097
- return entry.has(messageId);
2098
- }
2099
- //#endregion
2100
- //#region extensions/msteams/src/monitor-handler/inbound-media.ts
2101
- async function resolveMSTeamsInboundMedia(params) {
2102
- const { attachments, htmlSummary, maxBytes, tokenProvider, allowHosts, conversationType, conversationId, conversationMessageId, serviceUrl, activity, log, preserveFilenames } = params;
2103
- let mediaList = await downloadMSTeamsAttachments({
2104
- attachments,
2105
- maxBytes,
2106
- tokenProvider,
2107
- allowHosts,
2108
- authAllowHosts: params.authAllowHosts,
2109
- preserveFilenames,
2110
- logger: log
2111
- });
2112
- if (mediaList.length === 0) {
2113
- const attachmentIds = extractMSTeamsHtmlAttachmentIds(attachments);
2114
- const hasHtmlFileAttachment = attachmentIds.length > 0;
2115
- if (hasHtmlFileAttachment && isBotFrameworkPersonalChatId(conversationId)) if (!serviceUrl) log.debug?.("bot framework attachment skipped (missing serviceUrl)", {
2116
- conversationType,
2117
- conversationId
2118
- });
2119
- else {
2120
- const bfMedia = await downloadMSTeamsBotFrameworkAttachments({
2121
- serviceUrl,
2122
- attachmentIds,
2123
- tokenProvider,
2124
- maxBytes,
2125
- allowHosts,
2126
- authAllowHosts: params.authAllowHosts,
2127
- preserveFilenames
2128
- });
2129
- if (bfMedia.media.length > 0) mediaList = bfMedia.media;
2130
- else log.debug?.("bot framework attachments fetch empty", {
2131
- conversationType,
2132
- attachmentCount: bfMedia.attachmentCount ?? attachmentIds.length
2133
- });
2134
- }
2135
- if (hasHtmlFileAttachment && mediaList.length === 0 && !isBotFrameworkPersonalChatId(conversationId)) {
2136
- const messageUrls = buildMSTeamsGraphMessageUrls({
2137
- conversationType,
2138
- conversationId,
2139
- messageId: activity.id ?? void 0,
2140
- replyToId: activity.replyToId ?? void 0,
2141
- conversationMessageId,
2142
- channelData: activity.channelData
2143
- });
2144
- if (messageUrls.length === 0) log.debug?.("graph message url unavailable", {
2145
- conversationType,
2146
- hasChannelData: Boolean(activity.channelData),
2147
- messageId: activity.id ?? void 0,
2148
- replyToId: activity.replyToId ?? void 0
2149
- });
2150
- else {
2151
- const attempts = [];
2152
- for (const messageUrl of messageUrls) {
2153
- const graphMedia = await downloadMSTeamsGraphMedia({
2154
- messageUrl,
2155
- tokenProvider,
2156
- maxBytes,
2157
- allowHosts,
2158
- authAllowHosts: params.authAllowHosts,
2159
- preserveFilenames,
2160
- log,
2161
- logger: log
2162
- });
2163
- attempts.push({
2164
- url: messageUrl,
2165
- hostedStatus: graphMedia.hostedStatus,
2166
- attachmentStatus: graphMedia.attachmentStatus,
2167
- hostedCount: graphMedia.hostedCount,
2168
- attachmentCount: graphMedia.attachmentCount,
2169
- tokenError: graphMedia.tokenError
2170
- });
2171
- if (graphMedia.media.length > 0) {
2172
- mediaList = graphMedia.media;
2173
- break;
2174
- }
2175
- if (graphMedia.tokenError) break;
2176
- }
2177
- if (mediaList.length === 0) log.debug?.("graph media fetch empty", {
2178
- attempts,
2179
- attachmentIdCount: attachmentIds.length
2180
- });
2181
- }
2182
- }
2183
- }
2184
- if (mediaList.length > 0) log.debug?.("downloaded attachments", { count: mediaList.length });
2185
- else if (htmlSummary?.imgTags) log.debug?.("inline images detected but none downloaded", {
2186
- imgTags: htmlSummary.imgTags,
2187
- srcHosts: htmlSummary.srcHosts,
2188
- dataImages: htmlSummary.dataImages,
2189
- cidImages: htmlSummary.cidImages
2190
- });
2191
- return mediaList;
2192
- }
2193
- //#endregion
2194
- //#region extensions/msteams/src/monitor-handler/thread-session.ts
2195
- function resolveMSTeamsRouteSessionKey(params) {
2196
- const channelThreadId = params.isChannel ? params.conversationMessageId ?? params.replyToId ?? void 0 : void 0;
2197
- return resolveThreadSessionKeys({
2198
- baseSessionKey: params.baseSessionKey,
2199
- threadId: channelThreadId,
2200
- parentSessionKey: channelThreadId ? params.baseSessionKey : void 0
2201
- }).sessionKey;
2202
- }
2203
- //#endregion
2204
- //#region extensions/msteams/src/monitor-handler/message-handler.ts
2205
- function extractTextFromHtmlAttachments(attachments) {
2206
- for (const attachment of attachments) {
2207
- if (attachment.contentType !== "text/html") continue;
2208
- const content = attachment.content;
2209
- const raw = typeof content === "string" ? content : isRecord(content) && typeof content.text === "string" ? content.text : isRecord(content) && typeof content.body === "string" ? content.body : "";
2210
- if (!raw) continue;
2211
- const text = raw.replace(/<at[^>]*>.*?<\/at>/gis, " ").replace(/<a\b[^>]*href=["']([^"']+)["'][^>]*>(.*?)<\/a>/gis, "$2 $1").replace(/<br\s*\/?>/gi, "\n").replace(/<\/p>/gi, "\n").replace(/<[^>]+>/g, " ").replace(/&nbsp;/gi, " ").replace(/&amp;/gi, "&").replace(/\s+/g, " ").trim();
2212
- if (text) return text;
2213
- }
2214
- return "";
2215
- }
2216
- function buildStoredConversationReference(params) {
2217
- const { activity, conversationId, conversationType, teamId, threadId } = params;
2218
- const from = activity.from;
2219
- const conversation = activity.conversation;
2220
- const agent = activity.recipient;
2221
- const clientInfo = activity.entities?.find((e) => e.type === "clientInfo");
2222
- const tenantId = activity.channelData?.tenant?.id ?? conversation?.tenantId;
2223
- const aadObjectId = from?.aadObjectId;
2224
- return {
2225
- activityId: activity.id,
2226
- user: from ? {
2227
- id: from.id,
2228
- name: from.name,
2229
- aadObjectId: from.aadObjectId
2230
- } : void 0,
2231
- agent,
2232
- bot: agent ? {
2233
- id: agent.id,
2234
- name: agent.name
2235
- } : void 0,
2236
- conversation: {
2237
- id: conversationId,
2238
- conversationType,
2239
- tenantId
2240
- },
2241
- ...tenantId ? { tenantId } : {},
2242
- ...aadObjectId ? { aadObjectId } : {},
2243
- teamId,
2244
- channelId: activity.channelId,
2245
- serviceUrl: activity.serviceUrl,
2246
- locale: activity.locale,
2247
- ...clientInfo?.timezone ? { timezone: clientInfo.timezone } : {},
2248
- ...threadId ? { threadId } : {}
2249
- };
2250
- }
2251
- function createMSTeamsMessageHandler(deps) {
2252
- const { cfg, runtime, appId, adapter, tokenProvider, textLimit, mediaMaxBytes, conversationStore, pollStore, log } = deps;
2253
- const core = getMSTeamsRuntime();
2254
- const logVerboseMessage = (message) => {
2255
- if (core.logging.shouldLogVerbose()) log.debug?.(message);
2256
- };
2257
- const msteamsCfg = cfg.channels?.msteams;
2258
- const contextVisibilityMode = resolveChannelContextVisibilityMode({
2259
- cfg,
2260
- channel: "msteams"
2261
- });
2262
- const historyLimit = Math.max(0, msteamsCfg?.historyLimit ?? cfg.messages?.groupChat?.historyLimit ?? 50);
2263
- const conversationHistories = /* @__PURE__ */ new Map();
2264
- const inboundDebounceMs = core.channel.debounce.resolveInboundDebounceMs({
2265
- cfg,
2266
- channel: "msteams"
2267
- });
2268
- const handleTeamsMessageNow = async (params) => {
2269
- const context = params.context;
2270
- const activity = context.activity;
2271
- const rawText = params.rawText;
2272
- const text = params.text;
2273
- const attachments = params.attachments;
2274
- const attachmentPlaceholder = buildMSTeamsAttachmentPlaceholder(attachments, {
2275
- maxInlineBytes: mediaMaxBytes,
2276
- maxInlineTotalBytes: mediaMaxBytes
2277
- });
2278
- const rawBody = text || attachmentPlaceholder;
2279
- const quoteInfo = extractMSTeamsQuoteInfo(attachments);
2280
- let quoteSenderId;
2281
- let quoteSenderName;
2282
- const from = activity.from;
2283
- const conversation = activity.conversation;
2284
- const attachmentTypes = attachments.map((att) => typeof att.contentType === "string" ? att.contentType : void 0).filter(Boolean).slice(0, 3);
2285
- const htmlSummary = summarizeMSTeamsHtmlAttachments(attachments);
2286
- log.info("received message", {
2287
- rawText: rawText.slice(0, 50),
2288
- text: text.slice(0, 50),
2289
- attachments: attachments.length,
2290
- attachmentTypes,
2291
- from: from?.id,
2292
- conversation: conversation?.id
2293
- });
2294
- if (htmlSummary) log.debug?.("html attachment summary", htmlSummary);
2295
- if (!from?.id) {
2296
- log.debug?.("skipping message without from.id");
2297
- return;
2298
- }
2299
- const rawConversationId = conversation?.id ?? "";
2300
- const conversationId = normalizeMSTeamsConversationId(rawConversationId);
2301
- const conversationMessageId = extractMSTeamsConversationMessageId(rawConversationId);
2302
- const conversationType = conversation?.conversationType ?? "personal";
2303
- const teamId = activity.channelData?.team?.id;
2304
- const conversationRef = buildStoredConversationReference({
2305
- activity,
2306
- conversationId,
2307
- conversationType,
2308
- teamId,
2309
- threadId: conversationType === "channel" ? conversationMessageId ?? activity.replyToId ?? void 0 : void 0
2310
- });
2311
- const { dmPolicy, senderId, senderName, pairing, isDirectMessage, channelGate, access, configuredDmAllowFrom, effectiveDmAllowFrom, effectiveGroupAllowFrom, allowNameMatching, groupPolicy } = await resolveMSTeamsSenderAccess({
2312
- cfg,
2313
- activity
2314
- });
2315
- const useAccessGroups = cfg.commands?.useAccessGroups !== false;
2316
- const isChannel = conversationType === "channel";
2317
- if (isDirectMessage && msteamsCfg && access.decision !== "allow") {
2318
- if (access.reason === "dmPolicy=disabled") {
2319
- log.info("dropping dm (dms disabled)", {
2320
- sender: senderId,
2321
- label: senderName
2322
- });
2323
- log.debug?.("dropping dm (dms disabled)");
2324
- return;
2325
- }
2326
- const allowMatch = resolveMSTeamsAllowlistMatch({
2327
- allowFrom: effectiveDmAllowFrom,
2328
- senderId,
2329
- senderName,
2330
- allowNameMatching
2331
- });
2332
- if (access.decision === "pairing") {
2333
- conversationStore.upsert(conversationId, conversationRef).catch((err) => {
2334
- log.debug?.("failed to save conversation reference", { error: formatUnknownError(err) });
2335
- });
2336
- if (await pairing.upsertPairingRequest({
2337
- id: senderId,
2338
- meta: { name: senderName }
2339
- })) log.info("msteams pairing request created", {
2340
- sender: senderId,
2341
- label: senderName
2342
- });
2343
- }
2344
- log.debug?.("dropping dm (not allowlisted)", {
2345
- sender: senderId,
2346
- label: senderName,
2347
- allowlistMatch: formatAllowlistMatchMeta(allowMatch)
2348
- });
2349
- log.info("dropping dm (not allowlisted)", {
2350
- sender: senderId,
2351
- label: senderName,
2352
- dmPolicy,
2353
- reason: access.reason,
2354
- allowlistMatch: formatAllowlistMatchMeta(allowMatch)
2355
- });
2356
- return;
2357
- }
2358
- if (!isDirectMessage && msteamsCfg) {
2359
- if (channelGate.allowlistConfigured && !channelGate.allowed) {
2360
- log.info("dropping group message (not in team/channel allowlist)", {
2361
- conversationId,
2362
- teamKey: channelGate.teamKey ?? "none",
2363
- channelKey: channelGate.channelKey ?? "none",
2364
- channelMatchKey: channelGate.channelMatchKey ?? "none",
2365
- channelMatchSource: channelGate.channelMatchSource ?? "none"
2366
- });
2367
- log.debug?.("dropping group message (not in team/channel allowlist)", {
2368
- conversationId,
2369
- teamKey: channelGate.teamKey ?? "none",
2370
- channelKey: channelGate.channelKey ?? "none",
2371
- channelMatchKey: channelGate.channelMatchKey ?? "none",
2372
- channelMatchSource: channelGate.channelMatchSource ?? "none"
2373
- });
2374
- return;
2375
- }
2376
- const senderGroupAccess = evaluateSenderGroupAccessForPolicy({
2377
- groupPolicy,
2378
- groupAllowFrom: effectiveGroupAllowFrom,
2379
- senderId,
2380
- isSenderAllowed: (_senderId, allowFrom) => resolveMSTeamsAllowlistMatch({
2381
- allowFrom,
2382
- senderId,
2383
- senderName,
2384
- allowNameMatching
2385
- }).allowed
2386
- });
2387
- if (!senderGroupAccess.allowed && senderGroupAccess.reason === "disabled") {
2388
- log.info("dropping group message (groupPolicy: disabled)", { conversationId });
2389
- log.debug?.("dropping group message (groupPolicy: disabled)", { conversationId });
2390
- return;
2391
- }
2392
- if (!senderGroupAccess.allowed && senderGroupAccess.reason === "empty_allowlist") {
2393
- log.info("dropping group message (groupPolicy: allowlist, no allowlist)", { conversationId });
2394
- log.debug?.("dropping group message (groupPolicy: allowlist, no allowlist)", { conversationId });
2395
- return;
2396
- }
2397
- if (!senderGroupAccess.allowed && senderGroupAccess.reason === "sender_not_allowlisted") {
2398
- const allowMatch = resolveMSTeamsAllowlistMatch({
2399
- allowFrom: effectiveGroupAllowFrom,
2400
- senderId,
2401
- senderName,
2402
- allowNameMatching
2403
- });
2404
- log.debug?.("dropping group message (not in groupAllowFrom)", {
2405
- sender: senderId,
2406
- label: senderName,
2407
- allowlistMatch: formatAllowlistMatchMeta(allowMatch)
2408
- });
2409
- log.info("dropping group message (not in groupAllowFrom)", {
2410
- sender: senderId,
2411
- label: senderName,
2412
- allowlistMatch: formatAllowlistMatchMeta(allowMatch)
2413
- });
2414
- return;
2415
- }
2416
- }
2417
- const commandDmAllowFrom = isDirectMessage ? effectiveDmAllowFrom : configuredDmAllowFrom;
2418
- const ownerAllowedForCommands = isMSTeamsGroupAllowed({
2419
- groupPolicy: "allowlist",
2420
- allowFrom: commandDmAllowFrom,
2421
- senderId,
2422
- senderName,
2423
- allowNameMatching
2424
- });
2425
- const groupAllowedForCommands = isMSTeamsGroupAllowed({
2426
- groupPolicy: "allowlist",
2427
- allowFrom: effectiveGroupAllowFrom,
2428
- senderId,
2429
- senderName,
2430
- allowNameMatching
2431
- });
2432
- const { commandAuthorized, shouldBlock } = resolveDualTextControlCommandGate({
2433
- useAccessGroups,
2434
- primaryConfigured: commandDmAllowFrom.length > 0,
2435
- primaryAllowed: ownerAllowedForCommands,
2436
- secondaryConfigured: effectiveGroupAllowFrom.length > 0,
2437
- secondaryAllowed: groupAllowedForCommands,
2438
- hasControlCommand: core.channel.text.hasControlCommand(text, cfg)
2439
- });
2440
- if (shouldBlock) {
2441
- logInboundDrop({
2442
- log: logVerboseMessage,
2443
- channel: "msteams",
2444
- reason: "control command (unauthorized)",
2445
- target: senderId
2446
- });
2447
- return;
2448
- }
2449
- conversationStore.upsert(conversationId, conversationRef).catch((err) => {
2450
- log.debug?.("failed to save conversation reference", { error: formatUnknownError(err) });
2451
- });
2452
- const pollVote = extractMSTeamsPollVote(activity);
2453
- if (pollVote) {
2454
- try {
2455
- if (!await pollStore.recordVote({
2456
- pollId: pollVote.pollId,
2457
- voterId: senderId,
2458
- selections: pollVote.selections
2459
- })) log.debug?.("poll vote ignored (poll not found)", { pollId: pollVote.pollId });
2460
- else log.info("recorded poll vote", {
2461
- pollId: pollVote.pollId,
2462
- voter: senderId,
2463
- selections: pollVote.selections
2464
- });
2465
- } catch (err) {
2466
- log.error("failed to record poll vote", {
2467
- pollId: pollVote.pollId,
2468
- error: formatUnknownError(err)
2469
- });
2470
- }
2471
- return;
2472
- }
2473
- if (!rawBody) {
2474
- log.debug?.("skipping empty message after stripping mentions");
2475
- return;
2476
- }
2477
- const teamsFrom = isDirectMessage ? `msteams:${senderId}` : isChannel ? `msteams:channel:${conversationId}` : `msteams:group:${conversationId}`;
2478
- const teamsTo = isDirectMessage ? `user:${senderId}` : `conversation:${conversationId}`;
2479
- const route = core.channel.routing.resolveAgentRoute({
2480
- cfg,
2481
- channel: "msteams",
2482
- teamId,
2483
- peer: {
2484
- kind: isDirectMessage ? "direct" : isChannel ? "channel" : "group",
2485
- id: isDirectMessage ? senderId : conversationId
2486
- }
2487
- });
2488
- route.sessionKey = resolveMSTeamsRouteSessionKey({
2489
- baseSessionKey: route.sessionKey,
2490
- isChannel,
2491
- conversationMessageId,
2492
- replyToId: activity.replyToId
2493
- });
2494
- const preview = rawBody.replace(/\s+/g, " ").slice(0, 160);
2495
- const inboundLabel = isDirectMessage ? `Teams DM from ${senderName}` : `Teams message in ${conversationType} from ${senderName}`;
2496
- core.system.enqueueSystemEvent(`${inboundLabel}: ${preview}`, {
2497
- sessionKey: route.sessionKey,
2498
- contextKey: `msteams:message:${conversationId}:${activity.id ?? "unknown"}`
2499
- });
2500
- const channelId = conversationId;
2501
- const { teamConfig, channelConfig } = channelGate;
2502
- const { requireMention, replyStyle } = resolveMSTeamsReplyPolicy({
2503
- isDirectMessage,
2504
- globalConfig: msteamsCfg,
2505
- teamConfig,
2506
- channelConfig
2507
- });
2508
- const timestamp = parseMSTeamsActivityTimestamp(activity.timestamp);
2509
- const mentionDecision = resolveInboundMentionDecision({
2510
- facts: {
2511
- canDetectMention: true,
2512
- wasMentioned: params.wasMentioned,
2513
- implicitMentionKinds: params.implicitMentionKinds
2514
- },
2515
- policy: {
2516
- isGroup: !isDirectMessage,
2517
- requireMention,
2518
- allowTextCommands: false,
2519
- hasControlCommand: false,
2520
- commandAuthorized: false
2521
- }
2522
- });
2523
- if (!isDirectMessage) {
2524
- const mentioned = mentionDecision.effectiveWasMentioned;
2525
- if (requireMention && mentionDecision.shouldSkip) {
2526
- log.debug?.("skipping message (mention required)", {
2527
- teamId,
2528
- channelId,
2529
- requireMention,
2530
- mentioned
2531
- });
2532
- recordPendingHistoryEntryIfEnabled({
2533
- historyMap: conversationHistories,
2534
- historyKey: conversationId,
2535
- limit: historyLimit,
2536
- entry: {
2537
- sender: senderName,
2538
- body: rawBody,
2539
- timestamp: timestamp?.getTime(),
2540
- messageId: activity.id ?? void 0
2541
- }
2542
- });
2543
- return;
2544
- }
2545
- }
2546
- let graphConversationId = translateMSTeamsDmConversationIdForGraph({
2547
- isDirectMessage,
2548
- conversationId,
2549
- aadObjectId: from.aadObjectId,
2550
- appId
2551
- });
2552
- if (isDirectMessage && conversationId.startsWith("a:")) {
2553
- const cached = await conversationStore.get(conversationId);
2554
- if (cached?.graphChatId) graphConversationId = cached.graphChatId;
2555
- else try {
2556
- const resolved = await resolveGraphChatId({
2557
- botFrameworkConversationId: conversationId,
2558
- userAadObjectId: from.aadObjectId ?? void 0,
2559
- tokenProvider
2560
- });
2561
- if (resolved) {
2562
- graphConversationId = resolved;
2563
- conversationStore.upsert(conversationId, {
2564
- ...conversationRef,
2565
- graphChatId: resolved
2566
- }).catch(() => {});
2567
- }
2568
- } catch {
2569
- log.debug?.("failed to resolve Graph chat ID for inbound media", { conversationId });
2570
- }
2571
- }
2572
- const mediaPayload = buildMSTeamsMediaPayload(await resolveMSTeamsInboundMedia({
2573
- attachments,
2574
- htmlSummary: htmlSummary ?? void 0,
2575
- maxBytes: mediaMaxBytes,
2576
- tokenProvider,
2577
- allowHosts: msteamsCfg?.mediaAllowHosts,
2578
- authAllowHosts: msteamsCfg?.mediaAuthAllowHosts,
2579
- conversationType,
2580
- conversationId: graphConversationId,
2581
- conversationMessageId: conversationMessageId ?? void 0,
2582
- serviceUrl: activity.serviceUrl,
2583
- activity: {
2584
- id: activity.id,
2585
- replyToId: activity.replyToId,
2586
- channelData: activity.channelData
2587
- },
2588
- log,
2589
- preserveFilenames: cfg.media?.preserveFilenames
2590
- }));
2591
- let threadContext;
2592
- if (activity.replyToId && isChannel && teamId) try {
2593
- const graphToken = await tokenProvider.getAccessToken("https://graph.microsoft.com");
2594
- const groupId = await resolveTeamGroupId(graphToken, teamId);
2595
- const [parentResult, repliesResult] = await Promise.allSettled([fetchParentMessageCached(graphToken, groupId, conversationId, activity.replyToId), fetchThreadReplies(graphToken, groupId, conversationId, activity.replyToId)]);
2596
- const parentMsg = parentResult.status === "fulfilled" ? parentResult.value : void 0;
2597
- const replies = repliesResult.status === "fulfilled" ? repliesResult.value : [];
2598
- if (parentResult.status === "rejected") log.debug?.("failed to fetch parent message", { error: formatUnknownError(parentResult.reason) });
2599
- if (repliesResult.status === "rejected") log.debug?.("failed to fetch thread replies", { error: formatUnknownError(repliesResult.reason) });
2600
- const isThreadSenderAllowed = (msg) => groupPolicy === "allowlist" ? resolveMSTeamsAllowlistMatch({
2601
- allowFrom: effectiveGroupAllowFrom,
2602
- senderId: msg.from?.user?.id ?? "",
2603
- senderName: msg.from?.user?.displayName,
2604
- allowNameMatching
2605
- }).allowed : true;
2606
- const parentSummary = summarizeParentMessage(parentMsg);
2607
- const visibleParentMessages = parentMsg ? filterSupplementalContextItems({
2608
- items: [parentMsg],
2609
- mode: contextVisibilityMode,
2610
- kind: "thread",
2611
- isSenderAllowed: isThreadSenderAllowed
2612
- }).items : [];
2613
- if (parentSummary && visibleParentMessages.length > 0 && shouldInjectParentContext(route.sessionKey, activity.replyToId)) {
2614
- core.system.enqueueSystemEvent(formatParentContextEvent(parentSummary), {
2615
- sessionKey: route.sessionKey,
2616
- contextKey: `msteams:thread-parent:${conversationId}:${activity.replyToId}`
2617
- });
2618
- markParentContextInjected(route.sessionKey, activity.replyToId);
2619
- }
2620
- const allMessages = parentMsg ? [parentMsg, ...replies] : replies;
2621
- quoteSenderId = parentMsg?.from?.user?.id ?? parentMsg?.from?.application?.id ?? void 0;
2622
- quoteSenderName = parentMsg?.from?.user?.displayName ?? parentMsg?.from?.application?.displayName ?? quoteInfo?.sender;
2623
- const { items: threadMessages } = filterSupplementalContextItems({
2624
- items: allMessages,
2625
- mode: contextVisibilityMode,
2626
- kind: "thread",
2627
- isSenderAllowed: isThreadSenderAllowed
2628
- });
2629
- const formatted = formatThreadContext(threadMessages, activity.id);
2630
- if (formatted) threadContext = formatted;
2631
- } catch (err) {
2632
- log.debug?.("failed to fetch thread history", { error: formatUnknownError(err) });
2633
- }
2634
- quoteSenderName ??= quoteInfo?.sender;
2635
- const envelopeFrom = isDirectMessage ? senderName : conversationType;
2636
- const { storePath, envelopeOptions, previousTimestamp } = resolveInboundSessionEnvelopeContext({
2637
- cfg,
2638
- agentId: route.agentId,
2639
- sessionKey: route.sessionKey
2640
- });
2641
- let combinedBody = core.channel.reply.formatAgentEnvelope({
2642
- channel: "Teams",
2643
- from: envelopeFrom,
2644
- timestamp,
2645
- previousTimestamp,
2646
- envelope: envelopeOptions,
2647
- body: rawBody
2648
- });
2649
- const isRoomish = !isDirectMessage;
2650
- const historyKey = isRoomish ? conversationId : void 0;
2651
- if (isRoomish && historyKey) combinedBody = buildPendingHistoryContextFromMap({
2652
- historyMap: conversationHistories,
2653
- historyKey,
2654
- limit: historyLimit,
2655
- currentMessage: combinedBody,
2656
- formatEntry: (entry) => core.channel.reply.formatAgentEnvelope({
2657
- channel: "Teams",
2658
- from: conversationType,
2659
- timestamp: entry.timestamp,
2660
- body: `${entry.sender}: ${entry.body}${entry.messageId ? ` [id:${entry.messageId}]` : ""}`,
2661
- envelope: envelopeOptions
2662
- })
2663
- });
2664
- const inboundHistory = isRoomish && historyKey && historyLimit > 0 ? (conversationHistories.get(historyKey) ?? []).map((entry) => ({
2665
- sender: entry.sender,
2666
- body: entry.body,
2667
- timestamp: entry.timestamp
2668
- })) : void 0;
2669
- const commandBody = text.trim();
2670
- const quoteSenderAllowed = quoteInfo && quoteInfo.sender ? !isChannel || groupPolicy !== "allowlist" ? true : resolveMSTeamsAllowlistMatch({
2671
- allowFrom: effectiveGroupAllowFrom,
2672
- senderId: quoteSenderId ?? "",
2673
- senderName: quoteSenderName,
2674
- allowNameMatching
2675
- }).allowed : true;
2676
- const includeQuoteContext = quoteInfo && shouldIncludeSupplementalContext({
2677
- mode: contextVisibilityMode,
2678
- kind: "quote",
2679
- senderAllowed: quoteSenderAllowed
2680
- });
2681
- const bodyForAgent = threadContext ? `[Thread history]\n${threadContext}\n[/Thread history]\n\n${rawBody}` : rawBody;
2682
- const nativeChannelId = isChannel && teamId ? `${teamId}/${conversationId}` : void 0;
2683
- const ctxPayload = core.channel.reply.finalizeInboundContext({
2684
- Body: combinedBody,
2685
- BodyForAgent: bodyForAgent,
2686
- InboundHistory: inboundHistory,
2687
- RawBody: rawBody,
2688
- CommandBody: commandBody,
2689
- BodyForCommands: commandBody,
2690
- From: teamsFrom,
2691
- To: teamsTo,
2692
- SessionKey: route.sessionKey,
2693
- AccountId: route.accountId,
2694
- ChatType: isDirectMessage ? "direct" : isChannel ? "channel" : "group",
2695
- ConversationLabel: envelopeFrom,
2696
- GroupSubject: !isDirectMessage ? conversationType : void 0,
2697
- GroupSpace: teamId,
2698
- SenderName: senderName,
2699
- SenderId: senderId,
2700
- Provider: "msteams",
2701
- Surface: "msteams",
2702
- MessageSid: activity.id,
2703
- Timestamp: timestamp?.getTime() ?? Date.now(),
2704
- WasMentioned: isDirectMessage || mentionDecision.effectiveWasMentioned,
2705
- CommandAuthorized: commandAuthorized,
2706
- OriginatingChannel: "msteams",
2707
- OriginatingTo: teamsTo,
2708
- NativeChannelId: nativeChannelId,
2709
- ReplyToId: activity.replyToId ?? void 0,
2710
- ReplyToBody: includeQuoteContext ? quoteInfo?.body : void 0,
2711
- ReplyToSender: includeQuoteContext ? quoteInfo?.sender : void 0,
2712
- ReplyToIsQuote: quoteInfo ? true : void 0,
2713
- ...mediaPayload
2714
- });
2715
- await core.channel.session.recordInboundSession({
2716
- storePath,
2717
- sessionKey: ctxPayload.SessionKey ?? route.sessionKey,
2718
- ctx: ctxPayload,
2719
- onRecordError: (err) => {
2720
- logVerboseMessage(`msteams: failed updating session meta: ${formatUnknownError(err)}`);
2721
- }
2722
- });
2723
- logVerboseMessage(`msteams inbound: from=${ctxPayload.From} preview="${preview}"`);
2724
- const sharePointSiteId = msteamsCfg?.sharePointSiteId;
2725
- const { dispatcher, replyOptions, markDispatchIdle } = createMSTeamsReplyDispatcher({
2726
- cfg,
2727
- agentId: route.agentId,
2728
- sessionKey: route.sessionKey,
2729
- accountId: route.accountId,
2730
- runtime,
2731
- log,
2732
- adapter,
2733
- appId,
2734
- conversationRef,
2735
- context,
2736
- replyStyle,
2737
- textLimit,
2738
- onSentMessageIds: (ids) => {
2739
- for (const id of ids) recordMSTeamsSentMessage(conversationId, id);
2740
- },
2741
- tokenProvider,
2742
- sharePointSiteId
2743
- });
2744
- const senderTimezone = (activity.entities?.find((e) => e.type === "clientInfo"))?.timezone || conversationRef.timezone;
2745
- const configOverride = senderTimezone && !cfg.agents?.defaults?.userTimezone ? { agents: { defaults: {
2746
- ...cfg.agents?.defaults,
2747
- userTimezone: senderTimezone
2748
- } } } : void 0;
2749
- log.info("dispatching to agent", { sessionKey: route.sessionKey });
2750
- try {
2751
- const { queuedFinal, counts } = await dispatchReplyFromConfigWithSettledDispatcher({
2752
- cfg,
2753
- ctxPayload,
2754
- dispatcher,
2755
- onSettled: () => markDispatchIdle(),
2756
- replyOptions,
2757
- configOverride
2758
- });
2759
- log.info("dispatch complete", {
2760
- queuedFinal,
2761
- counts
2762
- });
2763
- if (!queuedFinal) {
2764
- if (isRoomish && historyKey) clearHistoryEntriesIfEnabled({
2765
- historyMap: conversationHistories,
2766
- historyKey,
2767
- limit: historyLimit
2768
- });
2769
- return;
2770
- }
2771
- const finalCount = counts.final;
2772
- logVerboseMessage(`msteams: delivered ${finalCount} reply${finalCount === 1 ? "" : "ies"} to ${teamsTo}`);
2773
- if (isRoomish && historyKey) clearHistoryEntriesIfEnabled({
2774
- historyMap: conversationHistories,
2775
- historyKey,
2776
- limit: historyLimit
2777
- });
2778
- } catch (err) {
2779
- log.error("dispatch failed", { error: formatUnknownError(err) });
2780
- runtime.error?.(`msteams dispatch failed: ${formatUnknownError(err)}`);
2781
- try {
2782
- await context.sendActivity("⚠️ Something went wrong. Please try again.");
2783
- } catch {}
2784
- }
2785
- };
2786
- const inboundDebouncer = core.channel.debounce.createInboundDebouncer({
2787
- debounceMs: inboundDebounceMs,
2788
- buildKey: (entry) => {
2789
- const conversationId = normalizeMSTeamsConversationId(entry.context.activity.conversation?.id ?? "");
2790
- const senderId = entry.context.activity.from?.aadObjectId ?? entry.context.activity.from?.id ?? "";
2791
- if (!senderId || !conversationId) return null;
2792
- return `msteams:${appId}:${conversationId}:${senderId}`;
2793
- },
2794
- shouldDebounce: (entry) => {
2795
- if (!entry.text.trim()) return false;
2796
- if (entry.attachments.length > 0) return false;
2797
- return !core.channel.text.hasControlCommand(entry.text, cfg);
2798
- },
2799
- onFlush: async (entries) => {
2800
- const last = entries.at(-1);
2801
- if (!last) return;
2802
- if (entries.length === 1) {
2803
- await handleTeamsMessageNow(last);
2804
- return;
2805
- }
2806
- const combinedText = entries.map((entry) => entry.text).filter(Boolean).join("\n");
2807
- if (!combinedText.trim()) return;
2808
- const combinedRawText = entries.map((entry) => entry.rawText).filter(Boolean).join("\n");
2809
- const wasMentioned = entries.some((entry) => entry.wasMentioned);
2810
- const implicitMentionKinds = entries.flatMap((entry) => entry.implicitMentionKinds);
2811
- await handleTeamsMessageNow({
2812
- context: last.context,
2813
- rawText: combinedRawText,
2814
- text: combinedText,
2815
- attachments: [],
2816
- wasMentioned,
2817
- implicitMentionKinds
2818
- });
2819
- },
2820
- onError: (err) => {
2821
- runtime.error?.(`msteams debounce flush failed: ${formatUnknownError(err)}`);
2822
- }
2823
- });
2824
- return async function handleTeamsMessage(context) {
2825
- const activity = context.activity;
2826
- const attachments = Array.isArray(activity.attachments) ? activity.attachments : [];
2827
- const rawText = activity.text?.trim() ?? "";
2828
- const htmlText = extractTextFromHtmlAttachments(attachments);
2829
- const text = stripMSTeamsMentionTags(rawText || htmlText);
2830
- const wasMentioned = wasMSTeamsBotMentioned(activity);
2831
- const conversationId = normalizeMSTeamsConversationId(activity.conversation?.id ?? "");
2832
- const replyToId = activity.replyToId ?? void 0;
2833
- const implicitMentionKinds = conversationId && replyToId && wasMSTeamsMessageSent(conversationId, replyToId) ? ["reply_to_bot"] : [];
2834
- await inboundDebouncer.enqueue({
2835
- context,
2836
- rawText,
2837
- text,
2838
- attachments,
2839
- wasMentioned,
2840
- implicitMentionKinds
2841
- });
2842
- };
2843
- }
2844
- //#endregion
2845
- //#region extensions/msteams/src/monitor-handler/reaction-handler.ts
2846
- /** Teams reaction type names → Unicode emoji. */
2847
- const TEAMS_REACTION_EMOJI = {
2848
- like: "👍",
2849
- heart: "❤️",
2850
- laugh: "😆",
2851
- surprised: "😮",
2852
- sad: "😢",
2853
- angry: "😡"
2854
- };
2855
- /**
2856
- * Map a Teams reaction type string to a Unicode emoji.
2857
- * Falls back to the raw type if not recognized.
2858
- */
2859
- function mapReactionEmoji(reactionType) {
2860
- return TEAMS_REACTION_EMOJI[reactionType] ?? reactionType;
2861
- }
2862
- /**
2863
- * Create a handler for MS Teams reaction activities (reactionsAdded / reactionsRemoved).
2864
- * The returned function accepts a turn context and a direction string.
2865
- */
2866
- function createMSTeamsReactionHandler(deps) {
2867
- const { cfg, log } = deps;
2868
- const core = getMSTeamsRuntime();
2869
- const msteamsCfg = cfg.channels?.msteams;
2870
- const pairing = createChannelPairingController({
2871
- core,
2872
- channel: "msteams",
2873
- accountId: DEFAULT_ACCOUNT_ID
2874
- });
2875
- return async function handleReaction(context, direction) {
2876
- const activity = context.activity;
2877
- const reactions = direction === "added" ? activity.reactionsAdded ?? [] : activity.reactionsRemoved ?? [];
2878
- if (reactions.length === 0) {
2879
- log.debug?.("reaction activity has no reactions; skipping");
2880
- return;
2881
- }
2882
- const from = activity.from;
2883
- if (!from?.id) {
2884
- log.debug?.("reaction activity missing from.id; skipping");
2885
- return;
2886
- }
2887
- const conversationId = normalizeMSTeamsConversationId(activity.conversation?.id ?? "");
2888
- const conversationType = activity.conversation?.conversationType ?? "personal";
2889
- const isGroupChat = conversationType === "groupChat" || activity.conversation?.isGroup === true;
2890
- const isChannel = conversationType === "channel";
2891
- const isDirectMessage = !isGroupChat && !isChannel;
2892
- const senderId = from.aadObjectId ?? from.id;
2893
- const senderName = from.name ?? from.id;
2894
- const dmPolicy = msteamsCfg?.dmPolicy ?? "pairing";
2895
- const storedAllowFrom = await readStoreAllowFromForDmPolicy({
2896
- provider: "msteams",
2897
- accountId: pairing.accountId,
2898
- dmPolicy,
2899
- readStore: pairing.readStoreForDmPolicy
2900
- });
2901
- const dmAllowFrom = msteamsCfg?.allowFrom ?? [];
2902
- const groupAllowFrom = msteamsCfg?.groupAllowFrom;
2903
- const resolvedAllowFromLists = resolveEffectiveAllowFromLists({
2904
- allowFrom: dmAllowFrom,
2905
- groupAllowFrom,
2906
- storeAllowFrom: storedAllowFrom,
2907
- dmPolicy
2908
- });
2909
- const defaultGroupPolicy = resolveDefaultGroupPolicy(cfg);
2910
- if (isDirectMessage && msteamsCfg) {
2911
- const access = resolveDmGroupAccessWithLists({
2912
- isGroup: false,
2913
- dmPolicy,
2914
- groupPolicy: msteamsCfg.groupPolicy ?? defaultGroupPolicy ?? "allowlist",
2915
- allowFrom: dmAllowFrom,
2916
- groupAllowFrom,
2917
- storeAllowFrom: storedAllowFrom,
2918
- groupAllowFromFallbackToAllowFrom: false,
2919
- isSenderAllowed: (allowFrom) => resolveMSTeamsAllowlistMatch({
2920
- allowFrom,
2921
- senderId,
2922
- senderName,
2923
- allowNameMatching: isDangerousNameMatchingEnabled(msteamsCfg)
2924
- }).allowed
2925
- });
2926
- if (access.decision !== "allow") {
2927
- log.debug?.("dropping reaction (dm access denied)", {
2928
- sender: senderId,
2929
- reason: access.reason
2930
- });
2931
- return;
2932
- }
2933
- }
2934
- if (!isDirectMessage && msteamsCfg) {
2935
- const teamId = activity.channelData?.team?.id;
2936
- const teamName = activity.channelData?.team?.name;
2937
- const channelName = activity.channelData?.channel?.name;
2938
- const channelGate = resolveMSTeamsRouteConfig({
2939
- cfg: msteamsCfg,
2940
- teamId,
2941
- teamName,
2942
- conversationId,
2943
- channelName,
2944
- allowNameMatching: isDangerousNameMatchingEnabled(msteamsCfg)
2945
- });
2946
- if (channelGate.allowlistConfigured && !channelGate.allowed) {
2947
- log.debug?.("dropping reaction (not in team/channel allowlist)", { conversationId });
2948
- return;
2949
- }
2950
- const effectiveGroupAllowFrom = resolvedAllowFromLists.effectiveGroupAllowFrom;
2951
- if (!isMSTeamsGroupAllowed({
2952
- groupPolicy: msteamsCfg.groupPolicy ?? defaultGroupPolicy ?? "allowlist",
2953
- allowFrom: effectiveGroupAllowFrom,
2954
- senderId,
2955
- senderName,
2956
- allowNameMatching: isDangerousNameMatchingEnabled(msteamsCfg)
2957
- })) {
2958
- log.debug?.("dropping reaction (sender not in group allowlist)", { sender: senderId });
2959
- return;
2960
- }
2961
- }
2962
- const teamId = isDirectMessage ? void 0 : activity.channelData?.team?.id;
2963
- const route = core.channel.routing.resolveAgentRoute({
2964
- cfg,
2965
- channel: "msteams",
2966
- peer: {
2967
- kind: isDirectMessage ? "direct" : isChannel ? "channel" : "group",
2968
- id: isDirectMessage ? senderId : conversationId
2969
- },
2970
- ...teamId ? { teamId } : {}
2971
- });
2972
- const targetMessageId = activity.replyToId ?? "unknown";
2973
- for (const reaction of reactions) {
2974
- const reactionType = reaction.type ?? "unknown";
2975
- const emoji = mapReactionEmoji(reactionType);
2976
- const label = direction === "added" ? `Teams reaction ${emoji} added by ${senderName} on message ${targetMessageId}` : `Teams reaction ${emoji} removed by ${senderName} from message ${targetMessageId}`;
2977
- log.info(`reaction ${direction}`, {
2978
- sender: senderId,
2979
- reactionType,
2980
- emoji,
2981
- targetMessageId,
2982
- conversationId
2983
- });
2984
- core.system.enqueueSystemEvent(label, {
2985
- sessionKey: route.sessionKey,
2986
- contextKey: `msteams:reaction:${conversationId}:${targetMessageId}:${senderId}:${reactionType}:${direction}`
2987
- });
2988
- }
2989
- };
2990
- }
2991
- //#endregion
2992
- //#region extensions/msteams/src/sso.ts
2993
- /** Scope used to obtain a Bot Framework service token. */
2994
- const BOT_FRAMEWORK_TOKEN_SCOPE = "https://api.botframework.com/.default";
2995
- /**
2996
- * Extract and validate the `signin/tokenExchange` activity value. Teams
2997
- * delivers `{ id, connectionName, token }`; any field may be missing on
2998
- * malformed invocations, so callers should check the parsed result.
2999
- */
3000
- function parseSigninTokenExchangeValue(value) {
3001
- if (!value || typeof value !== "object") return null;
3002
- const obj = value;
3003
- return {
3004
- id: typeof obj.id === "string" ? obj.id : void 0,
3005
- connectionName: typeof obj.connectionName === "string" ? obj.connectionName : void 0,
3006
- token: typeof obj.token === "string" ? obj.token : void 0
3007
- };
3008
- }
3009
- /** Extract the `signin/verifyState` activity value `{ state }`. */
3010
- function parseSigninVerifyStateValue(value) {
3011
- if (!value || typeof value !== "object") return null;
3012
- const obj = value;
3013
- return { state: typeof obj.state === "string" ? obj.state : void 0 };
3014
- }
3015
- async function callUserTokenService(params) {
3016
- const qs = new URLSearchParams(params.query).toString();
3017
- const url = `${params.baseUrl.replace(/\/+$/, "")}${params.path}?${qs}`;
3018
- const headers = {
3019
- Accept: "application/json",
3020
- Authorization: `Bearer ${params.bearerToken}`,
3021
- "User-Agent": buildUserAgent()
3022
- };
3023
- if (params.body !== void 0) headers["Content-Type"] = "application/json";
3024
- const response = await params.fetchImpl(url, {
3025
- method: params.method,
3026
- headers,
3027
- body: params.body === void 0 ? void 0 : JSON.stringify(params.body)
3028
- });
3029
- if (!response.ok) return {
3030
- error: await response.text().catch(() => "") || `HTTP ${response.status}`,
3031
- status: response.status
3032
- };
3033
- let parsed;
3034
- try {
3035
- parsed = await response.json();
3036
- } catch {
3037
- return {
3038
- error: "invalid JSON from User Token service",
3039
- status: response.status
3040
- };
3041
- }
3042
- if (!parsed || typeof parsed !== "object") return {
3043
- error: "empty response from User Token service",
3044
- status: response.status
3045
- };
3046
- const obj = parsed;
3047
- const token = typeof obj.token === "string" ? obj.token : void 0;
3048
- const connectionName = typeof obj.connectionName === "string" ? obj.connectionName : void 0;
3049
- const channelId = typeof obj.channelId === "string" ? obj.channelId : void 0;
3050
- const expiration = typeof obj.expiration === "string" ? obj.expiration : void 0;
3051
- if (!token || !connectionName) return {
3052
- error: "User Token service response missing token/connectionName",
3053
- status: 502
3054
- };
3055
- return {
3056
- channelId,
3057
- connectionName,
3058
- token,
3059
- expiration
3060
- };
3061
- }
3062
- /**
3063
- * Exchange a Teams SSO token for a delegated user token via Bot
3064
- * Framework's User Token service, then persist the result.
3065
- */
3066
- async function handleSigninTokenExchangeInvoke(params) {
3067
- const { value, user, deps } = params;
3068
- if (!user.userId) return {
3069
- ok: false,
3070
- code: "missing_user",
3071
- message: "no user id on invoke activity"
3072
- };
3073
- const connectionName = value.connectionName?.trim() || deps.connectionName;
3074
- if (!connectionName) return {
3075
- ok: false,
3076
- code: "missing_connection",
3077
- message: "no OAuth connection name"
3078
- };
3079
- if (!value.token) return {
3080
- ok: false,
3081
- code: "missing_token",
3082
- message: "no exchangeable token on invoke"
3083
- };
3084
- const bearer = await deps.tokenProvider.getAccessToken(BOT_FRAMEWORK_TOKEN_SCOPE);
3085
- const fetchImpl = deps.fetchImpl ?? globalThis.fetch;
3086
- const result = await callUserTokenService({
3087
- baseUrl: deps.userTokenBaseUrl ?? "https://token.botframework.com",
3088
- path: "/api/usertoken/exchange",
3089
- query: {
3090
- userId: user.userId,
3091
- connectionName,
3092
- channelId: user.channelId ?? "msteams"
3093
- },
3094
- method: "POST",
3095
- body: { token: value.token },
3096
- bearerToken: bearer,
3097
- fetchImpl
3098
- });
3099
- if ("error" in result) return {
3100
- ok: false,
3101
- code: result.status >= 500 ? "service_error" : "unexpected_response",
3102
- message: result.error,
3103
- status: result.status
3104
- };
3105
- await deps.tokenStore.save({
3106
- connectionName,
3107
- userId: user.userId,
3108
- token: result.token,
3109
- expiresAt: result.expiration,
3110
- updatedAt: (/* @__PURE__ */ new Date()).toISOString()
3111
- });
3112
- return {
3113
- ok: true,
3114
- token: result.token,
3115
- expiresAt: result.expiration
3116
- };
3117
- }
3118
- /**
3119
- * Finish a magic-code sign-in: look up the user token for the state
3120
- * code via Bot Framework's User Token service, then persist it.
3121
- */
3122
- async function handleSigninVerifyStateInvoke(params) {
3123
- const { value, user, deps } = params;
3124
- if (!user.userId) return {
3125
- ok: false,
3126
- code: "missing_user",
3127
- message: "no user id on invoke activity"
3128
- };
3129
- if (!deps.connectionName) return {
3130
- ok: false,
3131
- code: "missing_connection",
3132
- message: "no OAuth connection name"
3133
- };
3134
- const state = value.state?.trim();
3135
- if (!state) return {
3136
- ok: false,
3137
- code: "missing_state",
3138
- message: "no state code on invoke"
3139
- };
3140
- const bearer = await deps.tokenProvider.getAccessToken(BOT_FRAMEWORK_TOKEN_SCOPE);
3141
- const fetchImpl = deps.fetchImpl ?? globalThis.fetch;
3142
- const result = await callUserTokenService({
3143
- baseUrl: deps.userTokenBaseUrl ?? "https://token.botframework.com",
3144
- path: "/api/usertoken/GetToken",
3145
- query: {
3146
- userId: user.userId,
3147
- connectionName: deps.connectionName,
3148
- channelId: user.channelId ?? "msteams",
3149
- code: state
3150
- },
3151
- method: "GET",
3152
- bearerToken: bearer,
3153
- fetchImpl
3154
- });
3155
- if ("error" in result) return {
3156
- ok: false,
3157
- code: result.status >= 500 ? "service_error" : "unexpected_response",
3158
- message: result.error,
3159
- status: result.status
3160
- };
3161
- await deps.tokenStore.save({
3162
- connectionName: deps.connectionName,
3163
- userId: user.userId,
3164
- token: result.token,
3165
- expiresAt: result.expiration,
3166
- updatedAt: (/* @__PURE__ */ new Date()).toISOString()
3167
- });
3168
- return {
3169
- ok: true,
3170
- token: result.token,
3171
- expiresAt: result.expiration
3172
- };
3173
- }
3174
- //#endregion
3175
- //#region extensions/msteams/src/welcome-card.ts
3176
- /**
3177
- * Builds an Adaptive Card for welcoming users when the bot is added to a conversation.
3178
- */
3179
- const DEFAULT_PROMPT_STARTERS = [
3180
- "What can you do?",
3181
- "Summarize my last meeting",
3182
- "Help me draft an email"
3183
- ];
3184
- /**
3185
- * Build a welcome Adaptive Card for 1:1 personal chats.
3186
- */
3187
- function buildWelcomeCard(options) {
3188
- const botName = options?.botName || "Genesis";
3189
- const starters = options?.promptStarters?.length ? options.promptStarters : DEFAULT_PROMPT_STARTERS;
3190
- return {
3191
- type: "AdaptiveCard",
3192
- version: "1.5",
3193
- body: [{
3194
- type: "TextBlock",
3195
- text: `Hi! I'm ${botName}.`,
3196
- weight: "bolder",
3197
- size: "medium"
3198
- }, {
3199
- type: "TextBlock",
3200
- text: "I can help you with questions, tasks, and more. Here are some things to try:",
3201
- wrap: true
3202
- }],
3203
- actions: starters.map((label) => ({
3204
- type: "Action.Submit",
3205
- title: label,
3206
- data: { msteams: {
3207
- type: "imBack",
3208
- value: label
3209
- } }
3210
- }))
3211
- };
3212
- }
3213
- /**
3214
- * Build a brief welcome message for group chats (when the bot is @mentioned).
3215
- */
3216
- function buildGroupWelcomeText(botName) {
3217
- const name = botName || "Genesis";
3218
- return `Hi! I'm ${name}. Mention me with @${name} to get started.`;
3219
- }
3220
- //#endregion
3221
- //#region extensions/msteams/src/monitor-handler.ts
3222
- function serializeAdaptiveCardActionValue(value) {
3223
- if (typeof value === "string") {
3224
- const trimmed = value.trim();
3225
- return trimmed ? trimmed : null;
3226
- }
3227
- if (value === void 0) return null;
3228
- try {
3229
- return JSON.stringify(value);
3230
- } catch {
3231
- return null;
3232
- }
3233
- }
3234
- async function isInvokeAuthorized(params) {
3235
- const { context, deps, deniedLogs, includeInvokeName = false } = params;
3236
- const resolved = await resolveMSTeamsSenderAccess({
3237
- cfg: deps.cfg,
3238
- activity: context.activity
3239
- });
3240
- const { msteamsCfg, isDirectMessage, conversationId, senderId } = resolved;
3241
- if (!msteamsCfg) return true;
3242
- const maybeInvokeName = includeInvokeName ? { name: context.activity.name } : void 0;
3243
- if (isDirectMessage && resolved.access.decision !== "allow") {
3244
- deps.log.debug?.(deniedLogs.dm, {
3245
- sender: senderId,
3246
- conversationId,
3247
- ...maybeInvokeName
3248
- });
3249
- return false;
3250
- }
3251
- if (!isDirectMessage && resolved.channelGate.allowlistConfigured && !resolved.channelGate.allowed) {
3252
- deps.log.debug?.(deniedLogs.channel, {
3253
- conversationId,
3254
- teamKey: resolved.channelGate.teamKey ?? "none",
3255
- channelKey: resolved.channelGate.channelKey ?? "none",
3256
- ...maybeInvokeName
3257
- });
3258
- return false;
3259
- }
3260
- if (!isDirectMessage && !resolved.senderGroupAccess.allowed) {
3261
- deps.log.debug?.(deniedLogs.group, {
3262
- sender: senderId,
3263
- conversationId,
3264
- ...maybeInvokeName
3265
- });
3266
- return false;
3267
- }
3268
- return true;
3269
- }
3270
- async function isFeedbackInvokeAuthorized(context, deps) {
3271
- return isInvokeAuthorized({
3272
- context,
3273
- deps,
3274
- deniedLogs: {
3275
- dm: "dropping feedback invoke (dm sender not allowlisted)",
3276
- channel: "dropping feedback invoke (not in team/channel allowlist)",
3277
- group: "dropping feedback invoke (group sender not allowlisted)"
3278
- }
3279
- });
3280
- }
3281
- async function isSigninInvokeAuthorized(context, deps) {
3282
- return isInvokeAuthorized({
3283
- context,
3284
- deps,
3285
- deniedLogs: {
3286
- dm: "dropping signin invoke (dm sender not allowlisted)",
3287
- channel: "dropping signin invoke (not in team/channel allowlist)",
3288
- group: "dropping signin invoke (group sender not allowlisted)"
3289
- },
3290
- includeInvokeName: true
3291
- });
3292
- }
3293
- /**
3294
- * Parse and handle feedback invoke activities (thumbs up/down).
3295
- * Returns true if the activity was a feedback invoke, false otherwise.
3296
- */
3297
- async function handleFeedbackInvoke(context, deps) {
3298
- const activity = context.activity;
3299
- const value = activity.value;
3300
- if (!value) return false;
3301
- if (value.actionName !== "feedback") return false;
3302
- const reaction = value.actionValue?.reaction;
3303
- if (reaction !== "like" && reaction !== "dislike") {
3304
- deps.log.debug?.("ignoring feedback with unknown reaction", { reaction });
3305
- return false;
3306
- }
3307
- const msteamsCfg = deps.cfg.channels?.msteams;
3308
- if (msteamsCfg?.feedbackEnabled === false) {
3309
- deps.log.debug?.("feedback handling disabled");
3310
- return true;
3311
- }
3312
- if (!await isFeedbackInvokeAuthorized(context, deps)) return true;
3313
- let userComment;
3314
- if (value.actionValue?.feedback) try {
3315
- userComment = JSON.parse(value.actionValue.feedback).feedbackText || void 0;
3316
- } catch {}
3317
- const rawConversationId = activity.conversation?.id ?? "unknown";
3318
- const conversationId = normalizeMSTeamsConversationId(rawConversationId);
3319
- const senderId = activity.from?.aadObjectId ?? activity.from?.id ?? "unknown";
3320
- const messageId = value.replyToId ?? activity.replyToId ?? "unknown";
3321
- const isNegative = reaction === "dislike";
3322
- const convType = normalizeOptionalLowercaseString(activity.conversation?.conversationType);
3323
- const isDirectMessage = convType === "personal" || !convType && !activity.conversation?.isGroup;
3324
- const isChannel = convType === "channel";
3325
- const core = getMSTeamsRuntime();
3326
- const route = core.channel.routing.resolveAgentRoute({
3327
- cfg: deps.cfg,
3328
- channel: "msteams",
3329
- peer: {
3330
- kind: isDirectMessage ? "direct" : isChannel ? "channel" : "group",
3331
- id: isDirectMessage ? senderId : conversationId
3332
- }
3333
- });
3334
- const feedbackThreadId = isChannel ? extractMSTeamsConversationMessageId(rawConversationId) ?? activity.replyToId ?? void 0 : void 0;
3335
- if (feedbackThreadId) route.sessionKey = resolveThreadSessionKeys({
3336
- baseSessionKey: route.sessionKey,
3337
- threadId: feedbackThreadId,
3338
- parentSessionKey: route.sessionKey
3339
- }).sessionKey;
3340
- const feedbackEvent = buildFeedbackEvent({
3341
- messageId,
3342
- value: isNegative ? "negative" : "positive",
3343
- comment: userComment,
3344
- sessionKey: route.sessionKey,
3345
- agentId: route.agentId,
3346
- conversationId
3347
- });
3348
- deps.log.info("received feedback", {
3349
- value: feedbackEvent.value,
3350
- messageId,
3351
- conversationId,
3352
- hasComment: Boolean(userComment)
3353
- });
3354
- try {
3355
- const storePath = core.channel.session.resolveStorePath(deps.cfg.session?.store, { agentId: route.agentId });
3356
- const safeKey = route.sessionKey.replace(/[^a-zA-Z0-9_-]/g, "_");
3357
- const transcriptFile = path.join(storePath, `${safeKey}.jsonl`);
3358
- await fs.appendFile(transcriptFile, JSON.stringify(feedbackEvent) + "\n", "utf-8").catch(() => {});
3359
- } catch {}
3360
- const conversationRef = {
3361
- activityId: activity.id,
3362
- user: {
3363
- id: activity.from?.id,
3364
- name: activity.from?.name,
3365
- aadObjectId: activity.from?.aadObjectId
3366
- },
3367
- agent: activity.recipient ? {
3368
- id: activity.recipient.id,
3369
- name: activity.recipient.name
3370
- } : void 0,
3371
- bot: activity.recipient ? {
3372
- id: activity.recipient.id,
3373
- name: activity.recipient.name
3374
- } : void 0,
3375
- conversation: {
3376
- id: conversationId,
3377
- conversationType: activity.conversation?.conversationType,
3378
- tenantId: activity.conversation?.tenantId
3379
- },
3380
- channelId: activity.channelId ?? "msteams",
3381
- serviceUrl: activity.serviceUrl,
3382
- locale: activity.locale
3383
- };
3384
- if (isNegative && msteamsCfg?.feedbackReflection !== false) runFeedbackReflection({
3385
- cfg: deps.cfg,
3386
- adapter: deps.adapter,
3387
- appId: deps.appId,
3388
- conversationRef,
3389
- sessionKey: route.sessionKey,
3390
- agentId: route.agentId,
3391
- conversationId,
3392
- feedbackMessageId: messageId,
3393
- userComment,
3394
- log: deps.log
3395
- }).catch((err) => {
3396
- deps.log.error("feedback reflection failed", { error: formatUnknownError(err) });
3397
- });
3398
- return true;
3399
- }
3400
- function registerMSTeamsHandlers(handler, deps) {
3401
- const handleTeamsMessage = createMSTeamsMessageHandler(deps);
3402
- const handleReaction = createMSTeamsReactionHandler(deps);
3403
- const originalRun = handler.run;
3404
- if (originalRun) handler.run = async (context) => {
3405
- const ctx = context;
3406
- if (ctx.activity?.type === "invoke" && ctx.activity?.name === "fileConsent/invoke") {
3407
- await respondToMSTeamsFileConsentInvoke(ctx, deps.log);
3408
- return;
3409
- }
3410
- if (ctx.activity?.type === "invoke" && ctx.activity?.name === "message/submitAction") {
3411
- if (await handleFeedbackInvoke(ctx, deps)) return;
3412
- }
3413
- if (ctx.activity?.type === "invoke" && ctx.activity?.name === "adaptiveCard/action") {
3414
- const text = serializeAdaptiveCardActionValue(ctx.activity?.value);
3415
- if (text) {
3416
- await handleTeamsMessage({
3417
- ...ctx,
3418
- activity: {
3419
- ...ctx.activity,
3420
- type: "message",
3421
- text
3422
- }
3423
- });
3424
- return;
3425
- }
3426
- deps.log.debug?.("skipping adaptive card action invoke without value payload");
3427
- }
3428
- if (ctx.activity?.type === "invoke" && (ctx.activity?.name === "signin/tokenExchange" || ctx.activity?.name === "signin/verifyState")) {
3429
- await ctx.sendActivity({
3430
- type: "invokeResponse",
3431
- value: {
3432
- status: 200,
3433
- body: {}
3434
- }
3435
- });
3436
- if (!await isSigninInvokeAuthorized(ctx, deps)) return;
3437
- if (!deps.sso) {
3438
- deps.log.debug?.("signin invoke received but msteams.sso is not configured", { name: ctx.activity.name });
3439
- return;
3440
- }
3441
- const user = {
3442
- userId: ctx.activity.from?.aadObjectId ?? ctx.activity.from?.id ?? "",
3443
- channelId: ctx.activity.channelId ?? "msteams"
3444
- };
3445
- try {
3446
- if (ctx.activity.name === "signin/tokenExchange") {
3447
- const parsed = parseSigninTokenExchangeValue(ctx.activity.value);
3448
- if (!parsed) {
3449
- deps.log.debug?.("invalid signin/tokenExchange invoke value");
3450
- return;
3451
- }
3452
- const result = await handleSigninTokenExchangeInvoke({
3453
- value: parsed,
3454
- user,
3455
- deps: deps.sso
3456
- });
3457
- if (result.ok) deps.log.info("msteams sso token exchanged", {
3458
- userId: user.userId,
3459
- hasExpiry: Boolean(result.expiresAt)
3460
- });
3461
- else deps.log.error("msteams sso token exchange failed", {
3462
- code: result.code,
3463
- status: result.status,
3464
- message: result.message
3465
- });
3466
- return;
3467
- }
3468
- const parsed = parseSigninVerifyStateValue(ctx.activity.value);
3469
- if (!parsed) {
3470
- deps.log.debug?.("invalid signin/verifyState invoke value");
3471
- return;
3472
- }
3473
- const result = await handleSigninVerifyStateInvoke({
3474
- value: parsed,
3475
- user,
3476
- deps: deps.sso
3477
- });
3478
- if (result.ok) deps.log.info("msteams sso verifyState succeeded", {
3479
- userId: user.userId,
3480
- hasExpiry: Boolean(result.expiresAt)
3481
- });
3482
- else deps.log.error("msteams sso verifyState failed", {
3483
- code: result.code,
3484
- status: result.status,
3485
- message: result.message
3486
- });
3487
- } catch (err) {
3488
- deps.log.error("msteams sso invoke handler error", { error: formatUnknownError(err) });
3489
- }
3490
- return;
3491
- }
3492
- return originalRun.call(handler, context);
3493
- };
3494
- handler.onMessage(async (context, next) => {
3495
- try {
3496
- await handleTeamsMessage(context);
3497
- } catch (err) {
3498
- deps.runtime.error?.(`msteams handler failed: ${formatUnknownError(err)}`);
3499
- }
3500
- await next();
3501
- });
3502
- handler.onMembersAdded(async (context, next) => {
3503
- const ctx = context;
3504
- const membersAdded = ctx.activity?.membersAdded ?? [];
3505
- const botId = ctx.activity?.recipient?.id;
3506
- const msteamsCfg = deps.cfg.channels?.msteams;
3507
- for (const member of membersAdded) if (member.id === botId) {
3508
- const isPersonal = (normalizeOptionalLowercaseString(ctx.activity?.conversation?.conversationType) ?? "personal") === "personal";
3509
- if (isPersonal && msteamsCfg?.welcomeCard !== false) {
3510
- const card = buildWelcomeCard({
3511
- botName: ctx.activity?.recipient?.name ?? void 0,
3512
- promptStarters: msteamsCfg?.promptStarters
3513
- });
3514
- try {
3515
- await ctx.sendActivity({
3516
- type: "message",
3517
- attachments: [{
3518
- contentType: "application/vnd.microsoft.card.adaptive",
3519
- content: card
3520
- }]
3521
- });
3522
- deps.log.info("sent welcome card");
3523
- } catch (err) {
3524
- deps.log.debug?.("failed to send welcome card", { error: formatUnknownError(err) });
3525
- }
3526
- } else if (!isPersonal && msteamsCfg?.groupWelcomeCard === true) {
3527
- const botName = ctx.activity?.recipient?.name ?? void 0;
3528
- try {
3529
- await ctx.sendActivity(buildGroupWelcomeText(botName));
3530
- deps.log.info("sent group welcome message");
3531
- } catch (err) {
3532
- deps.log.debug?.("failed to send group welcome", { error: formatUnknownError(err) });
3533
- }
3534
- } else deps.log.debug?.("skipping welcome (disabled by config or conversation type)");
3535
- } else deps.log.debug?.("member added", { member: member.id });
3536
- await next();
3537
- });
3538
- handler.onReactionsAdded(async (context, next) => {
3539
- try {
3540
- await handleReaction(context, "added");
3541
- } catch (err) {
3542
- deps.runtime.error?.(`msteams reaction handler failed: ${String(err)}`);
3543
- }
3544
- await next();
3545
- });
3546
- handler.onReactionsRemoved(async (context, next) => {
3547
- try {
3548
- await handleReaction(context, "removed");
3549
- } catch (err) {
3550
- deps.runtime.error?.(`msteams reaction handler failed: ${String(err)}`);
3551
- }
3552
- await next();
3553
- });
3554
- return handler;
3555
- }
3556
- //#endregion
3557
- //#region extensions/msteams/src/sso-token-store.ts
3558
- /**
3559
- * File-backed store for Bot Framework OAuth SSO tokens.
3560
- *
3561
- * Tokens are keyed by (connectionName, userId). `userId` should be the
3562
- * stable AAD object ID (`activity.from.aadObjectId`) when available,
3563
- * falling back to the Bot Framework `activity.from.id`.
3564
- *
3565
- * The store is intentionally minimal: it persists the exchanged user
3566
- * token plus its expiration so consumers (for example tool handlers
3567
- * that call Microsoft Graph with delegated permissions) can fetch a
3568
- * valid token without reaching back into Bot Framework every turn.
3569
- */
3570
- const STORE_FILENAME = "msteams-sso-tokens.json";
3571
- const STORE_KEY_VERSION_PREFIX = "v2:";
3572
- function makeKey(connectionName, userId) {
3573
- return `${STORE_KEY_VERSION_PREFIX}${Buffer.from(JSON.stringify([connectionName, userId]), "utf8").toString("base64url")}`;
3574
- }
3575
- function normalizeStoredToken(value) {
3576
- if (!value || typeof value !== "object") return null;
3577
- const token = value;
3578
- if (typeof token.connectionName !== "string" || !token.connectionName || typeof token.userId !== "string" || !token.userId || typeof token.token !== "string" || !token.token || typeof token.updatedAt !== "string" || !token.updatedAt) return null;
3579
- return {
3580
- connectionName: token.connectionName,
3581
- userId: token.userId,
3582
- token: token.token,
3583
- ...typeof token.expiresAt === "string" ? { expiresAt: token.expiresAt } : {},
3584
- updatedAt: token.updatedAt
3585
- };
3586
- }
3587
- function isSsoStoreData(value) {
3588
- if (!value || typeof value !== "object") return false;
3589
- const obj = value;
3590
- return obj.version === 1 && typeof obj.tokens === "object" && obj.tokens !== null;
3591
- }
3592
- function createMSTeamsSsoTokenStoreFs(params) {
3593
- const filePath = resolveMSTeamsStorePath({
3594
- filename: STORE_FILENAME,
3595
- env: params?.env,
3596
- homedir: params?.homedir,
3597
- stateDir: params?.stateDir,
3598
- storePath: params?.storePath
3599
- });
3600
- const empty = {
3601
- version: 1,
3602
- tokens: {}
3603
- };
3604
- const readStore = async () => {
3605
- const { value } = await readJsonFile(filePath, empty);
3606
- if (!isSsoStoreData(value)) return {
3607
- version: 1,
3608
- tokens: {}
3609
- };
3610
- const tokens = {};
3611
- for (const stored of Object.values(value.tokens)) {
3612
- const normalized = normalizeStoredToken(stored);
3613
- if (!normalized) continue;
3614
- tokens[makeKey(normalized.connectionName, normalized.userId)] = normalized;
3615
- }
3616
- return {
3617
- version: 1,
3618
- tokens
3619
- };
3620
- };
3621
- return {
3622
- async get({ connectionName, userId }) {
3623
- return (await readStore()).tokens[makeKey(connectionName, userId)] ?? null;
3624
- },
3625
- async save(token) {
3626
- await withFileLock(filePath, empty, async () => {
3627
- const store = await readStore();
3628
- const key = makeKey(token.connectionName, token.userId);
3629
- store.tokens[key] = { ...token };
3630
- await writeJsonFile(filePath, store);
3631
- });
3632
- },
3633
- async remove({ connectionName, userId }) {
3634
- let removed = false;
3635
- await withFileLock(filePath, empty, async () => {
3636
- const store = await readStore();
3637
- const key = makeKey(connectionName, userId);
3638
- if (store.tokens[key]) {
3639
- delete store.tokens[key];
3640
- removed = true;
3641
- await writeJsonFile(filePath, store);
3642
- }
3643
- });
3644
- return removed;
3645
- }
3646
- };
3647
- }
3648
- //#endregion
3649
- //#region extensions/msteams/src/webhook-timeouts.ts
3650
- const MSTEAMS_WEBHOOK_INACTIVITY_TIMEOUT_MS = 3e4;
3651
- const MSTEAMS_WEBHOOK_REQUEST_TIMEOUT_MS = 3e4;
3652
- const MSTEAMS_WEBHOOK_HEADERS_TIMEOUT_MS = 15e3;
3653
- function applyMSTeamsWebhookTimeouts(httpServer, opts) {
3654
- const inactivityTimeoutMs = opts?.inactivityTimeoutMs ?? MSTEAMS_WEBHOOK_INACTIVITY_TIMEOUT_MS;
3655
- const requestTimeoutMs = opts?.requestTimeoutMs ?? MSTEAMS_WEBHOOK_REQUEST_TIMEOUT_MS;
3656
- const headersTimeoutMs = Math.min(opts?.headersTimeoutMs ?? MSTEAMS_WEBHOOK_HEADERS_TIMEOUT_MS, requestTimeoutMs);
3657
- httpServer.setTimeout(inactivityTimeoutMs);
3658
- httpServer.requestTimeout = requestTimeoutMs;
3659
- httpServer.headersTimeout = headersTimeoutMs;
3660
- }
3661
- //#endregion
3662
- //#region extensions/msteams/src/monitor.ts
3663
- const MSTEAMS_WEBHOOK_MAX_BODY_BYTES = DEFAULT_WEBHOOK_MAX_BODY_BYTES;
3664
- async function monitorMSTeamsProvider(opts) {
3665
- const core = getMSTeamsRuntime();
3666
- const log = core.logging.getChildLogger({ name: "msteams" });
3667
- let cfg = opts.cfg;
3668
- let msteamsCfg = cfg.channels?.msteams;
3669
- if (!msteamsCfg?.enabled) {
3670
- log.debug?.("msteams provider disabled");
3671
- return {
3672
- app: null,
3673
- shutdown: async () => {}
3674
- };
3675
- }
3676
- const creds = resolveMSTeamsCredentials(msteamsCfg);
3677
- if (!creds) {
3678
- log.error("msteams credentials not configured");
3679
- return {
3680
- app: null,
3681
- shutdown: async () => {}
3682
- };
3683
- }
3684
- const appId = creds.appId;
3685
- const runtime = opts.runtime ?? {
3686
- log: console.log,
3687
- error: console.error,
3688
- exit: (code) => {
3689
- throw new Error(`exit ${code}`);
3690
- }
3691
- };
3692
- let allowFrom = msteamsCfg.allowFrom;
3693
- let groupAllowFrom = msteamsCfg.groupAllowFrom;
3694
- let teamsConfig = msteamsCfg.teams;
3695
- const cleanAllowEntry = (entry) => entry.replace(/^(msteams|teams):/i, "").replace(/^user:/i, "").trim();
3696
- const resolveAllowlistUsers = async (label, entries) => {
3697
- if (entries.length === 0) return {
3698
- additions: [],
3699
- unresolved: []
3700
- };
3701
- const resolved = await resolveMSTeamsUserAllowlist({
3702
- cfg,
3703
- entries
3704
- });
3705
- const additions = [];
3706
- const unresolved = [];
3707
- for (const entry of resolved) if (entry.resolved && entry.id) additions.push(entry.id);
3708
- else unresolved.push(entry.input);
3709
- summarizeMapping(label, resolved.filter((entry) => entry.resolved && entry.id).map((entry) => `${entry.input}→${entry.id}`), unresolved, runtime);
3710
- return {
3711
- additions,
3712
- unresolved
3713
- };
3714
- };
3715
- try {
3716
- const allowEntries = allowFrom?.map((entry) => cleanAllowEntry(entry)).filter((entry) => entry && entry !== "*") ?? [];
3717
- if (allowEntries.length > 0) {
3718
- const { additions } = await resolveAllowlistUsers("msteams users", allowEntries);
3719
- allowFrom = mergeAllowlist({
3720
- existing: allowFrom,
3721
- additions
3722
- });
3723
- }
3724
- if (Array.isArray(groupAllowFrom) && groupAllowFrom.length > 0) {
3725
- const groupEntries = groupAllowFrom.map((entry) => cleanAllowEntry(entry)).filter((entry) => entry && entry !== "*");
3726
- if (groupEntries.length > 0) {
3727
- const { additions } = await resolveAllowlistUsers("msteams group users", groupEntries);
3728
- groupAllowFrom = mergeAllowlist({
3729
- existing: groupAllowFrom,
3730
- additions
3731
- });
3732
- }
3733
- }
3734
- if (teamsConfig && Object.keys(teamsConfig).length > 0) {
3735
- const entries = [];
3736
- for (const [teamKey, teamCfg] of Object.entries(teamsConfig)) {
3737
- if (teamKey === "*") continue;
3738
- const channels = teamCfg?.channels ?? {};
3739
- const channelKeys = Object.keys(channels).filter((key) => key !== "*");
3740
- if (channelKeys.length === 0) {
3741
- entries.push({
3742
- input: teamKey,
3743
- teamKey
3744
- });
3745
- continue;
3746
- }
3747
- for (const channelKey of channelKeys) entries.push({
3748
- input: `${teamKey}/${channelKey}`,
3749
- teamKey,
3750
- channelKey
3751
- });
3752
- }
3753
- if (entries.length > 0) {
3754
- const resolved = await resolveMSTeamsChannelAllowlist({
3755
- cfg,
3756
- entries: entries.map((entry) => entry.input)
3757
- });
3758
- const mapping = [];
3759
- const unresolved = [];
3760
- const nextTeams = { ...teamsConfig };
3761
- resolved.forEach((entry, idx) => {
3762
- const source = entries[idx];
3763
- if (!source) return;
3764
- const sourceTeam = teamsConfig?.[source.teamKey] ?? {};
3765
- if (!entry.resolved || !entry.teamId) {
3766
- unresolved.push(entry.input);
3767
- return;
3768
- }
3769
- mapping.push(entry.channelId ? `${entry.input}→${entry.teamId}/${entry.channelId}` : `${entry.input}→${entry.teamId}`);
3770
- const existing = nextTeams[entry.teamId] ?? {};
3771
- const mergedChannels = {
3772
- ...sourceTeam.channels,
3773
- ...existing.channels
3774
- };
3775
- const mergedTeam = {
3776
- ...sourceTeam,
3777
- ...existing,
3778
- channels: mergedChannels
3779
- };
3780
- nextTeams[entry.teamId] = mergedTeam;
3781
- if (source.channelKey && entry.channelId) {
3782
- const sourceChannel = sourceTeam.channels?.[source.channelKey];
3783
- if (sourceChannel) nextTeams[entry.teamId] = {
3784
- ...mergedTeam,
3785
- channels: {
3786
- ...mergedChannels,
3787
- [entry.channelId]: {
3788
- ...sourceChannel,
3789
- ...mergedChannels?.[entry.channelId]
3790
- }
3791
- }
3792
- };
3793
- }
3794
- });
3795
- teamsConfig = nextTeams;
3796
- summarizeMapping("msteams channels", mapping, unresolved, runtime);
3797
- }
3798
- }
3799
- } catch (err) {
3800
- runtime.log?.(`msteams resolve failed; using config entries. ${formatUnknownError(err)}`);
3801
- }
3802
- msteamsCfg = {
3803
- ...msteamsCfg,
3804
- allowFrom,
3805
- groupAllowFrom,
3806
- teams: teamsConfig
3807
- };
3808
- cfg = {
3809
- ...cfg,
3810
- channels: {
3811
- ...cfg.channels,
3812
- msteams: msteamsCfg
3813
- }
3814
- };
3815
- const port = msteamsCfg.webhook?.port ?? 3978;
3816
- const textLimit = core.channel.text.resolveTextChunkLimit(cfg, "msteams");
3817
- const MB = 1024 * 1024;
3818
- const agentDefaults = cfg.agents?.defaults;
3819
- const mediaMaxBytes = typeof agentDefaults?.mediaMaxMb === "number" && agentDefaults.mediaMaxMb > 0 ? Math.floor(agentDefaults.mediaMaxMb * MB) : 8 * MB;
3820
- const conversationStore = opts.conversationStore ?? createMSTeamsConversationStoreFs();
3821
- const pollStore = opts.pollStore ?? createMSTeamsPollStoreFs();
3822
- log.info(`starting provider (port ${port})`);
3823
- const express = await import("express");
3824
- const { sdk, app } = await loadMSTeamsSdkWithAuth(creds);
3825
- const tokenProvider = createMSTeamsTokenProvider(app);
3826
- const adapter = createMSTeamsAdapter(app, sdk);
3827
- let ssoDeps;
3828
- if (msteamsCfg.sso?.enabled && msteamsCfg.sso.connectionName) {
3829
- ssoDeps = {
3830
- tokenProvider,
3831
- tokenStore: createMSTeamsSsoTokenStoreFs(),
3832
- connectionName: msteamsCfg.sso.connectionName
3833
- };
3834
- log.debug?.("msteams sso enabled", { connectionName: msteamsCfg.sso.connectionName });
3835
- }
3836
- const handler = buildActivityHandler();
3837
- registerMSTeamsHandlers(handler, {
3838
- cfg,
3839
- runtime,
3840
- appId,
3841
- adapter,
3842
- tokenProvider,
3843
- textLimit,
3844
- mediaMaxBytes,
3845
- conversationStore,
3846
- pollStore,
3847
- log,
3848
- sso: ssoDeps
3849
- });
3850
- const expressApp = express.default();
3851
- expressApp.use((req, res, next) => {
3852
- const auth = req.headers.authorization;
3853
- if (!auth || !auth.startsWith("Bearer ")) {
3854
- res.status(401).json({ error: "Unauthorized" });
3855
- return;
3856
- }
3857
- next();
3858
- });
3859
- const jwtValidator = await createBotFrameworkJwtValidator(creds);
3860
- expressApp.use((req, res, next) => {
3861
- const authHeader = req.headers.authorization;
3862
- jwtValidator.validate(authHeader).then((valid) => {
3863
- if (!valid) {
3864
- log.debug?.("JWT validation failed");
3865
- res.status(401).json({ error: "Unauthorized" });
3866
- return;
3867
- }
3868
- next();
3869
- }).catch((err) => {
3870
- log.debug?.(`JWT validation error: ${formatUnknownError(err)}`);
3871
- res.status(401).json({ error: "Unauthorized" });
3872
- });
3873
- });
3874
- expressApp.use(express.json({ limit: MSTEAMS_WEBHOOK_MAX_BODY_BYTES }));
3875
- expressApp.use((err, _req, res, next) => {
3876
- if (err && typeof err === "object" && "status" in err && err.status === 413) {
3877
- res.status(413).json({ error: "Payload too large" });
3878
- return;
3879
- }
3880
- next(err);
3881
- });
3882
- const configuredPath = msteamsCfg.webhook?.path ?? "/api/messages";
3883
- const messageHandler = (req, res) => {
3884
- adapter.process(req, res, (context) => handler.run(context)).catch((err) => {
3885
- log.error("msteams webhook failed", { error: formatUnknownError(err) });
3886
- });
3887
- };
3888
- expressApp.post(configuredPath, messageHandler);
3889
- if (configuredPath !== "/api/messages") expressApp.post("/api/messages", messageHandler);
3890
- log.debug?.("listening on paths", {
3891
- primary: configuredPath,
3892
- fallback: "/api/messages"
3893
- });
3894
- const httpServer = expressApp.listen(port);
3895
- await new Promise((resolve, reject) => {
3896
- const onListening = () => {
3897
- httpServer.off("error", onError);
3898
- log.info(`msteams provider started on port ${port}`);
3899
- resolve();
3900
- };
3901
- const onError = (err) => {
3902
- httpServer.off("listening", onListening);
3903
- log.error("msteams server error", { error: formatUnknownError(err) });
3904
- reject(err);
3905
- };
3906
- httpServer.once("listening", onListening);
3907
- httpServer.once("error", onError);
3908
- });
3909
- applyMSTeamsWebhookTimeouts(httpServer);
3910
- httpServer.on("error", (err) => {
3911
- log.error("msteams server error", { error: formatUnknownError(err) });
3912
- });
3913
- const shutdown = async () => {
3914
- log.info("shutting down msteams provider");
3915
- return new Promise((resolve) => {
3916
- httpServer.close((err) => {
3917
- if (err) log.debug?.("msteams server close error", { error: formatUnknownError(err) });
3918
- resolve();
3919
- });
3920
- });
3921
- };
3922
- await keepHttpServerTaskAlive({
3923
- server: httpServer,
3924
- abortSignal: opts.abortSignal,
3925
- onAbort: shutdown
3926
- });
3927
- return {
3928
- app: expressApp,
3929
- shutdown
3930
- };
3931
- }
3932
- /**
3933
- * Build a minimal ActivityHandler-compatible object that supports
3934
- * onMessage / onMembersAdded registration and a run() method.
3935
- */
3936
- function buildActivityHandler() {
3937
- const messageHandlers = [];
3938
- const membersAddedHandlers = [];
3939
- const reactionsAddedHandlers = [];
3940
- const reactionsRemovedHandlers = [];
3941
- const handler = {
3942
- onMessage(cb) {
3943
- messageHandlers.push(cb);
3944
- return handler;
3945
- },
3946
- onMembersAdded(cb) {
3947
- membersAddedHandlers.push(cb);
3948
- return handler;
3949
- },
3950
- onReactionsAdded(cb) {
3951
- reactionsAddedHandlers.push(cb);
3952
- return handler;
3953
- },
3954
- onReactionsRemoved(cb) {
3955
- reactionsRemovedHandlers.push(cb);
3956
- return handler;
3957
- },
3958
- async run(context) {
3959
- const ctx = context;
3960
- const activityType = ctx?.activity?.type;
3961
- const noop = async () => {};
3962
- if (activityType === "message") for (const h of messageHandlers) await h(context, noop);
3963
- else if (activityType === "conversationUpdate") for (const h of membersAddedHandlers) await h(context, noop);
3964
- else if (activityType === "messageReaction") {
3965
- const activity = ctx?.activity;
3966
- if (activity?.reactionsAdded?.length) for (const h of reactionsAddedHandlers) await h(context, noop);
3967
- if (activity?.reactionsRemoved?.length) for (const h of reactionsRemovedHandlers) await h(context, noop);
3968
- }
3969
- }
3970
- };
3971
- return handler;
3972
- }
3973
- //#endregion
3974
- export { monitorMSTeamsProvider };