remoteclaw 0.2.0 → 0.2.1

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 (181) hide show
  1. package/dist/{accounts-Qulj3jS8.js → accounts-B0V43QEN.js} +1 -1
  2. package/dist/{accounts-PoAEsvXo.js → accounts-DObM4hAF.js} +2 -2
  3. package/dist/{accounts-C_7Xc5wa.js → accounts-DZ4c6f7x.js} +1 -1
  4. package/dist/{active-listener-nMUQ-dVt.js → active-listener-DVLYzYd3.js} +1 -1
  5. package/dist/{agent-O04J-JEw.js → agent-B2leLOo0.js} +377 -355
  6. package/dist/{agent-scope-wbu0VZoq.js → agent-scope-CYJrXxD6.js} +1 -1
  7. package/dist/{agents-BbQIzW1N.js → agents-Eg0_nSnn.js} +1 -1
  8. package/dist/{banner-DONy2WbW.js → banner-B52X-rEb.js} +1 -1
  9. package/dist/{bindings-0dx8vqz9.js → bindings-AUVd82yI.js} +2 -2
  10. package/dist/boot/handler.js +46 -46
  11. package/dist/build-info.json +3 -3
  12. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  13. package/dist/{channel-activity-D47P56pj.js → channel-activity-Bydtz0cv.js} +2 -2
  14. package/dist/{channel-options-DWOSBsjN.js → channel-options-CD6ZBbON.js} +1 -1
  15. package/dist/{channel-options-JoYluwGr.js → channel-options-h1pCAx0w.js} +1 -1
  16. package/dist/{channel-web-YLHk99fU.js → channel-web-DbNWyl5A.js} +2 -2
  17. package/dist/{channel-web-Cvf5FKyf.js → channel-web-FA7MGFJO.js} +2 -2
  18. package/dist/{channels-cli-Be0_n1L2.js → channels-cli-BIArqz2T.js} +9 -9
  19. package/dist/{channels-cli-BoDA0aQ1.js → channels-cli-BZ5sRWaP.js} +9 -9
  20. package/dist/{chunk-C5Oai9vm.js → chunk-0ZB8yVlw.js} +1 -1
  21. package/dist/{cli-BEOzFl_6.js → cli-C8XFOFxS.js} +5 -5
  22. package/dist/{cli-D1ORFJ6n.js → cli-ifZiERUK.js} +5 -5
  23. package/dist/command-logger/handler.js +1 -1
  24. package/dist/{command-registry-D6LIEhaY.js → command-registry-kxjFHjjE.js} +9 -9
  25. package/dist/{commands-registry-CB3qR3Ui.js → commands-registry-BQrQnwzJ.js} +3 -3
  26. package/dist/{completion-cli-ohSjYC4v.js → completion-cli-eH6YXa0H.js} +1 -1
  27. package/dist/{completion-cli-D93-g9B7.js → completion-cli-wYa36YaL.js} +2 -2
  28. package/dist/{config-Ca5Dfk8O.js → config-BIrnJuXL.js} +8 -8
  29. package/dist/{config-cli-CJ1S3_VC.js → config-cli-BfJacpda.js} +1 -1
  30. package/dist/{config-cli-uJUr7Pe-.js → config-cli-CkJFUL61.js} +1 -1
  31. package/dist/{configure-CXjIsq-V.js → configure-C9cTz03s.js} +2 -2
  32. package/dist/{configure-BAlORoYU.js → configure-Dh-yP8hn.js} +2 -2
  33. package/dist/{deliver-BGpFaGMz.js → deliver-B5eZoNwr.js} +2 -2
  34. package/dist/{deliver-D3lJfcWr.js → deliver-Cu2kD7-u.js} +2 -2
  35. package/dist/{deliver-BTjGqSGN.js → deliver-z04wZfnQ.js} +8 -8
  36. package/dist/{dock-C0qWBS5h.js → dock-BQ3iSblF.js} +5 -5
  37. package/dist/{doctor-completion-CKGabXFn.js → doctor-completion-Cz3-0qwJ.js} +1 -1
  38. package/dist/{doctor-completion-Bo9yo8-v.js → doctor-completion-D6DqtWrm.js} +1 -1
  39. package/dist/entry.js +1 -1
  40. package/dist/{env-Bs-DOhs6.js → env-D3fELH5B.js} +1 -1
  41. package/dist/{errors-bgTXk4n7.js → errors-Bg7BK273.js} +1 -1
  42. package/dist/extensionAPI.js +23 -1
  43. package/dist/{fetch-C-q-x9xS.js → fetch--eFpeNac.js} +3 -3
  44. package/dist/{fetch-B_D1a6ac.js → fetch-C3R1kkzO.js} +1 -1
  45. package/dist/{gateway-cli-DC1V6Fdf.js → gateway-cli-DuMZZmMm.js} +23 -14
  46. package/dist/{gateway-cli-CUPV9YIf.js → gateway-cli-ZPbldBb7.js} +23 -14
  47. package/dist/{health-D5YyZkng.js → health-6NZ23ZCc.js} +5 -5
  48. package/dist/{health-uTVcqwOx.js → health-D6T18gwU.js} +5 -5
  49. package/dist/{heartbeat-visibility-Z_3IqRgn.js → heartbeat-visibility-CXLlnSbK.js} +1 -1
  50. package/dist/{heartbeat-visibility-GeWWsF3e.js → heartbeat-visibility-CksK28e2.js} +1 -1
  51. package/dist/{hook-runner-global-D8bMcDPD.js → hook-runner-global-DPdZsDAH.js} +1 -1
  52. package/dist/{hooks-cli-DToXVDBQ.js → hooks-cli-CQAdRG0h.js} +6 -6
  53. package/dist/{hooks-cli-CpWC6lUu.js → hooks-cli-c8IB_ozo.js} +6 -6
  54. package/dist/{image-ops-CAVojpnw.js → image-ops-CD4YRYFY.js} +2 -2
  55. package/dist/index.js +10 -10
  56. package/dist/{ir-CDjoXuIW.js → ir-BK7K3Bbu.js} +6 -6
  57. package/dist/{logger-Bp0X6yHd.js → logger-BKFID___.js} +1 -1
  58. package/dist/{login-DWKSrC5K.js → login-BYHOjw55.js} +6 -6
  59. package/dist/{login-qr-C7zaGKxz.js → login-qr-ZRBRz2BA.js} +8 -8
  60. package/dist/{markdown-tables-Bm7xJUcn.js → markdown-tables-CfM1ner1.js} +1 -1
  61. package/dist/{message-action-names-y0-o46BN.js → message-action-names-AEii-fdA.js} +5 -5
  62. package/dist/{message-action-names-PbKqmcBa.js → message-action-names-CPJVqkJL.js} +5 -5
  63. package/dist/{message-channel-BuWy8hEk.js → message-channel-tSSi5C96.js} +1 -1
  64. package/dist/{npm-resolution-BLL-hroo.js → npm-resolution-C6jVPSqS.js} +1 -1
  65. package/dist/{npm-resolution-o9lE9iRL.js → npm-resolution-CdEbWlwy.js} +1 -1
  66. package/dist/{onboard-BohVFYna.js → onboard-CVpITzvB.js} +2 -2
  67. package/dist/{onboard-channels-DMgpmtQu.js → onboard-channels-D664lpQl.js} +1 -1
  68. package/dist/{onboard-channels-DzuidyBQ.js → onboard-channels-DReWe-Pi.js} +1 -1
  69. package/dist/{onboard-BKfLjwEp.js → onboard-zh78fAIB.js} +2 -2
  70. package/dist/{onboarding-sWcrQljf.js → onboarding-BnS6FhcE.js} +3 -3
  71. package/dist/{onboarding-BLgEs3xo.js → onboarding-CCahs79c.js} +3 -3
  72. package/dist/{onboarding.finalize-D5VLM268.js → onboarding.finalize-CmYoFs6n.js} +9 -9
  73. package/dist/{onboarding.finalize-CLmpb0fB.js → onboarding.finalize-uTFFUZ8O.js} +10 -10
  74. package/dist/{onboarding.gateway-config-DsTEqzPz.js → onboarding.gateway-config-DQX6SBU8.js} +1 -1
  75. package/dist/{onboarding.gateway-config-D-ZMefuj.js → onboarding.gateway-config-DYjDeKEw.js} +1 -1
  76. package/dist/{outbound-CCvRhb_6.js → outbound-BCY7cG5r.js} +6 -6
  77. package/dist/{outbound-attachment-BXwueqll.js → outbound-attachment-6NNNORlp.js} +3 -3
  78. package/dist/{plugin-registry-C-OlCiRd.js → plugin-registry-BC1RH6cl.js} +1 -1
  79. package/dist/{plugin-registry-LBCvRwK8.js → plugin-registry-TC2kC2iG.js} +1 -1
  80. package/dist/plugin-sdk/agents/session-run-registry.d.ts +36 -0
  81. package/dist/plugin-sdk/{channel-web-CM3jOFIe.js → channel-web-DSYJDq30.js} +4 -4
  82. package/dist/plugin-sdk/{deliver-DOBaX9a2.js → deliver-BzPIWEw5.js} +1 -1
  83. package/dist/plugin-sdk/index.js +5 -5
  84. package/dist/plugin-sdk/{reply-sVftK2Ge.js → reply-Dzts0EiK.js} +22 -8
  85. package/dist/plugin-sdk/{reply-payloads-DybMtW8a.js → reply-payloads-DwsjAWzB.js} +7 -1
  86. package/dist/plugin-sdk/{subagent-registry-BfxxwQv4.js → subagent-registry-DrBYYinw.js} +221 -5
  87. package/dist/plugin-sdk/web-afnwTWMq.js +7 -0
  88. package/dist/{plugins-cli-DCkrm_Bp.js → plugins-cli-CModgvwT.js} +6 -6
  89. package/dist/{plugins-cli-ChGSPhWr.js → plugins-cli-CpdkQdKD.js} +6 -6
  90. package/dist/{plugins-ODda1fNU.js → plugins-sjrWIkqk.js} +4 -4
  91. package/dist/{preflight-B9B3VBaW.js → preflight-a80t-iPi.js} +63 -63
  92. package/dist/{program-DYx2DvMr.js → program-BlZGbNe5.js} +11 -11
  93. package/dist/{program-context-B_oA8k9e.js → program-context-BVx30291.js} +16 -16
  94. package/dist/{prompt-select-styled-tATNv5wG.js → prompt-select-styled-Bqov4T-S.js} +4 -4
  95. package/dist/{prompt-select-styled-CHuBVQoF.js → prompt-select-styled-CtPeDmXo.js} +4 -4
  96. package/dist/{provider-dispatcher-CaVZ8Nhx.js → provider-dispatcher-BD5K64cR.js} +44 -22
  97. package/dist/{redact-DUvSdQvv.js → redact-D2_cayCv.js} +1 -1
  98. package/dist/{register.agent-mJGdqH4r.js → register.agent-B89Ymzwt.js} +8 -8
  99. package/dist/{register.agent-CAkJcVgr.js → register.agent-CuhMDT3t.js} +7 -7
  100. package/dist/{register.configure-BhkIDDW5.js → register.configure-C8WcdyT6.js} +9 -9
  101. package/dist/{register.configure-DvwKyrwL.js → register.configure-b8Ic06Uw.js} +9 -9
  102. package/dist/{register.maintenance-CKwKHDhS.js → register.maintenance-BlMuoELU.js} +11 -11
  103. package/dist/{register.maintenance-vpQOTI6u.js → register.maintenance-D5RP4wO6.js} +10 -10
  104. package/dist/{register.message-h_ydGqf0.js → register.message-CSeNrxdd.js} +7 -7
  105. package/dist/{register.message-NSrj_UY0.js → register.message-D7jdDTte.js} +7 -7
  106. package/dist/{register.onboard-C08IBU41.js → register.onboard-CRiXHw0n.js} +3 -3
  107. package/dist/{register.onboard-CcOONokP.js → register.onboard-Dj8wICC1.js} +3 -3
  108. package/dist/{register.setup-BHbQcv1_.js → register.setup-8gos4jqr.js} +3 -3
  109. package/dist/{register.setup-JYGpPbA2.js → register.setup-C_-8vfKv.js} +3 -3
  110. package/dist/{register.status-health-sessions-CAVFepVm.js → register.status-health-sessions-CrCsnTEq.js} +9 -9
  111. package/dist/{register.status-health-sessions-CV4R4Fe2.js → register.status-health-sessions-Df9SxgpH.js} +8 -8
  112. package/dist/{register.subclis-pRE159Cu.js → register.subclis-CxT7d8Bs.js} +8 -8
  113. package/dist/{replies-Cu8SG6CK.js → replies-Dsu1hdd7.js} +3 -3
  114. package/dist/{reply-DqJBHDn_.js → reply-Ccq9RRYF.js} +44 -22
  115. package/dist/{reply-payloads-DbQW7c5s.js → reply-payloads-DwEnDy7C.js} +4 -4
  116. package/dist/{reply-payloads-C4mbcSP-.js → reply-payloads-KYLwM629.js} +1 -1
  117. package/dist/{reply-prefix-DwJ8gxoz.js → reply-prefix-DtQ_7Eac.js} +1 -1
  118. package/dist/{resolve-route-BBztqaX0.js → resolve-route-DFUMTbRD.js} +4 -4
  119. package/dist/{response-prefix-template-BgDMziqu.js → response-prefix-template-DDQsoC2g.js} +1 -1
  120. package/dist/{run-main-D4CHxIUS.js → run-main-3RfLQTiu.js} +17 -17
  121. package/dist/{send-D3Uuw_MA.js → send-4gX7wep2.js} +8 -8
  122. package/dist/{send-CeBdN3Dp.js → send-CgAV9I1-.js} +15 -15
  123. package/dist/{send-DgVCmydL.js → send-CkPRLaz-.js} +8 -8
  124. package/dist/{send-C2J41ICD.js → send-DBeVQI-J.js} +7 -7
  125. package/dist/{send-Cibl-r-E.js → send-fdOUhBcN.js} +10 -10
  126. package/dist/{server-node-events-B60wtfXc.js → server-node-events-CRRE92S3.js} +6 -6
  127. package/dist/{server-node-events-DdwEsXLN.js → server-node-events-wpvPI-kw.js} +6 -6
  128. package/dist/{session-Bj8e8O8R.js → session-IUmTrU6A.js} +4 -4
  129. package/dist/{session-utils-CpgeP4rB.js → session-utils-ChEnoQCt.js} +1 -1
  130. package/dist/{session-utils-BUNcG-B2.js → session-utils-Dq5uiNDE.js} +1 -1
  131. package/dist/{sessions-3ACDrmHu.js → sessions-C6O5qrbx.js} +7 -1
  132. package/dist/{sessions-BePPqEtN.js → sessions-D5CiijxL.js} +12 -6
  133. package/dist/{sessions-n_z2PE4-.js → sessions-DPke45uf.js} +2 -2
  134. package/dist/{shell-env-DPAvieDD.js → shell-env-CKQ7fvtT.js} +1 -1
  135. package/dist/{status-BLKhFWFc.js → status-BeGUnsBd.js} +4 -4
  136. package/dist/{status-Ccfq5H-G.js → status-uyg2yOTM.js} +4 -4
  137. package/dist/{store-BS8fRU9w.js → store-BfW5-y9S.js} +7 -1
  138. package/dist/{subagent-registry-DIReZNw1.js → subagent-registry-BTv48FFX.js} +239 -6
  139. package/dist/{subagent-registry-DvnyYXMs.js → subagent-registry-D2yHvOBr.js} +238 -22
  140. package/dist/{subagent-registry-DMTgcI99.js → subagent-registry-DljM1oxO.js} +239 -6
  141. package/dist/{subsystem-DLQY6iY4.js → subsystem-9R2eOxp2.js} +2 -2
  142. package/dist/{tables-Bk8AXTIS.js → tables-CDsRjvfB.js} +2 -2
  143. package/dist/{tokens-CgIfCmK3.js → tokens-CFajuiSx.js} +1 -1
  144. package/dist/{tool-images-BMnWMHwL.js → tool-images-Cmsx31Bo.js} +1 -1
  145. package/dist/{update-cli-DCK9HF3t.js → update-cli-ChJoLU8L.js} +11 -11
  146. package/dist/{update-cli-1qesJ1_a.js → update-cli-DaW75dJC.js} +10 -10
  147. package/dist/{web-DG3SWzn_.js → web-BS0azDPB.js} +6 -6
  148. package/dist/{web-CCw02lmy.js → web-C_Alo-mS.js} +6 -6
  149. package/dist/{web-CKces-ap.js → web-DHXIgMOC.js} +50 -50
  150. package/dist/{whatsapp-actions-BzyFEHw4.js → whatsapp-actions-sR-u0T6U.js} +21 -21
  151. package/extensions/bluebubbles/package.json +1 -1
  152. package/extensions/diagnostics-otel/package.json +1 -1
  153. package/extensions/discord/package.json +1 -1
  154. package/extensions/feishu/package.json +1 -1
  155. package/extensions/googlechat/package.json +1 -1
  156. package/extensions/imessage/package.json +1 -1
  157. package/extensions/irc/package.json +1 -1
  158. package/extensions/line/package.json +1 -1
  159. package/extensions/matrix/package.json +1 -1
  160. package/extensions/mattermost/package.json +1 -1
  161. package/extensions/msteams/package.json +1 -1
  162. package/extensions/nextcloud-talk/package.json +1 -1
  163. package/extensions/nostr/package.json +1 -1
  164. package/extensions/signal/package.json +1 -1
  165. package/extensions/slack/package.json +1 -1
  166. package/extensions/synology-chat/package.json +1 -1
  167. package/extensions/telegram/package.json +1 -1
  168. package/extensions/tlon/package.json +1 -1
  169. package/extensions/twitch/package.json +1 -1
  170. package/extensions/voice-call/package.json +1 -1
  171. package/extensions/whatsapp/package.json +1 -1
  172. package/extensions/zalo/package.json +1 -1
  173. package/extensions/zalouser/package.json +1 -1
  174. package/package.json +1 -1
  175. package/dist/plugin-sdk/web-C24fSRzu.js +0 -7
  176. /package/dist/{fetch-timeout-DTIN7CGM.js → fetch-timeout-jOIu9Xud.js} +0 -0
  177. /package/dist/{file-lock-BftAtpBn.js → file-lock-CEhZlbAi.js} +0 -0
  178. /package/dist/{ip-B27WD9wk.js → ip-N_XHHVsM.js} +0 -0
  179. /package/dist/{json-file-CRyYLqpu.js → json-file-DYQIVLc1.js} +0 -0
  180. /package/dist/{render-DSLzcBxk.js → render-TpKSK5RV.js} +0 -0
  181. /package/dist/{target-errors-owiG6LWY.js → target-errors-D7fLx8zG.js} +0 -0
