@fased/fased 0.1.41 → 0.1.43

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 (2353) hide show
  1. package/dist/brand.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  4. package/dist/cli/daemon-cli/restart-health.js +49 -13
  5. package/dist/cli/plugins-cli.js +6 -103
  6. package/dist/cli/plugins-doctor-cli.js +45 -0
  7. package/dist/cli/plugins-info-cli.js +50 -0
  8. package/dist/cli/plugins-status-cli.js +4 -0
  9. package/dist/cli/program/routes.js +38 -0
  10. package/dist/cli/update-cli/shared.js +1 -29
  11. package/dist/cli/update-cli/update-command.js +87 -28
  12. package/dist/config/legacy.migrations.part-3.js +25 -0
  13. package/dist/gateway/server-plugins.js +12 -0
  14. package/dist/infra/hosted-runtime-artifact.js +40 -1
  15. package/dist/infra/update-global.js +1 -0
  16. package/dist/infra/update-runner.js +318 -38
  17. package/dist/light-plugin-doctor.js +1 -0
  18. package/dist/light-plugin-info.js +2 -0
  19. package/dist/light-update-precheck.js +1 -0
  20. package/dist/light-update-status.js +12 -0
  21. package/dist/plugin-sdk/account-id.d.ts +2 -1
  22. package/dist/plugin-sdk/account-id.js +1 -32
  23. package/dist/plugin-sdk/accounts-Bz_2QZSt.js +305 -0
  24. package/dist/plugin-sdk/accounts-CuqIKU8X.js +84 -0
  25. package/dist/plugin-sdk/accounts-RHZyaB73.js +63 -0
  26. package/dist/plugin-sdk/actions-CysoQjk1.js +150 -0
  27. package/dist/plugin-sdk/active-listener-C5ALSs7Y.js +37 -0
  28. package/dist/plugin-sdk/agent-scope-BbgPlhtw.js +1372 -0
  29. package/dist/plugin-sdk/allow-list-yqasgPpz.js +479 -0
  30. package/dist/plugin-sdk/audio-preflight-CzG6BjAn.js +107 -0
  31. package/dist/plugin-sdk/audit-BFnu5TVB.js +90 -0
  32. package/dist/plugin-sdk/blocks-input-DdQwSVtP.js +30 -0
  33. package/dist/plugin-sdk/channel-access-BiWxa3LR.js +68 -0
  34. package/dist/plugin-sdk/channel-access-configure-gJvqbbXB.js +28 -0
  35. package/dist/plugin-sdk/channel-adapters.discord-g8Do3f5N.js +35 -0
  36. package/dist/plugin-sdk/channel-core-CMPoGCik.js +1 -0
  37. package/dist/plugin-sdk/channel-plugin-common.d.ts +5 -1
  38. package/dist/plugin-sdk/channel-plugin-common.js +18 -1014
  39. package/dist/plugin-sdk/chat-type-CK5stkc4.d.ts +4 -0
  40. package/dist/plugin-sdk/chunk-CuJIMshx.js +341 -0
  41. package/dist/plugin-sdk/chunk-items-CxRDAM7m.js +34 -0
  42. package/dist/plugin-sdk/command-status.d.ts +20 -1
  43. package/dist/plugin-sdk/command-status.js +58 -47
  44. package/dist/plugin-sdk/commands-registry-DwQIFJmL.js +1337 -0
  45. package/dist/plugin-sdk/common-C90EHP1w.js +440 -0
  46. package/dist/plugin-sdk/config-DKNrb8oT.js +23271 -0
  47. package/dist/plugin-sdk/device-pair.d.ts +3 -1
  48. package/dist/plugin-sdk/device-pair.js +8 -840
  49. package/dist/plugin-sdk/device-pairing-J1IH1jFl.js +156 -0
  50. package/dist/plugin-sdk/diagnostic-C16gioN6.js +282 -0
  51. package/dist/plugin-sdk/directory-live-DK_83362.js +105 -0
  52. package/dist/plugin-sdk/directory-live-G7AN8y8N.js +88 -0
  53. package/dist/plugin-sdk/discord.d.ts +91 -1
  54. package/dist/plugin-sdk/discord.js +71 -3287
  55. package/dist/plugin-sdk/draft-stream-controls-DGYBMJYc.js +323 -0
  56. package/dist/plugin-sdk/exec-DQ8j4Fm3.js +230 -0
  57. package/dist/plugin-sdk/fetch-RV7QDF43.js +68 -0
  58. package/dist/plugin-sdk/fetch-guard-CxXvFYq5.js +168 -0
  59. package/dist/plugin-sdk/filesystem-manager-CeSmCA_A.js +188 -0
  60. package/dist/plugin-sdk/fs-safe-DztQeyQe.js +192 -0
  61. package/dist/plugin-sdk/group-mentions-DLOOve8d.d.ts +108 -0
  62. package/dist/plugin-sdk/guilds-n7MMnX1c.js +13 -0
  63. package/dist/plugin-sdk/handle-action-DkfMckah.js +1450 -0
  64. package/dist/plugin-sdk/helpers-C1pcZJsv.js +439 -0
  65. package/dist/plugin-sdk/image-ops-BSQmb-17.js +510 -0
  66. package/dist/plugin-sdk/index.d.ts +2575 -1
  67. package/dist/plugin-sdk/index.js +63 -783
  68. package/dist/plugin-sdk/ip-BkeyFRJr.js +181 -0
  69. package/dist/plugin-sdk/links-D5ecKoG9.js +74 -0
  70. package/dist/plugin-sdk/logger-BbFvCoKk.js +48 -0
  71. package/dist/plugin-sdk/login-YbYyMkkE.js +61 -0
  72. package/dist/plugin-sdk/login-qr-DvJw8_2g.js +326 -0
  73. package/dist/plugin-sdk/manager-DQ1dH8OM.js +3792 -0
  74. package/dist/plugin-sdk/markdown-tables-DrB-IM8r.js +29 -0
  75. package/dist/plugin-sdk/media-D8pWjqEt.js +1137 -0
  76. package/dist/plugin-sdk/memory-search-DHSeU4pJ.js +242 -0
  77. package/dist/plugin-sdk/monitor-B1PUtkd6.js +4539 -0
  78. package/dist/plugin-sdk/monitor-BrxWsb7H.js +7739 -0
  79. package/dist/plugin-sdk/openresponses-http-DJ2lfMja.js +923 -0
  80. package/dist/plugin-sdk/optional-runtime-dependency-Bt_3Yigu.js +41 -0
  81. package/dist/plugin-sdk/outbound-B5ukMdUv.js +224 -0
  82. package/dist/plugin-sdk/outbound-attachment-C9oadpUP.js +95 -0
  83. package/dist/plugin-sdk/pairing-message-B787pcJI.js +293 -0
  84. package/dist/plugin-sdk/pairing-message-DWXHX-jt.d.ts +46 -0
  85. package/dist/plugin-sdk/pairing-store-BdOcH_GA.js +437 -0
  86. package/dist/plugin-sdk/pairing-token-HQpaqod5.js +91 -0
  87. package/dist/plugin-sdk/path-alias-guards-BlIJ0AmG.js +43 -0
  88. package/dist/plugin-sdk/pi-embedded-runner-DMfkIj60.js +95517 -0
  89. package/dist/plugin-sdk/pi-model-discovery-DQdXL_-F.js +134 -0
  90. package/dist/plugin-sdk/pi-model-discovery-runtime-IwiWDCQ3.js +14 -0
  91. package/dist/plugin-sdk/probe-CJ6lN-jD.js +41 -0
  92. package/dist/plugin-sdk/probe-CvXWxzag.js +68 -0
  93. package/dist/plugin-sdk/probe-DO4M1Qd1.js +109 -0
  94. package/dist/plugin-sdk/probe-DbhD54Aw.js +89 -0
  95. package/dist/plugin-sdk/provider-web-search-config-contract.d.ts +42 -1
  96. package/dist/plugin-sdk/pw-ai-BgsJH_P8.js +1931 -0
  97. package/dist/plugin-sdk/qmd-manager-D2LMB27z.js +1335 -0
  98. package/dist/plugin-sdk/query-expansion-BM7lmqaP.js +769 -0
  99. package/dist/plugin-sdk/replies-BPFt4O-j.js +107 -0
  100. package/dist/plugin-sdk/reply-prefix-CbPHNXlm.js +171 -0
  101. package/dist/plugin-sdk/resolve-channels-B-dUtZYa.js +4 -0
  102. package/dist/plugin-sdk/resolve-channels-sscr14hU.js +208 -0
  103. package/dist/plugin-sdk/resolve-outbound-target-BP_JscKT.js +40 -0
  104. package/dist/plugin-sdk/resolve-route-wp5xq4Ws.js +249 -0
  105. package/dist/plugin-sdk/resolve-users-B63RqPIO.js +118 -0
  106. package/dist/plugin-sdk/resolve-users-C1sjzEsV.js +125 -0
  107. package/dist/plugin-sdk/retry-policy-BTH89onl.js +70 -0
  108. package/dist/plugin-sdk/run-command-i_W6EFb1.d.ts +99 -0
  109. package/dist/plugin-sdk/runtime-BUpqjZNM.js +6821 -0
  110. package/dist/plugin-sdk/runtime-dependency-pUwxUAJp.js +2110 -0
  111. package/dist/plugin-sdk/sandbox-paths-fc-HFGJr.js +158 -0
  112. package/dist/plugin-sdk/sat-runtime.d.ts +932 -1
  113. package/dist/plugin-sdk/sat-runtime.js +23 -11815
  114. package/dist/plugin-sdk/send-CRI83FPV.js +1353 -0
  115. package/dist/plugin-sdk/send-DGUAXb2b.js +518 -0
  116. package/dist/plugin-sdk/send-DUp9GIX8.js +329 -0
  117. package/dist/plugin-sdk/send-DWB5HFdb.js +547 -0
  118. package/dist/plugin-sdk/send-zn5KBXIN.js +2250 -0
  119. package/dist/plugin-sdk/session-BLyxz03u.js +175 -0
  120. package/dist/plugin-sdk/session-key--_1zVBRB.d.ts +17 -0
  121. package/dist/plugin-sdk/shared-V35XNAbz.js +37 -0
  122. package/dist/plugin-sdk/skill-commands-DCnCOVR_.js +1514 -0
  123. package/dist/plugin-sdk/slack-B6lIY1Jk.js +3742 -0
  124. package/dist/plugin-sdk/slack-actions-Dwy-8Zg7.js +254 -0
  125. package/dist/plugin-sdk/slack.d.ts +73 -1
  126. package/dist/plugin-sdk/slack.js +28 -2568
  127. package/dist/plugin-sdk/ssrf-D_4q0mKh.js +209 -0
  128. package/dist/plugin-sdk/sticker-cache-D4Ljzv1P.js +170 -0
  129. package/dist/plugin-sdk/tables-DX84FwPB.js +55 -0
  130. package/dist/plugin-sdk/tailscale-status-BGBRraZW.js +104 -0
  131. package/dist/plugin-sdk/targets-BgSHco9b.js +101 -0
  132. package/dist/plugin-sdk/targets-CuTZl1mO.js +79 -0
  133. package/dist/plugin-sdk/telegram-actions-tOhBd6st.js +319 -0
  134. package/dist/plugin-sdk/telegram.d.ts +39 -1
  135. package/dist/plugin-sdk/telegram.js +26 -2530
  136. package/dist/plugin-sdk/thread-bindings.lifecycle-DjpMLjhY.js +823 -0
  137. package/dist/plugin-sdk/thread-bindings.state-DYYR9qeT.js +643 -0
  138. package/dist/plugin-sdk/tmp-fased-dir-Be1wBhVz.d.ts +77 -0
  139. package/dist/plugin-sdk/tokens-Do_JU4Rh.js +21 -0
  140. package/dist/plugin-sdk/types-CBCtqtMn.d.ts +54 -0
  141. package/dist/plugin-sdk/types-CJGVZX6j.d.ts +1795 -0
  142. package/dist/plugin-sdk/types-CXLEOrJX.d.ts +3359 -0
  143. package/dist/plugin-sdk/types.plugin-CvUiB3Kh.d.ts +4959 -0
  144. package/dist/plugin-sdk/ui-KGr1WRXC.js +33 -0
  145. package/dist/plugin-sdk/wallet-status-CdxTkLWz.js +11880 -0
  146. package/dist/plugin-sdk/web-CX12Rpz1.js +2238 -0
  147. package/dist/plugin-sdk/whatsapp-actions-DISRDbu1.js +92 -0
  148. package/dist/plugin-sdk/whatsapp-heartbeat-KM3lYpt-.js +70 -0
  149. package/dist/plugin-sdk/whatsapp.d.ts +239 -1
  150. package/dist/plugin-sdk/whatsapp.js +29 -2474
  151. package/dist/plugin-sdk/ws-CxmRDbD9.js +114 -0
  152. package/dist/plugin-sdk/wsl-Cw-xOsqF.js +554 -0
  153. package/dist/plugin-sdk/zod-schema.providers-core-BEbNizPe.d.ts +1773 -0
  154. package/dist/plugins/status-cache.js +112 -0
  155. package/dist/plugins/status-manifest.js +61 -0
  156. package/dist/plugins/status.js +23 -2
  157. package/dist/wizard/onboarding.gateway-config.js +0 -21
  158. package/extensions/acpx/package.json +1 -1
  159. package/extensions/bluebubbles/package.json +1 -1
  160. package/extensions/copilot-proxy/package.json +1 -1
  161. package/extensions/diagnostics-otel/package.json +1 -1
  162. package/extensions/fased-federation/package.json +1 -1
  163. package/extensions/google-gemini-cli-auth/package.json +1 -1
  164. package/extensions/imessage/package.json +1 -1
  165. package/extensions/irc/package.json +1 -1
  166. package/extensions/line/package.json +1 -1
  167. package/extensions/llm-task/package.json +1 -1
  168. package/extensions/lobster/package.json +1 -1
  169. package/extensions/matrix/CHANGELOG.md +6 -0
  170. package/extensions/matrix/package.json +1 -1
  171. package/extensions/mattermost/package.json +1 -1
  172. package/extensions/memory-core/package.json +2 -2
  173. package/extensions/memory-lancedb/package.json +1 -1
  174. package/extensions/minimax-portal-auth/package.json +1 -1
  175. package/extensions/msteams/CHANGELOG.md +6 -0
  176. package/extensions/msteams/package.json +1 -1
  177. package/extensions/nextcloud-talk/package.json +1 -1
  178. package/extensions/nostr/CHANGELOG.md +6 -0
  179. package/extensions/nostr/package.json +1 -1
  180. package/extensions/open-prose/package.json +1 -1
  181. package/extensions/sat-mining/package.json +1 -1
  182. package/extensions/signal/package.json +1 -1
  183. package/extensions/synology-chat/package.json +1 -1
  184. package/extensions/tlon/package.json +1 -1
  185. package/extensions/twitch/CHANGELOG.md +6 -0
  186. package/extensions/twitch/package.json +1 -1
  187. package/extensions/voice-call/CHANGELOG.md +6 -0
  188. package/extensions/voice-call/package.json +1 -1
  189. package/extensions/zalo/CHANGELOG.md +6 -0
  190. package/extensions/zalo/package.json +1 -1
  191. package/extensions/zalouser/CHANGELOG.md +6 -0
  192. package/extensions/zalouser/package.json +1 -1
  193. package/fased.mjs +29 -1
  194. package/package.json +6 -4
  195. package/dist/plugin-sdk/account-helpers-CMvQP0I-.js +0 -38
  196. package/dist/plugin-sdk/accounts-BJFheJNv.js +0 -62
  197. package/dist/plugin-sdk/accounts-BRbbLNW_.js +0 -76
  198. package/dist/plugin-sdk/accounts-BwkH5bTD.js +0 -304
  199. package/dist/plugin-sdk/accounts-COY-15zJ.js +0 -231
  200. package/dist/plugin-sdk/accounts-D7_p-Ivb.js +0 -62
  201. package/dist/plugin-sdk/accounts-DTdM1xcj.js +0 -76
  202. package/dist/plugin-sdk/accounts-RT6y7n3H.js +0 -304
  203. package/dist/plugin-sdk/actions-BrU_JMqM.js +0 -149
  204. package/dist/plugin-sdk/actions-CUdVHzeJ.js +0 -149
  205. package/dist/plugin-sdk/active-listener-CE8t5g6l.js +0 -37
  206. package/dist/plugin-sdk/active-listener-Dx1SEGDn.js +0 -37
  207. package/dist/plugin-sdk/agent-scope-BuTbywla.js +0 -1641
  208. package/dist/plugin-sdk/agent-scope-kIJqg5PA.js +0 -1641
  209. package/dist/plugin-sdk/allow-list-C9N6FKeC.js +0 -479
  210. package/dist/plugin-sdk/allow-list-CBtbuDI8.js +0 -473
  211. package/dist/plugin-sdk/allow-list-Cgjx0Mc-.js +0 -215
  212. package/dist/plugin-sdk/audio-preflight-Chxqjwxe.js +0 -96
  213. package/dist/plugin-sdk/audio-preflight-aupYKWfa.js +0 -96
  214. package/dist/plugin-sdk/audit-DxB2Kml5.js +0 -78
  215. package/dist/plugin-sdk/audit-sSeRDwJb.js +0 -78
  216. package/dist/plugin-sdk/channel-adapters.discord-Chc31YZN.js +0 -35
  217. package/dist/plugin-sdk/channel-adapters.discord-DXVW1q8n.js +0 -35
  218. package/dist/plugin-sdk/chat-type-CH3W-zKy.js +0 -11
  219. package/dist/plugin-sdk/chunk-KCxbJLsV.js +0 -341
  220. package/dist/plugin-sdk/chunk-M2d7r-Zt.js +0 -341
  221. package/dist/plugin-sdk/chunk-items-BDhRe_xU.js +0 -34
  222. package/dist/plugin-sdk/client-DP_eXDIO.js +0 -22
  223. package/dist/plugin-sdk/client-Dn_01zRN.js +0 -28
  224. package/dist/plugin-sdk/command-poll-backoff-q0xAK3nQ.js +0 -65
  225. package/dist/plugin-sdk/commands-registry-CdT-nl7v.js +0 -1337
  226. package/dist/plugin-sdk/commands-registry-DoWdYAJd.js +0 -1337
  227. package/dist/plugin-sdk/common-Cpw-vuuM.js +0 -440
  228. package/dist/plugin-sdk/common-DJWrErdE.js +0 -440
  229. package/dist/plugin-sdk/config-B6SjJFp-.js +0 -20435
  230. package/dist/plugin-sdk/config-BULEb5QB.js +0 -19698
  231. package/dist/plugin-sdk/config-C0qggNKQ.js +0 -20423
  232. package/dist/plugin-sdk/config-CgwTaper.js +0 -22905
  233. package/dist/plugin-sdk/config-DLVjQxOu.js +0 -20435
  234. package/dist/plugin-sdk/config-DgD5T-Ui.js +0 -20656
  235. package/dist/plugin-sdk/config-DtqAN2L3.js +0 -23249
  236. package/dist/plugin-sdk/conversation-label-CDH4rKMG.js +0 -36
  237. package/dist/plugin-sdk/date-time-BtRPVcm7.js +0 -120
  238. package/dist/plugin-sdk/diagnostic-CuhHqubd.js +0 -282
  239. package/dist/plugin-sdk/diagnostic-DpyvOvs2.js +0 -275
  240. package/dist/plugin-sdk/diagnostic-session-state-Zw87xFym.js +0 -59
  241. package/dist/plugin-sdk/directory-live-8umGGN7a.js +0 -88
  242. package/dist/plugin-sdk/directory-live-BC7oHcsY.js +0 -105
  243. package/dist/plugin-sdk/directory-live-BJgud06p.js +0 -105
  244. package/dist/plugin-sdk/directory-live-BxSH0XXX.js +0 -88
  245. package/dist/plugin-sdk/draft-stream-controls-Bfbhumzv.js +0 -323
  246. package/dist/plugin-sdk/draft-stream-controls-v_5gdUYG.js +0 -323
  247. package/dist/plugin-sdk/draft-stream-loop-B3uUPmuU.js +0 -81
  248. package/dist/plugin-sdk/extensions/sat-mining/src/config.d.ts +0 -117
  249. package/dist/plugin-sdk/extensions/sat-mining/src/hash-spec.d.ts +0 -58
  250. package/dist/plugin-sdk/extensions/sat-mining/src/rpc-read.d.ts +0 -648
  251. package/dist/plugin-sdk/extensions/sat-mining/src/sat-bond-layout.d.ts +0 -110
  252. package/dist/plugin-sdk/extensions/sat-mining/src/solana-submit.d.ts +0 -297
  253. package/dist/plugin-sdk/fetch-D70syO9t.js +0 -68
  254. package/dist/plugin-sdk/fetch-guard-BLdujDnt.js +0 -163
  255. package/dist/plugin-sdk/fetch-guard-DTKgMN9f.js +0 -163
  256. package/dist/plugin-sdk/fetch-headers-my7hgV2G.js +0 -26
  257. package/dist/plugin-sdk/fetch-timeout-l_6RdoMw.js +0 -43
  258. package/dist/plugin-sdk/fetch-xfeOsibm.js +0 -68
  259. package/dist/plugin-sdk/filesystem-manager-BEd8NKL9.js +0 -186
  260. package/dist/plugin-sdk/filesystem-manager-D-4lQ3Af.js +0 -186
  261. package/dist/plugin-sdk/fs-safe-BDnJzutp.js +0 -192
  262. package/dist/plugin-sdk/fs-safe-BPYS6-j1.js +0 -192
  263. package/dist/plugin-sdk/gateway-registry-w_Z-PHGf.js +0 -58
  264. package/dist/plugin-sdk/github-copilot-token-Djqpy66R.js +0 -127
  265. package/dist/plugin-sdk/globals-BtKmaIS3.js +0 -439
  266. package/dist/plugin-sdk/guilds-BdkvRFue.js +0 -13
  267. package/dist/plugin-sdk/guilds-DmzO7n0X.js +0 -13
  268. package/dist/plugin-sdk/guilds-iTYlgBat.js +0 -13
  269. package/dist/plugin-sdk/handle-action-B61D85yo.js +0 -1445
  270. package/dist/plugin-sdk/handle-action-CjcxGzQD.js +0 -1445
  271. package/dist/plugin-sdk/inbound-context-CeJDjLk-.js +0 -68
  272. package/dist/plugin-sdk/internal-DMTDEiDF.js +0 -247
  273. package/dist/plugin-sdk/ip-Ddk9SPR-.js +0 -47
  274. package/dist/plugin-sdk/login-CB_nCjX3.js +0 -61
  275. package/dist/plugin-sdk/login-CzUuDd1v.js +0 -61
  276. package/dist/plugin-sdk/login-YveoqEvH.js +0 -268
  277. package/dist/plugin-sdk/login-qr-D7MEpFza.js +0 -324
  278. package/dist/plugin-sdk/login-qr-DgxfBFVN.js +0 -324
  279. package/dist/plugin-sdk/manager-9see0IX5.js +0 -3792
  280. package/dist/plugin-sdk/manager-D2kZ0Cps.js +0 -3792
  281. package/dist/plugin-sdk/markdown-tables-CCSD52rA.js +0 -29
  282. package/dist/plugin-sdk/markdown-tables-DWUNvLrc.js +0 -29
  283. package/dist/plugin-sdk/media-C7YT4DeU.js +0 -1641
  284. package/dist/plugin-sdk/media-Cxw-xLGU.js +0 -1641
  285. package/dist/plugin-sdk/memory-search-B-0Fwnrp.js +0 -242
  286. package/dist/plugin-sdk/memory-search-J6AYuENR.js +0 -242
  287. package/dist/plugin-sdk/monitor-38DGeIwS.js +0 -4528
  288. package/dist/plugin-sdk/monitor-CYCSEVee.js +0 -7743
  289. package/dist/plugin-sdk/monitor-Ceu-Wayc.js +0 -4528
  290. package/dist/plugin-sdk/monitor-DCyBaUCs.js +0 -7728
  291. package/dist/plugin-sdk/openresponses-http-CCfimy89.js +0 -912
  292. package/dist/plugin-sdk/openresponses-http-DAL_9jE-.js +0 -912
  293. package/dist/plugin-sdk/optional-runtime-dependency-szS49voX.js +0 -426
  294. package/dist/plugin-sdk/outbound-BCxOxdi-.js +0 -224
  295. package/dist/plugin-sdk/outbound-JIwQbpRY.js +0 -224
  296. package/dist/plugin-sdk/outbound-attachment-C-jSFaEB.js +0 -94
  297. package/dist/plugin-sdk/outbound-attachment-D6tj5Y5H.js +0 -78
  298. package/dist/plugin-sdk/path-alias-guards-C76pC928.js +0 -43
  299. package/dist/plugin-sdk/path-alias-guards-CcQroDXQ.js +0 -43
  300. package/dist/plugin-sdk/paths-DTurNPnO.js +0 -158
  301. package/dist/plugin-sdk/paths-GdhK5mV_.js +0 -191
  302. package/dist/plugin-sdk/pi-embedded-runner-Dum71Tdo.js +0 -107134
  303. package/dist/plugin-sdk/pi-model-discovery-DadlvsZW.js +0 -134
  304. package/dist/plugin-sdk/pi-model-discovery-G2L8gMcs.js +0 -22703
  305. package/dist/plugin-sdk/pi-model-discovery-runtime-BpR1pe7K.js +0 -3
  306. package/dist/plugin-sdk/pi-model-discovery-runtime-C5ssE6EW.js +0 -127
  307. package/dist/plugin-sdk/pi-model-discovery-runtime-CQOauapl.js +0 -127
  308. package/dist/plugin-sdk/pi-model-discovery-runtime-DAaOPt64.js +0 -12
  309. package/dist/plugin-sdk/pi-model-discovery-runtime-DYfUuqPN.js +0 -127
  310. package/dist/plugin-sdk/pi-model-discovery-runtime-DyOIGBor.js +0 -127
  311. package/dist/plugin-sdk/pi-model-discovery-runtime-gd77b0UF.js +0 -12
  312. package/dist/plugin-sdk/pi-model-discovery-runtime-w4DRRv53.js +0 -128
  313. package/dist/plugin-sdk/pi-model-discovery-yifTIDIn.js +0 -134
  314. package/dist/plugin-sdk/polls-D0YNJBfc.js +0 -33
  315. package/dist/plugin-sdk/probe-0Xt6fbw2.js +0 -109
  316. package/dist/plugin-sdk/probe-1paqsAk5.js +0 -89
  317. package/dist/plugin-sdk/probe-BPYqD-cg.js +0 -68
  318. package/dist/plugin-sdk/probe-Ba4KG8Vi.js +0 -41
  319. package/dist/plugin-sdk/probe-BfzwvkxZ.js +0 -68
  320. package/dist/plugin-sdk/probe-CsFmvxbr.js +0 -89
  321. package/dist/plugin-sdk/probe-Dqx0N4uk.js +0 -109
  322. package/dist/plugin-sdk/probe-DrTulmwQ.js +0 -41
  323. package/dist/plugin-sdk/proxy-CV9uL4Wi.js +0 -16
  324. package/dist/plugin-sdk/pw-ai-SNCI9UXT.js +0 -1926
  325. package/dist/plugin-sdk/pw-ai-sH1Pi-Fh.js +0 -1926
  326. package/dist/plugin-sdk/qmd-manager-BfJXNhlO.js +0 -1333
  327. package/dist/plugin-sdk/qmd-manager-QNVr__Z6.js +0 -1333
  328. package/dist/plugin-sdk/qmd-scope-Cei2-7Q5.js +0 -78
  329. package/dist/plugin-sdk/query-expansion-DjJAUtDU.js +0 -769
  330. package/dist/plugin-sdk/query-expansion-VePrajug.js +0 -769
  331. package/dist/plugin-sdk/redact-Ck-wgswc.js +0 -188
  332. package/dist/plugin-sdk/redact-identifier-DdQO7P4_.js +0 -15
  333. package/dist/plugin-sdk/registry-DNkJsNsz.js +0 -6463
  334. package/dist/plugin-sdk/replies-fvzN5wnU.js +0 -107
  335. package/dist/plugin-sdk/replies-zebgZCHX.js +0 -107
  336. package/dist/plugin-sdk/reply-prefix-DqlCqHXT.js +0 -171
  337. package/dist/plugin-sdk/reply-prefix-Y14LY6Rn.js +0 -171
  338. package/dist/plugin-sdk/reply-reference-mUSl_ExV.js +0 -35
  339. package/dist/plugin-sdk/resolve-channels-CGCkchAo.js +0 -208
  340. package/dist/plugin-sdk/resolve-channels-CHkzoB7d.js +0 -4
  341. package/dist/plugin-sdk/resolve-channels-CIoMOUEH.js +0 -88
  342. package/dist/plugin-sdk/resolve-channels-CU3vZXOG.js +0 -4
  343. package/dist/plugin-sdk/resolve-channels-J5m_-ZOk.js +0 -208
  344. package/dist/plugin-sdk/resolve-channels-gIpOj1wt.js +0 -206
  345. package/dist/plugin-sdk/resolve-route-CNhTJG_2.js +0 -248
  346. package/dist/plugin-sdk/resolve-route-DO0WR4nB.js +0 -248
  347. package/dist/plugin-sdk/resolve-users-Bm78yvE3.js +0 -123
  348. package/dist/plugin-sdk/resolve-users-C0F3LQs2.js +0 -118
  349. package/dist/plugin-sdk/resolve-users-CTKaESmf.js +0 -116
  350. package/dist/plugin-sdk/resolve-users-Ct0fO5kP.js +0 -125
  351. package/dist/plugin-sdk/resolve-users-DlpsBzVS.js +0 -118
  352. package/dist/plugin-sdk/resolve-users-sv9og6yh.js +0 -125
  353. package/dist/plugin-sdk/resolve-utils-r6ef8mj8.js +0 -147
  354. package/dist/plugin-sdk/retry-CB29XXbz.js +0 -780
  355. package/dist/plugin-sdk/retry-Cq65ROXv.js +0 -77
  356. package/dist/plugin-sdk/retry-policy-BLYEgIwP.js +0 -70
  357. package/dist/plugin-sdk/retry-policy-sM01QZT2.js +0 -70
  358. package/dist/plugin-sdk/run-with-concurrency-CavAFhML.js +0 -42
  359. package/dist/plugin-sdk/runtime-BPyuAmka.js +0 -6577
  360. package/dist/plugin-sdk/runtime-dependency-B-1u41Ph.js +0 -2217
  361. package/dist/plugin-sdk/runtime-dependency-Csswyv5r.js +0 -2217
  362. package/dist/plugin-sdk/sandbox-paths-CkTERCrj.js +0 -158
  363. package/dist/plugin-sdk/sandbox-paths-DMnFyOaA.js +0 -158
  364. package/dist/plugin-sdk/secure-random-DLpYiUzR.js +0 -12
  365. package/dist/plugin-sdk/send-B09HRfHN.js +0 -1351
  366. package/dist/plugin-sdk/send-BBYcgXA4.js +0 -546
  367. package/dist/plugin-sdk/send-BQXQA81e.js +0 -2249
  368. package/dist/plugin-sdk/send-BzFdvD_i.js +0 -1351
  369. package/dist/plugin-sdk/send-C3u-F_8s.js +0 -2249
  370. package/dist/plugin-sdk/send-D3836_UN.js +0 -505
  371. package/dist/plugin-sdk/send-D7tr-EsH.js +0 -546
  372. package/dist/plugin-sdk/send-DRGzRdI3.js +0 -518
  373. package/dist/plugin-sdk/send-DfkPKz_0.js +0 -356
  374. package/dist/plugin-sdk/send-DsxFXrCO.js +0 -356
  375. package/dist/plugin-sdk/session-DG_bYisw.js +0 -175
  376. package/dist/plugin-sdk/session-EIStzK0E.js +0 -175
  377. package/dist/plugin-sdk/session-key-Bp3qq3bm.js +0 -228
  378. package/dist/plugin-sdk/skill-commands-CkgGmWBS.js +0 -1600
  379. package/dist/plugin-sdk/skill-commands-hyZA0LE3.js +0 -1571
  380. package/dist/plugin-sdk/slack-B0dLDyHM.js +0 -3731
  381. package/dist/plugin-sdk/slack-Dv4zCw-x.js +0 -3730
  382. package/dist/plugin-sdk/slack-actions-BQawWGTJ.js +0 -248
  383. package/dist/plugin-sdk/slack-actions-DDMszx56.js +0 -248
  384. package/dist/plugin-sdk/src/acp/acpx-mutating-wrapper-policy.d.ts +0 -35
  385. package/dist/plugin-sdk/src/acp/acpx-push-test-approval-contract.d.ts +0 -62
  386. package/dist/plugin-sdk/src/acp/acpx-push-test-execution-adapter.d.ts +0 -44
  387. package/dist/plugin-sdk/src/acp/control-plane/manager.core.d.ts +0 -74
  388. package/dist/plugin-sdk/src/acp/control-plane/manager.d.ts +0 -7
  389. package/dist/plugin-sdk/src/acp/control-plane/manager.identity-reconcile.d.ts +0 -23
  390. package/dist/plugin-sdk/src/acp/control-plane/manager.runtime-controls.d.ts +0 -14
  391. package/dist/plugin-sdk/src/acp/control-plane/manager.types.d.ts +0 -103
  392. package/dist/plugin-sdk/src/acp/control-plane/manager.utils.d.ts +0 -14
  393. package/dist/plugin-sdk/src/acp/control-plane/runtime-cache.d.ts +0 -38
  394. package/dist/plugin-sdk/src/acp/control-plane/runtime-options.d.ts +0 -23
  395. package/dist/plugin-sdk/src/acp/control-plane/session-actor-queue.d.ts +0 -8
  396. package/dist/plugin-sdk/src/acp/control-plane/spawn.d.ts +0 -25
  397. package/dist/plugin-sdk/src/acp/policy.d.ts +0 -10
  398. package/dist/plugin-sdk/src/acp/runtime/error-text.d.ts +0 -7
  399. package/dist/plugin-sdk/src/acp/runtime/errors.d.ts +0 -20
  400. package/dist/plugin-sdk/src/acp/runtime/registry.d.ts +0 -18
  401. package/dist/plugin-sdk/src/acp/runtime/session-identifiers.d.ts +0 -17
  402. package/dist/plugin-sdk/src/acp/runtime/session-identity.d.ts +0 -23
  403. package/dist/plugin-sdk/src/acp/runtime/session-meta.d.ts +0 -30
  404. package/dist/plugin-sdk/src/acp/runtime/types.d.ts +0 -102
  405. package/dist/plugin-sdk/src/acp/status-snapshot.d.ts +0 -54
  406. package/dist/plugin-sdk/src/agents/acp-spawn-parent-stream.d.ts +0 -20
  407. package/dist/plugin-sdk/src/agents/acp-spawn.d.ts +0 -39
  408. package/dist/plugin-sdk/src/agents/agent-model-providers.d.ts +0 -47
  409. package/dist/plugin-sdk/src/agents/agent-paths.d.ts +0 -4
  410. package/dist/plugin-sdk/src/agents/agent-scope.d.ts +0 -71
  411. package/dist/plugin-sdk/src/agents/announce-idempotency.d.ts +0 -11
  412. package/dist/plugin-sdk/src/agents/anthropic-payload-log.d.ts +0 -20
  413. package/dist/plugin-sdk/src/agents/api-key-rotation.d.ts +0 -22
  414. package/dist/plugin-sdk/src/agents/apply-patch-update.d.ts +0 -10
  415. package/dist/plugin-sdk/src/agents/apply-patch.d.ts +0 -35
  416. package/dist/plugin-sdk/src/agents/auth-health.d.ts +0 -40
  417. package/dist/plugin-sdk/src/agents/auth-profiles/constants.d.ts +0 -19
  418. package/dist/plugin-sdk/src/agents/auth-profiles/display.d.ts +0 -7
  419. package/dist/plugin-sdk/src/agents/auth-profiles/doctor.d.ts +0 -8
  420. package/dist/plugin-sdk/src/agents/auth-profiles/external-cli-sync.d.ts +0 -7
  421. package/dist/plugin-sdk/src/agents/auth-profiles/oauth.d.ts +0 -14
  422. package/dist/plugin-sdk/src/agents/auth-profiles/order.d.ts +0 -8
  423. package/dist/plugin-sdk/src/agents/auth-profiles/paths.d.ts +0 -4
  424. package/dist/plugin-sdk/src/agents/auth-profiles/profiles.d.ts +0 -25
  425. package/dist/plugin-sdk/src/agents/auth-profiles/repair.d.ts +0 -14
  426. package/dist/plugin-sdk/src/agents/auth-profiles/session-override.d.ts +0 -19
  427. package/dist/plugin-sdk/src/agents/auth-profiles/store.d.ts +0 -24
  428. package/dist/plugin-sdk/src/agents/auth-profiles/types.d.ts +0 -65
  429. package/dist/plugin-sdk/src/agents/auth-profiles/usage.d.ts +0 -85
  430. package/dist/plugin-sdk/src/agents/auth-profiles.d.ts +0 -11
  431. package/dist/plugin-sdk/src/agents/bash-process-registry.d.ts +0 -72
  432. package/dist/plugin-sdk/src/agents/bash-tools.d.ts +0 -4
  433. package/dist/plugin-sdk/src/agents/bash-tools.exec-approval-followup.d.ts +0 -12
  434. package/dist/plugin-sdk/src/agents/bash-tools.exec-approval-request.d.ts +0 -70
  435. package/dist/plugin-sdk/src/agents/bash-tools.exec-host-gateway.d.ts +0 -34
  436. package/dist/plugin-sdk/src/agents/bash-tools.exec-host-node.d.ts +0 -26
  437. package/dist/plugin-sdk/src/agents/bash-tools.exec-host-shared.d.ts +0 -155
  438. package/dist/plugin-sdk/src/agents/bash-tools.exec-runtime.d.ts +0 -116
  439. package/dist/plugin-sdk/src/agents/bash-tools.exec-types.d.ts +0 -76
  440. package/dist/plugin-sdk/src/agents/bash-tools.exec.d.ts +0 -6
  441. package/dist/plugin-sdk/src/agents/bash-tools.process.d.ts +0 -11
  442. package/dist/plugin-sdk/src/agents/bash-tools.shared.d.ts +0 -56
  443. package/dist/plugin-sdk/src/agents/bootstrap-budget.d.ts +0 -87
  444. package/dist/plugin-sdk/src/agents/bootstrap-cache.d.ts +0 -11
  445. package/dist/plugin-sdk/src/agents/bootstrap-files.d.ts +0 -32
  446. package/dist/plugin-sdk/src/agents/bootstrap-hooks.d.ts +0 -10
  447. package/dist/plugin-sdk/src/agents/byteplus-models.d.ts +0 -128
  448. package/dist/plugin-sdk/src/agents/cache-trace.d.ts +0 -49
  449. package/dist/plugin-sdk/src/agents/channel-tools.d.ts +0 -30
  450. package/dist/plugin-sdk/src/agents/chutes-models.d.ts +0 -25
  451. package/dist/plugin-sdk/src/agents/chutes-oauth.d.ts +0 -46
  452. package/dist/plugin-sdk/src/agents/cli-backends.d.ts +0 -8
  453. package/dist/plugin-sdk/src/agents/cli-credentials.d.ts +0 -72
  454. package/dist/plugin-sdk/src/agents/cli-runner/helpers.d.ts +0 -72
  455. package/dist/plugin-sdk/src/agents/cli-runner/reliability.d.ts +0 -11
  456. package/dist/plugin-sdk/src/agents/cli-runner.d.ts +0 -42
  457. package/dist/plugin-sdk/src/agents/cli-session.d.ts +0 -3
  458. package/dist/plugin-sdk/src/agents/cli-watchdog-defaults.d.ts +0 -11
  459. package/dist/plugin-sdk/src/agents/cloudflare-ai-gateway.d.ts +0 -1
  460. package/dist/plugin-sdk/src/agents/command-poll-backoff.d.ts +0 -28
  461. package/dist/plugin-sdk/src/agents/compaction.d.ts +0 -72
  462. package/dist/plugin-sdk/src/agents/content-blocks.d.ts +0 -1
  463. package/dist/plugin-sdk/src/agents/context-window-guard.d.ts +0 -25
  464. package/dist/plugin-sdk/src/agents/context.d.ts +0 -38
  465. package/dist/plugin-sdk/src/agents/current-model-catalog.d.ts +0 -5
  466. package/dist/plugin-sdk/src/agents/current-time.d.ts +0 -17
  467. package/dist/plugin-sdk/src/agents/date-time.d.ts +0 -13
  468. package/dist/plugin-sdk/src/agents/defaults.d.ts +0 -3
  469. package/dist/plugin-sdk/src/agents/docs-path.d.ts +0 -6
  470. package/dist/plugin-sdk/src/agents/doubao-models.d.ts +0 -128
  471. package/dist/plugin-sdk/src/agents/embedded-pi-mcp.d.ts +0 -13
  472. package/dist/plugin-sdk/src/agents/exec-approval-result.d.ts +0 -21
  473. package/dist/plugin-sdk/src/agents/failover-error.d.ts +0 -33
  474. package/dist/plugin-sdk/src/agents/fased-tools.d.ts +0 -58
  475. package/dist/plugin-sdk/src/agents/glob-pattern.d.ts +0 -18
  476. package/dist/plugin-sdk/src/agents/huggingface-models.d.ts +0 -14
  477. package/dist/plugin-sdk/src/agents/identity-avatar.d.ts +0 -17
  478. package/dist/plugin-sdk/src/agents/identity-file.d.ts +0 -12
  479. package/dist/plugin-sdk/src/agents/identity.d.ts +0 -28
  480. package/dist/plugin-sdk/src/agents/image-sanitization.d.ts +0 -8
  481. package/dist/plugin-sdk/src/agents/lanes.d.ts +0 -4
  482. package/dist/plugin-sdk/src/agents/live-auth-keys.d.ts +0 -6
  483. package/dist/plugin-sdk/src/agents/mcp-config-shared.d.ts +0 -5
  484. package/dist/plugin-sdk/src/agents/mcp-http.d.ts +0 -19
  485. package/dist/plugin-sdk/src/agents/mcp-stdio.d.ts +0 -16
  486. package/dist/plugin-sdk/src/agents/mcp-transport-config.d.ts +0 -23
  487. package/dist/plugin-sdk/src/agents/mcp-transport.d.ts +0 -9
  488. package/dist/plugin-sdk/src/agents/memory-search.d.ts +0 -80
  489. package/dist/plugin-sdk/src/agents/minimax-vlm.d.ts +0 -8
  490. package/dist/plugin-sdk/src/agents/model-alias-lines.d.ts +0 -2
  491. package/dist/plugin-sdk/src/agents/model-auth-label.d.ts +0 -8
  492. package/dist/plugin-sdk/src/agents/model-auth.d.ts +0 -37
  493. package/dist/plugin-sdk/src/agents/model-catalog-access.d.ts +0 -30
  494. package/dist/plugin-sdk/src/agents/model-catalog-normalized.d.ts +0 -27
  495. package/dist/plugin-sdk/src/agents/model-catalog-source.d.ts +0 -41
  496. package/dist/plugin-sdk/src/agents/model-catalog-status.d.ts +0 -92
  497. package/dist/plugin-sdk/src/agents/model-catalog.d.ts +0 -35
  498. package/dist/plugin-sdk/src/agents/model-compat.d.ts +0 -2
  499. package/dist/plugin-sdk/src/agents/model-fallback.d.ts +0 -54
  500. package/dist/plugin-sdk/src/agents/model-forward-compat.d.ts +0 -3
  501. package/dist/plugin-sdk/src/agents/model-metadata.d.ts +0 -49
  502. package/dist/plugin-sdk/src/agents/model-ref-profile.d.ts +0 -4
  503. package/dist/plugin-sdk/src/agents/model-selection.d.ts +0 -130
  504. package/dist/plugin-sdk/src/agents/models-config.d.ts +0 -9
  505. package/dist/plugin-sdk/src/agents/models-config.providers.d.ts +0 -40
  506. package/dist/plugin-sdk/src/agents/opencode-zen-models.d.ts +0 -46
  507. package/dist/plugin-sdk/src/agents/owner-display.d.ts +0 -19
  508. package/dist/plugin-sdk/src/agents/payload-redaction.d.ts +0 -10
  509. package/dist/plugin-sdk/src/agents/pi-auth-credentials.d.ts +0 -16
  510. package/dist/plugin-sdk/src/agents/pi-bundle-mcp-materialize.d.ts +0 -12
  511. package/dist/plugin-sdk/src/agents/pi-bundle-mcp-names.d.ts +0 -9
  512. package/dist/plugin-sdk/src/agents/pi-bundle-mcp-runtime.d.ts +0 -21
  513. package/dist/plugin-sdk/src/agents/pi-bundle-mcp-tools.d.ts +0 -3
  514. package/dist/plugin-sdk/src/agents/pi-bundle-mcp-types.d.ts +0 -52
  515. package/dist/plugin-sdk/src/agents/pi-embedded-block-chunker.d.ts +0 -19
  516. package/dist/plugin-sdk/src/agents/pi-embedded-helpers/bootstrap.d.ts +0 -33
  517. package/dist/plugin-sdk/src/agents/pi-embedded-helpers/errors.d.ts +0 -70
  518. package/dist/plugin-sdk/src/agents/pi-embedded-helpers/google.d.ts +0 -3
  519. package/dist/plugin-sdk/src/agents/pi-embedded-helpers/images.d.ts +0 -22
  520. package/dist/plugin-sdk/src/agents/pi-embedded-helpers/messaging-dedupe.d.ts +0 -10
  521. package/dist/plugin-sdk/src/agents/pi-embedded-helpers/openai.d.ts +0 -17
  522. package/dist/plugin-sdk/src/agents/pi-embedded-helpers/thinking.d.ts +0 -5
  523. package/dist/plugin-sdk/src/agents/pi-embedded-helpers/turns.d.ts +0 -21
  524. package/dist/plugin-sdk/src/agents/pi-embedded-helpers/types.d.ts +0 -5
  525. package/dist/plugin-sdk/src/agents/pi-embedded-helpers.d.ts +0 -11
  526. package/dist/plugin-sdk/src/agents/pi-embedded-messaging.d.ts +0 -9
  527. package/dist/plugin-sdk/src/agents/pi-embedded-payloads.d.ts +0 -9
  528. package/dist/plugin-sdk/src/agents/pi-embedded-runner/abort.d.ts +0 -6
  529. package/dist/plugin-sdk/src/agents/pi-embedded-runner/cache-ttl.d.ts +0 -17
  530. package/dist/plugin-sdk/src/agents/pi-embedded-runner/compact.d.ts +0 -57
  531. package/dist/plugin-sdk/src/agents/pi-embedded-runner/compaction-safety-timeout.d.ts +0 -7
  532. package/dist/plugin-sdk/src/agents/pi-embedded-runner/extensions.d.ts +0 -12
  533. package/dist/plugin-sdk/src/agents/pi-embedded-runner/extra-params.d.ts +0 -76
  534. package/dist/plugin-sdk/src/agents/pi-embedded-runner/google.d.ts +0 -42
  535. package/dist/plugin-sdk/src/agents/pi-embedded-runner/history.d.ts +0 -18
  536. package/dist/plugin-sdk/src/agents/pi-embedded-runner/lanes.d.ts +0 -3
  537. package/dist/plugin-sdk/src/agents/pi-embedded-runner/logger.d.ts +0 -1
  538. package/dist/plugin-sdk/src/agents/pi-embedded-runner/model.d.ts +0 -30
  539. package/dist/plugin-sdk/src/agents/pi-embedded-runner/run/attempt.d.ts +0 -30
  540. package/dist/plugin-sdk/src/agents/pi-embedded-runner/run/compaction-timeout.d.ts +0 -20
  541. package/dist/plugin-sdk/src/agents/pi-embedded-runner/run/history-image-prune.d.ts +0 -7
  542. package/dist/plugin-sdk/src/agents/pi-embedded-runner/run/images.d.ts +0 -83
  543. package/dist/plugin-sdk/src/agents/pi-embedded-runner/run/llm-idle-timeout.d.ts +0 -9
  544. package/dist/plugin-sdk/src/agents/pi-embedded-runner/run/params.d.ts +0 -128
  545. package/dist/plugin-sdk/src/agents/pi-embedded-runner/run/payloads.d.ts +0 -42
  546. package/dist/plugin-sdk/src/agents/pi-embedded-runner/run/types.d.ts +0 -67
  547. package/dist/plugin-sdk/src/agents/pi-embedded-runner/run.d.ts +0 -3
  548. package/dist/plugin-sdk/src/agents/pi-embedded-runner/runs.d.ts +0 -32
  549. package/dist/plugin-sdk/src/agents/pi-embedded-runner/sandbox-info.d.ts +0 -4
  550. package/dist/plugin-sdk/src/agents/pi-embedded-runner/session-manager-cache.d.ts +0 -2
  551. package/dist/plugin-sdk/src/agents/pi-embedded-runner/session-manager-init.d.ts +0 -17
  552. package/dist/plugin-sdk/src/agents/pi-embedded-runner/system-prompt.d.ts +0 -55
  553. package/dist/plugin-sdk/src/agents/pi-embedded-runner/thinking.d.ts +0 -17
  554. package/dist/plugin-sdk/src/agents/pi-embedded-runner/tool-name-allowlist.d.ts +0 -6
  555. package/dist/plugin-sdk/src/agents/pi-embedded-runner/tool-result-context-guard.d.ts +0 -8
  556. package/dist/plugin-sdk/src/agents/pi-embedded-runner/tool-result-truncation.d.ts +0 -79
  557. package/dist/plugin-sdk/src/agents/pi-embedded-runner/tool-split.d.ts +0 -11
  558. package/dist/plugin-sdk/src/agents/pi-embedded-runner/types.d.ts +0 -95
  559. package/dist/plugin-sdk/src/agents/pi-embedded-runner/utils.d.ts +0 -5
  560. package/dist/plugin-sdk/src/agents/pi-embedded-runner/wait-for-idle-before-flush.d.ts +0 -14
  561. package/dist/plugin-sdk/src/agents/pi-embedded-runner.d.ts +0 -12
  562. package/dist/plugin-sdk/src/agents/pi-embedded-subscribe.d.ts +0 -34
  563. package/dist/plugin-sdk/src/agents/pi-embedded-subscribe.handlers.compaction.d.ts +0 -6
  564. package/dist/plugin-sdk/src/agents/pi-embedded-subscribe.handlers.d.ts +0 -2
  565. package/dist/plugin-sdk/src/agents/pi-embedded-subscribe.handlers.lifecycle.d.ts +0 -4
  566. package/dist/plugin-sdk/src/agents/pi-embedded-subscribe.handlers.messages.d.ts +0 -16
  567. package/dist/plugin-sdk/src/agents/pi-embedded-subscribe.handlers.tools.d.ts +0 -18
  568. package/dist/plugin-sdk/src/agents/pi-embedded-subscribe.handlers.types.d.ts +0 -152
  569. package/dist/plugin-sdk/src/agents/pi-embedded-subscribe.raw-stream.d.ts +0 -1
  570. package/dist/plugin-sdk/src/agents/pi-embedded-subscribe.tools.d.ts +0 -20
  571. package/dist/plugin-sdk/src/agents/pi-embedded-subscribe.types.d.ts +0 -45
  572. package/dist/plugin-sdk/src/agents/pi-embedded-utils.d.ts +0 -42
  573. package/dist/plugin-sdk/src/agents/pi-embedded.d.ts +0 -2
  574. package/dist/plugin-sdk/src/agents/pi-extensions/compaction-safeguard-runtime.d.ts +0 -16
  575. package/dist/plugin-sdk/src/agents/pi-extensions/compaction-safeguard.d.ts +0 -22
  576. package/dist/plugin-sdk/src/agents/pi-extensions/context-pruning/extension.d.ts +0 -7
  577. package/dist/plugin-sdk/src/agents/pi-extensions/context-pruning/pruner.d.ts +0 -10
  578. package/dist/plugin-sdk/src/agents/pi-extensions/context-pruning/runtime.d.ts +0 -9
  579. package/dist/plugin-sdk/src/agents/pi-extensions/context-pruning/settings.d.ts +0 -44
  580. package/dist/plugin-sdk/src/agents/pi-extensions/context-pruning/tools.d.ts +0 -2
  581. package/dist/plugin-sdk/src/agents/pi-extensions/context-pruning.d.ts +0 -10
  582. package/dist/plugin-sdk/src/agents/pi-extensions/session-manager-runtime-registry.d.ts +0 -4
  583. package/dist/plugin-sdk/src/agents/pi-model-discovery-runtime.d.ts +0 -1
  584. package/dist/plugin-sdk/src/agents/pi-model-discovery.d.ts +0 -7
  585. package/dist/plugin-sdk/src/agents/pi-project-settings.d.ts +0 -28
  586. package/dist/plugin-sdk/src/agents/pi-settings.d.ts +0 -45
  587. package/dist/plugin-sdk/src/agents/pi-tool-definition-adapter.d.ts +0 -8
  588. package/dist/plugin-sdk/src/agents/pi-tools.abort.d.ts +0 -2
  589. package/dist/plugin-sdk/src/agents/pi-tools.before-tool-call.d.ts +0 -31
  590. package/dist/plugin-sdk/src/agents/pi-tools.d.ts +0 -84
  591. package/dist/plugin-sdk/src/agents/pi-tools.policy.d.ts +0 -38
  592. package/dist/plugin-sdk/src/agents/pi-tools.read.d.ts +0 -61
  593. package/dist/plugin-sdk/src/agents/pi-tools.schema.d.ts +0 -9
  594. package/dist/plugin-sdk/src/agents/pi-tools.types.d.ts +0 -2
  595. package/dist/plugin-sdk/src/agents/prompt-cache-stability.d.ts +0 -2
  596. package/dist/plugin-sdk/src/agents/provider-attribution.d.ts +0 -70
  597. package/dist/plugin-sdk/src/agents/provider-auth-aliases.d.ts +0 -9
  598. package/dist/plugin-sdk/src/agents/provider-extension-catalog-index.d.ts +0 -37
  599. package/dist/plugin-sdk/src/agents/provider-extension-catalog-manifest.d.ts +0 -29
  600. package/dist/plugin-sdk/src/agents/provider-id.d.ts +0 -5
  601. package/dist/plugin-sdk/src/agents/provider-request-config.d.ts +0 -194
  602. package/dist/plugin-sdk/src/agents/pty-dsr.d.ts +0 -5
  603. package/dist/plugin-sdk/src/agents/pty-keys.d.ts +0 -14
  604. package/dist/plugin-sdk/src/agents/queued-file-writer.d.ts +0 -5
  605. package/dist/plugin-sdk/src/agents/sandbox/backend.d.ts +0 -29
  606. package/dist/plugin-sdk/src/agents/sandbox/bind-spec.d.ts +0 -7
  607. package/dist/plugin-sdk/src/agents/sandbox/browser-bridges.d.ts +0 -7
  608. package/dist/plugin-sdk/src/agents/sandbox/browser.d.ts +0 -12
  609. package/dist/plugin-sdk/src/agents/sandbox/config-hash.d.ts +0 -18
  610. package/dist/plugin-sdk/src/agents/sandbox/config.d.ts +0 -32
  611. package/dist/plugin-sdk/src/agents/sandbox/constants.d.ts +0 -21
  612. package/dist/plugin-sdk/src/agents/sandbox/context.d.ts +0 -20
  613. package/dist/plugin-sdk/src/agents/sandbox/docker.d.ts +0 -48
  614. package/dist/plugin-sdk/src/agents/sandbox/fs-bridge.d.ts +0 -56
  615. package/dist/plugin-sdk/src/agents/sandbox/fs-paths.d.ts +0 -28
  616. package/dist/plugin-sdk/src/agents/sandbox/hash.d.ts +0 -1
  617. package/dist/plugin-sdk/src/agents/sandbox/host-paths.d.ts +0 -9
  618. package/dist/plugin-sdk/src/agents/sandbox/manage.d.ts +0 -13
  619. package/dist/plugin-sdk/src/agents/sandbox/network-mode.d.ts +0 -7
  620. package/dist/plugin-sdk/src/agents/sandbox/novnc-auth.d.ts +0 -15
  621. package/dist/plugin-sdk/src/agents/sandbox/path-utils.d.ts +0 -2
  622. package/dist/plugin-sdk/src/agents/sandbox/prune.d.ts +0 -3
  623. package/dist/plugin-sdk/src/agents/sandbox/registry.d.ts +0 -31
  624. package/dist/plugin-sdk/src/agents/sandbox/runtime-status.d.ts +0 -18
  625. package/dist/plugin-sdk/src/agents/sandbox/sanitize-env-vars.d.ts +0 -14
  626. package/dist/plugin-sdk/src/agents/sandbox/shared.d.ts +0 -4
  627. package/dist/plugin-sdk/src/agents/sandbox/tool-policy.d.ts +0 -4
  628. package/dist/plugin-sdk/src/agents/sandbox/types.d.ts +0 -91
  629. package/dist/plugin-sdk/src/agents/sandbox/types.docker.d.ts +0 -4
  630. package/dist/plugin-sdk/src/agents/sandbox/validate-sandbox-security.d.ts +0 -68
  631. package/dist/plugin-sdk/src/agents/sandbox/workspace.d.ts +0 -1
  632. package/dist/plugin-sdk/src/agents/sandbox-media-paths.d.ts +0 -17
  633. package/dist/plugin-sdk/src/agents/sandbox-paths.d.ts +0 -24
  634. package/dist/plugin-sdk/src/agents/sandbox-tool-policy.d.ts +0 -8
  635. package/dist/plugin-sdk/src/agents/sandbox.d.ts +0 -8
  636. package/dist/plugin-sdk/src/agents/sanitize-for-prompt.d.ts +0 -21
  637. package/dist/plugin-sdk/src/agents/schema/clean-for-gemini.d.ts +0 -2
  638. package/dist/plugin-sdk/src/agents/schema/typebox.d.ts +0 -14
  639. package/dist/plugin-sdk/src/agents/session-dirs.d.ts +0 -3
  640. package/dist/plugin-sdk/src/agents/session-file-repair.d.ts +0 -11
  641. package/dist/plugin-sdk/src/agents/session-slug.d.ts +0 -1
  642. package/dist/plugin-sdk/src/agents/session-tool-result-guard-wrapper.d.ts +0 -19
  643. package/dist/plugin-sdk/src/agents/session-tool-result-guard.d.ts +0 -40
  644. package/dist/plugin-sdk/src/agents/session-transcript-repair.d.ts +0 -34
  645. package/dist/plugin-sdk/src/agents/session-write-lock.d.ts +0 -54
  646. package/dist/plugin-sdk/src/agents/shell-utils.d.ts +0 -9
  647. package/dist/plugin-sdk/src/agents/skills/agent-filter.d.ts +0 -6
  648. package/dist/plugin-sdk/src/agents/skills/bundled-context.d.ts +0 -6
  649. package/dist/plugin-sdk/src/agents/skills/bundled-dir.d.ts +0 -7
  650. package/dist/plugin-sdk/src/agents/skills/config.d.ts +0 -13
  651. package/dist/plugin-sdk/src/agents/skills/env-overrides.d.ts +0 -11
  652. package/dist/plugin-sdk/src/agents/skills/filter.d.ts +0 -3
  653. package/dist/plugin-sdk/src/agents/skills/frontmatter.d.ts +0 -6
  654. package/dist/plugin-sdk/src/agents/skills/local-loader.d.ts +0 -13
  655. package/dist/plugin-sdk/src/agents/skills/plugin-skills.d.ts +0 -5
  656. package/dist/plugin-sdk/src/agents/skills/refresh-state.d.ts +0 -15
  657. package/dist/plugin-sdk/src/agents/skills/refresh.d.ts +0 -8
  658. package/dist/plugin-sdk/src/agents/skills/serialize.d.ts +0 -1
  659. package/dist/plugin-sdk/src/agents/skills/skill-contract.d.ts +0 -27
  660. package/dist/plugin-sdk/src/agents/skills/source.d.ts +0 -2
  661. package/dist/plugin-sdk/src/agents/skills/types.d.ts +0 -105
  662. package/dist/plugin-sdk/src/agents/skills/workspace.d.ts +0 -54
  663. package/dist/plugin-sdk/src/agents/skills-clawhub.d.ts +0 -150
  664. package/dist/plugin-sdk/src/agents/skills-install-plan.d.ts +0 -25
  665. package/dist/plugin-sdk/src/agents/skills-install-trust.d.ts +0 -8
  666. package/dist/plugin-sdk/src/agents/skills-marketplace-policy.d.ts +0 -29
  667. package/dist/plugin-sdk/src/agents/skills-marketplace-scan.d.ts +0 -17
  668. package/dist/plugin-sdk/src/agents/skills-status.d.ts +0 -65
  669. package/dist/plugin-sdk/src/agents/skills.d.ts +0 -7
  670. package/dist/plugin-sdk/src/agents/spawned-context.d.ts +0 -30
  671. package/dist/plugin-sdk/src/agents/stable-stringify.d.ts +0 -1
  672. package/dist/plugin-sdk/src/agents/subagent-announce-dispatch.d.ts +0 -22
  673. package/dist/plugin-sdk/src/agents/subagent-announce-output.d.ts +0 -97
  674. package/dist/plugin-sdk/src/agents/subagent-announce-queue.d.ts +0 -24
  675. package/dist/plugin-sdk/src/agents/subagent-announce.d.ts +0 -51
  676. package/dist/plugin-sdk/src/agents/subagent-announce.runtime.d.ts +0 -4
  677. package/dist/plugin-sdk/src/agents/subagent-depth.d.ts +0 -11
  678. package/dist/plugin-sdk/src/agents/subagent-lifecycle-events.d.ts +0 -18
  679. package/dist/plugin-sdk/src/agents/subagent-registry-cleanup.d.ts +0 -25
  680. package/dist/plugin-sdk/src/agents/subagent-registry-completion.d.ts +0 -15
  681. package/dist/plugin-sdk/src/agents/subagent-registry-queries.d.ts +0 -17
  682. package/dist/plugin-sdk/src/agents/subagent-registry-state.d.ts +0 -7
  683. package/dist/plugin-sdk/src/agents/subagent-registry.d.ts +0 -67
  684. package/dist/plugin-sdk/src/agents/subagent-registry.store.d.ts +0 -5
  685. package/dist/plugin-sdk/src/agents/subagent-registry.types.d.ts +0 -62
  686. package/dist/plugin-sdk/src/agents/subagent-spawn.d.ts +0 -49
  687. package/dist/plugin-sdk/src/agents/synthetic-models.d.ts +0 -1
  688. package/dist/plugin-sdk/src/agents/system-prompt-cache-boundary.d.ts +0 -10
  689. package/dist/plugin-sdk/src/agents/system-prompt-params.d.ts +0 -30
  690. package/dist/plugin-sdk/src/agents/system-prompt-report.d.ts +0 -22
  691. package/dist/plugin-sdk/src/agents/system-prompt.d.ts +0 -77
  692. package/dist/plugin-sdk/src/agents/timeout.d.ts +0 -8
  693. package/dist/plugin-sdk/src/agents/together-models.d.ts +0 -1
  694. package/dist/plugin-sdk/src/agents/tool-call-id.d.ts +0 -29
  695. package/dist/plugin-sdk/src/agents/tool-catalog.d.ts +0 -35
  696. package/dist/plugin-sdk/src/agents/tool-description-presets.d.ts +0 -15
  697. package/dist/plugin-sdk/src/agents/tool-description-summary.d.ts +0 -11
  698. package/dist/plugin-sdk/src/agents/tool-display-common.d.ts +0 -70
  699. package/dist/plugin-sdk/src/agents/tool-display-config.d.ts +0 -11
  700. package/dist/plugin-sdk/src/agents/tool-display-exec-shell.d.ts +0 -17
  701. package/dist/plugin-sdk/src/agents/tool-display-exec.d.ts +0 -1
  702. package/dist/plugin-sdk/src/agents/tool-display.d.ts +0 -15
  703. package/dist/plugin-sdk/src/agents/tool-fs-policy.d.ts +0 -21
  704. package/dist/plugin-sdk/src/agents/tool-images.d.ts +0 -11
  705. package/dist/plugin-sdk/src/agents/tool-loop-detection.d.ts +0 -55
  706. package/dist/plugin-sdk/src/agents/tool-mutation.d.ts +0 -14
  707. package/dist/plugin-sdk/src/agents/tool-policy-match.d.ts +0 -3
  708. package/dist/plugin-sdk/src/agents/tool-policy-pipeline.d.ts +0 -32
  709. package/dist/plugin-sdk/src/agents/tool-policy-shared.d.ts +0 -11
  710. package/dist/plugin-sdk/src/agents/tool-policy.d.ts +0 -35
  711. package/dist/plugin-sdk/src/agents/tool-summaries.d.ts +0 -2
  712. package/dist/plugin-sdk/src/agents/tools/agent-step.d.ts +0 -23
  713. package/dist/plugin-sdk/src/agents/tools/agents-list-tool.d.ts +0 -6
  714. package/dist/plugin-sdk/src/agents/tools/browser-tool.d.ts +0 -5
  715. package/dist/plugin-sdk/src/agents/tools/browser-tool.schema.d.ts +0 -50
  716. package/dist/plugin-sdk/src/agents/tools/canvas-tool.d.ts +0 -5
  717. package/dist/plugin-sdk/src/agents/tools/common.d.ts +0 -86
  718. package/dist/plugin-sdk/src/agents/tools/cron-tool.d.ts +0 -11
  719. package/dist/plugin-sdk/src/agents/tools/diff-view-tool.d.ts +0 -2
  720. package/dist/plugin-sdk/src/agents/tools/discord-actions-guild.d.ts +0 -4
  721. package/dist/plugin-sdk/src/agents/tools/discord-actions-messaging.d.ts +0 -6
  722. package/dist/plugin-sdk/src/agents/tools/discord-actions-moderation-shared.d.ts +0 -13
  723. package/dist/plugin-sdk/src/agents/tools/discord-actions-moderation.d.ts +0 -4
  724. package/dist/plugin-sdk/src/agents/tools/discord-actions-presence.d.ts +0 -4
  725. package/dist/plugin-sdk/src/agents/tools/discord-actions.d.ts +0 -5
  726. package/dist/plugin-sdk/src/agents/tools/gateway-tool.d.ts +0 -14
  727. package/dist/plugin-sdk/src/agents/tools/gateway.d.ts +0 -20
  728. package/dist/plugin-sdk/src/agents/tools/image-tool.d.ts +0 -37
  729. package/dist/plugin-sdk/src/agents/tools/image-tool.helpers.d.ts +0 -21
  730. package/dist/plugin-sdk/src/agents/tools/marketplace-offer-draft-tool.d.ts +0 -5
  731. package/dist/plugin-sdk/src/agents/tools/memory-tool.d.ts +0 -10
  732. package/dist/plugin-sdk/src/agents/tools/message-tool.d.ts +0 -26
  733. package/dist/plugin-sdk/src/agents/tools/mining-tool.d.ts +0 -8
  734. package/dist/plugin-sdk/src/agents/tools/nodes-tool.d.ts +0 -13
  735. package/dist/plugin-sdk/src/agents/tools/nodes-utils.d.ts +0 -13
  736. package/dist/plugin-sdk/src/agents/tools/session-status-tool.d.ts +0 -7
  737. package/dist/plugin-sdk/src/agents/tools/sessions-access.d.ts +0 -42
  738. package/dist/plugin-sdk/src/agents/tools/sessions-announce-target.d.ts +0 -5
  739. package/dist/plugin-sdk/src/agents/tools/sessions-helpers.d.ts +0 -54
  740. package/dist/plugin-sdk/src/agents/tools/sessions-history-tool.d.ts +0 -11
  741. package/dist/plugin-sdk/src/agents/tools/sessions-list-tool.d.ts +0 -11
  742. package/dist/plugin-sdk/src/agents/tools/sessions-resolution.d.ts +0 -67
  743. package/dist/plugin-sdk/src/agents/tools/sessions-send-helpers.d.ts +0 -34
  744. package/dist/plugin-sdk/src/agents/tools/sessions-send-tool.a2a.d.ts +0 -20
  745. package/dist/plugin-sdk/src/agents/tools/sessions-send-tool.d.ts +0 -13
  746. package/dist/plugin-sdk/src/agents/tools/sessions-spawn-tool.d.ts +0 -16
  747. package/dist/plugin-sdk/src/agents/tools/slack-actions.d.ts +0 -15
  748. package/dist/plugin-sdk/src/agents/tools/subagents-tool.d.ts +0 -4
  749. package/dist/plugin-sdk/src/agents/tools/telegram-actions.d.ts +0 -7
  750. package/dist/plugin-sdk/src/agents/tools/tts-tool.d.ts +0 -7
  751. package/dist/plugin-sdk/src/agents/tools/wallet-action-tool.d.ts +0 -9
  752. package/dist/plugin-sdk/src/agents/tools/wallet-skill-policy.d.ts +0 -39
  753. package/dist/plugin-sdk/src/agents/tools/wallet-tool.d.ts +0 -9
  754. package/dist/plugin-sdk/src/agents/tools/web-fetch-utils.d.ts +0 -18
  755. package/dist/plugin-sdk/src/agents/tools/web-fetch-visibility.d.ts +0 -2
  756. package/dist/plugin-sdk/src/agents/tools/web-fetch.d.ts +0 -25
  757. package/dist/plugin-sdk/src/agents/tools/web-guarded-fetch.d.ts +0 -12
  758. package/dist/plugin-sdk/src/agents/tools/web-search.d.ts +0 -148
  759. package/dist/plugin-sdk/src/agents/tools/web-shared.d.ts +0 -24
  760. package/dist/plugin-sdk/src/agents/tools/web-tools.d.ts +0 -2
  761. package/dist/plugin-sdk/src/agents/tools/whatsapp-actions.d.ts +0 -3
  762. package/dist/plugin-sdk/src/agents/tools/whatsapp-target-auth.d.ts +0 -10
  763. package/dist/plugin-sdk/src/agents/tools-effective-inventory.d.ts +0 -49
  764. package/dist/plugin-sdk/src/agents/trace-base.d.ts +0 -10
  765. package/dist/plugin-sdk/src/agents/transcript-policy.d.ts +0 -25
  766. package/dist/plugin-sdk/src/agents/usage.d.ts +0 -65
  767. package/dist/plugin-sdk/src/agents/venice-models.d.ts +0 -7
  768. package/dist/plugin-sdk/src/agents/volc-models.shared.d.ts +0 -90
  769. package/dist/plugin-sdk/src/agents/workspace-dir.d.ts +0 -2
  770. package/dist/plugin-sdk/src/agents/workspace-dirs.d.ts +0 -2
  771. package/dist/plugin-sdk/src/agents/workspace-run.d.ts +0 -18
  772. package/dist/plugin-sdk/src/agents/workspace-templates.d.ts +0 -6
  773. package/dist/plugin-sdk/src/agents/workspace.d.ts +0 -45
  774. package/dist/plugin-sdk/src/auto-reply/chunk.d.ts +0 -45
  775. package/dist/plugin-sdk/src/auto-reply/command-auth.d.ts +0 -17
  776. package/dist/plugin-sdk/src/auto-reply/command-detection.d.ts +0 -13
  777. package/dist/plugin-sdk/src/auto-reply/commands-args.d.ts +0 -3
  778. package/dist/plugin-sdk/src/auto-reply/commands-registry.d.ts +0 -55
  779. package/dist/plugin-sdk/src/auto-reply/commands-registry.data.d.ts +0 -3
  780. package/dist/plugin-sdk/src/auto-reply/commands-registry.types.d.ts +0 -66
  781. package/dist/plugin-sdk/src/auto-reply/dispatch.d.ts +0 -32
  782. package/dist/plugin-sdk/src/auto-reply/envelope.d.ts +0 -58
  783. package/dist/plugin-sdk/src/auto-reply/fallback-state.d.ts +0 -55
  784. package/dist/plugin-sdk/src/auto-reply/group-activation.d.ts +0 -6
  785. package/dist/plugin-sdk/src/auto-reply/heartbeat-reply-payload.d.ts +0 -2
  786. package/dist/plugin-sdk/src/auto-reply/heartbeat.d.ts +0 -26
  787. package/dist/plugin-sdk/src/auto-reply/inbound-debounce.d.ts +0 -17
  788. package/dist/plugin-sdk/src/auto-reply/media-note.d.ts +0 -2
  789. package/dist/plugin-sdk/src/auto-reply/model-runtime.d.ts +0 -17
  790. package/dist/plugin-sdk/src/auto-reply/model.d.ts +0 -8
  791. package/dist/plugin-sdk/src/auto-reply/reply/abort-cutoff.d.ts +0 -28
  792. package/dist/plugin-sdk/src/auto-reply/reply/abort.d.ts +0 -33
  793. package/dist/plugin-sdk/src/auto-reply/reply/acp-projector.d.ts +0 -15
  794. package/dist/plugin-sdk/src/auto-reply/reply/agent-runner-execution.d.ts +0 -59
  795. package/dist/plugin-sdk/src/auto-reply/reply/agent-runner-helpers.d.ts +0 -15
  796. package/dist/plugin-sdk/src/auto-reply/reply/agent-runner-memory.d.ts +0 -20
  797. package/dist/plugin-sdk/src/auto-reply/reply/agent-runner-payloads.d.ts +0 -27
  798. package/dist/plugin-sdk/src/auto-reply/reply/agent-runner-utils.d.ts +0 -148
  799. package/dist/plugin-sdk/src/auto-reply/reply/agent-runner.d.ts +0 -38
  800. package/dist/plugin-sdk/src/auto-reply/reply/bash-command.d.ts +0 -19
  801. package/dist/plugin-sdk/src/auto-reply/reply/block-reply-coalescer.d.ts +0 -15
  802. package/dist/plugin-sdk/src/auto-reply/reply/block-reply-pipeline.d.ts +0 -31
  803. package/dist/plugin-sdk/src/auto-reply/reply/block-streaming.d.ts +0 -36
  804. package/dist/plugin-sdk/src/auto-reply/reply/body.d.ts +0 -10
  805. package/dist/plugin-sdk/src/auto-reply/reply/command-gates.d.ts +0 -18
  806. package/dist/plugin-sdk/src/auto-reply/reply/commands-acp/context.d.ts +0 -12
  807. package/dist/plugin-sdk/src/auto-reply/reply/commands-acp/diagnostics.d.ts +0 -4
  808. package/dist/plugin-sdk/src/auto-reply/reply/commands-acp/lifecycle.d.ts +0 -5
  809. package/dist/plugin-sdk/src/auto-reply/reply/commands-acp/runtime-options.d.ts +0 -9
  810. package/dist/plugin-sdk/src/auto-reply/reply/commands-acp/shared.d.ts +0 -97
  811. package/dist/plugin-sdk/src/auto-reply/reply/commands-acp/targets.d.ts +0 -12
  812. package/dist/plugin-sdk/src/auto-reply/reply/commands-acp.d.ts +0 -2
  813. package/dist/plugin-sdk/src/auto-reply/reply/commands-allowlist.d.ts +0 -2
  814. package/dist/plugin-sdk/src/auto-reply/reply/commands-approve.d.ts +0 -2
  815. package/dist/plugin-sdk/src/auto-reply/reply/commands-bash.d.ts +0 -2
  816. package/dist/plugin-sdk/src/auto-reply/reply/commands-compact.d.ts +0 -2
  817. package/dist/plugin-sdk/src/auto-reply/reply/commands-config.d.ts +0 -3
  818. package/dist/plugin-sdk/src/auto-reply/reply/commands-context-report.d.ts +0 -3
  819. package/dist/plugin-sdk/src/auto-reply/reply/commands-context.d.ts +0 -12
  820. package/dist/plugin-sdk/src/auto-reply/reply/commands-control.d.ts +0 -5
  821. package/dist/plugin-sdk/src/auto-reply/reply/commands-core.d.ts +0 -13
  822. package/dist/plugin-sdk/src/auto-reply/reply/commands-export-session.d.ts +0 -3
  823. package/dist/plugin-sdk/src/auto-reply/reply/commands-info.d.ts +0 -11
  824. package/dist/plugin-sdk/src/auto-reply/reply/commands-models.d.ts +0 -36
  825. package/dist/plugin-sdk/src/auto-reply/reply/commands-plugin.d.ts +0 -13
  826. package/dist/plugin-sdk/src/auto-reply/reply/commands-session-abort.d.ts +0 -3
  827. package/dist/plugin-sdk/src/auto-reply/reply/commands-session-store.d.ts +0 -13
  828. package/dist/plugin-sdk/src/auto-reply/reply/commands-session.d.ts +0 -8
  829. package/dist/plugin-sdk/src/auto-reply/reply/commands-setunset-standard.d.ts +0 -10
  830. package/dist/plugin-sdk/src/auto-reply/reply/commands-setunset.d.ts +0 -34
  831. package/dist/plugin-sdk/src/auto-reply/reply/commands-slash-parse.d.ts +0 -24
  832. package/dist/plugin-sdk/src/auto-reply/reply/commands-status.d.ts +0 -26
  833. package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-agents.d.ts +0 -3
  834. package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-focus.d.ts +0 -3
  835. package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-help.d.ts +0 -2
  836. package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-info.d.ts +0 -3
  837. package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-kill.d.ts +0 -3
  838. package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-list.d.ts +0 -3
  839. package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-log.d.ts +0 -3
  840. package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-send.d.ts +0 -3
  841. package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-spawn.d.ts +0 -3
  842. package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/action-unfocus.d.ts +0 -3
  843. package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents/shared.d.ts +0 -81
  844. package/dist/plugin-sdk/src/auto-reply/reply/commands-subagents.d.ts +0 -4
  845. package/dist/plugin-sdk/src/auto-reply/reply/commands-system-prompt.d.ts +0 -14
  846. package/dist/plugin-sdk/src/auto-reply/reply/commands-tts.d.ts +0 -2
  847. package/dist/plugin-sdk/src/auto-reply/reply/commands-types.d.ts +0 -63
  848. package/dist/plugin-sdk/src/auto-reply/reply/commands.d.ts +0 -4
  849. package/dist/plugin-sdk/src/auto-reply/reply/config-commands.d.ts +0 -15
  850. package/dist/plugin-sdk/src/auto-reply/reply/config-value.d.ts +0 -4
  851. package/dist/plugin-sdk/src/auto-reply/reply/debug-commands.d.ts +0 -16
  852. package/dist/plugin-sdk/src/auto-reply/reply/directive-handling.auth.d.ts +0 -19
  853. package/dist/plugin-sdk/src/auto-reply/reply/directive-handling.d.ts +0 -6
  854. package/dist/plugin-sdk/src/auto-reply/reply/directive-handling.fast-lane.d.ts +0 -7
  855. package/dist/plugin-sdk/src/auto-reply/reply/directive-handling.impl.d.ts +0 -3
  856. package/dist/plugin-sdk/src/auto-reply/reply/directive-handling.levels.d.ts +0 -20
  857. package/dist/plugin-sdk/src/auto-reply/reply/directive-handling.model-picker.d.ts +0 -13
  858. package/dist/plugin-sdk/src/auto-reply/reply/directive-handling.model.d.ts +0 -44
  859. package/dist/plugin-sdk/src/auto-reply/reply/directive-handling.params.d.ts +0 -51
  860. package/dist/plugin-sdk/src/auto-reply/reply/directive-handling.parse.d.ts +0 -62
  861. package/dist/plugin-sdk/src/auto-reply/reply/directive-handling.persist.d.ts +0 -37
  862. package/dist/plugin-sdk/src/auto-reply/reply/directive-handling.queue-validation.d.ts +0 -10
  863. package/dist/plugin-sdk/src/auto-reply/reply/directive-handling.shared.d.ts +0 -28
  864. package/dist/plugin-sdk/src/auto-reply/reply/directive-parsing.d.ts +0 -5
  865. package/dist/plugin-sdk/src/auto-reply/reply/directives.d.ts +0 -38
  866. package/dist/plugin-sdk/src/auto-reply/reply/dispatch-acp.d.ts +0 -30
  867. package/dist/plugin-sdk/src/auto-reply/reply/dispatch-from-config.d.ts +0 -16
  868. package/dist/plugin-sdk/src/auto-reply/reply/dispatcher-registry.d.ts +0 -24
  869. package/dist/plugin-sdk/src/auto-reply/reply/elevated-allowlist-matcher.d.ts +0 -20
  870. package/dist/plugin-sdk/src/auto-reply/reply/elevated-unavailable.d.ts +0 -8
  871. package/dist/plugin-sdk/src/auto-reply/reply/exec/directive.d.ts +0 -20
  872. package/dist/plugin-sdk/src/auto-reply/reply/exec.d.ts +0 -1
  873. package/dist/plugin-sdk/src/auto-reply/reply/followup-runner.d.ts +0 -16
  874. package/dist/plugin-sdk/src/auto-reply/reply/get-reply-directives-apply.d.ts +0 -64
  875. package/dist/plugin-sdk/src/auto-reply/reply/get-reply-directives-utils.d.ts +0 -3
  876. package/dist/plugin-sdk/src/auto-reply/reply/get-reply-directives.d.ts +0 -92
  877. package/dist/plugin-sdk/src/auto-reply/reply/get-reply-inline-actions.d.ts +0 -59
  878. package/dist/plugin-sdk/src/auto-reply/reply/get-reply-run.d.ts +0 -69
  879. package/dist/plugin-sdk/src/auto-reply/reply/get-reply.d.ts +0 -4
  880. package/dist/plugin-sdk/src/auto-reply/reply/groups.d.ts +0 -26
  881. package/dist/plugin-sdk/src/auto-reply/reply/history.d.ts +0 -72
  882. package/dist/plugin-sdk/src/auto-reply/reply/inbound-context.d.ts +0 -8
  883. package/dist/plugin-sdk/src/auto-reply/reply/inbound-dedupe.d.ts +0 -8
  884. package/dist/plugin-sdk/src/auto-reply/reply/inbound-meta.d.ts +0 -3
  885. package/dist/plugin-sdk/src/auto-reply/reply/inbound-text.d.ts +0 -2
  886. package/dist/plugin-sdk/src/auto-reply/reply/line-directives.d.ts +0 -22
  887. package/dist/plugin-sdk/src/auto-reply/reply/memory-flush.d.ts +0 -28
  888. package/dist/plugin-sdk/src/auto-reply/reply/mentions.d.ts +0 -19
  889. package/dist/plugin-sdk/src/auto-reply/reply/model-selection.d.ts +0 -67
  890. package/dist/plugin-sdk/src/auto-reply/reply/normalize-reply.d.ts +0 -13
  891. package/dist/plugin-sdk/src/auto-reply/reply/origin-routing.d.ts +0 -13
  892. package/dist/plugin-sdk/src/auto-reply/reply/post-compaction-audit.d.ts +0 -26
  893. package/dist/plugin-sdk/src/auto-reply/reply/post-compaction-context.d.ts +0 -12
  894. package/dist/plugin-sdk/src/auto-reply/reply/provider-dispatcher.d.ts +0 -19
  895. package/dist/plugin-sdk/src/auto-reply/reply/queue/cleanup.d.ts +0 -11
  896. package/dist/plugin-sdk/src/auto-reply/reply/queue/directive.d.ts +0 -15
  897. package/dist/plugin-sdk/src/auto-reply/reply/queue/drain.d.ts +0 -2
  898. package/dist/plugin-sdk/src/auto-reply/reply/queue/enqueue.d.ts +0 -3
  899. package/dist/plugin-sdk/src/auto-reply/reply/queue/normalize.d.ts +0 -3
  900. package/dist/plugin-sdk/src/auto-reply/reply/queue/settings.d.ts +0 -2
  901. package/dist/plugin-sdk/src/auto-reply/reply/queue/state.d.ts +0 -20
  902. package/dist/plugin-sdk/src/auto-reply/reply/queue/types.d.ts +0 -85
  903. package/dist/plugin-sdk/src/auto-reply/reply/queue-policy.d.ts +0 -8
  904. package/dist/plugin-sdk/src/auto-reply/reply/queue.d.ts +0 -8
  905. package/dist/plugin-sdk/src/auto-reply/reply/reply-delivery.d.ts +0 -27
  906. package/dist/plugin-sdk/src/auto-reply/reply/reply-directives.d.ts +0 -14
  907. package/dist/plugin-sdk/src/auto-reply/reply/reply-dispatcher.d.ts +0 -54
  908. package/dist/plugin-sdk/src/auto-reply/reply/reply-elevated.d.ts +0 -16
  909. package/dist/plugin-sdk/src/auto-reply/reply/reply-inline.d.ts +0 -8
  910. package/dist/plugin-sdk/src/auto-reply/reply/reply-payloads.d.ts +0 -27
  911. package/dist/plugin-sdk/src/auto-reply/reply/reply-reference.d.ts +0 -22
  912. package/dist/plugin-sdk/src/auto-reply/reply/reply-tags.d.ts +0 -6
  913. package/dist/plugin-sdk/src/auto-reply/reply/reply-threading.d.ts +0 -9
  914. package/dist/plugin-sdk/src/auto-reply/reply/response-prefix-template.d.ts +0 -51
  915. package/dist/plugin-sdk/src/auto-reply/reply/route-reply.d.ts +0 -56
  916. package/dist/plugin-sdk/src/auto-reply/reply/session-reset-model.d.ts +0 -24
  917. package/dist/plugin-sdk/src/auto-reply/reply/session-reset-prompt.d.ts +0 -1
  918. package/dist/plugin-sdk/src/auto-reply/reply/session-run-accounting.d.ts +0 -12
  919. package/dist/plugin-sdk/src/auto-reply/reply/session-updates.d.ts +0 -34
  920. package/dist/plugin-sdk/src/auto-reply/reply/session-usage.d.ts +0 -21
  921. package/dist/plugin-sdk/src/auto-reply/reply/session.d.ts +0 -26
  922. package/dist/plugin-sdk/src/auto-reply/reply/stage-sandbox-media.d.ts +0 -9
  923. package/dist/plugin-sdk/src/auto-reply/reply/streaming-directives.d.ts +0 -10
  924. package/dist/plugin-sdk/src/auto-reply/reply/strip-inbound-meta.d.ts +0 -27
  925. package/dist/plugin-sdk/src/auto-reply/reply/subagents-utils.d.ts +0 -27
  926. package/dist/plugin-sdk/src/auto-reply/reply/typing-mode.d.ts +0 -30
  927. package/dist/plugin-sdk/src/auto-reply/reply/typing-policy.d.ts +0 -13
  928. package/dist/plugin-sdk/src/auto-reply/reply/typing.d.ts +0 -18
  929. package/dist/plugin-sdk/src/auto-reply/reply/untrusted-context.d.ts +0 -1
  930. package/dist/plugin-sdk/src/auto-reply/reply.d.ts +0 -6
  931. package/dist/plugin-sdk/src/auto-reply/send-policy.d.ts +0 -6
  932. package/dist/plugin-sdk/src/auto-reply/skill-commands.d.ts +0 -19
  933. package/dist/plugin-sdk/src/auto-reply/status.d.ts +0 -60
  934. package/dist/plugin-sdk/src/auto-reply/templating.d.ts +0 -161
  935. package/dist/plugin-sdk/src/auto-reply/thinking.d.ts +0 -16
  936. package/dist/plugin-sdk/src/auto-reply/tokens.d.ts +0 -4
  937. package/dist/plugin-sdk/src/auto-reply/tool-meta.d.ts +0 -8
  938. package/dist/plugin-sdk/src/auto-reply/types.d.ts +0 -85
  939. package/dist/plugin-sdk/src/brand.d.ts +0 -6
  940. package/dist/plugin-sdk/src/browser/bridge-auth-registry.d.ts +0 -8
  941. package/dist/plugin-sdk/src/browser/bridge-server.d.ts +0 -19
  942. package/dist/plugin-sdk/src/browser/cdp.d.ts +0 -125
  943. package/dist/plugin-sdk/src/browser/cdp.helpers.d.ts +0 -13
  944. package/dist/plugin-sdk/src/browser/chrome.d.ts +0 -20
  945. package/dist/plugin-sdk/src/browser/chrome.executables.d.ts +0 -9
  946. package/dist/plugin-sdk/src/browser/chrome.profile-decoration.d.ts +0 -10
  947. package/dist/plugin-sdk/src/browser/client-actions-core.d.ts +0 -142
  948. package/dist/plugin-sdk/src/browser/client-actions-observe.d.ts +0 -68
  949. package/dist/plugin-sdk/src/browser/client-actions-state.d.ts +0 -90
  950. package/dist/plugin-sdk/src/browser/client-actions-types.d.ts +0 -18
  951. package/dist/plugin-sdk/src/browser/client-actions-url.d.ts +0 -2
  952. package/dist/plugin-sdk/src/browser/client-actions.d.ts +0 -4
  953. package/dist/plugin-sdk/src/browser/client-fetch.d.ts +0 -20
  954. package/dist/plugin-sdk/src/browser/client.d.ts +0 -147
  955. package/dist/plugin-sdk/src/browser/config.d.ts +0 -43
  956. package/dist/plugin-sdk/src/browser/constants.d.ts +0 -8
  957. package/dist/plugin-sdk/src/browser/control-auth.d.ts +0 -13
  958. package/dist/plugin-sdk/src/browser/control-service.d.ts +0 -5
  959. package/dist/plugin-sdk/src/browser/csrf.d.ts +0 -8
  960. package/dist/plugin-sdk/src/browser/extension-relay-auth.d.ts +0 -8
  961. package/dist/plugin-sdk/src/browser/extension-relay.d.ts +0 -15
  962. package/dist/plugin-sdk/src/browser/form-fields.d.ts +0 -8
  963. package/dist/plugin-sdk/src/browser/http-auth.d.ts +0 -5
  964. package/dist/plugin-sdk/src/browser/navigation-guard.d.ts +0 -21
  965. package/dist/plugin-sdk/src/browser/paths.d.ts +0 -61
  966. package/dist/plugin-sdk/src/browser/profiles-service.d.ts +0 -25
  967. package/dist/plugin-sdk/src/browser/profiles.d.ts +0 -30
  968. package/dist/plugin-sdk/src/browser/proxy-files.d.ts +0 -7
  969. package/dist/plugin-sdk/src/browser/pw-ai-module.d.ts +0 -6
  970. package/dist/plugin-sdk/src/browser/pw-ai-state.d.ts +0 -2
  971. package/dist/plugin-sdk/src/browser/pw-ai.d.ts +0 -2
  972. package/dist/plugin-sdk/src/browser/pw-role-snapshot.d.ts +0 -35
  973. package/dist/plugin-sdk/src/browser/pw-session.d.ts +0 -162
  974. package/dist/plugin-sdk/src/browser/pw-tools-core.activity.d.ts +0 -21
  975. package/dist/plugin-sdk/src/browser/pw-tools-core.d.ts +0 -8
  976. package/dist/plugin-sdk/src/browser/pw-tools-core.downloads.d.ts +0 -34
  977. package/dist/plugin-sdk/src/browser/pw-tools-core.interactions.d.ts +0 -114
  978. package/dist/plugin-sdk/src/browser/pw-tools-core.responses.d.ts +0 -13
  979. package/dist/plugin-sdk/src/browser/pw-tools-core.shared.d.ts +0 -6
  980. package/dist/plugin-sdk/src/browser/pw-tools-core.snapshot.d.ts +0 -66
  981. package/dist/plugin-sdk/src/browser/pw-tools-core.state.d.ts +0 -46
  982. package/dist/plugin-sdk/src/browser/pw-tools-core.storage.d.ts +0 -47
  983. package/dist/plugin-sdk/src/browser/pw-tools-core.trace.d.ts +0 -12
  984. package/dist/plugin-sdk/src/browser/resolved-config-refresh.d.ts +0 -12
  985. package/dist/plugin-sdk/src/browser/routes/agent.act.d.ts +0 -3
  986. package/dist/plugin-sdk/src/browser/routes/agent.act.download.d.ts +0 -3
  987. package/dist/plugin-sdk/src/browser/routes/agent.act.hooks.d.ts +0 -3
  988. package/dist/plugin-sdk/src/browser/routes/agent.act.shared.d.ts +0 -10
  989. package/dist/plugin-sdk/src/browser/routes/agent.d.ts +0 -3
  990. package/dist/plugin-sdk/src/browser/routes/agent.debug.d.ts +0 -3
  991. package/dist/plugin-sdk/src/browser/routes/agent.shared.d.ts +0 -37
  992. package/dist/plugin-sdk/src/browser/routes/agent.snapshot.d.ts +0 -3
  993. package/dist/plugin-sdk/src/browser/routes/agent.storage.d.ts +0 -14
  994. package/dist/plugin-sdk/src/browser/routes/basic.d.ts +0 -3
  995. package/dist/plugin-sdk/src/browser/routes/dispatcher.d.ts +0 -16
  996. package/dist/plugin-sdk/src/browser/routes/index.d.ts +0 -3
  997. package/dist/plugin-sdk/src/browser/routes/output-paths.d.ts +0 -10
  998. package/dist/plugin-sdk/src/browser/routes/path-output.d.ts +0 -1
  999. package/dist/plugin-sdk/src/browser/routes/tabs.d.ts +0 -3
  1000. package/dist/plugin-sdk/src/browser/routes/types.d.ts +0 -20
  1001. package/dist/plugin-sdk/src/browser/routes/utils.d.ts +0 -15
  1002. package/dist/plugin-sdk/src/browser/runtime-dependency.d.ts +0 -3
  1003. package/dist/plugin-sdk/src/browser/screenshot.d.ts +0 -9
  1004. package/dist/plugin-sdk/src/browser/server-context.d.ts +0 -4
  1005. package/dist/plugin-sdk/src/browser/server-context.types.d.ts +0 -65
  1006. package/dist/plugin-sdk/src/browser/server-lifecycle.d.ts +0 -10
  1007. package/dist/plugin-sdk/src/browser/server-middleware.d.ts +0 -6
  1008. package/dist/plugin-sdk/src/browser/target-id.d.ts +0 -11
  1009. package/dist/plugin-sdk/src/browser/trash.d.ts +0 -1
  1010. package/dist/plugin-sdk/src/canvas-host/a2ui.d.ts +0 -6
  1011. package/dist/plugin-sdk/src/canvas-host/file-resolver.d.ts +0 -3
  1012. package/dist/plugin-sdk/src/canvas-host/server.d.ts +0 -36
  1013. package/dist/plugin-sdk/src/channel-web.d.ts +0 -6
  1014. package/dist/plugin-sdk/src/channels/account-snapshot-fields.d.ts +0 -2
  1015. package/dist/plugin-sdk/src/channels/account-summary.d.ts +0 -17
  1016. package/dist/plugin-sdk/src/channels/ack-reactions.d.ts +0 -29
  1017. package/dist/plugin-sdk/src/channels/allow-from.d.ts +0 -16
  1018. package/dist/plugin-sdk/src/channels/allowlist-match.d.ts +0 -16
  1019. package/dist/plugin-sdk/src/channels/allowlists/resolve-utils.d.ts +0 -33
  1020. package/dist/plugin-sdk/src/channels/channel-config.d.ts +0 -39
  1021. package/dist/plugin-sdk/src/channels/chat-type.d.ts +0 -2
  1022. package/dist/plugin-sdk/src/channels/command-gating.d.ts +0 -20
  1023. package/dist/plugin-sdk/src/channels/conversation-label.d.ts +0 -2
  1024. package/dist/plugin-sdk/src/channels/dock.d.ts +0 -25
  1025. package/dist/plugin-sdk/src/channels/draft-stream-controls.d.ts +0 -54
  1026. package/dist/plugin-sdk/src/channels/draft-stream-loop.d.ts +0 -13
  1027. package/dist/plugin-sdk/src/channels/ids.d.ts +0 -9
  1028. package/dist/plugin-sdk/src/channels/location.d.ts +0 -21
  1029. package/dist/plugin-sdk/src/channels/logging.d.ts +0 -20
  1030. package/dist/plugin-sdk/src/channels/mention-gating.d.ts +0 -27
  1031. package/dist/plugin-sdk/src/channels/model-overrides.d.ts +0 -18
  1032. package/dist/plugin-sdk/src/channels/plugins/account-action-gate.d.ts +0 -5
  1033. package/dist/plugin-sdk/src/channels/plugins/account-helpers.d.ts +0 -6
  1034. package/dist/plugin-sdk/src/channels/plugins/actions/discord/handle-action.d.ts +0 -3
  1035. package/dist/plugin-sdk/src/channels/plugins/actions/discord/handle-action.guild-admin.d.ts +0 -9
  1036. package/dist/plugin-sdk/src/channels/plugins/actions/discord.d.ts +0 -2
  1037. package/dist/plugin-sdk/src/channels/plugins/actions/shared.d.ts +0 -7
  1038. package/dist/plugin-sdk/src/channels/plugins/actions/signal.d.ts +0 -2
  1039. package/dist/plugin-sdk/src/channels/plugins/actions/telegram.d.ts +0 -2
  1040. package/dist/plugin-sdk/src/channels/plugins/agent-tools/whatsapp-login.d.ts +0 -2
  1041. package/dist/plugin-sdk/src/channels/plugins/allowlist-match.d.ts +0 -2
  1042. package/dist/plugin-sdk/src/channels/plugins/bluebubbles-actions.d.ts +0 -48
  1043. package/dist/plugin-sdk/src/channels/plugins/catalog.d.ts +0 -50
  1044. package/dist/plugin-sdk/src/channels/plugins/channel-config.d.ts +0 -2
  1045. package/dist/plugin-sdk/src/channels/plugins/config-helpers.d.ts +0 -14
  1046. package/dist/plugin-sdk/src/channels/plugins/config-schema.d.ts +0 -3
  1047. package/dist/plugin-sdk/src/channels/plugins/config-writes.d.ts +0 -7
  1048. package/dist/plugin-sdk/src/channels/plugins/directory-config.d.ts +0 -16
  1049. package/dist/plugin-sdk/src/channels/plugins/group-mentions.d.ts +0 -18
  1050. package/dist/plugin-sdk/src/channels/plugins/helpers.d.ts +0 -8
  1051. package/dist/plugin-sdk/src/channels/plugins/index.d.ts +0 -8
  1052. package/dist/plugin-sdk/src/channels/plugins/media-limits.d.ts +0 -9
  1053. package/dist/plugin-sdk/src/channels/plugins/media-payload.d.ts +0 -15
  1054. package/dist/plugin-sdk/src/channels/plugins/message-action-names.d.ts +0 -2
  1055. package/dist/plugin-sdk/src/channels/plugins/message-actions.d.ts +0 -15
  1056. package/dist/plugin-sdk/src/channels/plugins/normalize/discord.d.ts +0 -14
  1057. package/dist/plugin-sdk/src/channels/plugins/normalize/imessage.d.ts +0 -2
  1058. package/dist/plugin-sdk/src/channels/plugins/normalize/shared.d.ts +0 -6
  1059. package/dist/plugin-sdk/src/channels/plugins/normalize/signal.d.ts +0 -2
  1060. package/dist/plugin-sdk/src/channels/plugins/normalize/slack.d.ts +0 -2
  1061. package/dist/plugin-sdk/src/channels/plugins/normalize/telegram.d.ts +0 -2
  1062. package/dist/plugin-sdk/src/channels/plugins/normalize/whatsapp.d.ts +0 -3
  1063. package/dist/plugin-sdk/src/channels/plugins/onboarding/channel-access-configure.d.ts +0 -21
  1064. package/dist/plugin-sdk/src/channels/plugins/onboarding/channel-access.d.ts +0 -31
  1065. package/dist/plugin-sdk/src/channels/plugins/onboarding/discord.d.ts +0 -2
  1066. package/dist/plugin-sdk/src/channels/plugins/onboarding/helpers.d.ts +0 -177
  1067. package/dist/plugin-sdk/src/channels/plugins/onboarding/imessage.d.ts +0 -6
  1068. package/dist/plugin-sdk/src/channels/plugins/onboarding/signal.d.ts +0 -7
  1069. package/dist/plugin-sdk/src/channels/plugins/onboarding/slack.d.ts +0 -2
  1070. package/dist/plugin-sdk/src/channels/plugins/onboarding/telegram.d.ts +0 -4
  1071. package/dist/plugin-sdk/src/channels/plugins/onboarding/whatsapp.d.ts +0 -2
  1072. package/dist/plugin-sdk/src/channels/plugins/onboarding-types.d.ts +0 -149
  1073. package/dist/plugin-sdk/src/channels/plugins/outbound/load.d.ts +0 -2
  1074. package/dist/plugin-sdk/src/channels/plugins/pairing-message.d.ts +0 -1
  1075. package/dist/plugin-sdk/src/channels/plugins/pairing.d.ts +0 -16
  1076. package/dist/plugin-sdk/src/channels/plugins/registry-loader.d.ts +0 -5
  1077. package/dist/plugin-sdk/src/channels/plugins/setup-helpers.d.ts +0 -21
  1078. package/dist/plugin-sdk/src/channels/plugins/status-issues/bluebubbles.d.ts +0 -2
  1079. package/dist/plugin-sdk/src/channels/plugins/status-issues/discord.d.ts +0 -2
  1080. package/dist/plugin-sdk/src/channels/plugins/status-issues/shared.d.ts +0 -29
  1081. package/dist/plugin-sdk/src/channels/plugins/status-issues/telegram.d.ts +0 -2
  1082. package/dist/plugin-sdk/src/channels/plugins/status-issues/whatsapp.d.ts +0 -2
  1083. package/dist/plugin-sdk/src/channels/plugins/types.adapters.d.ts +0 -294
  1084. package/dist/plugin-sdk/src/channels/plugins/types.core.d.ts +0 -357
  1085. package/dist/plugin-sdk/src/channels/plugins/types.d.ts +0 -6
  1086. package/dist/plugin-sdk/src/channels/plugins/types.plugin.d.ts +0 -54
  1087. package/dist/plugin-sdk/src/channels/plugins/whatsapp-heartbeat.d.ts +0 -11
  1088. package/dist/plugin-sdk/src/channels/plugins/whatsapp-shared.d.ts +0 -5
  1089. package/dist/plugin-sdk/src/channels/registry.d.ts +0 -12
  1090. package/dist/plugin-sdk/src/channels/reply-prefix.d.ts +0 -24
  1091. package/dist/plugin-sdk/src/channels/sender-label.d.ts +0 -9
  1092. package/dist/plugin-sdk/src/channels/session.d.ts +0 -18
  1093. package/dist/plugin-sdk/src/channels/status-reactions.d.ts +0 -62
  1094. package/dist/plugin-sdk/src/channels/targets.d.ts +0 -42
  1095. package/dist/plugin-sdk/src/channels/telegram/allow-from.d.ts +0 -2
  1096. package/dist/plugin-sdk/src/channels/telegram/api.d.ts +0 -5
  1097. package/dist/plugin-sdk/src/channels/thread-bindings-messages.d.ts +0 -19
  1098. package/dist/plugin-sdk/src/channels/thread-bindings-policy.d.ts +0 -68
  1099. package/dist/plugin-sdk/src/channels/typing-lifecycle.d.ts +0 -12
  1100. package/dist/plugin-sdk/src/channels/typing-start-guard.d.ts +0 -13
  1101. package/dist/plugin-sdk/src/channels/typing.d.ts +0 -18
  1102. package/dist/plugin-sdk/src/channels/web/index.d.ts +0 -1
  1103. package/dist/plugin-sdk/src/cli/argv.d.ts +0 -17
  1104. package/dist/plugin-sdk/src/cli/banner.d.ts +0 -11
  1105. package/dist/plugin-sdk/src/cli/cli-name.d.ts +0 -3
  1106. package/dist/plugin-sdk/src/cli/cli-utils.d.ts +0 -19
  1107. package/dist/plugin-sdk/src/cli/command-format.d.ts +0 -1
  1108. package/dist/plugin-sdk/src/cli/deps.d.ts +0 -18
  1109. package/dist/plugin-sdk/src/cli/help-format.d.ts +0 -5
  1110. package/dist/plugin-sdk/src/cli/memory-cli.d.ts +0 -21
  1111. package/dist/plugin-sdk/src/cli/nodes-camera.d.ts +0 -38
  1112. package/dist/plugin-sdk/src/cli/nodes-canvas.d.ts +0 -10
  1113. package/dist/plugin-sdk/src/cli/nodes-media-utils.d.ts +0 -13
  1114. package/dist/plugin-sdk/src/cli/nodes-run.d.ts +0 -3
  1115. package/dist/plugin-sdk/src/cli/nodes-screen.d.ts +0 -18
  1116. package/dist/plugin-sdk/src/cli/outbound-send-deps.d.ts +0 -4
  1117. package/dist/plugin-sdk/src/cli/outbound-send-mapping.d.ts +0 -10
  1118. package/dist/plugin-sdk/src/cli/parse-bytes.d.ts +0 -4
  1119. package/dist/plugin-sdk/src/cli/parse-duration.d.ts +0 -4
  1120. package/dist/plugin-sdk/src/cli/parse-timeout.d.ts +0 -1
  1121. package/dist/plugin-sdk/src/cli/profile-utils.d.ts +0 -2
  1122. package/dist/plugin-sdk/src/cli/progress.d.ts +0 -24
  1123. package/dist/plugin-sdk/src/cli/prompt.d.ts +0 -1
  1124. package/dist/plugin-sdk/src/cli/wait.d.ts +0 -1
  1125. package/dist/plugin-sdk/src/commands/agent/attempt.d.ts +0 -39
  1126. package/dist/plugin-sdk/src/commands/agent/delivery.d.ts +0 -21
  1127. package/dist/plugin-sdk/src/commands/agent/lifecycle.d.ts +0 -17
  1128. package/dist/plugin-sdk/src/commands/agent/run-context.d.ts +0 -2
  1129. package/dist/plugin-sdk/src/commands/agent/session-store.d.ts +0 -17
  1130. package/dist/plugin-sdk/src/commands/agent/session.d.ts +0 -33
  1131. package/dist/plugin-sdk/src/commands/agent/strict-agentic-contract.d.ts +0 -44
  1132. package/dist/plugin-sdk/src/commands/agent/types.d.ts +0 -77
  1133. package/dist/plugin-sdk/src/commands/agent.d.ts +0 -7
  1134. package/dist/plugin-sdk/src/commands/agents.config.d.ts +0 -42
  1135. package/dist/plugin-sdk/src/commands/channel-account-context.d.ts +0 -10
  1136. package/dist/plugin-sdk/src/commands/cleanup-utils.d.ts +0 -37
  1137. package/dist/plugin-sdk/src/commands/daemon-runtime.d.ts +0 -8
  1138. package/dist/plugin-sdk/src/commands/gateway-presence.d.ts +0 -7
  1139. package/dist/plugin-sdk/src/commands/health.d.ts +0 -74
  1140. package/dist/plugin-sdk/src/commands/hosted-dashboard-probe.d.ts +0 -40
  1141. package/dist/plugin-sdk/src/commands/oauth-flow.d.ts +0 -21
  1142. package/dist/plugin-sdk/src/commands/onboard-helpers.d.ts +0 -84
  1143. package/dist/plugin-sdk/src/commands/onboard-types.d.ts +0 -119
  1144. package/dist/plugin-sdk/src/commands/signal-install.d.ts +0 -30
  1145. package/dist/plugin-sdk/src/commands/status-all/agents.d.ts +0 -16
  1146. package/dist/plugin-sdk/src/commands/status-all/channels.d.ts +0 -19
  1147. package/dist/plugin-sdk/src/commands/status-all/diagnosis.d.ts +0 -62
  1148. package/dist/plugin-sdk/src/commands/status-all/format.d.ts +0 -7
  1149. package/dist/plugin-sdk/src/commands/status-all/gateway.d.ts +0 -5
  1150. package/dist/plugin-sdk/src/commands/status-all/report-lines.d.ts +0 -44
  1151. package/dist/plugin-sdk/src/commands/status-all.d.ts +0 -4
  1152. package/dist/plugin-sdk/src/commands/status.acpx-bridge.d.ts +0 -19
  1153. package/dist/plugin-sdk/src/commands/status.agent-local.d.ts +0 -16
  1154. package/dist/plugin-sdk/src/commands/status.command.d.ts +0 -9
  1155. package/dist/plugin-sdk/src/commands/status.d.ts +0 -3
  1156. package/dist/plugin-sdk/src/commands/status.daemon.d.ts +0 -9
  1157. package/dist/plugin-sdk/src/commands/status.format.d.ts +0 -12
  1158. package/dist/plugin-sdk/src/commands/status.gateway-probe.d.ts +0 -6
  1159. package/dist/plugin-sdk/src/commands/status.link-channel.d.ts +0 -10
  1160. package/dist/plugin-sdk/src/commands/status.scan.d.ts +0 -46
  1161. package/dist/plugin-sdk/src/commands/status.strict-agentic.d.ts +0 -18
  1162. package/dist/plugin-sdk/src/commands/status.summary.d.ts +0 -5
  1163. package/dist/plugin-sdk/src/commands/status.types.d.ts +0 -67
  1164. package/dist/plugin-sdk/src/commands/status.update.d.ts +0 -23
  1165. package/dist/plugin-sdk/src/commands/text-format.d.ts +0 -1
  1166. package/dist/plugin-sdk/src/commands/wallet.d.ts +0 -300
  1167. package/dist/plugin-sdk/src/commands/xai-oauth.d.ts +0 -17
  1168. package/dist/plugin-sdk/src/config/agent-dirs.d.ts +0 -14
  1169. package/dist/plugin-sdk/src/config/agent-limits.d.ts +0 -6
  1170. package/dist/plugin-sdk/src/config/backup-rotation.d.ts +0 -5
  1171. package/dist/plugin-sdk/src/config/cache-utils.d.ts +0 -6
  1172. package/dist/plugin-sdk/src/config/channel-capabilities.d.ts +0 -6
  1173. package/dist/plugin-sdk/src/config/commands.d.ts +0 -25
  1174. package/dist/plugin-sdk/src/config/config-paths.d.ts +0 -10
  1175. package/dist/plugin-sdk/src/config/config.d.ts +0 -7
  1176. package/dist/plugin-sdk/src/config/dangerous-name-matching.d.ts +0 -12
  1177. package/dist/plugin-sdk/src/config/defaults.d.ts +0 -19
  1178. package/dist/plugin-sdk/src/config/discord-preview-streaming.d.ts +0 -25
  1179. package/dist/plugin-sdk/src/config/env-preserve.d.ts +0 -10
  1180. package/dist/plugin-sdk/src/config/env-substitution.d.ts +0 -36
  1181. package/dist/plugin-sdk/src/config/env-vars.d.ts +0 -6
  1182. package/dist/plugin-sdk/src/config/group-policy.d.ts +0 -49
  1183. package/dist/plugin-sdk/src/config/includes-scan.d.ts +0 -4
  1184. package/dist/plugin-sdk/src/config/includes.d.ts +0 -43
  1185. package/dist/plugin-sdk/src/config/io.d.ts +0 -63
  1186. package/dist/plugin-sdk/src/config/legacy-migrate.d.ts +0 -5
  1187. package/dist/plugin-sdk/src/config/legacy.d.ts +0 -6
  1188. package/dist/plugin-sdk/src/config/legacy.migrations.d.ts +0 -1
  1189. package/dist/plugin-sdk/src/config/legacy.migrations.part-1.d.ts +0 -2
  1190. package/dist/plugin-sdk/src/config/legacy.migrations.part-2.d.ts +0 -2
  1191. package/dist/plugin-sdk/src/config/legacy.migrations.part-3.d.ts +0 -2
  1192. package/dist/plugin-sdk/src/config/legacy.rules.d.ts +0 -2
  1193. package/dist/plugin-sdk/src/config/legacy.shared.d.ts +0 -19
  1194. package/dist/plugin-sdk/src/config/markdown-tables.d.ts +0 -7
  1195. package/dist/plugin-sdk/src/config/merge-config.d.ts +0 -7
  1196. package/dist/plugin-sdk/src/config/merge-patch.d.ts +0 -5
  1197. package/dist/plugin-sdk/src/config/model-input.d.ts +0 -11
  1198. package/dist/plugin-sdk/src/config/normalize-exec-safe-bin.d.ts +0 -2
  1199. package/dist/plugin-sdk/src/config/normalize-paths.d.ts +0 -8
  1200. package/dist/plugin-sdk/src/config/paths.d.ts +0 -57
  1201. package/dist/plugin-sdk/src/config/plugin-auto-enable.d.ts +0 -15
  1202. package/dist/plugin-sdk/src/config/plugins-allowlist.d.ts +0 -12
  1203. package/dist/plugin-sdk/src/config/port-defaults.d.ts +0 -13
  1204. package/dist/plugin-sdk/src/config/prototype-keys.d.ts +0 -1
  1205. package/dist/plugin-sdk/src/config/runtime-group-policy.d.ts +0 -56
  1206. package/dist/plugin-sdk/src/config/runtime-overrides.d.ts +0 -15
  1207. package/dist/plugin-sdk/src/config/sat-runtime-ids.d.ts +0 -23
  1208. package/dist/plugin-sdk/src/config/sessions/artifacts.d.ts +0 -6
  1209. package/dist/plugin-sdk/src/config/sessions/delivery-info.d.ts +0 -16
  1210. package/dist/plugin-sdk/src/config/sessions/disk-budget.d.ts +0 -28
  1211. package/dist/plugin-sdk/src/config/sessions/group.d.ts +0 -11
  1212. package/dist/plugin-sdk/src/config/sessions/main-session.d.ts +0 -43
  1213. package/dist/plugin-sdk/src/config/sessions/metadata.d.ts +0 -16
  1214. package/dist/plugin-sdk/src/config/sessions/paths.d.ts +0 -21
  1215. package/dist/plugin-sdk/src/config/sessions/reset.d.ts +0 -43
  1216. package/dist/plugin-sdk/src/config/sessions/session-file.d.ts +0 -15
  1217. package/dist/plugin-sdk/src/config/sessions/session-key.d.ts +0 -8
  1218. package/dist/plugin-sdk/src/config/sessions/store.d.ts +0 -124
  1219. package/dist/plugin-sdk/src/config/sessions/transcript.d.ts +0 -32
  1220. package/dist/plugin-sdk/src/config/sessions/types.d.ts +0 -273
  1221. package/dist/plugin-sdk/src/config/sessions.d.ts +0 -13
  1222. package/dist/plugin-sdk/src/config/talk.d.ts +0 -22
  1223. package/dist/plugin-sdk/src/config/telegram-custom-commands.d.ts +0 -24
  1224. package/dist/plugin-sdk/src/config/types.acp.d.ts +0 -28
  1225. package/dist/plugin-sdk/src/config/types.agent-defaults.d.ts +0 -322
  1226. package/dist/plugin-sdk/src/config/types.agents-shared.d.ts +0 -53
  1227. package/dist/plugin-sdk/src/config/types.agents.d.ts +0 -71
  1228. package/dist/plugin-sdk/src/config/types.approvals.d.ts +0 -26
  1229. package/dist/plugin-sdk/src/config/types.auth.d.ts +0 -34
  1230. package/dist/plugin-sdk/src/config/types.base.d.ts +0 -227
  1231. package/dist/plugin-sdk/src/config/types.browser.d.ts +0 -65
  1232. package/dist/plugin-sdk/src/config/types.channel-messaging-common.d.ts +0 -44
  1233. package/dist/plugin-sdk/src/config/types.channels.d.ts +0 -53
  1234. package/dist/plugin-sdk/src/config/types.cron.d.ts +0 -26
  1235. package/dist/plugin-sdk/src/config/types.d.ts +0 -35
  1236. package/dist/plugin-sdk/src/config/types.discord.d.ts +0 -283
  1237. package/dist/plugin-sdk/src/config/types.fased.d.ts +0 -134
  1238. package/dist/plugin-sdk/src/config/types.federation.d.ts +0 -319
  1239. package/dist/plugin-sdk/src/config/types.gateway.d.ts +0 -313
  1240. package/dist/plugin-sdk/src/config/types.googlechat.d.ts +0 -110
  1241. package/dist/plugin-sdk/src/config/types.hooks.d.ts +0 -141
  1242. package/dist/plugin-sdk/src/config/types.imessage.d.ts +0 -77
  1243. package/dist/plugin-sdk/src/config/types.installs.d.ts +0 -36
  1244. package/dist/plugin-sdk/src/config/types.irc.d.ts +0 -54
  1245. package/dist/plugin-sdk/src/config/types.mcp.d.ts +0 -5
  1246. package/dist/plugin-sdk/src/config/types.memory.d.ts +0 -59
  1247. package/dist/plugin-sdk/src/config/types.messages.d.ts +0 -151
  1248. package/dist/plugin-sdk/src/config/types.models.d.ts +0 -70
  1249. package/dist/plugin-sdk/src/config/types.msteams.d.ts +0 -110
  1250. package/dist/plugin-sdk/src/config/types.node-host.d.ts +0 -10
  1251. package/dist/plugin-sdk/src/config/types.plugins.d.ts +0 -48
  1252. package/dist/plugin-sdk/src/config/types.queue.d.ts +0 -14
  1253. package/dist/plugin-sdk/src/config/types.sandbox.d.ts +0 -97
  1254. package/dist/plugin-sdk/src/config/types.secrets.d.ts +0 -67
  1255. package/dist/plugin-sdk/src/config/types.signal.d.ts +0 -46
  1256. package/dist/plugin-sdk/src/config/types.skills.d.ts +0 -47
  1257. package/dist/plugin-sdk/src/config/types.slack.d.ts +0 -181
  1258. package/dist/plugin-sdk/src/config/types.telegram.d.ts +0 -199
  1259. package/dist/plugin-sdk/src/config/types.tools.d.ts +0 -637
  1260. package/dist/plugin-sdk/src/config/types.tts.d.ts +0 -78
  1261. package/dist/plugin-sdk/src/config/types.wallet.d.ts +0 -88
  1262. package/dist/plugin-sdk/src/config/types.whatsapp.d.ts +0 -101
  1263. package/dist/plugin-sdk/src/config/validation.d.ts +0 -37
  1264. package/dist/plugin-sdk/src/config/version.d.ts +0 -9
  1265. package/dist/plugin-sdk/src/config/zod-schema.agent-defaults.d.ts +0 -308
  1266. package/dist/plugin-sdk/src/config/zod-schema.agent-model.d.ts +0 -24
  1267. package/dist/plugin-sdk/src/config/zod-schema.agent-runtime.d.ts +0 -1439
  1268. package/dist/plugin-sdk/src/config/zod-schema.agents.d.ts +0 -621
  1269. package/dist/plugin-sdk/src/config/zod-schema.allowdeny.d.ts +0 -13
  1270. package/dist/plugin-sdk/src/config/zod-schema.approvals.d.ts +0 -15
  1271. package/dist/plugin-sdk/src/config/zod-schema.channels.d.ts +0 -6
  1272. package/dist/plugin-sdk/src/config/zod-schema.core.d.ts +0 -926
  1273. package/dist/plugin-sdk/src/config/zod-schema.d.ts +0 -4763
  1274. package/dist/plugin-sdk/src/config/zod-schema.hooks.d.ts +0 -83
  1275. package/dist/plugin-sdk/src/config/zod-schema.installs.d.ts +0 -38
  1276. package/dist/plugin-sdk/src/config/zod-schema.providers-core.d.ts +0 -3785
  1277. package/dist/plugin-sdk/src/config/zod-schema.providers-whatsapp.d.ts +0 -235
  1278. package/dist/plugin-sdk/src/config/zod-schema.providers.d.ts +0 -2261
  1279. package/dist/plugin-sdk/src/config/zod-schema.sensitive.d.ts +0 -2
  1280. package/dist/plugin-sdk/src/config/zod-schema.session.d.ts +0 -237
  1281. package/dist/plugin-sdk/src/context-engine/types.d.ts +0 -6
  1282. package/dist/plugin-sdk/src/cron/access-block.d.ts +0 -22
  1283. package/dist/plugin-sdk/src/cron/delivery.d.ts +0 -10
  1284. package/dist/plugin-sdk/src/cron/graph-context.d.ts +0 -45
  1285. package/dist/plugin-sdk/src/cron/legacy-delivery.d.ts +0 -3
  1286. package/dist/plugin-sdk/src/cron/normalize.d.ts +0 -9
  1287. package/dist/plugin-sdk/src/cron/parse.d.ts +0 -1
  1288. package/dist/plugin-sdk/src/cron/payload-migration.d.ts +0 -3
  1289. package/dist/plugin-sdk/src/cron/run-detail-format.d.ts +0 -28
  1290. package/dist/plugin-sdk/src/cron/run-detail.d.ts +0 -95
  1291. package/dist/plugin-sdk/src/cron/run-log.d.ts +0 -65
  1292. package/dist/plugin-sdk/src/cron/schedule.d.ts +0 -2
  1293. package/dist/plugin-sdk/src/cron/service/jobs.d.ts +0 -23
  1294. package/dist/plugin-sdk/src/cron/service/locked.d.ts +0 -2
  1295. package/dist/plugin-sdk/src/cron/service/normalize.d.ts +0 -18
  1296. package/dist/plugin-sdk/src/cron/service/ops.d.ts +0 -152
  1297. package/dist/plugin-sdk/src/cron/service/run-lease.d.ts +0 -15
  1298. package/dist/plugin-sdk/src/cron/service/state.d.ts +0 -154
  1299. package/dist/plugin-sdk/src/cron/service/store.d.ts +0 -9
  1300. package/dist/plugin-sdk/src/cron/service/timeout-policy.d.ts +0 -13
  1301. package/dist/plugin-sdk/src/cron/service/timer.d.ts +0 -80
  1302. package/dist/plugin-sdk/src/cron/service.d.ts +0 -122
  1303. package/dist/plugin-sdk/src/cron/session-reaper.d.ts +0 -35
  1304. package/dist/plugin-sdk/src/cron/stagger.d.ts +0 -8
  1305. package/dist/plugin-sdk/src/cron/store.d.ts +0 -6
  1306. package/dist/plugin-sdk/src/cron/task-adaptive-routing.d.ts +0 -21
  1307. package/dist/plugin-sdk/src/cron/task-evaluator.d.ts +0 -28
  1308. package/dist/plugin-sdk/src/cron/task-model-roles.d.ts +0 -21
  1309. package/dist/plugin-sdk/src/cron/task-planner.d.ts +0 -37
  1310. package/dist/plugin-sdk/src/cron/task-run-queue.d.ts +0 -270
  1311. package/dist/plugin-sdk/src/cron/trusted-sources.d.ts +0 -28
  1312. package/dist/plugin-sdk/src/cron/types.d.ts +0 -673
  1313. package/dist/plugin-sdk/src/cron/webhook-url.d.ts +0 -1
  1314. package/dist/plugin-sdk/src/daemon/arg-split.d.ts +0 -4
  1315. package/dist/plugin-sdk/src/daemon/cmd-argv.d.ts +0 -3
  1316. package/dist/plugin-sdk/src/daemon/cmd-set.d.ts +0 -7
  1317. package/dist/plugin-sdk/src/daemon/constants.d.ts +0 -63
  1318. package/dist/plugin-sdk/src/daemon/diagnostics.d.ts +0 -1
  1319. package/dist/plugin-sdk/src/daemon/exec-file.d.ts +0 -7
  1320. package/dist/plugin-sdk/src/daemon/launchd-plist.d.ts +0 -15
  1321. package/dist/plugin-sdk/src/daemon/launchd.d.ts +0 -49
  1322. package/dist/plugin-sdk/src/daemon/node-service.d.ts +0 -2
  1323. package/dist/plugin-sdk/src/daemon/output.d.ts +0 -8
  1324. package/dist/plugin-sdk/src/daemon/paths.d.ts +0 -3
  1325. package/dist/plugin-sdk/src/daemon/runtime-binary.d.ts +0 -2
  1326. package/dist/plugin-sdk/src/daemon/runtime-parse.d.ts +0 -1
  1327. package/dist/plugin-sdk/src/daemon/schtasks-exec.d.ts +0 -5
  1328. package/dist/plugin-sdk/src/daemon/schtasks.d.ts +0 -18
  1329. package/dist/plugin-sdk/src/daemon/service-runtime.d.ts +0 -13
  1330. package/dist/plugin-sdk/src/daemon/service-types.d.ts +0 -32
  1331. package/dist/plugin-sdk/src/daemon/service.d.ts +0 -16
  1332. package/dist/plugin-sdk/src/daemon/systemd-linger.d.ts +0 -15
  1333. package/dist/plugin-sdk/src/daemon/systemd-system.d.ts +0 -28
  1334. package/dist/plugin-sdk/src/daemon/systemd-unit.d.ts +0 -7
  1335. package/dist/plugin-sdk/src/daemon/systemd.d.ts +0 -32
  1336. package/dist/plugin-sdk/src/discord/accounts.d.ts +0 -21
  1337. package/dist/plugin-sdk/src/discord/api.d.ts +0 -11
  1338. package/dist/plugin-sdk/src/discord/audit.d.ts +0 -29
  1339. package/dist/plugin-sdk/src/discord/chunk.d.ts +0 -20
  1340. package/dist/plugin-sdk/src/discord/client.d.ts +0 -21
  1341. package/dist/plugin-sdk/src/discord/components-registry.d.ts +0 -16
  1342. package/dist/plugin-sdk/src/discord/components.d.ts +0 -196
  1343. package/dist/plugin-sdk/src/discord/directory-live.d.ts +0 -4
  1344. package/dist/plugin-sdk/src/discord/draft-chunking.d.ts +0 -6
  1345. package/dist/plugin-sdk/src/discord/draft-stream.d.ts +0 -21
  1346. package/dist/plugin-sdk/src/discord/gateway-logging.d.ts +0 -8
  1347. package/dist/plugin-sdk/src/discord/guilds.d.ts +0 -6
  1348. package/dist/plugin-sdk/src/discord/monitor/agent-components.d.ts +0 -55
  1349. package/dist/plugin-sdk/src/discord/monitor/allow-list.d.ts +0 -176
  1350. package/dist/plugin-sdk/src/discord/monitor/commands.d.ts +0 -2
  1351. package/dist/plugin-sdk/src/discord/monitor/exec-approvals.d.ts +0 -55
  1352. package/dist/plugin-sdk/src/discord/monitor/format.d.ts +0 -13
  1353. package/dist/plugin-sdk/src/discord/monitor/gateway-error-guard.d.ts +0 -6
  1354. package/dist/plugin-sdk/src/discord/monitor/gateway-plugin.d.ts +0 -8
  1355. package/dist/plugin-sdk/src/discord/monitor/gateway-registry.d.ts +0 -9
  1356. package/dist/plugin-sdk/src/discord/monitor/listeners.d.ts +0 -50
  1357. package/dist/plugin-sdk/src/discord/monitor/message-handler.d.ts +0 -5
  1358. package/dist/plugin-sdk/src/discord/monitor/message-handler.preflight.d.ts +0 -14
  1359. package/dist/plugin-sdk/src/discord/monitor/message-handler.preflight.types.d.ts +0 -96
  1360. package/dist/plugin-sdk/src/discord/monitor/message-handler.process.d.ts +0 -2
  1361. package/dist/plugin-sdk/src/discord/monitor/message-utils.d.ts +0 -44
  1362. package/dist/plugin-sdk/src/discord/monitor/model-picker-preferences.d.ts +0 -18
  1363. package/dist/plugin-sdk/src/discord/monitor/model-picker.d.ts +0 -117
  1364. package/dist/plugin-sdk/src/discord/monitor/native-command.d.ts +0 -26
  1365. package/dist/plugin-sdk/src/discord/monitor/presence-cache.d.ts +0 -9
  1366. package/dist/plugin-sdk/src/discord/monitor/presence.d.ts +0 -5
  1367. package/dist/plugin-sdk/src/discord/monitor/provider.allowlist.d.ts +0 -14
  1368. package/dist/plugin-sdk/src/discord/monitor/provider.d.ts +0 -34
  1369. package/dist/plugin-sdk/src/discord/monitor/provider.lifecycle.d.ts +0 -28
  1370. package/dist/plugin-sdk/src/discord/monitor/reply-context.d.ts +0 -17
  1371. package/dist/plugin-sdk/src/discord/monitor/reply-delivery.d.ts +0 -37
  1372. package/dist/plugin-sdk/src/discord/monitor/rest-fetch.d.ts +0 -2
  1373. package/dist/plugin-sdk/src/discord/monitor/sender-identity.d.ts +0 -31
  1374. package/dist/plugin-sdk/src/discord/monitor/system-events.d.ts +0 -2
  1375. package/dist/plugin-sdk/src/discord/monitor/thread-bindings.config.d.ts +0 -11
  1376. package/dist/plugin-sdk/src/discord/monitor/thread-bindings.d.ts +0 -8
  1377. package/dist/plugin-sdk/src/discord/monitor/thread-bindings.discord-api.d.ts +0 -36
  1378. package/dist/plugin-sdk/src/discord/monitor/thread-bindings.lifecycle.d.ts +0 -46
  1379. package/dist/plugin-sdk/src/discord/monitor/thread-bindings.manager.d.ts +0 -18
  1380. package/dist/plugin-sdk/src/discord/monitor/thread-bindings.messages.d.ts +0 -1
  1381. package/dist/plugin-sdk/src/discord/monitor/thread-bindings.persona.d.ts +0 -6
  1382. package/dist/plugin-sdk/src/discord/monitor/thread-bindings.state.d.ts +0 -80
  1383. package/dist/plugin-sdk/src/discord/monitor/thread-bindings.types.d.ts +0 -77
  1384. package/dist/plugin-sdk/src/discord/monitor/threading.d.ts +0 -106
  1385. package/dist/plugin-sdk/src/discord/monitor/typing.d.ts +0 -5
  1386. package/dist/plugin-sdk/src/discord/monitor.d.ts +0 -10
  1387. package/dist/plugin-sdk/src/discord/monitor.gateway.d.ts +0 -12
  1388. package/dist/plugin-sdk/src/discord/pluralkit.d.ts +0 -26
  1389. package/dist/plugin-sdk/src/discord/probe.d.ts +0 -28
  1390. package/dist/plugin-sdk/src/discord/resolve-channels.d.ts +0 -15
  1391. package/dist/plugin-sdk/src/discord/resolve-users.d.ts +0 -14
  1392. package/dist/plugin-sdk/src/discord/send.channels.d.ts +0 -17
  1393. package/dist/plugin-sdk/src/discord/send.components.d.ts +0 -17
  1394. package/dist/plugin-sdk/src/discord/send.d.ts +0 -10
  1395. package/dist/plugin-sdk/src/discord/send.emojis-stickers.d.ts +0 -4
  1396. package/dist/plugin-sdk/src/discord/send.guild.d.ts +0 -24
  1397. package/dist/plugin-sdk/src/discord/send.messages.d.ts +0 -20
  1398. package/dist/plugin-sdk/src/discord/send.outbound.d.ts +0 -57
  1399. package/dist/plugin-sdk/src/discord/send.permissions.d.ts +0 -20
  1400. package/dist/plugin-sdk/src/discord/send.reactions.d.ts +0 -15
  1401. package/dist/plugin-sdk/src/discord/send.shared.d.ts +0 -85
  1402. package/dist/plugin-sdk/src/discord/send.types.d.ts +0 -144
  1403. package/dist/plugin-sdk/src/discord/targets.d.ts +0 -18
  1404. package/dist/plugin-sdk/src/discord/token.d.ts +0 -11
  1405. package/dist/plugin-sdk/src/discord/ui.d.ts +0 -19
  1406. package/dist/plugin-sdk/src/discord/voice/command.d.ts +0 -15
  1407. package/dist/plugin-sdk/src/discord/voice/manager.d.ts +0 -52
  1408. package/dist/plugin-sdk/src/discord/voice-message.d.ts +0 -50
  1409. package/dist/plugin-sdk/src/federation/access-token.d.ts +0 -34
  1410. package/dist/plugin-sdk/src/federation/attestation.d.ts +0 -37
  1411. package/dist/plugin-sdk/src/federation/auto-connect.d.ts +0 -103
  1412. package/dist/plugin-sdk/src/federation/marketplace-capability-adapter.d.ts +0 -31
  1413. package/dist/plugin-sdk/src/federation/marketplace-chat-command.d.ts +0 -13
  1414. package/dist/plugin-sdk/src/federation/marketplace-delivery.d.ts +0 -61
  1415. package/dist/plugin-sdk/src/federation/marketplace-direct-payment.d.ts +0 -36
  1416. package/dist/plugin-sdk/src/federation/marketplace-escrow.d.ts +0 -58
  1417. package/dist/plugin-sdk/src/federation/marketplace-service-kinds.d.ts +0 -23
  1418. package/dist/plugin-sdk/src/federation/marketplace-task-ledger.d.ts +0 -12
  1419. package/dist/plugin-sdk/src/federation/offers.d.ts +0 -258
  1420. package/dist/plugin-sdk/src/federation/runtime.d.ts +0 -14
  1421. package/dist/plugin-sdk/src/federation/settlement-evidence.d.ts +0 -27
  1422. package/dist/plugin-sdk/src/gateway/a2a-http.d.ts +0 -25
  1423. package/dist/plugin-sdk/src/gateway/a2a-settlement.d.ts +0 -36
  1424. package/dist/plugin-sdk/src/gateway/agent-event-assistant-text.d.ts +0 -2
  1425. package/dist/plugin-sdk/src/gateway/agent-prompt.d.ts +0 -6
  1426. package/dist/plugin-sdk/src/gateway/assistant-identity.d.ts +0 -13
  1427. package/dist/plugin-sdk/src/gateway/auth-rate-limit.d.ts +0 -67
  1428. package/dist/plugin-sdk/src/gateway/auth.d.ts +0 -63
  1429. package/dist/plugin-sdk/src/gateway/call.d.ts +0 -82
  1430. package/dist/plugin-sdk/src/gateway/canvas-capability.d.ts +0 -14
  1431. package/dist/plugin-sdk/src/gateway/chat-abort.d.ts +0 -70
  1432. package/dist/plugin-sdk/src/gateway/chat-sanitize.d.ts +0 -4
  1433. package/dist/plugin-sdk/src/gateway/client.d.ts +0 -66
  1434. package/dist/plugin-sdk/src/gateway/control-plane-audit.d.ts +0 -10
  1435. package/dist/plugin-sdk/src/gateway/control-ui-boot-check.d.ts +0 -22
  1436. package/dist/plugin-sdk/src/gateway/control-ui-contract.d.ts +0 -7
  1437. package/dist/plugin-sdk/src/gateway/control-ui-csp.d.ts +0 -1
  1438. package/dist/plugin-sdk/src/gateway/control-ui-login.d.ts +0 -115
  1439. package/dist/plugin-sdk/src/gateway/control-ui-shared.d.ts +0 -9
  1440. package/dist/plugin-sdk/src/gateway/control-ui.d.ts +0 -36
  1441. package/dist/plugin-sdk/src/gateway/credentials.d.ts +0 -34
  1442. package/dist/plugin-sdk/src/gateway/device-auth.d.ts +0 -17
  1443. package/dist/plugin-sdk/src/gateway/exec-approval-manager.d.ts +0 -38
  1444. package/dist/plugin-sdk/src/gateway/federation-http.d.ts +0 -7
  1445. package/dist/plugin-sdk/src/gateway/federation-marketplace.d.ts +0 -90
  1446. package/dist/plugin-sdk/src/gateway/fedify-http.d.ts +0 -5
  1447. package/dist/plugin-sdk/src/gateway/gateway-identity.d.ts +0 -5
  1448. package/dist/plugin-sdk/src/gateway/hooks-mapping.d.ts +0 -80
  1449. package/dist/plugin-sdk/src/gateway/hooks.d.ts +0 -102
  1450. package/dist/plugin-sdk/src/gateway/http-auth-helpers.d.ts +0 -11
  1451. package/dist/plugin-sdk/src/gateway/http-common.d.ts +0 -21
  1452. package/dist/plugin-sdk/src/gateway/http-endpoint-helpers.d.ts +0 -13
  1453. package/dist/plugin-sdk/src/gateway/http-utils.d.ts +0 -15
  1454. package/dist/plugin-sdk/src/gateway/internal-call-auth.d.ts +0 -3
  1455. package/dist/plugin-sdk/src/gateway/method-scopes.d.ts +0 -22
  1456. package/dist/plugin-sdk/src/gateway/mutating-admin-rpc-rate-limit.d.ts +0 -29
  1457. package/dist/plugin-sdk/src/gateway/net.d.ts +0 -83
  1458. package/dist/plugin-sdk/src/gateway/node-command-policy.d.ts +0 -14
  1459. package/dist/plugin-sdk/src/gateway/node-registry.d.ts +0 -60
  1460. package/dist/plugin-sdk/src/gateway/open-responses.schema.d.ts +0 -765
  1461. package/dist/plugin-sdk/src/gateway/openai-http.d.ts +0 -12
  1462. package/dist/plugin-sdk/src/gateway/openresponses-http.d.ts +0 -21
  1463. package/dist/plugin-sdk/src/gateway/openresponses-prompt.d.ts +0 -5
  1464. package/dist/plugin-sdk/src/gateway/probe-auth.d.ts +0 -9
  1465. package/dist/plugin-sdk/src/gateway/probe.d.ts +0 -26
  1466. package/dist/plugin-sdk/src/gateway/protocol/client-info.d.ts +0 -58
  1467. package/dist/plugin-sdk/src/gateway/protocol/index.d.ts +0 -1048
  1468. package/dist/plugin-sdk/src/gateway/protocol/schema/agent.d.ts +0 -91
  1469. package/dist/plugin-sdk/src/gateway/protocol/schema/agents-models-skills.d.ts +0 -1400
  1470. package/dist/plugin-sdk/src/gateway/protocol/schema/channels.d.ts +0 -158
  1471. package/dist/plugin-sdk/src/gateway/protocol/schema/commands.d.ts +0 -68
  1472. package/dist/plugin-sdk/src/gateway/protocol/schema/config.d.ts +0 -115
  1473. package/dist/plugin-sdk/src/gateway/protocol/schema/cron.d.ts +0 -1551
  1474. package/dist/plugin-sdk/src/gateway/protocol/schema/devices.d.ts +0 -42
  1475. package/dist/plugin-sdk/src/gateway/protocol/schema/error-codes.d.ts +0 -15
  1476. package/dist/plugin-sdk/src/gateway/protocol/schema/exec-approvals.d.ts +0 -182
  1477. package/dist/plugin-sdk/src/gateway/protocol/schema/frames.d.ts +0 -168
  1478. package/dist/plugin-sdk/src/gateway/protocol/schema/logs-chat.d.ts +0 -45
  1479. package/dist/plugin-sdk/src/gateway/protocol/schema/nodes.d.ts +0 -85
  1480. package/dist/plugin-sdk/src/gateway/protocol/schema/primitives.d.ts +0 -4
  1481. package/dist/plugin-sdk/src/gateway/protocol/schema/protocol-schemas.d.ts +0 -3
  1482. package/dist/plugin-sdk/src/gateway/protocol/schema/push.d.ts +0 -15
  1483. package/dist/plugin-sdk/src/gateway/protocol/schema/sessions.d.ts +0 -134
  1484. package/dist/plugin-sdk/src/gateway/protocol/schema/snapshot.d.ts +0 -69
  1485. package/dist/plugin-sdk/src/gateway/protocol/schema/types.d.ts +0 -245
  1486. package/dist/plugin-sdk/src/gateway/protocol/schema/wizard.d.ts +0 -86
  1487. package/dist/plugin-sdk/src/gateway/protocol/schema.d.ts +0 -18
  1488. package/dist/plugin-sdk/src/gateway/security-path.d.ts +0 -15
  1489. package/dist/plugin-sdk/src/gateway/server/readiness.d.ts +0 -6
  1490. package/dist/plugin-sdk/src/gateway/server/ws-types.d.ts +0 -12
  1491. package/dist/plugin-sdk/src/gateway/server-broadcast.d.ts +0 -17
  1492. package/dist/plugin-sdk/src/gateway/server-channels.d.ts +0 -26
  1493. package/dist/plugin-sdk/src/gateway/server-constants.d.ts +0 -10
  1494. package/dist/plugin-sdk/src/gateway/server-http.d.ts +0 -131
  1495. package/dist/plugin-sdk/src/gateway/server-methods/commands.d.ts +0 -11
  1496. package/dist/plugin-sdk/src/gateway/server-methods/mutating-admin-rpc-audit.d.ts +0 -41
  1497. package/dist/plugin-sdk/src/gateway/server-methods/nodes.helpers.d.ts +0 -20
  1498. package/dist/plugin-sdk/src/gateway/server-methods/push.d.ts +0 -2
  1499. package/dist/plugin-sdk/src/gateway/server-methods/types.d.ts +0 -106
  1500. package/dist/plugin-sdk/src/gateway/server-model-catalog.d.ts +0 -17
  1501. package/dist/plugin-sdk/src/gateway/server-shared.d.ts +0 -7
  1502. package/dist/plugin-sdk/src/gateway/server-startup-readiness.d.ts +0 -21
  1503. package/dist/plugin-sdk/src/gateway/server-startup-trace.d.ts +0 -29
  1504. package/dist/plugin-sdk/src/gateway/session-compaction-checkpoints.d.ts +0 -24
  1505. package/dist/plugin-sdk/src/gateway/session-utils.d.ts +0 -80
  1506. package/dist/plugin-sdk/src/gateway/session-utils.fs.d.ts +0 -48
  1507. package/dist/plugin-sdk/src/gateway/session-utils.types.d.ts +0 -106
  1508. package/dist/plugin-sdk/src/gateway/tools-invoke-http.d.ts +0 -10
  1509. package/dist/plugin-sdk/src/gateway/update-status.d.ts +0 -27
  1510. package/dist/plugin-sdk/src/gateway/ws-log.d.ts +0 -5
  1511. package/dist/plugin-sdk/src/gateway/ws-logging.d.ts +0 -4
  1512. package/dist/plugin-sdk/src/globals.d.ts +0 -11
  1513. package/dist/plugin-sdk/src/hooks/config.d.ts +0 -11
  1514. package/dist/plugin-sdk/src/hooks/frontmatter.d.ts +0 -5
  1515. package/dist/plugin-sdk/src/hooks/internal-hooks.d.ts +0 -155
  1516. package/dist/plugin-sdk/src/hooks/module-loader.d.ts +0 -18
  1517. package/dist/plugin-sdk/src/hooks/types.d.ts +0 -62
  1518. package/dist/plugin-sdk/src/image-generation/types.d.ts +0 -74
  1519. package/dist/plugin-sdk/src/imessage/accounts.d.ts +0 -16
  1520. package/dist/plugin-sdk/src/imessage/client.d.ts +0 -46
  1521. package/dist/plugin-sdk/src/imessage/constants.d.ts +0 -2
  1522. package/dist/plugin-sdk/src/imessage/monitor/abort-handler.d.ts +0 -9
  1523. package/dist/plugin-sdk/src/imessage/monitor/deliver.d.ts +0 -14
  1524. package/dist/plugin-sdk/src/imessage/monitor/echo-cache.d.ts +0 -9
  1525. package/dist/plugin-sdk/src/imessage/monitor/inbound-processing.d.ts +0 -96
  1526. package/dist/plugin-sdk/src/imessage/monitor/monitor-provider.d.ts +0 -7
  1527. package/dist/plugin-sdk/src/imessage/monitor/parse-notification.d.ts +0 -2
  1528. package/dist/plugin-sdk/src/imessage/monitor/runtime.d.ts +0 -4
  1529. package/dist/plugin-sdk/src/imessage/monitor/types.d.ts +0 -37
  1530. package/dist/plugin-sdk/src/imessage/monitor.d.ts +0 -2
  1531. package/dist/plugin-sdk/src/imessage/probe.d.ts +0 -17
  1532. package/dist/plugin-sdk/src/imessage/send.d.ts +0 -34
  1533. package/dist/plugin-sdk/src/imessage/target-parsing-helpers.d.ts +0 -45
  1534. package/dist/plugin-sdk/src/imessage/targets.d.ts +0 -40
  1535. package/dist/plugin-sdk/src/infra/abort-signal.d.ts +0 -1
  1536. package/dist/plugin-sdk/src/infra/agent-events.d.ts +0 -24
  1537. package/dist/plugin-sdk/src/infra/archive-path.d.ts +0 -12
  1538. package/dist/plugin-sdk/src/infra/archive.d.ts +0 -46
  1539. package/dist/plugin-sdk/src/infra/backoff.d.ts +0 -8
  1540. package/dist/plugin-sdk/src/infra/binaries.d.ts +0 -3
  1541. package/dist/plugin-sdk/src/infra/boundary-file-read.d.ts +0 -33
  1542. package/dist/plugin-sdk/src/infra/boundary-path.d.ts +0 -38
  1543. package/dist/plugin-sdk/src/infra/brew.d.ts +0 -8
  1544. package/dist/plugin-sdk/src/infra/channel-activity.d.ts +0 -18
  1545. package/dist/plugin-sdk/src/infra/channel-summary.d.ts +0 -6
  1546. package/dist/plugin-sdk/src/infra/channels-status-issues.d.ts +0 -2
  1547. package/dist/plugin-sdk/src/infra/clawhub.d.ts +0 -1
  1548. package/dist/plugin-sdk/src/infra/control-ui-assets.d.ts +0 -32
  1549. package/dist/plugin-sdk/src/infra/dedupe.d.ts +0 -12
  1550. package/dist/plugin-sdk/src/infra/detect-package-manager.d.ts +0 -2
  1551. package/dist/plugin-sdk/src/infra/device-auth-store.d.ts +0 -19
  1552. package/dist/plugin-sdk/src/infra/device-identity.d.ts +0 -13
  1553. package/dist/plugin-sdk/src/infra/device-pairing.d.ts +0 -103
  1554. package/dist/plugin-sdk/src/infra/diagnostic-events.d.ts +0 -140
  1555. package/dist/plugin-sdk/src/infra/diagnostic-flags.d.ts +0 -4
  1556. package/dist/plugin-sdk/src/infra/dotenv.d.ts +0 -13
  1557. package/dist/plugin-sdk/src/infra/env.d.ts +0 -11
  1558. package/dist/plugin-sdk/src/infra/errors.d.ts +0 -11
  1559. package/dist/plugin-sdk/src/infra/exec-approval-reply.d.ts +0 -11
  1560. package/dist/plugin-sdk/src/infra/exec-approval-surface.d.ts +0 -38
  1561. package/dist/plugin-sdk/src/infra/exec-approvals-allowlist.d.ts +0 -69
  1562. package/dist/plugin-sdk/src/infra/exec-approvals-analysis.d.ts +0 -78
  1563. package/dist/plugin-sdk/src/infra/exec-approvals.d.ts +0 -147
  1564. package/dist/plugin-sdk/src/infra/exec-command-resolution.d.ts +0 -45
  1565. package/dist/plugin-sdk/src/infra/exec-obfuscation-detect.d.ts +0 -12
  1566. package/dist/plugin-sdk/src/infra/exec-safe-bin-policy-profiles.d.ts +0 -24
  1567. package/dist/plugin-sdk/src/infra/exec-safe-bin-policy-validator.d.ts +0 -2
  1568. package/dist/plugin-sdk/src/infra/exec-safe-bin-policy.d.ts +0 -2
  1569. package/dist/plugin-sdk/src/infra/exec-safe-bin-runtime-policy.d.ts +0 -25
  1570. package/dist/plugin-sdk/src/infra/exec-safe-bin-trust.d.ts +0 -23
  1571. package/dist/plugin-sdk/src/infra/exec-safety.d.ts +0 -1
  1572. package/dist/plugin-sdk/src/infra/exec-wrapper-resolution.d.ts +0 -48
  1573. package/dist/plugin-sdk/src/infra/fased-exec-env.d.ts +0 -1
  1574. package/dist/plugin-sdk/src/infra/fased-root.d.ts +0 -10
  1575. package/dist/plugin-sdk/src/infra/fasedhub.d.ts +0 -114
  1576. package/dist/plugin-sdk/src/infra/fetch-headers.d.ts +0 -4
  1577. package/dist/plugin-sdk/src/infra/fetch.d.ts +0 -2
  1578. package/dist/plugin-sdk/src/infra/file-identity.d.ts +0 -5
  1579. package/dist/plugin-sdk/src/infra/file-lock.d.ts +0 -2
  1580. package/dist/plugin-sdk/src/infra/format-time/format-datetime.d.ts +0 -35
  1581. package/dist/plugin-sdk/src/infra/format-time/format-duration.d.ts +0 -23
  1582. package/dist/plugin-sdk/src/infra/format-time/format-relative.d.ts +0 -39
  1583. package/dist/plugin-sdk/src/infra/fs-safe.d.ts +0 -43
  1584. package/dist/plugin-sdk/src/infra/gemini-auth.d.ts +0 -16
  1585. package/dist/plugin-sdk/src/infra/git-commit.d.ts +0 -4
  1586. package/dist/plugin-sdk/src/infra/git-root.d.ts +0 -7
  1587. package/dist/plugin-sdk/src/infra/hardlink-guards.d.ts +0 -6
  1588. package/dist/plugin-sdk/src/infra/heartbeat-active-hours.d.ts +0 -5
  1589. package/dist/plugin-sdk/src/infra/heartbeat-events-filter.d.ts +0 -8
  1590. package/dist/plugin-sdk/src/infra/heartbeat-events.d.ts +0 -21
  1591. package/dist/plugin-sdk/src/infra/heartbeat-reason.d.ts +0 -5
  1592. package/dist/plugin-sdk/src/infra/heartbeat-runner.d.ts +0 -46
  1593. package/dist/plugin-sdk/src/infra/heartbeat-visibility.d.ts +0 -17
  1594. package/dist/plugin-sdk/src/infra/heartbeat-wake.d.ts +0 -32
  1595. package/dist/plugin-sdk/src/infra/home-dir.d.ts +0 -7
  1596. package/dist/plugin-sdk/src/infra/host-env-security.d.ts +0 -26
  1597. package/dist/plugin-sdk/src/infra/http-body.d.ts +0 -46
  1598. package/dist/plugin-sdk/src/infra/install-flow.d.ts +0 -24
  1599. package/dist/plugin-sdk/src/infra/install-mode-options.d.ts +0 -20
  1600. package/dist/plugin-sdk/src/infra/install-package-dir.d.ts +0 -19
  1601. package/dist/plugin-sdk/src/infra/install-safe-path.d.ts +0 -14
  1602. package/dist/plugin-sdk/src/infra/install-source-utils.d.ts +0 -32
  1603. package/dist/plugin-sdk/src/infra/json-file.d.ts +0 -2
  1604. package/dist/plugin-sdk/src/infra/json-files.d.ts +0 -5
  1605. package/dist/plugin-sdk/src/infra/jsonl-socket.d.ts +0 -6
  1606. package/dist/plugin-sdk/src/infra/machine-name.d.ts +0 -1
  1607. package/dist/plugin-sdk/src/infra/map-size.d.ts +0 -1
  1608. package/dist/plugin-sdk/src/infra/net/fetch-guard.d.ts +0 -28
  1609. package/dist/plugin-sdk/src/infra/net/hostname.d.ts +0 -1
  1610. package/dist/plugin-sdk/src/infra/net/ssrf.d.ts +0 -35
  1611. package/dist/plugin-sdk/src/infra/node-commands.d.ts +0 -4
  1612. package/dist/plugin-sdk/src/infra/node-pairing.d.ts +0 -65
  1613. package/dist/plugin-sdk/src/infra/node-shell.d.ts +0 -1
  1614. package/dist/plugin-sdk/src/infra/npm-integrity.d.ts +0 -38
  1615. package/dist/plugin-sdk/src/infra/npm-pack-install.d.ts +0 -56
  1616. package/dist/plugin-sdk/src/infra/npm-registry-spec.d.ts +0 -1
  1617. package/dist/plugin-sdk/src/infra/optional-runtime-dependency.d.ts +0 -6
  1618. package/dist/plugin-sdk/src/infra/os-summary.d.ts +0 -7
  1619. package/dist/plugin-sdk/src/infra/outbound/abort.d.ts +0 -8
  1620. package/dist/plugin-sdk/src/infra/outbound/agent-delivery.d.ts +0 -46
  1621. package/dist/plugin-sdk/src/infra/outbound/best-effort-delivery.d.ts +0 -13
  1622. package/dist/plugin-sdk/src/infra/outbound/bound-delivery-router.d.ts +0 -16
  1623. package/dist/plugin-sdk/src/infra/outbound/channel-adapters.d.ts +0 -15
  1624. package/dist/plugin-sdk/src/infra/outbound/channel-adapters.discord.d.ts +0 -2
  1625. package/dist/plugin-sdk/src/infra/outbound/channel-resolution.d.ts +0 -8
  1626. package/dist/plugin-sdk/src/infra/outbound/channel-selection.d.ts +0 -11
  1627. package/dist/plugin-sdk/src/infra/outbound/channel-target.d.ts +0 -6
  1628. package/dist/plugin-sdk/src/infra/outbound/conversation-id.d.ts +0 -4
  1629. package/dist/plugin-sdk/src/infra/outbound/deliver.d.ts +0 -80
  1630. package/dist/plugin-sdk/src/infra/outbound/delivery-queue.d.ts +0 -85
  1631. package/dist/plugin-sdk/src/infra/outbound/directory-cache.d.ts +0 -24
  1632. package/dist/plugin-sdk/src/infra/outbound/envelope.d.ts +0 -16
  1633. package/dist/plugin-sdk/src/infra/outbound/format.d.ts +0 -41
  1634. package/dist/plugin-sdk/src/infra/outbound/identity.d.ts +0 -8
  1635. package/dist/plugin-sdk/src/infra/outbound/message-action-params.d.ts +0 -54
  1636. package/dist/plugin-sdk/src/infra/outbound/message-action-runner.d.ts +0 -81
  1637. package/dist/plugin-sdk/src/infra/outbound/message-action-spec.d.ts +0 -5
  1638. package/dist/plugin-sdk/src/infra/outbound/message.d.ts +0 -87
  1639. package/dist/plugin-sdk/src/infra/outbound/outbound-policy.d.ts +0 -32
  1640. package/dist/plugin-sdk/src/infra/outbound/outbound-send-service.d.ts +0 -74
  1641. package/dist/plugin-sdk/src/infra/outbound/outbound-session.d.ts +0 -31
  1642. package/dist/plugin-sdk/src/infra/outbound/payloads.d.ts +0 -18
  1643. package/dist/plugin-sdk/src/infra/outbound/session-binding-service.d.ts +0 -89
  1644. package/dist/plugin-sdk/src/infra/outbound/session-context.d.ts +0 -12
  1645. package/dist/plugin-sdk/src/infra/outbound/target-errors.d.ts +0 -6
  1646. package/dist/plugin-sdk/src/infra/outbound/target-normalization.d.ts +0 -4
  1647. package/dist/plugin-sdk/src/infra/outbound/target-resolver.d.ts +0 -53
  1648. package/dist/plugin-sdk/src/infra/outbound/targets.d.ts +0 -87
  1649. package/dist/plugin-sdk/src/infra/outbound/tool-payload.d.ts +0 -2
  1650. package/dist/plugin-sdk/src/infra/pairing-files.d.ts +0 -23
  1651. package/dist/plugin-sdk/src/infra/pairing-pending.d.ts +0 -13
  1652. package/dist/plugin-sdk/src/infra/pairing-token.d.ts +0 -3
  1653. package/dist/plugin-sdk/src/infra/path-alias-guards.d.ts +0 -18
  1654. package/dist/plugin-sdk/src/infra/path-guards.d.ts +0 -5
  1655. package/dist/plugin-sdk/src/infra/path-prepend.d.ts +0 -6
  1656. package/dist/plugin-sdk/src/infra/path-safety.d.ts +0 -2
  1657. package/dist/plugin-sdk/src/infra/plain-object.d.ts +0 -4
  1658. package/dist/plugin-sdk/src/infra/ports-format.d.ts +0 -5
  1659. package/dist/plugin-sdk/src/infra/ports-inspect.d.ts +0 -2
  1660. package/dist/plugin-sdk/src/infra/ports-lsof.d.ts +0 -2
  1661. package/dist/plugin-sdk/src/infra/ports-probe.d.ts +0 -5
  1662. package/dist/plugin-sdk/src/infra/ports-types.d.ts +0 -18
  1663. package/dist/plugin-sdk/src/infra/ports.d.ts +0 -14
  1664. package/dist/plugin-sdk/src/infra/prototype-keys.d.ts +0 -1
  1665. package/dist/plugin-sdk/src/infra/provider-usage.auth.d.ts +0 -11
  1666. package/dist/plugin-sdk/src/infra/provider-usage.d.ts +0 -4
  1667. package/dist/plugin-sdk/src/infra/provider-usage.fetch.claude.d.ts +0 -2
  1668. package/dist/plugin-sdk/src/infra/provider-usage.fetch.codex.d.ts +0 -2
  1669. package/dist/plugin-sdk/src/infra/provider-usage.fetch.copilot.d.ts +0 -2
  1670. package/dist/plugin-sdk/src/infra/provider-usage.fetch.d.ts +0 -6
  1671. package/dist/plugin-sdk/src/infra/provider-usage.fetch.gemini.d.ts +0 -2
  1672. package/dist/plugin-sdk/src/infra/provider-usage.fetch.minimax.d.ts +0 -2
  1673. package/dist/plugin-sdk/src/infra/provider-usage.fetch.shared.d.ts +0 -12
  1674. package/dist/plugin-sdk/src/infra/provider-usage.fetch.zai.d.ts +0 -2
  1675. package/dist/plugin-sdk/src/infra/provider-usage.format.d.ts +0 -13
  1676. package/dist/plugin-sdk/src/infra/provider-usage.load.d.ts +0 -12
  1677. package/dist/plugin-sdk/src/infra/provider-usage.shared.d.ts +0 -8
  1678. package/dist/plugin-sdk/src/infra/provider-usage.types.d.ts +0 -17
  1679. package/dist/plugin-sdk/src/infra/push-apns.d.ts +0 -83
  1680. package/dist/plugin-sdk/src/infra/restart-sentinel.d.ts +0 -50
  1681. package/dist/plugin-sdk/src/infra/restart-stale-pids.d.ts +0 -13
  1682. package/dist/plugin-sdk/src/infra/restart.d.ts +0 -72
  1683. package/dist/plugin-sdk/src/infra/retry-policy.d.ts +0 -25
  1684. package/dist/plugin-sdk/src/infra/retry.d.ts +0 -21
  1685. package/dist/plugin-sdk/src/infra/runtime-guard.d.ts +0 -21
  1686. package/dist/plugin-sdk/src/infra/runtime-status.d.ts +0 -8
  1687. package/dist/plugin-sdk/src/infra/safe-open-sync.d.ts +0 -23
  1688. package/dist/plugin-sdk/src/infra/scp-host.d.ts +0 -2
  1689. package/dist/plugin-sdk/src/infra/secure-random.d.ts +0 -2
  1690. package/dist/plugin-sdk/src/infra/session-cost-usage.d.ts +0 -45
  1691. package/dist/plugin-sdk/src/infra/session-cost-usage.types.d.ts +0 -153
  1692. package/dist/plugin-sdk/src/infra/session-maintenance-warning.d.ts +0 -10
  1693. package/dist/plugin-sdk/src/infra/shell-env.d.ts +0 -34
  1694. package/dist/plugin-sdk/src/infra/skills-remote.d.ts +0 -25
  1695. package/dist/plugin-sdk/src/infra/system-events.d.ts +0 -20
  1696. package/dist/plugin-sdk/src/infra/system-message.d.ts +0 -3
  1697. package/dist/plugin-sdk/src/infra/system-presence.d.ts +0 -45
  1698. package/dist/plugin-sdk/src/infra/system-run-command.d.ts +0 -30
  1699. package/dist/plugin-sdk/src/infra/tailnet.d.ts +0 -7
  1700. package/dist/plugin-sdk/src/infra/tailscale.d.ts +0 -34
  1701. package/dist/plugin-sdk/src/infra/tls/fingerprint.d.ts +0 -1
  1702. package/dist/plugin-sdk/src/infra/tls/gateway.d.ts +0 -16
  1703. package/dist/plugin-sdk/src/infra/tmp-fased-dir.d.ts +0 -20
  1704. package/dist/plugin-sdk/src/infra/transport-ready.d.ts +0 -16
  1705. package/dist/plugin-sdk/src/infra/unhandled-rejections.d.ts +0 -15
  1706. package/dist/plugin-sdk/src/infra/update-channels.d.ts +0 -36
  1707. package/dist/plugin-sdk/src/infra/update-check.d.ts +0 -69
  1708. package/dist/plugin-sdk/src/infra/update-global.d.ts +0 -29
  1709. package/dist/plugin-sdk/src/infra/warning-filter.d.ts +0 -7
  1710. package/dist/plugin-sdk/src/infra/ws.d.ts +0 -2
  1711. package/dist/plugin-sdk/src/infra/wsl.d.ts +0 -11
  1712. package/dist/plugin-sdk/src/line/accounts.d.ts +0 -10
  1713. package/dist/plugin-sdk/src/line/actions.d.ts +0 -22
  1714. package/dist/plugin-sdk/src/line/auto-reply-delivery.d.ts +0 -38
  1715. package/dist/plugin-sdk/src/line/bot-access.d.ts +0 -17
  1716. package/dist/plugin-sdk/src/line/bot-handlers.d.ts +0 -13
  1717. package/dist/plugin-sdk/src/line/bot-message-context.d.ts +0 -118
  1718. package/dist/plugin-sdk/src/line/bot.d.ts +0 -24
  1719. package/dist/plugin-sdk/src/line/channel-access-token.d.ts +0 -4
  1720. package/dist/plugin-sdk/src/line/config-schema.d.ts +0 -64
  1721. package/dist/plugin-sdk/src/line/download.d.ts +0 -7
  1722. package/dist/plugin-sdk/src/line/flex-templates/basic-cards.d.ts +0 -46
  1723. package/dist/plugin-sdk/src/line/flex-templates/common.d.ts +0 -2
  1724. package/dist/plugin-sdk/src/line/flex-templates/media-control-cards.d.ts +0 -73
  1725. package/dist/plugin-sdk/src/line/flex-templates/message.d.ts +0 -6
  1726. package/dist/plugin-sdk/src/line/flex-templates/schedule-cards.d.ts +0 -55
  1727. package/dist/plugin-sdk/src/line/flex-templates/types.d.ts +0 -19
  1728. package/dist/plugin-sdk/src/line/flex-templates.d.ts +0 -5
  1729. package/dist/plugin-sdk/src/line/logging.d.ts +0 -2
  1730. package/dist/plugin-sdk/src/line/markdown-to-line.d.ts +0 -72
  1731. package/dist/plugin-sdk/src/line/monitor.d.ts +0 -28
  1732. package/dist/plugin-sdk/src/line/probe.d.ts +0 -2
  1733. package/dist/plugin-sdk/src/line/reply-chunks.d.ts +0 -24
  1734. package/dist/plugin-sdk/src/line/send.d.ts +0 -91
  1735. package/dist/plugin-sdk/src/line/signature.d.ts +0 -1
  1736. package/dist/plugin-sdk/src/line/template-messages.d.ts +0 -100
  1737. package/dist/plugin-sdk/src/line/types.d.ts +0 -113
  1738. package/dist/plugin-sdk/src/line/webhook-node.d.ts +0 -15
  1739. package/dist/plugin-sdk/src/line/webhook-utils.d.ts +0 -3
  1740. package/dist/plugin-sdk/src/line/webhook.d.ts +0 -19
  1741. package/dist/plugin-sdk/src/link-understanding/apply.d.ts +0 -10
  1742. package/dist/plugin-sdk/src/link-understanding/defaults.d.ts +0 -2
  1743. package/dist/plugin-sdk/src/link-understanding/detect.d.ts +0 -3
  1744. package/dist/plugin-sdk/src/link-understanding/format.d.ts +0 -4
  1745. package/dist/plugin-sdk/src/link-understanding/runner.d.ts +0 -13
  1746. package/dist/plugin-sdk/src/logger.d.ts +0 -6
  1747. package/dist/plugin-sdk/src/logging/config.d.ts +0 -4
  1748. package/dist/plugin-sdk/src/logging/console.d.ts +0 -23
  1749. package/dist/plugin-sdk/src/logging/diagnostic-session-state.d.ts +0 -30
  1750. package/dist/plugin-sdk/src/logging/diagnostic-stability.d.ts +0 -85
  1751. package/dist/plugin-sdk/src/logging/diagnostic.d.ts +0 -65
  1752. package/dist/plugin-sdk/src/logging/env-log-level.d.ts +0 -2
  1753. package/dist/plugin-sdk/src/logging/levels.d.ts +0 -5
  1754. package/dist/plugin-sdk/src/logging/logger.d.ts +0 -44
  1755. package/dist/plugin-sdk/src/logging/node-require.d.ts +0 -1
  1756. package/dist/plugin-sdk/src/logging/redact-identifier.d.ts +0 -4
  1757. package/dist/plugin-sdk/src/logging/redact.d.ts +0 -9
  1758. package/dist/plugin-sdk/src/logging/state.d.ts +0 -19
  1759. package/dist/plugin-sdk/src/logging/subsystem.d.ts +0 -18
  1760. package/dist/plugin-sdk/src/logging/timestamps.d.ts +0 -1
  1761. package/dist/plugin-sdk/src/logging.d.ts +0 -10
  1762. package/dist/plugin-sdk/src/managed/federation.d.ts +0 -16
  1763. package/dist/plugin-sdk/src/markdown/code-spans.d.ts +0 -10
  1764. package/dist/plugin-sdk/src/markdown/fences.d.ts +0 -10
  1765. package/dist/plugin-sdk/src/markdown/frontmatter.d.ts +0 -2
  1766. package/dist/plugin-sdk/src/markdown/ir.d.ts +0 -32
  1767. package/dist/plugin-sdk/src/markdown/render.d.ts +0 -18
  1768. package/dist/plugin-sdk/src/markdown/tables.d.ts +0 -2
  1769. package/dist/plugin-sdk/src/markdown/whatsapp.d.ts +0 -14
  1770. package/dist/plugin-sdk/src/media/audio-tags.d.ts +0 -10
  1771. package/dist/plugin-sdk/src/media/audio.d.ts +0 -19
  1772. package/dist/plugin-sdk/src/media/base64.d.ts +0 -6
  1773. package/dist/plugin-sdk/src/media/constants.d.ts +0 -7
  1774. package/dist/plugin-sdk/src/media/fetch.d.ts +0 -24
  1775. package/dist/plugin-sdk/src/media/image-ops.d.ts +0 -41
  1776. package/dist/plugin-sdk/src/media/inbound-path-policy.d.ts +0 -18
  1777. package/dist/plugin-sdk/src/media/input-files.d.ts +0 -95
  1778. package/dist/plugin-sdk/src/media/local-roots.d.ts +0 -3
  1779. package/dist/plugin-sdk/src/media/mime.d.ts +0 -16
  1780. package/dist/plugin-sdk/src/media/outbound-attachment.d.ts +0 -6
  1781. package/dist/plugin-sdk/src/media/parse.d.ts +0 -8
  1782. package/dist/plugin-sdk/src/media/png-encode.d.ts +0 -8
  1783. package/dist/plugin-sdk/src/media/read-response-with-limit.d.ts +0 -7
  1784. package/dist/plugin-sdk/src/media/sniff-mime-from-base64.d.ts +0 -1
  1785. package/dist/plugin-sdk/src/media/store.d.ts +0 -33
  1786. package/dist/plugin-sdk/src/media-understanding/apply.d.ts +0 -19
  1787. package/dist/plugin-sdk/src/media-understanding/attachments.d.ts +0 -49
  1788. package/dist/plugin-sdk/src/media-understanding/audio-preflight.d.ts +0 -16
  1789. package/dist/plugin-sdk/src/media-understanding/concurrency.d.ts +0 -1
  1790. package/dist/plugin-sdk/src/media-understanding/defaults.d.ts +0 -14
  1791. package/dist/plugin-sdk/src/media-understanding/errors.d.ts +0 -6
  1792. package/dist/plugin-sdk/src/media-understanding/format.d.ts +0 -7
  1793. package/dist/plugin-sdk/src/media-understanding/fs.d.ts +0 -1
  1794. package/dist/plugin-sdk/src/media-understanding/output-extract.d.ts +0 -2
  1795. package/dist/plugin-sdk/src/media-understanding/providers/anthropic/index.d.ts +0 -2
  1796. package/dist/plugin-sdk/src/media-understanding/providers/deepgram/audio.d.ts +0 -4
  1797. package/dist/plugin-sdk/src/media-understanding/providers/deepgram/index.d.ts +0 -2
  1798. package/dist/plugin-sdk/src/media-understanding/providers/google/audio.d.ts +0 -3
  1799. package/dist/plugin-sdk/src/media-understanding/providers/google/index.d.ts +0 -2
  1800. package/dist/plugin-sdk/src/media-understanding/providers/google/inline-data.d.ts +0 -20
  1801. package/dist/plugin-sdk/src/media-understanding/providers/google/video.d.ts +0 -3
  1802. package/dist/plugin-sdk/src/media-understanding/providers/groq/index.d.ts +0 -2
  1803. package/dist/plugin-sdk/src/media-understanding/providers/image.d.ts +0 -2
  1804. package/dist/plugin-sdk/src/media-understanding/providers/index.d.ts +0 -4
  1805. package/dist/plugin-sdk/src/media-understanding/providers/minimax/index.d.ts +0 -2
  1806. package/dist/plugin-sdk/src/media-understanding/providers/mistral/index.d.ts +0 -2
  1807. package/dist/plugin-sdk/src/media-understanding/providers/moonshot/index.d.ts +0 -2
  1808. package/dist/plugin-sdk/src/media-understanding/providers/moonshot/video.d.ts +0 -3
  1809. package/dist/plugin-sdk/src/media-understanding/providers/openai/audio.d.ts +0 -3
  1810. package/dist/plugin-sdk/src/media-understanding/providers/openai/index.d.ts +0 -3
  1811. package/dist/plugin-sdk/src/media-understanding/providers/shared.d.ts +0 -20
  1812. package/dist/plugin-sdk/src/media-understanding/providers/zai/index.d.ts +0 -2
  1813. package/dist/plugin-sdk/src/media-understanding/resolve.d.ts +0 -44
  1814. package/dist/plugin-sdk/src/media-understanding/runner.d.ts +0 -39
  1815. package/dist/plugin-sdk/src/media-understanding/runner.entries.d.ts +0 -33
  1816. package/dist/plugin-sdk/src/media-understanding/scope.d.ts +0 -9
  1817. package/dist/plugin-sdk/src/media-understanding/types.d.ts +0 -93
  1818. package/dist/plugin-sdk/src/media-understanding/video.d.ts +0 -2
  1819. package/dist/plugin-sdk/src/memory/backend-config.d.ts +0 -55
  1820. package/dist/plugin-sdk/src/memory/batch-error-utils.d.ts +0 -15
  1821. package/dist/plugin-sdk/src/memory/batch-gemini.d.ts +0 -51
  1822. package/dist/plugin-sdk/src/memory/batch-http.d.ts +0 -8
  1823. package/dist/plugin-sdk/src/memory/batch-openai.d.ts +0 -20
  1824. package/dist/plugin-sdk/src/memory/batch-output.d.ts +0 -23
  1825. package/dist/plugin-sdk/src/memory/batch-provider-common.d.ts +0 -9
  1826. package/dist/plugin-sdk/src/memory/batch-runner.d.ts +0 -38
  1827. package/dist/plugin-sdk/src/memory/batch-upload.d.ts +0 -6
  1828. package/dist/plugin-sdk/src/memory/batch-utils.d.ts +0 -11
  1829. package/dist/plugin-sdk/src/memory/batch-voyage.d.ts +0 -21
  1830. package/dist/plugin-sdk/src/memory/embedding-chunk-limits.d.ts +0 -3
  1831. package/dist/plugin-sdk/src/memory/embedding-input-limits.d.ts +0 -2
  1832. package/dist/plugin-sdk/src/memory/embedding-model-limits.d.ts +0 -2
  1833. package/dist/plugin-sdk/src/memory/embeddings-debug.d.ts +0 -1
  1834. package/dist/plugin-sdk/src/memory/embeddings-gemini.d.ts +0 -16
  1835. package/dist/plugin-sdk/src/memory/embeddings-mistral.d.ts +0 -15
  1836. package/dist/plugin-sdk/src/memory/embeddings-openai.d.ts +0 -15
  1837. package/dist/plugin-sdk/src/memory/embeddings-remote-client.d.ts +0 -12
  1838. package/dist/plugin-sdk/src/memory/embeddings-remote-fetch.d.ts +0 -8
  1839. package/dist/plugin-sdk/src/memory/embeddings-remote-provider.d.ts +0 -21
  1840. package/dist/plugin-sdk/src/memory/embeddings-voyage.d.ts +0 -15
  1841. package/dist/plugin-sdk/src/memory/embeddings.d.ts +0 -48
  1842. package/dist/plugin-sdk/src/memory/filesystem-manager.d.ts +0 -38
  1843. package/dist/plugin-sdk/src/memory/fs-utils.d.ts +0 -11
  1844. package/dist/plugin-sdk/src/memory/hybrid.d.ts +0 -45
  1845. package/dist/plugin-sdk/src/memory/index.d.ts +0 -4
  1846. package/dist/plugin-sdk/src/memory/internal.d.ts +0 -38
  1847. package/dist/plugin-sdk/src/memory/inventory.d.ts +0 -150
  1848. package/dist/plugin-sdk/src/memory/manager-embedding-ops.d.ts +0 -42
  1849. package/dist/plugin-sdk/src/memory/manager-search.d.ts +0 -60
  1850. package/dist/plugin-sdk/src/memory/manager-sync-ops.d.ts +0 -137
  1851. package/dist/plugin-sdk/src/memory/manager.d.ts +0 -111
  1852. package/dist/plugin-sdk/src/memory/memory-schema.d.ts +0 -10
  1853. package/dist/plugin-sdk/src/memory/mmr.d.ts +0 -62
  1854. package/dist/plugin-sdk/src/memory/node-llama.d.ts +0 -8
  1855. package/dist/plugin-sdk/src/memory/post-json.d.ts +0 -10
  1856. package/dist/plugin-sdk/src/memory/qmd-manager.d.ts +0 -134
  1857. package/dist/plugin-sdk/src/memory/qmd-query-parser.d.ts +0 -9
  1858. package/dist/plugin-sdk/src/memory/qmd-scope.d.ts +0 -5
  1859. package/dist/plugin-sdk/src/memory/query-expansion.d.ts +0 -40
  1860. package/dist/plugin-sdk/src/memory/remote-http.d.ts +0 -9
  1861. package/dist/plugin-sdk/src/memory/repair-audit-plan.d.ts +0 -68
  1862. package/dist/plugin-sdk/src/memory/repair-cli-preview-contract.d.ts +0 -22
  1863. package/dist/plugin-sdk/src/memory/repair-contracts.d.ts +0 -80
  1864. package/dist/plugin-sdk/src/memory/repair-dashboard-preview-contract.d.ts +0 -65
  1865. package/dist/plugin-sdk/src/memory/repair-execution-policy.d.ts +0 -36
  1866. package/dist/plugin-sdk/src/memory/repair-execution-request-contract.d.ts +0 -43
  1867. package/dist/plugin-sdk/src/memory/repair-executor-fs-safety-contract.d.ts +0 -33
  1868. package/dist/plugin-sdk/src/memory/repair-executor-gate.d.ts +0 -27
  1869. package/dist/plugin-sdk/src/memory/repair-executor-lock-contract.d.ts +0 -40
  1870. package/dist/plugin-sdk/src/memory/repair-executor-result-contract.d.ts +0 -72
  1871. package/dist/plugin-sdk/src/memory/repair-executor.d.ts +0 -60
  1872. package/dist/plugin-sdk/src/memory/repair-preflight-cli-preview-contract.d.ts +0 -15
  1873. package/dist/plugin-sdk/src/memory/repair-preflight-dashboard-preview-contract.d.ts +0 -50
  1874. package/dist/plugin-sdk/src/memory/repair-preflight-pipeline-contract.d.ts +0 -35
  1875. package/dist/plugin-sdk/src/memory/search-manager.d.ts +0 -11
  1876. package/dist/plugin-sdk/src/memory/session-files.d.ts +0 -14
  1877. package/dist/plugin-sdk/src/memory/sqlite-vec.d.ts +0 -9
  1878. package/dist/plugin-sdk/src/memory/sqlite.d.ts +0 -1
  1879. package/dist/plugin-sdk/src/memory/status-format.d.ts +0 -28
  1880. package/dist/plugin-sdk/src/memory/temporal-decay.d.ts +0 -25
  1881. package/dist/plugin-sdk/src/memory/types.d.ts +0 -94
  1882. package/dist/plugin-sdk/src/mining/chat-command.d.ts +0 -19
  1883. package/dist/plugin-sdk/src/mining/mainnet-sync.d.ts +0 -32
  1884. package/dist/plugin-sdk/src/pairing/pairing-challenge.d.ts +0 -32
  1885. package/dist/plugin-sdk/src/pairing/pairing-labels.d.ts +0 -2
  1886. package/dist/plugin-sdk/src/pairing/pairing-messages.d.ts +0 -6
  1887. package/dist/plugin-sdk/src/pairing/pairing-store.d.ts +0 -50
  1888. package/dist/plugin-sdk/src/plugin-sdk/account-id.d.ts +0 -1
  1889. package/dist/plugin-sdk/src/plugin-sdk/agent-media-payload.d.ts +0 -12
  1890. package/dist/plugin-sdk/src/plugin-sdk/allow-from.d.ts +0 -32
  1891. package/dist/plugin-sdk/src/plugin-sdk/channel-core.d.ts +0 -18
  1892. package/dist/plugin-sdk/src/plugin-sdk/command-auth.d.ts +0 -27
  1893. package/dist/plugin-sdk/src/plugin-sdk/config-paths.d.ts +0 -6
  1894. package/dist/plugin-sdk/src/plugin-sdk/device-pair.d.ts +0 -5
  1895. package/dist/plugin-sdk/src/plugin-sdk/discord.d.ts +0 -10
  1896. package/dist/plugin-sdk/src/plugin-sdk/fetch-auth.d.ts +0 -13
  1897. package/dist/plugin-sdk/src/plugin-sdk/file-lock.d.ts +0 -16
  1898. package/dist/plugin-sdk/src/plugin-sdk/group-access.d.ts +0 -16
  1899. package/dist/plugin-sdk/src/plugin-sdk/image-generation.d.ts +0 -2
  1900. package/dist/plugin-sdk/src/plugin-sdk/index.d.ts +0 -163
  1901. package/dist/plugin-sdk/src/plugin-sdk/json-store.d.ts +0 -5
  1902. package/dist/plugin-sdk/src/plugin-sdk/onboarding.d.ts +0 -11
  1903. package/dist/plugin-sdk/src/plugin-sdk/pairing-access.d.ts +0 -18
  1904. package/dist/plugin-sdk/src/plugin-sdk/persistent-dedupe.d.ts +0 -20
  1905. package/dist/plugin-sdk/src/plugin-sdk/provider-auth-result.d.ts +0 -14
  1906. package/dist/plugin-sdk/src/plugin-sdk/realtime-transcription.d.ts +0 -3
  1907. package/dist/plugin-sdk/src/plugin-sdk/realtime-voice.d.ts +0 -3
  1908. package/dist/plugin-sdk/src/plugin-sdk/reply-payload.d.ts +0 -22
  1909. package/dist/plugin-sdk/src/plugin-sdk/run-command.d.ts +0 -12
  1910. package/dist/plugin-sdk/src/plugin-sdk/runtime.d.ts +0 -10
  1911. package/dist/plugin-sdk/src/plugin-sdk/sat-runtime.d.ts +0 -32
  1912. package/dist/plugin-sdk/src/plugin-sdk/slack-message-actions.d.ts +0 -11
  1913. package/dist/plugin-sdk/src/plugin-sdk/slack.d.ts +0 -9
  1914. package/dist/plugin-sdk/src/plugin-sdk/ssrf-policy.d.ts +0 -12
  1915. package/dist/plugin-sdk/src/plugin-sdk/status-helpers.d.ts +0 -88
  1916. package/dist/plugin-sdk/src/plugin-sdk/telegram.d.ts +0 -9
  1917. package/dist/plugin-sdk/src/plugin-sdk/temp-path.d.ts +0 -12
  1918. package/dist/plugin-sdk/src/plugin-sdk/text-chunking.d.ts +0 -1
  1919. package/dist/plugin-sdk/src/plugin-sdk/tool-send.d.ts +0 -4
  1920. package/dist/plugin-sdk/src/plugin-sdk/video-generation.d.ts +0 -4
  1921. package/dist/plugin-sdk/src/plugin-sdk/webhook-path.d.ts +0 -6
  1922. package/dist/plugin-sdk/src/plugin-sdk/webhook-targets.d.ts +0 -23
  1923. package/dist/plugin-sdk/src/plugin-sdk/whatsapp.d.ts +0 -11
  1924. package/dist/plugin-sdk/src/plugins/bundled-dir.d.ts +0 -7
  1925. package/dist/plugin-sdk/src/plugins/capability-provider-runtime.d.ts +0 -9
  1926. package/dist/plugin-sdk/src/plugins/commands.d.ts +0 -85
  1927. package/dist/plugin-sdk/src/plugins/config-schema.d.ts +0 -2
  1928. package/dist/plugin-sdk/src/plugins/config-state.d.ts +0 -86
  1929. package/dist/plugin-sdk/src/plugins/discovery.d.ts +0 -25
  1930. package/dist/plugin-sdk/src/plugins/hook-runner-global.d.ts +0 -37
  1931. package/dist/plugin-sdk/src/plugins/hooks.d.ts +0 -55
  1932. package/dist/plugin-sdk/src/plugins/http-path.d.ts +0 -1
  1933. package/dist/plugin-sdk/src/plugins/http-registry.d.ts +0 -13
  1934. package/dist/plugin-sdk/src/plugins/install.d.ts +0 -93
  1935. package/dist/plugin-sdk/src/plugins/loader.d.ts +0 -35
  1936. package/dist/plugin-sdk/src/plugins/logger.d.ts +0 -9
  1937. package/dist/plugin-sdk/src/plugins/manifest-registry.d.ts +0 -53
  1938. package/dist/plugin-sdk/src/plugins/manifest.d.ts +0 -136
  1939. package/dist/plugin-sdk/src/plugins/memory-embedding-providers.d.ts +0 -15
  1940. package/dist/plugin-sdk/src/plugins/min-host-version.d.ts +0 -28
  1941. package/dist/plugin-sdk/src/plugins/package-extensions.d.ts +0 -23
  1942. package/dist/plugin-sdk/src/plugins/path-safety.d.ts +0 -5
  1943. package/dist/plugin-sdk/src/plugins/provider-discovery.d.ts +0 -13
  1944. package/dist/plugin-sdk/src/plugins/provider-runtime.runtime.d.ts +0 -8
  1945. package/dist/plugin-sdk/src/plugins/providers.d.ts +0 -28
  1946. package/dist/plugin-sdk/src/plugins/registry.d.ts +0 -171
  1947. package/dist/plugin-sdk/src/plugins/runtime/admin-rpc-helper.d.ts +0 -71
  1948. package/dist/plugin-sdk/src/plugins/runtime/index.d.ts +0 -4
  1949. package/dist/plugin-sdk/src/plugins/runtime/native-deps.d.ts +0 -8
  1950. package/dist/plugin-sdk/src/plugins/runtime/scoped.d.ts +0 -6
  1951. package/dist/plugin-sdk/src/plugins/runtime/session-read-helper.d.ts +0 -115
  1952. package/dist/plugin-sdk/src/plugins/runtime/types.d.ts +0 -370
  1953. package/dist/plugin-sdk/src/plugins/runtime.d.ts +0 -6
  1954. package/dist/plugin-sdk/src/plugins/schema-validator.d.ts +0 -10
  1955. package/dist/plugin-sdk/src/plugins/slots.d.ts +0 -24
  1956. package/dist/plugin-sdk/src/plugins/tools.d.ts +0 -14
  1957. package/dist/plugin-sdk/src/plugins/types.d.ts +0 -684
  1958. package/dist/plugin-sdk/src/plugins/uninstall.d.ts +0 -45
  1959. package/dist/plugin-sdk/src/polls.d.ts +0 -31
  1960. package/dist/plugin-sdk/src/process/command-queue.d.ts +0 -63
  1961. package/dist/plugin-sdk/src/process/exec.d.ts +0 -31
  1962. package/dist/plugin-sdk/src/process/kill-tree.d.ts +0 -12
  1963. package/dist/plugin-sdk/src/process/lanes.d.ts +0 -6
  1964. package/dist/plugin-sdk/src/process/spawn-utils.d.ts +0 -26
  1965. package/dist/plugin-sdk/src/process/supervisor/adapters/child.d.ts +0 -10
  1966. package/dist/plugin-sdk/src/process/supervisor/adapters/env.d.ts +0 -1
  1967. package/dist/plugin-sdk/src/process/supervisor/adapters/pty.d.ts +0 -11
  1968. package/dist/plugin-sdk/src/process/supervisor/index.d.ts +0 -4
  1969. package/dist/plugin-sdk/src/process/supervisor/registry.d.ts +0 -21
  1970. package/dist/plugin-sdk/src/process/supervisor/supervisor.d.ts +0 -2
  1971. package/dist/plugin-sdk/src/process/supervisor/types.d.ts +0 -92
  1972. package/dist/plugin-sdk/src/project.d.ts +0 -3
  1973. package/dist/plugin-sdk/src/providers/cloudflare-ai-gateway-shared.d.ts +0 -84
  1974. package/dist/plugin-sdk/src/providers/github-copilot-models.d.ts +0 -5
  1975. package/dist/plugin-sdk/src/providers/github-copilot-token.d.ts +0 -22
  1976. package/dist/plugin-sdk/src/providers/health.d.ts +0 -15
  1977. package/dist/plugin-sdk/src/providers/huggingface-models.d.ts +0 -47
  1978. package/dist/plugin-sdk/src/providers/litellm-models.d.ts +0 -30
  1979. package/dist/plugin-sdk/src/providers/opencode-zen-shared.d.ts +0 -7
  1980. package/dist/plugin-sdk/src/providers/refreshed-model-capabilities.d.ts +0 -14
  1981. package/dist/plugin-sdk/src/providers/registry.d.ts +0 -204
  1982. package/dist/plugin-sdk/src/providers/synthetic-models.d.ts +0 -31
  1983. package/dist/plugin-sdk/src/providers/together-models.d.ts +0 -38
  1984. package/dist/plugin-sdk/src/providers/venice-models.d.ts +0 -175
  1985. package/dist/plugin-sdk/src/providers/vercel-ai-gateway-models.d.ts +0 -113
  1986. package/dist/plugin-sdk/src/providers/xiaomi-models.d.ts +0 -21
  1987. package/dist/plugin-sdk/src/realtime-transcription/provider-registry.d.ts +0 -7
  1988. package/dist/plugin-sdk/src/realtime-transcription/provider-types.d.ts +0 -26
  1989. package/dist/plugin-sdk/src/realtime-voice/provider-registry.d.ts +0 -7
  1990. package/dist/plugin-sdk/src/realtime-voice/provider-types.d.ts +0 -55
  1991. package/dist/plugin-sdk/src/routing/account-id.d.ts +0 -3
  1992. package/dist/plugin-sdk/src/routing/account-lookup.d.ts +0 -1
  1993. package/dist/plugin-sdk/src/routing/bindings.d.ts +0 -11
  1994. package/dist/plugin-sdk/src/routing/resolve-route.d.ts +0 -42
  1995. package/dist/plugin-sdk/src/routing/session-key.d.ts +0 -48
  1996. package/dist/plugin-sdk/src/runtime.d.ts +0 -7
  1997. package/dist/plugin-sdk/src/secrets/json-pointer.d.ts +0 -6
  1998. package/dist/plugin-sdk/src/secrets/ref-contract.d.ts +0 -19
  1999. package/dist/plugin-sdk/src/secrets/resolve.d.ts +0 -15
  2000. package/dist/plugin-sdk/src/secrets/runtime-web-tools.types.d.ts +0 -26
  2001. package/dist/plugin-sdk/src/secrets/shared.d.ts +0 -7
  2002. package/dist/plugin-sdk/src/security/audit-channel.d.ts +0 -7
  2003. package/dist/plugin-sdk/src/security/audit-extra.async.d.ts +0 -47
  2004. package/dist/plugin-sdk/src/security/audit-extra.d.ts +0 -10
  2005. package/dist/plugin-sdk/src/security/audit-extra.sync.d.ts +0 -25
  2006. package/dist/plugin-sdk/src/security/audit-fs.d.ts +0 -44
  2007. package/dist/plugin-sdk/src/security/audit-tool-policy.d.ts +0 -1
  2008. package/dist/plugin-sdk/src/security/audit.d.ts +0 -57
  2009. package/dist/plugin-sdk/src/security/channel-metadata.d.ts +0 -6
  2010. package/dist/plugin-sdk/src/security/dangerous-config-flags.d.ts +0 -2
  2011. package/dist/plugin-sdk/src/security/dangerous-tools.d.ts +0 -12
  2012. package/dist/plugin-sdk/src/security/dm-policy-shared.d.ts +0 -93
  2013. package/dist/plugin-sdk/src/security/external-content.d.ts +0 -58
  2014. package/dist/plugin-sdk/src/security/mutable-allowlist-detectors.d.ts +0 -6
  2015. package/dist/plugin-sdk/src/security/safe-regex.d.ts +0 -2
  2016. package/dist/plugin-sdk/src/security/scan-paths.d.ts +0 -5
  2017. package/dist/plugin-sdk/src/security/secret-equal.d.ts +0 -1
  2018. package/dist/plugin-sdk/src/security/skill-scanner.d.ts +0 -25
  2019. package/dist/plugin-sdk/src/security/windows-acl.d.ts +0 -37
  2020. package/dist/plugin-sdk/src/sessions/input-provenance.d.ts +0 -16
  2021. package/dist/plugin-sdk/src/sessions/level-overrides.d.ts +0 -10
  2022. package/dist/plugin-sdk/src/sessions/model-overrides.d.ts +0 -16
  2023. package/dist/plugin-sdk/src/sessions/send-policy.d.ts +0 -11
  2024. package/dist/plugin-sdk/src/sessions/session-key-utils.d.ts +0 -20
  2025. package/dist/plugin-sdk/src/sessions/session-label.d.ts +0 -9
  2026. package/dist/plugin-sdk/src/sessions/transcript-events.d.ts +0 -9
  2027. package/dist/plugin-sdk/src/shared/avatar-policy.d.ts +0 -16
  2028. package/dist/plugin-sdk/src/shared/chat-content.d.ts +0 -5
  2029. package/dist/plugin-sdk/src/shared/chat-envelope.d.ts +0 -2
  2030. package/dist/plugin-sdk/src/shared/config-eval.d.ts +0 -27
  2031. package/dist/plugin-sdk/src/shared/device-auth.d.ts +0 -13
  2032. package/dist/plugin-sdk/src/shared/entry-metadata.d.ts +0 -15
  2033. package/dist/plugin-sdk/src/shared/entry-status.d.ts +0 -47
  2034. package/dist/plugin-sdk/src/shared/frontmatter.d.ts +0 -24
  2035. package/dist/plugin-sdk/src/shared/gateway-bind-url.d.ts +0 -14
  2036. package/dist/plugin-sdk/src/shared/gateway-method-policy.d.ts +0 -8
  2037. package/dist/plugin-sdk/src/shared/model-param-b.d.ts +0 -1
  2038. package/dist/plugin-sdk/src/shared/model-thinking.d.ts +0 -31
  2039. package/dist/plugin-sdk/src/shared/net/ip.d.ts +0 -20
  2040. package/dist/plugin-sdk/src/shared/net/redact-sensitive-url.d.ts +0 -2
  2041. package/dist/plugin-sdk/src/shared/node-list-parse.d.ts +0 -3
  2042. package/dist/plugin-sdk/src/shared/node-list-types.d.ts +0 -48
  2043. package/dist/plugin-sdk/src/shared/node-match.d.ts +0 -9
  2044. package/dist/plugin-sdk/src/shared/operator-scope-compat.d.ts +0 -5
  2045. package/dist/plugin-sdk/src/shared/pid-alive.d.ts +0 -1
  2046. package/dist/plugin-sdk/src/shared/process-scoped-map.d.ts +0 -1
  2047. package/dist/plugin-sdk/src/shared/requirements.d.ts +0 -80
  2048. package/dist/plugin-sdk/src/shared/string-normalization.d.ts +0 -4
  2049. package/dist/plugin-sdk/src/shared/subagents-format.d.ts +0 -15
  2050. package/dist/plugin-sdk/src/shared/tailscale-status.d.ts +0 -8
  2051. package/dist/plugin-sdk/src/shared/text/code-regions.d.ts +0 -6
  2052. package/dist/plugin-sdk/src/shared/text/reasoning-tags.d.ts +0 -6
  2053. package/dist/plugin-sdk/src/shared/text-chunking.d.ts +0 -1
  2054. package/dist/plugin-sdk/src/signal/accounts.d.ts +0 -17
  2055. package/dist/plugin-sdk/src/signal/client.d.ts +0 -32
  2056. package/dist/plugin-sdk/src/signal/daemon.d.ts +0 -26
  2057. package/dist/plugin-sdk/src/signal/format.d.ts +0 -17
  2058. package/dist/plugin-sdk/src/signal/identity.d.ts +0 -24
  2059. package/dist/plugin-sdk/src/signal/index.d.ts +0 -5
  2060. package/dist/plugin-sdk/src/signal/monitor/access-policy.d.ts +0 -40
  2061. package/dist/plugin-sdk/src/signal/monitor/event-handler.d.ts +0 -5
  2062. package/dist/plugin-sdk/src/signal/monitor/event-handler.types.d.ts +0 -125
  2063. package/dist/plugin-sdk/src/signal/monitor/mentions.d.ts +0 -2
  2064. package/dist/plugin-sdk/src/signal/monitor.d.ts +0 -25
  2065. package/dist/plugin-sdk/src/signal/probe.d.ts +0 -7
  2066. package/dist/plugin-sdk/src/signal/reaction-level.d.ts +0 -17
  2067. package/dist/plugin-sdk/src/signal/rpc-context.d.ts +0 -9
  2068. package/dist/plugin-sdk/src/signal/send-reactions.d.ts +0 -32
  2069. package/dist/plugin-sdk/src/signal/send.d.ts +0 -25
  2070. package/dist/plugin-sdk/src/signal/sse-reconnect.d.ts +0 -13
  2071. package/dist/plugin-sdk/src/slack/accounts.d.ts +0 -32
  2072. package/dist/plugin-sdk/src/slack/actions.d.ts +0 -56
  2073. package/dist/plugin-sdk/src/slack/blocks-fallback.d.ts +0 -2
  2074. package/dist/plugin-sdk/src/slack/blocks-input.d.ts +0 -3
  2075. package/dist/plugin-sdk/src/slack/channel-migration.d.ts +0 -20
  2076. package/dist/plugin-sdk/src/slack/client.d.ts +0 -4
  2077. package/dist/plugin-sdk/src/slack/directory-live.d.ts +0 -4
  2078. package/dist/plugin-sdk/src/slack/draft-stream.d.ts +0 -25
  2079. package/dist/plugin-sdk/src/slack/format.d.ts +0 -7
  2080. package/dist/plugin-sdk/src/slack/http/index.d.ts +0 -1
  2081. package/dist/plugin-sdk/src/slack/http/registry.d.ts +0 -12
  2082. package/dist/plugin-sdk/src/slack/index.d.ts +0 -6
  2083. package/dist/plugin-sdk/src/slack/message-actions.d.ts +0 -4
  2084. package/dist/plugin-sdk/src/slack/modal-metadata.d.ts +0 -8
  2085. package/dist/plugin-sdk/src/slack/monitor/allow-list.d.ts +0 -23
  2086. package/dist/plugin-sdk/src/slack/monitor/auth.d.ts +0 -26
  2087. package/dist/plugin-sdk/src/slack/monitor/channel-config.d.ts +0 -43
  2088. package/dist/plugin-sdk/src/slack/monitor/commands.d.ts +0 -9
  2089. package/dist/plugin-sdk/src/slack/monitor/context.d.ts +0 -104
  2090. package/dist/plugin-sdk/src/slack/monitor/dm-auth.d.ts +0 -17
  2091. package/dist/plugin-sdk/src/slack/monitor/events/channels.d.ts +0 -4
  2092. package/dist/plugin-sdk/src/slack/monitor/events/interactions.d.ts +0 -4
  2093. package/dist/plugin-sdk/src/slack/monitor/events/members.d.ts +0 -4
  2094. package/dist/plugin-sdk/src/slack/monitor/events/messages.d.ts +0 -6
  2095. package/dist/plugin-sdk/src/slack/monitor/events/pins.d.ts +0 -4
  2096. package/dist/plugin-sdk/src/slack/monitor/events/reactions.d.ts +0 -4
  2097. package/dist/plugin-sdk/src/slack/monitor/events/system-event-context.d.ts +0 -12
  2098. package/dist/plugin-sdk/src/slack/monitor/events.d.ts +0 -8
  2099. package/dist/plugin-sdk/src/slack/monitor/external-arg-menu-store.d.ts +0 -18
  2100. package/dist/plugin-sdk/src/slack/monitor/media.d.ts +0 -66
  2101. package/dist/plugin-sdk/src/slack/monitor/message-handler/dispatch.d.ts +0 -12
  2102. package/dist/plugin-sdk/src/slack/monitor/message-handler/prepare.d.ts +0 -13
  2103. package/dist/plugin-sdk/src/slack/monitor/message-handler/types.d.ts +0 -22
  2104. package/dist/plugin-sdk/src/slack/monitor/message-handler.d.ts +0 -11
  2105. package/dist/plugin-sdk/src/slack/monitor/mrkdwn.d.ts +0 -1
  2106. package/dist/plugin-sdk/src/slack/monitor/policy.d.ts +0 -5
  2107. package/dist/plugin-sdk/src/slack/monitor/provider.d.ts +0 -7
  2108. package/dist/plugin-sdk/src/slack/monitor/replies.d.ts +0 -54
  2109. package/dist/plugin-sdk/src/slack/monitor/room-context.d.ts +0 -14
  2110. package/dist/plugin-sdk/src/slack/monitor/slash.d.ts +0 -6
  2111. package/dist/plugin-sdk/src/slack/monitor/thread-resolution.d.ts +0 -12
  2112. package/dist/plugin-sdk/src/slack/monitor/types.d.ts +0 -109
  2113. package/dist/plugin-sdk/src/slack/monitor.d.ts +0 -5
  2114. package/dist/plugin-sdk/src/slack/probe.d.ts +0 -14
  2115. package/dist/plugin-sdk/src/slack/resolve-channels.d.ts +0 -19
  2116. package/dist/plugin-sdk/src/slack/resolve-users.d.ts +0 -26
  2117. package/dist/plugin-sdk/src/slack/send.d.ts +0 -22
  2118. package/dist/plugin-sdk/src/slack/stream-mode.d.ts +0 -23
  2119. package/dist/plugin-sdk/src/slack/streaming.d.ts +0 -72
  2120. package/dist/plugin-sdk/src/slack/targets.d.ts +0 -7
  2121. package/dist/plugin-sdk/src/slack/threading-tool-context.d.ts +0 -10
  2122. package/dist/plugin-sdk/src/slack/threading.d.ts +0 -29
  2123. package/dist/plugin-sdk/src/slack/token.d.ts +0 -3
  2124. package/dist/plugin-sdk/src/slack/types.d.ts +0 -58
  2125. package/dist/plugin-sdk/src/tasks/channel-task-ledger.d.ts +0 -9
  2126. package/dist/plugin-sdk/src/tasks/task-executor.d.ts +0 -86
  2127. package/dist/plugin-sdk/src/tasks/task-owner-access.d.ts +0 -12
  2128. package/dist/plugin-sdk/src/tasks/task-registry.d.ts +0 -35
  2129. package/dist/plugin-sdk/src/tasks/task-registry.types.d.ts +0 -114
  2130. package/dist/plugin-sdk/src/tasks/task-status.d.ts +0 -11
  2131. package/dist/plugin-sdk/src/telegram/accounts.d.ts +0 -21
  2132. package/dist/plugin-sdk/src/telegram/allowed-updates.d.ts +0 -4
  2133. package/dist/plugin-sdk/src/telegram/api-logging.d.ts +0 -11
  2134. package/dist/plugin-sdk/src/telegram/audit.d.ts +0 -29
  2135. package/dist/plugin-sdk/src/telegram/bot/delivery.d.ts +0 -35
  2136. package/dist/plugin-sdk/src/telegram/bot/helpers.d.ts +0 -127
  2137. package/dist/plugin-sdk/src/telegram/bot/types.d.ts +0 -28
  2138. package/dist/plugin-sdk/src/telegram/bot-access.d.ts +0 -26
  2139. package/dist/plugin-sdk/src/telegram/bot-handlers.d.ts +0 -2
  2140. package/dist/plugin-sdk/src/telegram/bot-message-context.d.ts +0 -149
  2141. package/dist/plugin-sdk/src/telegram/bot-message-dispatch.d.ts +0 -29
  2142. package/dist/plugin-sdk/src/telegram/bot-message.d.ts +0 -20
  2143. package/dist/plugin-sdk/src/telegram/bot-native-command-menu.d.ts +0 -33
  2144. package/dist/plugin-sdk/src/telegram/bot-native-commands.d.ts +0 -58
  2145. package/dist/plugin-sdk/src/telegram/bot-updates.d.ts +0 -31
  2146. package/dist/plugin-sdk/src/telegram/bot.d.ts +0 -62
  2147. package/dist/plugin-sdk/src/telegram/button-types.d.ts +0 -7
  2148. package/dist/plugin-sdk/src/telegram/caption.d.ts +0 -5
  2149. package/dist/plugin-sdk/src/telegram/dm-access.d.ts +0 -18
  2150. package/dist/plugin-sdk/src/telegram/draft-stream.d.ts +0 -37
  2151. package/dist/plugin-sdk/src/telegram/fetch.d.ts +0 -5
  2152. package/dist/plugin-sdk/src/telegram/format.d.ts +0 -18
  2153. package/dist/plugin-sdk/src/telegram/group-access.d.ts +0 -54
  2154. package/dist/plugin-sdk/src/telegram/group-config-helpers.d.ts +0 -8
  2155. package/dist/plugin-sdk/src/telegram/group-migration.d.ts +0 -20
  2156. package/dist/plugin-sdk/src/telegram/inline-buttons.d.ts +0 -11
  2157. package/dist/plugin-sdk/src/telegram/lane-delivery.d.ts +0 -56
  2158. package/dist/plugin-sdk/src/telegram/model-buttons.d.ts +0 -63
  2159. package/dist/plugin-sdk/src/telegram/monitor.d.ts +0 -19
  2160. package/dist/plugin-sdk/src/telegram/network-config.d.ts +0 -33
  2161. package/dist/plugin-sdk/src/telegram/network-errors.d.ts +0 -5
  2162. package/dist/plugin-sdk/src/telegram/outbound-params.d.ts +0 -2
  2163. package/dist/plugin-sdk/src/telegram/probe.d.ts +0 -17
  2164. package/dist/plugin-sdk/src/telegram/proxy.d.ts +0 -1
  2165. package/dist/plugin-sdk/src/telegram/reaction-level.d.ts +0 -11
  2166. package/dist/plugin-sdk/src/telegram/reasoning-lane-coordinator.d.ts +0 -18
  2167. package/dist/plugin-sdk/src/telegram/send.d.ts +0 -153
  2168. package/dist/plugin-sdk/src/telegram/sendchataction-401-backoff.d.ts +0 -28
  2169. package/dist/plugin-sdk/src/telegram/sent-message-cache.d.ts +0 -16
  2170. package/dist/plugin-sdk/src/telegram/status-reaction-variants.d.ts +0 -21
  2171. package/dist/plugin-sdk/src/telegram/sticker-cache.d.ts +0 -46
  2172. package/dist/plugin-sdk/src/telegram/target-writeback.d.ts +0 -7
  2173. package/dist/plugin-sdk/src/telegram/targets.d.ts +0 -11
  2174. package/dist/plugin-sdk/src/telegram/token.d.ts +0 -13
  2175. package/dist/plugin-sdk/src/telegram/update-offset-store.d.ts +0 -15
  2176. package/dist/plugin-sdk/src/telegram/voice.d.ts +0 -16
  2177. package/dist/plugin-sdk/src/telegram/webhook.d.ts +0 -20
  2178. package/dist/plugin-sdk/src/terminal/ansi.d.ts +0 -2
  2179. package/dist/plugin-sdk/src/terminal/health-style.d.ts +0 -1
  2180. package/dist/plugin-sdk/src/terminal/links.d.ts +0 -6
  2181. package/dist/plugin-sdk/src/terminal/palette.d.ts +0 -10
  2182. package/dist/plugin-sdk/src/terminal/progress-line.d.ts +0 -3
  2183. package/dist/plugin-sdk/src/terminal/prompt-style.d.ts +0 -6
  2184. package/dist/plugin-sdk/src/terminal/restore.d.ts +0 -17
  2185. package/dist/plugin-sdk/src/terminal/table.d.ts +0 -18
  2186. package/dist/plugin-sdk/src/terminal/theme.d.ts +0 -18
  2187. package/dist/plugin-sdk/src/tts/tts-core.d.ts +0 -52
  2188. package/dist/plugin-sdk/src/tts/tts.d.ts +0 -194
  2189. package/dist/plugin-sdk/src/utils/account-id.d.ts +0 -1
  2190. package/dist/plugin-sdk/src/utils/boolean.d.ts +0 -5
  2191. package/dist/plugin-sdk/src/utils/chunk-items.d.ts +0 -1
  2192. package/dist/plugin-sdk/src/utils/delivery-context.d.ts +0 -29
  2193. package/dist/plugin-sdk/src/utils/directive-tags.d.ts +0 -29
  2194. package/dist/plugin-sdk/src/utils/fetch-timeout.d.ts +0 -13
  2195. package/dist/plugin-sdk/src/utils/mask-api-key.d.ts +0 -1
  2196. package/dist/plugin-sdk/src/utils/message-channel.d.ts +0 -27
  2197. package/dist/plugin-sdk/src/utils/normalize-secret-input.d.ts +0 -11
  2198. package/dist/plugin-sdk/src/utils/private-network-url.d.ts +0 -1
  2199. package/dist/plugin-sdk/src/utils/provider-utils.d.ts +0 -9
  2200. package/dist/plugin-sdk/src/utils/queue-helpers.d.ts +0 -80
  2201. package/dist/plugin-sdk/src/utils/reaction-level.d.ts +0 -15
  2202. package/dist/plugin-sdk/src/utils/run-with-concurrency.d.ts +0 -11
  2203. package/dist/plugin-sdk/src/utils/safe-json.d.ts +0 -1
  2204. package/dist/plugin-sdk/src/utils/shell-argv.d.ts +0 -1
  2205. package/dist/plugin-sdk/src/utils/transcript-tools.d.ts +0 -8
  2206. package/dist/plugin-sdk/src/utils/usage-format.d.ts +0 -26
  2207. package/dist/plugin-sdk/src/utils/with-timeout.d.ts +0 -1
  2208. package/dist/plugin-sdk/src/utils.d.ts +0 -63
  2209. package/dist/plugin-sdk/src/version.d.ts +0 -8
  2210. package/dist/plugin-sdk/src/video-generation/dashscope-compatible.d.ts +0 -45
  2211. package/dist/plugin-sdk/src/video-generation/types.d.ts +0 -79
  2212. package/dist/plugin-sdk/src/wallet/chat-command.d.ts +0 -17
  2213. package/dist/plugin-sdk/src/wallet/local-socket-signer-broker.d.ts +0 -13
  2214. package/dist/plugin-sdk/src/wallet/local-socket-signer-custody.d.ts +0 -35
  2215. package/dist/plugin-sdk/src/wallet/local-socket-signer-protocol.d.ts +0 -191
  2216. package/dist/plugin-sdk/src/wallet/providers/alchemy-adapter.d.ts +0 -29
  2217. package/dist/plugin-sdk/src/wallet/providers/embedded-keystore-adapter.d.ts +0 -37
  2218. package/dist/plugin-sdk/src/wallet/providers/local-socket-signer-adapter.d.ts +0 -44
  2219. package/dist/plugin-sdk/src/wallet/providers/privy-adapter.d.ts +0 -31
  2220. package/dist/plugin-sdk/src/wallet/providers/turnkey-adapter.d.ts +0 -33
  2221. package/dist/plugin-sdk/src/wallet/solana-address.d.ts +0 -2
  2222. package/dist/plugin-sdk/src/wallet/solana-assets.d.ts +0 -80
  2223. package/dist/plugin-sdk/src/wallet/solana-bond-signing.d.ts +0 -20
  2224. package/dist/plugin-sdk/src/wallet/solana-spl-transfer.d.ts +0 -33
  2225. package/dist/plugin-sdk/src/wallet/solana-swap.d.ts +0 -93
  2226. package/dist/plugin-sdk/src/wallet/solana-token-resolver.d.ts +0 -36
  2227. package/dist/plugin-sdk/src/wallet/solana-transaction-inspection.d.ts +0 -16
  2228. package/dist/plugin-sdk/src/wallet/solana-trigger.d.ts +0 -74
  2229. package/dist/plugin-sdk/src/wallet/trade-chat-command.d.ts +0 -18
  2230. package/dist/plugin-sdk/src/wallet/wallet-agent-selection.d.ts +0 -43
  2231. package/dist/plugin-sdk/src/wallet/wallet-approval-auth.d.ts +0 -212
  2232. package/dist/plugin-sdk/src/wallet/wallet-audit-log.d.ts +0 -18
  2233. package/dist/plugin-sdk/src/wallet/wallet-canary.d.ts +0 -47
  2234. package/dist/plugin-sdk/src/wallet/wallet-custody.d.ts +0 -313
  2235. package/dist/plugin-sdk/src/wallet/wallet-inbound-events.d.ts +0 -88
  2236. package/dist/plugin-sdk/src/wallet/wallet-observability.d.ts +0 -16
  2237. package/dist/plugin-sdk/src/wallet/wallet-policy-simulation.d.ts +0 -61
  2238. package/dist/plugin-sdk/src/wallet/wallet-policy.d.ts +0 -144
  2239. package/dist/plugin-sdk/src/wallet/wallet-provider-adapter.d.ts +0 -111
  2240. package/dist/plugin-sdk/src/wallet/wallet-provider-capabilities.d.ts +0 -51
  2241. package/dist/plugin-sdk/src/wallet/wallet-provider-registry.d.ts +0 -128
  2242. package/dist/plugin-sdk/src/wallet/wallet-provider-resolver.d.ts +0 -17
  2243. package/dist/plugin-sdk/src/wallet/wallet-redaction.d.ts +0 -3
  2244. package/dist/plugin-sdk/src/wallet/wallet-runtime-config.d.ts +0 -93
  2245. package/dist/plugin-sdk/src/wallet/wallet-secrets-store.d.ts +0 -63
  2246. package/dist/plugin-sdk/src/wallet/wallet-send-approvals.d.ts +0 -165
  2247. package/dist/plugin-sdk/src/wallet/wallet-settlement-links.d.ts +0 -57
  2248. package/dist/plugin-sdk/src/wallet/wallet-status.d.ts +0 -106
  2249. package/dist/plugin-sdk/src/wallet/wallet-task-ledger.d.ts +0 -7
  2250. package/dist/plugin-sdk/src/web/accounts.d.ts +0 -39
  2251. package/dist/plugin-sdk/src/web/active-listener.d.ts +0 -26
  2252. package/dist/plugin-sdk/src/web/auth-store.d.ts +0 -26
  2253. package/dist/plugin-sdk/src/web/auto-reply/constants.d.ts +0 -1
  2254. package/dist/plugin-sdk/src/web/auto-reply/deliver-reply.d.ts +0 -19
  2255. package/dist/plugin-sdk/src/web/auto-reply/heartbeat-runner.d.ts +0 -20
  2256. package/dist/plugin-sdk/src/web/auto-reply/loggers.d.ts +0 -4
  2257. package/dist/plugin-sdk/src/web/auto-reply/mentions.d.ts +0 -19
  2258. package/dist/plugin-sdk/src/web/auto-reply/monitor/ack-reaction.d.ts +0 -13
  2259. package/dist/plugin-sdk/src/web/auto-reply/monitor/broadcast.d.ts +0 -16
  2260. package/dist/plugin-sdk/src/web/auto-reply/monitor/commands.d.ts +0 -2
  2261. package/dist/plugin-sdk/src/web/auto-reply/monitor/echo.d.ts +0 -17
  2262. package/dist/plugin-sdk/src/web/auto-reply/monitor/group-activation.d.ts +0 -9
  2263. package/dist/plugin-sdk/src/web/auto-reply/monitor/group-gating.d.ts +0 -33
  2264. package/dist/plugin-sdk/src/web/auto-reply/monitor/group-members.d.ts +0 -6
  2265. package/dist/plugin-sdk/src/web/auto-reply/monitor/last-route.d.ts +0 -15
  2266. package/dist/plugin-sdk/src/web/auto-reply/monitor/message-line.d.ts +0 -11
  2267. package/dist/plugin-sdk/src/web/auto-reply/monitor/on-message.d.ts +0 -24
  2268. package/dist/plugin-sdk/src/web/auto-reply/monitor/peer.d.ts +0 -2
  2269. package/dist/plugin-sdk/src/web/auto-reply/monitor/process-message.d.ts +0 -40
  2270. package/dist/plugin-sdk/src/web/auto-reply/monitor.d.ts +0 -5
  2271. package/dist/plugin-sdk/src/web/auto-reply/session-snapshot.d.ts +0 -17
  2272. package/dist/plugin-sdk/src/web/auto-reply/types.d.ts +0 -30
  2273. package/dist/plugin-sdk/src/web/auto-reply/util.d.ts +0 -2
  2274. package/dist/plugin-sdk/src/web/auto-reply.d.ts +0 -1
  2275. package/dist/plugin-sdk/src/web/auto-reply.impl.d.ts +0 -6
  2276. package/dist/plugin-sdk/src/web/inbound/access-control.d.ts +0 -36
  2277. package/dist/plugin-sdk/src/web/inbound/dedupe.d.ts +0 -2
  2278. package/dist/plugin-sdk/src/web/inbound/extract.d.ts +0 -13
  2279. package/dist/plugin-sdk/src/web/inbound/media.d.ts +0 -7
  2280. package/dist/plugin-sdk/src/web/inbound/monitor.d.ts +0 -30
  2281. package/dist/plugin-sdk/src/web/inbound/send-api.d.ts +0 -22
  2282. package/dist/plugin-sdk/src/web/inbound/types.d.ts +0 -41
  2283. package/dist/plugin-sdk/src/web/inbound.d.ts +0 -4
  2284. package/dist/plugin-sdk/src/web/login-qr.d.ts +0 -19
  2285. package/dist/plugin-sdk/src/web/login.d.ts +0 -3
  2286. package/dist/plugin-sdk/src/web/media.d.ts +0 -43
  2287. package/dist/plugin-sdk/src/web/outbound.d.ts +0 -25
  2288. package/dist/plugin-sdk/src/web/qr-image.d.ts +0 -4
  2289. package/dist/plugin-sdk/src/web/reconnect.d.ts +0 -12
  2290. package/dist/plugin-sdk/src/web/session.d.ts +0 -14
  2291. package/dist/plugin-sdk/src/web/vcard.d.ts +0 -6
  2292. package/dist/plugin-sdk/src/whatsapp/normalize.d.ts +0 -6
  2293. package/dist/plugin-sdk/src/whatsapp/resolve-outbound-target.d.ts +0 -12
  2294. package/dist/plugin-sdk/src/wizard/onboarding.types.d.ts +0 -31
  2295. package/dist/plugin-sdk/src/wizard/onboarding.wallet.d.ts +0 -45
  2296. package/dist/plugin-sdk/src/wizard/prompts.d.ts +0 -45
  2297. package/dist/plugin-sdk/src/wizard/session.d.ts +0 -42
  2298. package/dist/plugin-sdk/ssrf-Cce6LubA.js +0 -421
  2299. package/dist/plugin-sdk/ssrf-Cg5wg0v3.js +0 -4
  2300. package/dist/plugin-sdk/status-B2vb7zNW.js +0 -106417
  2301. package/dist/plugin-sdk/sticker-cache-C1vOWkzA.js +0 -170
  2302. package/dist/plugin-sdk/sticker-cache-CJDzqowL.js +0 -170
  2303. package/dist/plugin-sdk/subsystem-BmpnSVOu.js +0 -358
  2304. package/dist/plugin-sdk/tables-BD7H5ug-.js +0 -55
  2305. package/dist/plugin-sdk/tables-CJE8kB35.js +0 -55
  2306. package/dist/plugin-sdk/target-errors-kz4lDpCF.js +0 -26
  2307. package/dist/plugin-sdk/targets-4QTk4tTz.js +0 -45
  2308. package/dist/plugin-sdk/targets-DmSpDM4F.js +0 -45
  2309. package/dist/plugin-sdk/targets-cA134MEE.js +0 -101
  2310. package/dist/plugin-sdk/targets-t1hbjHdJ.js +0 -101
  2311. package/dist/plugin-sdk/telegram-actions-BoiC9J7L.js +0 -307
  2312. package/dist/plugin-sdk/telegram-actions-CwAsKaNz.js +0 -307
  2313. package/dist/plugin-sdk/thread-bindings.lifecycle-Djem8FWF.js +0 -737
  2314. package/dist/plugin-sdk/thread-bindings.lifecycle-gmHv3hc7.js +0 -737
  2315. package/dist/plugin-sdk/thread-bindings.state-CNT2vxm3.js +0 -643
  2316. package/dist/plugin-sdk/thread-bindings.state-D8kN2X6H.js +0 -643
  2317. package/dist/plugin-sdk/token-BWZYO8QR.js +0 -36
  2318. package/dist/plugin-sdk/tokens-BK5rrwBB.js +0 -72
  2319. package/dist/plugin-sdk/tokens-CQRTq-NN.js +0 -72
  2320. package/dist/plugin-sdk/tool-loop-detection-Ci_YYA7P.js +0 -352
  2321. package/dist/plugin-sdk/transcript-events-BJQWUdmU.js +0 -24
  2322. package/dist/plugin-sdk/ui-7sxJ-x37.js +0 -33
  2323. package/dist/plugin-sdk/ui-BQ-Vvq_c.js +0 -33
  2324. package/dist/plugin-sdk/utils-LGKVujSU.js +0 -237
  2325. package/dist/plugin-sdk/web-BjV7ROeA.js +0 -2226
  2326. package/dist/plugin-sdk/web-DjTSgU98.js +0 -2226
  2327. package/dist/plugin-sdk/whatsapp-actions-68Mfs2dJ.js +0 -123
  2328. package/dist/plugin-sdk/whatsapp-actions-DRqtzvTO.js +0 -123
  2329. package/dist/plugin-sdk/wsl-DcM2PgSS.js +0 -1016
  2330. package/dist/plugin-sdk/wsl-PXrdWitE.js +0 -1016
  2331. /package/dist/plugin-sdk/{channel-activity-Cf5sKkfd.js → channel-activity-B7MIaDei.js} +0 -0
  2332. /package/dist/plugin-sdk/{client-DWTXscox.js → client-BTUzO_8g.js} +0 -0
  2333. /package/dist/plugin-sdk/{command-poll-backoff-C2vOB38t.js → command-poll-backoff-CBq0jVRw.js} +0 -0
  2334. /package/dist/plugin-sdk/{date-time-Bo5FVB7G.js → date-time-Bbp5JvNw.js} +0 -0
  2335. /package/dist/plugin-sdk/{diagnostic-session-state-CT36_PCE.js → diagnostic-session-state-B-9PL5r7.js} +0 -0
  2336. /package/dist/plugin-sdk/{draft-stream-loop-2KC6-8CG.js → draft-stream-loop-DZ1OAyye.js} +0 -0
  2337. /package/dist/plugin-sdk/{fetch-headers-BTcaUCW6.js → fetch-headers-DvXyXtoI.js} +0 -0
  2338. /package/dist/plugin-sdk/{fetch-timeout-Dyj5Y_Ss.js → fetch-timeout-jOIu9Xud.js} +0 -0
  2339. /package/dist/plugin-sdk/{gateway-registry-CtUjFG3Q.js → gateway-registry-C-MTEdvG.js} +0 -0
  2340. /package/dist/plugin-sdk/{inbound-context-Daf9i2Me.js → inbound-context-BNCTzgjG.js} +0 -0
  2341. /package/dist/plugin-sdk/{internal-DFhCtnuk.js → internal-CC6TMTtc.js} +0 -0
  2342. /package/dist/plugin-sdk/{media-payload-CcW51vQj.js → media-payload-DpYEcV-X.js} +0 -0
  2343. /package/dist/plugin-sdk/{polls-B4cMiwMo.js → polls-Dy1NsYKT.js} +0 -0
  2344. /package/dist/plugin-sdk/{proxy-CKQOQYAl.js → proxy-R5TjOIFS.js} +0 -0
  2345. /package/dist/plugin-sdk/{qmd-scope-ubzoBMhc.js → qmd-scope-C9tRnohc.js} +0 -0
  2346. /package/dist/plugin-sdk/{redact-identifier-BAD7jXcr.js → redact-identifier-CDvAeiFm.js} +0 -0
  2347. /package/dist/plugin-sdk/{redact-sensitive-url-DK8OUExz.js → redact-sensitive-url-B0RJQqO7.js} +0 -0
  2348. /package/dist/plugin-sdk/{render-C9LkRUhd.js → render-K7NwXvVu.js} +0 -0
  2349. /package/dist/plugin-sdk/{reply-reference-DxIu2vr0.js → reply-reference-CWEIswqw.js} +0 -0
  2350. /package/dist/plugin-sdk/{secure-random-CO1VkMEt.js → secure-random-C2EhANj2.js} +0 -0
  2351. /package/dist/plugin-sdk/{target-errors-Dn4aykSV.js → target-errors-C0yNDbGS.js} +0 -0
  2352. /package/dist/plugin-sdk/{tool-loop-detection-D6OX2-I9.js → tool-loop-detection-P5u2k0_f.js} +0 -0
  2353. /package/dist/plugin-sdk/{with-timeout-DqkblR98.js → with-timeout-Dl513q34.js} +0 -0
@@ -1,4528 +0,0 @@
1
- import { $ as formatModelsAvailableHeader, $n as resolveTelegramInlineButtonsScope, A as clearHistoryEntriesIfEnabled, C as buildPairingReply, Ct as enqueueSystemEvent, E as DEFAULT_GROUP_HISTORY_LIMIT, F as recordInboundSession, Gt as hasControlCommand, H as createInboundDebouncer, I as removeAckReactionAfterReply, Jt as buildMentionRegexes, K as resolveEnvelopeFormatOptions, L as shouldAckReaction, N as recordPendingHistoryEntryIfEnabled, Nt as registerUnhandledRejectionHandler, O as buildPendingHistoryContextFromMap, Q as buildModelsProviderData, Qt as formatReasoningMessage, Sn as readJsonBodyWithLimit, T as sleepWithAbort, Tt as resolveChannelConfigWrites, U as resolveInboundDebounceMs, W as formatInboundEnvelope, Yt as matchesMentionWithExplicit, Z as resolveStoredModelOverride, _r as resolveControlCommandGate, at as buildCommandsPaginationKeyboard, b as logInboundDrop, bt as buildCommandsMessagePaginated, c as loadModelCatalog, en as stripReasoningTagsFromText, et as buildModelsKeyboard, f as createTypingCallbacks, gr as resolveCommandAuthorizedFromAuthorizers, it as parseModelCallbackData, l as modelSupportsVision, m as resolveMentionGatingWithBypass, nn as isInsideCode, nt as calculateTotalPages, qt as isAbortRequestText, rr as waitForAbortSignal, rt as getModelsPageSize, s as findModelInCatalog, sr as createDedupeCache, tn as findCodeRegions, tt as buildProviderKeyboard, w as computeBackoff, x as logTypingFailure, xr as resolveOpenProviderRuntimeGroupPolicy, xt as formatDurationPrecise, y as logAckFailure, z as dispatchReplyWithBufferedBlockDispatcher } from "./pi-embedded-runner-Dum71Tdo.js";
2
- import { C as recordSessionMetaFromInbound, Dt as resolveTelegramAccount, Rt as resolveChannelGroupPolicy, S as readSessionUpdatedAt, fn as executePluginCommand, hn as matchPluginCommand, pn as getPluginCommandSpecs, x as loadSessionStore, zt as resolveChannelGroupRequireMention } from "./runtime-BPyuAmka.js";
3
- import { i as defaultRuntime, r as createNonExitingRuntime, t as createSubsystemLogger } from "./subsystem-DBPNbQDQ.js";
4
- import { i as logVerbose, l as warn, p as getChildLogger, s as shouldLogVerbose, t as danger } from "./globals-B_jjtAje.js";
5
- import { s as resolveStateDir } from "./paths-BEmvSyOV.js";
6
- import "./utils-CYk9EKoq.js";
7
- import { Gt as resolveDefaultModelForAgent, Nt as resolveAgentMaxConcurrent, cr as formatErrorMessage, h as resolveTelegramCustomCommands, lr as formatUncaughtError, m as normalizeTelegramCommandName, n as loadConfig, p as TELEGRAM_COMMAND_NAME_PATTERN, s as writeConfigFile } from "./config-DtqAN2L3.js";
8
- import { a as resolveAgentDir, u as resolveDefaultAgentId } from "./agent-scope-kIJqg5PA.js";
9
- import { p as normalizeAccountId$1, u as resolveThreadSessionKeys } from "./session-key-HSJ2KQTc.js";
10
- import "./accounts-D7_p-Ivb.js";
11
- import "./accounts-DTdM1xcj.js";
12
- import "./accounts-RT6y7n3H.js";
13
- import "./tokens-CQRTq-NN.js";
14
- import "./allow-list-C9N6FKeC.js";
15
- import "./redact-CwCz68Mi.js";
16
- import "./github-copilot-token-Dgug856m.js";
17
- import { n as retryAsync } from "./retry-DycQ4ymF.js";
18
- import { l as resolveStorePath } from "./paths-B88DQEK8.js";
19
- import "./optional-runtime-dependency-szS49voX.js";
20
- import "./fetch-guard-DTKgMN9f.js";
21
- import "./send-DRGzRdI3.js";
22
- import { C as isSenderAllowed, D as formatLocationText, E as resolveSenderAllowMatch, K as firstDefined, O as toLocationContext, S as resolveTelegramThreadSpec, T as normalizeDmAllowFromWithStore, V as upsertChannelPairingRequest, _ as resolveTelegramForumThreadId, a as buildSenderLabel, b as resolveTelegramReplyId, c as buildTelegramGroupPeerId, d as buildTypingThreadParams, f as describeReplyTarget, g as normalizeForwardedContext, h as hasBotMention, i as buildGroupLabel, l as buildTelegramParentPeer, m as extractTelegramLocation, o as buildSenderName, p as expandTextLinks, s as buildTelegramGroupFrom, u as buildTelegramThreadParams, v as resolveTelegramGroupAllowFromContext, w as normalizeAllowFrom, x as resolveTelegramStreamMode, y as resolveTelegramMediaPlaceholder, z as readChannelAllowFromStore } from "./wsl-PXrdWitE.js";
23
- import { c as resolveChunkMode, i as chunkMarkdownTextWithMode, l as resolveTextChunkLimit } from "./chunk-M2d7r-Zt.js";
24
- import { a as resolveAckReaction, n as createReplyPrefixOptions } from "./reply-prefix-DqlCqHXT.js";
25
- import { n as listSkillCommandsForAgents } from "./skill-commands-CkgGmWBS.js";
26
- import { c as logWebhookError, d as startDiagnosticHeartbeat, f as stopDiagnosticHeartbeat, l as logWebhookProcessed, m as isDiagnosticsEnabled, u as logWebhookReceived } from "./diagnostic-CuhHqubd.js";
27
- import "./diagnostic-session-state-Zw87xFym.js";
28
- import { E as mediaKindFromMime, c as MediaFetchError, l as fetchRemoteMedia, m as getAgentScopedMediaLocalRoots, n as loadWebMedia, x as isGifMedia } from "./media-Cxw-xLGU.js";
29
- import "./pi-model-discovery-yifTIDIn.js";
30
- import "./runtime-dependency-Csswyv5r.js";
31
- import "./path-alias-guards-CcQroDXQ.js";
32
- import "./fs-safe-BPYS6-j1.js";
33
- import { n as resolveMarkdownTableMode } from "./markdown-tables-CCSD52rA.js";
34
- import "./send-D7tr-EsH.js";
35
- import { a as saveMediaBuffer } from "./outbound-attachment-C-jSFaEB.js";
36
- import "./fetch-D70syO9t.js";
37
- import "./thread-bindings.state-CNT2vxm3.js";
38
- import "./memory-search-J6AYuENR.js";
39
- import "./manager-D2kZ0Cps.js";
40
- import "./query-expansion-VePrajug.js";
41
- import "./common-Cpw-vuuM.js";
42
- import { C as isNativeCommandsExplicitlyDisabled, E as resolveNativeSkillsEnabled, T as resolveNativeCommandsEnabled, c as listNativeCommandSpecsForConfig, d as parseCommandArgs, p as resolveCommandArgMenu, r as findCommandByNativeName, s as listNativeCommandSpecs, t as buildCommandTextFromArgs, u as normalizeCommandBody } from "./commands-registry-CdT-nl7v.js";
43
- import { t as finalizeInboundContext } from "./inbound-context-Daf9i2Me.js";
44
- import "./directory-live-BxSH0XXX.js";
45
- import "./targets-cA134MEE.js";
46
- import "./sandbox-paths-CkTERCrj.js";
47
- import { n as resolveAgentRoute } from "./resolve-route-CNhTJG_2.js";
48
- import "./render-C9LkRUhd.js";
49
- import "./tables-CJE8kB35.js";
50
- import { n as recordChannelActivity } from "./channel-activity-Cf5sKkfd.js";
51
- import { _ as splitTelegramCaption, d as isRecoverableTelegramNetworkError, f as markdownToTelegramChunks, g as resolveTelegramFetch, h as wrapFileReferencesInHtml, i as editMessageTelegram, l as resolveTelegramVoiceSend, m as renderTelegramHtmlText, p as markdownToTelegramHtml, t as buildInlineKeyboard, u as wasSentByBot, v as withTelegramApiErrorLogging } from "./send-BzFdvD_i.js";
52
- import "./retry-policy-sM01QZT2.js";
53
- import { t as makeProxyFetch } from "./proxy-CKQOQYAl.js";
54
- import { i as getCachedSticker, n as describeStickerImage, t as cacheSticker } from "./sticker-cache-CJDzqowL.js";
55
- import { i as createStatusReactionController, n as DEFAULT_EMOJIS, t as createFinalizableDraftLifecycle } from "./draft-stream-controls-v_5gdUYG.js";
56
- import path from "node:path";
57
- import os from "node:os";
58
- import fs from "node:fs/promises";
59
- import crypto from "node:crypto";
60
- import { createServer } from "node:http";
61
- import { API_CONSTANTS, Bot, GrammyError, InputFile, webhookCallback } from "grammy";
62
- import { run, sequentialize } from "@grammyjs/runner";
63
- import { apiThrottler } from "@grammyjs/transformer-throttler";
64
-
65
- //#region src/telegram/allowed-updates.ts
66
- function resolveTelegramAllowedUpdates() {
67
- const updates = [...API_CONSTANTS.DEFAULT_UPDATE_TYPES];
68
- if (!updates.includes("message_reaction")) updates.push("message_reaction");
69
- if (!updates.includes("channel_post")) updates.push("channel_post");
70
- return updates;
71
- }
72
-
73
- //#endregion
74
- //#region src/telegram/bot-updates.ts
75
- const MEDIA_GROUP_TIMEOUT_MS = 500;
76
- const RECENT_TELEGRAM_UPDATE_TTL_MS = 5 * 6e4;
77
- const RECENT_TELEGRAM_UPDATE_MAX = 2e3;
78
- const resolveTelegramUpdateId = (ctx) => ctx.update?.update_id ?? ctx.update_id;
79
- const buildTelegramUpdateKey = (ctx) => {
80
- const updateId = resolveTelegramUpdateId(ctx);
81
- if (typeof updateId === "number") return `update:${updateId}`;
82
- const callbackId = ctx.callbackQuery?.id;
83
- if (callbackId) return `callback:${callbackId}`;
84
- const msg = ctx.message ?? ctx.channelPost ?? ctx.editedChannelPost ?? ctx.update?.message ?? ctx.update?.edited_message ?? ctx.update?.channel_post ?? ctx.update?.edited_channel_post ?? ctx.callbackQuery?.message;
85
- const chatId = msg?.chat?.id;
86
- const messageId = msg?.message_id;
87
- if (typeof chatId !== "undefined" && typeof messageId === "number") return `message:${chatId}:${messageId}`;
88
- };
89
- const createTelegramUpdateDedupe = () => createDedupeCache({
90
- ttlMs: RECENT_TELEGRAM_UPDATE_TTL_MS,
91
- maxSize: RECENT_TELEGRAM_UPDATE_MAX
92
- });
93
-
94
- //#endregion
95
- //#region src/telegram/bot/delivery.ts
96
- const PARSE_ERR_RE = /can't parse entities|parse entities|find end of the entity/i;
97
- const EMPTY_TEXT_ERR_RE = /message text is empty/i;
98
- const VOICE_FORBIDDEN_RE = /VOICE_MESSAGES_FORBIDDEN/;
99
- const FILE_TOO_BIG_RE = /file is too big/i;
100
- const TELEGRAM_MEDIA_SSRF_POLICY = {
101
- allowedHostnames: ["api.telegram.org"],
102
- allowRfc2544BenchmarkRange: true
103
- };
104
- async function deliverReplies(params) {
105
- const { replies, chatId, runtime, bot, replyToMode, textLimit, thread, linkPreview, replyQuoteText } = params;
106
- const chunkMode = params.chunkMode ?? "length";
107
- let hasReplied = false;
108
- let hasDelivered = false;
109
- const markDelivered = () => {
110
- hasDelivered = true;
111
- };
112
- const chunkText = (markdown) => {
113
- const markdownChunks = chunkMode === "newline" ? chunkMarkdownTextWithMode(markdown, textLimit, chunkMode) : [markdown];
114
- const chunks = [];
115
- for (const chunk of markdownChunks) {
116
- const nested = markdownToTelegramChunks(chunk, textLimit, { tableMode: params.tableMode });
117
- if (!nested.length && chunk) {
118
- chunks.push({
119
- html: wrapFileReferencesInHtml(markdownToTelegramHtml(chunk, {
120
- tableMode: params.tableMode,
121
- wrapFileRefs: false
122
- })),
123
- text: chunk
124
- });
125
- continue;
126
- }
127
- chunks.push(...nested);
128
- }
129
- return chunks;
130
- };
131
- for (const reply of replies) {
132
- const hasMedia = Boolean(reply?.mediaUrl) || (reply?.mediaUrls?.length ?? 0) > 0;
133
- if (!reply?.text && !hasMedia) {
134
- if (reply?.audioAsVoice) {
135
- logVerbose("telegram reply has audioAsVoice without media/text; skipping");
136
- continue;
137
- }
138
- runtime.error?.(danger("reply missing text/media"));
139
- continue;
140
- }
141
- const replyToId = replyToMode === "off" ? void 0 : resolveTelegramReplyId(reply.replyToId);
142
- const replyToMessageIdForPayload = replyToId && (replyToMode === "all" || !hasReplied) ? replyToId : void 0;
143
- const mediaList = reply.mediaUrls?.length ? reply.mediaUrls : reply.mediaUrl ? [reply.mediaUrl] : [];
144
- const telegramData = reply.channelData?.telegram;
145
- const replyMarkup = buildInlineKeyboard(telegramData?.buttons);
146
- if (mediaList.length === 0) {
147
- const chunks = chunkText(reply.text || "");
148
- let sentTextChunk = false;
149
- for (let i = 0; i < chunks.length; i += 1) {
150
- const chunk = chunks[i];
151
- if (!chunk) continue;
152
- const shouldAttachButtons = i === 0 && replyMarkup;
153
- const chunkReplyToMessageId = replyToMode === "all" || i === 0 ? replyToMessageIdForPayload : void 0;
154
- await sendTelegramText(bot, chatId, chunk.html, runtime, {
155
- replyToMessageId: chunkReplyToMessageId,
156
- replyQuoteText,
157
- thread,
158
- textMode: "html",
159
- plainText: chunk.text,
160
- linkPreview,
161
- replyMarkup: shouldAttachButtons ? replyMarkup : void 0
162
- });
163
- sentTextChunk = true;
164
- markDelivered();
165
- }
166
- if (replyToMessageIdForPayload && !hasReplied && sentTextChunk) hasReplied = true;
167
- continue;
168
- }
169
- let first = true;
170
- let pendingFollowUpText;
171
- for (const mediaUrl of mediaList) {
172
- const isFirstMedia = first;
173
- const media = await loadWebMedia(mediaUrl, { localRoots: params.mediaLocalRoots });
174
- const kind = mediaKindFromMime(media.contentType ?? void 0);
175
- const isGif = isGifMedia({
176
- contentType: media.contentType,
177
- fileName: media.fileName
178
- });
179
- const fileName = media.fileName ?? (isGif ? "animation.gif" : "file");
180
- const file = new InputFile(media.buffer, fileName);
181
- const { caption, followUpText } = splitTelegramCaption(isFirstMedia ? reply.text ?? void 0 : void 0);
182
- const htmlCaption = caption ? renderTelegramHtmlText(caption, { tableMode: params.tableMode }) : void 0;
183
- if (followUpText) pendingFollowUpText = followUpText;
184
- first = false;
185
- const replyToMessageId = replyToMode === "all" || isFirstMedia ? replyToMessageIdForPayload : void 0;
186
- const shouldAttachButtonsToMedia = isFirstMedia && replyMarkup && !followUpText;
187
- const mediaParams = {
188
- caption: htmlCaption,
189
- ...htmlCaption ? { parse_mode: "HTML" } : {},
190
- ...shouldAttachButtonsToMedia ? { reply_markup: replyMarkup } : {},
191
- ...buildTelegramSendParams({
192
- replyToMessageId,
193
- thread
194
- })
195
- };
196
- if (isGif) {
197
- await withTelegramApiErrorLogging({
198
- operation: "sendAnimation",
199
- runtime,
200
- fn: () => bot.api.sendAnimation(chatId, file, { ...mediaParams })
201
- });
202
- markDelivered();
203
- } else if (kind === "image") {
204
- await withTelegramApiErrorLogging({
205
- operation: "sendPhoto",
206
- runtime,
207
- fn: () => bot.api.sendPhoto(chatId, file, { ...mediaParams })
208
- });
209
- markDelivered();
210
- } else if (kind === "video") {
211
- await withTelegramApiErrorLogging({
212
- operation: "sendVideo",
213
- runtime,
214
- fn: () => bot.api.sendVideo(chatId, file, { ...mediaParams })
215
- });
216
- markDelivered();
217
- } else if (kind === "audio") {
218
- const { useVoice } = resolveTelegramVoiceSend({
219
- wantsVoice: reply.audioAsVoice === true,
220
- contentType: media.contentType,
221
- fileName,
222
- logFallback: logVerbose
223
- });
224
- if (useVoice) {
225
- await params.onVoiceRecording?.();
226
- try {
227
- await withTelegramApiErrorLogging({
228
- operation: "sendVoice",
229
- runtime,
230
- shouldLog: (err) => !isVoiceMessagesForbidden(err),
231
- fn: () => bot.api.sendVoice(chatId, file, { ...mediaParams })
232
- });
233
- markDelivered();
234
- } catch (voiceErr) {
235
- if (isVoiceMessagesForbidden(voiceErr)) {
236
- const fallbackText = reply.text;
237
- if (!fallbackText || !fallbackText.trim()) throw voiceErr;
238
- logVerbose("telegram sendVoice forbidden (recipient has voice messages blocked in privacy settings); falling back to text");
239
- await sendTelegramVoiceFallbackText({
240
- bot,
241
- chatId,
242
- runtime,
243
- text: fallbackText,
244
- chunkText,
245
- replyToId: replyToMessageIdForPayload,
246
- replyToMode,
247
- thread,
248
- linkPreview,
249
- replyMarkup,
250
- replyQuoteText
251
- });
252
- if (replyToMessageIdForPayload && !hasReplied) hasReplied = true;
253
- markDelivered();
254
- continue;
255
- }
256
- throw voiceErr;
257
- }
258
- } else {
259
- await withTelegramApiErrorLogging({
260
- operation: "sendAudio",
261
- runtime,
262
- fn: () => bot.api.sendAudio(chatId, file, { ...mediaParams })
263
- });
264
- markDelivered();
265
- }
266
- } else {
267
- await withTelegramApiErrorLogging({
268
- operation: "sendDocument",
269
- runtime,
270
- fn: () => bot.api.sendDocument(chatId, file, { ...mediaParams })
271
- });
272
- markDelivered();
273
- }
274
- if (replyToMessageId && !hasReplied) hasReplied = true;
275
- if (pendingFollowUpText && isFirstMedia) {
276
- const chunks = chunkText(pendingFollowUpText);
277
- for (let i = 0; i < chunks.length; i += 1) {
278
- const chunk = chunks[i];
279
- const followUpReplyToMessageId = replyToMode === "all" ? replyToMessageIdForPayload : void 0;
280
- await sendTelegramText(bot, chatId, chunk.html, runtime, {
281
- replyToMessageId: followUpReplyToMessageId,
282
- thread,
283
- textMode: "html",
284
- plainText: chunk.text,
285
- linkPreview,
286
- replyMarkup: i === 0 ? replyMarkup : void 0
287
- });
288
- markDelivered();
289
- }
290
- pendingFollowUpText = void 0;
291
- }
292
- if (replyToMessageIdForPayload && !hasReplied) hasReplied = true;
293
- }
294
- }
295
- return { delivered: hasDelivered };
296
- }
297
- async function resolveMedia(ctx, maxBytes, token, proxyFetch) {
298
- const msg = ctx.message;
299
- const downloadAndSaveTelegramFile = async (filePath, fetchImpl) => {
300
- const fetched = await fetchRemoteMedia({
301
- url: `https://api.telegram.org/file/bot${token}/${filePath}`,
302
- fetchImpl,
303
- filePathHint: filePath,
304
- maxBytes,
305
- ssrfPolicy: TELEGRAM_MEDIA_SSRF_POLICY
306
- });
307
- const originalName = fetched.fileName ?? filePath;
308
- return saveMediaBuffer(fetched.buffer, fetched.contentType, "inbound", maxBytes, originalName);
309
- };
310
- if (msg.sticker) {
311
- const sticker = msg.sticker;
312
- if (sticker.is_animated || sticker.is_video) {
313
- logVerbose("telegram: skipping animated/video sticker (only static stickers supported)");
314
- return null;
315
- }
316
- if (!sticker.file_id) return null;
317
- try {
318
- const file = await ctx.getFile();
319
- if (!file.file_path) {
320
- logVerbose("telegram: getFile returned no file_path for sticker");
321
- return null;
322
- }
323
- const fetchImpl = proxyFetch ?? globalThis.fetch;
324
- if (!fetchImpl) {
325
- logVerbose("telegram: fetch not available for sticker download");
326
- return null;
327
- }
328
- const saved = await downloadAndSaveTelegramFile(file.file_path, fetchImpl);
329
- const cached = sticker.file_unique_id ? getCachedSticker(sticker.file_unique_id) : null;
330
- if (cached) {
331
- logVerbose(`telegram: sticker cache hit for ${sticker.file_unique_id}`);
332
- const fileId = sticker.file_id ?? cached.fileId;
333
- const emoji = sticker.emoji ?? cached.emoji;
334
- const setName = sticker.set_name ?? cached.setName;
335
- if (fileId !== cached.fileId || emoji !== cached.emoji || setName !== cached.setName) cacheSticker({
336
- ...cached,
337
- fileId,
338
- emoji,
339
- setName
340
- });
341
- return {
342
- path: saved.path,
343
- contentType: saved.contentType,
344
- placeholder: "<media:sticker>",
345
- stickerMetadata: {
346
- emoji,
347
- setName,
348
- fileId,
349
- fileUniqueId: sticker.file_unique_id,
350
- cachedDescription: cached.description
351
- }
352
- };
353
- }
354
- return {
355
- path: saved.path,
356
- contentType: saved.contentType,
357
- placeholder: "<media:sticker>",
358
- stickerMetadata: {
359
- emoji: sticker.emoji ?? void 0,
360
- setName: sticker.set_name ?? void 0,
361
- fileId: sticker.file_id,
362
- fileUniqueId: sticker.file_unique_id
363
- }
364
- };
365
- } catch (err) {
366
- logVerbose(`telegram: failed to process sticker: ${String(err)}`);
367
- return null;
368
- }
369
- }
370
- if (!(msg.photo?.[msg.photo.length - 1] ?? msg.video ?? msg.video_note ?? msg.document ?? msg.audio ?? msg.voice)?.file_id) return null;
371
- let file;
372
- try {
373
- file = await retryAsync(() => ctx.getFile(), {
374
- attempts: 3,
375
- minDelayMs: 1e3,
376
- maxDelayMs: 4e3,
377
- jitter: .2,
378
- label: "telegram:getFile",
379
- shouldRetry: isRetryableGetFileError,
380
- onRetry: ({ attempt, maxAttempts }) => logVerbose(`telegram: getFile retry ${attempt}/${maxAttempts}`)
381
- });
382
- } catch (err) {
383
- if (isFileTooBigError(err)) {
384
- logVerbose(warn("telegram: getFile failed - file exceeds Telegram Bot API 20MB limit; skipping attachment"));
385
- return null;
386
- }
387
- logVerbose(`telegram: getFile failed after retries: ${String(err)}`);
388
- return null;
389
- }
390
- if (!file.file_path) throw new Error("Telegram getFile returned no file_path");
391
- const fetchImpl = proxyFetch ?? globalThis.fetch;
392
- if (!fetchImpl) throw new Error("fetch is not available; set channels.telegram.proxy in config");
393
- const saved = await downloadAndSaveTelegramFile(file.file_path, fetchImpl);
394
- const placeholder = resolveTelegramMediaPlaceholder(msg) ?? "<media:document>";
395
- return {
396
- path: saved.path,
397
- contentType: saved.contentType,
398
- placeholder
399
- };
400
- }
401
- function isVoiceMessagesForbidden(err) {
402
- if (err instanceof GrammyError) return VOICE_FORBIDDEN_RE.test(err.description);
403
- return VOICE_FORBIDDEN_RE.test(formatErrorMessage(err));
404
- }
405
- /**
406
- * Returns true if the error is Telegram's "file is too big" error.
407
- * This happens when trying to download files >20MB via the Bot API.
408
- * Unlike network errors, this is a permanent error and should not be retried.
409
- */
410
- function isFileTooBigError(err) {
411
- if (err instanceof GrammyError) return FILE_TOO_BIG_RE.test(err.description);
412
- return FILE_TOO_BIG_RE.test(formatErrorMessage(err));
413
- }
414
- /**
415
- * Returns true if the error is a transient network error that should be retried.
416
- * Returns false for permanent errors like "file is too big" (400 Bad Request).
417
- */
418
- function isRetryableGetFileError(err) {
419
- if (isFileTooBigError(err)) return false;
420
- return true;
421
- }
422
- async function sendTelegramVoiceFallbackText(opts) {
423
- const chunks = opts.chunkText(opts.text);
424
- for (let i = 0; i < chunks.length; i += 1) {
425
- const chunk = chunks[i];
426
- const chunkReplyToId = opts.replyToMode === "all" || i === 0 ? opts.replyToId : void 0;
427
- await sendTelegramText(opts.bot, opts.chatId, chunk.html, opts.runtime, {
428
- replyToMessageId: chunkReplyToId,
429
- replyQuoteText: opts.replyQuoteText,
430
- thread: opts.thread,
431
- textMode: "html",
432
- plainText: chunk.text,
433
- linkPreview: opts.linkPreview,
434
- replyMarkup: i === 0 ? opts.replyMarkup : void 0
435
- });
436
- }
437
- }
438
- function buildTelegramSendParams(opts) {
439
- const threadParams = buildTelegramThreadParams(opts?.thread);
440
- const params = {};
441
- if (opts?.replyToMessageId) params.reply_to_message_id = opts.replyToMessageId;
442
- if (threadParams) params.message_thread_id = threadParams.message_thread_id;
443
- return params;
444
- }
445
- async function sendTelegramText(bot, chatId, text, runtime, opts) {
446
- const baseParams = buildTelegramSendParams({
447
- replyToMessageId: opts?.replyToMessageId,
448
- thread: opts?.thread
449
- });
450
- const linkPreviewOptions = opts?.linkPreview ?? true ? void 0 : { is_disabled: true };
451
- const htmlText = (opts?.textMode ?? "markdown") === "html" ? text : markdownToTelegramHtml(text);
452
- const fallbackText = opts?.plainText ?? text;
453
- const hasFallbackText = fallbackText.trim().length > 0;
454
- const sendPlainFallback = async () => {
455
- const res = await withTelegramApiErrorLogging({
456
- operation: "sendMessage",
457
- runtime,
458
- fn: () => bot.api.sendMessage(chatId, fallbackText, {
459
- ...linkPreviewOptions ? { link_preview_options: linkPreviewOptions } : {},
460
- ...opts?.replyMarkup ? { reply_markup: opts.replyMarkup } : {},
461
- ...baseParams
462
- })
463
- });
464
- runtime.log?.(`telegram sendMessage ok chat=${chatId} message=${res.message_id} (plain)`);
465
- return res.message_id;
466
- };
467
- if (!htmlText.trim()) {
468
- if (!hasFallbackText) throw new Error("telegram sendMessage failed: empty formatted text and empty plain fallback");
469
- return await sendPlainFallback();
470
- }
471
- try {
472
- const res = await withTelegramApiErrorLogging({
473
- operation: "sendMessage",
474
- runtime,
475
- shouldLog: (err) => {
476
- const errText = formatErrorMessage(err);
477
- return !PARSE_ERR_RE.test(errText) && !EMPTY_TEXT_ERR_RE.test(errText);
478
- },
479
- fn: () => bot.api.sendMessage(chatId, htmlText, {
480
- parse_mode: "HTML",
481
- ...linkPreviewOptions ? { link_preview_options: linkPreviewOptions } : {},
482
- ...opts?.replyMarkup ? { reply_markup: opts.replyMarkup } : {},
483
- ...baseParams
484
- })
485
- });
486
- runtime.log?.(`telegram sendMessage ok chat=${chatId} message=${res.message_id}`);
487
- return res.message_id;
488
- } catch (err) {
489
- const errText = formatErrorMessage(err);
490
- if (PARSE_ERR_RE.test(errText) || EMPTY_TEXT_ERR_RE.test(errText)) {
491
- if (!hasFallbackText) throw err;
492
- runtime.log?.(`telegram formatted send failed; retrying without formatting: ${errText}`);
493
- return await sendPlainFallback();
494
- }
495
- throw err;
496
- }
497
- }
498
-
499
- //#endregion
500
- //#region src/telegram/dm-access.ts
501
- function resolveTelegramSenderIdentity(msg, chatId) {
502
- const from = msg.from;
503
- const userId = from?.id != null ? String(from.id) : null;
504
- return {
505
- username: from?.username ?? "",
506
- userId,
507
- candidateId: userId ?? String(chatId),
508
- firstName: from?.first_name,
509
- lastName: from?.last_name
510
- };
511
- }
512
- async function enforceTelegramDmAccess(params) {
513
- const { isGroup, dmPolicy, msg, chatId, effectiveDmAllow, accountId, bot, logger } = params;
514
- if (isGroup) return true;
515
- if (dmPolicy === "disabled") return false;
516
- if (dmPolicy === "open") return true;
517
- const sender = resolveTelegramSenderIdentity(msg, chatId);
518
- const allowMatch = resolveSenderAllowMatch({
519
- allow: effectiveDmAllow,
520
- senderId: sender.candidateId,
521
- senderUsername: sender.username
522
- });
523
- const allowMatchMeta = `matchKey=${allowMatch.matchKey ?? "none"} matchSource=${allowMatch.matchSource ?? "none"}`;
524
- if (effectiveDmAllow.hasWildcard || effectiveDmAllow.hasEntries && allowMatch.allowed) return true;
525
- if (dmPolicy === "pairing") {
526
- try {
527
- const telegramUserId = sender.userId ?? sender.candidateId;
528
- const { code, created } = await upsertChannelPairingRequest({
529
- channel: "telegram",
530
- id: telegramUserId,
531
- accountId,
532
- meta: {
533
- username: sender.username || void 0,
534
- firstName: sender.firstName,
535
- lastName: sender.lastName
536
- }
537
- });
538
- if (created) {
539
- logger.info({
540
- chatId: String(chatId),
541
- senderUserId: sender.userId ?? void 0,
542
- username: sender.username || void 0,
543
- firstName: sender.firstName,
544
- lastName: sender.lastName,
545
- matchKey: allowMatch.matchKey ?? "none",
546
- matchSource: allowMatch.matchSource ?? "none"
547
- }, "telegram pairing request");
548
- await withTelegramApiErrorLogging({
549
- operation: "sendMessage",
550
- fn: () => bot.api.sendMessage(chatId, buildPairingReply({
551
- channel: "telegram",
552
- idLine: `Your Telegram user id: ${telegramUserId}`,
553
- code
554
- }))
555
- });
556
- }
557
- } catch (err) {
558
- logVerbose(`telegram pairing reply failed for chat ${chatId}: ${String(err)}`);
559
- }
560
- return false;
561
- }
562
- logVerbose(`Blocked unauthorized telegram sender ${sender.candidateId} (dmPolicy=${dmPolicy}, ${allowMatchMeta})`);
563
- return false;
564
- }
565
-
566
- //#endregion
567
- //#region src/telegram/group-access.ts
568
- const evaluateTelegramGroupBaseAccess = (params) => {
569
- if (!params.isGroup) return { allowed: true };
570
- if (params.groupConfig?.enabled === false) return {
571
- allowed: false,
572
- reason: "group-disabled"
573
- };
574
- if (params.topicConfig?.enabled === false) return {
575
- allowed: false,
576
- reason: "topic-disabled"
577
- };
578
- if (!params.enforceAllowOverride || !params.hasGroupAllowOverride) return { allowed: true };
579
- if (!params.effectiveGroupAllow.hasEntries) return {
580
- allowed: false,
581
- reason: "group-override-unauthorized"
582
- };
583
- const senderId = params.senderId ?? "";
584
- if (params.requireSenderForAllowOverride && !senderId) return {
585
- allowed: false,
586
- reason: "group-override-unauthorized"
587
- };
588
- if (!isSenderAllowed({
589
- allow: params.effectiveGroupAllow,
590
- senderId,
591
- senderUsername: params.senderUsername ?? ""
592
- })) return {
593
- allowed: false,
594
- reason: "group-override-unauthorized"
595
- };
596
- return { allowed: true };
597
- };
598
- const resolveTelegramRuntimeGroupPolicy = (params) => resolveOpenProviderRuntimeGroupPolicy({
599
- providerConfigPresent: params.providerConfigPresent,
600
- groupPolicy: params.groupPolicy,
601
- defaultGroupPolicy: params.defaultGroupPolicy
602
- });
603
- const evaluateTelegramGroupPolicyAccess = (params) => {
604
- const { groupPolicy: runtimeFallbackPolicy } = resolveTelegramRuntimeGroupPolicy({
605
- providerConfigPresent: params.cfg.channels?.telegram !== void 0,
606
- groupPolicy: params.telegramCfg.groupPolicy,
607
- defaultGroupPolicy: params.cfg.channels?.defaults?.groupPolicy
608
- });
609
- const fallbackPolicy = firstDefined(params.telegramCfg.groupPolicy, params.cfg.channels?.defaults?.groupPolicy) ?? runtimeFallbackPolicy;
610
- const groupPolicy = params.useTopicAndGroupOverrides ? firstDefined(params.topicConfig?.groupPolicy, params.groupConfig?.groupPolicy, params.telegramCfg.groupPolicy, params.cfg.channels?.defaults?.groupPolicy) ?? runtimeFallbackPolicy : fallbackPolicy;
611
- if (!params.isGroup || !params.enforcePolicy) return {
612
- allowed: true,
613
- groupPolicy
614
- };
615
- if (groupPolicy === "disabled") return {
616
- allowed: false,
617
- reason: "group-policy-disabled",
618
- groupPolicy
619
- };
620
- if (groupPolicy === "allowlist" && params.enforceAllowlistAuthorization) {
621
- const senderId = params.senderId ?? "";
622
- if (params.requireSenderForAllowlistAuthorization && !senderId) return {
623
- allowed: false,
624
- reason: "group-policy-allowlist-no-sender",
625
- groupPolicy
626
- };
627
- if (!params.allowEmptyAllowlistEntries && !params.effectiveGroupAllow.hasEntries) return {
628
- allowed: false,
629
- reason: "group-policy-allowlist-empty",
630
- groupPolicy
631
- };
632
- const senderUsername = params.senderUsername ?? "";
633
- if (!isSenderAllowed({
634
- allow: params.effectiveGroupAllow,
635
- senderId,
636
- senderUsername
637
- })) return {
638
- allowed: false,
639
- reason: "group-policy-allowlist-unauthorized",
640
- groupPolicy
641
- };
642
- }
643
- if (params.checkChatAllowlist) {
644
- const groupAllowlist = params.resolveGroupPolicy(params.chatId);
645
- if (groupAllowlist.allowlistEnabled && !groupAllowlist.allowed) return {
646
- allowed: false,
647
- reason: "group-chat-not-allowed",
648
- groupPolicy
649
- };
650
- }
651
- return {
652
- allowed: true,
653
- groupPolicy
654
- };
655
- };
656
-
657
- //#endregion
658
- //#region src/telegram/group-migration.ts
659
- function resolveAccountGroups(cfg, accountId) {
660
- if (!accountId) return {};
661
- const normalized = normalizeAccountId$1(accountId);
662
- const accounts = cfg.channels?.telegram?.accounts;
663
- if (!accounts || typeof accounts !== "object") return {};
664
- const exact = accounts[normalized];
665
- if (exact?.groups) return { groups: exact.groups };
666
- const matchKey = Object.keys(accounts).find((key) => key.toLowerCase() === normalized.toLowerCase());
667
- return { groups: matchKey ? accounts[matchKey]?.groups : void 0 };
668
- }
669
- function migrateTelegramGroupsInPlace(groups, oldChatId, newChatId) {
670
- if (!groups) return {
671
- migrated: false,
672
- skippedExisting: false
673
- };
674
- if (oldChatId === newChatId) return {
675
- migrated: false,
676
- skippedExisting: false
677
- };
678
- if (!Object.hasOwn(groups, oldChatId)) return {
679
- migrated: false,
680
- skippedExisting: false
681
- };
682
- if (Object.hasOwn(groups, newChatId)) return {
683
- migrated: false,
684
- skippedExisting: true
685
- };
686
- groups[newChatId] = groups[oldChatId];
687
- delete groups[oldChatId];
688
- return {
689
- migrated: true,
690
- skippedExisting: false
691
- };
692
- }
693
- function migrateTelegramGroupConfig(params) {
694
- const scopes = [];
695
- let migrated = false;
696
- let skippedExisting = false;
697
- const migrationTargets = [{
698
- scope: "account",
699
- groups: resolveAccountGroups(params.cfg, params.accountId).groups
700
- }, {
701
- scope: "global",
702
- groups: params.cfg.channels?.telegram?.groups
703
- }];
704
- for (const target of migrationTargets) {
705
- const result = migrateTelegramGroupsInPlace(target.groups, params.oldChatId, params.newChatId);
706
- if (result.migrated) {
707
- migrated = true;
708
- scopes.push(target.scope);
709
- }
710
- if (result.skippedExisting) skippedExisting = true;
711
- }
712
- return {
713
- migrated,
714
- skippedExisting,
715
- scopes
716
- };
717
- }
718
-
719
- //#endregion
720
- //#region src/telegram/bot-handlers.ts
721
- function isMediaSizeLimitError(err) {
722
- const errMsg = String(err);
723
- return errMsg.includes("exceeds") && errMsg.includes("MB limit");
724
- }
725
- function isRecoverableMediaGroupError(err) {
726
- return err instanceof MediaFetchError || isMediaSizeLimitError(err);
727
- }
728
- function hasInboundMedia(msg) {
729
- return Boolean(msg.media_group_id) || Array.isArray(msg.photo) && msg.photo.length > 0 || Boolean(msg.video ?? msg.video_note ?? msg.document ?? msg.audio ?? msg.voice ?? msg.sticker);
730
- }
731
- function hasReplyTargetMedia(msg) {
732
- const externalReply = msg.external_reply;
733
- const replyTarget = msg.reply_to_message ?? externalReply;
734
- return Boolean(replyTarget && hasInboundMedia(replyTarget));
735
- }
736
- function resolveInboundMediaFileId(msg) {
737
- return msg.sticker?.file_id ?? msg.photo?.[msg.photo.length - 1]?.file_id ?? msg.video?.file_id ?? msg.video_note?.file_id ?? msg.document?.file_id ?? msg.audio?.file_id ?? msg.voice?.file_id;
738
- }
739
- const registerTelegramHandlers = ({ cfg, accountId, bot, opts, runtime, mediaMaxBytes, telegramCfg, allowFrom, groupAllowFrom, resolveGroupPolicy, resolveTelegramGroupConfig, shouldSkipUpdate, processMessage, logger }) => {
740
- const DEFAULT_TEXT_FRAGMENT_MAX_GAP_MS = 1500;
741
- const TELEGRAM_TEXT_FRAGMENT_START_THRESHOLD_CHARS = 4e3;
742
- const TELEGRAM_TEXT_FRAGMENT_MAX_GAP_MS = typeof opts.testTimings?.textFragmentGapMs === "number" && Number.isFinite(opts.testTimings.textFragmentGapMs) ? Math.max(10, Math.floor(opts.testTimings.textFragmentGapMs)) : DEFAULT_TEXT_FRAGMENT_MAX_GAP_MS;
743
- const TELEGRAM_TEXT_FRAGMENT_MAX_ID_GAP = 1;
744
- const TELEGRAM_TEXT_FRAGMENT_MAX_PARTS = 12;
745
- const TELEGRAM_TEXT_FRAGMENT_MAX_TOTAL_CHARS = 5e4;
746
- const mediaGroupTimeoutMs = typeof opts.testTimings?.mediaGroupFlushMs === "number" && Number.isFinite(opts.testTimings.mediaGroupFlushMs) ? Math.max(10, Math.floor(opts.testTimings.mediaGroupFlushMs)) : MEDIA_GROUP_TIMEOUT_MS;
747
- const mediaGroupBuffer = /* @__PURE__ */ new Map();
748
- let mediaGroupProcessing = Promise.resolve();
749
- const textFragmentBuffer = /* @__PURE__ */ new Map();
750
- let textFragmentProcessing = Promise.resolve();
751
- const debounceMs = resolveInboundDebounceMs({
752
- cfg,
753
- channel: "telegram"
754
- });
755
- const FORWARD_BURST_DEBOUNCE_MS = 80;
756
- const resolveTelegramDebounceLane = (msg) => {
757
- const forwardMeta = msg;
758
- return forwardMeta.forward_origin ?? forwardMeta.forward_from ?? forwardMeta.forward_from_chat ?? forwardMeta.forward_sender_name ?? forwardMeta.forward_date ? "forward" : "default";
759
- };
760
- const buildSyntheticTextMessage = (params) => ({
761
- ...params.base,
762
- ...params.from ? { from: params.from } : {},
763
- text: params.text,
764
- caption: void 0,
765
- caption_entities: void 0,
766
- entities: void 0,
767
- ...params.date != null ? { date: params.date } : {}
768
- });
769
- const buildSyntheticContext = (ctx, message) => {
770
- const getFile = typeof ctx.getFile === "function" ? ctx.getFile.bind(ctx) : async () => ({});
771
- return {
772
- message,
773
- me: ctx.me,
774
- getFile
775
- };
776
- };
777
- const inboundDebouncer = createInboundDebouncer({
778
- debounceMs,
779
- resolveDebounceMs: (entry) => entry.debounceLane === "forward" ? FORWARD_BURST_DEBOUNCE_MS : debounceMs,
780
- buildKey: (entry) => entry.debounceKey,
781
- shouldDebounce: (entry) => {
782
- const text = entry.msg.text ?? entry.msg.caption ?? "";
783
- const hasText = text.trim().length > 0;
784
- if (hasText && hasControlCommand(text, cfg, { botUsername: entry.botUsername })) return false;
785
- if (entry.debounceLane === "forward") return true;
786
- return entry.allMedia.length === 0 && hasText;
787
- },
788
- onFlush: async (entries) => {
789
- const last = entries.at(-1);
790
- if (!last) return;
791
- if (entries.length === 1) {
792
- const replyMedia = await resolveReplyMediaForMessage(last.ctx, last.msg);
793
- await processMessage(last.ctx, last.allMedia, last.storeAllowFrom, void 0, replyMedia);
794
- return;
795
- }
796
- const combinedText = entries.map((entry) => entry.msg.text ?? entry.msg.caption ?? "").filter(Boolean).join("\n");
797
- const combinedMedia = entries.flatMap((entry) => entry.allMedia);
798
- if (!combinedText.trim() && combinedMedia.length === 0) return;
799
- const first = entries[0];
800
- const baseCtx = first.ctx;
801
- const syntheticMessage = buildSyntheticTextMessage({
802
- base: first.msg,
803
- text: combinedText,
804
- date: last.msg.date ?? first.msg.date
805
- });
806
- const messageIdOverride = last.msg.message_id ? String(last.msg.message_id) : void 0;
807
- const syntheticCtx = buildSyntheticContext(baseCtx, syntheticMessage);
808
- const replyMedia = await resolveReplyMediaForMessage(baseCtx, syntheticMessage);
809
- await processMessage(syntheticCtx, combinedMedia, first.storeAllowFrom, messageIdOverride ? { messageIdOverride } : void 0, replyMedia);
810
- },
811
- onError: (err) => {
812
- runtime.error?.(danger(`telegram debounce flush failed: ${String(err)}`));
813
- }
814
- });
815
- const resolveTelegramSessionState = (params) => {
816
- const resolvedThreadId = params.resolvedThreadId ?? resolveTelegramForumThreadId({
817
- isForum: params.isForum,
818
- messageThreadId: params.messageThreadId
819
- });
820
- const peerId = params.isGroup ? buildTelegramGroupPeerId(params.chatId, resolvedThreadId) : String(params.chatId);
821
- const parentPeer = buildTelegramParentPeer({
822
- isGroup: params.isGroup,
823
- resolvedThreadId,
824
- chatId: params.chatId
825
- });
826
- const route = resolveAgentRoute({
827
- cfg,
828
- channel: "telegram",
829
- accountId,
830
- peer: {
831
- kind: params.isGroup ? "group" : "direct",
832
- id: peerId
833
- },
834
- parentPeer
835
- });
836
- const baseSessionKey = route.sessionKey;
837
- const dmThreadId = !params.isGroup ? params.messageThreadId : void 0;
838
- const sessionKey = (dmThreadId != null ? resolveThreadSessionKeys({
839
- baseSessionKey,
840
- threadId: String(dmThreadId)
841
- }) : null)?.sessionKey ?? baseSessionKey;
842
- const store = loadSessionStore(resolveStorePath(cfg.session?.store, { agentId: route.agentId }));
843
- const entry = store[sessionKey];
844
- const storedOverride = resolveStoredModelOverride({
845
- sessionEntry: entry,
846
- sessionStore: store,
847
- sessionKey
848
- });
849
- if (storedOverride) return {
850
- agentId: route.agentId,
851
- sessionEntry: entry,
852
- model: storedOverride.provider ? `${storedOverride.provider}/${storedOverride.model}` : storedOverride.model
853
- };
854
- const provider = entry?.modelProvider?.trim();
855
- const model = entry?.model?.trim();
856
- if (provider && model) return {
857
- agentId: route.agentId,
858
- sessionEntry: entry,
859
- model: `${provider}/${model}`
860
- };
861
- const modelCfg = cfg.agents?.defaults?.model;
862
- return {
863
- agentId: route.agentId,
864
- sessionEntry: entry,
865
- model: typeof modelCfg === "string" ? modelCfg : modelCfg?.primary
866
- };
867
- };
868
- const processMediaGroup = async (entry) => {
869
- try {
870
- entry.messages.sort((a, b) => a.msg.message_id - b.msg.message_id);
871
- const primaryEntry = entry.messages.find((m) => m.msg.caption || m.msg.text) ?? entry.messages[0];
872
- const allMedia = [];
873
- for (const { ctx } of entry.messages) {
874
- let media;
875
- try {
876
- media = await resolveMedia(ctx, mediaMaxBytes, opts.token, opts.proxyFetch);
877
- } catch (mediaErr) {
878
- if (!isRecoverableMediaGroupError(mediaErr)) throw mediaErr;
879
- runtime.log?.(warn(`media group: skipping photo that failed to fetch: ${String(mediaErr)}`));
880
- continue;
881
- }
882
- if (media) allMedia.push({
883
- path: media.path,
884
- contentType: media.contentType,
885
- stickerMetadata: media.stickerMetadata
886
- });
887
- }
888
- const storeAllowFrom = await loadStoreAllowFrom();
889
- const replyMedia = await resolveReplyMediaForMessage(primaryEntry.ctx, primaryEntry.msg);
890
- await processMessage(primaryEntry.ctx, allMedia, storeAllowFrom, void 0, replyMedia);
891
- } catch (err) {
892
- runtime.error?.(danger(`media group handler failed: ${String(err)}`));
893
- }
894
- };
895
- const flushTextFragments = async (entry) => {
896
- try {
897
- entry.messages.sort((a, b) => a.msg.message_id - b.msg.message_id);
898
- const first = entry.messages[0];
899
- const last = entry.messages.at(-1);
900
- if (!first || !last) return;
901
- const combinedText = entry.messages.map((m) => m.msg.text ?? "").join("");
902
- if (!combinedText.trim()) return;
903
- const syntheticMessage = buildSyntheticTextMessage({
904
- base: first.msg,
905
- text: combinedText,
906
- date: last.msg.date ?? first.msg.date
907
- });
908
- const storeAllowFrom = await loadStoreAllowFrom();
909
- const baseCtx = first.ctx;
910
- await processMessage(buildSyntheticContext(baseCtx, syntheticMessage), [], storeAllowFrom, { messageIdOverride: String(last.msg.message_id) });
911
- } catch (err) {
912
- runtime.error?.(danger(`text fragment handler failed: ${String(err)}`));
913
- }
914
- };
915
- const queueTextFragmentFlush = async (entry) => {
916
- textFragmentProcessing = textFragmentProcessing.then(async () => {
917
- await flushTextFragments(entry);
918
- }).catch(() => void 0);
919
- await textFragmentProcessing;
920
- };
921
- const runTextFragmentFlush = async (entry) => {
922
- textFragmentBuffer.delete(entry.key);
923
- await queueTextFragmentFlush(entry);
924
- };
925
- const scheduleTextFragmentFlush = (entry) => {
926
- clearTimeout(entry.timer);
927
- entry.timer = setTimeout(async () => {
928
- await runTextFragmentFlush(entry);
929
- }, TELEGRAM_TEXT_FRAGMENT_MAX_GAP_MS);
930
- };
931
- const loadStoreAllowFrom = async () => readChannelAllowFromStore("telegram", process.env, accountId).catch(() => []);
932
- const resolveReplyMediaForMessage = async (ctx, msg) => {
933
- const replyMessage = msg.reply_to_message;
934
- if (!replyMessage || !hasInboundMedia(replyMessage)) return [];
935
- const replyFileId = resolveInboundMediaFileId(replyMessage);
936
- if (!replyFileId) return [];
937
- try {
938
- const media = await resolveMedia({
939
- message: replyMessage,
940
- me: ctx.me,
941
- getFile: async () => await bot.api.getFile(replyFileId)
942
- }, mediaMaxBytes, opts.token, opts.proxyFetch);
943
- if (!media) return [];
944
- return [{
945
- path: media.path,
946
- contentType: media.contentType,
947
- stickerMetadata: media.stickerMetadata
948
- }];
949
- } catch (err) {
950
- logger.warn({
951
- chatId: msg.chat.id,
952
- error: String(err)
953
- }, "reply media fetch failed");
954
- return [];
955
- }
956
- };
957
- const isAllowlistAuthorized = (allow, senderId, senderUsername) => allow.hasWildcard || allow.hasEntries && isSenderAllowed({
958
- allow,
959
- senderId,
960
- senderUsername
961
- });
962
- const shouldSkipGroupMessage = (params) => {
963
- const { isGroup, chatId, chatTitle, resolvedThreadId, senderId, senderUsername, effectiveGroupAllow, hasGroupAllowOverride, groupConfig, topicConfig } = params;
964
- const baseAccess = evaluateTelegramGroupBaseAccess({
965
- isGroup,
966
- groupConfig,
967
- topicConfig,
968
- hasGroupAllowOverride,
969
- effectiveGroupAllow,
970
- senderId,
971
- senderUsername,
972
- enforceAllowOverride: true,
973
- requireSenderForAllowOverride: true
974
- });
975
- if (!baseAccess.allowed) {
976
- if (baseAccess.reason === "group-disabled") {
977
- logVerbose(`Blocked telegram group ${chatId} (group disabled)`);
978
- return true;
979
- }
980
- if (baseAccess.reason === "topic-disabled") {
981
- logVerbose(`Blocked telegram topic ${chatId} (${resolvedThreadId ?? "unknown"}) (topic disabled)`);
982
- return true;
983
- }
984
- logVerbose(`Blocked telegram group sender ${senderId || "unknown"} (group allowFrom override)`);
985
- return true;
986
- }
987
- if (!isGroup) return false;
988
- const policyAccess = evaluateTelegramGroupPolicyAccess({
989
- isGroup,
990
- chatId,
991
- cfg,
992
- telegramCfg,
993
- topicConfig,
994
- groupConfig,
995
- effectiveGroupAllow,
996
- senderId,
997
- senderUsername,
998
- resolveGroupPolicy,
999
- enforcePolicy: true,
1000
- useTopicAndGroupOverrides: true,
1001
- enforceAllowlistAuthorization: true,
1002
- allowEmptyAllowlistEntries: false,
1003
- requireSenderForAllowlistAuthorization: true,
1004
- checkChatAllowlist: true
1005
- });
1006
- if (!policyAccess.allowed) {
1007
- if (policyAccess.reason === "group-policy-disabled") {
1008
- logVerbose("Blocked telegram group message (groupPolicy: disabled)");
1009
- return true;
1010
- }
1011
- if (policyAccess.reason === "group-policy-allowlist-no-sender") {
1012
- logVerbose("Blocked telegram group message (no sender ID, groupPolicy: allowlist)");
1013
- return true;
1014
- }
1015
- if (policyAccess.reason === "group-policy-allowlist-empty") {
1016
- logVerbose("Blocked telegram group message (groupPolicy: allowlist, no group allowlist entries)");
1017
- return true;
1018
- }
1019
- if (policyAccess.reason === "group-policy-allowlist-unauthorized") {
1020
- logVerbose(`Blocked telegram group message from ${senderId} (groupPolicy: allowlist)`);
1021
- return true;
1022
- }
1023
- logger.info({
1024
- chatId,
1025
- title: chatTitle,
1026
- reason: "not-allowed"
1027
- }, "skipping group message");
1028
- return true;
1029
- }
1030
- return false;
1031
- };
1032
- const TELEGRAM_EVENT_AUTH_RULES = {
1033
- reaction: {
1034
- enforceDirectAuthorization: true,
1035
- enforceGroupAllowlistAuthorization: false,
1036
- deniedDmReason: "reaction unauthorized by dm policy/allowlist",
1037
- deniedGroupReason: "reaction unauthorized by group allowlist"
1038
- },
1039
- "callback-scope": {
1040
- enforceDirectAuthorization: false,
1041
- enforceGroupAllowlistAuthorization: false,
1042
- deniedDmReason: "callback unauthorized by inlineButtonsScope",
1043
- deniedGroupReason: "callback unauthorized by inlineButtonsScope"
1044
- },
1045
- "callback-allowlist": {
1046
- enforceDirectAuthorization: true,
1047
- enforceGroupAllowlistAuthorization: false,
1048
- deniedDmReason: "callback unauthorized by inlineButtonsScope allowlist",
1049
- deniedGroupReason: "callback unauthorized by inlineButtonsScope allowlist"
1050
- }
1051
- };
1052
- const resolveTelegramEventAuthorizationContext = async (params) => {
1053
- return {
1054
- dmPolicy: telegramCfg.dmPolicy ?? "pairing",
1055
- ...params.groupAllowContext ?? await resolveTelegramGroupAllowFromContext({
1056
- chatId: params.chatId,
1057
- accountId,
1058
- isForum: params.isForum,
1059
- messageThreadId: params.messageThreadId,
1060
- groupAllowFrom,
1061
- resolveTelegramGroupConfig
1062
- })
1063
- };
1064
- };
1065
- const authorizeTelegramEventSender = (params) => {
1066
- const { chatId, chatTitle, isGroup, senderId, senderUsername, mode, context } = params;
1067
- const { dmPolicy, resolvedThreadId, storeAllowFrom, groupConfig, topicConfig, effectiveGroupAllow, hasGroupAllowOverride } = context;
1068
- const { enforceDirectAuthorization, enforceGroupAllowlistAuthorization, deniedDmReason, deniedGroupReason } = TELEGRAM_EVENT_AUTH_RULES[mode];
1069
- if (shouldSkipGroupMessage({
1070
- isGroup,
1071
- chatId,
1072
- chatTitle,
1073
- resolvedThreadId,
1074
- senderId,
1075
- senderUsername,
1076
- effectiveGroupAllow,
1077
- hasGroupAllowOverride,
1078
- groupConfig,
1079
- topicConfig
1080
- })) return {
1081
- allowed: false,
1082
- reason: "group-policy"
1083
- };
1084
- if (!isGroup && enforceDirectAuthorization) {
1085
- if (dmPolicy === "disabled") {
1086
- logVerbose(`Blocked telegram direct event from ${senderId || "unknown"} (${deniedDmReason})`);
1087
- return {
1088
- allowed: false,
1089
- reason: "direct-disabled"
1090
- };
1091
- }
1092
- if (dmPolicy !== "open") {
1093
- if (!isAllowlistAuthorized(normalizeDmAllowFromWithStore({
1094
- allowFrom,
1095
- storeAllowFrom,
1096
- dmPolicy
1097
- }), senderId, senderUsername)) {
1098
- logVerbose(`Blocked telegram direct sender ${senderId || "unknown"} (${deniedDmReason})`);
1099
- return {
1100
- allowed: false,
1101
- reason: "direct-unauthorized"
1102
- };
1103
- }
1104
- }
1105
- }
1106
- if (isGroup && enforceGroupAllowlistAuthorization) {
1107
- if (!isAllowlistAuthorized(effectiveGroupAllow, senderId, senderUsername)) {
1108
- logVerbose(`Blocked telegram group sender ${senderId || "unknown"} (${deniedGroupReason})`);
1109
- return {
1110
- allowed: false,
1111
- reason: "group-unauthorized"
1112
- };
1113
- }
1114
- }
1115
- return { allowed: true };
1116
- };
1117
- bot.on("message_reaction", async (ctx) => {
1118
- try {
1119
- const reaction = ctx.messageReaction;
1120
- if (!reaction) return;
1121
- if (shouldSkipUpdate(ctx)) return;
1122
- const chatId = reaction.chat.id;
1123
- const messageId = reaction.message_id;
1124
- const user = reaction.user;
1125
- const senderId = user?.id != null ? String(user.id) : "";
1126
- const senderUsername = user?.username ?? "";
1127
- const isGroup = reaction.chat.type === "group" || reaction.chat.type === "supergroup";
1128
- const isForum = reaction.chat.is_forum === true;
1129
- const reactionMode = telegramCfg.reactionNotifications ?? "own";
1130
- if (reactionMode === "off") return;
1131
- if (user?.is_bot) return;
1132
- if (reactionMode === "own" && !wasSentByBot(chatId, messageId)) return;
1133
- const eventAuthContext = await resolveTelegramEventAuthorizationContext({
1134
- chatId,
1135
- isForum
1136
- });
1137
- if (!authorizeTelegramEventSender({
1138
- chatId,
1139
- chatTitle: reaction.chat.title,
1140
- isGroup,
1141
- senderId,
1142
- senderUsername,
1143
- mode: "reaction",
1144
- context: eventAuthContext
1145
- }).allowed) return;
1146
- const oldEmojis = new Set(reaction.old_reaction.filter((r) => r.type === "emoji").map((r) => r.emoji));
1147
- const addedReactions = reaction.new_reaction.filter((r) => r.type === "emoji").filter((r) => !oldEmojis.has(r.emoji));
1148
- if (addedReactions.length === 0) return;
1149
- const senderName = user ? [user.first_name, user.last_name].filter(Boolean).join(" ").trim() || user.username : void 0;
1150
- const senderUsernameLabel = user?.username ? `@${user.username}` : void 0;
1151
- let senderLabel = senderName;
1152
- if (senderName && senderUsernameLabel) senderLabel = `${senderName} (${senderUsernameLabel})`;
1153
- else if (!senderName && senderUsernameLabel) senderLabel = senderUsernameLabel;
1154
- if (!senderLabel && user?.id) senderLabel = `id:${user.id}`;
1155
- senderLabel = senderLabel || "unknown";
1156
- const resolvedThreadId = isForum ? resolveTelegramForumThreadId({
1157
- isForum,
1158
- messageThreadId: void 0
1159
- }) : void 0;
1160
- const peerId = isGroup ? buildTelegramGroupPeerId(chatId, resolvedThreadId) : String(chatId);
1161
- const parentPeer = buildTelegramParentPeer({
1162
- isGroup,
1163
- resolvedThreadId,
1164
- chatId
1165
- });
1166
- const sessionKey = resolveAgentRoute({
1167
- cfg: loadConfig(),
1168
- channel: "telegram",
1169
- accountId,
1170
- peer: {
1171
- kind: isGroup ? "group" : "direct",
1172
- id: peerId
1173
- },
1174
- parentPeer
1175
- }).sessionKey;
1176
- for (const r of addedReactions) {
1177
- const emoji = r.emoji;
1178
- const text = `Telegram reaction added: ${emoji} by ${senderLabel} on msg ${messageId}`;
1179
- enqueueSystemEvent(text, {
1180
- sessionKey,
1181
- contextKey: `telegram:reaction:add:${chatId}:${messageId}:${user?.id ?? "anon"}:${emoji}`
1182
- });
1183
- logVerbose(`telegram: reaction event enqueued: ${text}`);
1184
- }
1185
- } catch (err) {
1186
- runtime.error?.(danger(`telegram reaction handler failed: ${String(err)}`));
1187
- }
1188
- });
1189
- const processInboundMessage = async (params) => {
1190
- const { ctx, msg, chatId, resolvedThreadId, storeAllowFrom, sendOversizeWarning, oversizeLogMessage } = params;
1191
- const text = typeof msg.text === "string" ? msg.text : void 0;
1192
- const isCommandLike = (text ?? "").trim().startsWith("/");
1193
- if (text && !isCommandLike) {
1194
- const nowMs = Date.now();
1195
- const senderId = msg.from?.id != null ? String(msg.from.id) : "unknown";
1196
- const key = `text:${chatId}:${resolvedThreadId ?? "main"}:${senderId}`;
1197
- const existing = textFragmentBuffer.get(key);
1198
- if (existing) {
1199
- const last = existing.messages.at(-1);
1200
- const lastMsgId = last?.msg.message_id;
1201
- const lastReceivedAtMs = last?.receivedAtMs ?? nowMs;
1202
- const idGap = typeof lastMsgId === "number" ? msg.message_id - lastMsgId : Infinity;
1203
- const timeGapMs = nowMs - lastReceivedAtMs;
1204
- if (idGap > 0 && idGap <= TELEGRAM_TEXT_FRAGMENT_MAX_ID_GAP && timeGapMs >= 0 && timeGapMs <= TELEGRAM_TEXT_FRAGMENT_MAX_GAP_MS) {
1205
- const nextTotalChars = existing.messages.reduce((sum, m) => sum + (m.msg.text?.length ?? 0), 0) + text.length;
1206
- if (existing.messages.length + 1 <= TELEGRAM_TEXT_FRAGMENT_MAX_PARTS && nextTotalChars <= TELEGRAM_TEXT_FRAGMENT_MAX_TOTAL_CHARS) {
1207
- existing.messages.push({
1208
- msg,
1209
- ctx,
1210
- receivedAtMs: nowMs
1211
- });
1212
- scheduleTextFragmentFlush(existing);
1213
- return;
1214
- }
1215
- }
1216
- clearTimeout(existing.timer);
1217
- textFragmentBuffer.delete(key);
1218
- textFragmentProcessing = textFragmentProcessing.then(async () => {
1219
- await flushTextFragments(existing);
1220
- }).catch(() => void 0);
1221
- await textFragmentProcessing;
1222
- }
1223
- if (text.length >= TELEGRAM_TEXT_FRAGMENT_START_THRESHOLD_CHARS) {
1224
- const entry = {
1225
- key,
1226
- messages: [{
1227
- msg,
1228
- ctx,
1229
- receivedAtMs: nowMs
1230
- }],
1231
- timer: setTimeout(() => {}, TELEGRAM_TEXT_FRAGMENT_MAX_GAP_MS)
1232
- };
1233
- textFragmentBuffer.set(key, entry);
1234
- scheduleTextFragmentFlush(entry);
1235
- return;
1236
- }
1237
- }
1238
- const mediaGroupId = msg.media_group_id;
1239
- if (mediaGroupId) {
1240
- const existing = mediaGroupBuffer.get(mediaGroupId);
1241
- if (existing) {
1242
- clearTimeout(existing.timer);
1243
- existing.messages.push({
1244
- msg,
1245
- ctx
1246
- });
1247
- existing.timer = setTimeout(async () => {
1248
- mediaGroupBuffer.delete(mediaGroupId);
1249
- mediaGroupProcessing = mediaGroupProcessing.then(async () => {
1250
- await processMediaGroup(existing);
1251
- }).catch(() => void 0);
1252
- await mediaGroupProcessing;
1253
- }, mediaGroupTimeoutMs);
1254
- } else {
1255
- const entry = {
1256
- messages: [{
1257
- msg,
1258
- ctx
1259
- }],
1260
- timer: setTimeout(async () => {
1261
- mediaGroupBuffer.delete(mediaGroupId);
1262
- mediaGroupProcessing = mediaGroupProcessing.then(async () => {
1263
- await processMediaGroup(entry);
1264
- }).catch(() => void 0);
1265
- await mediaGroupProcessing;
1266
- }, mediaGroupTimeoutMs)
1267
- };
1268
- mediaGroupBuffer.set(mediaGroupId, entry);
1269
- }
1270
- return;
1271
- }
1272
- let media = null;
1273
- try {
1274
- media = await resolveMedia(ctx, mediaMaxBytes, opts.token, opts.proxyFetch);
1275
- } catch (mediaErr) {
1276
- if (isMediaSizeLimitError(mediaErr)) {
1277
- if (sendOversizeWarning) {
1278
- const limitMb = Math.round(mediaMaxBytes / (1024 * 1024));
1279
- await withTelegramApiErrorLogging({
1280
- operation: "sendMessage",
1281
- runtime,
1282
- fn: () => bot.api.sendMessage(chatId, `⚠️ File too large. Maximum size is ${limitMb}MB.`, { reply_to_message_id: msg.message_id })
1283
- }).catch(() => {});
1284
- }
1285
- logger.warn({
1286
- chatId,
1287
- error: String(mediaErr)
1288
- }, oversizeLogMessage);
1289
- return;
1290
- }
1291
- logger.warn({
1292
- chatId,
1293
- error: String(mediaErr)
1294
- }, "media fetch failed");
1295
- await withTelegramApiErrorLogging({
1296
- operation: "sendMessage",
1297
- runtime,
1298
- fn: () => bot.api.sendMessage(chatId, "⚠️ Failed to download media. Please try again.", { reply_to_message_id: msg.message_id })
1299
- }).catch(() => {});
1300
- return;
1301
- }
1302
- const hasText = Boolean((msg.text ?? msg.caption ?? "").trim());
1303
- if (msg.sticker && !media && !hasText) {
1304
- logVerbose("telegram: skipping sticker-only message (unsupported sticker type)");
1305
- return;
1306
- }
1307
- const allMedia = media ? [{
1308
- path: media.path,
1309
- contentType: media.contentType,
1310
- stickerMetadata: media.stickerMetadata
1311
- }] : [];
1312
- const senderId = msg.from?.id ? String(msg.from.id) : "";
1313
- const conversationKey = resolvedThreadId != null ? `${chatId}:topic:${resolvedThreadId}` : String(chatId);
1314
- const debounceLane = resolveTelegramDebounceLane(msg);
1315
- const debounceKey = senderId ? `telegram:${accountId ?? "default"}:${conversationKey}:${senderId}:${debounceLane}` : null;
1316
- await inboundDebouncer.enqueue({
1317
- ctx,
1318
- msg,
1319
- allMedia,
1320
- storeAllowFrom,
1321
- debounceKey,
1322
- debounceLane,
1323
- botUsername: ctx.me?.username
1324
- });
1325
- };
1326
- bot.on("callback_query", async (ctx) => {
1327
- const callback = ctx.callbackQuery;
1328
- if (!callback) return;
1329
- if (shouldSkipUpdate(ctx)) return;
1330
- await withTelegramApiErrorLogging({
1331
- operation: "answerCallbackQuery",
1332
- runtime,
1333
- fn: typeof ctx.answerCallbackQuery === "function" ? () => ctx.answerCallbackQuery() : () => bot.api.answerCallbackQuery(callback.id)
1334
- }).catch(() => {});
1335
- try {
1336
- const data = (callback.data ?? "").trim();
1337
- const callbackMessage = callback.message;
1338
- if (!data || !callbackMessage) return;
1339
- const editCallbackMessage = async (text, params) => {
1340
- if (typeof ctx.editMessageText === "function") return await ctx.editMessageText(text, params);
1341
- return await bot.api.editMessageText(callbackMessage.chat.id, callbackMessage.message_id, text, params);
1342
- };
1343
- const deleteCallbackMessage = async () => {
1344
- if (typeof ctx.deleteMessage === "function") return await ctx.deleteMessage();
1345
- return await bot.api.deleteMessage(callbackMessage.chat.id, callbackMessage.message_id);
1346
- };
1347
- const replyToCallbackChat = async (text, params) => {
1348
- if (typeof ctx.reply === "function") return await ctx.reply(text, params);
1349
- return await bot.api.sendMessage(callbackMessage.chat.id, text, params);
1350
- };
1351
- const inlineButtonsScope = resolveTelegramInlineButtonsScope({
1352
- cfg,
1353
- accountId
1354
- });
1355
- if (inlineButtonsScope === "off") return;
1356
- const chatId = callbackMessage.chat.id;
1357
- const isGroup = callbackMessage.chat.type === "group" || callbackMessage.chat.type === "supergroup";
1358
- if (inlineButtonsScope === "dm" && isGroup) return;
1359
- if (inlineButtonsScope === "group" && !isGroup) return;
1360
- const messageThreadId = callbackMessage.message_thread_id;
1361
- const isForum = callbackMessage.chat.is_forum === true;
1362
- const eventAuthContext = await resolveTelegramEventAuthorizationContext({
1363
- chatId,
1364
- isForum,
1365
- messageThreadId
1366
- });
1367
- const { resolvedThreadId, storeAllowFrom } = eventAuthContext;
1368
- const senderId = callback.from?.id ? String(callback.from.id) : "";
1369
- const senderUsername = callback.from?.username ?? "";
1370
- const authorizationMode = inlineButtonsScope === "allowlist" ? "callback-allowlist" : "callback-scope";
1371
- if (!authorizeTelegramEventSender({
1372
- chatId,
1373
- chatTitle: callbackMessage.chat.title,
1374
- isGroup,
1375
- senderId,
1376
- senderUsername,
1377
- mode: authorizationMode,
1378
- context: eventAuthContext
1379
- }).allowed) return;
1380
- const paginationMatch = data.match(/^commands_page_(\d+|noop)(?::(.+))?$/);
1381
- if (paginationMatch) {
1382
- const pageValue = paginationMatch[1];
1383
- if (pageValue === "noop") return;
1384
- const page = Number.parseInt(pageValue, 10);
1385
- if (Number.isNaN(page) || page < 1) return;
1386
- const agentId = paginationMatch[2]?.trim() || resolveDefaultAgentId(cfg) || void 0;
1387
- const result = buildCommandsMessagePaginated(cfg, listSkillCommandsForAgents({
1388
- cfg,
1389
- agentIds: agentId ? [agentId] : void 0
1390
- }), {
1391
- page,
1392
- surface: "telegram"
1393
- });
1394
- const keyboard = result.totalPages > 1 ? buildInlineKeyboard(buildCommandsPaginationKeyboard(result.currentPage, result.totalPages, agentId)) : void 0;
1395
- try {
1396
- await editCallbackMessage(result.text, keyboard ? { reply_markup: keyboard } : void 0);
1397
- } catch (editErr) {
1398
- if (!String(editErr).includes("message is not modified")) throw editErr;
1399
- }
1400
- return;
1401
- }
1402
- const modelCallback = parseModelCallbackData(data);
1403
- if (modelCallback) {
1404
- const { byProvider, providers } = await buildModelsProviderData(cfg);
1405
- const editMessageWithButtons = async (text, buttons) => {
1406
- const keyboard = buildInlineKeyboard(buttons);
1407
- try {
1408
- await editCallbackMessage(text, keyboard ? { reply_markup: keyboard } : void 0);
1409
- } catch (editErr) {
1410
- const errStr = String(editErr);
1411
- if (errStr.includes("no text in the message")) {
1412
- try {
1413
- await deleteCallbackMessage();
1414
- } catch {}
1415
- await replyToCallbackChat(text, keyboard ? { reply_markup: keyboard } : void 0);
1416
- } else if (!errStr.includes("message is not modified")) throw editErr;
1417
- }
1418
- };
1419
- if (modelCallback.type === "providers" || modelCallback.type === "back") {
1420
- if (providers.length === 0) {
1421
- await editMessageWithButtons("No providers available.", []);
1422
- return;
1423
- }
1424
- await editMessageWithButtons("Select a provider:", buildProviderKeyboard(providers.map((p) => ({
1425
- id: p,
1426
- count: byProvider.get(p)?.size ?? 0
1427
- }))));
1428
- return;
1429
- }
1430
- if (modelCallback.type === "list") {
1431
- const { provider, page } = modelCallback;
1432
- const modelSet = byProvider.get(provider);
1433
- if (!modelSet || modelSet.size === 0) {
1434
- const buttons = buildProviderKeyboard(providers.map((p) => ({
1435
- id: p,
1436
- count: byProvider.get(p)?.size ?? 0
1437
- })));
1438
- await editMessageWithButtons(`Unknown provider: ${provider}\n\nSelect a provider:`, buttons);
1439
- return;
1440
- }
1441
- const models = [...modelSet].toSorted();
1442
- const pageSize = getModelsPageSize();
1443
- const totalPages = calculateTotalPages(models.length, pageSize);
1444
- const safePage = Math.max(1, Math.min(page, totalPages));
1445
- const sessionState = resolveTelegramSessionState({
1446
- chatId,
1447
- isGroup,
1448
- isForum,
1449
- messageThreadId,
1450
- resolvedThreadId
1451
- });
1452
- const currentModel = sessionState.model;
1453
- const buttons = buildModelsKeyboard({
1454
- provider,
1455
- models,
1456
- currentModel,
1457
- currentPage: safePage,
1458
- totalPages,
1459
- pageSize
1460
- });
1461
- await editMessageWithButtons(formatModelsAvailableHeader({
1462
- provider,
1463
- total: models.length,
1464
- cfg,
1465
- agentDir: resolveAgentDir(cfg, sessionState.agentId),
1466
- sessionEntry: sessionState.sessionEntry
1467
- }), buttons);
1468
- return;
1469
- }
1470
- if (modelCallback.type === "select") {
1471
- const { provider, model } = modelCallback;
1472
- await processMessage(buildSyntheticContext(ctx, buildSyntheticTextMessage({
1473
- base: callbackMessage,
1474
- from: callback.from,
1475
- text: `/model ${provider}/${model}`
1476
- })), [], storeAllowFrom, {
1477
- forceWasMentioned: true,
1478
- messageIdOverride: callback.id
1479
- });
1480
- return;
1481
- }
1482
- return;
1483
- }
1484
- await processMessage(buildSyntheticContext(ctx, buildSyntheticTextMessage({
1485
- base: callbackMessage,
1486
- from: callback.from,
1487
- text: data
1488
- })), [], storeAllowFrom, {
1489
- forceWasMentioned: true,
1490
- messageIdOverride: callback.id
1491
- });
1492
- } catch (err) {
1493
- runtime.error?.(danger(`callback handler failed: ${String(err)}`));
1494
- }
1495
- });
1496
- bot.on("message:migrate_to_chat_id", async (ctx) => {
1497
- try {
1498
- const msg = ctx.message;
1499
- if (!msg?.migrate_to_chat_id) return;
1500
- if (shouldSkipUpdate(ctx)) return;
1501
- const oldChatId = String(msg.chat.id);
1502
- const newChatId = String(msg.migrate_to_chat_id);
1503
- const chatTitle = msg.chat.title ?? "Unknown";
1504
- runtime.log?.(warn(`[telegram] Group migrated: "${chatTitle}" ${oldChatId} → ${newChatId}`));
1505
- if (!resolveChannelConfigWrites({
1506
- cfg,
1507
- channelId: "telegram",
1508
- accountId
1509
- })) {
1510
- runtime.log?.(warn("[telegram] Config writes disabled; skipping group config migration."));
1511
- return;
1512
- }
1513
- const currentConfig = loadConfig();
1514
- const migration = migrateTelegramGroupConfig({
1515
- cfg: currentConfig,
1516
- accountId,
1517
- oldChatId,
1518
- newChatId
1519
- });
1520
- if (migration.migrated) {
1521
- runtime.log?.(warn(`[telegram] Migrating group config from ${oldChatId} to ${newChatId}`));
1522
- migrateTelegramGroupConfig({
1523
- cfg,
1524
- accountId,
1525
- oldChatId,
1526
- newChatId
1527
- });
1528
- await writeConfigFile(currentConfig);
1529
- runtime.log?.(warn(`[telegram] Group config migrated and saved successfully`));
1530
- } else if (migration.skippedExisting) runtime.log?.(warn(`[telegram] Group config already exists for ${newChatId}; leaving ${oldChatId} unchanged`));
1531
- else runtime.log?.(warn(`[telegram] No config found for old group ID ${oldChatId}, migration logged only`));
1532
- } catch (err) {
1533
- runtime.error?.(danger(`[telegram] Group migration handler failed: ${String(err)}`));
1534
- }
1535
- });
1536
- const handleInboundMessageLike = async (event) => {
1537
- try {
1538
- if (shouldSkipUpdate(event.ctxForDedupe)) return;
1539
- const { dmPolicy, resolvedThreadId, storeAllowFrom, groupConfig, topicConfig, effectiveGroupAllow, hasGroupAllowOverride } = await resolveTelegramEventAuthorizationContext({
1540
- chatId: event.chatId,
1541
- isForum: event.isForum,
1542
- messageThreadId: event.messageThreadId
1543
- });
1544
- const effectiveDmAllow = normalizeDmAllowFromWithStore({
1545
- allowFrom,
1546
- storeAllowFrom,
1547
- dmPolicy
1548
- });
1549
- if (event.requireConfiguredGroup && (!groupConfig || groupConfig.enabled === false)) {
1550
- logVerbose(`Blocked telegram channel ${event.chatId} (channel disabled)`);
1551
- return;
1552
- }
1553
- if (shouldSkipGroupMessage({
1554
- isGroup: event.isGroup,
1555
- chatId: event.chatId,
1556
- chatTitle: event.msg.chat.title,
1557
- resolvedThreadId,
1558
- senderId: event.senderId,
1559
- senderUsername: event.senderUsername,
1560
- effectiveGroupAllow,
1561
- hasGroupAllowOverride,
1562
- groupConfig,
1563
- topicConfig
1564
- })) return;
1565
- if (!event.isGroup && (hasInboundMedia(event.msg) || hasReplyTargetMedia(event.msg))) {
1566
- if (!await enforceTelegramDmAccess({
1567
- isGroup: event.isGroup,
1568
- dmPolicy,
1569
- msg: event.msg,
1570
- chatId: event.chatId,
1571
- effectiveDmAllow,
1572
- accountId,
1573
- bot,
1574
- logger
1575
- })) return;
1576
- }
1577
- await processInboundMessage({
1578
- ctx: event.ctx,
1579
- msg: event.msg,
1580
- chatId: event.chatId,
1581
- resolvedThreadId,
1582
- storeAllowFrom,
1583
- sendOversizeWarning: event.sendOversizeWarning,
1584
- oversizeLogMessage: event.oversizeLogMessage
1585
- });
1586
- } catch (err) {
1587
- runtime.error?.(danger(`${event.errorMessage}: ${String(err)}`));
1588
- }
1589
- };
1590
- bot.on("message", async (ctx) => {
1591
- const msg = ctx.message;
1592
- if (!msg) return;
1593
- await handleInboundMessageLike({
1594
- ctxForDedupe: ctx,
1595
- ctx: buildSyntheticContext(ctx, msg),
1596
- msg,
1597
- chatId: msg.chat.id,
1598
- isGroup: msg.chat.type === "group" || msg.chat.type === "supergroup",
1599
- isForum: msg.chat.is_forum === true,
1600
- messageThreadId: msg.message_thread_id,
1601
- senderId: msg.from?.id != null ? String(msg.from.id) : "",
1602
- senderUsername: msg.from?.username ?? "",
1603
- requireConfiguredGroup: false,
1604
- sendOversizeWarning: true,
1605
- oversizeLogMessage: "media exceeds size limit",
1606
- errorMessage: "handler failed"
1607
- });
1608
- });
1609
- bot.on("channel_post", async (ctx) => {
1610
- const post = ctx.channelPost;
1611
- if (!post) return;
1612
- const chatId = post.chat.id;
1613
- const syntheticFrom = post.sender_chat ? {
1614
- id: post.sender_chat.id,
1615
- is_bot: true,
1616
- first_name: post.sender_chat.title || "Channel",
1617
- username: post.sender_chat.username
1618
- } : {
1619
- id: chatId,
1620
- is_bot: true,
1621
- first_name: post.chat.title || "Channel",
1622
- username: post.chat.username
1623
- };
1624
- const syntheticMsg = {
1625
- ...post,
1626
- from: post.from ?? syntheticFrom,
1627
- chat: {
1628
- ...post.chat,
1629
- type: "supergroup"
1630
- }
1631
- };
1632
- await handleInboundMessageLike({
1633
- ctxForDedupe: ctx,
1634
- ctx: buildSyntheticContext(ctx, syntheticMsg),
1635
- msg: syntheticMsg,
1636
- chatId,
1637
- isGroup: true,
1638
- isForum: false,
1639
- senderId: post.sender_chat?.id != null ? String(post.sender_chat.id) : post.from?.id != null ? String(post.from.id) : "",
1640
- senderUsername: post.sender_chat?.username ?? post.from?.username ?? "",
1641
- requireConfiguredGroup: true,
1642
- sendOversizeWarning: false,
1643
- oversizeLogMessage: "channel post media exceeds size limit",
1644
- errorMessage: "channel_post handler failed"
1645
- });
1646
- });
1647
- };
1648
-
1649
- //#endregion
1650
- //#region src/telegram/group-config-helpers.ts
1651
- function resolveTelegramGroupPromptSettings(params) {
1652
- const skillFilter = firstDefined(params.topicConfig?.skills, params.groupConfig?.skills);
1653
- const systemPromptParts = [params.groupConfig?.systemPrompt?.trim() || null, params.topicConfig?.systemPrompt?.trim() || null].filter((entry) => Boolean(entry));
1654
- return {
1655
- skillFilter,
1656
- groupSystemPrompt: systemPromptParts.length > 0 ? systemPromptParts.join("\n\n") : void 0
1657
- };
1658
- }
1659
-
1660
- //#endregion
1661
- //#region src/telegram/status-reaction-variants.ts
1662
- const TELEGRAM_GENERIC_REACTION_FALLBACKS = [
1663
- "👍",
1664
- "👀",
1665
- "🔥"
1666
- ];
1667
- const TELEGRAM_SUPPORTED_REACTION_EMOJIS = new Set([
1668
- "❤",
1669
- "👍",
1670
- "👎",
1671
- "🔥",
1672
- "🥰",
1673
- "👏",
1674
- "😁",
1675
- "🤔",
1676
- "🤯",
1677
- "😱",
1678
- "🤬",
1679
- "😢",
1680
- "🎉",
1681
- "🤩",
1682
- "🤮",
1683
- "💩",
1684
- "🙏",
1685
- "👌",
1686
- "🕊",
1687
- "🤡",
1688
- "🥱",
1689
- "🥴",
1690
- "😍",
1691
- "🐳",
1692
- "❤‍🔥",
1693
- "🌚",
1694
- "🌭",
1695
- "💯",
1696
- "🤣",
1697
- "⚡",
1698
- "🍌",
1699
- "🏆",
1700
- "💔",
1701
- "🤨",
1702
- "😐",
1703
- "🍓",
1704
- "🍾",
1705
- "💋",
1706
- "🖕",
1707
- "😈",
1708
- "😴",
1709
- "😭",
1710
- "🤓",
1711
- "👻",
1712
- "👨‍💻",
1713
- "👀",
1714
- "🎃",
1715
- "🙈",
1716
- "😇",
1717
- "😨",
1718
- "🤝",
1719
- "✍",
1720
- "🤗",
1721
- "🫡",
1722
- "🎅",
1723
- "🎄",
1724
- "☃",
1725
- "💅",
1726
- "🤪",
1727
- "🗿",
1728
- "🆒",
1729
- "💘",
1730
- "🙉",
1731
- "🦄",
1732
- "😘",
1733
- "💊",
1734
- "🙊",
1735
- "😎",
1736
- "👾",
1737
- "🤷‍♂",
1738
- "🤷",
1739
- "🤷‍♀",
1740
- "😡"
1741
- ]);
1742
- const TELEGRAM_STATUS_REACTION_VARIANTS = {
1743
- queued: [
1744
- "👀",
1745
- "👍",
1746
- "🔥"
1747
- ],
1748
- thinking: [
1749
- "🤔",
1750
- "🤓",
1751
- "👀"
1752
- ],
1753
- tool: [
1754
- "🔥",
1755
- "⚡",
1756
- "👍"
1757
- ],
1758
- coding: [
1759
- "👨‍💻",
1760
- "🔥",
1761
- "⚡"
1762
- ],
1763
- web: [
1764
- "⚡",
1765
- "🔥",
1766
- "👍"
1767
- ],
1768
- done: [
1769
- "👍",
1770
- "🎉",
1771
- "💯"
1772
- ],
1773
- error: [
1774
- "😱",
1775
- "😨",
1776
- "🤯"
1777
- ],
1778
- stallSoft: [
1779
- "🥱",
1780
- "😴",
1781
- "🤔"
1782
- ],
1783
- stallHard: [
1784
- "😨",
1785
- "😱",
1786
- "⚡"
1787
- ]
1788
- };
1789
- const STATUS_REACTION_EMOJI_KEYS = [
1790
- "queued",
1791
- "thinking",
1792
- "tool",
1793
- "coding",
1794
- "web",
1795
- "done",
1796
- "error",
1797
- "stallSoft",
1798
- "stallHard"
1799
- ];
1800
- function normalizeEmoji(value) {
1801
- const trimmed = value?.trim();
1802
- return trimmed ? trimmed : void 0;
1803
- }
1804
- function toUniqueNonEmpty(values) {
1805
- return Array.from(new Set(values.map((value) => value.trim()).filter(Boolean)));
1806
- }
1807
- function resolveTelegramStatusReactionEmojis(params) {
1808
- const { overrides } = params;
1809
- const queuedFallback = normalizeEmoji(params.initialEmoji) ?? DEFAULT_EMOJIS.queued;
1810
- return {
1811
- queued: normalizeEmoji(overrides?.queued) ?? queuedFallback,
1812
- thinking: normalizeEmoji(overrides?.thinking) ?? DEFAULT_EMOJIS.thinking,
1813
- tool: normalizeEmoji(overrides?.tool) ?? DEFAULT_EMOJIS.tool,
1814
- coding: normalizeEmoji(overrides?.coding) ?? DEFAULT_EMOJIS.coding,
1815
- web: normalizeEmoji(overrides?.web) ?? DEFAULT_EMOJIS.web,
1816
- done: normalizeEmoji(overrides?.done) ?? DEFAULT_EMOJIS.done,
1817
- error: normalizeEmoji(overrides?.error) ?? DEFAULT_EMOJIS.error,
1818
- stallSoft: normalizeEmoji(overrides?.stallSoft) ?? DEFAULT_EMOJIS.stallSoft,
1819
- stallHard: normalizeEmoji(overrides?.stallHard) ?? DEFAULT_EMOJIS.stallHard
1820
- };
1821
- }
1822
- function buildTelegramStatusReactionVariants(emojis) {
1823
- const variantsByRequested = /* @__PURE__ */ new Map();
1824
- for (const key of STATUS_REACTION_EMOJI_KEYS) {
1825
- const requested = normalizeEmoji(emojis[key]);
1826
- if (!requested) continue;
1827
- const candidates = toUniqueNonEmpty([requested, ...TELEGRAM_STATUS_REACTION_VARIANTS[key] ?? []]);
1828
- variantsByRequested.set(requested, candidates);
1829
- }
1830
- return variantsByRequested;
1831
- }
1832
- function isTelegramSupportedReactionEmoji(emoji) {
1833
- return TELEGRAM_SUPPORTED_REACTION_EMOJIS.has(emoji);
1834
- }
1835
- function extractTelegramAllowedEmojiReactions(chat) {
1836
- if (!chat || typeof chat !== "object") return;
1837
- if (!Object.prototype.hasOwnProperty.call(chat, "available_reactions")) return;
1838
- const availableReactions = chat.available_reactions;
1839
- if (availableReactions == null) return null;
1840
- if (!Array.isArray(availableReactions)) return /* @__PURE__ */ new Set();
1841
- const allowed = /* @__PURE__ */ new Set();
1842
- for (const reaction of availableReactions) {
1843
- if (!reaction || typeof reaction !== "object") continue;
1844
- const typedReaction = reaction;
1845
- if (typedReaction.type !== "emoji" || typeof typedReaction.emoji !== "string") continue;
1846
- const emoji = typedReaction.emoji.trim();
1847
- if (emoji) allowed.add(emoji);
1848
- }
1849
- return allowed;
1850
- }
1851
- async function resolveTelegramAllowedEmojiReactions(params) {
1852
- const fromMessage = extractTelegramAllowedEmojiReactions(params.chat);
1853
- if (fromMessage !== void 0) return fromMessage;
1854
- if (params.getChat) try {
1855
- const fromLookup = extractTelegramAllowedEmojiReactions(await params.getChat(params.chatId));
1856
- if (fromLookup !== void 0) return fromLookup;
1857
- } catch {
1858
- return null;
1859
- }
1860
- return null;
1861
- }
1862
- function resolveTelegramReactionVariant(params) {
1863
- const requestedEmoji = normalizeEmoji(params.requestedEmoji);
1864
- if (!requestedEmoji) return;
1865
- const variants = toUniqueNonEmpty([...params.variantsByRequestedEmoji.get(requestedEmoji) ?? [requestedEmoji], ...TELEGRAM_GENERIC_REACTION_FALLBACKS]);
1866
- for (const candidate of variants) if ((params.allowedEmojiReactions == null || params.allowedEmojiReactions.has(candidate)) && isTelegramSupportedReactionEmoji(candidate)) return candidate;
1867
- }
1868
-
1869
- //#endregion
1870
- //#region src/telegram/bot-message-context.ts
1871
- async function resolveStickerVisionSupport$1(params) {
1872
- try {
1873
- const catalog = await loadModelCatalog({ config: params.cfg });
1874
- const defaultModel = resolveDefaultModelForAgent({
1875
- cfg: params.cfg,
1876
- agentId: params.agentId
1877
- });
1878
- const entry = findModelInCatalog(catalog, defaultModel.provider, defaultModel.model);
1879
- if (!entry) return false;
1880
- return modelSupportsVision(entry);
1881
- } catch {
1882
- return false;
1883
- }
1884
- }
1885
- const buildTelegramMessageContext = async ({ primaryCtx, allMedia, replyMedia = [], storeAllowFrom, options, bot, cfg, account, historyLimit, groupHistories, dmPolicy, allowFrom, groupAllowFrom, ackReactionScope, logger, resolveGroupActivation, resolveGroupRequireMention, resolveTelegramGroupConfig, sendChatActionHandler }) => {
1886
- const msg = primaryCtx.message;
1887
- const chatId = msg.chat.id;
1888
- const isGroup = msg.chat.type === "group" || msg.chat.type === "supergroup";
1889
- const messageThreadId = msg.message_thread_id;
1890
- const isForum = msg.chat.is_forum === true;
1891
- const threadSpec = resolveTelegramThreadSpec({
1892
- isGroup,
1893
- isForum,
1894
- messageThreadId
1895
- });
1896
- const resolvedThreadId = threadSpec.scope === "forum" ? threadSpec.id : void 0;
1897
- const replyThreadId = threadSpec.id;
1898
- const { groupConfig, topicConfig } = resolveTelegramGroupConfig(chatId, resolvedThreadId);
1899
- const peerId = isGroup ? buildTelegramGroupPeerId(chatId, resolvedThreadId) : String(chatId);
1900
- const parentPeer = buildTelegramParentPeer({
1901
- isGroup,
1902
- resolvedThreadId,
1903
- chatId
1904
- });
1905
- const route = resolveAgentRoute({
1906
- cfg: loadConfig(),
1907
- channel: "telegram",
1908
- accountId: account.accountId,
1909
- peer: {
1910
- kind: isGroup ? "group" : "direct",
1911
- id: peerId
1912
- },
1913
- parentPeer
1914
- });
1915
- const baseSessionKey = route.sessionKey;
1916
- const dmThreadId = threadSpec.scope === "dm" ? threadSpec.id : void 0;
1917
- const sessionKey = (dmThreadId != null ? resolveThreadSessionKeys({
1918
- baseSessionKey,
1919
- threadId: String(dmThreadId)
1920
- }) : null)?.sessionKey ?? baseSessionKey;
1921
- const mentionRegexes = buildMentionRegexes(cfg, route.agentId);
1922
- const effectiveDmAllow = normalizeDmAllowFromWithStore({
1923
- allowFrom,
1924
- storeAllowFrom,
1925
- dmPolicy
1926
- });
1927
- const groupAllowOverride = firstDefined(topicConfig?.allowFrom, groupConfig?.allowFrom);
1928
- const effectiveGroupAllow = normalizeAllowFrom(groupAllowOverride ?? groupAllowFrom);
1929
- const hasGroupAllowOverride = typeof groupAllowOverride !== "undefined";
1930
- const senderId = msg.from?.id ? String(msg.from.id) : "";
1931
- const senderUsername = msg.from?.username ?? "";
1932
- const baseAccess = evaluateTelegramGroupBaseAccess({
1933
- isGroup,
1934
- groupConfig,
1935
- topicConfig,
1936
- hasGroupAllowOverride,
1937
- effectiveGroupAllow,
1938
- senderId,
1939
- senderUsername,
1940
- enforceAllowOverride: true,
1941
- requireSenderForAllowOverride: false
1942
- });
1943
- if (!baseAccess.allowed) {
1944
- if (baseAccess.reason === "group-disabled") {
1945
- logVerbose(`Blocked telegram group ${chatId} (group disabled)`);
1946
- return null;
1947
- }
1948
- if (baseAccess.reason === "topic-disabled") {
1949
- logVerbose(`Blocked telegram topic ${chatId} (${resolvedThreadId ?? "unknown"}) (topic disabled)`);
1950
- return null;
1951
- }
1952
- logVerbose(`Blocked telegram group sender ${senderId || "unknown"} (group allowFrom override)`);
1953
- return null;
1954
- }
1955
- const activationOverride = resolveGroupActivation({
1956
- chatId,
1957
- messageThreadId: resolvedThreadId,
1958
- sessionKey,
1959
- agentId: route.agentId
1960
- });
1961
- const baseRequireMention = resolveGroupRequireMention(chatId);
1962
- const requireMention = firstDefined(activationOverride, topicConfig?.requireMention, groupConfig?.requireMention, baseRequireMention);
1963
- const sendTyping = async () => {
1964
- await withTelegramApiErrorLogging({
1965
- operation: "sendChatAction",
1966
- fn: () => sendChatActionHandler.sendChatAction(chatId, "typing", buildTypingThreadParams(replyThreadId))
1967
- });
1968
- };
1969
- const sendRecordVoice = async () => {
1970
- try {
1971
- await withTelegramApiErrorLogging({
1972
- operation: "sendChatAction",
1973
- fn: () => sendChatActionHandler.sendChatAction(chatId, "record_voice", buildTypingThreadParams(replyThreadId))
1974
- });
1975
- } catch (err) {
1976
- logVerbose(`telegram record_voice cue failed for chat ${chatId}: ${String(err)}`);
1977
- }
1978
- };
1979
- if (!await enforceTelegramDmAccess({
1980
- isGroup,
1981
- dmPolicy,
1982
- msg,
1983
- chatId,
1984
- effectiveDmAllow,
1985
- accountId: account.accountId,
1986
- bot,
1987
- logger
1988
- })) return null;
1989
- recordChannelActivity({
1990
- channel: "telegram",
1991
- accountId: account.accountId,
1992
- direction: "inbound"
1993
- });
1994
- const botUsername = primaryCtx.me?.username?.toLowerCase();
1995
- const allowForCommands = isGroup ? effectiveGroupAllow : effectiveDmAllow;
1996
- const senderAllowedForCommands = isSenderAllowed({
1997
- allow: allowForCommands,
1998
- senderId,
1999
- senderUsername
2000
- });
2001
- const useAccessGroups = cfg.commands?.useAccessGroups !== false;
2002
- const hasControlCommandInMessage = hasControlCommand(msg.text ?? msg.caption ?? "", cfg, { botUsername });
2003
- const commandGate = resolveControlCommandGate({
2004
- useAccessGroups,
2005
- authorizers: [{
2006
- configured: allowForCommands.hasEntries,
2007
- allowed: senderAllowedForCommands
2008
- }],
2009
- allowTextCommands: true,
2010
- hasControlCommand: hasControlCommandInMessage
2011
- });
2012
- const commandAuthorized = commandGate.commandAuthorized;
2013
- const historyKey = isGroup ? buildTelegramGroupPeerId(chatId, resolvedThreadId) : void 0;
2014
- let placeholder = resolveTelegramMediaPlaceholder(msg) ?? "";
2015
- const cachedStickerDescription = allMedia[0]?.stickerMetadata?.cachedDescription;
2016
- const stickerSupportsVision = msg.sticker ? await resolveStickerVisionSupport$1({
2017
- cfg,
2018
- agentId: route.agentId
2019
- }) : false;
2020
- const stickerCacheHit = Boolean(cachedStickerDescription) && !stickerSupportsVision;
2021
- if (stickerCacheHit) {
2022
- const emoji = allMedia[0]?.stickerMetadata?.emoji;
2023
- const setName = allMedia[0]?.stickerMetadata?.setName;
2024
- const stickerContext = [emoji, setName ? `from "${setName}"` : null].filter(Boolean).join(" ");
2025
- placeholder = `[Sticker${stickerContext ? ` ${stickerContext}` : ""}] ${cachedStickerDescription}`;
2026
- }
2027
- const locationData = extractTelegramLocation(msg);
2028
- const locationText = locationData ? formatLocationText(locationData) : void 0;
2029
- const rawText = expandTextLinks(msg.text ?? msg.caption ?? "", msg.entities ?? msg.caption_entities).trim();
2030
- const hasUserText = Boolean(rawText || locationText);
2031
- let rawBody = [rawText, locationText].filter(Boolean).join("\n").trim();
2032
- if (!rawBody) rawBody = placeholder;
2033
- if (!rawBody && allMedia.length === 0) return null;
2034
- let bodyText = rawBody;
2035
- const hasAudio = allMedia.some((media) => media.contentType?.startsWith("audio/"));
2036
- let preflightTranscript;
2037
- if (isGroup && requireMention && hasAudio && !hasUserText && mentionRegexes.length > 0) try {
2038
- const { transcribeFirstAudio } = await import("./audio-preflight-Chxqjwxe.js");
2039
- preflightTranscript = await transcribeFirstAudio({
2040
- ctx: {
2041
- MediaPaths: allMedia.length > 0 ? allMedia.map((m) => m.path) : void 0,
2042
- MediaTypes: allMedia.length > 0 ? allMedia.map((m) => m.contentType).filter(Boolean) : void 0
2043
- },
2044
- cfg,
2045
- agentDir: void 0
2046
- });
2047
- } catch (err) {
2048
- logVerbose(`telegram: audio preflight transcription failed: ${String(err)}`);
2049
- }
2050
- if (hasAudio && bodyText === "<media:audio>" && preflightTranscript) bodyText = preflightTranscript;
2051
- if (!bodyText && allMedia.length > 0) if (hasAudio) bodyText = preflightTranscript || "<media:audio>";
2052
- else bodyText = `<media:image>${allMedia.length > 1 ? ` (${allMedia.length} images)` : ""}`;
2053
- const hasAnyMention = (msg.entities ?? msg.caption_entities ?? []).some((ent) => ent.type === "mention");
2054
- const explicitlyMentioned = botUsername ? hasBotMention(msg, botUsername) : false;
2055
- const computedWasMentioned = matchesMentionWithExplicit({
2056
- text: msg.text ?? msg.caption ?? "",
2057
- mentionRegexes,
2058
- explicit: {
2059
- hasAnyMention,
2060
- isExplicitlyMentioned: explicitlyMentioned,
2061
- canResolveExplicit: Boolean(botUsername)
2062
- },
2063
- transcript: preflightTranscript
2064
- });
2065
- const wasMentioned = options?.forceWasMentioned === true ? true : computedWasMentioned;
2066
- if (isGroup && commandGate.shouldBlock) {
2067
- logInboundDrop({
2068
- log: logVerbose,
2069
- channel: "telegram",
2070
- reason: "control command (unauthorized)",
2071
- target: senderId ?? "unknown"
2072
- });
2073
- return null;
2074
- }
2075
- const botId = primaryCtx.me?.id;
2076
- const replyFromId = msg.reply_to_message?.from?.id;
2077
- const implicitMention = botId != null && replyFromId === botId;
2078
- const canDetectMention = Boolean(botUsername) || mentionRegexes.length > 0;
2079
- const mentionGate = resolveMentionGatingWithBypass({
2080
- isGroup,
2081
- requireMention: Boolean(requireMention),
2082
- canDetectMention,
2083
- wasMentioned,
2084
- implicitMention: isGroup && Boolean(requireMention) && implicitMention,
2085
- hasAnyMention,
2086
- allowTextCommands: true,
2087
- hasControlCommand: hasControlCommandInMessage,
2088
- commandAuthorized
2089
- });
2090
- const effectiveWasMentioned = mentionGate.effectiveWasMentioned;
2091
- if (isGroup && requireMention && canDetectMention) {
2092
- if (mentionGate.shouldSkip) {
2093
- logger.info({
2094
- chatId,
2095
- reason: "no-mention"
2096
- }, "skipping group message");
2097
- recordPendingHistoryEntryIfEnabled({
2098
- historyMap: groupHistories,
2099
- historyKey: historyKey ?? "",
2100
- limit: historyLimit,
2101
- entry: historyKey ? {
2102
- sender: buildSenderLabel(msg, senderId || chatId),
2103
- body: rawBody,
2104
- timestamp: msg.date ? msg.date * 1e3 : void 0,
2105
- messageId: typeof msg.message_id === "number" ? String(msg.message_id) : void 0
2106
- } : null
2107
- });
2108
- return null;
2109
- }
2110
- }
2111
- const ackReaction = resolveAckReaction(cfg, route.agentId, {
2112
- channel: "telegram",
2113
- accountId: account.accountId
2114
- });
2115
- const removeAckAfterReply = cfg.messages?.removeAckAfterReply ?? false;
2116
- const shouldAckReaction$1 = () => Boolean(ackReaction && shouldAckReaction({
2117
- scope: ackReactionScope,
2118
- isDirect: !isGroup,
2119
- isGroup,
2120
- isMentionableGroup: isGroup,
2121
- requireMention: Boolean(requireMention),
2122
- canDetectMention,
2123
- effectiveWasMentioned,
2124
- shouldBypassMention: mentionGate.shouldBypassMention
2125
- }));
2126
- const api = bot.api;
2127
- const reactionApi = typeof api.setMessageReaction === "function" ? api.setMessageReaction.bind(api) : null;
2128
- const getChatApi = typeof api.getChat === "function" ? api.getChat.bind(api) : null;
2129
- const statusReactionsConfig = cfg.messages?.statusReactions;
2130
- const statusReactionsEnabled = statusReactionsConfig?.enabled === true && Boolean(reactionApi) && shouldAckReaction$1();
2131
- const resolvedStatusReactionEmojis = resolveTelegramStatusReactionEmojis({
2132
- initialEmoji: ackReaction,
2133
- overrides: statusReactionsConfig?.emojis
2134
- });
2135
- const statusReactionVariantsByEmoji = buildTelegramStatusReactionVariants(resolvedStatusReactionEmojis);
2136
- let allowedStatusReactionEmojisPromise = null;
2137
- const statusReactionController = statusReactionsEnabled && msg.message_id ? createStatusReactionController({
2138
- enabled: true,
2139
- adapter: { setReaction: async (emoji) => {
2140
- if (reactionApi) {
2141
- if (!allowedStatusReactionEmojisPromise) allowedStatusReactionEmojisPromise = resolveTelegramAllowedEmojiReactions({
2142
- chat: msg.chat,
2143
- chatId,
2144
- getChat: getChatApi ?? void 0
2145
- }).catch((err) => {
2146
- logVerbose(`telegram status-reaction available_reactions lookup failed for chat ${chatId}: ${String(err)}`);
2147
- return null;
2148
- });
2149
- const resolvedEmoji = resolveTelegramReactionVariant({
2150
- requestedEmoji: emoji,
2151
- variantsByRequestedEmoji: statusReactionVariantsByEmoji,
2152
- allowedEmojiReactions: await allowedStatusReactionEmojisPromise
2153
- });
2154
- if (!resolvedEmoji) return;
2155
- await reactionApi(chatId, msg.message_id, [{
2156
- type: "emoji",
2157
- emoji: resolvedEmoji
2158
- }]);
2159
- }
2160
- } },
2161
- initialEmoji: ackReaction,
2162
- emojis: resolvedStatusReactionEmojis,
2163
- timing: statusReactionsConfig?.timing,
2164
- onError: (err) => {
2165
- logVerbose(`telegram status-reaction error for chat ${chatId}: ${String(err)}`);
2166
- }
2167
- }) : null;
2168
- const ackReactionPromise = statusReactionController ? shouldAckReaction$1() ? Promise.resolve(statusReactionController.setQueued()).then(() => true, () => false) : null : shouldAckReaction$1() && msg.message_id && reactionApi ? withTelegramApiErrorLogging({
2169
- operation: "setMessageReaction",
2170
- fn: () => reactionApi(chatId, msg.message_id, [{
2171
- type: "emoji",
2172
- emoji: ackReaction
2173
- }])
2174
- }).then(() => true, (err) => {
2175
- logVerbose(`telegram react failed for chat ${chatId}: ${String(err)}`);
2176
- return false;
2177
- }) : null;
2178
- const replyTarget = describeReplyTarget(msg);
2179
- const forwardOrigin = normalizeForwardedContext(msg);
2180
- const replyForwardAnnotation = replyTarget?.forwardedFrom ? `[Forwarded from ${replyTarget.forwardedFrom.from}${replyTarget.forwardedFrom.date ? ` at ${(/* @__PURE__ */ new Date(replyTarget.forwardedFrom.date * 1e3)).toISOString()}` : ""}]\n` : "";
2181
- const replySuffix = replyTarget ? replyTarget.kind === "quote" ? `\n\n[Quoting ${replyTarget.sender}${replyTarget.id ? ` id:${replyTarget.id}` : ""}]\n${replyForwardAnnotation}"${replyTarget.body}"\n[/Quoting]` : `\n\n[Replying to ${replyTarget.sender}${replyTarget.id ? ` id:${replyTarget.id}` : ""}]\n${replyForwardAnnotation}${replyTarget.body}\n[/Replying]` : "";
2182
- const forwardPrefix = forwardOrigin ? `[Forwarded from ${forwardOrigin.from}${forwardOrigin.date ? ` at ${(/* @__PURE__ */ new Date(forwardOrigin.date * 1e3)).toISOString()}` : ""}]\n` : "";
2183
- const groupLabel = isGroup ? buildGroupLabel(msg, chatId, resolvedThreadId) : void 0;
2184
- const senderName = buildSenderName(msg);
2185
- const conversationLabel = isGroup ? groupLabel ?? `group:${chatId}` : buildSenderLabel(msg, senderId || chatId);
2186
- const storePath = resolveStorePath(cfg.session?.store, { agentId: route.agentId });
2187
- const envelopeOptions = resolveEnvelopeFormatOptions(cfg);
2188
- const previousTimestamp = readSessionUpdatedAt({
2189
- storePath,
2190
- sessionKey
2191
- });
2192
- const body = formatInboundEnvelope({
2193
- channel: "Telegram",
2194
- from: conversationLabel,
2195
- timestamp: msg.date ? msg.date * 1e3 : void 0,
2196
- body: `${forwardPrefix}${bodyText}${replySuffix}`,
2197
- chatType: isGroup ? "group" : "direct",
2198
- sender: {
2199
- name: senderName,
2200
- username: senderUsername || void 0,
2201
- id: senderId || void 0
2202
- },
2203
- previousTimestamp,
2204
- envelope: envelopeOptions
2205
- });
2206
- let combinedBody = body;
2207
- if (isGroup && historyKey && historyLimit > 0) combinedBody = buildPendingHistoryContextFromMap({
2208
- historyMap: groupHistories,
2209
- historyKey,
2210
- limit: historyLimit,
2211
- currentMessage: combinedBody,
2212
- formatEntry: (entry) => formatInboundEnvelope({
2213
- channel: "Telegram",
2214
- from: groupLabel ?? `group:${chatId}`,
2215
- timestamp: entry.timestamp,
2216
- body: `${entry.body} [id:${entry.messageId ?? "unknown"} chat:${chatId}]`,
2217
- chatType: "group",
2218
- senderLabel: entry.sender,
2219
- envelope: envelopeOptions
2220
- })
2221
- });
2222
- const { skillFilter, groupSystemPrompt } = resolveTelegramGroupPromptSettings({
2223
- groupConfig,
2224
- topicConfig
2225
- });
2226
- const commandBody = normalizeCommandBody(rawBody, { botUsername });
2227
- const inboundHistory = isGroup && historyKey && historyLimit > 0 ? (groupHistories.get(historyKey) ?? []).map((entry) => ({
2228
- sender: entry.sender,
2229
- body: entry.body,
2230
- timestamp: entry.timestamp
2231
- })) : void 0;
2232
- const contextMedia = [...stickerCacheHit ? [] : allMedia, ...replyMedia];
2233
- const ctxPayload = finalizeInboundContext({
2234
- Body: combinedBody,
2235
- BodyForAgent: bodyText,
2236
- InboundHistory: inboundHistory,
2237
- RawBody: rawBody,
2238
- CommandBody: commandBody,
2239
- From: isGroup ? buildTelegramGroupFrom(chatId, resolvedThreadId) : `telegram:${chatId}`,
2240
- To: `telegram:${chatId}`,
2241
- SessionKey: sessionKey,
2242
- AccountId: route.accountId,
2243
- ChatType: isGroup ? "group" : "direct",
2244
- ConversationLabel: conversationLabel,
2245
- GroupSubject: isGroup ? msg.chat.title ?? void 0 : void 0,
2246
- GroupSystemPrompt: isGroup ? groupSystemPrompt : void 0,
2247
- SenderName: senderName,
2248
- SenderId: senderId || void 0,
2249
- SenderUsername: senderUsername || void 0,
2250
- Provider: "telegram",
2251
- Surface: "telegram",
2252
- MessageSid: options?.messageIdOverride ?? String(msg.message_id),
2253
- ReplyToId: replyTarget?.id,
2254
- ReplyToBody: replyTarget?.body,
2255
- ReplyToSender: replyTarget?.sender,
2256
- ReplyToIsQuote: replyTarget?.kind === "quote" ? true : void 0,
2257
- ReplyToForwardedFrom: replyTarget?.forwardedFrom?.from,
2258
- ReplyToForwardedFromType: replyTarget?.forwardedFrom?.fromType,
2259
- ReplyToForwardedFromId: replyTarget?.forwardedFrom?.fromId,
2260
- ReplyToForwardedFromUsername: replyTarget?.forwardedFrom?.fromUsername,
2261
- ReplyToForwardedFromTitle: replyTarget?.forwardedFrom?.fromTitle,
2262
- ReplyToForwardedDate: replyTarget?.forwardedFrom?.date ? replyTarget.forwardedFrom.date * 1e3 : void 0,
2263
- ForwardedFrom: forwardOrigin?.from,
2264
- ForwardedFromType: forwardOrigin?.fromType,
2265
- ForwardedFromId: forwardOrigin?.fromId,
2266
- ForwardedFromUsername: forwardOrigin?.fromUsername,
2267
- ForwardedFromTitle: forwardOrigin?.fromTitle,
2268
- ForwardedFromSignature: forwardOrigin?.fromSignature,
2269
- ForwardedFromChatType: forwardOrigin?.fromChatType,
2270
- ForwardedFromMessageId: forwardOrigin?.fromMessageId,
2271
- ForwardedDate: forwardOrigin?.date ? forwardOrigin.date * 1e3 : void 0,
2272
- Timestamp: msg.date ? msg.date * 1e3 : void 0,
2273
- WasMentioned: isGroup ? effectiveWasMentioned : void 0,
2274
- MediaPath: contextMedia.length > 0 ? contextMedia[0]?.path : void 0,
2275
- MediaType: contextMedia.length > 0 ? contextMedia[0]?.contentType : void 0,
2276
- MediaUrl: contextMedia.length > 0 ? contextMedia[0]?.path : void 0,
2277
- MediaPaths: contextMedia.length > 0 ? contextMedia.map((m) => m.path) : void 0,
2278
- MediaUrls: contextMedia.length > 0 ? contextMedia.map((m) => m.path) : void 0,
2279
- MediaTypes: contextMedia.length > 0 ? contextMedia.map((m) => m.contentType).filter(Boolean) : void 0,
2280
- Sticker: allMedia[0]?.stickerMetadata,
2281
- StickerMediaIncluded: allMedia[0]?.stickerMetadata ? !stickerCacheHit : void 0,
2282
- ...locationData ? toLocationContext(locationData) : void 0,
2283
- CommandAuthorized: commandAuthorized,
2284
- MessageThreadId: threadSpec.id,
2285
- IsForum: isForum,
2286
- OriginatingChannel: "telegram",
2287
- OriginatingTo: `telegram:${chatId}`
2288
- });
2289
- await recordInboundSession({
2290
- storePath,
2291
- sessionKey: ctxPayload.SessionKey ?? sessionKey,
2292
- ctx: ctxPayload,
2293
- updateLastRoute: !isGroup ? {
2294
- sessionKey: route.mainSessionKey,
2295
- channel: "telegram",
2296
- to: `telegram:${chatId}`,
2297
- accountId: route.accountId,
2298
- threadId: dmThreadId != null ? String(dmThreadId) : void 0
2299
- } : void 0,
2300
- onRecordError: (err) => {
2301
- logVerbose(`telegram: failed updating session meta: ${String(err)}`);
2302
- }
2303
- });
2304
- if (replyTarget && shouldLogVerbose()) {
2305
- const preview = replyTarget.body.replace(/\s+/g, " ").slice(0, 120);
2306
- logVerbose(`telegram reply-context: replyToId=${replyTarget.id} replyToSender=${replyTarget.sender} replyToBody="${preview}"`);
2307
- }
2308
- if (forwardOrigin && shouldLogVerbose()) logVerbose(`telegram forward-context: forwardedFrom="${forwardOrigin.from}" type=${forwardOrigin.fromType}`);
2309
- if (shouldLogVerbose()) {
2310
- const preview = body.slice(0, 200).replace(/\n/g, "\\n");
2311
- const mediaInfo = allMedia.length > 1 ? ` mediaCount=${allMedia.length}` : "";
2312
- const topicInfo = resolvedThreadId != null ? ` topic=${resolvedThreadId}` : "";
2313
- logVerbose(`telegram inbound: chatId=${chatId} from=${ctxPayload.From} len=${body.length}${mediaInfo}${topicInfo} preview="${preview}"`);
2314
- }
2315
- return {
2316
- ctxPayload,
2317
- primaryCtx,
2318
- msg,
2319
- chatId,
2320
- isGroup,
2321
- resolvedThreadId,
2322
- threadSpec,
2323
- replyThreadId,
2324
- isForum,
2325
- historyKey,
2326
- historyLimit,
2327
- groupHistories,
2328
- route,
2329
- skillFilter,
2330
- sendTyping,
2331
- sendRecordVoice,
2332
- ackReactionPromise,
2333
- reactionApi,
2334
- removeAckAfterReply,
2335
- statusReactionController,
2336
- accountId: account.accountId
2337
- };
2338
- };
2339
-
2340
- //#endregion
2341
- //#region src/telegram/draft-stream.ts
2342
- const TELEGRAM_STREAM_MAX_CHARS = 4096;
2343
- const DEFAULT_THROTTLE_MS = 1e3;
2344
- function createTelegramDraftStream(params) {
2345
- const maxChars = Math.min(params.maxChars ?? TELEGRAM_STREAM_MAX_CHARS, TELEGRAM_STREAM_MAX_CHARS);
2346
- const throttleMs = Math.max(250, params.throttleMs ?? DEFAULT_THROTTLE_MS);
2347
- const minInitialChars = params.minInitialChars;
2348
- const chatId = params.chatId;
2349
- const threadParams = buildTelegramThreadParams(params.thread);
2350
- const replyParams = params.replyToMessageId != null ? {
2351
- ...threadParams,
2352
- reply_to_message_id: params.replyToMessageId
2353
- } : threadParams;
2354
- const streamState = {
2355
- stopped: false,
2356
- final: false
2357
- };
2358
- let streamMessageId;
2359
- let lastSentText = "";
2360
- let lastSentParseMode;
2361
- let generation = 0;
2362
- const sendOrEditStreamMessage = async (text) => {
2363
- if (streamState.stopped && !streamState.final) return false;
2364
- const trimmed = text.trimEnd();
2365
- if (!trimmed) return false;
2366
- const rendered = params.renderText?.(trimmed) ?? { text: trimmed };
2367
- const renderedText = rendered.text.trimEnd();
2368
- const renderedParseMode = rendered.parseMode;
2369
- if (!renderedText) return false;
2370
- if (renderedText.length > maxChars) {
2371
- streamState.stopped = true;
2372
- params.warn?.(`telegram stream preview stopped (text length ${renderedText.length} > ${maxChars})`);
2373
- return false;
2374
- }
2375
- if (renderedText === lastSentText && renderedParseMode === lastSentParseMode) return true;
2376
- const sendGeneration = generation;
2377
- if (typeof streamMessageId !== "number" && minInitialChars != null && !streamState.final) {
2378
- if (renderedText.length < minInitialChars) return false;
2379
- }
2380
- lastSentText = renderedText;
2381
- lastSentParseMode = renderedParseMode;
2382
- try {
2383
- if (typeof streamMessageId === "number") {
2384
- if (renderedParseMode) await params.api.editMessageText(chatId, streamMessageId, renderedText, { parse_mode: renderedParseMode });
2385
- else await params.api.editMessageText(chatId, streamMessageId, renderedText);
2386
- return true;
2387
- }
2388
- const sendParams = renderedParseMode ? {
2389
- ...replyParams,
2390
- parse_mode: renderedParseMode
2391
- } : replyParams;
2392
- const sentMessageId = (await params.api.sendMessage(chatId, renderedText, sendParams))?.message_id;
2393
- if (typeof sentMessageId !== "number" || !Number.isFinite(sentMessageId)) {
2394
- streamState.stopped = true;
2395
- params.warn?.("telegram stream preview stopped (missing message id from sendMessage)");
2396
- return false;
2397
- }
2398
- const normalizedMessageId = Math.trunc(sentMessageId);
2399
- if (sendGeneration !== generation) {
2400
- params.onSupersededPreview?.({
2401
- messageId: normalizedMessageId,
2402
- textSnapshot: renderedText,
2403
- parseMode: renderedParseMode
2404
- });
2405
- return true;
2406
- }
2407
- streamMessageId = normalizedMessageId;
2408
- return true;
2409
- } catch (err) {
2410
- streamState.stopped = true;
2411
- params.warn?.(`telegram stream preview failed: ${err instanceof Error ? err.message : String(err)}`);
2412
- return false;
2413
- }
2414
- };
2415
- const { loop, update, stop, clear } = createFinalizableDraftLifecycle({
2416
- throttleMs,
2417
- state: streamState,
2418
- sendOrEditStreamMessage,
2419
- readMessageId: () => streamMessageId,
2420
- clearMessageId: () => {
2421
- streamMessageId = void 0;
2422
- },
2423
- isValidMessageId: (value) => typeof value === "number" && Number.isFinite(value),
2424
- deleteMessage: async (messageId) => {
2425
- await params.api.deleteMessage(chatId, messageId);
2426
- },
2427
- onDeleteSuccess: (messageId) => {
2428
- params.log?.(`telegram stream preview deleted (chat=${chatId}, message=${messageId})`);
2429
- },
2430
- warn: params.warn,
2431
- warnPrefix: "telegram stream preview cleanup failed"
2432
- });
2433
- const forceNewMessage = () => {
2434
- generation += 1;
2435
- streamMessageId = void 0;
2436
- lastSentText = "";
2437
- lastSentParseMode = void 0;
2438
- loop.resetPending();
2439
- loop.resetThrottleWindow();
2440
- };
2441
- params.log?.(`telegram stream preview ready (maxChars=${maxChars}, throttleMs=${throttleMs})`);
2442
- return {
2443
- update,
2444
- flush: loop.flush,
2445
- messageId: () => streamMessageId,
2446
- clear,
2447
- stop,
2448
- forceNewMessage
2449
- };
2450
- }
2451
-
2452
- //#endregion
2453
- //#region src/telegram/lane-delivery.ts
2454
- function createLaneDeliveryStateTracker() {
2455
- const state = {
2456
- delivered: false,
2457
- skippedNonSilent: 0,
2458
- failedNonSilent: 0
2459
- };
2460
- return {
2461
- markDelivered: () => {
2462
- state.delivered = true;
2463
- },
2464
- markNonSilentSkip: () => {
2465
- state.skippedNonSilent += 1;
2466
- },
2467
- markNonSilentFailure: () => {
2468
- state.failedNonSilent += 1;
2469
- },
2470
- snapshot: () => ({ ...state })
2471
- };
2472
- }
2473
- function createLaneTextDeliverer(params) {
2474
- const getLanePreviewText = (lane) => lane.lastPartialText;
2475
- const shouldSkipRegressivePreviewUpdate = (args) => {
2476
- const currentPreviewText = args.currentPreviewText;
2477
- if (currentPreviewText === void 0) return false;
2478
- return currentPreviewText.startsWith(args.text) && args.text.length < currentPreviewText.length && (args.skipRegressive === "always" || args.hadPreviewMessage);
2479
- };
2480
- const tryEditPreviewMessage = async (args) => {
2481
- try {
2482
- await params.editPreview({
2483
- laneName: args.laneName,
2484
- messageId: args.messageId,
2485
- text: args.text,
2486
- previewButtons: args.previewButtons,
2487
- context: args.context
2488
- });
2489
- if (args.updateLaneSnapshot) args.lane.lastPartialText = args.text;
2490
- params.markDelivered();
2491
- return true;
2492
- } catch (err) {
2493
- if (args.treatEditFailureAsDelivered) {
2494
- params.log(`telegram: ${args.laneName} preview ${args.context} edit failed after stop-created flush; treating as delivered (${String(err)})`);
2495
- params.markDelivered();
2496
- return true;
2497
- }
2498
- params.log(`telegram: ${args.laneName} preview ${args.context} edit failed; falling back to standard send (${String(err)})`);
2499
- return false;
2500
- }
2501
- };
2502
- const tryUpdatePreviewForLane = async ({ lane, laneName, text, previewButtons, stopBeforeEdit = false, updateLaneSnapshot = false, skipRegressive, context, previewMessageId: previewMessageIdOverride, previewTextSnapshot }) => {
2503
- if (!lane.stream) return false;
2504
- const lanePreviewMessageId = lane.stream.messageId();
2505
- const hadPreviewMessage = typeof previewMessageIdOverride === "number" || typeof lanePreviewMessageId === "number";
2506
- if (stopBeforeEdit && !hadPreviewMessage && context === "final") {
2507
- lane.stream.update(text);
2508
- await params.stopDraftLane(lane);
2509
- const previewMessageId = lane.stream.messageId();
2510
- if (typeof previewMessageId !== "number") return false;
2511
- if (shouldSkipRegressivePreviewUpdate({
2512
- currentPreviewText: previewTextSnapshot ?? getLanePreviewText(lane),
2513
- text,
2514
- skipRegressive,
2515
- hadPreviewMessage
2516
- })) {
2517
- params.markDelivered();
2518
- return true;
2519
- }
2520
- return tryEditPreviewMessage({
2521
- laneName,
2522
- messageId: previewMessageId,
2523
- text,
2524
- context,
2525
- previewButtons,
2526
- updateLaneSnapshot,
2527
- lane,
2528
- treatEditFailureAsDelivered: true
2529
- });
2530
- }
2531
- if (stopBeforeEdit) await params.stopDraftLane(lane);
2532
- const previewMessageId = typeof previewMessageIdOverride === "number" ? previewMessageIdOverride : lane.stream.messageId();
2533
- if (typeof previewMessageId !== "number") return false;
2534
- if (shouldSkipRegressivePreviewUpdate({
2535
- currentPreviewText: previewTextSnapshot ?? getLanePreviewText(lane),
2536
- text,
2537
- skipRegressive,
2538
- hadPreviewMessage
2539
- })) {
2540
- params.markDelivered();
2541
- return true;
2542
- }
2543
- return tryEditPreviewMessage({
2544
- laneName,
2545
- messageId: previewMessageId,
2546
- text,
2547
- context,
2548
- previewButtons,
2549
- updateLaneSnapshot,
2550
- lane,
2551
- treatEditFailureAsDelivered: false
2552
- });
2553
- };
2554
- const consumeArchivedAnswerPreviewForFinal = async ({ lane, text, payload, previewButtons, canEditViaPreview }) => {
2555
- const archivedPreview = params.archivedAnswerPreviews.shift();
2556
- if (!archivedPreview) return;
2557
- if (canEditViaPreview) {
2558
- if (await tryUpdatePreviewForLane({
2559
- lane,
2560
- laneName: "answer",
2561
- text,
2562
- previewButtons,
2563
- stopBeforeEdit: false,
2564
- skipRegressive: "existingOnly",
2565
- context: "final",
2566
- previewMessageId: archivedPreview.messageId,
2567
- previewTextSnapshot: archivedPreview.textSnapshot
2568
- })) return "preview-finalized";
2569
- }
2570
- try {
2571
- await params.deletePreviewMessage(archivedPreview.messageId);
2572
- } catch (err) {
2573
- params.log(`telegram: archived answer preview cleanup failed (${archivedPreview.messageId}): ${String(err)}`);
2574
- }
2575
- return await params.sendPayload(params.applyTextToPayload(payload, text)) ? "sent" : "skipped";
2576
- };
2577
- return async ({ laneName, text, payload, infoKind, previewButtons, allowPreviewUpdateForNonFinal = false }) => {
2578
- const lane = params.lanes[laneName];
2579
- const hasMedia = Boolean(payload.mediaUrl) || (payload.mediaUrls?.length ?? 0) > 0;
2580
- const canEditViaPreview = !hasMedia && text.length > 0 && text.length <= params.draftMaxChars && !payload.isError;
2581
- if (infoKind === "final") {
2582
- if (laneName === "answer") {
2583
- const archivedResult = await consumeArchivedAnswerPreviewForFinal({
2584
- lane,
2585
- text,
2586
- payload,
2587
- previewButtons,
2588
- canEditViaPreview
2589
- });
2590
- if (archivedResult) return archivedResult;
2591
- }
2592
- if (canEditViaPreview && !params.finalizedPreviewByLane[laneName]) {
2593
- await params.flushDraftLane(lane);
2594
- if (laneName === "answer") {
2595
- const archivedResultAfterFlush = await consumeArchivedAnswerPreviewForFinal({
2596
- lane,
2597
- text,
2598
- payload,
2599
- previewButtons,
2600
- canEditViaPreview
2601
- });
2602
- if (archivedResultAfterFlush) return archivedResultAfterFlush;
2603
- }
2604
- if (await tryUpdatePreviewForLane({
2605
- lane,
2606
- laneName,
2607
- text,
2608
- previewButtons,
2609
- stopBeforeEdit: true,
2610
- skipRegressive: "existingOnly",
2611
- context: "final"
2612
- })) {
2613
- params.finalizedPreviewByLane[laneName] = true;
2614
- return "preview-finalized";
2615
- }
2616
- } else if (!hasMedia && !payload.isError && text.length > params.draftMaxChars) params.log(`telegram: preview final too long for edit (${text.length} > ${params.draftMaxChars}); falling back to standard send`);
2617
- await params.stopDraftLane(lane);
2618
- return await params.sendPayload(params.applyTextToPayload(payload, text)) ? "sent" : "skipped";
2619
- }
2620
- if (allowPreviewUpdateForNonFinal && canEditViaPreview) {
2621
- if (await tryUpdatePreviewForLane({
2622
- lane,
2623
- laneName,
2624
- text,
2625
- previewButtons,
2626
- stopBeforeEdit: false,
2627
- updateLaneSnapshot: true,
2628
- skipRegressive: "always",
2629
- context: "update"
2630
- })) return "preview-updated";
2631
- }
2632
- return await params.sendPayload(params.applyTextToPayload(payload, text)) ? "sent" : "skipped";
2633
- };
2634
- }
2635
-
2636
- //#endregion
2637
- //#region src/telegram/reasoning-lane-coordinator.ts
2638
- const REASONING_MESSAGE_PREFIX = "Reasoning:\n";
2639
- const REASONING_TAG_PREFIXES = [
2640
- "<think",
2641
- "<thinking",
2642
- "<thought",
2643
- "<antthinking",
2644
- "</think",
2645
- "</thinking",
2646
- "</thought",
2647
- "</antthinking"
2648
- ];
2649
- const THINKING_TAG_RE = /<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^<>]*>/gi;
2650
- function extractThinkingFromTaggedStreamOutsideCode(text) {
2651
- if (!text) return "";
2652
- const codeRegions = findCodeRegions(text);
2653
- let result = "";
2654
- let lastIndex = 0;
2655
- let inThinking = false;
2656
- THINKING_TAG_RE.lastIndex = 0;
2657
- for (const match of text.matchAll(THINKING_TAG_RE)) {
2658
- const idx = match.index ?? 0;
2659
- if (isInsideCode(idx, codeRegions)) continue;
2660
- if (inThinking) result += text.slice(lastIndex, idx);
2661
- inThinking = !(match[1] === "/");
2662
- lastIndex = idx + match[0].length;
2663
- }
2664
- if (inThinking) result += text.slice(lastIndex);
2665
- return result.trim();
2666
- }
2667
- function isPartialReasoningTagPrefix(text) {
2668
- const trimmed = text.trimStart().toLowerCase();
2669
- if (!trimmed.startsWith("<")) return false;
2670
- if (trimmed.includes(">")) return false;
2671
- return REASONING_TAG_PREFIXES.some((prefix) => prefix.startsWith(trimmed));
2672
- }
2673
- function splitTelegramReasoningText(text) {
2674
- if (typeof text !== "string") return {};
2675
- const trimmed = text.trim();
2676
- if (isPartialReasoningTagPrefix(trimmed)) return {};
2677
- if (trimmed.startsWith(REASONING_MESSAGE_PREFIX) && trimmed.length > 11) return { reasoningText: trimmed };
2678
- const taggedReasoning = extractThinkingFromTaggedStreamOutsideCode(text);
2679
- const strippedAnswer = stripReasoningTagsFromText(text, {
2680
- mode: "strict",
2681
- trim: "both"
2682
- });
2683
- if (!taggedReasoning && strippedAnswer === text) return { answerText: text };
2684
- return {
2685
- reasoningText: taggedReasoning ? formatReasoningMessage(taggedReasoning) : void 0,
2686
- answerText: strippedAnswer || void 0
2687
- };
2688
- }
2689
- function createTelegramReasoningStepState() {
2690
- let reasoningStatus = "none";
2691
- let bufferedFinalAnswer;
2692
- const noteReasoningHint = () => {
2693
- if (reasoningStatus === "none") reasoningStatus = "hinted";
2694
- };
2695
- const noteReasoningDelivered = () => {
2696
- reasoningStatus = "delivered";
2697
- };
2698
- const shouldBufferFinalAnswer = () => {
2699
- return reasoningStatus === "hinted" && !bufferedFinalAnswer;
2700
- };
2701
- const bufferFinalAnswer = (value) => {
2702
- bufferedFinalAnswer = value;
2703
- };
2704
- const takeBufferedFinalAnswer = () => {
2705
- const value = bufferedFinalAnswer;
2706
- bufferedFinalAnswer = void 0;
2707
- return value;
2708
- };
2709
- const resetForNextStep = () => {
2710
- reasoningStatus = "none";
2711
- bufferedFinalAnswer = void 0;
2712
- };
2713
- return {
2714
- noteReasoningHint,
2715
- noteReasoningDelivered,
2716
- shouldBufferFinalAnswer,
2717
- bufferFinalAnswer,
2718
- takeBufferedFinalAnswer,
2719
- resetForNextStep
2720
- };
2721
- }
2722
-
2723
- //#endregion
2724
- //#region src/telegram/bot-message-dispatch.ts
2725
- const EMPTY_RESPONSE_FALLBACK$1 = "No response generated. Please try again.";
2726
- /** Minimum chars before sending first streaming message (improves push notification UX) */
2727
- const DRAFT_MIN_INITIAL_CHARS = 30;
2728
- const PROGRESS_DRAFT_LABEL = "Working";
2729
- function formatTelegramProgressToolName(name) {
2730
- const normalized = name?.trim();
2731
- if (!normalized) return "Tool";
2732
- return normalized.replace(/[_-]+/g, " ").split(/\s+/).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
2733
- }
2734
- function formatTelegramToolProgressDraft(payload) {
2735
- return `${PROGRESS_DRAFT_LABEL}\n\`🛠️ ${formatTelegramProgressToolName(payload.name)}\``;
2736
- }
2737
- async function resolveStickerVisionSupport(cfg, agentId) {
2738
- try {
2739
- const catalog = await loadModelCatalog({ config: cfg });
2740
- const defaultModel = resolveDefaultModelForAgent({
2741
- cfg,
2742
- agentId
2743
- });
2744
- const entry = findModelInCatalog(catalog, defaultModel.provider, defaultModel.model);
2745
- if (!entry) return false;
2746
- return modelSupportsVision(entry);
2747
- } catch {
2748
- return false;
2749
- }
2750
- }
2751
- function pruneStickerMediaFromContext(ctxPayload, opts) {
2752
- if (opts?.stickerMediaIncluded === false) return;
2753
- const nextMediaPaths = Array.isArray(ctxPayload.MediaPaths) ? ctxPayload.MediaPaths.slice(1) : void 0;
2754
- const nextMediaUrls = Array.isArray(ctxPayload.MediaUrls) ? ctxPayload.MediaUrls.slice(1) : void 0;
2755
- const nextMediaTypes = Array.isArray(ctxPayload.MediaTypes) ? ctxPayload.MediaTypes.slice(1) : void 0;
2756
- ctxPayload.MediaPaths = nextMediaPaths && nextMediaPaths.length > 0 ? nextMediaPaths : void 0;
2757
- ctxPayload.MediaUrls = nextMediaUrls && nextMediaUrls.length > 0 ? nextMediaUrls : void 0;
2758
- ctxPayload.MediaTypes = nextMediaTypes && nextMediaTypes.length > 0 ? nextMediaTypes : void 0;
2759
- ctxPayload.MediaPath = ctxPayload.MediaPaths?.[0];
2760
- ctxPayload.MediaUrl = ctxPayload.MediaUrls?.[0] ?? ctxPayload.MediaPath;
2761
- ctxPayload.MediaType = ctxPayload.MediaTypes?.[0];
2762
- }
2763
- function resolveTelegramReasoningLevel(params) {
2764
- const { cfg, sessionKey, agentId } = params;
2765
- if (!sessionKey) return "off";
2766
- try {
2767
- const store = loadSessionStore(resolveStorePath(cfg.session?.store, { agentId }), { skipCache: true });
2768
- const level = (store[sessionKey.toLowerCase()] ?? store[sessionKey])?.reasoningLevel;
2769
- if (level === "on" || level === "stream") return level;
2770
- } catch {}
2771
- return "off";
2772
- }
2773
- const dispatchTelegramMessage = async ({ context, bot, cfg, runtime, replyToMode, streamMode, textLimit, telegramCfg, opts }) => {
2774
- const { ctxPayload, msg, chatId, isGroup, threadSpec, historyKey, historyLimit, groupHistories, route, skillFilter, sendTyping, sendRecordVoice, ackReactionPromise, reactionApi, removeAckAfterReply, statusReactionController } = context;
2775
- const draftMaxChars = Math.min(textLimit, 4096);
2776
- const tableMode = resolveMarkdownTableMode({
2777
- cfg,
2778
- channel: "telegram",
2779
- accountId: route.accountId
2780
- });
2781
- const renderDraftPreview = (text) => ({
2782
- text: renderTelegramHtmlText(text, { tableMode }),
2783
- parseMode: "HTML"
2784
- });
2785
- const accountBlockStreamingEnabled = typeof telegramCfg.blockStreaming === "boolean" ? telegramCfg.blockStreaming : cfg.agents?.defaults?.blockStreamingDefault === "on";
2786
- const resolvedReasoningLevel = resolveTelegramReasoningLevel({
2787
- cfg,
2788
- sessionKey: ctxPayload.SessionKey,
2789
- agentId: route.agentId
2790
- });
2791
- const forceBlockStreamingForReasoning = resolvedReasoningLevel === "on";
2792
- const streamReasoningDraft = resolvedReasoningLevel === "stream";
2793
- const previewStreamingEnabled = streamMode !== "off";
2794
- const canStreamAnswerDraft = previewStreamingEnabled && !accountBlockStreamingEnabled && !forceBlockStreamingForReasoning;
2795
- const canStreamReasoningDraft = canStreamAnswerDraft || streamReasoningDraft;
2796
- const draftReplyToMessageId = replyToMode !== "off" && typeof msg.message_id === "number" ? msg.message_id : void 0;
2797
- const draftMinInitialChars = DRAFT_MIN_INITIAL_CHARS;
2798
- const mediaLocalRoots = getAgentScopedMediaLocalRoots(cfg, route.agentId);
2799
- const archivedAnswerPreviews = [];
2800
- const archivedReasoningPreviewIds = [];
2801
- const createDraftLane = (laneName, enabled) => {
2802
- return {
2803
- stream: enabled ? createTelegramDraftStream({
2804
- api: bot.api,
2805
- chatId,
2806
- maxChars: draftMaxChars,
2807
- thread: threadSpec,
2808
- replyToMessageId: draftReplyToMessageId,
2809
- minInitialChars: draftMinInitialChars,
2810
- renderText: renderDraftPreview,
2811
- onSupersededPreview: laneName === "answer" || laneName === "reasoning" ? (preview) => {
2812
- if (laneName === "reasoning") {
2813
- if (!archivedReasoningPreviewIds.includes(preview.messageId)) archivedReasoningPreviewIds.push(preview.messageId);
2814
- return;
2815
- }
2816
- archivedAnswerPreviews.push({
2817
- messageId: preview.messageId,
2818
- textSnapshot: preview.textSnapshot
2819
- });
2820
- } : void 0,
2821
- log: logVerbose,
2822
- warn: logVerbose
2823
- }) : void 0,
2824
- lastPartialText: "",
2825
- hasStreamedMessage: false
2826
- };
2827
- };
2828
- const lanes = {
2829
- answer: createDraftLane("answer", canStreamAnswerDraft),
2830
- reasoning: createDraftLane("reasoning", canStreamReasoningDraft)
2831
- };
2832
- const answerLane = lanes.answer;
2833
- const reasoningLane = lanes.reasoning;
2834
- const progressDraftsEnabled = telegramCfg.streaming === "progress" && Boolean(answerLane.stream);
2835
- let splitReasoningOnNextStream = false;
2836
- const reasoningStepState = createTelegramReasoningStepState();
2837
- const splitTextIntoLaneSegments = (text) => {
2838
- const split = splitTelegramReasoningText(text);
2839
- const segments = [];
2840
- const suppressReasoning = resolvedReasoningLevel === "off";
2841
- if (split.reasoningText && !suppressReasoning) segments.push({
2842
- lane: "reasoning",
2843
- text: split.reasoningText
2844
- });
2845
- if (split.answerText) segments.push({
2846
- lane: "answer",
2847
- text: split.answerText
2848
- });
2849
- return {
2850
- segments,
2851
- suppressedReasoningOnly: Boolean(split.reasoningText) && suppressReasoning && !split.answerText
2852
- };
2853
- };
2854
- const resetDraftLaneState = (lane) => {
2855
- lane.lastPartialText = "";
2856
- lane.hasStreamedMessage = false;
2857
- };
2858
- const updateDraftFromPartial = (lane, text) => {
2859
- const laneStream = lane.stream;
2860
- if (!laneStream || !text) return;
2861
- if (text === lane.lastPartialText) return;
2862
- lane.hasStreamedMessage = true;
2863
- if (lane.lastPartialText && lane.lastPartialText.startsWith(text) && text.length < lane.lastPartialText.length) return;
2864
- lane.lastPartialText = text;
2865
- laneStream.update(text);
2866
- };
2867
- const pushToolProgressDraft = async (payload) => {
2868
- if (!progressDraftsEnabled || !answerLane.stream) return;
2869
- const text = formatTelegramToolProgressDraft(payload);
2870
- answerLane.stream.update(text);
2871
- answerLane.lastPartialText = text;
2872
- answerLane.hasStreamedMessage = true;
2873
- await answerLane.stream.flush();
2874
- };
2875
- const ingestDraftLaneSegments = (text) => {
2876
- const split = splitTextIntoLaneSegments(text);
2877
- for (const segment of split.segments) {
2878
- if (segment.lane === "reasoning") {
2879
- reasoningStepState.noteReasoningHint();
2880
- reasoningStepState.noteReasoningDelivered();
2881
- }
2882
- updateDraftFromPartial(lanes[segment.lane], segment.text);
2883
- }
2884
- };
2885
- const flushDraftLane = async (lane) => {
2886
- if (!lane.stream) return;
2887
- await lane.stream.flush();
2888
- };
2889
- const disableBlockStreaming = !previewStreamingEnabled ? true : forceBlockStreamingForReasoning ? false : typeof telegramCfg.blockStreaming === "boolean" ? !telegramCfg.blockStreaming : canStreamAnswerDraft ? true : void 0;
2890
- const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
2891
- cfg,
2892
- agentId: route.agentId,
2893
- channel: "telegram",
2894
- accountId: route.accountId
2895
- });
2896
- const chunkMode = resolveChunkMode(cfg, "telegram", route.accountId);
2897
- const sticker = ctxPayload.Sticker;
2898
- if (sticker?.fileId && sticker.fileUniqueId && ctxPayload.MediaPath) {
2899
- const agentDir = resolveAgentDir(cfg, route.agentId);
2900
- const stickerSupportsVision = await resolveStickerVisionSupport(cfg, route.agentId);
2901
- let description = sticker.cachedDescription ?? null;
2902
- if (!description) description = await describeStickerImage({
2903
- imagePath: ctxPayload.MediaPath,
2904
- cfg,
2905
- agentDir,
2906
- agentId: route.agentId
2907
- });
2908
- if (description) {
2909
- const stickerContext = [sticker.emoji, sticker.setName ? `from "${sticker.setName}"` : null].filter(Boolean).join(" ");
2910
- const formattedDesc = `[Sticker${stickerContext ? ` ${stickerContext}` : ""}] ${description}`;
2911
- sticker.cachedDescription = description;
2912
- if (!stickerSupportsVision) {
2913
- ctxPayload.Body = formattedDesc;
2914
- ctxPayload.BodyForAgent = formattedDesc;
2915
- pruneStickerMediaFromContext(ctxPayload, { stickerMediaIncluded: ctxPayload.StickerMediaIncluded });
2916
- }
2917
- if (sticker.fileId) {
2918
- cacheSticker({
2919
- fileId: sticker.fileId,
2920
- fileUniqueId: sticker.fileUniqueId,
2921
- emoji: sticker.emoji,
2922
- setName: sticker.setName,
2923
- description,
2924
- cachedAt: (/* @__PURE__ */ new Date()).toISOString(),
2925
- receivedFrom: ctxPayload.From
2926
- });
2927
- logVerbose(`telegram: cached sticker description for ${sticker.fileUniqueId}`);
2928
- } else logVerbose(`telegram: skipped sticker cache (missing fileId)`);
2929
- }
2930
- }
2931
- const replyQuoteText = ctxPayload.ReplyToIsQuote && ctxPayload.ReplyToBody ? ctxPayload.ReplyToBody.trim() || void 0 : void 0;
2932
- const deliveryState = createLaneDeliveryStateTracker();
2933
- const finalizedPreviewByLane = {
2934
- answer: false,
2935
- reasoning: false
2936
- };
2937
- const clearGroupHistory = () => {
2938
- if (isGroup && historyKey) clearHistoryEntriesIfEnabled({
2939
- historyMap: groupHistories,
2940
- historyKey,
2941
- limit: historyLimit
2942
- });
2943
- };
2944
- const deliveryBaseOptions = {
2945
- chatId: String(chatId),
2946
- token: opts.token,
2947
- runtime,
2948
- bot,
2949
- mediaLocalRoots,
2950
- replyToMode,
2951
- textLimit,
2952
- thread: threadSpec,
2953
- tableMode,
2954
- chunkMode,
2955
- linkPreview: telegramCfg.linkPreview,
2956
- replyQuoteText
2957
- };
2958
- const applyTextToPayload = (payload, text) => {
2959
- if (payload.text === text) return payload;
2960
- return {
2961
- ...payload,
2962
- text
2963
- };
2964
- };
2965
- const sendPayload = async (payload) => {
2966
- const result = await deliverReplies({
2967
- ...deliveryBaseOptions,
2968
- replies: [payload],
2969
- onVoiceRecording: sendRecordVoice
2970
- });
2971
- if (result.delivered) deliveryState.markDelivered();
2972
- return result.delivered;
2973
- };
2974
- const deliverLaneText = createLaneTextDeliverer({
2975
- lanes,
2976
- archivedAnswerPreviews,
2977
- finalizedPreviewByLane,
2978
- draftMaxChars,
2979
- applyTextToPayload,
2980
- sendPayload,
2981
- flushDraftLane,
2982
- stopDraftLane: async (lane) => {
2983
- await lane.stream?.stop();
2984
- },
2985
- editPreview: async ({ messageId, text, previewButtons }) => {
2986
- await editMessageTelegram(chatId, messageId, text, {
2987
- api: bot.api,
2988
- cfg,
2989
- accountId: route.accountId,
2990
- linkPreview: telegramCfg.linkPreview,
2991
- buttons: previewButtons
2992
- });
2993
- },
2994
- deletePreviewMessage: async (messageId) => {
2995
- await bot.api.deleteMessage(chatId, messageId);
2996
- },
2997
- log: logVerbose,
2998
- markDelivered: () => {
2999
- deliveryState.markDelivered();
3000
- }
3001
- });
3002
- let queuedFinal = false;
3003
- if (statusReactionController) statusReactionController.setThinking();
3004
- const typingCallbacks = createTypingCallbacks({
3005
- start: sendTyping,
3006
- onStartError: (err) => {
3007
- logTypingFailure({
3008
- log: logVerbose,
3009
- channel: "telegram",
3010
- target: String(chatId),
3011
- error: err
3012
- });
3013
- }
3014
- });
3015
- try {
3016
- ({queuedFinal} = await dispatchReplyWithBufferedBlockDispatcher({
3017
- ctx: ctxPayload,
3018
- cfg,
3019
- dispatcherOptions: {
3020
- ...prefixOptions,
3021
- typingCallbacks,
3022
- deliver: async (payload, info) => {
3023
- const previewButtons = (payload.channelData?.telegram)?.buttons;
3024
- const split = splitTextIntoLaneSegments(payload.text);
3025
- const segments = split.segments;
3026
- const hasMedia = Boolean(payload.mediaUrl) || (payload.mediaUrls?.length ?? 0) > 0;
3027
- const flushBufferedFinalAnswer = async () => {
3028
- const buffered = reasoningStepState.takeBufferedFinalAnswer();
3029
- if (!buffered) return;
3030
- const bufferedButtons = (buffered.payload.channelData?.telegram)?.buttons;
3031
- await deliverLaneText({
3032
- laneName: "answer",
3033
- text: buffered.text,
3034
- payload: buffered.payload,
3035
- infoKind: "final",
3036
- previewButtons: bufferedButtons
3037
- });
3038
- reasoningStepState.resetForNextStep();
3039
- };
3040
- for (const segment of segments) {
3041
- if (segment.lane === "answer" && info.kind === "final" && reasoningStepState.shouldBufferFinalAnswer()) {
3042
- reasoningStepState.bufferFinalAnswer({
3043
- payload,
3044
- text: segment.text
3045
- });
3046
- continue;
3047
- }
3048
- if (segment.lane === "reasoning") reasoningStepState.noteReasoningHint();
3049
- const result = await deliverLaneText({
3050
- laneName: segment.lane,
3051
- text: segment.text,
3052
- payload,
3053
- infoKind: info.kind,
3054
- previewButtons,
3055
- allowPreviewUpdateForNonFinal: segment.lane === "reasoning"
3056
- });
3057
- if (segment.lane === "reasoning") {
3058
- if (result !== "skipped") {
3059
- reasoningStepState.noteReasoningDelivered();
3060
- await flushBufferedFinalAnswer();
3061
- }
3062
- continue;
3063
- }
3064
- if (info.kind === "final") {
3065
- if (reasoningLane.hasStreamedMessage) finalizedPreviewByLane.reasoning = true;
3066
- reasoningStepState.resetForNextStep();
3067
- }
3068
- }
3069
- if (segments.length > 0) return;
3070
- if (split.suppressedReasoningOnly) {
3071
- if (hasMedia) await sendPayload(typeof payload.text === "string" ? {
3072
- ...payload,
3073
- text: ""
3074
- } : payload);
3075
- if (info.kind === "final") await flushBufferedFinalAnswer();
3076
- return;
3077
- }
3078
- if (info.kind === "final") {
3079
- await answerLane.stream?.stop();
3080
- await reasoningLane.stream?.stop();
3081
- reasoningStepState.resetForNextStep();
3082
- }
3083
- if (!(hasMedia || typeof payload.text !== "string" || payload.text.length > 0)) {
3084
- if (info.kind === "final") await flushBufferedFinalAnswer();
3085
- return;
3086
- }
3087
- await sendPayload(payload);
3088
- if (info.kind === "final") await flushBufferedFinalAnswer();
3089
- },
3090
- onSkip: (_payload, info) => {
3091
- if (info.reason !== "silent") deliveryState.markNonSilentSkip();
3092
- },
3093
- onError: (err, info) => {
3094
- deliveryState.markNonSilentFailure();
3095
- runtime.error?.(danger(`telegram ${info.kind} reply failed: ${String(err)}`));
3096
- }
3097
- },
3098
- replyOptions: {
3099
- skillFilter,
3100
- disableBlockStreaming,
3101
- allowProgressCallbacksWhenSourceDeliverySuppressed: progressDraftsEnabled ? true : void 0,
3102
- onPartialReply: answerLane.stream || reasoningLane.stream ? (payload) => ingestDraftLaneSegments(payload.text) : void 0,
3103
- onReasoningStream: reasoningLane.stream ? (payload) => {
3104
- if (splitReasoningOnNextStream) {
3105
- reasoningLane.stream?.forceNewMessage();
3106
- resetDraftLaneState(reasoningLane);
3107
- splitReasoningOnNextStream = false;
3108
- }
3109
- ingestDraftLaneSegments(payload.text);
3110
- } : void 0,
3111
- onAssistantMessageStart: answerLane.stream ? async () => {
3112
- reasoningStepState.resetForNextStep();
3113
- if (answerLane.hasStreamedMessage) {
3114
- const previewMessageId = answerLane.stream?.messageId();
3115
- if (typeof previewMessageId === "number" && !finalizedPreviewByLane.answer) archivedAnswerPreviews.push({
3116
- messageId: previewMessageId,
3117
- textSnapshot: answerLane.lastPartialText
3118
- });
3119
- answerLane.stream?.forceNewMessage();
3120
- }
3121
- resetDraftLaneState(answerLane);
3122
- finalizedPreviewByLane.answer = false;
3123
- } : void 0,
3124
- onReasoningEnd: reasoningLane.stream ? () => {
3125
- splitReasoningOnNextStream = reasoningLane.hasStreamedMessage;
3126
- } : void 0,
3127
- onToolStart: progressDraftsEnabled || statusReactionController ? async (payload) => {
3128
- const progressPromise = pushToolProgressDraft(payload);
3129
- if (statusReactionController) await statusReactionController.setTool(payload.name);
3130
- await progressPromise;
3131
- } : void 0,
3132
- onModelSelected
3133
- }
3134
- }));
3135
- } finally {
3136
- const streamCleanupStates = /* @__PURE__ */ new Map();
3137
- const lanesToCleanup = [{
3138
- laneName: "answer",
3139
- lane: answerLane
3140
- }, {
3141
- laneName: "reasoning",
3142
- lane: reasoningLane
3143
- }];
3144
- for (const laneState of lanesToCleanup) {
3145
- const stream = laneState.lane.stream;
3146
- if (!stream) continue;
3147
- const shouldClear = !finalizedPreviewByLane[laneState.laneName];
3148
- const existing = streamCleanupStates.get(stream);
3149
- if (!existing) {
3150
- streamCleanupStates.set(stream, { shouldClear });
3151
- continue;
3152
- }
3153
- existing.shouldClear = existing.shouldClear && shouldClear;
3154
- }
3155
- for (const [stream, cleanupState] of streamCleanupStates) {
3156
- await stream.stop();
3157
- if (cleanupState.shouldClear) await stream.clear();
3158
- }
3159
- for (const archivedPreview of archivedAnswerPreviews) try {
3160
- await bot.api.deleteMessage(chatId, archivedPreview.messageId);
3161
- } catch (err) {
3162
- logVerbose(`telegram: archived answer preview cleanup failed (${archivedPreview.messageId}): ${String(err)}`);
3163
- }
3164
- for (const messageId of archivedReasoningPreviewIds) try {
3165
- await bot.api.deleteMessage(chatId, messageId);
3166
- } catch (err) {
3167
- logVerbose(`telegram: archived reasoning preview cleanup failed (${messageId}): ${String(err)}`);
3168
- }
3169
- }
3170
- let sentFallback = false;
3171
- const deliverySummary = deliveryState.snapshot();
3172
- if (!deliverySummary.delivered && (deliverySummary.skippedNonSilent > 0 || deliverySummary.failedNonSilent > 0)) sentFallback = (await deliverReplies({
3173
- replies: [{ text: EMPTY_RESPONSE_FALLBACK$1 }],
3174
- ...deliveryBaseOptions
3175
- })).delivered;
3176
- const hasFinalResponse = queuedFinal || sentFallback;
3177
- if (statusReactionController && !hasFinalResponse) statusReactionController.setError().catch((err) => {
3178
- logVerbose(`telegram: status reaction error finalize failed: ${String(err)}`);
3179
- });
3180
- if (!hasFinalResponse) {
3181
- clearGroupHistory();
3182
- return;
3183
- }
3184
- if (statusReactionController) statusReactionController.setDone().catch((err) => {
3185
- logVerbose(`telegram: status reaction finalize failed: ${String(err)}`);
3186
- });
3187
- else removeAckReactionAfterReply({
3188
- removeAfterReply: removeAckAfterReply,
3189
- ackReactionPromise,
3190
- ackReactionValue: ackReactionPromise ? "ack" : null,
3191
- remove: () => reactionApi?.(chatId, msg.message_id ?? 0, []) ?? Promise.resolve(),
3192
- onError: (err) => {
3193
- if (!msg.message_id) return;
3194
- logAckFailure({
3195
- log: logVerbose,
3196
- channel: "telegram",
3197
- target: `${chatId}/${msg.message_id}`,
3198
- error: err
3199
- });
3200
- }
3201
- });
3202
- clearGroupHistory();
3203
- };
3204
-
3205
- //#endregion
3206
- //#region src/telegram/bot-message.ts
3207
- const createTelegramMessageProcessor = (deps) => {
3208
- const { bot, cfg, account, telegramCfg, historyLimit, groupHistories, dmPolicy, allowFrom, groupAllowFrom, ackReactionScope, logger, resolveGroupActivation, resolveGroupRequireMention, resolveTelegramGroupConfig, sendChatActionHandler, runtime, replyToMode, streamMode, textLimit, opts } = deps;
3209
- return async (primaryCtx, allMedia, storeAllowFrom, options, replyMedia) => {
3210
- const context = await buildTelegramMessageContext({
3211
- primaryCtx,
3212
- allMedia,
3213
- replyMedia,
3214
- storeAllowFrom,
3215
- options,
3216
- bot,
3217
- cfg,
3218
- account,
3219
- historyLimit,
3220
- groupHistories,
3221
- dmPolicy,
3222
- allowFrom,
3223
- groupAllowFrom,
3224
- ackReactionScope,
3225
- logger,
3226
- resolveGroupActivation,
3227
- resolveGroupRequireMention,
3228
- resolveTelegramGroupConfig,
3229
- sendChatActionHandler
3230
- });
3231
- if (!context) return;
3232
- await dispatchTelegramMessage({
3233
- context,
3234
- bot,
3235
- cfg,
3236
- runtime,
3237
- replyToMode,
3238
- streamMode,
3239
- textLimit,
3240
- telegramCfg,
3241
- opts
3242
- });
3243
- };
3244
- };
3245
-
3246
- //#endregion
3247
- //#region src/telegram/bot-native-command-menu.ts
3248
- const TELEGRAM_MAX_COMMANDS = 100;
3249
- const TELEGRAM_COMMAND_RETRY_RATIO = .8;
3250
- function isBotCommandsTooMuchError(err) {
3251
- if (!err) return false;
3252
- const pattern = /\bBOT_COMMANDS_TOO_MUCH\b/i;
3253
- if (typeof err === "string") return pattern.test(err);
3254
- if (err instanceof Error) {
3255
- if (pattern.test(err.message)) return true;
3256
- }
3257
- if (typeof err === "object") {
3258
- const maybe = err;
3259
- if (typeof maybe.description === "string" && pattern.test(maybe.description)) return true;
3260
- if (typeof maybe.message === "string" && pattern.test(maybe.message)) return true;
3261
- }
3262
- return false;
3263
- }
3264
- function buildPluginTelegramMenuCommands(params) {
3265
- const { specs, existingCommands } = params;
3266
- const commands = [];
3267
- const issues = [];
3268
- const pluginCommandNames = /* @__PURE__ */ new Set();
3269
- for (const spec of specs) {
3270
- const normalized = normalizeTelegramCommandName(spec.name);
3271
- if (!normalized || !TELEGRAM_COMMAND_NAME_PATTERN.test(normalized)) {
3272
- issues.push(`Plugin command "/${spec.name}" is invalid for Telegram (use a-z, 0-9, underscore; max 32 chars).`);
3273
- continue;
3274
- }
3275
- const description = spec.description.trim();
3276
- if (!description) {
3277
- issues.push(`Plugin command "/${normalized}" is missing a description.`);
3278
- continue;
3279
- }
3280
- if (existingCommands.has(normalized)) {
3281
- if (pluginCommandNames.has(normalized)) issues.push(`Plugin command "/${normalized}" is duplicated.`);
3282
- else issues.push(`Plugin command "/${normalized}" conflicts with an existing Telegram command.`);
3283
- continue;
3284
- }
3285
- pluginCommandNames.add(normalized);
3286
- existingCommands.add(normalized);
3287
- commands.push({
3288
- command: normalized,
3289
- description
3290
- });
3291
- }
3292
- return {
3293
- commands,
3294
- issues
3295
- };
3296
- }
3297
- function buildCappedTelegramMenuCommands(params) {
3298
- const { allCommands } = params;
3299
- const maxCommands = params.maxCommands ?? TELEGRAM_MAX_COMMANDS;
3300
- const totalCommands = allCommands.length;
3301
- const overflowCount = Math.max(0, totalCommands - maxCommands);
3302
- return {
3303
- commandsToRegister: allCommands.slice(0, maxCommands),
3304
- totalCommands,
3305
- maxCommands,
3306
- overflowCount
3307
- };
3308
- }
3309
- function syncTelegramMenuCommands(params) {
3310
- const { bot, runtime, commandsToRegister } = params;
3311
- const sync = async () => {
3312
- if (typeof bot.api.deleteMyCommands === "function") await withTelegramApiErrorLogging({
3313
- operation: "deleteMyCommands",
3314
- runtime,
3315
- fn: () => bot.api.deleteMyCommands()
3316
- }).catch(() => {});
3317
- if (commandsToRegister.length === 0) return;
3318
- let retryCommands = commandsToRegister;
3319
- while (retryCommands.length > 0) try {
3320
- await withTelegramApiErrorLogging({
3321
- operation: "setMyCommands",
3322
- runtime,
3323
- fn: () => bot.api.setMyCommands(retryCommands)
3324
- });
3325
- return;
3326
- } catch (err) {
3327
- if (!isBotCommandsTooMuchError(err)) throw err;
3328
- const nextCount = Math.floor(retryCommands.length * TELEGRAM_COMMAND_RETRY_RATIO);
3329
- const reducedCount = nextCount < retryCommands.length ? nextCount : retryCommands.length - 1;
3330
- if (reducedCount <= 0) {
3331
- runtime.error?.("Telegram rejected native command registration (BOT_COMMANDS_TOO_MUCH); leaving menu empty. Reduce commands or disable channels.telegram.commands.native.");
3332
- return;
3333
- }
3334
- runtime.log?.(`Telegram rejected ${retryCommands.length} commands (BOT_COMMANDS_TOO_MUCH); retrying with ${reducedCount}.`);
3335
- retryCommands = retryCommands.slice(0, reducedCount);
3336
- }
3337
- };
3338
- sync().catch((err) => {
3339
- runtime.error?.(`Telegram command sync failed: ${String(err)}`);
3340
- });
3341
- }
3342
-
3343
- //#endregion
3344
- //#region src/telegram/bot-native-commands.ts
3345
- const EMPTY_RESPONSE_FALLBACK = "No response generated. Please try again.";
3346
- async function resolveTelegramCommandAuth(params) {
3347
- const { msg, bot, cfg, accountId, telegramCfg, allowFrom, groupAllowFrom, useAccessGroups, resolveGroupPolicy, resolveTelegramGroupConfig, requireAuth } = params;
3348
- const chatId = msg.chat.id;
3349
- const isGroup = msg.chat.type === "group" || msg.chat.type === "supergroup";
3350
- const messageThreadId = msg.message_thread_id;
3351
- const isForum = msg.chat.is_forum === true;
3352
- const { resolvedThreadId, storeAllowFrom, groupConfig, topicConfig, effectiveGroupAllow, hasGroupAllowOverride } = await resolveTelegramGroupAllowFromContext({
3353
- chatId,
3354
- accountId,
3355
- isForum,
3356
- messageThreadId,
3357
- groupAllowFrom,
3358
- resolveTelegramGroupConfig
3359
- });
3360
- const senderId = msg.from?.id ? String(msg.from.id) : "";
3361
- const senderUsername = msg.from?.username ?? "";
3362
- const sendAuthMessage = async (text) => {
3363
- await withTelegramApiErrorLogging({
3364
- operation: "sendMessage",
3365
- fn: () => bot.api.sendMessage(chatId, text)
3366
- });
3367
- return null;
3368
- };
3369
- const rejectNotAuthorized = async () => {
3370
- return await sendAuthMessage("You are not authorized to use this command.");
3371
- };
3372
- const baseAccess = evaluateTelegramGroupBaseAccess({
3373
- isGroup,
3374
- groupConfig,
3375
- topicConfig,
3376
- hasGroupAllowOverride,
3377
- effectiveGroupAllow,
3378
- senderId,
3379
- senderUsername,
3380
- enforceAllowOverride: requireAuth,
3381
- requireSenderForAllowOverride: true
3382
- });
3383
- if (!baseAccess.allowed) {
3384
- if (baseAccess.reason === "group-disabled") return await sendAuthMessage("This group is disabled.");
3385
- if (baseAccess.reason === "topic-disabled") return await sendAuthMessage("This topic is disabled.");
3386
- return await rejectNotAuthorized();
3387
- }
3388
- const policyAccess = evaluateTelegramGroupPolicyAccess({
3389
- isGroup,
3390
- chatId,
3391
- cfg,
3392
- telegramCfg,
3393
- topicConfig,
3394
- groupConfig,
3395
- effectiveGroupAllow,
3396
- senderId,
3397
- senderUsername,
3398
- resolveGroupPolicy,
3399
- enforcePolicy: useAccessGroups,
3400
- useTopicAndGroupOverrides: false,
3401
- enforceAllowlistAuthorization: requireAuth,
3402
- allowEmptyAllowlistEntries: true,
3403
- requireSenderForAllowlistAuthorization: true,
3404
- checkChatAllowlist: useAccessGroups
3405
- });
3406
- if (!policyAccess.allowed) {
3407
- if (policyAccess.reason === "group-policy-disabled") return await sendAuthMessage("Telegram group commands are disabled.");
3408
- if (policyAccess.reason === "group-policy-allowlist-no-sender" || policyAccess.reason === "group-policy-allowlist-unauthorized") return await rejectNotAuthorized();
3409
- if (policyAccess.reason === "group-chat-not-allowed") return await sendAuthMessage("This group is not allowed.");
3410
- }
3411
- const dmAllow = normalizeDmAllowFromWithStore({
3412
- allowFrom,
3413
- storeAllowFrom: isGroup ? [] : storeAllowFrom,
3414
- dmPolicy: telegramCfg.dmPolicy ?? "pairing"
3415
- });
3416
- const senderAllowed = isSenderAllowed({
3417
- allow: dmAllow,
3418
- senderId,
3419
- senderUsername
3420
- });
3421
- const commandAuthorized = resolveCommandAuthorizedFromAuthorizers({
3422
- useAccessGroups,
3423
- authorizers: [{
3424
- configured: dmAllow.hasEntries,
3425
- allowed: senderAllowed
3426
- }],
3427
- modeWhenAccessGroupsOff: "configured"
3428
- });
3429
- if (requireAuth && !commandAuthorized) return await rejectNotAuthorized();
3430
- return {
3431
- chatId,
3432
- isGroup,
3433
- isForum,
3434
- resolvedThreadId,
3435
- senderId,
3436
- senderUsername,
3437
- groupConfig,
3438
- topicConfig,
3439
- commandAuthorized
3440
- };
3441
- }
3442
- const registerTelegramNativeCommands = ({ bot, cfg, runtime, accountId, telegramCfg, allowFrom, groupAllowFrom, replyToMode, textLimit, useAccessGroups, nativeEnabled, nativeSkillsEnabled, nativeDisabledExplicit, resolveGroupPolicy, resolveTelegramGroupConfig, shouldSkipUpdate, opts }) => {
3443
- const boundRoute = nativeEnabled && nativeSkillsEnabled ? resolveAgentRoute({
3444
- cfg,
3445
- channel: "telegram",
3446
- accountId
3447
- }) : null;
3448
- const boundAgentIds = boundRoute ? [boundRoute.agentId] : null;
3449
- const skillCommands = nativeEnabled && nativeSkillsEnabled ? listSkillCommandsForAgents(boundAgentIds ? {
3450
- cfg,
3451
- agentIds: boundAgentIds
3452
- } : { cfg }) : [];
3453
- const nativeCommands = nativeEnabled ? listNativeCommandSpecsForConfig(cfg, {
3454
- skillCommands,
3455
- provider: "telegram"
3456
- }) : [];
3457
- const reservedCommands = new Set(listNativeCommandSpecs().map((command) => normalizeTelegramCommandName(command.name)));
3458
- for (const command of skillCommands) reservedCommands.add(command.name.toLowerCase());
3459
- const customResolution = resolveTelegramCustomCommands({
3460
- commands: telegramCfg.customCommands,
3461
- reservedCommands
3462
- });
3463
- for (const issue of customResolution.issues) runtime.error?.(danger(issue.message));
3464
- const customCommands = customResolution.commands;
3465
- const pluginCatalog = buildPluginTelegramMenuCommands({
3466
- specs: getPluginCommandSpecs(),
3467
- existingCommands: new Set([...nativeCommands.map((command) => normalizeTelegramCommandName(command.name)), ...customCommands.map((command) => command.command)].map((command) => command.toLowerCase()))
3468
- });
3469
- for (const issue of pluginCatalog.issues) runtime.error?.(danger(issue));
3470
- const { commandsToRegister, totalCommands, maxCommands, overflowCount } = buildCappedTelegramMenuCommands({ allCommands: [
3471
- ...nativeCommands.map((command) => {
3472
- const normalized = normalizeTelegramCommandName(command.name);
3473
- if (!TELEGRAM_COMMAND_NAME_PATTERN.test(normalized)) {
3474
- runtime.error?.(danger(`Native command "${command.name}" is invalid for Telegram (resolved to "${normalized}"). Skipping.`));
3475
- return null;
3476
- }
3477
- return {
3478
- command: normalized,
3479
- description: command.description
3480
- };
3481
- }).filter((cmd) => cmd !== null),
3482
- ...nativeEnabled ? pluginCatalog.commands : [],
3483
- ...customCommands
3484
- ] });
3485
- if (overflowCount > 0) runtime.log?.(`Telegram limits bots to ${maxCommands} commands. ${totalCommands} configured; registering first ${maxCommands}. Use channels.telegram.commands.native: false to disable, or reduce plugin/skill/custom commands.`);
3486
- syncTelegramMenuCommands({
3487
- bot,
3488
- runtime,
3489
- commandsToRegister
3490
- });
3491
- const resolveCommandRuntimeContext = (params) => {
3492
- const { msg, isGroup, isForum, resolvedThreadId } = params;
3493
- const chatId = msg.chat.id;
3494
- const messageThreadId = msg.message_thread_id;
3495
- const threadSpec = resolveTelegramThreadSpec({
3496
- isGroup,
3497
- isForum,
3498
- messageThreadId
3499
- });
3500
- const parentPeer = buildTelegramParentPeer({
3501
- isGroup,
3502
- resolvedThreadId,
3503
- chatId
3504
- });
3505
- const route = resolveAgentRoute({
3506
- cfg,
3507
- channel: "telegram",
3508
- accountId,
3509
- peer: {
3510
- kind: isGroup ? "group" : "direct",
3511
- id: isGroup ? buildTelegramGroupPeerId(chatId, resolvedThreadId) : String(chatId)
3512
- },
3513
- parentPeer
3514
- });
3515
- return {
3516
- chatId,
3517
- threadSpec,
3518
- route,
3519
- mediaLocalRoots: getAgentScopedMediaLocalRoots(cfg, route.agentId),
3520
- tableMode: resolveMarkdownTableMode({
3521
- cfg,
3522
- channel: "telegram",
3523
- accountId: route.accountId
3524
- }),
3525
- chunkMode: resolveChunkMode(cfg, "telegram", route.accountId)
3526
- };
3527
- };
3528
- const buildCommandDeliveryBaseOptions = (params) => ({
3529
- chatId: String(params.chatId),
3530
- token: opts.token,
3531
- runtime,
3532
- bot,
3533
- mediaLocalRoots: params.mediaLocalRoots,
3534
- replyToMode,
3535
- textLimit,
3536
- thread: params.threadSpec,
3537
- tableMode: params.tableMode,
3538
- chunkMode: params.chunkMode,
3539
- linkPreview: telegramCfg.linkPreview
3540
- });
3541
- if (commandsToRegister.length > 0 || pluginCatalog.commands.length > 0) if (typeof bot.command !== "function") logVerbose("telegram: bot.command unavailable; skipping native handlers");
3542
- else {
3543
- for (const command of nativeCommands) {
3544
- const normalizedCommandName = normalizeTelegramCommandName(command.name);
3545
- bot.command(normalizedCommandName, async (ctx) => {
3546
- const msg = ctx.message;
3547
- if (!msg) return;
3548
- if (shouldSkipUpdate(ctx)) return;
3549
- const auth = await resolveTelegramCommandAuth({
3550
- msg,
3551
- bot,
3552
- cfg,
3553
- accountId,
3554
- telegramCfg,
3555
- allowFrom,
3556
- groupAllowFrom,
3557
- useAccessGroups,
3558
- resolveGroupPolicy,
3559
- resolveTelegramGroupConfig,
3560
- requireAuth: true
3561
- });
3562
- if (!auth) return;
3563
- const { chatId, isGroup, isForum, resolvedThreadId, senderId, senderUsername, groupConfig, topicConfig, commandAuthorized } = auth;
3564
- const { threadSpec, route, mediaLocalRoots, tableMode, chunkMode } = resolveCommandRuntimeContext({
3565
- msg,
3566
- isGroup,
3567
- isForum,
3568
- resolvedThreadId
3569
- });
3570
- const deliveryBaseOptions = buildCommandDeliveryBaseOptions({
3571
- chatId,
3572
- mediaLocalRoots,
3573
- threadSpec,
3574
- tableMode,
3575
- chunkMode
3576
- });
3577
- const threadParams = buildTelegramThreadParams(threadSpec) ?? {};
3578
- const commandDefinition = findCommandByNativeName(command.name, "telegram");
3579
- const rawText = ctx.match?.trim() ?? "";
3580
- const commandArgs = commandDefinition ? parseCommandArgs(commandDefinition, rawText) : rawText ? { raw: rawText } : void 0;
3581
- const prompt = commandDefinition ? buildCommandTextFromArgs(commandDefinition, commandArgs) : rawText ? `/${command.name} ${rawText}` : `/${command.name}`;
3582
- const menu = commandDefinition ? resolveCommandArgMenu({
3583
- command: commandDefinition,
3584
- args: commandArgs,
3585
- cfg
3586
- }) : null;
3587
- if (menu && commandDefinition) {
3588
- const title = menu.title ?? `Choose ${menu.arg.description || menu.arg.name} for /${commandDefinition.nativeName ?? commandDefinition.key}.`;
3589
- const rows = [];
3590
- for (let i = 0; i < menu.choices.length; i += 2) {
3591
- const slice = menu.choices.slice(i, i + 2);
3592
- rows.push(slice.map((choice) => {
3593
- const args = { values: { [menu.arg.name]: choice.value } };
3594
- return {
3595
- text: choice.label,
3596
- callback_data: buildCommandTextFromArgs(commandDefinition, args)
3597
- };
3598
- }));
3599
- }
3600
- const replyMarkup = buildInlineKeyboard(rows);
3601
- await withTelegramApiErrorLogging({
3602
- operation: "sendMessage",
3603
- runtime,
3604
- fn: () => bot.api.sendMessage(chatId, title, {
3605
- ...replyMarkup ? { reply_markup: replyMarkup } : {},
3606
- ...threadParams
3607
- })
3608
- });
3609
- return;
3610
- }
3611
- const baseSessionKey = route.sessionKey;
3612
- const dmThreadId = threadSpec.scope === "dm" ? threadSpec.id : void 0;
3613
- const sessionKey = (dmThreadId != null ? resolveThreadSessionKeys({
3614
- baseSessionKey,
3615
- threadId: String(dmThreadId)
3616
- }) : null)?.sessionKey ?? baseSessionKey;
3617
- const { skillFilter, groupSystemPrompt } = resolveTelegramGroupPromptSettings({
3618
- groupConfig,
3619
- topicConfig
3620
- });
3621
- const conversationLabel = isGroup ? msg.chat.title ? `${msg.chat.title} id:${chatId}` : `group:${chatId}` : buildSenderName(msg) ?? String(senderId || chatId);
3622
- const ctxPayload = finalizeInboundContext({
3623
- Body: prompt,
3624
- BodyForAgent: prompt,
3625
- RawBody: prompt,
3626
- CommandBody: prompt,
3627
- CommandArgs: commandArgs,
3628
- From: isGroup ? buildTelegramGroupFrom(chatId, resolvedThreadId) : `telegram:${chatId}`,
3629
- To: `slash:${senderId || chatId}`,
3630
- ChatType: isGroup ? "group" : "direct",
3631
- ConversationLabel: conversationLabel,
3632
- GroupSubject: isGroup ? msg.chat.title ?? void 0 : void 0,
3633
- GroupSystemPrompt: isGroup ? groupSystemPrompt : void 0,
3634
- SenderName: buildSenderName(msg),
3635
- SenderId: senderId || void 0,
3636
- SenderUsername: senderUsername || void 0,
3637
- Surface: "telegram",
3638
- Provider: "telegram",
3639
- MessageSid: String(msg.message_id),
3640
- Timestamp: msg.date ? msg.date * 1e3 : void 0,
3641
- WasMentioned: true,
3642
- CommandAuthorized: commandAuthorized,
3643
- CommandSource: "native",
3644
- SessionKey: `telegram:slash:${senderId || chatId}`,
3645
- AccountId: route.accountId,
3646
- CommandTargetSessionKey: sessionKey,
3647
- MessageThreadId: threadSpec.id,
3648
- IsForum: isForum,
3649
- OriginatingChannel: "telegram",
3650
- OriginatingTo: `telegram:${chatId}`
3651
- });
3652
- const storePath = resolveStorePath(cfg.session?.store, { agentId: route.agentId });
3653
- try {
3654
- await recordSessionMetaFromInbound({
3655
- storePath,
3656
- sessionKey: ctxPayload.SessionKey ?? route.sessionKey,
3657
- ctx: ctxPayload
3658
- });
3659
- } catch (err) {
3660
- runtime.error?.(danger(`telegram slash: failed updating session meta: ${String(err)}`));
3661
- }
3662
- const disableBlockStreaming = typeof telegramCfg.blockStreaming === "boolean" ? !telegramCfg.blockStreaming : void 0;
3663
- const deliveryState = {
3664
- delivered: false,
3665
- skippedNonSilent: 0
3666
- };
3667
- const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
3668
- cfg,
3669
- agentId: route.agentId,
3670
- channel: "telegram",
3671
- accountId: route.accountId
3672
- });
3673
- await dispatchReplyWithBufferedBlockDispatcher({
3674
- ctx: ctxPayload,
3675
- cfg,
3676
- dispatcherOptions: {
3677
- ...prefixOptions,
3678
- deliver: async (payload, _info) => {
3679
- if ((await deliverReplies({
3680
- replies: [payload],
3681
- ...deliveryBaseOptions
3682
- })).delivered) deliveryState.delivered = true;
3683
- },
3684
- onSkip: (_payload, info) => {
3685
- if (info.reason !== "silent") deliveryState.skippedNonSilent += 1;
3686
- },
3687
- onError: (err, info) => {
3688
- runtime.error?.(danger(`telegram slash ${info.kind} reply failed: ${String(err)}`));
3689
- }
3690
- },
3691
- replyOptions: {
3692
- skillFilter,
3693
- disableBlockStreaming,
3694
- onModelSelected
3695
- }
3696
- });
3697
- if (!deliveryState.delivered && deliveryState.skippedNonSilent > 0) await deliverReplies({
3698
- replies: [{ text: EMPTY_RESPONSE_FALLBACK }],
3699
- ...deliveryBaseOptions
3700
- });
3701
- });
3702
- }
3703
- for (const pluginCommand of pluginCatalog.commands) bot.command(pluginCommand.command, async (ctx) => {
3704
- const msg = ctx.message;
3705
- if (!msg) return;
3706
- if (shouldSkipUpdate(ctx)) return;
3707
- const chatId = msg.chat.id;
3708
- const rawText = ctx.match?.trim() ?? "";
3709
- const commandBody = `/${pluginCommand.command}${rawText ? ` ${rawText}` : ""}`;
3710
- const match = matchPluginCommand(commandBody);
3711
- if (!match) {
3712
- await withTelegramApiErrorLogging({
3713
- operation: "sendMessage",
3714
- runtime,
3715
- fn: () => bot.api.sendMessage(chatId, "Command not found.")
3716
- });
3717
- return;
3718
- }
3719
- const auth = await resolveTelegramCommandAuth({
3720
- msg,
3721
- bot,
3722
- cfg,
3723
- accountId,
3724
- telegramCfg,
3725
- allowFrom,
3726
- groupAllowFrom,
3727
- useAccessGroups,
3728
- resolveGroupPolicy,
3729
- resolveTelegramGroupConfig,
3730
- requireAuth: match.command.requireAuth !== false
3731
- });
3732
- if (!auth) return;
3733
- const { senderId, commandAuthorized, isGroup, isForum, resolvedThreadId } = auth;
3734
- const { threadSpec, mediaLocalRoots, tableMode, chunkMode } = resolveCommandRuntimeContext({
3735
- msg,
3736
- isGroup,
3737
- isForum,
3738
- resolvedThreadId
3739
- });
3740
- const deliveryBaseOptions = buildCommandDeliveryBaseOptions({
3741
- chatId,
3742
- mediaLocalRoots,
3743
- threadSpec,
3744
- tableMode,
3745
- chunkMode
3746
- });
3747
- const from = isGroup ? buildTelegramGroupFrom(chatId, threadSpec.id) : `telegram:${chatId}`;
3748
- const to = `telegram:${chatId}`;
3749
- await deliverReplies({
3750
- replies: [await executePluginCommand({
3751
- command: match.command,
3752
- args: match.args,
3753
- senderId,
3754
- channel: "telegram",
3755
- isAuthorizedSender: commandAuthorized,
3756
- commandBody,
3757
- config: cfg,
3758
- from,
3759
- to,
3760
- accountId,
3761
- messageThreadId: threadSpec.id
3762
- })],
3763
- ...deliveryBaseOptions
3764
- });
3765
- });
3766
- }
3767
- else if (nativeDisabledExplicit) withTelegramApiErrorLogging({
3768
- operation: "setMyCommands",
3769
- runtime,
3770
- fn: () => bot.api.setMyCommands([])
3771
- }).catch(() => {});
3772
- };
3773
-
3774
- //#endregion
3775
- //#region src/telegram/sendchataction-401-backoff.ts
3776
- const BACKOFF_POLICY = {
3777
- initialMs: 1e3,
3778
- maxMs: 3e5,
3779
- factor: 2,
3780
- jitter: .1
3781
- };
3782
- function is401Error(error) {
3783
- if (!error) return false;
3784
- const message = error instanceof Error ? error.message : JSON.stringify(error);
3785
- return message.includes("401") || message.toLowerCase().includes("unauthorized");
3786
- }
3787
- /**
3788
- * Creates a GLOBAL (per-account) handler for sendChatAction that tracks 401 errors
3789
- * across all message contexts. This prevents the infinite loop that caused Telegram
3790
- * to delete bots (issue #27092).
3791
- *
3792
- * When a 401 occurs, exponential backoff is applied (1s → 2s → 4s → ... → 5min).
3793
- * After maxConsecutive401 failures (default 10), all sendChatAction calls are
3794
- * suspended until reset() is called.
3795
- */
3796
- function createTelegramSendChatActionHandler({ sendChatActionFn, logger, maxConsecutive401 = 10 }) {
3797
- let consecutive401Failures = 0;
3798
- let suspended = false;
3799
- const reset = () => {
3800
- consecutive401Failures = 0;
3801
- suspended = false;
3802
- };
3803
- const sendChatAction = async (chatId, action, threadParams) => {
3804
- if (suspended) return;
3805
- if (consecutive401Failures > 0) {
3806
- const backoffMs = computeBackoff(BACKOFF_POLICY, consecutive401Failures);
3807
- logger(`sendChatAction backoff: waiting ${backoffMs}ms before retry (failure ${consecutive401Failures}/${maxConsecutive401})`);
3808
- await sleepWithAbort(backoffMs);
3809
- }
3810
- try {
3811
- await sendChatActionFn(chatId, action, threadParams);
3812
- if (consecutive401Failures > 0) {
3813
- logger(`sendChatAction recovered after ${consecutive401Failures} consecutive 401 failures`);
3814
- consecutive401Failures = 0;
3815
- }
3816
- } catch (error) {
3817
- if (is401Error(error)) {
3818
- consecutive401Failures++;
3819
- if (consecutive401Failures >= maxConsecutive401) {
3820
- suspended = true;
3821
- logger(`CRITICAL: sendChatAction suspended after ${consecutive401Failures} consecutive 401 errors. Bot token is likely invalid. Telegram may DELETE the bot if requests continue. Replace the token and restart: fased channels restart telegram`);
3822
- } else logger(`sendChatAction 401 error (${consecutive401Failures}/${maxConsecutive401}). Retrying with exponential backoff.`);
3823
- }
3824
- throw error;
3825
- }
3826
- };
3827
- return {
3828
- sendChatAction,
3829
- isSuspended: () => suspended,
3830
- reset
3831
- };
3832
- }
3833
-
3834
- //#endregion
3835
- //#region src/telegram/bot.ts
3836
- const TELEGRAM_CONTROL_COMMANDS = new Set(["/status"]);
3837
- function isTelegramControlRequestText(rawText, options) {
3838
- if (!rawText) return false;
3839
- if (isAbortRequestText(rawText, options)) return true;
3840
- const normalized = normalizeCommandBody(rawText, options).trim().toLowerCase();
3841
- return TELEGRAM_CONTROL_COMMANDS.has(normalized);
3842
- }
3843
- function getTelegramSequentialKey(ctx) {
3844
- const reaction = ctx.update?.message_reaction;
3845
- if (reaction?.chat?.id) return `telegram:${reaction.chat.id}`;
3846
- const msg = ctx.message ?? ctx.channelPost ?? ctx.editedChannelPost ?? ctx.update?.message ?? ctx.update?.edited_message ?? ctx.update?.channel_post ?? ctx.update?.edited_channel_post ?? ctx.update?.callback_query?.message;
3847
- const chatId = msg?.chat?.id ?? ctx.chat?.id;
3848
- const rawText = msg?.text ?? msg?.caption;
3849
- const botUsername = ctx.me?.username;
3850
- if (isTelegramControlRequestText(rawText, botUsername ? { botUsername } : void 0)) {
3851
- if (typeof chatId === "number") return `telegram:${chatId}:control`;
3852
- return "telegram:control";
3853
- }
3854
- const isGroup = msg?.chat?.type === "group" || msg?.chat?.type === "supergroup";
3855
- const messageThreadId = msg?.message_thread_id;
3856
- const isForum = msg?.chat?.is_forum;
3857
- const threadId = isGroup ? resolveTelegramForumThreadId({
3858
- isForum,
3859
- messageThreadId
3860
- }) : messageThreadId;
3861
- if (typeof chatId === "number") return threadId != null ? `telegram:${chatId}:topic:${threadId}` : `telegram:${chatId}`;
3862
- return "telegram:unknown";
3863
- }
3864
- function createTelegramBot(opts) {
3865
- const runtime = opts.runtime ?? createNonExitingRuntime();
3866
- const cfg = opts.config ?? loadConfig();
3867
- const account = resolveTelegramAccount({
3868
- cfg,
3869
- accountId: opts.accountId
3870
- });
3871
- const telegramCfg = account.config;
3872
- const fetchImpl = resolveTelegramFetch(opts.proxyFetch, { network: telegramCfg.network });
3873
- const shouldProvideFetch = Boolean(fetchImpl);
3874
- const fetchForClient = fetchImpl;
3875
- const timeoutSeconds = typeof telegramCfg?.timeoutSeconds === "number" && Number.isFinite(telegramCfg.timeoutSeconds) ? Math.max(1, Math.floor(telegramCfg.timeoutSeconds)) : void 0;
3876
- const client = shouldProvideFetch || timeoutSeconds ? {
3877
- ...shouldProvideFetch && fetchImpl ? { fetch: fetchForClient } : {},
3878
- ...timeoutSeconds ? { timeoutSeconds } : {}
3879
- } : void 0;
3880
- const bot = new Bot(opts.token, client ? { client } : void 0);
3881
- bot.api.config.use(apiThrottler());
3882
- bot.catch((err) => {
3883
- runtime.error?.(danger(`telegram bot error: ${formatUncaughtError(err)}`));
3884
- });
3885
- const recentUpdates = createTelegramUpdateDedupe();
3886
- const initialUpdateId = typeof opts.updateOffset?.lastUpdateId === "number" ? opts.updateOffset.lastUpdateId : null;
3887
- const pendingUpdateIds = /* @__PURE__ */ new Set();
3888
- let highestCompletedUpdateId = initialUpdateId;
3889
- let highestPersistedUpdateId = initialUpdateId;
3890
- const maybePersistSafeWatermark = () => {
3891
- if (typeof opts.updateOffset?.onUpdateId !== "function") return;
3892
- if (highestCompletedUpdateId === null) return;
3893
- let safe = highestCompletedUpdateId;
3894
- if (pendingUpdateIds.size > 0) {
3895
- let minPending = null;
3896
- for (const id of pendingUpdateIds) if (minPending === null || id < minPending) minPending = id;
3897
- if (minPending !== null) safe = Math.min(safe, minPending - 1);
3898
- }
3899
- if (highestPersistedUpdateId !== null && safe <= highestPersistedUpdateId) return;
3900
- highestPersistedUpdateId = safe;
3901
- opts.updateOffset.onUpdateId(safe);
3902
- };
3903
- const shouldSkipUpdate = (ctx) => {
3904
- const updateId = resolveTelegramUpdateId(ctx);
3905
- const skipCutoff = highestPersistedUpdateId ?? initialUpdateId;
3906
- if (typeof updateId === "number" && skipCutoff !== null && updateId <= skipCutoff) return true;
3907
- const key = buildTelegramUpdateKey(ctx);
3908
- const skipped = recentUpdates.check(key);
3909
- if (skipped && key && shouldLogVerbose()) logVerbose(`telegram dedupe: skipped ${key}`);
3910
- return skipped;
3911
- };
3912
- bot.use(async (ctx, next) => {
3913
- const updateId = resolveTelegramUpdateId(ctx);
3914
- if (typeof updateId === "number") pendingUpdateIds.add(updateId);
3915
- try {
3916
- await next();
3917
- } finally {
3918
- if (typeof updateId === "number") {
3919
- pendingUpdateIds.delete(updateId);
3920
- if (highestCompletedUpdateId === null || updateId > highestCompletedUpdateId) highestCompletedUpdateId = updateId;
3921
- maybePersistSafeWatermark();
3922
- }
3923
- }
3924
- });
3925
- bot.use(sequentialize(getTelegramSequentialKey));
3926
- const rawUpdateLogger = createSubsystemLogger("gateway/channels/telegram/raw-update");
3927
- const MAX_RAW_UPDATE_CHARS = 8e3;
3928
- const MAX_RAW_UPDATE_STRING = 500;
3929
- const MAX_RAW_UPDATE_ARRAY = 20;
3930
- const stringifyUpdate = (update) => {
3931
- const seen = /* @__PURE__ */ new WeakSet();
3932
- return JSON.stringify(update ?? null, (key, value) => {
3933
- if (typeof value === "string" && value.length > MAX_RAW_UPDATE_STRING) return `${value.slice(0, MAX_RAW_UPDATE_STRING)}...`;
3934
- if (Array.isArray(value) && value.length > MAX_RAW_UPDATE_ARRAY) return [...value.slice(0, MAX_RAW_UPDATE_ARRAY), `...(${value.length - MAX_RAW_UPDATE_ARRAY} more)`];
3935
- if (value && typeof value === "object") {
3936
- if (seen.has(value)) return "[Circular]";
3937
- seen.add(value);
3938
- }
3939
- return value;
3940
- });
3941
- };
3942
- bot.use(async (ctx, next) => {
3943
- if (shouldLogVerbose()) try {
3944
- const raw = stringifyUpdate(ctx.update);
3945
- const preview = raw.length > MAX_RAW_UPDATE_CHARS ? `${raw.slice(0, MAX_RAW_UPDATE_CHARS)}...` : raw;
3946
- rawUpdateLogger.debug(`telegram update: ${preview}`);
3947
- } catch (err) {
3948
- rawUpdateLogger.debug(`telegram update log failed: ${String(err)}`);
3949
- }
3950
- await next();
3951
- });
3952
- const historyLimit = Math.max(0, telegramCfg.historyLimit ?? cfg.messages?.groupChat?.historyLimit ?? DEFAULT_GROUP_HISTORY_LIMIT);
3953
- const groupHistories = /* @__PURE__ */ new Map();
3954
- const textLimit = resolveTextChunkLimit(cfg, "telegram", account.accountId);
3955
- const dmPolicy = telegramCfg.dmPolicy ?? "pairing";
3956
- const allowFrom = opts.allowFrom ?? telegramCfg.allowFrom;
3957
- const groupAllowFrom = opts.groupAllowFrom ?? telegramCfg.groupAllowFrom ?? (telegramCfg.allowFrom && telegramCfg.allowFrom.length > 0 ? telegramCfg.allowFrom : void 0) ?? (opts.allowFrom && opts.allowFrom.length > 0 ? opts.allowFrom : void 0);
3958
- const replyToMode = opts.replyToMode ?? telegramCfg.replyToMode ?? "off";
3959
- const nativeEnabled = resolveNativeCommandsEnabled({
3960
- providerId: "telegram",
3961
- providerSetting: telegramCfg.commands?.native,
3962
- globalSetting: cfg.commands?.native
3963
- });
3964
- const nativeSkillsEnabled = resolveNativeSkillsEnabled({
3965
- providerId: "telegram",
3966
- providerSetting: telegramCfg.commands?.nativeSkills,
3967
- globalSetting: cfg.commands?.nativeSkills
3968
- });
3969
- const nativeDisabledExplicit = isNativeCommandsExplicitlyDisabled({
3970
- providerSetting: telegramCfg.commands?.native,
3971
- globalSetting: cfg.commands?.native
3972
- });
3973
- const useAccessGroups = cfg.commands?.useAccessGroups !== false;
3974
- const ackReactionScope = cfg.messages?.ackReactionScope ?? "group-mentions";
3975
- const mediaMaxBytes = (opts.mediaMaxMb ?? telegramCfg.mediaMaxMb ?? 5) * 1024 * 1024;
3976
- const logger = getChildLogger({ module: "telegram-auto-reply" });
3977
- const streamMode = resolveTelegramStreamMode(telegramCfg);
3978
- const resolveGroupPolicy = (chatId) => resolveChannelGroupPolicy({
3979
- cfg,
3980
- channel: "telegram",
3981
- accountId: account.accountId,
3982
- groupId: String(chatId)
3983
- });
3984
- const resolveGroupActivation = (params) => {
3985
- const agentId = params.agentId ?? resolveDefaultAgentId(cfg);
3986
- const sessionKey = params.sessionKey ?? `agent:${agentId}:telegram:group:${buildTelegramGroupPeerId(params.chatId, params.messageThreadId)}`;
3987
- const storePath = resolveStorePath(cfg.session?.store, { agentId });
3988
- try {
3989
- const entry = loadSessionStore(storePath)[sessionKey];
3990
- if (entry?.groupActivation === "always") return false;
3991
- if (entry?.groupActivation === "mention") return true;
3992
- } catch (err) {
3993
- logVerbose(`Failed to load session for activation check: ${String(err)}`);
3994
- }
3995
- };
3996
- const resolveGroupRequireMention = (chatId) => resolveChannelGroupRequireMention({
3997
- cfg,
3998
- channel: "telegram",
3999
- accountId: account.accountId,
4000
- groupId: String(chatId),
4001
- requireMentionOverride: opts.requireMention,
4002
- overrideOrder: "after-config"
4003
- });
4004
- const resolveTelegramGroupConfig = (chatId, messageThreadId) => {
4005
- const groups = telegramCfg.groups;
4006
- if (!groups) return {
4007
- groupConfig: void 0,
4008
- topicConfig: void 0
4009
- };
4010
- const groupConfig = groups[String(chatId)] ?? groups["*"];
4011
- return {
4012
- groupConfig,
4013
- topicConfig: messageThreadId != null ? groupConfig?.topics?.[String(messageThreadId)] : void 0
4014
- };
4015
- };
4016
- const processMessage = createTelegramMessageProcessor({
4017
- bot,
4018
- cfg,
4019
- account,
4020
- telegramCfg,
4021
- historyLimit,
4022
- groupHistories,
4023
- dmPolicy,
4024
- allowFrom,
4025
- groupAllowFrom,
4026
- ackReactionScope,
4027
- logger,
4028
- resolveGroupActivation,
4029
- resolveGroupRequireMention,
4030
- resolveTelegramGroupConfig,
4031
- sendChatActionHandler: createTelegramSendChatActionHandler({
4032
- sendChatActionFn: (chatId, action, threadParams) => bot.api.sendChatAction(chatId, action, threadParams),
4033
- logger: (message) => logVerbose(`telegram: ${message}`)
4034
- }),
4035
- runtime,
4036
- replyToMode,
4037
- streamMode,
4038
- textLimit,
4039
- opts
4040
- });
4041
- registerTelegramNativeCommands({
4042
- bot,
4043
- cfg,
4044
- runtime,
4045
- accountId: account.accountId,
4046
- telegramCfg,
4047
- allowFrom,
4048
- groupAllowFrom,
4049
- replyToMode,
4050
- textLimit,
4051
- useAccessGroups,
4052
- nativeEnabled,
4053
- nativeSkillsEnabled,
4054
- nativeDisabledExplicit,
4055
- resolveGroupPolicy,
4056
- resolveTelegramGroupConfig,
4057
- shouldSkipUpdate,
4058
- opts
4059
- });
4060
- registerTelegramHandlers({
4061
- cfg,
4062
- accountId: account.accountId,
4063
- bot,
4064
- opts,
4065
- runtime,
4066
- mediaMaxBytes,
4067
- telegramCfg,
4068
- allowFrom,
4069
- groupAllowFrom,
4070
- resolveGroupPolicy,
4071
- resolveTelegramGroupConfig,
4072
- shouldSkipUpdate,
4073
- processMessage,
4074
- logger
4075
- });
4076
- return bot;
4077
- }
4078
-
4079
- //#endregion
4080
- //#region src/telegram/update-offset-store.ts
4081
- const STORE_VERSION = 2;
4082
- function normalizeAccountId(accountId) {
4083
- const trimmed = accountId?.trim();
4084
- if (!trimmed) return "default";
4085
- return trimmed.replace(/[^a-z0-9._-]+/gi, "_");
4086
- }
4087
- function resolveTelegramUpdateOffsetPath(accountId, env = process.env) {
4088
- const stateDir = resolveStateDir(env, os.homedir);
4089
- const normalized = normalizeAccountId(accountId);
4090
- return path.join(stateDir, "telegram", `update-offset-${normalized}.json`);
4091
- }
4092
- function extractBotIdFromToken(token) {
4093
- const trimmed = token?.trim();
4094
- if (!trimmed) return null;
4095
- const [rawBotId] = trimmed.split(":", 1);
4096
- if (!rawBotId || !/^\d+$/.test(rawBotId)) return null;
4097
- return rawBotId;
4098
- }
4099
- function safeParseState(raw) {
4100
- try {
4101
- const parsed = JSON.parse(raw);
4102
- if (parsed?.version !== STORE_VERSION && parsed?.version !== 1) return null;
4103
- if (parsed.lastUpdateId !== null && typeof parsed.lastUpdateId !== "number") return null;
4104
- if (parsed.version === STORE_VERSION && parsed.botId !== null && typeof parsed.botId !== "string") return null;
4105
- return {
4106
- version: STORE_VERSION,
4107
- lastUpdateId: parsed.lastUpdateId ?? null,
4108
- botId: parsed.version === STORE_VERSION ? parsed.botId ?? null : null
4109
- };
4110
- } catch {
4111
- return null;
4112
- }
4113
- }
4114
- async function readTelegramUpdateOffset(params) {
4115
- const filePath = resolveTelegramUpdateOffsetPath(params.accountId, params.env);
4116
- try {
4117
- const parsed = safeParseState(await fs.readFile(filePath, "utf-8"));
4118
- const expectedBotId = extractBotIdFromToken(params.botToken);
4119
- if (expectedBotId && parsed?.botId && parsed.botId !== expectedBotId) return null;
4120
- if (expectedBotId && parsed?.botId === null) return null;
4121
- return parsed?.lastUpdateId ?? null;
4122
- } catch (err) {
4123
- if (err.code === "ENOENT") return null;
4124
- return null;
4125
- }
4126
- }
4127
- async function writeTelegramUpdateOffset(params) {
4128
- const filePath = resolveTelegramUpdateOffsetPath(params.accountId, params.env);
4129
- const dir = path.dirname(filePath);
4130
- await fs.mkdir(dir, {
4131
- recursive: true,
4132
- mode: 448
4133
- });
4134
- const tmp = path.join(dir, `${path.basename(filePath)}.${crypto.randomUUID()}.tmp`);
4135
- const payload = {
4136
- version: STORE_VERSION,
4137
- lastUpdateId: params.updateId,
4138
- botId: extractBotIdFromToken(params.botToken)
4139
- };
4140
- await fs.writeFile(tmp, `${JSON.stringify(payload, null, 2)}\n`, { encoding: "utf-8" });
4141
- await fs.chmod(tmp, 384);
4142
- await fs.rename(tmp, filePath);
4143
- }
4144
-
4145
- //#endregion
4146
- //#region src/telegram/webhook.ts
4147
- const TELEGRAM_WEBHOOK_MAX_BODY_BYTES = 1024 * 1024;
4148
- const TELEGRAM_WEBHOOK_BODY_TIMEOUT_MS = 3e4;
4149
- const TELEGRAM_WEBHOOK_CALLBACK_TIMEOUT_MS = 1e4;
4150
- async function listenHttpServer(params) {
4151
- await new Promise((resolve, reject) => {
4152
- const onError = (err) => {
4153
- params.server.off("error", onError);
4154
- reject(err);
4155
- };
4156
- params.server.once("error", onError);
4157
- params.server.listen(params.port, params.host, () => {
4158
- params.server.off("error", onError);
4159
- resolve();
4160
- });
4161
- });
4162
- }
4163
- function resolveWebhookPublicUrl(params) {
4164
- if (params.configuredPublicUrl) return params.configuredPublicUrl;
4165
- const address = params.server.address();
4166
- if (address && typeof address !== "string") return `http://${params.host === "0.0.0.0" || address.address === "0.0.0.0" || address.address === "::" ? "localhost" : address.address}:${address.port}${params.path}`;
4167
- return `http://${params.host === "0.0.0.0" ? "localhost" : params.host}:${params.port}${params.path}`;
4168
- }
4169
- async function initializeTelegramWebhookBot(params) {
4170
- const initSignal = params.abortSignal;
4171
- await withTelegramApiErrorLogging({
4172
- operation: "getMe",
4173
- runtime: params.runtime,
4174
- fn: () => params.bot.init(initSignal)
4175
- });
4176
- }
4177
- async function startTelegramWebhook(opts) {
4178
- const path = opts.path ?? "/telegram-webhook";
4179
- const healthPath = opts.healthPath ?? "/healthz";
4180
- const port = opts.port ?? 8787;
4181
- const host = opts.host ?? "127.0.0.1";
4182
- const secret = typeof opts.secret === "string" ? opts.secret.trim() : "";
4183
- if (!secret) throw new Error("Telegram webhook mode requires a non-empty secret token. Set channels.telegram.webhookSecret in your config.");
4184
- const runtime = opts.runtime ?? defaultRuntime;
4185
- const diagnosticsEnabled = isDiagnosticsEnabled(opts.config);
4186
- const bot = createTelegramBot({
4187
- token: opts.token,
4188
- runtime,
4189
- proxyFetch: opts.fetch,
4190
- config: opts.config,
4191
- accountId: opts.accountId
4192
- });
4193
- await initializeTelegramWebhookBot({
4194
- bot,
4195
- runtime,
4196
- abortSignal: opts.abortSignal
4197
- });
4198
- const handler = webhookCallback(bot, "callback", {
4199
- secretToken: secret,
4200
- onTimeout: "return",
4201
- timeoutMilliseconds: TELEGRAM_WEBHOOK_CALLBACK_TIMEOUT_MS
4202
- });
4203
- if (diagnosticsEnabled) startDiagnosticHeartbeat();
4204
- const server = createServer((req, res) => {
4205
- const respondText = (statusCode, text = "") => {
4206
- if (res.headersSent || res.writableEnded) return;
4207
- res.writeHead(statusCode, { "Content-Type": "text/plain; charset=utf-8" });
4208
- res.end(text);
4209
- };
4210
- if (req.url === healthPath) {
4211
- res.writeHead(200);
4212
- res.end("ok");
4213
- return;
4214
- }
4215
- if (req.url !== path || req.method !== "POST") {
4216
- res.writeHead(404);
4217
- res.end();
4218
- return;
4219
- }
4220
- const startTime = Date.now();
4221
- if (diagnosticsEnabled) logWebhookReceived({
4222
- channel: "telegram",
4223
- updateType: "telegram-post"
4224
- });
4225
- (async () => {
4226
- const body = await readJsonBodyWithLimit(req, {
4227
- maxBytes: TELEGRAM_WEBHOOK_MAX_BODY_BYTES,
4228
- timeoutMs: TELEGRAM_WEBHOOK_BODY_TIMEOUT_MS,
4229
- emptyObjectOnEmpty: false
4230
- });
4231
- if (!body.ok) {
4232
- if (body.code === "PAYLOAD_TOO_LARGE") {
4233
- respondText(413, body.error);
4234
- return;
4235
- }
4236
- if (body.code === "REQUEST_BODY_TIMEOUT") {
4237
- respondText(408, body.error);
4238
- return;
4239
- }
4240
- if (body.code === "CONNECTION_CLOSED") {
4241
- respondText(400, body.error);
4242
- return;
4243
- }
4244
- respondText(400, body.error);
4245
- return;
4246
- }
4247
- let replied = false;
4248
- const reply = async (json) => {
4249
- if (replied) return;
4250
- replied = true;
4251
- if (res.headersSent || res.writableEnded) return;
4252
- res.writeHead(200, { "Content-Type": "application/json; charset=utf-8" });
4253
- res.end(json);
4254
- };
4255
- const unauthorized = async () => {
4256
- if (replied) return;
4257
- replied = true;
4258
- respondText(401, "unauthorized");
4259
- };
4260
- const secretHeaderRaw = req.headers["x-telegram-bot-api-secret-token"];
4261
- const secretHeader = Array.isArray(secretHeaderRaw) ? secretHeaderRaw[0] : secretHeaderRaw;
4262
- await handler(body.value, reply, secretHeader, unauthorized);
4263
- if (!replied) respondText(200);
4264
- if (diagnosticsEnabled) logWebhookProcessed({
4265
- channel: "telegram",
4266
- updateType: "telegram-post",
4267
- durationMs: Date.now() - startTime
4268
- });
4269
- })().catch((err) => {
4270
- const errMsg = formatErrorMessage(err);
4271
- if (diagnosticsEnabled) logWebhookError({
4272
- channel: "telegram",
4273
- updateType: "telegram-post",
4274
- error: errMsg
4275
- });
4276
- runtime.log?.(`webhook handler failed: ${errMsg}`);
4277
- respondText(500);
4278
- });
4279
- });
4280
- await listenHttpServer({
4281
- server,
4282
- port,
4283
- host
4284
- });
4285
- const boundAddress = server.address();
4286
- const boundPort = boundAddress && typeof boundAddress !== "string" ? boundAddress.port : port;
4287
- const publicUrl = resolveWebhookPublicUrl({
4288
- configuredPublicUrl: opts.publicUrl,
4289
- server,
4290
- path,
4291
- host,
4292
- port
4293
- });
4294
- try {
4295
- await withTelegramApiErrorLogging({
4296
- operation: "setWebhook",
4297
- runtime,
4298
- fn: () => bot.api.setWebhook(publicUrl, {
4299
- secret_token: secret,
4300
- allowed_updates: resolveTelegramAllowedUpdates()
4301
- })
4302
- });
4303
- } catch (err) {
4304
- server.close();
4305
- bot.stop();
4306
- if (diagnosticsEnabled) stopDiagnosticHeartbeat();
4307
- throw err;
4308
- }
4309
- runtime.log?.(`webhook local listener on http://${host}:${boundPort}${path}`);
4310
- runtime.log?.(`webhook advertised to telegram on ${publicUrl}`);
4311
- let shutDown = false;
4312
- const shutdown = () => {
4313
- if (shutDown) return;
4314
- shutDown = true;
4315
- withTelegramApiErrorLogging({
4316
- operation: "deleteWebhook",
4317
- runtime,
4318
- fn: () => bot.api.deleteWebhook({ drop_pending_updates: false })
4319
- }).catch(() => {});
4320
- server.close();
4321
- bot.stop();
4322
- if (diagnosticsEnabled) stopDiagnosticHeartbeat();
4323
- };
4324
- if (opts.abortSignal) opts.abortSignal.addEventListener("abort", shutdown, { once: true });
4325
- return {
4326
- server,
4327
- bot,
4328
- stop: shutdown
4329
- };
4330
- }
4331
-
4332
- //#endregion
4333
- //#region src/telegram/monitor.ts
4334
- function createTelegramRunnerOptions(cfg) {
4335
- return {
4336
- sink: { concurrency: resolveAgentMaxConcurrent(cfg) },
4337
- runner: {
4338
- fetch: {
4339
- timeout: 30,
4340
- allowed_updates: resolveTelegramAllowedUpdates()
4341
- },
4342
- silent: true,
4343
- maxRetryTime: 3600 * 1e3,
4344
- retryInterval: "exponential"
4345
- }
4346
- };
4347
- }
4348
- const TELEGRAM_POLL_RESTART_POLICY = {
4349
- initialMs: 2e3,
4350
- maxMs: 3e4,
4351
- factor: 1.8,
4352
- jitter: .25
4353
- };
4354
- const isGetUpdatesConflict = (err) => {
4355
- if (!err || typeof err !== "object") return false;
4356
- const typed = err;
4357
- if ((typed.error_code ?? typed.errorCode) !== 409) return false;
4358
- return [
4359
- typed.method,
4360
- typed.description,
4361
- typed.message
4362
- ].filter((value) => typeof value === "string").join(" ").toLowerCase().includes("getupdates");
4363
- };
4364
- /** Check if error is a Grammy HttpError (used to scope unhandled rejection handling) */
4365
- const isGrammyHttpError = (err) => {
4366
- if (!err || typeof err !== "object") return false;
4367
- return err.name === "HttpError";
4368
- };
4369
- async function monitorTelegramProvider(opts = {}) {
4370
- const log = opts.runtime?.error ?? console.error;
4371
- let activeRunner;
4372
- let forceRestarted = false;
4373
- const unregisterHandler = registerUnhandledRejectionHandler((err) => {
4374
- const isNetworkError = isRecoverableTelegramNetworkError(err, { context: "polling" });
4375
- if (isGrammyHttpError(err) && isNetworkError) {
4376
- log(`[telegram] Suppressed network error: ${formatErrorMessage(err)}`);
4377
- return true;
4378
- }
4379
- if (isNetworkError && activeRunner && activeRunner.isRunning()) {
4380
- forceRestarted = true;
4381
- activeRunner.stop().catch(() => {});
4382
- log(`[telegram] Restarting polling after unhandled network error: ${formatErrorMessage(err)}`);
4383
- return true;
4384
- }
4385
- return false;
4386
- });
4387
- try {
4388
- const cfg = opts.config ?? loadConfig();
4389
- const account = resolveTelegramAccount({
4390
- cfg,
4391
- accountId: opts.accountId
4392
- });
4393
- const token = opts.token?.trim() || account.token;
4394
- if (!token) throw new Error(`Telegram bot token missing for account "${account.accountId}" (set channels.telegram.accounts.${account.accountId}.botToken/tokenFile or TELEGRAM_BOT_TOKEN for default).`);
4395
- const proxyFetch = opts.proxyFetch ?? (account.config.proxy ? makeProxyFetch(account.config.proxy) : void 0);
4396
- let lastUpdateId = await readTelegramUpdateOffset({
4397
- accountId: account.accountId,
4398
- botToken: token
4399
- });
4400
- const persistUpdateId = async (updateId) => {
4401
- if (lastUpdateId !== null && updateId <= lastUpdateId) return;
4402
- lastUpdateId = updateId;
4403
- try {
4404
- await writeTelegramUpdateOffset({
4405
- accountId: account.accountId,
4406
- updateId,
4407
- botToken: token
4408
- });
4409
- } catch (err) {
4410
- (opts.runtime?.error ?? console.error)(`telegram: failed to persist update offset: ${String(err)}`);
4411
- }
4412
- };
4413
- if (opts.useWebhook) {
4414
- await startTelegramWebhook({
4415
- token,
4416
- accountId: account.accountId,
4417
- config: cfg,
4418
- path: opts.webhookPath,
4419
- port: opts.webhookPort,
4420
- secret: opts.webhookSecret ?? account.config.webhookSecret,
4421
- host: opts.webhookHost ?? account.config.webhookHost,
4422
- runtime: opts.runtime,
4423
- fetch: proxyFetch,
4424
- abortSignal: opts.abortSignal,
4425
- publicUrl: opts.webhookUrl
4426
- });
4427
- await waitForAbortSignal(opts.abortSignal);
4428
- return;
4429
- }
4430
- let restartAttempts = 0;
4431
- let webhookCleared = false;
4432
- const runnerOptions = createTelegramRunnerOptions(cfg);
4433
- const waitBeforeRestart = async (buildLine) => {
4434
- restartAttempts += 1;
4435
- const delayMs = computeBackoff(TELEGRAM_POLL_RESTART_POLICY, restartAttempts);
4436
- log(buildLine(formatDurationPrecise(delayMs)));
4437
- try {
4438
- await sleepWithAbort(delayMs, opts.abortSignal);
4439
- } catch (sleepErr) {
4440
- if (opts.abortSignal?.aborted) return false;
4441
- throw sleepErr;
4442
- }
4443
- return true;
4444
- };
4445
- const waitBeforeRetryOnRecoverableSetupError = async (err, logPrefix) => {
4446
- if (opts.abortSignal?.aborted) return false;
4447
- if (!isRecoverableTelegramNetworkError(err, { context: "unknown" })) throw err;
4448
- return waitBeforeRestart((delay) => `${logPrefix}: ${formatErrorMessage(err)}; retrying in ${delay}.`);
4449
- };
4450
- const createPollingBot = async () => {
4451
- try {
4452
- return createTelegramBot({
4453
- token,
4454
- runtime: opts.runtime,
4455
- proxyFetch,
4456
- config: cfg,
4457
- accountId: account.accountId,
4458
- updateOffset: {
4459
- lastUpdateId,
4460
- onUpdateId: persistUpdateId
4461
- }
4462
- });
4463
- } catch (err) {
4464
- if (!await waitBeforeRetryOnRecoverableSetupError(err, "Telegram setup network error")) return;
4465
- return;
4466
- }
4467
- };
4468
- const ensureWebhookCleanup = async (bot) => {
4469
- if (webhookCleared) return "ready";
4470
- try {
4471
- await withTelegramApiErrorLogging({
4472
- operation: "deleteWebhook",
4473
- runtime: opts.runtime,
4474
- fn: () => bot.api.deleteWebhook({ drop_pending_updates: false })
4475
- });
4476
- webhookCleared = true;
4477
- return "ready";
4478
- } catch (err) {
4479
- return await waitBeforeRetryOnRecoverableSetupError(err, "Telegram webhook cleanup failed") ? "retry" : "exit";
4480
- }
4481
- };
4482
- const runPollingCycle = async (bot) => {
4483
- const runner = run(bot, runnerOptions);
4484
- activeRunner = runner;
4485
- let stopPromise;
4486
- const stopRunner = () => {
4487
- stopPromise ??= Promise.resolve(runner.stop()).then(() => void 0).catch(() => {});
4488
- return stopPromise;
4489
- };
4490
- const stopOnAbort = () => {
4491
- if (opts.abortSignal?.aborted) stopRunner();
4492
- };
4493
- opts.abortSignal?.addEventListener("abort", stopOnAbort, { once: true });
4494
- try {
4495
- await runner.task();
4496
- if (opts.abortSignal?.aborted) return "exit";
4497
- const reason = forceRestarted ? "unhandled network error" : "runner stopped (maxRetryTime exceeded or graceful stop)";
4498
- forceRestarted = false;
4499
- return await waitBeforeRestart((delay) => `Telegram polling runner stopped (${reason}); restarting in ${delay}.`) ? "continue" : "exit";
4500
- } catch (err) {
4501
- forceRestarted = false;
4502
- if (opts.abortSignal?.aborted) throw err;
4503
- const isConflict = isGetUpdatesConflict(err);
4504
- const isRecoverable = isRecoverableTelegramNetworkError(err, { context: "polling" });
4505
- if (!isConflict && !isRecoverable) throw err;
4506
- const reason = isConflict ? "getUpdates conflict" : "network error";
4507
- const errMsg = formatErrorMessage(err);
4508
- return await waitBeforeRestart((delay) => `Telegram ${reason}: ${errMsg}; retrying in ${delay}.`) ? "continue" : "exit";
4509
- } finally {
4510
- opts.abortSignal?.removeEventListener("abort", stopOnAbort);
4511
- await stopRunner();
4512
- }
4513
- };
4514
- while (!opts.abortSignal?.aborted) {
4515
- const bot = await createPollingBot();
4516
- if (!bot) continue;
4517
- const cleanupState = await ensureWebhookCleanup(bot);
4518
- if (cleanupState === "retry") continue;
4519
- if (cleanupState === "exit") return;
4520
- if (await runPollingCycle(bot) === "exit") return;
4521
- }
4522
- } finally {
4523
- unregisterHandler();
4524
- }
4525
- }
4526
-
4527
- //#endregion
4528
- export { monitorTelegramProvider };