@@ -1,53 +1,53 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-Cbj13DAv.js";
2
- import { $ as createInternalHookEvent, E as isRecord$1, F as sleep$1, G as warn, K as theme, L as truncateUtf16Safe, M as resolveUserPath, Q as resolvePreferredRemoteClawTmpDir, S as CONFIG_DIR, T as escapeRegExp, U as shouldLogVerbose, V as logVerbose, Z as normalizeLogLevel, _ as clearPluginCommands, at as resolveGatewayPort, b as listPluginCommands, c as normalizeAnyChannelId, d as getActivePluginRegistry, f as getActivePluginRegistryKey, g as normalizePluginHttpPath, h as createPluginRegistry, k as normalizeE164, l as normalizeChannelId, lt as resolveRequiredHomeDir, m as setActivePluginRegistry, n as createNonExitingRuntime, nt as STATE_DIR, o as getChatChannelMeta, p as requireActivePluginRegistry, q as getChildLogger, r as defaultRuntime, s as listChatChannels, st as resolveStateDir, t as createSubsystemLogger, tt as triggerInternalHook, u as normalizeChatChannelId, v as executePluginCommand, x as matchPluginCommand, y as getPluginCommandSpecs, z as danger } from "./subsystem-DLQY6iY4.js";
2
+ import { $ as createInternalHookEvent, E as isRecord$1, F as sleep$1, G as warn, K as theme, L as truncateUtf16Safe, M as resolveUserPath, Q as resolvePreferredRemoteClawTmpDir, S as CONFIG_DIR, T as escapeRegExp, U as shouldLogVerbose, V as logVerbose, Z as normalizeLogLevel, _ as clearPluginCommands, at as resolveGatewayPort, b as listPluginCommands, c as normalizeAnyChannelId, d as getActivePluginRegistry, f as getActivePluginRegistryKey, g as normalizePluginHttpPath, h as createPluginRegistry, k as normalizeE164, l as normalizeChannelId, lt as resolveRequiredHomeDir, m as setActivePluginRegistry, n as createNonExitingRuntime, nt as STATE_DIR, o as getChatChannelMeta, p as requireActivePluginRegistry, q as getChildLogger, r as defaultRuntime, s as listChatChannels, st as resolveStateDir, t as createSubsystemLogger, tt as triggerInternalHook, u as normalizeChatChannelId, v as executePluginCommand, x as matchPluginCommand, y as getPluginCommandSpecs, z as danger } from "./subsystem-9R2eOxp2.js";
3
3
  import { _ as parseAgentSessionKey, c as resolveAgentIdFromSessionKey, d as DEFAULT_ACCOUNT_ID, f as normalizeAccountId$2, h as deriveSessionChatType, l as resolveThreadSessionKeys, m as isBlockedObjectKey, o as normalizeAgentId, p as normalizeOptionalAccountId, s as normalizeMainKey } from "./session-key-X7pmdLBX.js";
4
- import { a as resolveAgentRuntimeArgs, c as resolveAgentWorkspaceDir, d as resolveSessionAgentId, i as resolveAgentDir, n as resolveAgentAuth, o as resolveAgentRuntimeEnv, r as resolveAgentConfig, s as resolveAgentRuntimeOrThrow, t as listAgentIds, u as resolveDefaultAgentId } from "./agent-scope-wbu0VZoq.js";
5
- import { n as formatCliCommand } from "./env-Bs-DOhs6.js";
6
- import { a as getWebAuthAgeMs, d as readWebSelfId, h as webAuthExists, n as resolveWhatsAppAccount, o as logWebSelfId, s as logoutWeb, t as hasAnyWhatsAppAuth } from "./accounts-PoAEsvXo.js";
7
- import { i as isSilentReplyText, n as SILENT_REPLY_TOKEN, r as isSilentReplyPrefixText } from "./tokens-CgIfCmK3.js";
4
+ import { a as resolveAgentRuntimeArgs, c as resolveAgentWorkspaceDir, d as resolveSessionAgentId, i as resolveAgentDir, n as resolveAgentAuth, o as resolveAgentRuntimeEnv, r as resolveAgentConfig, s as resolveAgentRuntimeOrThrow, t as listAgentIds, u as resolveDefaultAgentId } from "./agent-scope-CYJrXxD6.js";
5
+ import { n as formatCliCommand } from "./env-D3fELH5B.js";
6
+ import { a as getWebAuthAgeMs, d as readWebSelfId, h as webAuthExists, n as resolveWhatsAppAccount, o as logWebSelfId, s as logoutWeb, t as hasAnyWhatsAppAuth } from "./accounts-DObM4hAF.js";
7
+ import { i as isSilentReplyText, n as SILENT_REPLY_TOKEN, r as isSilentReplyPrefixText } from "./tokens-CFajuiSx.js";
8
8
  import { t as resolveAccountEntry } from "./account-lookup-BU0Ibuj-.js";
9
- import { a as normalizeStringEntries, c as resolveChannelGroupRequireMention, i as normalizeHyphenSlug, n as listChannelDocks, o as normalizeStringEntriesLower, r as normalizeSignalMessagingTarget, s as resolveChannelGroupPolicy, t as getChannelDock } from "./dock-C0qWBS5h.js";
10
- import { _ as resolveDiscordAccount, c as listTelegramAccountIds, d as resolveSlackAccount, g as listEnabledDiscordAccounts, h as createDiscordActionGate, l as resolveTelegramAccount, m as resolveSlackBotToken, n as listChannelPlugins, o as createTelegramActionGate, p as resolveSlackAppToken, r as normalizeChannelId$1, s as listEnabledTelegramAccounts, t as getChannelPlugin, u as resolveTelegramToken, v as normalizeDiscordToken } from "./plugins-ODda1fNU.js";
11
- import { t as resolveIMessageAccount } from "./accounts-C_7Xc5wa.js";
12
- import { n as resolveSignalAccount, t as listEnabledSignalAccounts } from "./accounts-Qulj3jS8.js";
9
+ import { a as normalizeStringEntries, c as resolveChannelGroupRequireMention, i as normalizeHyphenSlug, n as listChannelDocks, o as normalizeStringEntriesLower, r as normalizeSignalMessagingTarget, s as resolveChannelGroupPolicy, t as getChannelDock } from "./dock-BQ3iSblF.js";
10
+ import { _ as resolveDiscordAccount, c as listTelegramAccountIds, d as resolveSlackAccount, g as listEnabledDiscordAccounts, h as createDiscordActionGate, l as resolveTelegramAccount, m as resolveSlackBotToken, n as listChannelPlugins, o as createTelegramActionGate, p as resolveSlackAppToken, r as normalizeChannelId$1, s as listEnabledTelegramAccounts, t as getChannelPlugin, u as resolveTelegramToken, v as normalizeDiscordToken } from "./plugins-sjrWIkqk.js";
11
+ import { t as resolveIMessageAccount } from "./accounts-DZ4c6f7x.js";
12
+ import { n as resolveSignalAccount, t as listEnabledSignalAccounts } from "./accounts-B0V43QEN.js";
13
13
  import { t as normalizeChatType } from "./chat-type-Coeec2xt.js";
14
- import { a as resolveSlackWebClientOptions, c as buildSlackBlocksFallbackText, i as createSlackWebClient, l as parseSlackTarget, o as parseSlackBlocksInput, s as validateSlackBlocksArray, t as sendMessageSlack, u as resolveSlackChannelId } from "./send-D3Uuw_MA.js";
15
- import { $ as hasAnyGuildPermissionDiscord, A as unpinMessageDiscord, B as listScheduledEventsDiscord, C as editMessageDiscord, Ct as applyChannelMatchMeta, D as pinMessageDiscord, E as listThreadsDiscord, Et as resolveChannelEntryMatchWithFallback, F as fetchMemberInfoDiscord, G as uploadStickerDiscord, H as timeoutMemberDiscord, I as fetchRoleInfoDiscord, J as editChannelDiscord, K as createChannelDiscord, L as fetchVoiceStatusDiscord, M as banMemberDiscord, N as createScheduledEventDiscord, O as readMessagesDiscord, P as fetchChannelInfoDiscord, Q as fetchChannelPermissionsDiscord, R as kickMemberDiscord, S as deleteMessageDiscord, St as fetchDiscord, T as listPinsDiscord, Tt as normalizeChannelSlug, U as listGuildEmojisDiscord, V as removeRoleDiscord, W as uploadEmojiDiscord, X as removeChannelPermissionDiscord, Y as moveChannelDiscord, Z as setChannelPermissionDiscord, _ as sendPollDiscord, _t as shouldEmitDiscordReactionNotification, a as removeReactionDiscord, at as listDiscordDirectoryPeersLive, b as sendWebhookMessageDiscord, bt as resolveDiscordSystemLocation, c as formatDiscordComponentEventText, ct as normalizeDiscordAllowList, d as parseDiscordModalCustomId, dt as resolveDiscordChannelConfigWithFallback, et as chunkDiscordTextWithMode, f as parseDiscordModalCustomIdForCarbon, ft as resolveDiscordGuildEntry, g as sendMessageDiscord, gt as resolveGroupDmAllow, h as resolveDiscordModalEntry, ht as resolveDiscordShouldRequireMention, i as removeOwnReactionsDiscord, it as listDiscordDirectoryGroupsLive, j as addRoleDiscord, k as searchMessagesDiscord, l as parseDiscordComponentCustomId, lt as normalizeDiscordSlug, m as resolveDiscordComponentEntry, mt as resolveDiscordOwnerAllowFrom, n as fetchReactionsDiscord, nt as parseDiscordTarget, o as sendDiscordComponentMessage, ot as allowListMatches$1, p as readDiscordComponentSpec, pt as resolveDiscordMemberAccessState, q as deleteChannelDiscord, r as reactMessageDiscord, rt as resolveDiscordChannelId, s as createDiscordFormModal, st as isDiscordGroupAllowedByPolicy, tt as createDiscordRestClient, u as parseDiscordComponentCustomIdForCarbon, ut as resolveDiscordAllowListMatch, v as sendStickerDiscord, vt as formatDiscordReactionEmoji, w as fetchMessageDiscord, wt as buildChannelKeyCandidates, x as createThreadDiscord, xt as resolveTimestampMs, y as sendVoiceMessageDiscord, yt as formatDiscordUserTag, z as listGuildChannelsDiscord } from "./send-Cibl-r-E.js";
16
- import { f as normalizeModelRef, l as isCliProvider, m as parseModelRef, p as normalizeProviderId, u as modelKey } from "./shell-env-DPAvieDD.js";
17
- import { A as safeStatSync, B as setConfigValueAtPath, C as isAvatarHttpUrl, D as loadPluginManifestRegistry, E as validateJsonSchemaValue, F as resetConfigOverrides, H as openBoundaryFileSync, I as setConfigOverride, J as VERSION, K as DEFAULT_SUBAGENT_MAX_SPAWN_DEPTH, L as unsetConfigOverride, M as normalizePluginsConfig, N as resolveEffectiveEnableState, O as discoverRemoteClawPlugins, P as getConfigOverrides, R as getConfigValueAtPath, S as isAvatarDataUrl, T as isSupportedLocalAvatarExtension, V as unsetConfigValueAtPath, _ as normalizeScpRemoteHost, a as validateConfigObjectWithPlugins, c as resolveTelegramCustomCommands, d as resolveSlackNativeStreaming, f as resolveSlackStreamingMode, g as resolveIMessageRemoteAttachmentRoots, h as resolveIMessageAttachmentRoots, i as writeConfigFile, j as applyTestPluginDefaults, k as isPathInside, l as mapStreamingModeToSlackLegacyDraftStreamMode, m as isInboundPathAllowed, n as readConfigFileSnapshot, o as TELEGRAM_COMMAND_NAME_PATTERN, q as resolveAgentMaxConcurrent, s as normalizeTelegramCommandName, t as loadConfig, u as resolveDiscordPreviewStreamMode, v as isSafeExecutableValue, w as isPathWithinRoot, x as AVATAR_MAX_BYTES, y as parseDurationMs, z as parseConfigPath } from "./config-Ca5Dfk8O.js";
18
- import { a as listDeliverableMessageChannels, i as isInternalMessageChannel, n as isDeliverableMessageChannel, o as normalizeMessageChannel, r as isGatewayMessageChannel, s as resolveMessageChannel, t as INTERNAL_MESSAGE_CHANNEL } from "./message-channel-BuWy8hEk.js";
19
- import { A as resolveDefaultSessionStorePath, B as resolveGroupSessionKey, C as resolveSessionKey, D as resolveSessionResetType, E as resolveSessionResetPolicy, F as resolveStorePath, L as resolveExplicitAgentSessionKey, M as resolveSessionFilePathOptions, N as resolveSessionTranscriptPath, O as resolveThreadFlag, P as resolveSessionTranscriptsDirForAgent, T as resolveChannelResetConfig, _ as normalizeAccountId$3, a as resolveAndPersistSessionFile, b as extractToolCallNames, c as readSessionUpdatedAt, d as updateSessionStore, f as updateSessionStoreEntry, g as normalizeSessionDeliveryFields, h as normalizeDeliveryContext, j as resolveSessionFilePath, k as DEFAULT_RESET_TRIGGERS, l as recordSessionMetaFromInbound, n as parseSessionThreadInfo, o as CURRENT_SESSION_VERSION, p as deliveryContextFromSession, s as loadSessionStore, u as updateLastRoute, v as archiveSessionTranscripts, w as evaluateSessionFreshness, y as countToolResults, z as deriveSessionMetaPatch } from "./sessions-BePPqEtN.js";
14
+ import { a as resolveSlackWebClientOptions, c as buildSlackBlocksFallbackText, i as createSlackWebClient, l as parseSlackTarget, o as parseSlackBlocksInput, s as validateSlackBlocksArray, t as sendMessageSlack, u as resolveSlackChannelId } from "./send-4gX7wep2.js";
15
+ import { $ as hasAnyGuildPermissionDiscord, A as unpinMessageDiscord, B as listScheduledEventsDiscord, C as editMessageDiscord, Ct as applyChannelMatchMeta, D as pinMessageDiscord, E as listThreadsDiscord, Et as resolveChannelEntryMatchWithFallback, F as fetchMemberInfoDiscord, G as uploadStickerDiscord, H as timeoutMemberDiscord, I as fetchRoleInfoDiscord, J as editChannelDiscord, K as createChannelDiscord, L as fetchVoiceStatusDiscord, M as banMemberDiscord, N as createScheduledEventDiscord, O as readMessagesDiscord, P as fetchChannelInfoDiscord, Q as fetchChannelPermissionsDiscord, R as kickMemberDiscord, S as deleteMessageDiscord, St as fetchDiscord, T as listPinsDiscord, Tt as normalizeChannelSlug, U as listGuildEmojisDiscord, V as removeRoleDiscord, W as uploadEmojiDiscord, X as removeChannelPermissionDiscord, Y as moveChannelDiscord, Z as setChannelPermissionDiscord, _ as sendPollDiscord, _t as shouldEmitDiscordReactionNotification, a as removeReactionDiscord, at as listDiscordDirectoryPeersLive, b as sendWebhookMessageDiscord, bt as resolveDiscordSystemLocation, c as formatDiscordComponentEventText, ct as normalizeDiscordAllowList, d as parseDiscordModalCustomId, dt as resolveDiscordChannelConfigWithFallback, et as chunkDiscordTextWithMode, f as parseDiscordModalCustomIdForCarbon, ft as resolveDiscordGuildEntry, g as sendMessageDiscord, gt as resolveGroupDmAllow, h as resolveDiscordModalEntry, ht as resolveDiscordShouldRequireMention, i as removeOwnReactionsDiscord, it as listDiscordDirectoryGroupsLive, j as addRoleDiscord, k as searchMessagesDiscord, l as parseDiscordComponentCustomId, lt as normalizeDiscordSlug, m as resolveDiscordComponentEntry, mt as resolveDiscordOwnerAllowFrom, n as fetchReactionsDiscord, nt as parseDiscordTarget, o as sendDiscordComponentMessage, ot as allowListMatches$1, p as readDiscordComponentSpec, pt as resolveDiscordMemberAccessState, q as deleteChannelDiscord, r as reactMessageDiscord, rt as resolveDiscordChannelId, s as createDiscordFormModal, st as isDiscordGroupAllowedByPolicy, tt as createDiscordRestClient, u as parseDiscordComponentCustomIdForCarbon, ut as resolveDiscordAllowListMatch, v as sendStickerDiscord, vt as formatDiscordReactionEmoji, w as fetchMessageDiscord, wt as buildChannelKeyCandidates, x as createThreadDiscord, xt as resolveTimestampMs, y as sendVoiceMessageDiscord, yt as formatDiscordUserTag, z as listGuildChannelsDiscord } from "./send-fdOUhBcN.js";
16
+ import { f as normalizeModelRef, l as isCliProvider, m as parseModelRef, p as normalizeProviderId, u as modelKey } from "./shell-env-CKQ7fvtT.js";
17
+ import { A as safeStatSync, B as setConfigValueAtPath, C as isAvatarHttpUrl, D as loadPluginManifestRegistry, E as validateJsonSchemaValue, F as resetConfigOverrides, H as openBoundaryFileSync, I as setConfigOverride, J as VERSION, K as DEFAULT_SUBAGENT_MAX_SPAWN_DEPTH, L as unsetConfigOverride, M as normalizePluginsConfig, N as resolveEffectiveEnableState, O as discoverRemoteClawPlugins, P as getConfigOverrides, R as getConfigValueAtPath, S as isAvatarDataUrl, T as isSupportedLocalAvatarExtension, V as unsetConfigValueAtPath, _ as normalizeScpRemoteHost, a as validateConfigObjectWithPlugins, c as resolveTelegramCustomCommands, d as resolveSlackNativeStreaming, f as resolveSlackStreamingMode, g as resolveIMessageRemoteAttachmentRoots, h as resolveIMessageAttachmentRoots, i as writeConfigFile, j as applyTestPluginDefaults, k as isPathInside, l as mapStreamingModeToSlackLegacyDraftStreamMode, m as isInboundPathAllowed, n as readConfigFileSnapshot, o as TELEGRAM_COMMAND_NAME_PATTERN, q as resolveAgentMaxConcurrent, s as normalizeTelegramCommandName, t as loadConfig, u as resolveDiscordPreviewStreamMode, v as isSafeExecutableValue, w as isPathWithinRoot, x as AVATAR_MAX_BYTES, y as parseDurationMs, z as parseConfigPath } from "./config-BIrnJuXL.js";
18
+ import { a as listDeliverableMessageChannels, i as isInternalMessageChannel, n as isDeliverableMessageChannel, o as normalizeMessageChannel, r as isGatewayMessageChannel, s as resolveMessageChannel, t as INTERNAL_MESSAGE_CHANNEL } from "./message-channel-tSSi5C96.js";
19
+ import { A as DEFAULT_RESET_TRIGGERS, B as deriveSessionMetaPatch, D as resolveSessionResetPolicy, E as resolveChannelResetConfig, F as resolveSessionTranscriptsDirForAgent, I as resolveStorePath, M as resolveSessionFilePath, N as resolveSessionFilePathOptions, O as resolveSessionResetType, P as resolveSessionTranscriptPath, R as resolveExplicitAgentSessionKey, T as evaluateSessionFreshness, V as resolveGroupSessionKey, _ as normalizeSessionDeliveryFields, a as resolveAndPersistSessionFile, b as countToolResults, c as readSessionUpdatedAt, d as updateSessionStore, f as updateSessionStoreEntry, g as normalizeDeliveryContext, j as resolveDefaultSessionStorePath, k as resolveThreadFlag, l as recordSessionMetaFromInbound, n as parseSessionThreadInfo, o as CURRENT_SESSION_VERSION, p as deliveryContextFromSession, s as loadSessionStore, u as updateLastRoute, v as normalizeAccountId$3, w as resolveSessionKey, x as extractToolCallNames, y as archiveSessionTranscripts } from "./sessions-D5CiijxL.js";
20
20
  import { n as resolveConversationLabel } from "./conversation-label-Dg3yLt9j.js";
21
- import { A as createReceiptCard, B as logWebhookReceived, C as resolveQueueSettings, D as isRoutableChannel, E as scheduleFollowupDrain, F as logMessageProcessed, G as extractQueueDirective, H as stopDiagnosticHeartbeat, I as logMessageQueued, J as AGENT_LANE_SUBAGENT, K as callGateway, L as logSessionStateChange, M as clearSessionQueues, N as clearCommandLane, O as routeReply, P as getQueueSize, Q as resolveGatewayCredentialsFromConfig, R as logWebhookError, S as unregisterSessionBindingAdapter, T as getFollowupQueueDepth, U as emitDiagnosticEvent, V as startDiagnosticHeartbeat, W as isDiagnosticsEnabled, X as emitAgentEvent, Y as clearAgentRunContext, Z as registerAgentRunContext, _ as resolveMainSessionAlias, a as markSubagentRunTerminated, b as getSessionBindingService, d as extractAssistantText, f as sanitizeTextContent, g as resolveInternalSessionKey, h as resolveDisplaySessionKey, i as markSubagentRunForSteerRestart, j as buildOutboundSessionContext, k as normalizeReplyPayload, l as resolveAgentTimeoutMs, m as stripReasoningTagsFromText, n as countActiveRunsForSession, o as registerSubagentRun, p as stripToolMessages, q as AGENT_LANE_NESTED, r as listSubagentRunsForRequester, s as replaceSubagentRunAfterSteer, t as clearSubagentRunSteerRestart, u as buildSubagentSystemPrompt, v as getSubagentDepthFromSessionStore, w as enqueueFollowupRun, x as registerSessionBindingAdapter, y as extractTextFromChatContent, z as logWebhookProcessed } from "./subagent-registry-DvnyYXMs.js";
22
- import { n as logError, t as logDebug } from "./logger-Bp0X6yHd.js";
23
- import { a as isRenderablePayload, c as createReplyToModeFilterForChannel, d as isContextOverflowError, f as isLikelyContextOverflowError, g as initializeGlobalHookRunner, h as getGlobalHookRunner, i as filterMessagingToolMediaDuplicates, l as resolveReplyToMode, m as sanitizeUserFacingText, n as applyReplyThreading, o as shouldSuppressMessagingToolReplies, p as isTransientHttpError, r as filterMessagingToolDuplicates, s as shouldSuppressReasoningPayload, t as applyReplyTagsToPayload, u as isCompactionFailureError } from "./reply-payloads-DbQW7c5s.js";
24
- import { n as fetchWithTimeout } from "./fetch-timeout-DTIN7CGM.js";
25
- import { f as normalizeHostname, i as extensionForMime$1, n as fetchRemoteMedia, o as isAudioFileName, r as detectMime, s as isGifMedia, t as MediaFetchError, u as mediaKindFromMime } from "./fetch-C-q-x9xS.js";
26
- import { n as wrapFetchWithAbortSignal, t as resolveFetch } from "./fetch-B_D1a6ac.js";
27
- import { n as recordChannelActivity, o as retryAsync, r as createDiscordRetryRunner, t as getChannelActivity } from "./channel-activity-D47P56pj.js";
28
- import { $ as getPairingAdapter, A as hasBotMention, B as normalizeDmAllowFromWithStore, C as buildTelegramGroupPeerId, D as describeReplyTarget, E as buildTypingThreadParams, F as resolveTelegramReplyId, G as resolveGroupAllowFromSources, H as firstDefined$1, I as resolveTelegramStreamMode, J as withTelegramApiErrorLogging, K as formatLocationText, L as resolveTelegramThreadSpec, M as resolveTelegramForumThreadId, N as resolveTelegramGroupAllowFromContext, O as expandTextLinks, P as resolveTelegramMediaPlaceholder, Q as upsertChannelPairingRequest, R as isSenderAllowed$1, S as buildTelegramGroupFrom, T as buildTelegramThreadParams, U as isSenderIdAllowed, V as resolveSenderAllowMatch, W as mergeDmAllowFromSources, X as readChannelAllowFromStore, Y as addChannelAllowFromStoreEntry, Z as removeChannelAllowFromStoreEntry, _ as resolveTelegramFetch, a as reactMessageTelegram, b as buildSenderLabel, c as sendStickerTelegram, d as wasSentByBot, et as listPairingChannels, f as isRecoverableTelegramNetworkError, g as wrapFileReferencesInHtml, h as renderTelegramHtmlText, i as editMessageTelegram, j as normalizeForwardedContext, k as extractTelegramLocation, m as markdownToTelegramHtml, n as createForumTopicTelegram, nt as parseTelegramTarget, o as sendMessageTelegram, p as markdownToTelegramChunks, q as toLocationContext, r as deleteMessageTelegram, rt as resolveTelegramTargetChatType, s as sendPollTelegram, t as buildInlineKeyboard, tt as isVoiceCompatibleAudio, u as resolveTelegramVoiceSend, v as splitTelegramCaption, w as buildTelegramParentPeer, x as buildSenderName, y as buildGroupLabel, z as normalizeAllowFrom$2 } from "./send-CeBdN3Dp.js";
29
- import { a as resolveEffectiveMessagesConfig, i as resolveAgentIdentity, o as resolveHumanDelayConfig, r as resolveAckReaction } from "./response-prefix-template-BgDMziqu.js";
30
- import { a as chunkText, c as resolveChunkMode, d as isSafeFenceBreak, f as parseFenceSpans, i as chunkMarkdownTextWithMode, l as resolveTextChunkLimit, o as chunkTextWithMode, r as chunkMarkdownText, t as chunkByNewline, u as findFenceSpanAt } from "./chunk-C5Oai9vm.js";
31
- import { n as resolveMarkdownTableMode } from "./markdown-tables-Bm7xJUcn.js";
32
- import { i as loadWebMedia, o as getAgentScopedMediaLocalRoots } from "./ir-CDjoXuIW.js";
33
- import { a as resizeToJpeg, n as getImageMetadata, o as runCommandWithTimeout } from "./image-ops-CAVojpnw.js";
34
- import { a as parseAvailableTags, c as readStringArrayParam, i as jsonResult, l as readStringOrNumberParam, o as readNumberParam, r as createActionGate, s as readReactionParams, t as missingTargetError, u as readStringParam } from "./target-errors-owiG6LWY.js";
35
- import { _ as resolveNativeCommandsEnabled, a as listChatCommandsForConfig, c as normalizeCommandBody, d as resolveCommandArgMenu, f as serializeCommandArgs, g as isRestartEnabled, h as isNativeCommandsExplicitlyDisabled, i as listChatCommands, l as parseCommandArgs, m as isCommandFlagEnabled, o as listNativeCommandSpecs, p as shouldHandleTextCommands, r as findCommandByNativeName, s as listNativeCommandSpecsForConfig, t as buildCommandTextFromArgs, u as resolveCommandArgChoices } from "./commands-registry-CB3qR3Ui.js";
36
- import { n as saveJsonFile, t as loadJsonFile } from "./json-file-CRyYLqpu.js";
37
- import { a as clearExpiredCooldowns, c as resolveProfileUnusableUntil, d as ensureAuthProfileStore, f as normalizeSecretInput, i as resolveModelAuthMode, l as resolveApiKeyForProfile, n as transcribeFirstAudio, o as isProfileInCooldown, r as resolveApiKeyForProvider, s as markAuthProfileUsed, u as listProfilesForProvider } from "./preflight-B9B3VBaW.js";
38
- import { n as formatErrorMessage, r as formatUncaughtError } from "./errors-bgTXk4n7.js";
39
- import { t as convertMarkdownTables } from "./tables-Bk8AXTIS.js";
21
+ import { $ as clearAgentRunContext, A as createReceiptCard, B as logWebhookReceived, C as resolveQueueSettings, D as isRoutableChannel, E as scheduleFollowupDrain, F as logMessageProcessed, G as extractQueueDirective, H as stopDiagnosticHeartbeat, I as logMessageQueued, J as AGENT_LANE_SUBAGENT, K as callGateway, L as logSessionStateChange, M as clearSessionQueues, N as clearCommandLane, O as routeReply, P as getQueueSize, Q as unregisterSessionRun, R as logWebhookError, S as unregisterSessionBindingAdapter, T as getFollowupQueueDepth, U as emitDiagnosticEvent, V as startDiagnosticHeartbeat, W as isDiagnosticsEnabled, X as killSessionRun, Y as isSessionRunActive, Z as registerSessionRun, _ as resolveMainSessionAlias, a as markSubagentRunTerminated, b as getSessionBindingService, d as extractAssistantText, et as emitAgentEvent, f as sanitizeTextContent, g as resolveInternalSessionKey, h as resolveDisplaySessionKey, i as markSubagentRunForSteerRestart, j as buildOutboundSessionContext, k as normalizeReplyPayload, l as resolveAgentTimeoutMs, m as stripReasoningTagsFromText, n as countActiveRunsForSession, nt as resolveGatewayCredentialsFromConfig, o as registerSubagentRun, p as stripToolMessages, q as AGENT_LANE_NESTED, r as listSubagentRunsForRequester, s as replaceSubagentRunAfterSteer, t as clearSubagentRunSteerRestart, tt as registerAgentRunContext, u as buildSubagentSystemPrompt, v as getSubagentDepthFromSessionStore, w as enqueueFollowupRun, x as registerSessionBindingAdapter, y as extractTextFromChatContent, z as logWebhookProcessed } from "./subagent-registry-D2yHvOBr.js";
22
+ import { a as listProfilesForProvider, c as isProfileInCooldown, d as ensureAuthProfileStore, f as resolveApiKeyForProfile, i as resolveModelAuthMode, l as markAuthProfileUsed, n as transcribeFirstAudio, o as normalizeSecretInput, r as resolveApiKeyForProvider, s as clearExpiredCooldowns, u as resolveProfileUnusableUntil } from "./preflight-a80t-iPi.js";
23
+ import { n as saveJsonFile, t as loadJsonFile } from "./json-file-DYQIVLc1.js";
24
+ import { n as logError, t as logDebug } from "./logger-BKFID___.js";
25
+ import { a as isRenderablePayload, c as createReplyToModeFilterForChannel, d as isContextOverflowError, f as isLikelyContextOverflowError, g as initializeGlobalHookRunner, h as getGlobalHookRunner, i as filterMessagingToolMediaDuplicates, l as resolveReplyToMode, m as sanitizeUserFacingText, n as applyReplyThreading, o as shouldSuppressMessagingToolReplies, p as isTransientHttpError, r as filterMessagingToolDuplicates, s as shouldSuppressReasoningPayload, t as applyReplyTagsToPayload, u as isCompactionFailureError } from "./reply-payloads-DwEnDy7C.js";
26
+ import { n as fetchWithTimeout } from "./fetch-timeout-jOIu9Xud.js";
27
+ import { f as normalizeHostname, i as extensionForMime$1, n as fetchRemoteMedia, o as isAudioFileName, r as detectMime, s as isGifMedia, t as MediaFetchError, u as mediaKindFromMime } from "./fetch--eFpeNac.js";
28
+ import { n as wrapFetchWithAbortSignal, t as resolveFetch } from "./fetch-C3R1kkzO.js";
29
+ import { n as recordChannelActivity, o as retryAsync, r as createDiscordRetryRunner, t as getChannelActivity } from "./channel-activity-Bydtz0cv.js";
30
+ import { $ as getPairingAdapter, A as hasBotMention, B as normalizeDmAllowFromWithStore, C as buildTelegramGroupPeerId, D as describeReplyTarget, E as buildTypingThreadParams, F as resolveTelegramReplyId, G as resolveGroupAllowFromSources, H as firstDefined$1, I as resolveTelegramStreamMode, J as withTelegramApiErrorLogging, K as formatLocationText, L as resolveTelegramThreadSpec, M as resolveTelegramForumThreadId, N as resolveTelegramGroupAllowFromContext, O as expandTextLinks, P as resolveTelegramMediaPlaceholder, Q as upsertChannelPairingRequest, R as isSenderAllowed$1, S as buildTelegramGroupFrom, T as buildTelegramThreadParams, U as isSenderIdAllowed, V as resolveSenderAllowMatch, W as mergeDmAllowFromSources, X as readChannelAllowFromStore, Y as addChannelAllowFromStoreEntry, Z as removeChannelAllowFromStoreEntry, _ as resolveTelegramFetch, a as reactMessageTelegram, b as buildSenderLabel, c as sendStickerTelegram, d as wasSentByBot, et as listPairingChannels, f as isRecoverableTelegramNetworkError, g as wrapFileReferencesInHtml, h as renderTelegramHtmlText, i as editMessageTelegram, j as normalizeForwardedContext, k as extractTelegramLocation, m as markdownToTelegramHtml, n as createForumTopicTelegram, nt as parseTelegramTarget, o as sendMessageTelegram, p as markdownToTelegramChunks, q as toLocationContext, r as deleteMessageTelegram, rt as resolveTelegramTargetChatType, s as sendPollTelegram, t as buildInlineKeyboard, tt as isVoiceCompatibleAudio, u as resolveTelegramVoiceSend, v as splitTelegramCaption, w as buildTelegramParentPeer, x as buildSenderName, y as buildGroupLabel, z as normalizeAllowFrom$2 } from "./send-CgAV9I1-.js";
31
+ import { a as resolveEffectiveMessagesConfig, i as resolveAgentIdentity, o as resolveHumanDelayConfig, r as resolveAckReaction } from "./response-prefix-template-DDQsoC2g.js";
32
+ import { a as chunkText, c as resolveChunkMode, d as isSafeFenceBreak, f as parseFenceSpans, i as chunkMarkdownTextWithMode, l as resolveTextChunkLimit, o as chunkTextWithMode, r as chunkMarkdownText, t as chunkByNewline, u as findFenceSpanAt } from "./chunk-0ZB8yVlw.js";
33
+ import { n as resolveMarkdownTableMode } from "./markdown-tables-CfM1ner1.js";
34
+ import { i as loadWebMedia, o as getAgentScopedMediaLocalRoots } from "./ir-BK7K3Bbu.js";
35
+ import { a as resizeToJpeg, n as getImageMetadata, o as runCommandWithTimeout } from "./image-ops-CD4YRYFY.js";
36
+ import { a as parseAvailableTags, c as readStringArrayParam, i as jsonResult, l as readStringOrNumberParam, o as readNumberParam, r as createActionGate, s as readReactionParams, t as missingTargetError, u as readStringParam } from "./target-errors-D7fLx8zG.js";
37
+ import { _ as resolveNativeCommandsEnabled, a as listChatCommandsForConfig, c as normalizeCommandBody, d as resolveCommandArgMenu, f as serializeCommandArgs, g as isRestartEnabled, h as isNativeCommandsExplicitlyDisabled, i as listChatCommands, l as parseCommandArgs, m as isCommandFlagEnabled, o as listNativeCommandSpecs, p as shouldHandleTextCommands, r as findCommandByNativeName, s as listNativeCommandSpecsForConfig, t as buildCommandTextFromArgs, u as resolveCommandArgChoices } from "./commands-registry-BQrQnwzJ.js";
38
+ import { n as formatErrorMessage, r as formatUncaughtError } from "./errors-Bg7BK273.js";
39
+ import { t as convertMarkdownTables } from "./tables-CDsRjvfB.js";
40
40
  import { n as generateSecureUuid, t as generateSecureToken } from "./secure-random-B_UuvbNQ.js";
41
- import { a as normalizeOutboundPayloadsForJson, i as normalizeOutboundPayloads, o as parseReplyDirectives, r as formatOutboundPayloadLog, t as deliverOutboundPayloads } from "./deliver-BTjGqSGN.js";
41
+ import { a as normalizeOutboundPayloadsForJson, i as normalizeOutboundPayloads, o as parseReplyDirectives, r as formatOutboundPayloadLog, t as deliverOutboundPayloads } from "./deliver-z04wZfnQ.js";
42
42
  import { r as normalizeInboundTextNewlines, t as finalizeInboundContext } from "./inbound-context-DbddR753.js";
43
- import { c as signalRpcRequest, l as streamSignalEvents, n as sendReadReceiptSignal, o as resolveSignalRpcContext, r as sendTypingSignal, s as signalCheck, t as sendMessageSignal } from "./send-DgVCmydL.js";
43
+ import { c as signalRpcRequest, l as streamSignalEvents, n as sendReadReceiptSignal, o as resolveSignalRpcContext, r as sendTypingSignal, s as signalCheck, t as sendMessageSignal } from "./send-CkPRLaz-.js";
44
44
  import { t as makeProxyFetch } from "./proxy-HXV2llPX.js";
45
- import { n as resolveAgentRoute, t as buildAgentSessionKey } from "./resolve-route-BBztqaX0.js";
46
- import { n as saveMediaBuffer } from "./outbound-attachment-BXwueqll.js";
47
- import { a as createReplyReferencePlanner, i as resolveSlackThreadTs, n as deliverReplies$3, t as createSlackReplyDeliveryPlan } from "./replies-Cu8SG6CK.js";
48
- import { t as createReplyPrefixOptions } from "./reply-prefix-DwJ8gxoz.js";
49
- import { a as normalizeIMessageHandle, i as isAllowedIMessageSender, o as createIMessageRpcClient, r as formatIMessageChatTarget, s as DEFAULT_IMESSAGE_PROBE_TIMEOUT_MS, t as sendMessageIMessage } from "./send-C2J41ICD.js";
50
- import { t as getActiveWebListener } from "./active-listener-nMUQ-dVt.js";
45
+ import { n as resolveAgentRoute, t as buildAgentSessionKey } from "./resolve-route-DFUMTbRD.js";
46
+ import { n as saveMediaBuffer } from "./outbound-attachment-6NNNORlp.js";
47
+ import { a as createReplyReferencePlanner, i as resolveSlackThreadTs, n as deliverReplies$3, t as createSlackReplyDeliveryPlan } from "./replies-Dsu1hdd7.js";
48
+ import { t as createReplyPrefixOptions } from "./reply-prefix-DtQ_7Eac.js";
49
+ import { a as normalizeIMessageHandle, i as isAllowedIMessageSender, o as createIMessageRpcClient, r as formatIMessageChatTarget, s as DEFAULT_IMESSAGE_PROBE_TIMEOUT_MS, t as sendMessageIMessage } from "./send-DBeVQI-J.js";
50
+ import { t as getActiveWebListener } from "./active-listener-DVLYzYd3.js";
51
51
  import { createRequire } from "node:module";
52
52
  import path, { join } from "node:path";
53
53
  import fs, { existsSync, mkdirSync, mkdtempSync, readFileSync, renameSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
@@ -60,7 +60,7 @@ import { fileURLToPath } from "node:url";
60
60
  import { ProxyAgent, fetch as fetch$1 } from "undici";
61
61
  import readline, { createInterface } from "node:readline";
62
62
  import { createJiti } from "jiti";
63
- import WebSocket$1 from "ws";
63
+ import WebSocket from "ws";
64
64
  import { Type } from "@sinclair/typebox";
65
65
  import { EdgeTTS } from "node-edge-tts";
66
66
  import { ApplicationCommandOptionType, ButtonStyle, ChannelType, PermissionFlagsBits, Routes, StickerFormatType } from "discord-api-types/v10";
@@ -96,27 +96,27 @@ function createOutboundSendDepsFromCliSource(deps) {
96
96
  function createDefaultDeps() {
97
97
  return {
98
98
  sendMessageWhatsApp: async (...args) => {
99
- const { sendMessageWhatsApp } = await import("./web-CKces-ap.js");
99
+ const { sendMessageWhatsApp } = await import("./web-DHXIgMOC.js");
100
100
  return await sendMessageWhatsApp(...args);
101
101
  },
102
102
  sendMessageTelegram: async (...args) => {
103
- const { sendMessageTelegram } = await import("./send-CeBdN3Dp.js").then((n) => n.l);
103
+ const { sendMessageTelegram } = await import("./send-CgAV9I1-.js").then((n) => n.l);
104
104
  return await sendMessageTelegram(...args);
105
105
  },
106
106
  sendMessageDiscord: async (...args) => {
107
- const { sendMessageDiscord } = await import("./send-Cibl-r-E.js").then((n) => n.t);
107
+ const { sendMessageDiscord } = await import("./send-fdOUhBcN.js").then((n) => n.t);
108
108
  return await sendMessageDiscord(...args);
109
109
  },
110
110
  sendMessageSlack: async (...args) => {
111
- const { sendMessageSlack } = await import("./send-D3Uuw_MA.js").then((n) => n.n);
111
+ const { sendMessageSlack } = await import("./send-4gX7wep2.js").then((n) => n.n);
112
112
  return await sendMessageSlack(...args);
113
113
  },
114
114
  sendMessageSignal: async (...args) => {
115
- const { sendMessageSignal } = await import("./send-DgVCmydL.js").then((n) => n.i);
115
+ const { sendMessageSignal } = await import("./send-CkPRLaz-.js").then((n) => n.i);
116
116
  return await sendMessageSignal(...args);
117
117
  },
118
118
  sendMessageIMessage: async (...args) => {
119
- const { sendMessageIMessage } = await import("./send-C2J41ICD.js").then((n) => n.n);
119
+ const { sendMessageIMessage } = await import("./send-DBeVQI-J.js").then((n) => n.n);
120
120
  return await sendMessageIMessage(...args);
121
121
  }
122
122
  };
@@ -228,6 +228,280 @@ function resolveResponseUsageMode(raw) {
228
228
  return normalizeUsageDisplay(raw) ?? "off";
229
229
  }
230
230
 
231
+ //#endregion
232
+ //#region src/auth/env-injection.ts
233
+ /**
234
+ * Auth profile -> CLI subprocess env var injection.
235
+ *
236
+ * Resolves per-agent auth profile references to environment variables
237
+ * suitable for injecting into CLI subprocess environments.
238
+ */
239
+ const log$4 = createSubsystemLogger("auth-env");
240
+ /**
241
+ * Map a provider ID to the primary environment variable name used by CLI agents.
242
+ *
243
+ * Returns `undefined` for providers with no known env var mapping.
244
+ */
245
+ function resolveProviderEnvVarName(provider) {
246
+ const normalized = normalizeProviderId(provider);
247
+ switch (normalized) {
248
+ case "anthropic": return "ANTHROPIC_API_KEY";
249
+ case "google": return "GEMINI_API_KEY";
250
+ case "openai":
251
+ case "openai-codex": return "OPENAI_API_KEY";
252
+ case "opencode": return "OPENCODE_API_KEY";
253
+ case "github-copilot": return "GITHUB_TOKEN";
254
+ default: break;
255
+ }
256
+ return {
257
+ voyage: "VOYAGE_API_KEY",
258
+ groq: "GROQ_API_KEY",
259
+ deepgram: "DEEPGRAM_API_KEY",
260
+ cerebras: "CEREBRAS_API_KEY",
261
+ xai: "XAI_API_KEY",
262
+ openrouter: "OPENROUTER_API_KEY",
263
+ litellm: "LITELLM_API_KEY",
264
+ mistral: "MISTRAL_API_KEY",
265
+ together: "TOGETHER_API_KEY",
266
+ moonshot: "MOONSHOT_API_KEY",
267
+ minimax: "MINIMAX_API_KEY",
268
+ nvidia: "NVIDIA_API_KEY",
269
+ xiaomi: "XIAOMI_API_KEY",
270
+ venice: "VENICE_API_KEY",
271
+ qianfan: "QIANFAN_API_KEY",
272
+ kilocode: "KILOCODE_API_KEY",
273
+ elevenlabs: "ELEVENLABS_API_KEY"
274
+ }[normalized];
275
+ }
276
+ /**
277
+ * Pick the next profile ID from an array using persistent, cooldown-aware
278
+ * round-robin. Profiles are ordered by lastUsed (oldest first) with
279
+ * cooldown profiles pushed to the end. The selected profile is marked as
280
+ * used so subsequent calls rotate to the next one.
281
+ */
282
+ async function pickNextProfile(store, profiles) {
283
+ if (profiles.length === 0) return;
284
+ clearExpiredCooldowns(store);
285
+ const available = [];
286
+ const inCooldown = [];
287
+ const now = Date.now();
288
+ for (const profileId of profiles) {
289
+ if (!store.profiles[profileId]) continue;
290
+ if (isProfileInCooldown(store, profileId)) {
291
+ const cooldownUntil = resolveProfileUnusableUntil(store.usageStats?.[profileId] ?? {}) ?? now;
292
+ inCooldown.push({
293
+ profileId,
294
+ cooldownUntil
295
+ });
296
+ } else available.push(profileId);
297
+ }
298
+ const sorted = available.toSorted((a, b) => {
299
+ return (store.usageStats?.[a]?.lastUsed ?? 0) - (store.usageStats?.[b]?.lastUsed ?? 0);
300
+ });
301
+ const cooldownSorted = inCooldown.toSorted((a, b) => a.cooldownUntil - b.cooldownUntil).map((entry) => entry.profileId);
302
+ const selected = [...sorted, ...cooldownSorted][0];
303
+ if (!selected) return;
304
+ await markAuthProfileUsed({
305
+ store,
306
+ profileId: selected
307
+ });
308
+ return selected;
309
+ }
310
+ /**
311
+ * Return the number of auth profiles configured for an agent.
312
+ *
313
+ * - `auth: false` or `undefined` -> 0
314
+ * - `auth: "profile-id"` -> 1
315
+ * - `auth: ["id1", "id2"]` -> N
316
+ */
317
+ function resolveAuthProfileCount(cfg, agentId) {
318
+ const auth = resolveAgentAuth(cfg, agentId);
319
+ if (auth === false || auth === void 0) return 0;
320
+ if (typeof auth === "string") return 1;
321
+ return auth.length;
322
+ }
323
+ /**
324
+ * Resolve per-agent auth profile(s) to env vars for CLI subprocess injection.
325
+ *
326
+ * - `auth: false` -> no injection (returns `undefined`)
327
+ * - `auth: "profile-id"` -> resolve single profile, inject as env var
328
+ * - `auth: ["id1", "id2"]` -> persistent cooldown-aware round-robin, inject selected profile
329
+ * - `auth: undefined` -> no injection (returns `undefined`)
330
+ *
331
+ * Missing or invalid profiles log a warning and return `undefined`
332
+ * (fall-through to next credential precedence level).
333
+ */
334
+ async function resolveAuthEnv(params) {
335
+ const auth = resolveAgentAuth(params.cfg, params.agentId);
336
+ if (auth === false || auth === void 0) return;
337
+ const store = params.store ?? ensureAuthProfileStore();
338
+ const profileId = Array.isArray(auth) ? await pickNextProfile(store, auth) : auth;
339
+ if (!profileId) return;
340
+ let resolved;
341
+ try {
342
+ resolved = await resolveApiKeyForProfile({
343
+ cfg: params.cfg,
344
+ store,
345
+ profileId
346
+ });
347
+ } catch {
348
+ log$4.warn(`Failed to resolve auth profile "${profileId}" — skipping env injection`);
349
+ return;
350
+ }
351
+ if (!resolved) {
352
+ log$4.warn(`Auth profile "${profileId}" not found or has no key — skipping env injection`);
353
+ return;
354
+ }
355
+ const envVarName = resolveProviderEnvVarName(resolved.provider);
356
+ if (!envVarName) {
357
+ log$4.warn(`No env var mapping for provider "${resolved.provider}" (profile "${profileId}") — skipping env injection`);
358
+ return;
359
+ }
360
+ const credType = store.profiles[profileId]?.type;
361
+ return { [envVarName === "ANTHROPIC_API_KEY" && credType === "token" ? "CLAUDE_CODE_OAUTH_TOKEN" : envVarName]: resolved.apiKey };
362
+ }
363
+
364
+ //#endregion
365
+ //#region src/middleware/error-classifier.ts
366
+ const retryablePatterns = [
367
+ /rate.?limit/i,
368
+ /429/i,
369
+ /503/i,
370
+ /overloaded/i,
371
+ /ETIMEDOUT/i,
372
+ /ECONNRESET/i,
373
+ /ECONNREFUSED/i,
374
+ /network/i
375
+ ];
376
+ const contextOverflowPatterns = [
377
+ /context.?length/i,
378
+ /context.?window/i,
379
+ /context.?overflow/i,
380
+ /too many tokens/i,
381
+ /maximum context/i,
382
+ /token.?limit/i
383
+ ];
384
+ const fatalAuthPatterns = [
385
+ /401/i,
386
+ /403/i,
387
+ /unauthorized/i,
388
+ /forbidden/i,
389
+ /invalid.?key/i,
390
+ /authentication/i
391
+ ];
392
+ /**
393
+ * Rate-limit and auth failure patterns that may benefit from key rotation.
394
+ *
395
+ * Includes rate-limit indicators (429, quota) and auth failures
396
+ * (401, invalid key) — a different API key might succeed in either case.
397
+ */
398
+ const authRotatablePatterns = [
399
+ /rate.?limit/i,
400
+ /\b429\b/,
401
+ /quota.?exceeded/i,
402
+ /resource.?exhausted/i,
403
+ /too many requests/i,
404
+ /\b401\b/,
405
+ /unauthorized/i,
406
+ /invalid.?key/i
407
+ ];
408
+ /**
409
+ * Test whether an error message indicates a rate-limit or auth failure
410
+ * that could be resolved by rotating to a different API key.
411
+ */
412
+ function isAuthRotatableError(message) {
413
+ return authRotatablePatterns.some((pattern) => pattern.test(message));
414
+ }
415
+ /**
416
+ * Classify an error message string into an actionable category.
417
+ *
418
+ * Uses first-match-wins semantics across ordered pattern arrays:
419
+ * 1. Retryable patterns checked first
420
+ * 2. Context overflow patterns checked second
421
+ * 3. Fatal auth patterns checked third
422
+ * 4. Default: "fatal" for unmatched messages
423
+ *
424
+ * Case-insensitive matching throughout.
425
+ */
426
+ function classifyError(message) {
427
+ for (const pattern of retryablePatterns) if (pattern.test(message)) {
428
+ logDebug(`[error-classifier] classified as retryable: ${message.slice(0, 200)}`);
429
+ return "retryable";
430
+ }
431
+ for (const pattern of contextOverflowPatterns) if (pattern.test(message)) {
432
+ logDebug(`[error-classifier] classified as context_overflow: ${message.slice(0, 200)}`);
433
+ return "context_overflow";
434
+ }
435
+ for (const pattern of fatalAuthPatterns) if (pattern.test(message)) {
436
+ logDebug(`[error-classifier] classified as fatal (auth): ${message.slice(0, 200)}`);
437
+ return "fatal";
438
+ }
439
+ logDebug(`[error-classifier] classified as fatal (unmatched): ${message.slice(0, 200)}`);
440
+ return "fatal";
441
+ }
442
+
443
+ //#endregion
444
+ //#region src/middleware/auth-key-retry.ts
445
+ /**
446
+ * Auth key retry — rotates to the next auth profile on rate-limit / auth errors.
447
+ *
448
+ * When an agent has multiple auth profiles configured (`auth: ["k1", "k2"]`),
449
+ * a rate-limit or auth failure triggers a retry with the next key in the
450
+ * rotation. Each key is tried at most once per invocation.
451
+ */
452
+ const log$3 = createSubsystemLogger("auth-retry");
453
+ /**
454
+ * Execute a callback with automatic auth key retry on rate-limit / auth errors.
455
+ *
456
+ * - `auth: false` / `undefined` / single key → one attempt, no retry.
457
+ * - `auth: ["k1", "k2", ...]` → up to `N` attempts (one per key).
458
+ *
459
+ * The `execute` callback receives a merged env (base + auth). On a rate-limit
460
+ * or auth error (thrown or returned in the result), the next profile is
461
+ * selected via round-robin and the callback is retried.
462
+ *
463
+ * @param options Auth config and base env.
464
+ * @param execute Callback that runs the agent with the given env.
465
+ * @param getErrorMessage Extracts an error string from a non-thrown result
466
+ * (e.g. `result.error`). Return `undefined` if no error.
467
+ */
468
+ async function withAuthKeyRetry(options, execute, getErrorMessage) {
469
+ const profileCount = resolveAuthProfileCount(options.cfg, options.agentId);
470
+ const maxAttempts = Math.max(1, profileCount);
471
+ let lastResult;
472
+ let lastError;
473
+ for (let attempt = 0; attempt < maxAttempts; attempt++) {
474
+ const authEnv = await resolveAuthEnv({
475
+ cfg: options.cfg,
476
+ agentId: options.agentId,
477
+ store: options.store
478
+ });
479
+ const env = authEnv ? {
480
+ ...options.baseEnv,
481
+ ...authEnv
482
+ } : options.baseEnv ? { ...options.baseEnv } : {};
483
+ try {
484
+ const result = await execute(env);
485
+ const errorMsg = getErrorMessage(result);
486
+ if (errorMsg && isAuthRotatableError(errorMsg) && attempt + 1 < maxAttempts) {
487
+ log$3.info(`Auth key rate-limited (attempt ${attempt + 1}/${maxAttempts}), rotating to next profile`);
488
+ lastResult = result;
489
+ continue;
490
+ }
491
+ return result;
492
+ } catch (err) {
493
+ lastError = err;
494
+ if (isAuthRotatableError(err instanceof Error ? err.message : String(err)) && attempt + 1 < maxAttempts) {
495
+ log$3.info(`Auth key rate-limited (attempt ${attempt + 1}/${maxAttempts}), rotating to next profile`);
496
+ continue;
497
+ }
498
+ throw err;
499
+ }
500
+ }
501
+ if (lastResult !== void 0) return lastResult;
502
+ throw lastError;
503
+ }
504
+
231
505
  //#endregion
232
506
  //#region src/middleware/delivery-adapter.ts
233
507
  const DEFAULT_CHUNK_LIMIT = 4e3;
@@ -404,85 +678,6 @@ function findOpenCodeFence(text, limit) {
404
678
  return openFence;
405
679
  }
406
680
 
407
- //#endregion
408
- //#region src/middleware/error-classifier.ts
409
- const retryablePatterns = [
410
- /rate.?limit/i,
411
- /429/i,
412
- /503/i,
413
- /overloaded/i,
414
- /ETIMEDOUT/i,
415
- /ECONNRESET/i,
416
- /ECONNREFUSED/i,
417
- /network/i
418
- ];
419
- const contextOverflowPatterns = [
420
- /context.?length/i,
421
- /context.?window/i,
422
- /context.?overflow/i,
423
- /too many tokens/i,
424
- /maximum context/i,
425
- /token.?limit/i
426
- ];
427
- const fatalAuthPatterns = [
428
- /401/i,
429
- /403/i,
430
- /unauthorized/i,
431
- /forbidden/i,
432
- /invalid.?key/i,
433
- /authentication/i
434
- ];
435
- /**
436
- * Rate-limit and auth failure patterns that may benefit from key rotation.
437
- *
438
- * Includes rate-limit indicators (429, quota) and auth failures
439
- * (401, invalid key) — a different API key might succeed in either case.
440
- */
441
- const authRotatablePatterns = [
442
- /rate.?limit/i,
443
- /\b429\b/,
444
- /quota.?exceeded/i,
445
- /resource.?exhausted/i,
446
- /too many requests/i,
447
- /\b401\b/,
448
- /unauthorized/i,
449
- /invalid.?key/i
450
- ];
451
- /**
452
- * Test whether an error message indicates a rate-limit or auth failure
453
- * that could be resolved by rotating to a different API key.
454
- */
455
- function isAuthRotatableError(message) {
456
- return authRotatablePatterns.some((pattern) => pattern.test(message));
457
- }
458
- /**
459
- * Classify an error message string into an actionable category.
460
- *
461
- * Uses first-match-wins semantics across ordered pattern arrays:
462
- * 1. Retryable patterns checked first
463
- * 2. Context overflow patterns checked second
464
- * 3. Fatal auth patterns checked third
465
- * 4. Default: "fatal" for unmatched messages
466
- *
467
- * Case-insensitive matching throughout.
468
- */
469
- function classifyError(message) {
470
- for (const pattern of retryablePatterns) if (pattern.test(message)) {
471
- logDebug(`[error-classifier] classified as retryable: ${message.slice(0, 200)}`);
472
- return "retryable";
473
- }
474
- for (const pattern of contextOverflowPatterns) if (pattern.test(message)) {
475
- logDebug(`[error-classifier] classified as context_overflow: ${message.slice(0, 200)}`);
476
- return "context_overflow";
477
- }
478
- for (const pattern of fatalAuthPatterns) if (pattern.test(message)) {
479
- logDebug(`[error-classifier] classified as fatal (auth): ${message.slice(0, 200)}`);
480
- return "fatal";
481
- }
482
- logDebug(`[error-classifier] classified as fatal (unmatched): ${message.slice(0, 200)}`);
483
- return "fatal";
484
- }
485
-
486
681
  //#endregion
487
682
  //#region src/middleware/mcp-side-effects.ts
488
683
  async function readMcpSideEffects(filePath) {
@@ -2146,6 +2341,15 @@ var ChannelBridge = class {
2146
2341
  let workspaceDir = this.#workspaceDir;
2147
2342
  let hookEnv;
2148
2343
  const runId = randomUUID();
2344
+ const sessionKeyStr = formatSessionKeyString(sessionKey);
2345
+ const internalAbortCtrl = new AbortController();
2346
+ registerSessionRun(sessionKeyStr, {
2347
+ startedAt: Date.now(),
2348
+ sessionKey: sessionKeyStr,
2349
+ agentId: message.agentId ?? "default",
2350
+ abortController: internalAbortCtrl
2351
+ });
2352
+ const combinedSignal = abortSignal ? AbortSignal.any([abortSignal, internalAbortCtrl.signal]) : internalAbortCtrl.signal;
2149
2353
  if (hookRunner?.hasHooks("before_runtime_spawn")) {
2150
2354
  const spawnResult = await hookRunner.runBeforeRuntimeSpawn({
2151
2355
  runtimeName: this.#provider,
@@ -2190,7 +2394,7 @@ var ChannelBridge = class {
2190
2394
  media: supportedMedia?.length ? supportedMedia : void 0,
2191
2395
  sessionId: existingSessionId,
2192
2396
  mcpServers,
2193
- abortSignal,
2397
+ abortSignal: combinedSignal,
2194
2398
  workingDirectory: workspaceDir,
2195
2399
  env: this.#runtimeEnv || hookEnv ? {
2196
2400
  ...this.#runtimeEnv,
@@ -2259,6 +2463,7 @@ var ChannelBridge = class {
2259
2463
  error: lastError
2260
2464
  };
2261
2465
  } finally {
2466
+ unregisterSessionRun(formatSessionKeyString(sessionKey));
2262
2467
  await rm(invocationDir, {
2263
2468
  recursive: true,
2264
2469
  force: true
@@ -3775,11 +3980,13 @@ function stopSubagentsForRequester(params) {
3775
3980
  store = loadSessionStore(storePath);
3776
3981
  storeCache.set(storePath, store);
3777
3982
  }
3778
- if (markSubagentRunTerminated({
3983
+ const markedTerminated = markSubagentRunTerminated({
3779
3984
  runId: run.runId,
3780
3985
  childSessionKey: childKey,
3781
3986
  reason: "killed"
3782
- }) > 0 || cleared.followupCleared > 0 || cleared.laneCleared > 0) stopped += 1;
3987
+ }) > 0;
3988
+ killSessionRun(childKey);
3989
+ if (markedTerminated || cleared.followupCleared > 0 || cleared.laneCleared > 0) stopped += 1;
3783
3990
  }
3784
3991
  const cascadeResult = stopSubagentsForRequester({
3785
3992
  cfg: params.cfg,
@@ -3839,6 +4046,7 @@ async function tryFastAbortFromMessage(params) {
3839
4046
  nextStore[key] = nextEntry;
3840
4047
  });
3841
4048
  } else if (abortKey) setAbortMemory(abortKey, true);
4049
+ if (requesterSessionKey) killSessionRun(requesterSessionKey);
3842
4050
  const { stopped } = stopSubagentsForRequester({
3843
4051
  cfg,
3844
4052
  requesterSessionKey
@@ -3850,6 +4058,7 @@ async function tryFastAbortFromMessage(params) {
3850
4058
  };
3851
4059
  }
3852
4060
  if (abortKey) setAbortMemory(abortKey, true);
4061
+ if (requesterSessionKey) killSessionRun(requesterSessionKey);
3853
4062
  const { stopped } = stopSubagentsForRequester({
3854
4063
  cfg,
3855
4064
  requesterSessionKey
@@ -13093,201 +13302,6 @@ function resolveFallbackTransition(params) {
13093
13302
  };
13094
13303
  }
13095
13304
 
13096
- //#endregion
13097
- //#region src/auth/env-injection.ts
13098
- /**
13099
- * Auth profile -> CLI subprocess env var injection.
13100
- *
13101
- * Resolves per-agent auth profile references to environment variables
13102
- * suitable for injecting into CLI subprocess environments.
13103
- */
13104
- const log$4 = createSubsystemLogger("auth-env");
13105
- /**
13106
- * Map a provider ID to the primary environment variable name used by CLI agents.
13107
- *
13108
- * Returns `undefined` for providers with no known env var mapping.
13109
- */
13110
- function resolveProviderEnvVarName(provider) {
13111
- const normalized = normalizeProviderId(provider);
13112
- switch (normalized) {
13113
- case "anthropic": return "ANTHROPIC_API_KEY";
13114
- case "google": return "GEMINI_API_KEY";
13115
- case "openai":
13116
- case "openai-codex": return "OPENAI_API_KEY";
13117
- case "opencode": return "OPENCODE_API_KEY";
13118
- case "github-copilot": return "GITHUB_TOKEN";
13119
- default: break;
13120
- }
13121
- return {
13122
- voyage: "VOYAGE_API_KEY",
13123
- groq: "GROQ_API_KEY",
13124
- deepgram: "DEEPGRAM_API_KEY",
13125
- cerebras: "CEREBRAS_API_KEY",
13126
- xai: "XAI_API_KEY",
13127
- openrouter: "OPENROUTER_API_KEY",
13128
- litellm: "LITELLM_API_KEY",
13129
- mistral: "MISTRAL_API_KEY",
13130
- together: "TOGETHER_API_KEY",
13131
- moonshot: "MOONSHOT_API_KEY",
13132
- minimax: "MINIMAX_API_KEY",
13133
- nvidia: "NVIDIA_API_KEY",
13134
- xiaomi: "XIAOMI_API_KEY",
13135
- venice: "VENICE_API_KEY",
13136
- qianfan: "QIANFAN_API_KEY",
13137
- kilocode: "KILOCODE_API_KEY",
13138
- elevenlabs: "ELEVENLABS_API_KEY"
13139
- }[normalized];
13140
- }
13141
- /**
13142
- * Pick the next profile ID from an array using persistent, cooldown-aware
13143
- * round-robin. Profiles are ordered by lastUsed (oldest first) with
13144
- * cooldown profiles pushed to the end. The selected profile is marked as
13145
- * used so subsequent calls rotate to the next one.
13146
- */
13147
- async function pickNextProfile(store, profiles) {
13148
- if (profiles.length === 0) return;
13149
- clearExpiredCooldowns(store);
13150
- const available = [];
13151
- const inCooldown = [];
13152
- const now = Date.now();
13153
- for (const profileId of profiles) {
13154
- if (!store.profiles[profileId]) continue;
13155
- if (isProfileInCooldown(store, profileId)) {
13156
- const cooldownUntil = resolveProfileUnusableUntil(store.usageStats?.[profileId] ?? {}) ?? now;
13157
- inCooldown.push({
13158
- profileId,
13159
- cooldownUntil
13160
- });
13161
- } else available.push(profileId);
13162
- }
13163
- const sorted = available.toSorted((a, b) => {
13164
- return (store.usageStats?.[a]?.lastUsed ?? 0) - (store.usageStats?.[b]?.lastUsed ?? 0);
13165
- });
13166
- const cooldownSorted = inCooldown.toSorted((a, b) => a.cooldownUntil - b.cooldownUntil).map((entry) => entry.profileId);
13167
- const selected = [...sorted, ...cooldownSorted][0];
13168
- if (!selected) return;
13169
- await markAuthProfileUsed({
13170
- store,
13171
- profileId: selected
13172
- });
13173
- return selected;
13174
- }
13175
- /**
13176
- * Return the number of auth profiles configured for an agent.
13177
- *
13178
- * - `auth: false` or `undefined` -> 0
13179
- * - `auth: "profile-id"` -> 1
13180
- * - `auth: ["id1", "id2"]` -> N
13181
- */
13182
- function resolveAuthProfileCount(cfg, agentId) {
13183
- const auth = resolveAgentAuth(cfg, agentId);
13184
- if (auth === false || auth === void 0) return 0;
13185
- if (typeof auth === "string") return 1;
13186
- return auth.length;
13187
- }
13188
- /**
13189
- * Resolve per-agent auth profile(s) to env vars for CLI subprocess injection.
13190
- *
13191
- * - `auth: false` -> no injection (returns `undefined`)
13192
- * - `auth: "profile-id"` -> resolve single profile, inject as env var
13193
- * - `auth: ["id1", "id2"]` -> persistent cooldown-aware round-robin, inject selected profile
13194
- * - `auth: undefined` -> no injection (returns `undefined`)
13195
- *
13196
- * Missing or invalid profiles log a warning and return `undefined`
13197
- * (fall-through to next credential precedence level).
13198
- */
13199
- async function resolveAuthEnv(params) {
13200
- const auth = resolveAgentAuth(params.cfg, params.agentId);
13201
- if (auth === false || auth === void 0) return;
13202
- const store = params.store ?? ensureAuthProfileStore();
13203
- const profileId = Array.isArray(auth) ? await pickNextProfile(store, auth) : auth;
13204
- if (!profileId) return;
13205
- let resolved;
13206
- try {
13207
- resolved = await resolveApiKeyForProfile({
13208
- cfg: params.cfg,
13209
- store,
13210
- profileId
13211
- });
13212
- } catch {
13213
- log$4.warn(`Failed to resolve auth profile "${profileId}" — skipping env injection`);
13214
- return;
13215
- }
13216
- if (!resolved) {
13217
- log$4.warn(`Auth profile "${profileId}" not found or has no key — skipping env injection`);
13218
- return;
13219
- }
13220
- const envVarName = resolveProviderEnvVarName(resolved.provider);
13221
- if (!envVarName) {
13222
- log$4.warn(`No env var mapping for provider "${resolved.provider}" (profile "${profileId}") — skipping env injection`);
13223
- return;
13224
- }
13225
- const credType = store.profiles[profileId]?.type;
13226
- return { [envVarName === "ANTHROPIC_API_KEY" && credType === "token" ? "CLAUDE_CODE_OAUTH_TOKEN" : envVarName]: resolved.apiKey };
13227
- }
13228
-
13229
- //#endregion
13230
- //#region src/middleware/auth-key-retry.ts
13231
- /**
13232
- * Auth key retry — rotates to the next auth profile on rate-limit / auth errors.
13233
- *
13234
- * When an agent has multiple auth profiles configured (`auth: ["k1", "k2"]`),
13235
- * a rate-limit or auth failure triggers a retry with the next key in the
13236
- * rotation. Each key is tried at most once per invocation.
13237
- */
13238
- const log$3 = createSubsystemLogger("auth-retry");
13239
- /**
13240
- * Execute a callback with automatic auth key retry on rate-limit / auth errors.
13241
- *
13242
- * - `auth: false` / `undefined` / single key → one attempt, no retry.
13243
- * - `auth: ["k1", "k2", ...]` → up to `N` attempts (one per key).
13244
- *
13245
- * The `execute` callback receives a merged env (base + auth). On a rate-limit
13246
- * or auth error (thrown or returned in the result), the next profile is
13247
- * selected via round-robin and the callback is retried.
13248
- *
13249
- * @param options Auth config and base env.
13250
- * @param execute Callback that runs the agent with the given env.
13251
- * @param getErrorMessage Extracts an error string from a non-thrown result
13252
- * (e.g. `result.error`). Return `undefined` if no error.
13253
- */
13254
- async function withAuthKeyRetry(options, execute, getErrorMessage) {
13255
- const profileCount = resolveAuthProfileCount(options.cfg, options.agentId);
13256
- const maxAttempts = Math.max(1, profileCount);
13257
- let lastResult;
13258
- let lastError;
13259
- for (let attempt = 0; attempt < maxAttempts; attempt++) {
13260
- const authEnv = await resolveAuthEnv({
13261
- cfg: options.cfg,
13262
- agentId: options.agentId,
13263
- store: options.store
13264
- });
13265
- const env = authEnv ? {
13266
- ...options.baseEnv,
13267
- ...authEnv
13268
- } : options.baseEnv ? { ...options.baseEnv } : {};
13269
- try {
13270
- const result = await execute(env);
13271
- const errorMsg = getErrorMessage(result);
13272
- if (errorMsg && isAuthRotatableError(errorMsg) && attempt + 1 < maxAttempts) {
13273
- log$3.info(`Auth key rate-limited (attempt ${attempt + 1}/${maxAttempts}), rotating to next profile`);
13274
- lastResult = result;
13275
- continue;
13276
- }
13277
- return result;
13278
- } catch (err) {
13279
- lastError = err;
13280
- if (isAuthRotatableError(err instanceof Error ? err.message : String(err)) && attempt + 1 < maxAttempts) {
13281
- log$3.info(`Auth key rate-limited (attempt ${attempt + 1}/${maxAttempts}), rotating to next profile`);
13282
- continue;
13283
- }
13284
- throw err;
13285
- }
13286
- }
13287
- if (lastResult !== void 0) return lastResult;
13288
- throw lastError;
13289
- }
13290
-
13291
13305
  //#endregion
13292
13306
  //#region src/auto-reply/reply/block-reply-coalescer.ts
13293
13307
  function createBlockReplyCoalescer(params) {
@@ -15415,7 +15429,7 @@ async function runPreparedReply(params) {
15415
15429
  const laneSize = getQueueSize(sessionLaneKey);
15416
15430
  if (resolvedQueue.mode === "interrupt" && laneSize > 0) logVerbose(`Interrupting ${sessionLaneKey} (cleared ${clearCommandLane(sessionLaneKey)})`);
15417
15431
  const queueKey = sessionKey ?? sessionIdFinal;
15418
- const isActive = false;
15432
+ const isActive = isSessionRunActive(queueKey);
15419
15433
  const shouldFollowup = resolvedQueue.mode === "followup" || resolvedQueue.mode === "collect" || resolvedQueue.mode === "steer-backlog";
15420
15434
  return runReplyAgent({
15421
15435
  commandBody: prefixedCommandBody,
@@ -15543,7 +15557,7 @@ async function deliverSessionMaintenanceWarning(params) {
15543
15557
  return;
15544
15558
  }
15545
15559
  try {
15546
- const { deliverOutboundPayloads } = await import("./deliver-BTjGqSGN.js").then((n) => n.n);
15560
+ const { deliverOutboundPayloads } = await import("./deliver-z04wZfnQ.js").then((n) => n.n);
15547
15561
  const outboundSession = buildOutboundSessionContext({
15548
15562
  cfg: params.cfg,
15549
15563
  sessionKey: params.sessionKey
@@ -19639,7 +19653,7 @@ function createWhatsAppLoginTool() {
19639
19653
  force: Type.Optional(Type.Boolean())
19640
19654
  }),
19641
19655
  execute: async (_toolCallId, args) => {
19642
- const { startWebLoginWithQr, waitForWebLogin } = await import("./login-qr-C7zaGKxz.js");
19656
+ const { startWebLoginWithQr, waitForWebLogin } = await import("./login-qr-ZRBRz2BA.js");
19643
19657
  if ((args?.action ?? "start") === "wait") {
19644
19658
  const result = await waitForWebLogin({ timeoutMs: typeof args.timeoutMs === "number" ? args.timeoutMs : void 0 });
19645
19659
  return {
@@ -21464,7 +21478,7 @@ async function preflightDiscordMessage(params) {
21464
21478
  let preflightTranscript;
21465
21479
  const hasAudioAttachment = message.attachments?.some((att) => att.contentType?.startsWith("audio/"));
21466
21480
  if (!isDirectMessage && shouldRequireMention && hasAudioAttachment && !baseText && mentionRegexes.length > 0) try {
21467
- const { transcribeFirstAudio } = await import("./preflight-B9B3VBaW.js").then((n) => n.t);
21481
+ const { transcribeFirstAudio } = await import("./preflight-a80t-iPi.js").then((n) => n.t);
21468
21482
  const audioPaths = message.attachments?.filter((att) => att.contentType?.startsWith("audio/")).map((att) => att.url) ?? [];
21469
21483
  if (audioPaths.length > 0) preflightTranscript = await transcribeFirstAudio({
21470
21484
  ctx: {
@@ -26389,7 +26403,7 @@ function createDiscordGatewayPlugin(params) {
26389
26403
  return super.registerClient(client);
26390
26404
  }
26391
26405
  createWebSocket(url) {
26392
- return new WebSocket$1(url, { agent: wsAgent });
26406
+ return new WebSocket(url, { agent: wsAgent });
26393
26407
  }
26394
26408
  }
26395
26409
  return new ProxyGatewayPlugin();
@@ -34598,7 +34612,7 @@ function readSlackExternalArgMenuToken(raw) {
34598
34612
  }
34599
34613
  let commandsRegistry;
34600
34614
  async function getCommandsRegistry() {
34601
- if (!commandsRegistry) commandsRegistry = await import("./commands-registry-CB3qR3Ui.js").then((n) => n.n);
34615
+ if (!commandsRegistry) commandsRegistry = await import("./commands-registry-BQrQnwzJ.js").then((n) => n.n);
34602
34616
  return commandsRegistry;
34603
34617
  }
34604
34618
  function encodeSlackCommandArgValue(parts) {
@@ -34922,14 +34936,14 @@ async function registerSlackMonitorSlashCommands(params) {
34922
34936
  const channelName = channelInfo?.name;
34923
34937
  const roomLabel = channelName ? `#${channelName}` : `#${command.channel_id}`;
34924
34938
  const [{ resolveAgentRoute }, { finalizeInboundContext }, { dispatchReplyWithDispatcher }] = await Promise.all([
34925
- import("./resolve-route-BBztqaX0.js").then((n) => n.r),
34939
+ import("./resolve-route-DFUMTbRD.js").then((n) => n.r),
34926
34940
  import("./inbound-context-DbddR753.js").then((n) => n.n),
34927
34941
  Promise.resolve().then(() => provider_dispatcher_exports)
34928
34942
  ]);
34929
34943
  const [{ resolveConversationLabel }, { createReplyPrefixOptions }, { recordSessionMetaFromInbound, resolveStorePath }] = await Promise.all([
34930
34944
  import("./conversation-label-Dg3yLt9j.js").then((n) => n.t),
34931
- import("./reply-prefix-DwJ8gxoz.js").then((n) => n.n),
34932
- import("./sessions-BePPqEtN.js").then((n) => n.t)
34945
+ import("./reply-prefix-DtQ_7Eac.js").then((n) => n.n),
34946
+ import("./sessions-D5CiijxL.js").then((n) => n.t)
34933
34947
  ]);
34934
34948
  const route = resolveAgentRoute({
34935
34949
  cfg,
@@ -34997,9 +35011,9 @@ async function registerSlackMonitorSlashCommands(params) {
34997
35011
  });
34998
35012
  const deliverSlashPayloads = async (replies) => {
34999
35013
  const [{ deliverSlackSlashReplies }, { resolveChunkMode }, { resolveMarkdownTableMode }] = await Promise.all([
35000
- import("./replies-Cu8SG6CK.js").then((n) => n.r),
35001
- import("./chunk-C5Oai9vm.js").then((n) => n.s),
35002
- import("./markdown-tables-Bm7xJUcn.js").then((n) => n.t)
35014
+ import("./replies-Dsu1hdd7.js").then((n) => n.r),
35015
+ import("./chunk-0ZB8yVlw.js").then((n) => n.s),
35016
+ import("./markdown-tables-CfM1ner1.js").then((n) => n.t)
35003
35017
  ]);
35004
35018
  await deliverSlackSlashReplies({
35005
35019
  replies,
@@ -35485,7 +35499,7 @@ async function auditTelegramGroupMembership(params) {
35485
35499
  elapsedMs: Date.now() - started
35486
35500
  };
35487
35501
  const fetcher = params.proxyUrl ? (await import("./proxy-HXV2llPX.js").then((n) => n.n)).makeProxyFetch(params.proxyUrl) : fetch;
35488
- const { fetchWithTimeout } = await import("./fetch-timeout-DTIN7CGM.js").then((n) => n.r);
35502
+ const { fetchWithTimeout } = await import("./fetch-timeout-jOIu9Xud.js").then((n) => n.r);
35489
35503
  const base = `${TELEGRAM_API_BASE$1}/bot${token}`;
35490
35504
  const groups = [];
35491
35505
  for (const chatId of params.groupIds) try {
@@ -37307,7 +37321,7 @@ const buildTelegramMessageContext = async ({ primaryCtx, allMedia, storeAllowFro
37307
37321
  const hasAudio = allMedia.some((media) => media.contentType?.startsWith("audio/"));
37308
37322
  let preflightTranscript;
37309
37323
  if (isGroup && requireMention && hasAudio && !hasUserText && mentionRegexes.length > 0) try {
37310
- const { transcribeFirstAudio } = await import("./preflight-B9B3VBaW.js").then((n) => n.t);
37324
+ const { transcribeFirstAudio } = await import("./preflight-a80t-iPi.js").then((n) => n.t);
37311
37325
  preflightTranscript = await transcribeFirstAudio({
37312
37326
  ctx: {
37313
37327
  MediaPaths: allMedia.length > 0 ? allMedia.map((m) => m.path) : void 0,
@@ -39625,23 +39639,23 @@ let webLoginQrPromise = null;
39625
39639
  let webChannelPromise = null;
39626
39640
  let whatsappActionsPromise = null;
39627
39641
  function loadWebOutbound() {
39628
- webOutboundPromise ??= import("./outbound-CCvRhb_6.js").then((n) => n.t);
39642
+ webOutboundPromise ??= import("./outbound-BCY7cG5r.js").then((n) => n.t);
39629
39643
  return webOutboundPromise;
39630
39644
  }
39631
39645
  function loadWebLogin() {
39632
- webLoginPromise ??= import("./login-DWKSrC5K.js").then((n) => n.n);
39646
+ webLoginPromise ??= import("./login-BYHOjw55.js").then((n) => n.n);
39633
39647
  return webLoginPromise;
39634
39648
  }
39635
39649
  function loadWebLoginQr() {
39636
- webLoginQrPromise ??= import("./login-qr-C7zaGKxz.js");
39650
+ webLoginQrPromise ??= import("./login-qr-ZRBRz2BA.js");
39637
39651
  return webLoginQrPromise;
39638
39652
  }
39639
39653
  function loadWebChannel() {
39640
- webChannelPromise ??= import("./web-CKces-ap.js");
39654
+ webChannelPromise ??= import("./web-DHXIgMOC.js");
39641
39655
  return webChannelPromise;
39642
39656
  }
39643
39657
  function loadWhatsAppActions() {
39644
- whatsappActionsPromise ??= import("./whatsapp-actions-BzyFEHw4.js");
39658
+ whatsappActionsPromise ??= import("./whatsapp-actions-sR-u0T6U.js");
39645
39659
  return whatsappActionsPromise;
39646
39660
  }
39647
39661
  function createPluginRuntime() {
@@ -41035,15 +41049,7 @@ async function agentCommand(opts, runtime = defaultRuntime, deps = createDefault
41035
41049
  const runContext = resolveAgentRunContext(opts);
41036
41050
  const messageChannel = resolveMessageChannel(runContext.messageChannel, opts.replyChannel ?? opts.channel);
41037
41051
  const sessionMap = createSessionMapAdapter({ getSessionId: () => getCliSessionId(sessionEntry, provider) });
41038
- const bridge = new ChannelBridge({
41039
- provider: resolveAgentRuntimeOrThrow(cfg, sessionAgentId),
41040
- sessionMap,
41041
- gatewayUrl: resolveGatewayUrlFromConfig(cfg),
41042
- gatewayToken: resolveGatewayTokenFromConfig(cfg),
41043
- workspaceDir,
41044
- runtimeArgs: resolveAgentRuntimeArgs(cfg, sessionAgentId),
41045
- runtimeEnv: resolveAgentRuntimeEnv(cfg, sessionAgentId)
41046
- });
41052
+ const baseRuntimeEnv = resolveAgentRuntimeEnv(cfg, sessionAgentId);
41047
41053
  const messageToolHints = resolveChannelMessageToolHints({
41048
41054
  cfg,
41049
41055
  channel: messageChannel,
@@ -41059,7 +41065,23 @@ async function agentCommand(opts, runtime = defaultRuntime, deps = createDefault
41059
41065
  timestamp: Date.now(),
41060
41066
  messageToolHints
41061
41067
  });
41062
- result = await bridge.handle(message, void 0, opts.abortSignal);
41068
+ result = await withAuthKeyRetry({
41069
+ cfg,
41070
+ agentId: sessionAgentId,
41071
+ baseEnv: baseRuntimeEnv
41072
+ }, async (runtimeEnv) => {
41073
+ const bridgeResult = await new ChannelBridge({
41074
+ provider: resolveAgentRuntimeOrThrow(cfg, sessionAgentId),
41075
+ sessionMap,
41076
+ gatewayUrl: resolveGatewayUrlFromConfig(cfg),
41077
+ gatewayToken: resolveGatewayTokenFromConfig(cfg),
41078
+ workspaceDir,
41079
+ runtimeArgs: resolveAgentRuntimeArgs(cfg, sessionAgentId),
41080
+ runtimeEnv
41081
+ }).handle(message, void 0, opts.abortSignal);
41082
+ if (bridgeResult.error && bridgeResult.payloads.length === 0) throw new Error(bridgeResult.error);
41083
+ return bridgeResult;
41084
+ }, (bridgeResult) => bridgeResult.error);
41063
41085
  emitAgentEvent({
41064
41086
  runId,
41065
41087
  stream: "lifecycle",