@gguf/claw 2026.2.4 → 2026.2.5

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 (616) hide show
  1. package/CHANGELOG.md +50 -1
  2. package/LICENSE +1 -1
  3. package/README.md +50 -43
  4. package/dist/{accounts-BlHoTziG.js → accounts-BgZmhIm6.js} +4 -4
  5. package/dist/{accounts-B5QZU96b.js → accounts-Dto4p9zB.js} +2 -2
  6. package/dist/{acp-cli-DU_cVWbN.js → acp-cli-BOKabdeW.js} +15 -15
  7. package/dist/{acp-cli-O8LcQigE.js → acp-cli-BwcHtBDk.js} +19 -19
  8. package/dist/{agent-BBI-UGkN.js → agent-DztWhVCH.js} +20 -13
  9. package/dist/{agent-DuQt3QDO.js → agent-_H-0rbHV.js} +21 -14
  10. package/dist/{agent-scope-jm0ZdXwM.js → agent-scope-C9VjJXEK.js} +5 -180
  11. package/dist/{agent-scope-CrgUOY3f.js → agent-scope-CMs5Y7l-.js} +6 -181
  12. package/dist/{agent-scope-COnICB_7.js → agent-scope-Csu2B6AM.js} +2 -2
  13. package/dist/{audit-D-OqdjQu.js → audit-BWbjQmyv.js} +182 -15
  14. package/dist/{audit-CWGOX7Eh.js → audit-ZY6Dk5Ec.js} +183 -16
  15. package/dist/{auth-viF_w60n.js → auth-CbhB03Rz.js} +2 -2
  16. package/dist/{auth-DK3l201_.js → auth-DksjO6WG.js} +2 -2
  17. package/dist/{auth-health-DcKoxhDo.js → auth-health-C4bElkgf.js} +1 -1
  18. package/dist/{auth-health-Ba9GTScq.js → auth-health-Ctf-_JFE.js} +1 -1
  19. package/dist/{auth-profiles-CfFGCDJa.js → auth-profiles-CYBuGiBb.js} +38 -13
  20. package/dist/build-info.json +2 -2
  21. package/dist/{call-CfqL-4Nc.js → call-90HgQQ8o.js} +34 -8
  22. package/dist/{call-CPBhMXxo.js → call-BTbA5OB4.js} +35 -9
  23. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  24. package/dist/canvas-host/a2ui/a2ui.bundle.js +29 -44
  25. package/dist/{channel-options-eRR8_a8h.js → channel-options-DrUmtdd9.js} +3 -3
  26. package/dist/{channel-options-BCSvD6JM.js → channel-options-uftAnT5P.js} +7 -7
  27. package/dist/{channel-selection-BAwiO0li.js → channel-selection-CJWYmCLf.js} +2 -2
  28. package/dist/{channel-selection-BCn8_qun.js → channel-selection-PZuuCvrp.js} +2 -2
  29. package/dist/{channel-summary-BkqO8zZ9.js → channel-summary-D9nzC5WB.js} +8 -42
  30. package/dist/{channel-summary-C8GoEKgH.js → channel-summary-DUiKDBLv.js} +9 -43
  31. package/dist/{channels-cli-CBGINubh.js → channels-cli-PAlqhOZ7.js} +56 -54
  32. package/dist/{channels-cli-yQo-Rzw6.js → channels-cli-PPk5wwuy.js} +59 -57
  33. package/dist/{channels-status-issues-C9vMMPG0.js → channels-status-issues-CJ8PJgDc.js} +1 -1
  34. package/dist/{channels-status-issues-DRXQXvhY.js → channels-status-issues-CrS1r5sr.js} +1 -1
  35. package/dist/{chrome-DlqPCh1y.js → chrome-B3IuUad-.js} +2 -2
  36. package/dist/{chrome-D2LUApAY.js → chrome-BNSd7Bie.js} +5 -5
  37. package/dist/{clack-prompter-OmDa1Hm1.js → clack-prompter-CEKDd_Vg.js} +5 -5
  38. package/dist/{clack-prompter-BJuVh97L.js → clack-prompter-DuBVnTKy.js} +4 -4
  39. package/dist/cli/daemon-cli.js +1 -1
  40. package/dist/cli-DBAccB3n.js +86 -0
  41. package/dist/cli-DD5dW58-.js +89 -0
  42. package/dist/{client-zqMhLTAX.js → client-BYVbRnuQ.js} +13 -5
  43. package/dist/{client-cU7Xg1MO.js → client-CxbkcEZ7.js} +12 -4
  44. package/dist/{command-options-51bBgSJL.js → command-options-DUUINcz0.js} +3 -3
  45. package/dist/{commands-DMKDOFmC.js → commands-DAC7XMAT.js} +5 -4
  46. package/dist/completion-cli-BPIeQDFy.js +773 -0
  47. package/dist/{completion-cli-BoF86Oeq.js → completion-cli-BbhA_JbG.js} +62 -15
  48. package/dist/{config-qgIz1lbh.js → config-CAuZ-EkU.js} +93 -31
  49. package/dist/{config-CGsoho7J.js → config-CG73z4h6.js} +61 -28
  50. package/dist/{config-DCT1RAo6.js → config-CKLedg5Y.js} +92 -30
  51. package/dist/{config-guard-CJuPkD5Y.js → config-guard-a5ynrKd-.js} +181 -57
  52. package/dist/{configure-C1_0rFdQ.js → configure-B47GYdlB.js} +33 -23
  53. package/dist/{configure-D0OAmW2s.js → configure-ChnTy7Jz.js} +31 -21
  54. package/dist/{control-service-BW5sW2U1.js → control-service-CS61Road.js} +13 -6
  55. package/dist/{control-service-Ds9ompnU.js → control-service-D2E9NKqQ.js} +12 -5
  56. package/dist/control-ui/assets/{index-RwcW4Xl0.css → index-BoXosYY6.css} +1 -1
  57. package/dist/control-ui/assets/index-Dm6g1E26.js +7553 -0
  58. package/dist/control-ui/assets/index-Dm6g1E26.js.map +1 -0
  59. package/dist/control-ui/index.html +2 -2
  60. package/dist/{cron-cli-Bn_e3WGb.js → cron-cli-CssI71-c.js} +20 -19
  61. package/dist/{cron-cli-BVARiNrv.js → cron-cli-Ys53MyTg.js} +24 -23
  62. package/dist/{daemon-cli-fHXAapHL.js → daemon-cli-B6aLZ8OE.js} +28 -23
  63. package/dist/{daemon-cli-yy_MAYxv.js → daemon-cli-CMKd_D6h.js} +26 -21
  64. package/dist/{daemon-runtime-vNkYv9tq.js → daemon-runtime-BCn_QIHK.js} +64 -7
  65. package/dist/{daemon-runtime-ELWW7q0C.js → daemon-runtime-DMd0mgTK.js} +64 -7
  66. package/dist/{deliver-Bsvrattg.js → deliver-C3bnXkg5.js} +12 -10
  67. package/dist/{deliver-Dl8TEyHM.js → deliver-CZPhTA7x.js} +7 -5
  68. package/dist/{deliver-eE21zdeQ.js → deliver-Cau4HL7W.js} +11 -9
  69. package/dist/{deps-BrcOX0ht.js → deps-BG1LonF6.js} +2 -2
  70. package/dist/{deps-wXkiMwLZ.js → deps-ytXmI88x.js} +2 -2
  71. package/dist/{devices-cli-BjlwgE6B.js → devices-cli-Cm0ENrXH.js} +16 -16
  72. package/dist/{devices-cli-BVc_Ic5O.js → devices-cli-D_rnGkqO.js} +12 -12
  73. package/dist/{directory-cli-cc9ivzEM.js → directory-cli-CGLolzJC.js} +15 -15
  74. package/dist/{directory-cli-CULRQACb.js → directory-cli-CTtv_AB7.js} +19 -19
  75. package/dist/{dispatcher-BNB5aCZ6.js → dispatcher-6oI-H42S.js} +1 -1
  76. package/dist/{dns-cli-BwDdBlsK.js → dns-cli-BRkJGLqK.js} +15 -15
  77. package/dist/{dns-cli-B79COhmu.js → dns-cli-CoeI4817.js} +11 -11
  78. package/dist/{docs-cli-BM55jf4Y.js → docs-cli-BH9bMx3a.js} +7 -7
  79. package/dist/{docs-cli-t7IEzxr8.js → docs-cli-Bh1Coji2.js} +10 -10
  80. package/dist/{doctor-CT9JPoCt.js → doctor-CwSrWRCp.js} +43 -38
  81. package/dist/{doctor-OmfNRlMS.js → doctor-JnMryC_M.js} +40 -35
  82. package/dist/entry.js +12 -8
  83. package/dist/{env-DOcCob95.js → env-0_mKbEWW.js} +2 -2
  84. package/dist/{errors-DdT2Dtkb.js → errors-CZ9opC6L.js} +4 -4
  85. package/dist/{exec-B7WKla_0.js → exec-BMnoMcZW.js} +1 -1
  86. package/dist/{exec-CTo4hK94.js → exec-HEWTMJ7j.js} +1 -1
  87. package/dist/{exec-approvals-WdYFyy5N.js → exec-approvals-BCEFzcbC.js} +19 -2
  88. package/dist/{exec-approvals-CK-Umdr3.js → exec-approvals-DZixgolZ.js} +19 -2
  89. package/dist/{exec-approvals-cli-DD_z4fL9.js → exec-approvals-cli-D7aVv5hN.js} +19 -19
  90. package/dist/{exec-approvals-cli-BK2toX2b.js → exec-approvals-cli-DzLp5G7t.js} +23 -23
  91. package/dist/extensionAPI.js +1186 -267
  92. package/dist/{gateway-cli-BCC0T5iY.js → gateway-cli-DHP5DRUH.js} +910 -199
  93. package/dist/{gateway-cli-BTlr6Uwl.js → gateway-cli-ape0pnBU.js} +912 -202
  94. package/dist/{gateway-rpc-CMAcradB.js → gateway-rpc-C8rNIC0P.js} +3 -3
  95. package/dist/{gateway-rpc-SvVB4Fmv.js → gateway-rpc-CWnTaSEY.js} +3 -3
  96. package/dist/{github-copilot-auth-BHLcQ1sN.js → github-copilot-auth-B_lK1g__.js} +173 -87
  97. package/dist/{github-copilot-auth-BoRchp_Q.js → github-copilot-auth-C8Uf0Q03.js} +174 -88
  98. package/dist/{github-copilot-token-BEtihsn6.js → github-copilot-token-B3SA95yo.js} +8 -2
  99. package/dist/{github-copilot-token-rP-6QdKv.js → github-copilot-token-SLWintYd.js} +7 -1
  100. package/dist/{github-copilot-token-VZsS4013.js → github-copilot-token-pGSmVaW-.js} +8 -2
  101. package/dist/{gmail-setup-utils-4czdWNCN.js → gmail-setup-utils-Bi6W14MK.js} +3 -3
  102. package/dist/{gmail-setup-utils-B1CTmT2V.js → gmail-setup-utils-QpN7TEXS.js} +4 -4
  103. package/dist/{health-format-B4_A88V3.js → health-format-B3eStY5r.js} +215 -21
  104. package/dist/{health-format-Ct8J0fwc.js → health-format-ND2rUbQO.js} +213 -19
  105. package/dist/{help-format-CGcnDM3D.js → help-format-Bozi4K9H.js} +1 -1
  106. package/dist/{helpers-DfgBr1D5.js → helpers-BIc7L8EF.js} +1 -1
  107. package/dist/{helpers-Cw9kFCkw.js → helpers-D66_XoIz.js} +1 -1
  108. package/dist/{hooks-cli-NmkXLKmj.js → hooks-cli-BMu_-4Ru.js} +49 -49
  109. package/dist/{hooks-cli-B-28F__A.js → hooks-cli-CmeQxEOM.js} +45 -45
  110. package/dist/{hooks-status-I3Y60zVN.js → hooks-status-CKmUPU-M.js} +3 -3
  111. package/dist/{hooks-status-XV9oQICf.js → hooks-status-DepPyfBb.js} +4 -4
  112. package/dist/{image-ClOB6QDJ.js → image-Ca_PtqY7.js} +8 -6
  113. package/dist/{image-BYmtfVH8.js → image-CgBndiQy.js} +9 -7
  114. package/dist/{image-CXg7Z0WD.js → image-nRwqkmtf.js} +8 -6
  115. package/dist/index.js +231 -105
  116. package/dist/{installs-C5cjVarj.js → installs-BhEjOqPy.js} +43 -6
  117. package/dist/{installs-W4Pc1LJz.js → installs-DsJkyWfL.js} +43 -6
  118. package/dist/{links-C9fyAH-V.js → links-B5pRdmo1.js} +1 -1
  119. package/dist/{links-jGisPfXW.js → links-D0uzJbi6.js} +1 -1
  120. package/dist/{loader-BYWxo-_j.js → loader-_Pj-TZS2.js} +920 -491
  121. package/dist/{logging-BnUUuH3y.js → logging-Cc7m6PTv.js} +1 -1
  122. package/dist/{logging-CLCWl7Iu.js → logging-TXWhN8jG.js} +2 -2
  123. package/dist/{login-qr-C2H_iQJU.js → login-qr-BIlr0vwe.js} +12 -7
  124. package/dist/{login-qr-7WOtj6zE.js → login-qr-CcOWO_dR.js} +9 -4
  125. package/dist/{login-qr-sEcxw1_U.js → login-qr-Cmsf7BGt.js} +11 -6
  126. package/dist/{logs-cli-C5v4fEDj.js → logs-cli-5L3NxTsc.js} +19 -19
  127. package/dist/{logs-cli-nVwK5g60.js → logs-cli-DtiFFkZL.js} +15 -15
  128. package/dist/{manager-rDmdE7O9.js → manager-BXiIQku7.js} +9 -7
  129. package/dist/{manager-JSP5pLyv.js → manager-C4ILl-d3.js} +10 -8
  130. package/dist/{manager-BArueSTR.js → manager-LpytrxUw.js} +12 -10
  131. package/dist/{manifest-registry-tuAcHxrV.js → manifest-registry-C69Z-I4v.js} +1 -1
  132. package/dist/{manifest-registry-BFpLJJDB.js → manifest-registry-DHaa1SJb.js} +1 -1
  133. package/dist/{message-channel-CAFcg7mw.js → message-channel-BlgPSDAh.js} +6 -1
  134. package/dist/{message-channel-CQGWXVL4.js → message-channel-Bpfe5l5f.js} +7 -2
  135. package/dist/{model-selection-Cp1maz7B.js → model-selection-DMUrNhQP.js} +41 -16
  136. package/dist/{model-selection-Cs1y6OBv.js → model-selection-mzTqrNoj.js} +38 -14
  137. package/dist/{models-cli-n9a8pESx.js → models-cli-DHzyyLvp.js} +49 -49
  138. package/dist/{models-cli-DGnLcr4X.js → models-cli-EhrWjNLH.js} +53 -53
  139. package/dist/{net-DaJz_a4n.js → net-C8YRVt16.js} +1 -1
  140. package/dist/{net-DeiCIMU6.js → net-CWMMy37F.js} +1 -1
  141. package/dist/{node-cli-rtEq-YyU.js → node-cli-2oYmIWJt.js} +30 -30
  142. package/dist/{node-cli-AOO0HsM1.js → node-cli-DH7Ykym5.js} +26 -26
  143. package/dist/{node-service-CjtBRyjp.js → node-service-BAYHx0E7.js} +2 -2
  144. package/dist/{node-service-BW_LhY5w.js → node-service-Lc1LlnFH.js} +2 -2
  145. package/dist/{nodes-cli-Coxj5hDA.js → nodes-cli-Bc5K-0Lt.js} +22 -22
  146. package/dist/{nodes-cli-ChBsNXzz.js → nodes-cli-hT8yYD7S.js} +18 -18
  147. package/dist/{nodes-screen-Ln98EX_f.js → nodes-screen-DGlNPbk4.js} +2 -2
  148. package/dist/{nodes-screen-DOhGEibx.js → nodes-screen-DT5HvhJV.js} +2 -2
  149. package/dist/{note-BFpD-42H.js → note-B5HnoeZX.js} +2 -2
  150. package/dist/{note-CBiVaqG7.js → note-Ci08TSbV.js} +1 -1
  151. package/dist/{onboard-channels-CF7lTDNu.js → onboard-channels-D-ZQTy5V.js} +9 -8
  152. package/dist/{onboard-channels-CJCy7TTQ.js → onboard-channels-DKT27PdN.js} +10 -9
  153. package/dist/{onboard-skills-DdFGj9pt.js → onboard-skills-YobctE-R.js} +259 -194
  154. package/dist/{onboard-skills-fL84FI8F.js → onboard-skills-s8J5xbUr.js} +259 -194
  155. package/dist/{onboarding-DcN1avQK.js → onboarding-BP4-5uzE.js} +96 -60
  156. package/dist/{pairing-cli-DbP9KqPL.js → pairing-cli-C8KHRjaU.js} +15 -15
  157. package/dist/{pairing-cli-B7RQFp4r.js → pairing-cli-i7wiTmYC.js} +19 -19
  158. package/dist/{pairing-labels-DK2aLSd2.js → pairing-labels-BbydDT7w.js} +1 -1
  159. package/dist/{pairing-labels-C6I3dD-m.js → pairing-labels-CtqLxbG6.js} +1 -1
  160. package/dist/{pairing-store-BnMngoWQ.js → pairing-store-DFq7WtOv.js} +2 -2
  161. package/dist/{pairing-store-DMex6WWe.js → pairing-store-DTfv_FGA.js} +1 -1
  162. package/dist/{path-env-CuGC6r1F.js → path-env-DP3DsVge.js} +2 -2
  163. package/dist/{path-env-CUhrC5DA.js → path-env-h3xp5PqO.js} +1 -1
  164. package/dist/{paths-xPuk88Yf.js → paths-B4kigINg.js} +2 -2
  165. package/dist/{paths-50eo6DV6.js → paths-Bb0nwPeu.js} +2 -2
  166. package/dist/{paths-RvF0P6tQ.js → paths-CTg8F3AE.js} +1 -1
  167. package/dist/{pi-embedded-helpers-DJgCXZEz.js → pi-embedded-helpers-BB4uACeq.js} +175 -170
  168. package/dist/{pi-embedded-helpers-DiK8Qn1l.js → pi-embedded-helpers-BxqZh6U7.js} +43 -19
  169. package/dist/{pi-embedded-helpers-CC00lEFI.js → pi-embedded-helpers-DF8SAHU-.js} +175 -170
  170. package/dist/{pi-model-discovery-DjGamP_B.js → pi-model-discovery-CV2V1HHz.js} +8 -1
  171. package/dist/{pi-model-discovery-CnK2Dol8.js → pi-model-discovery-DzEIEgHL.js} +8 -1
  172. package/dist/{pi-model-discovery-CsRo-xMp.js → pi-model-discovery-EhM2JAQo.js} +8 -1
  173. package/dist/{pi-tools.policy-DleRi9eC.js → pi-tools.policy-BQ8N5y8a.js} +5 -4
  174. package/dist/{plugin-auto-enable-JQ63k0Ce.js → plugin-auto-enable-Ci7TBlH2.js} +5 -5
  175. package/dist/{plugin-auto-enable-CIVp3SAp.js → plugin-auto-enable-DyW8lHTT.js} +4 -4
  176. package/dist/plugin-sdk/index.d.ts +228 -283
  177. package/dist/plugin-sdk/index.js +22528 -69091
  178. package/dist/plugin-sdk/pi-model-discovery-Dw3A6oXH.js +37 -0
  179. package/dist/{plugins-TrKFfrLt.js → plugins-BUPpq5aS.js} +3 -2
  180. package/dist/{plugins-D1CxUobm.js → plugins-BYIWo0Cp.js} +5 -4
  181. package/dist/{plugins-cli-17wYux52.js → plugins-cli-CGfxctIx.js} +50 -49
  182. package/dist/{plugins-cli-VyQWn_LW.js → plugins-cli-Dr_R2-FY.js} +46 -45
  183. package/dist/{ports-B27T1uRn.js → ports-0V-Mu4ch.js} +2 -2
  184. package/dist/{program-BA9_uWfO.js → program-oR55MCAT.js} +84 -81
  185. package/dist/{progress-uNDQDtGB.js → progress-xpLtQsNY.js} +1 -1
  186. package/dist/{prompt-style-gfROyHgB.js → prompt-style-vzh0MGHs.js} +1 -1
  187. package/dist/{pw-ai-BC4dLE7k.js → pw-ai-B7Fvw8DW.js} +4 -4
  188. package/dist/{pw-ai-DlTBXZjY.js → pw-ai-DYpQO6HI.js} +6 -6
  189. package/dist/{pw-ai-BEqPnalN.js → pw-ai-tNPuRNn3.js} +4 -4
  190. package/dist/{qmd-manager-8xWxIGbO.js → qmd-manager-BKkFEEN_.js} +9 -8
  191. package/dist/{plugin-sdk/qmd-manager-DvkA01DP.js → qmd-manager-CF52nuBg.js} +6 -6
  192. package/dist/{qmd-manager-BSCOmXYZ.js → qmd-manager-Dub8jfbo.js} +7 -6
  193. package/dist/{register.subclis-CWWz9WdX.js → register.subclis-BpIR6Iqi.js} +36 -30
  194. package/dist/{reply-CoztdrN_.js → reply-B8pOiUNN.js} +935 -506
  195. package/dist/rolldown-runtime-Cbj13DAv.js +20 -0
  196. package/dist/{routes-yI5QIzeL.js → routes-BSfXf8a5.js} +5 -5
  197. package/dist/{routes-Ds-tIZFJ.js → routes-DchZU3EK.js} +6 -6
  198. package/dist/{rpc-HF82_iLh.js → rpc-DqI3QH59.js} +3 -3
  199. package/dist/{rpc-HdKLb6jx.js → rpc-Vo2ACfn-.js} +3 -3
  200. package/dist/{run-main-B3krVvc1.js → run-main-DrVUUPHV.js} +84 -84
  201. package/dist/{sandbox-BXUfp_qv.js → sandbox-CV8VwPij.js} +36 -16
  202. package/dist/{sandbox-Cnq9TXEn.js → sandbox-DuqLKN5J.js} +34 -14
  203. package/dist/{sandbox-cli-C7j1V6tb.js → sandbox-cli-C0_Hrk7i.js} +25 -24
  204. package/dist/{sandbox-cli-CnS9JJlO.js → sandbox-cli-Ces6i3n2.js} +21 -20
  205. package/dist/{security-cli-Clg7RQT3.js → security-cli-CybLT9XS.js} +32 -30
  206. package/dist/{security-cli-BGd4NO4l.js → security-cli-T7yrd3lb.js} +28 -26
  207. package/dist/{server-context-D2cv-pIA.js → server-context-vChIAqjH.js} +6 -6
  208. package/dist/{server-context-CM_E6wD5.js → server-context-yKyxyxOJ.js} +5 -5
  209. package/dist/{server-node-events-IMwI538C.js → server-node-events-BR2vHqf6.js} +44 -43
  210. package/dist/{server-node-events-C5EqDe_U.js → server-node-events-D39FA0NG.js} +48 -47
  211. package/dist/{service-CAxAjHNB.js → service-BZesBIaG.js} +3 -3
  212. package/dist/{service-BoDHq_LN.js → service-_JwSmGSn.js} +2 -2
  213. package/dist/{service-audit-Bf33pqEM.js → service-audit-C-IA4omi.js} +6 -6
  214. package/dist/{service-audit-DBSAGhm8.js → service-audit-DDX1kO3k.js} +6 -6
  215. package/dist/session-cost-usage-BTXosU1k.js +692 -0
  216. package/dist/session-cost-usage-CBP4Hv9D.js +692 -0
  217. package/dist/session-key-CZkcvAtx.js +177 -0
  218. package/dist/session-key-Dm2EOhrH.js +177 -0
  219. package/dist/{shared-ChNOqAzp.js → shared-BmtNKsPq.js} +4 -4
  220. package/dist/{shared-D42-KbPa.js → shared-C1XLEyB0.js} +3 -3
  221. package/dist/{shared-xZjRQa6y.js → shared-C8_5pNbb.js} +4 -4
  222. package/dist/{shared-DBGw227P.js → shared-fnGLWyZ6.js} +3 -3
  223. package/dist/skill-scanner-BoGjHXUZ.js +255 -0
  224. package/dist/skill-scanner-Bp1D9gra.js +255 -0
  225. package/dist/{skills-DtwGIkTI.js → skills-CmU0Q92f.js} +3 -3
  226. package/dist/{skills-C4b1FA1e.js → skills-D5JDj3TR.js} +5 -5
  227. package/dist/{skills-cli-BPkuJAz9.js → skills-cli-C1yJvIkL.js} +16 -16
  228. package/dist/{skills-cli-b0ZmGlmh.js → skills-cli-DBC5zFat.js} +12 -12
  229. package/dist/{skills-status-CSCMqNZP.js → skills-status-CEvVUD3U.js} +3 -3
  230. package/dist/{skills-status-CWkBweWW.js → skills-status-DtXrj3fy.js} +2 -2
  231. package/dist/{status-BIWeu5mN.js → status-BRXuHUsK.js} +94 -58
  232. package/dist/{status-CcM6W8r4.js → status-BTGXSvZ1.js} +3 -3
  233. package/dist/{status-PjegR5Cv.js → status-DBZ5Z7ng.js} +4 -4
  234. package/dist/{subsystem-46MXi6Ip.js → subsystem-CAq3uyo7.js} +1 -1
  235. package/dist/{system-cli-B4FEIE5d.js → system-cli-Dqnt-b0D.js} +13 -13
  236. package/dist/{system-cli-BL_QZ1VP.js → system-cli-SJLtqI47.js} +17 -17
  237. package/dist/{systemd-DAgZTW06.js → systemd-8sIc6isV.js} +2 -2
  238. package/dist/{systemd-CNYEkRek.js → systemd-B-3NdMmA.js} +3 -3
  239. package/dist/{systemd-hints-CcgK8AJE.js → systemd-hints-DO88c_nD.js} +1 -1
  240. package/dist/{systemd-hints-okqOoOug.js → systemd-hints-Wim4Bq6j.js} +1 -1
  241. package/dist/{systemd-linger-CTe0ZDxD.js → systemd-linger-N-cIaegf.js} +8 -3
  242. package/dist/{systemd-linger-Cbkoh9qw.js → systemd-linger-SsSOsJST.js} +8 -3
  243. package/dist/{table-f0EgX-YI.js → table-CJSx0YID.js} +1 -1
  244. package/dist/{table-DuNe7Qes.js → table-CLtGjVsx.js} +2 -2
  245. package/dist/{tailscale-BUcKO8Rr.js → tailscale-9MusRvOi.js} +1 -1
  246. package/dist/{tailscale-Cvk3mQDZ.js → tailscale-BVGD9gSD.js} +2 -2
  247. package/dist/{tool-display-rIUh61kT.js → tool-display-BxZG0o1b.js} +2 -2
  248. package/dist/{tool-display-BMYWrp0L.js → tool-display-DmgKs6-V.js} +2 -2
  249. package/dist/{tui-cV-R-JXi.js → tui-DPorsF4z.js} +203 -75
  250. package/dist/{tui-DBmFYQTk.js → tui-XH6_v0qC.js} +204 -74
  251. package/dist/{tui-cli-B_CKOjZ1.js → tui-cli-DRSIBDgZ.js} +30 -29
  252. package/dist/{tui-cli-CVdJ28TX.js → tui-cli-DV_JAtnq.js} +26 -25
  253. package/dist/{update-BDyA5Iqy.js → update-DNAVcIQ7.js} +3 -3
  254. package/dist/{update-BIB5jGcv.js → update-DzMcwy1G.js} +3 -3
  255. package/dist/{update-cli-p49uMWby.js → update-cli-OAcZiYuA.js} +112 -27
  256. package/dist/{update-cli-C5vwquH_.js → update-cli-tQcy8mkI.js} +109 -23
  257. package/dist/{update-runner-8XFxQglY.js → update-runner-2i8_mIG5.js} +254 -17
  258. package/dist/{update-runner-s8Rs8ex3.js → update-runner-BDdk_K2S.js} +254 -17
  259. package/dist/usage-format-DvowRSs-.js +36 -0
  260. package/dist/usage-format-E3bMcUMV.js +36 -0
  261. package/dist/{utils-Dg0Xbl6w.js → utils-CKSrBNwq.js} +2 -2
  262. package/dist/{webhooks-cli-DkQGQ2ae.js → webhooks-cli-BztQHEco.js} +11 -11
  263. package/dist/{webhooks-cli-kRN8qR7B.js → webhooks-cli-ZAn97osC.js} +15 -15
  264. package/dist/{widearea-dns-BIhjVRG1.js → widearea-dns-CsSylzXH.js} +2 -2
  265. package/dist/{widearea-dns-D4yoSNNw.js → widearea-dns-D9Al4QRv.js} +2 -2
  266. package/dist/{ws-log-DQ6nkLys.js → ws-log-B7UNLFLC.js} +3 -3
  267. package/dist/{ws-log-C4IerKk4.js → ws-log-DJIXahf0.js} +2 -2
  268. package/dist/{wsl-DASmek7h.js → wsl-ATjkMwMA.js} +1 -1
  269. package/docs/.i18n/glossary.zh-CN.json +20 -0
  270. package/docs/assets/macos-onboarding/01-macos-warning.jpeg +0 -0
  271. package/docs/assets/macos-onboarding/02-local-networks.jpeg +0 -0
  272. package/docs/assets/macos-onboarding/03-security-notice.png +0 -0
  273. package/docs/assets/macos-onboarding/04-choose-gateway.png +0 -0
  274. package/docs/assets/macos-onboarding/05-permissions.png +0 -0
  275. package/docs/bedrock.md +3 -3
  276. package/docs/channels/discord.md +2 -1
  277. package/docs/channels/feishu.md +72 -2
  278. package/docs/channels/telegram.md +19 -0
  279. package/docs/cli/devices.md +3 -0
  280. package/docs/cli/gateway.md +3 -0
  281. package/docs/cli/index.md +2 -0
  282. package/docs/cli/onboard.md +16 -2
  283. package/docs/concepts/features.md +53 -0
  284. package/docs/concepts/memory.md +1 -1
  285. package/docs/concepts/messages.md +1 -1
  286. package/docs/concepts/model-providers.md +11 -11
  287. package/docs/concepts/models.md +1 -1
  288. package/docs/concepts/multi-agent.md +2 -2
  289. package/docs/concepts/session.md +19 -3
  290. package/docs/docs.json +331 -182
  291. package/docs/gateway/cli-backends.md +7 -5
  292. package/docs/gateway/configuration-examples.md +4 -4
  293. package/docs/gateway/configuration.md +34 -16
  294. package/docs/gateway/heartbeat.md +61 -1
  295. package/docs/gateway/local-models.md +3 -3
  296. package/docs/gateway/network-model.md +17 -0
  297. package/docs/gateway/remote.md +3 -1
  298. package/docs/gateway/security/index.md +1 -1
  299. package/docs/help/faq.md +25 -26
  300. package/docs/help/submitting-a-pr.md +214 -0
  301. package/docs/help/submitting-an-issue.md +165 -0
  302. package/docs/index.md +127 -193
  303. package/docs/install/docker.md +2 -2
  304. package/docs/{platforms → install}/exe-dev.md +4 -3
  305. package/docs/{platforms → install}/fly.md +1 -1
  306. package/docs/install/index.md +4 -2
  307. package/docs/nodes/media-understanding.md +2 -2
  308. package/docs/platforms/digitalocean.md +2 -2
  309. package/docs/platforms/index.md +4 -4
  310. package/docs/platforms/linux.md +1 -1
  311. package/docs/platforms/mac/release.md +7 -7
  312. package/docs/platforms/oracle.md +1 -1
  313. package/docs/platforms/raspberry-pi.md +1 -1
  314. package/docs/providers/anthropic.md +3 -3
  315. package/docs/providers/index.md +1 -1
  316. package/docs/providers/minimax.md +3 -3
  317. package/docs/providers/models.md +1 -1
  318. package/docs/providers/ollama.md +60 -6
  319. package/docs/providers/openai.md +2 -2
  320. package/docs/providers/opencode.md +1 -1
  321. package/docs/providers/vercel-ai-gateway.md +1 -1
  322. package/docs/reference/credits.md +27 -0
  323. package/docs/reference/wizard.md +268 -0
  324. package/docs/start/bootstrapping.md +41 -0
  325. package/docs/start/docs-directory.md +64 -0
  326. package/docs/start/getting-started.md +109 -197
  327. package/docs/start/hubs.md +12 -0
  328. package/docs/start/onboarding.md +51 -81
  329. package/docs/start/openclaw.md +3 -20
  330. package/docs/start/quickstart.md +22 -0
  331. package/docs/start/setup.md +14 -1
  332. package/docs/start/wizard-cli-automation.md +141 -0
  333. package/docs/start/wizard-cli-reference.md +244 -0
  334. package/docs/start/wizard.md +48 -289
  335. package/docs/style.css +3 -0
  336. package/docs/testing.md +9 -9
  337. package/docs/token-use.md +2 -2
  338. package/docs/tools/index.md +3 -0
  339. package/docs/tools/llm-task.md +1 -1
  340. package/docs/tools/thinking.md +1 -0
  341. package/docs/tui.md +3 -0
  342. package/docs/vps.md +6 -6
  343. package/docs/web/control-ui.md +2 -0
  344. package/docs/web/dashboard.md +7 -7
  345. package/docs/zh-CN/channels/feishu.md +119 -3
  346. package/docs/zh-CN/concepts/features.md +59 -0
  347. package/docs/zh-CN/gateway/network-model.md +23 -0
  348. package/docs/zh-CN/gateway/remote.md +1 -1
  349. package/docs/zh-CN/help/faq.md +5 -5
  350. package/docs/zh-CN/index.md +124 -202
  351. package/docs/zh-CN/install/docker.md +1 -1
  352. package/docs/zh-CN/platforms/digitalocean.md +2 -2
  353. package/docs/zh-CN/platforms/index.md +4 -4
  354. package/docs/zh-CN/platforms/linux.md +1 -1
  355. package/docs/zh-CN/platforms/oracle.md +1 -1
  356. package/docs/zh-CN/platforms/raspberry-pi.md +1 -1
  357. package/docs/zh-CN/providers/ollama.md +1 -1
  358. package/docs/zh-CN/reference/credits.md +34 -0
  359. package/docs/zh-CN/start/docs-directory.md +70 -0
  360. package/docs/zh-CN/start/getting-started.md +1 -1
  361. package/docs/zh-CN/start/hubs.md +39 -30
  362. package/docs/zh-CN/start/quickstart.md +88 -0
  363. package/docs/zh-CN/vps.md +4 -4
  364. package/extensions/bluebubbles/package.json +1 -1
  365. package/extensions/bluebubbles/src/monitor.ts +9 -0
  366. package/extensions/copilot-proxy/index.ts +1 -0
  367. package/extensions/copilot-proxy/package.json +1 -1
  368. package/extensions/diagnostics-otel/package.json +1 -1
  369. package/extensions/discord/package.json +1 -1
  370. package/extensions/feishu/index.ts +49 -1
  371. package/extensions/feishu/openclaw.plugin.json +1 -0
  372. package/extensions/feishu/package.json +9 -5
  373. package/extensions/feishu/skills/feishu-doc/SKILL.md +105 -0
  374. package/extensions/feishu/skills/feishu-doc/references/block-types.md +103 -0
  375. package/extensions/feishu/skills/feishu-drive/SKILL.md +97 -0
  376. package/extensions/feishu/skills/feishu-perm/SKILL.md +119 -0
  377. package/extensions/feishu/skills/feishu-wiki/SKILL.md +111 -0
  378. package/extensions/feishu/src/accounts.ts +144 -0
  379. package/extensions/feishu/src/bitable.ts +459 -0
  380. package/extensions/feishu/src/bot.ts +871 -0
  381. package/extensions/feishu/src/channel.ts +267 -202
  382. package/extensions/feishu/src/client.ts +118 -0
  383. package/extensions/feishu/src/config-schema.ts +152 -26
  384. package/extensions/feishu/src/directory.ts +177 -0
  385. package/extensions/feishu/src/doc-schema.ts +47 -0
  386. package/extensions/feishu/src/docx.ts +521 -0
  387. package/extensions/feishu/src/drive-schema.ts +46 -0
  388. package/extensions/feishu/src/drive.ts +227 -0
  389. package/extensions/feishu/src/media.ts +527 -0
  390. package/extensions/feishu/src/mention.ts +126 -0
  391. package/extensions/feishu/src/monitor.ts +190 -0
  392. package/extensions/feishu/src/onboarding.ts +278 -200
  393. package/extensions/feishu/src/outbound.ts +40 -0
  394. package/extensions/feishu/src/perm-schema.ts +52 -0
  395. package/extensions/feishu/src/perm.ts +173 -0
  396. package/extensions/feishu/src/policy.ts +104 -0
  397. package/extensions/feishu/src/probe.ts +44 -0
  398. package/extensions/feishu/src/reactions.ts +160 -0
  399. package/extensions/feishu/src/reply-dispatcher.ts +184 -0
  400. package/extensions/feishu/src/runtime.ts +14 -0
  401. package/extensions/feishu/src/send.ts +358 -0
  402. package/extensions/feishu/src/targets.ts +78 -0
  403. package/extensions/feishu/src/tools-config.ts +21 -0
  404. package/extensions/feishu/src/types.ts +75 -0
  405. package/extensions/feishu/src/typing.ts +80 -0
  406. package/extensions/feishu/src/wiki-schema.ts +55 -0
  407. package/extensions/feishu/src/wiki.ts +232 -0
  408. package/extensions/google-antigravity-auth/package.json +1 -1
  409. package/extensions/google-gemini-cli-auth/package.json +1 -1
  410. package/extensions/googlechat/package.json +1 -1
  411. package/extensions/googlechat/src/monitor.ts +12 -1
  412. package/extensions/imessage/package.json +1 -1
  413. package/extensions/line/package.json +1 -1
  414. package/extensions/llm-task/package.json +1 -1
  415. package/extensions/lobster/package.json +1 -1
  416. package/extensions/matrix/CHANGELOG.md +6 -0
  417. package/extensions/matrix/package.json +1 -1
  418. package/extensions/matrix/src/config-schema.ts +1 -0
  419. package/extensions/matrix/src/matrix/monitor/handler.ts +9 -5
  420. package/extensions/matrix/src/types.ts +2 -0
  421. package/extensions/mattermost/package.json +1 -1
  422. package/extensions/mattermost/src/channel.test.ts +24 -0
  423. package/extensions/mattermost/src/config-schema.ts +1 -0
  424. package/extensions/mattermost/src/mattermost/monitor.ts +9 -5
  425. package/extensions/mattermost/src/types.ts +2 -0
  426. package/extensions/memory-core/package.json +1 -1
  427. package/extensions/memory-lancedb/node_modules/.bin/openai +2 -2
  428. package/extensions/memory-lancedb/node_modules/.bin/openai.CMD +2 -2
  429. package/extensions/memory-lancedb/node_modules/.bin/openai.ps1 +2 -2
  430. package/extensions/memory-lancedb/package.json +2 -2
  431. package/extensions/minimax-portal-auth/package.json +1 -1
  432. package/extensions/msteams/CHANGELOG.md +6 -0
  433. package/extensions/msteams/package.json +1 -1
  434. package/extensions/msteams/src/monitor-handler/message-handler.ts +1 -0
  435. package/extensions/msteams/src/reply-dispatcher.ts +7 -5
  436. package/extensions/nextcloud-talk/package.json +1 -1
  437. package/extensions/nextcloud-talk/src/config-schema.ts +1 -0
  438. package/extensions/nextcloud-talk/src/inbound.ts +10 -0
  439. package/extensions/nextcloud-talk/src/send.ts +7 -2
  440. package/extensions/nextcloud-talk/src/types.ts +2 -0
  441. package/extensions/nostr/CHANGELOG.md +6 -0
  442. package/extensions/nostr/package.json +1 -1
  443. package/extensions/open-prose/package.json +1 -1
  444. package/extensions/signal/package.json +1 -1
  445. package/extensions/slack/package.json +1 -1
  446. package/extensions/telegram/package.json +1 -1
  447. package/extensions/tlon/package.json +1 -1
  448. package/extensions/tlon/src/config-schema.ts +2 -0
  449. package/extensions/tlon/src/monitor/index.ts +41 -14
  450. package/extensions/tlon/src/monitor/utils.ts +1 -0
  451. package/extensions/twitch/CHANGELOG.md +6 -0
  452. package/extensions/twitch/package.json +1 -1
  453. package/extensions/twitch/src/config-schema.ts +2 -0
  454. package/extensions/twitch/src/monitor.ts +11 -0
  455. package/extensions/twitch/src/types.ts +2 -0
  456. package/extensions/voice-call/CHANGELOG.md +6 -0
  457. package/extensions/voice-call/package.json +1 -1
  458. package/extensions/voice-call/src/manager.test.ts +30 -0
  459. package/extensions/whatsapp/package.json +1 -1
  460. package/extensions/zalo/CHANGELOG.md +6 -0
  461. package/extensions/zalo/package.json +1 -1
  462. package/extensions/zalo/src/config-schema.ts +1 -0
  463. package/extensions/zalo/src/monitor.ts +11 -0
  464. package/extensions/zalo/src/types.ts +2 -0
  465. package/extensions/zalouser/CHANGELOG.md +6 -0
  466. package/extensions/zalouser/package.json +1 -1
  467. package/extensions/zalouser/src/config-schema.ts +1 -0
  468. package/extensions/zalouser/src/monitor.ts +12 -1
  469. package/extensions/zalouser/src/types.ts +2 -0
  470. package/package.json +14 -14
  471. package/dist/auth-profiles-3t9aTwDR.js +0 -11
  472. package/dist/auth-profiles-BYvLI-zr.js +0 -7
  473. package/dist/auth-profiles-DswR7tzt.js +0 -7
  474. package/dist/cli-BxIwNzhi.js +0 -89
  475. package/dist/cli-wFmvNjpg.js +0 -86
  476. package/dist/command-format-SkzzRqR1.js +0 -52
  477. package/dist/completion-cli-vxe-jqwC.js +0 -390
  478. package/dist/config-BwVg6hhl.js +0 -13
  479. package/dist/config-jKcyRiMo.js +0 -10
  480. package/dist/configure-DaecSBSI.js +0 -60
  481. package/dist/configure-t-7r9i4H.js +0 -64
  482. package/dist/control-service-Dag9b-dU.js +0 -16
  483. package/dist/control-service-DsUyuevF.js +0 -12
  484. package/dist/control-ui/assets/index-ryaCcbyp.js +0 -4584
  485. package/dist/control-ui/assets/index-ryaCcbyp.js.map +0 -1
  486. package/dist/daemon-cli-CUkUiGoK.js +0 -53
  487. package/dist/daemon-cli-D6FF4tmP.js +0 -49
  488. package/dist/deliver-BGnJ4-vz.js +0 -12
  489. package/dist/deliver-CXpx7BNb.js +0 -25
  490. package/dist/deliver-Ds2yqOA3.js +0 -21
  491. package/dist/doctor-BwqqPqMX.js +0 -58
  492. package/dist/doctor-DGrfzoKj.js +0 -62
  493. package/dist/github-copilot-token-B0CUgVkW.js +0 -4
  494. package/dist/github-copilot-token-B_uWT0Yi.js +0 -4
  495. package/dist/github-copilot-token-CXUZ9Lrb.js +0 -3
  496. package/dist/image-CgTMdnmz.js +0 -28
  497. package/dist/image-D1O-ebQc.js +0 -14
  498. package/dist/image-njq9Rf6U.js +0 -24
  499. package/dist/login-qr-BfbIJ1wP.js +0 -12
  500. package/dist/login-qr-CGWNrSQq.js +0 -9
  501. package/dist/login-qr-CUV9HZCg.js +0 -16
  502. package/dist/manager-DKpTd5pc.js +0 -10
  503. package/dist/manager-Dr_eVHpN.js +0 -10
  504. package/dist/manager-DtFcs1NT.js +0 -14
  505. package/dist/pi-model-discovery-BOramrmp.js +0 -3
  506. package/dist/pi-model-discovery-Bj98Srfa.js +0 -3
  507. package/dist/pi-model-discovery-DHPwfwKu.js +0 -3
  508. package/dist/plugin-sdk/agent-scope-qNPdmst1.js +0 -606
  509. package/dist/plugin-sdk/auth-profiles-D0LhX8iB.js +0 -7
  510. package/dist/plugin-sdk/chrome-DMuEXuKT.js +0 -1953
  511. package/dist/plugin-sdk/config-D5CsedNn.js +0 -5623
  512. package/dist/plugin-sdk/deliver-DOlMKwJ9.js +0 -12
  513. package/dist/plugin-sdk/deliver-Dl2ednkv.js +0 -2555
  514. package/dist/plugin-sdk/exec-CjyVHUuE.js +0 -1107
  515. package/dist/plugin-sdk/github-copilot-token-BoPqI-5_.js +0 -97
  516. package/dist/plugin-sdk/github-copilot-token-YEH9Bwov.js +0 -4
  517. package/dist/plugin-sdk/image-B_t0xXCb.js +0 -1419
  518. package/dist/plugin-sdk/image-DYTdodiR.js +0 -14
  519. package/dist/plugin-sdk/login-qr-B7ec28AI.js +0 -9
  520. package/dist/plugin-sdk/login-qr-BVBRxQRt.js +0 -470
  521. package/dist/plugin-sdk/manager-B-EITu1a.js +0 -10
  522. package/dist/plugin-sdk/manager-WCGzgWdf.js +0 -2868
  523. package/dist/plugin-sdk/model-selection-Bo7pocNu.js +0 -2667
  524. package/dist/plugin-sdk/paths-BFxmmTT5.js +0 -164
  525. package/dist/plugin-sdk/paths-Bkjq_KcG.js +0 -40
  526. package/dist/plugin-sdk/pi-embedded-helpers-fm5_Eokw.js +0 -8755
  527. package/dist/plugin-sdk/pi-model-discovery-CLgDNnGq.js +0 -13
  528. package/dist/plugin-sdk/pi-model-discovery-P2-pVRmz.js +0 -3
  529. package/dist/plugin-sdk/pw-ai-BN7Cwl9J.js +0 -1649
  530. package/dist/qmd-manager-CzArLjr6.js +0 -615
  531. package/dist/redact-BR0IM00e.js +0 -94
  532. package/dist/register.subclis-Bo-xmQ-W.js +0 -342
  533. package/dist/register.subclis-BuT7ZpPf.js +0 -3
  534. package/dist/restart-sentinel-CdcBcziq.js +0 -65
  535. package/dist/restart-sentinel-DywisDen.js +0 -65
  536. package/dist/runtime-guard-BG6JybtL.js +0 -60
  537. package/dist/runtime-guard-DvBpNsbR.js +0 -60
  538. package/dist/sqlite-Dz6S6ijV.js +0 -215
  539. package/dist/status.update-2ZdxeIeT.js +0 -79
  540. package/dist/status.update-ChwCPLBt.js +0 -79
  541. package/dist/systemd-linger-BZb1Uwsd.js +0 -7
  542. package/dist/systemd-linger-DemNCT5l.js +0 -9
  543. package/dist/transcript-events-fUhPZcB5.js +0 -17
  544. package/docs/_config.yml +0 -53
  545. package/docs/_layouts/default.html +0 -145
  546. package/docs/assets/docs-chat-widget.js +0 -667
  547. package/docs/assets/markdown.css +0 -179
  548. package/docs/assets/terminal.css +0 -473
  549. package/docs/assets/theme.js +0 -55
  550. package/extensions/feishu/README.md +0 -47
  551. /package/dist/{archive-BrH5WBhI.js → archive-D0z3LZDK.js} +0 -0
  552. /package/dist/{archive-mFgwsll-.js → archive-Dy3Ezb-5.js} +0 -0
  553. /package/dist/{boolean-CE7i9tBR.js → boolean-BgXe2hyu.js} +0 -0
  554. /package/dist/{brew-0HRgjHZw.js → brew-CAcErcKz.js} +0 -0
  555. /package/dist/{brew-Qdppmdlx.js → brew-CcZV0dSS.js} +0 -0
  556. /package/dist/{cli-utils-CukoNm8O.js → cli-utils-BkRQdAoC.js} +0 -0
  557. /package/dist/{cli-utils-DFbPmfWB.js → cli-utils-ByANh4Sp.js} +0 -0
  558. /package/dist/{plugin-sdk/command-format-CFzL448l.js → command-format-CFzL448l.js} +0 -0
  559. /package/dist/{command-format-BQK1OIvH.js → command-format-ChfKqObn.js} +0 -0
  560. /package/dist/{command-format-3xiXujG0.js → command-format-ayFsmwwz.js} +0 -0
  561. /package/dist/{constants-3er_81qc.js → constants-D1op9uGI.js} +0 -0
  562. /package/dist/{constants-CLUi6T-M.js → constants-HPrOsATF.js} +0 -0
  563. /package/dist/{exec-BIMFe4XS.js → exec-B8JKbXKW.js} +0 -0
  564. /package/dist/{format-BnjMmWWT.js → format-B7OjpGnt.js} +0 -0
  565. /package/dist/{format-hyFOmVZc.js → format-CS7EI0xF.js} +0 -0
  566. /package/dist/{help-format-af1XWYxC.js → help-format-CfZ94KRN.js} +0 -0
  567. /package/dist/{helpers-HZ-6iA1e.js → helpers-5yebzF4C.js} +0 -0
  568. /package/dist/{helpers-uGhPZ_kK.js → helpers-EKm3X92T.js} +0 -0
  569. /package/dist/{is-main-DD0MG3N8.js → is-main-B6kCyqsv.js} +0 -0
  570. /package/dist/{is-main-DrJg4t1R.js → is-main-qJ675wPV.js} +0 -0
  571. /package/dist/{logging-BdnOSVPD.js → logging-BWRYHvLp.js} +0 -0
  572. /package/dist/{logging-fywhKCmE.js → logging-CfEk_PnX.js} +0 -0
  573. /package/dist/{openclaw-root-Dean7Fp2.js → openclaw-root-9ILYSmJ9.js} +0 -0
  574. /package/dist/{openclaw-root-CJKDUIBP.js → openclaw-root-Cvotktkd.js} +0 -0
  575. /package/dist/{parse-BB0Cqon8.js → parse-BZz5lHzQ.js} +0 -0
  576. /package/dist/{parse-DLFPuO7w.js → parse-gTOGQPH6.js} +0 -0
  577. /package/dist/{parse-log-line-B3U8Kflp.js → parse-log-line-C6szvNBZ.js} +0 -0
  578. /package/dist/{parse-log-line-BmyeB3J2.js → parse-log-line-CARp5QyJ.js} +0 -0
  579. /package/dist/{parse-timeout-BIB19Upi.js → parse-timeout-CbVKLZ4B.js} +0 -0
  580. /package/dist/{parse-timeout-CmBmmqZZ.js → parse-timeout-Du-wHHNi.js} +0 -0
  581. /package/dist/{paths-VslOJiD2.js → paths-B1kfl4h5.js} +0 -0
  582. /package/dist/{paths-BDd7_JUB.js → paths-scjhy7N2.js} +0 -0
  583. /package/dist/{progress-Dn3kWpaL.js → progress-Da1ehW-x.js} +0 -0
  584. /package/dist/{prompt-style-D5D7b3cX.js → prompt-style-Dc0C5HC9.js} +0 -0
  585. /package/dist/{prompts-CIDznuZR.js → prompts-CXLLIBwP.js} +0 -0
  586. /package/dist/{prompts-CSlE5VZB.js → prompts-FbZThK8w.js} +0 -0
  587. /package/dist/{redact-BKh-zp-c.js → redact-B8YiFlwn.js} +0 -0
  588. /package/dist/{plugin-sdk/redact-wH73ib3-.js → redact-BIMJ3ntQ.js} +0 -0
  589. /package/dist/{redact-CDPAzwi8.js → redact-DJCFY628.js} +0 -0
  590. /package/dist/{plugin-sdk/sqlite-CqVsQPIl.js → sqlite-BKl1HJFe.js} +0 -0
  591. /package/dist/{sqlite-C59YNxdL.js → sqlite-Dnmf3LS7.js} +0 -0
  592. /package/dist/{sqlite-B_L84oiu.js → sqlite-DqUEZnjO.js} +0 -0
  593. /package/dist/{status-DkW6wMxZ.js → status-CRIEi8Mc.js} +0 -0
  594. /package/dist/{status-IDW1pkc0.js → status-tCu4RWZH.js} +0 -0
  595. /package/dist/{tailnet-BijMqkqa.js → tailnet-Byp3obcc.js} +0 -0
  596. /package/dist/{tailnet-Bk5cGmwE.js → tailnet-DLDGNuH2.js} +0 -0
  597. /package/dist/{plugin-sdk/transcript-events-DOI14YeV.js → transcript-events-CZ8CG4ht.js} +0 -0
  598. /package/dist/{transcript-events-Cj85Mq0h.js → transcript-events-ChU6IQwp.js} +0 -0
  599. /package/dist/{transcript-events-DW_H__a1.js → transcript-events-JLH5W4He.js} +0 -0
  600. /package/dist/{utils-PmTbZoD1.js → utils-DX85MiPR.js} +0 -0
  601. /package/dist/{ws-Cxo2p9fH.js → ws-CEcdsnN9.js} +0 -0
  602. /package/dist/{ws-DlSkA_BG.js → ws-D091yo4M.js} +0 -0
  603. /package/docs/{platforms → install}/gcp.md +0 -0
  604. /package/docs/{platforms → install}/hetzner.md +0 -0
  605. /package/docs/{platforms → install}/macos-vm.md +0 -0
  606. /package/docs/{northflank.mdx → install/northflank.mdx} +0 -0
  607. /package/docs/{railway.mdx → install/railway.mdx} +0 -0
  608. /package/docs/{render.mdx → install/render.mdx} +0 -0
  609. /package/docs/zh-CN/{platforms → install}/exe-dev.md +0 -0
  610. /package/docs/zh-CN/{platforms → install}/fly.md +0 -0
  611. /package/docs/zh-CN/{platforms → install}/gcp.md +0 -0
  612. /package/docs/zh-CN/{platforms → install}/hetzner.md +0 -0
  613. /package/docs/zh-CN/{platforms → install}/macos-vm.md +0 -0
  614. /package/docs/zh-CN/{northflank.mdx → install/northflank.mdx} +0 -0
  615. /package/docs/zh-CN/{railway.mdx → install/railway.mdx} +0 -0
  616. /package/docs/zh-CN/{render.mdx → install/render.mdx} +0 -0
@@ -1,55 +1,57 @@
1
- import { A as buildBootstrapContextFiles, B as normalizeThinkLevel, C as isLikelyContextOverflowError, D as parseImageDimensionError, E as isTimeoutErrorMessage, F as formatXHighModelHint, H as normalizeVerboseLevel, M as resolveBootstrapMaxChars, N as sanitizeGoogleTurnOrdering, O as parseImageSizeError, P as formatThinkingLevels, R as normalizeElevatedLevel, S as isFailoverErrorMessage, T as isRawApiErrorPayload, U as resolveResponseUsageMode, V as normalizeUsageDisplay, W as supportsXHighThinking, _ as isAuthAssistantError, a as isMessagingToolDuplicateNormalized, b as isContextOverflowError, c as sanitizeImageBlocks, d as isAntigravityClaude, f as isGoogleModelApi, g as getApiErrorPayloadFingerprint, h as formatRawAssistantErrorForUi, j as ensureSessionHeader, k as sanitizeUserFacingText, l as sanitizeToolResultImages, m as formatAssistantErrorText, n as validateGeminiTurns, o as normalizeTextForComparison, p as classifyFailoverReason, r as pickFallbackThinkingLevel, s as sanitizeSessionMessagesImages, t as validateAnthropicTurns, u as downgradeOpenAIReasoningBlocks, v as isCloudCodeAssistFormatError, w as isRateLimitAssistantError, x as isFailoverAssistantError, y as isCompactionFailureError, z as normalizeReasoningLevel } from "./pi-embedded-helpers-CC00lEFI.js";
2
- import { g as resolveStateDir, r as STATE_DIR, t as CONFIG_PATH } from "./paths-BDd7_JUB.js";
3
- import { A as buildAgentPeerSessionKey, B as isAcpSessionKey, C as loadWorkspaceBootstrapFiles, D as DEFAULT_AGENT_ID, E as DEFAULT_ACCOUNT_ID$1, F as resolveAgentIdFromSessionKey, H as parseAgentSessionKey, I as resolveThreadSessionKeys, L as sanitizeAgentId, M as normalizeAccountId$3, N as normalizeAgentId, O as DEFAULT_MAIN_KEY, P as normalizeMainKey, S as filterBootstrapFilesForSession, U as resolveThreadParentSessionKey, V as isSubagentSessionKey, c as resolveDefaultAgentId, f as DEFAULT_AGENT_WORKSPACE_DIR, i as resolveAgentModelFallbacksOverride, j as buildGroupHistoryKey, k as buildAgentMainSessionKey, l as resolveSessionAgentId, n as resolveAgentConfig, o as resolveAgentSkillsFilter, p as DEFAULT_BOOTSTRAP_FILENAME, r as resolveAgentDir, s as resolveAgentWorkspaceDir, t as listAgentIds, u as resolveSessionAgentIds, x as ensureAgentWorkspace } from "./agent-scope-CrgUOY3f.js";
4
- import { A as logVerbose, D as info, E as danger, F as warn, I as colorize, L as isRich, M as setVerbose, N as shouldLogVerbose, P as success, R as theme, T as setActivePluginRegistry, U as normalizeLogLevel, b as normalizeAnyChannelId, c as defaultRuntime, m as CHAT_CHANNEL_ORDER, t as createSubsystemLogger, w as requireActivePluginRegistry, x as normalizeChannelId, z as getChildLogger } from "./subsystem-46MXi6Ip.js";
5
- import { _ as shortenHomePath, b as toWhatsappJid, d as normalizeE164, g as shortenHomeInString, h as resolveUserPath, l as isSelfChatMode, m as resolveJidToE164, r as clampInt, t as CONFIG_DIR, u as jidToE164, v as sleep, x as truncateUtf16Safe, y as sliceUtf16Safe } from "./utils-Dg0Xbl6w.js";
6
- import { a as logDebug, c as logWarn, i as spawnWithFallback, n as runExec, o as logError, r as formatSpawnError, s as logInfo, t as runCommandWithTimeout } from "./exec-CTo4hK94.js";
7
- import { t as resolveOpenClawPackageRoot } from "./openclaw-root-CJKDUIBP.js";
8
- import { A as getCustomProviderApiKey, F as resolveModelAuthMode, G as resolveAuthProfileOrder, J as markAuthProfileFailure, L as getShellPathFromLoginShell, M as resolveApiKeyForProvider, P as resolveEnvApiKey, Y as markAuthProfileUsed, Z as resolveApiKeyForProfile, a as modelKey, at as listProfilesForProvider, bt as DEFAULT_MODEL, f as resolveModelRefFromString, g as normalizeGoogleModelId, gt as resolveAuthProfileDisplayLabel, ht as resolveOpenClawAgentDir, i as isCliProvider, j as requireApiKey, k as getApiKeyForModel, l as resolveConfiguredModelRef, lt as ensureAuthProfileStore, mt as resolveAuthStorePathForDisplay, n as buildModelAliasIndex, o as normalizeProviderId, ot as markAuthProfileGood, p as resolveThinkingDefault, q as isProfileInCooldown, s as parseModelRef, t as buildAllowedModelSet, u as resolveDefaultModelForAgent, xt as DEFAULT_PROVIDER, yt as DEFAULT_CONTEXT_TOKENS, z as resolveShellEnvFallbackTimeoutMs } from "./model-selection-Cp1maz7B.js";
9
- import { a as saveJsonFile, i as loadJsonFile } from "./github-copilot-token-VZsS4013.js";
10
- import { t as formatCliCommand } from "./command-format-BQK1OIvH.js";
11
- import { t as parseBooleanValue$1 } from "./boolean-CE7i9tBR.js";
12
- import { t as isTruthyEnvValue } from "./env-DOcCob95.js";
13
- import { A as resolveAgentMaxConcurrent, C as parseConfigPath, M as VERSION, S as getConfigValueAtPath, T as unsetConfigValueAtPath, a as readConfigFileSnapshot, b as setConfigOverride, d as TELEGRAM_COMMAND_NAME_PATTERN, f as normalizeTelegramCommandName, g as validateJsonSchemaValue, h as parseDurationMs, l as validateConfigObjectWithPlugins, m as isSafeExecutableValue, o as resolveConfigSnapshotHash, p as resolveTelegramCustomCommands, r as loadConfig, s as writeConfigFile, v as getConfigOverrides, w as setConfigValueAtPath, x as unsetConfigOverride, y as resetConfigOverrides } from "./config-qgIz1lbh.js";
14
- import { c as resolveEnableState, l as resolveMemorySlotDecision, n as discoverOpenClawPlugins, s as normalizePluginsConfig, t as loadPluginManifestRegistry } from "./manifest-registry-BFpLJJDB.js";
15
- import { _ as listEnabledDiscordAccounts, a as normalizeWhatsAppTarget, b as normalizeChatType, c as resolveTelegramAccount, d as listBindings, g as resolveSlackBotToken, h as resolveSlackAppToken, i as isWhatsAppGroupJid, l as resolveTelegramToken, n as listChannelPlugins, o as listEnabledTelegramAccounts, p as resolveSlackAccount, r as normalizeChannelId$1, s as listTelegramAccountIds, t as getChannelPlugin, v as resolveDiscordAccount, y as normalizeDiscordToken } from "./plugins-D1CxUobm.js";
16
- import { A as resolveSessionResetPolicy, C as normalizeDeliveryContext, D as resolveSessionKey$1, H as listChannelDocks, J as resolveIMessageAccount, K as listEnabledSignalAccounts, L as resolveMainSessionKey, M as resolveThreadFlag, N as DEFAULT_RESET_TRIGGERS, O as evaluateSessionFreshness, P as canonicalizeMainSessionAlias, S as mergeDeliveryContext, U as resolveChannelGroupPolicy, V as getChannelDock, W as resolveChannelGroupRequireMention, X as resolveGroupSessionKey, Y as buildGroupDisplayName, Z as resolveSandboxConfigForAgent, _ as updateSessionStoreEntry, a as ensureSandboxWorkspaceForSession, at as resolveToolProfilePolicy, b as deliveryContextFromSession, c as resolveSandboxRuntimeStatus, d as loadSessionStore, et as buildPluginToolGroups, f as readSessionUpdatedAt, g as updateSessionStore, h as updateLastRoute, it as normalizeToolName, j as resolveSessionResetType, k as resolveChannelResetConfig, l as appendAssistantMessageToSessionTranscript, nt as expandPolicyWithPluginGroups, o as resolveSandboxContext, ot as stripPluginOnlyAllowlist, p as recordSessionMetaFromInbound, q as resolveSignalAccount, tt as collectExplicitAllowlist, ut as resolveConversationLabel, v as isCacheEnabled, w as normalizeSessionDeliveryFields, x as deliveryContextKey, y as resolveCacheTtlMs$1, z as deriveSessionMetaPatch } from "./sandbox-BXUfp_qv.js";
17
- import { _ as minimaxUnderstandImage, a as resolveProviderVisionModelFromConfig, c as extractThinkingFromTaggedStream, d as inferToolMetaFromArgs, f as promoteThinkingTagsToBlocks, g as ensureOpenClawModelsJson, h as stripThinkingTagsFromText, i as decodeDataUrl, l as extractThinkingFromTaggedText, m as stripMinimaxToolCallXml, n as coerceImageAssistantText, o as extractAssistantText$1, p as stripDowngradedToolCallText, r as coerceImageModelConfig, s as extractAssistantThinking, t as describeImageWithModel, u as formatReasoningMessage } from "./image-ClOB6QDJ.js";
18
- import { i as discoverModels, r as discoverAuthStorage } from "./pi-model-discovery-DjGamP_B.js";
19
- import { E as formatUncaughtError, T as formatErrorMessage, k as DEFAULT_AI_SNAPSHOT_MAX_CHARS, w as extractErrorCode } from "./chrome-D2LUApAY.js";
20
- import { a as resolveSkillsPromptForRun, i as loadWorkspaceSkillEntries, l as applySkillEnvOverrides, n as buildWorkspaceSkillCommandSpecs, r as buildWorkspaceSkillSnapshot, s as resolvePluginSkillDirs, u as applySkillEnvOverridesFromSnapshot } from "./skills-C4b1FA1e.js";
21
- import { c as saveMediaBuffer, d as getFileExtension, f as imageMimeFromFormat, g as MAX_IMAGE_BYTES, h as kindFromMime, l as detectMime, m as isGifMedia, o as resizeToJpeg, p as isAudioFileName, r as getImageMetadata, s as getMediaDir, u as extensionForMime, v as mediaKindFromMime, y as SsrFBlockedError } from "./routes-Ds-tIZFJ.js";
22
- import { i as resolveBrowserConfig } from "./server-context-D2cv-pIA.js";
23
- import { a as isInternalMessageChannel, c as listDeliverableMessageChannels, d as resolveMessageChannel, f as GATEWAY_CLIENT_IDS, l as normalizeMessageChannel, m as GATEWAY_CLIENT_NAMES, n as isDeliverableMessageChannel, o as isMarkdownCapableMessageChannel, p as GATEWAY_CLIENT_MODES, t as INTERNAL_MESSAGE_CHANNEL, u as resolveGatewayMessageChannel } from "./message-channel-CQGWXVL4.js";
24
- import { a as logoutWeb, d as webAuthExists, i as logWebSelfId, n as resolveWhatsAppAccount, r as getWebAuthAgeMs, s as readWebSelfId } from "./accounts-BlHoTziG.js";
25
- import { a as resolveSessionTranscriptsDirForAgent, n as resolveSessionFilePath, o as resolveStorePath, r as resolveSessionTranscriptPath } from "./paths-50eo6DV6.js";
26
- import { t as emitSessionTranscriptUpdate } from "./transcript-events-fUhPZcB5.js";
27
- import { n as redactSensitiveText } from "./redact-BKh-zp-c.js";
28
- import { n as resolveToolDisplay } from "./tool-display-rIUh61kT.js";
29
- import { A as loadWebMedia, B as findFenceSpanAt, C as signalRpcRequest, D as chunkMarkdownIR, E as wrapFetchWithAbortSignal, F as chunkMarkdownTextWithMode, G as isSilentReplyText, H as parseFenceSpans, I as chunkText, J as fetchWithSsrFGuard, K as MediaFetchError, L as chunkTextWithMode, M as resolveMarkdownTableMode, N as chunkByNewline, O as markdownToIR, P as chunkMarkdownText, R as resolveChunkMode, S as signalCheck, T as resolveFetch, U as HEARTBEAT_TOKEN, V as isSafeFenceBreak, W as SILENT_REPLY_TOKEN, _ as splitMediaFromOutput, a as normalizeReplyPayloadsForDelivery, b as sendReadReceiptSignal, c as filterMessagingToolDuplicates, d as createReplyToModeFilterForChannel, f as resolveReplyToMode, g as parseReplyDirectives, h as normalizeTargetForProvider, j as loadWebMediaRaw, k as markdownToIRWithMeta, l as isRenderablePayload, m as normalizeChannelTargetInput, o as applyReplyTagsToPayload, p as buildTargetResolverSignature, q as fetchRemoteMedia, s as applyReplyThreading, t as deliverOutboundPayloads, u as shouldSuppressMessagingToolReplies, v as parseInlineDirectives$1, w as streamSignalEvents, x as sendTypingSignal, y as sendMessageSignal, z as resolveTextChunkLimit } from "./deliver-Bsvrattg.js";
30
- import { i as getMachineDisplayName, n as isWSL, t as createBrowserRouteDispatcher } from "./dispatcher-BNB5aCZ6.js";
31
- import { i as resolveMemorySearchConfig, n as resolveRetryConfig, r as retryAsync } from "./manager-BArueSTR.js";
32
- import { c as listMemoryFiles, l as normalizeExtraMemoryPaths } from "./sqlite-Dz6S6ijV.js";
33
- import { C as parseCommandArgs, D as shouldHandleTextCommands, E as serializeCommandArgs, S as normalizeCommandBody, T as resolveCommandArgMenu, _ as findCommandByNativeName, b as listNativeCommandSpecs, f as estimateUsageCost, g as buildCommandTextFromArgs, h as resolveModelCostConfig, m as formatUsd$1, o as extractTextFromMessage, p as formatTokenCount$2, t as buildChannelSummary, v as listChatCommands, w as resolveCommandArgChoices, x as listNativeCommandSpecsForConfig, y as listChatCommandsForConfig } from "./channel-summary-C8GoEKgH.js";
34
- import { Tt as SESSION_LABEL_MAX_LENGTH, t as GatewayClient } from "./client-zqMhLTAX.js";
35
- import { t as pickPrimaryTailnetIPv4 } from "./tailnet-Bk5cGmwE.js";
36
- import { n as callGateway, r as randomIdempotencyKey } from "./call-CPBhMXxo.js";
37
- import { a as getStatusCode$1, i as formatError$1, n as waitForWebLogin, o as waitForWaConnection, r as createWaSocket, t as startWebLoginWithQr } from "./login-qr-C2H_iQJU.js";
38
- import { a as removeChannelAllowFromStoreEntry, c as listPairingChannels, i as readChannelAllowFromStore, o as upsertChannelPairingRequest, t as addChannelAllowFromStoreEntry } from "./pairing-store-BnMngoWQ.js";
39
- import { t as formatDocsLink } from "./links-C9fyAH-V.js";
40
- import { i as withManager, t as formatErrorMessage$1 } from "./cli-utils-CukoNm8O.js";
41
- import { n as withProgress, r as withProgressTotals } from "./progress-uNDQDtGB.js";
42
- import { a as resolveSubagentToolPolicy, c as resolveNativeSkillsEnabled, i as resolveGroupToolPolicy, n as isToolAllowedByPolicies, o as isNativeCommandsExplicitlyDisabled, r as resolveEffectiveToolPolicy, s as resolveNativeCommandsEnabled, t as filterToolsByPolicy } from "./pi-tools.policy-DleRi9eC.js";
43
- import { r as stylePromptTitle } from "./prompt-style-gfROyHgB.js";
44
- import { t as resolvePairingIdLabel } from "./pairing-labels-DK2aLSd2.js";
45
- import { a as evaluateShellAllowlist, d as requiresExecApproval, f as resolveExecApprovals, h as resolveSafeBins, o as maxAsk, p as resolveExecApprovalsFromFile, s as minSecurity, t as addAllowlistEntry, u as recordAllowlistUse } from "./exec-approvals-CK-Umdr3.js";
46
- import { a as canvasSnapshotTempPath, c as parseCameraClipPayload, d as buildNodeShellCommand, i as parseEnvPairs, l as parseCameraSnapPayload, n as screenRecordTempPath, o as parseCanvasSnapshotPayload, r as writeScreenRecordToFile, s as cameraTempPath, t as parseScreenRecordPayload, u as writeBase64ToFile } from "./nodes-screen-Ln98EX_f.js";
47
- import { r as startBrowserControlServiceFromConfig, t as createBrowserControlContext } from "./control-service-BW5sW2U1.js";
48
- import { t as parseAbsoluteTimeMs } from "./parse-DLFPuO7w.js";
49
- import { n as formatDoctorNonInteractiveHint, s as writeRestartSentinel } from "./restart-sentinel-CdcBcziq.js";
50
- import { d as resolveGatewaySystemdServiceName, l as resolveGatewayLaunchAgentLabel } from "./constants-3er_81qc.js";
51
- import { n as resolveMessageChannelSelection, t as listConfiguredMessageChannels } from "./channel-selection-BCn8_qun.js";
52
- import { t as parseTimeoutMs } from "./parse-timeout-CmBmmqZZ.js";
1
+ import { A as parseImageSizeError, B as normalizeElevatedLevel, C as isFailoverAssistantError, D as isRawApiErrorPayload, E as isRateLimitAssistantError, F as sanitizeGoogleTurnOrdering, G as resolveResponseUsageMode, H as normalizeThinkLevel, I as formatThinkingLevels, K as supportsXHighThinking, L as formatXHighModelHint, M as buildBootstrapContextFiles, N as ensureSessionHeader, O as isTimeoutErrorMessage, P as resolveBootstrapMaxChars, S as isContextOverflowError, T as isLikelyContextOverflowError, U as normalizeUsageDisplay, V as normalizeReasoningLevel, W as normalizeVerboseLevel, _ as getApiErrorPayloadFingerprint, a as isMessagingToolDuplicateNormalized, b as isCloudCodeAssistFormatError, c as sanitizeImageBlocks, d as isAntigravityClaude, f as isGoogleModelApi, g as formatRawAssistantErrorForUi, h as formatAssistantErrorText, j as sanitizeUserFacingText, k as parseImageDimensionError, l as sanitizeToolResultImages, m as classifyFailoverReason, n as validateGeminiTurns, o as normalizeTextForComparison, p as BILLING_ERROR_USER_MESSAGE, r as pickFallbackThinkingLevel, s as sanitizeSessionMessagesImages, t as validateAnthropicTurns, u as downgradeOpenAIReasoningBlocks, v as isAuthAssistantError, w as isFailoverErrorMessage, x as isCompactionFailureError, y as isBillingAssistantError } from "./pi-embedded-helpers-BB4uACeq.js";
2
+ import { g as resolveStateDir, r as STATE_DIR, t as CONFIG_PATH } from "./paths-scjhy7N2.js";
3
+ import { _ as parseAgentSessionKey, a as buildAgentPeerSessionKey, c as normalizeAgentId, d as resolveThreadSessionKeys, f as sanitizeAgentId, g as isSubagentSessionKey, h as isAcpSessionKey, i as buildAgentMainSessionKey, l as normalizeMainKey, n as DEFAULT_AGENT_ID, o as buildGroupHistoryKey, r as DEFAULT_MAIN_KEY, s as normalizeAccountId$3, t as DEFAULT_ACCOUNT_ID$1, u as resolveAgentIdFromSessionKey, v as resolveThreadParentSessionKey } from "./session-key-Dm2EOhrH.js";
4
+ import { A as logVerbose, D as info, E as danger, F as warn, I as colorize, L as isRich, M as setVerbose, N as shouldLogVerbose, P as success, R as theme, T as setActivePluginRegistry, U as normalizeLogLevel, b as normalizeAnyChannelId, c as defaultRuntime, m as CHAT_CHANNEL_ORDER, t as createSubsystemLogger, w as requireActivePluginRegistry, x as normalizeChannelId, z as getChildLogger } from "./subsystem-CAq3uyo7.js";
5
+ import { _ as shortenHomePath, b as toWhatsappJid, d as normalizeE164, g as shortenHomeInString, h as resolveUserPath, l as isSelfChatMode, m as resolveJidToE164, r as clampInt, t as CONFIG_DIR, u as jidToE164, v as sleep, x as truncateUtf16Safe, y as sliceUtf16Safe } from "./utils-CKSrBNwq.js";
6
+ import { a as logDebug, c as logWarn, i as spawnWithFallback, n as runExec, o as logError, r as formatSpawnError, s as logInfo, t as runCommandWithTimeout } from "./exec-HEWTMJ7j.js";
7
+ import { t as resolveOpenClawPackageRoot } from "./openclaw-root-Cvotktkd.js";
8
+ import { C as loadWorkspaceBootstrapFiles, S as filterBootstrapFilesForSession, c as resolveDefaultAgentId, f as DEFAULT_AGENT_WORKSPACE_DIR, i as resolveAgentModelFallbacksOverride, l as resolveSessionAgentId, n as resolveAgentConfig, o as resolveAgentSkillsFilter, p as DEFAULT_BOOTSTRAP_FILENAME, r as resolveAgentDir, s as resolveAgentWorkspaceDir, t as listAgentIds, u as resolveSessionAgentIds, x as ensureAgentWorkspace } from "./agent-scope-CMs5Y7l-.js";
9
+ import { $ as resolveApiKeyForProfile, I as resolveEnvApiKey, J as resolveAuthProfileOrder, L as resolveModelAuthMode, M as getCustomProviderApiKey, N as requireApiKey, P as resolveApiKeyForProvider, V as resolveShellEnvFallbackTimeoutMs, X as markAuthProfileFailure, Y as isProfileInCooldown, Z as markAuthProfileUsed, a as isCliProvider, at as listProfilesForProvider, bt as DEFAULT_PROVIDER, d as resolveConfiguredModelRef, f as resolveDefaultModelForAgent, h as resolveThinkingDefault, ht as resolveAuthProfileDisplayLabel, j as getApiKeyForModel, lt as ensureAuthProfileStore, m as resolveModelRefFromString, mt as resolveOpenClawAgentDir, n as buildConfiguredAllowlistKeys, o as modelKey, ot as markAuthProfileGood, pt as resolveAuthStorePathForDisplay, r as buildModelAliasIndex, s as normalizeProviderId, t as buildAllowedModelSet, v as normalizeGoogleModelId, vt as DEFAULT_CONTEXT_TOKENS, yt as DEFAULT_MODEL, z as getShellPathFromLoginShell } from "./model-selection-DMUrNhQP.js";
10
+ import { a as saveJsonFile, i as loadJsonFile } from "./github-copilot-token-pGSmVaW-.js";
11
+ import { t as formatCliCommand } from "./command-format-ChfKqObn.js";
12
+ import { t as parseBooleanValue$1 } from "./boolean-BgXe2hyu.js";
13
+ import { t as isTruthyEnvValue } from "./env-0_mKbEWW.js";
14
+ import { C as setConfigValueAtPath, S as parseConfigPath, _ as getConfigOverrides, b as unsetConfigOverride, c as writeConfigFile, d as TELEGRAM_COMMAND_NAME_PATTERN, f as normalizeTelegramCommandName, g as validateJsonSchemaValue, h as parseDurationMs, i as loadConfig, j as VERSION, k as resolveAgentMaxConcurrent, l as validateConfigObjectWithPlugins, m as isSafeExecutableValue, o as readConfigFileSnapshot, p as resolveTelegramCustomCommands, s as resolveConfigSnapshotHash, v as resetConfigOverrides, w as unsetConfigValueAtPath, x as getConfigValueAtPath, y as setConfigOverride } from "./config-CAuZ-EkU.js";
15
+ import { c as resolveEnableState, l as resolveMemorySlotDecision, n as discoverOpenClawPlugins, s as normalizePluginsConfig, t as loadPluginManifestRegistry } from "./manifest-registry-DHaa1SJb.js";
16
+ import { _ as listEnabledDiscordAccounts, a as normalizeWhatsAppTarget, b as normalizeChatType, c as resolveTelegramAccount, d as listBindings, g as resolveSlackBotToken, h as resolveSlackAppToken, i as isWhatsAppGroupJid, l as resolveTelegramToken, n as listChannelPlugins, o as listEnabledTelegramAccounts, p as resolveSlackAccount, r as normalizeChannelId$1, s as listTelegramAccountIds, t as getChannelPlugin, v as resolveDiscordAccount, y as normalizeDiscordToken } from "./plugins-BYIWo0Cp.js";
17
+ import { A as resolveSessionResetPolicy, C as normalizeDeliveryContext, D as resolveSessionKey$1, H as listChannelDocks, J as resolveIMessageAccount, K as listEnabledSignalAccounts, L as resolveMainSessionKey, M as resolveThreadFlag, N as DEFAULT_RESET_TRIGGERS, O as evaluateSessionFreshness, P as canonicalizeMainSessionAlias, S as mergeDeliveryContext, U as resolveChannelGroupPolicy, V as getChannelDock, W as resolveChannelGroupRequireMention, X as resolveGroupSessionKey, Y as buildGroupDisplayName, Z as resolveSandboxConfigForAgent, _ as updateSessionStoreEntry, a as ensureSandboxWorkspaceForSession, at as normalizeToolName, b as deliveryContextFromSession, c as resolveSandboxRuntimeStatus, d as loadSessionStore, dt as resolveConversationLabel, et as applyOwnerOnlyToolPolicy, f as readSessionUpdatedAt, g as updateSessionStore, h as updateLastRoute, j as resolveSessionResetType, k as resolveChannelResetConfig, l as appendAssistantMessageToSessionTranscript, nt as collectExplicitAllowlist, o as resolveSandboxContext, ot as resolveToolProfilePolicy, p as recordSessionMetaFromInbound, q as resolveSignalAccount, rt as expandPolicyWithPluginGroups, st as stripPluginOnlyAllowlist, tt as buildPluginToolGroups, v as isCacheEnabled, w as normalizeSessionDeliveryFields, x as deliveryContextKey, y as resolveCacheTtlMs$1, z as deriveSessionMetaPatch } from "./sandbox-CV8VwPij.js";
18
+ import { _ as ensureOpenClawModelsJson, a as decodeDataUrl, c as extractAssistantThinking, d as formatReasoningMessage, f as inferToolMetaFromArgs, g as stripThinkingTagsFromText, h as stripMinimaxToolCallXml, i as coerceImageModelConfig, l as extractThinkingFromTaggedStream, m as stripDowngradedToolCallText, o as resolveProviderVisionModelFromConfig, p as promoteThinkingTagsToBlocks, r as coerceImageAssistantText, s as extractAssistantText$1, t as describeImageWithModel, u as extractThinkingFromTaggedText, v as minimaxUnderstandImage } from "./image-Ca_PtqY7.js";
19
+ import { n as discoverModels, t as discoverAuthStorage } from "./pi-model-discovery-CV2V1HHz.js";
20
+ import { E as formatUncaughtError, T as formatErrorMessage, k as DEFAULT_AI_SNAPSHOT_MAX_CHARS, w as extractErrorCode } from "./chrome-BNSd7Bie.js";
21
+ import { a as resolveSkillsPromptForRun, i as loadWorkspaceSkillEntries, l as applySkillEnvOverrides, n as buildWorkspaceSkillCommandSpecs, r as buildWorkspaceSkillSnapshot, s as resolvePluginSkillDirs, u as applySkillEnvOverridesFromSnapshot } from "./skills-D5JDj3TR.js";
22
+ import { c as saveMediaBuffer, d as getFileExtension, f as imageMimeFromFormat, g as MAX_IMAGE_BYTES, h as kindFromMime, l as detectMime, m as isGifMedia, o as resizeToJpeg, p as isAudioFileName, r as getImageMetadata, s as getMediaDir, u as extensionForMime, v as mediaKindFromMime, y as SsrFBlockedError } from "./routes-DchZU3EK.js";
23
+ import { i as resolveBrowserConfig } from "./server-context-vChIAqjH.js";
24
+ import { a as isInternalMessageChannel, c as listDeliverableMessageChannels, d as resolveMessageChannel, h as GATEWAY_CLIENT_NAMES, l as normalizeMessageChannel, m as GATEWAY_CLIENT_MODES, n as isDeliverableMessageChannel, o as isMarkdownCapableMessageChannel, p as GATEWAY_CLIENT_IDS, t as INTERNAL_MESSAGE_CHANNEL, u as resolveGatewayMessageChannel } from "./message-channel-Bpfe5l5f.js";
25
+ import { a as logoutWeb, d as webAuthExists, i as logWebSelfId, n as resolveWhatsAppAccount, r as getWebAuthAgeMs, s as readWebSelfId } from "./accounts-BgZmhIm6.js";
26
+ import { a as resolveSessionTranscriptsDirForAgent, n as resolveSessionFilePath, o as resolveStorePath, r as resolveSessionTranscriptPath } from "./paths-Bb0nwPeu.js";
27
+ import { t as emitSessionTranscriptUpdate } from "./transcript-events-ChU6IQwp.js";
28
+ import { n as redactSensitiveText } from "./redact-DJCFY628.js";
29
+ import { n as resolveToolDisplay } from "./tool-display-BxZG0o1b.js";
30
+ import { A as markdownToIRWithMeta, B as resolveTextChunkLimit, C as signalCheck, D as wrapFetchWithAbortSignal, E as resolveFetch, F as chunkMarkdownText, G as SILENT_REPLY_TOKEN, H as isSafeFenceBreak, I as chunkMarkdownTextWithMode, J as fetchRemoteMedia, K as isSilentReplyText, L as chunkText, M as loadWebMediaRaw, N as resolveMarkdownTableMode, O as chunkMarkdownIR, P as chunkByNewline, R as chunkTextWithMode, S as sendTypingSignal, T as streamSignalEvents, U as parseFenceSpans, V as findFenceSpanAt, W as HEARTBEAT_TOKEN, Y as fetchWithSsrFGuard, _ as parseReplyDirectives, b as sendMessageSignal, c as applyReplyThreading, d as shouldSuppressMessagingToolReplies, f as createReplyToModeFilterForChannel, g as normalizeTargetForProvider, h as normalizeChannelTargetInput, j as loadWebMedia, k as markdownToIR, l as filterMessagingToolDuplicates, m as buildTargetResolverSignature, o as normalizeReplyPayloadsForDelivery, p as resolveReplyToMode, q as MediaFetchError, s as applyReplyTagsToPayload, t as deliverOutboundPayloads, u as isRenderablePayload, v as splitMediaFromOutput, w as signalRpcRequest, x as sendReadReceiptSignal, y as parseInlineDirectives$1, z as resolveChunkMode } from "./deliver-C3bnXkg5.js";
31
+ import { i as getMachineDisplayName, n as isWSL, t as createBrowserRouteDispatcher } from "./dispatcher-6oI-H42S.js";
32
+ import { i as resolveMemorySearchConfig, n as resolveRetryConfig, r as retryAsync } from "./manager-LpytrxUw.js";
33
+ import { c as listMemoryFiles, l as normalizeExtraMemoryPaths } from "./sqlite-BKl1HJFe.js";
34
+ import { C as shouldHandleTextCommands, S as serializeCommandArgs, _ as listNativeCommandSpecsForConfig, b as resolveCommandArgChoices, f as buildCommandTextFromArgs, g as listNativeCommandSpecs, h as listChatCommandsForConfig, m as listChatCommands, o as extractTextFromMessage, p as findCommandByNativeName, t as buildChannelSummary, v as normalizeCommandBody, x as resolveCommandArgMenu, y as parseCommandArgs } from "./channel-summary-DUiKDBLv.js";
35
+ import { Et as SESSION_LABEL_MAX_LENGTH, t as GatewayClient } from "./client-BYVbRnuQ.js";
36
+ import { t as pickPrimaryTailnetIPv4 } from "./tailnet-DLDGNuH2.js";
37
+ import { i as randomIdempotencyKey, n as callGateway } from "./call-BTbA5OB4.js";
38
+ import { a as formatError$1, i as createWaSocket, n as startWebLoginWithQr, o as getStatusCode$1, r as waitForWebLogin, s as waitForWaConnection } from "./login-qr-BIlr0vwe.js";
39
+ import { a as removeChannelAllowFromStoreEntry, c as listPairingChannels, i as readChannelAllowFromStore, o as upsertChannelPairingRequest, t as addChannelAllowFromStoreEntry } from "./pairing-store-DFq7WtOv.js";
40
+ import { t as formatDocsLink } from "./links-B5pRdmo1.js";
41
+ import { i as withManager, t as formatErrorMessage$1 } from "./cli-utils-BkRQdAoC.js";
42
+ import { n as withProgress, r as withProgressTotals } from "./progress-xpLtQsNY.js";
43
+ import { a as resolveSubagentToolPolicy, c as resolveNativeSkillsEnabled, i as resolveGroupToolPolicy, n as isToolAllowedByPolicies, o as isNativeCommandsExplicitlyDisabled, r as resolveEffectiveToolPolicy, s as resolveNativeCommandsEnabled, t as filterToolsByPolicy } from "./pi-tools.policy-BQ8N5y8a.js";
44
+ import { r as stylePromptTitle } from "./prompt-style-vzh0MGHs.js";
45
+ import { t as resolvePairingIdLabel } from "./pairing-labels-CtqLxbG6.js";
46
+ import { c as derivePromptTokens, l as hasNonzeroUsage, n as loadCostUsageSummary, o as extractToolCallNames, r as loadSessionCostSummary, s as hasToolCall, u as normalizeUsage } from "./session-cost-usage-CBP4Hv9D.js";
47
+ import { i as resolveModelCostConfig, n as formatTokenCount$2, r as formatUsd$1, t as estimateUsageCost } from "./usage-format-DvowRSs-.js";
48
+ import { a as evaluateShellAllowlist, d as requiresExecApproval, f as resolveExecApprovals, h as resolveSafeBins, o as maxAsk, p as resolveExecApprovalsFromFile, s as minSecurity, t as addAllowlistEntry, u as recordAllowlistUse } from "./exec-approvals-DZixgolZ.js";
49
+ import { a as canvasSnapshotTempPath, c as parseCameraClipPayload, d as buildNodeShellCommand, i as parseEnvPairs, l as parseCameraSnapPayload, n as screenRecordTempPath, o as parseCanvasSnapshotPayload, r as writeScreenRecordToFile, s as cameraTempPath, t as parseScreenRecordPayload, u as writeBase64ToFile } from "./nodes-screen-DT5HvhJV.js";
50
+ import { n as createBrowserControlContext, r as startBrowserControlServiceFromConfig } from "./control-service-CS61Road.js";
51
+ import { t as parseAbsoluteTimeMs } from "./parse-BZz5lHzQ.js";
52
+ import { d as resolveGatewaySystemdServiceName, l as resolveGatewayLaunchAgentLabel } from "./constants-HPrOsATF.js";
53
+ import { n as resolveMessageChannelSelection, t as listConfiguredMessageChannels } from "./channel-selection-CJWYmCLf.js";
54
+ import { t as parseTimeoutMs } from "./parse-timeout-Du-wHHNi.js";
53
55
  import { createRequire } from "node:module";
54
56
  import process$1 from "node:process";
55
57
  import { fileURLToPath } from "node:url";
@@ -79,7 +81,7 @@ import { setTimeout as setTimeout$1 } from "node:timers/promises";
79
81
  import { DisconnectReason, downloadMediaMessage, extractMessageContent, getContentType, isJidGroup, normalizeMessageContent } from "@whiskeysockets/baileys";
80
82
  import { cancel, isCancel } from "@clack/prompts";
81
83
  import { GatewayIntents, GatewayPlugin } from "@buape/carbon/gateway";
82
- import readline, { createInterface } from "node:readline";
84
+ import { createInterface } from "node:readline";
83
85
  import { messagingApi } from "@line/bot-sdk";
84
86
  import SlackBolt from "@slack/bolt";
85
87
  import { run, sequentialize } from "@grammyjs/runner";
@@ -1905,7 +1907,7 @@ function formatAudioTranscripts(outputs) {
1905
1907
  //#region src/agents/model-catalog.ts
1906
1908
  let modelCatalogPromise = null;
1907
1909
  let hasLoggedModelCatalogError = false;
1908
- const defaultImportPiSdk = () => import("./pi-model-discovery-DHPwfwKu.js");
1910
+ const defaultImportPiSdk = () => import("./pi-model-discovery-CV2V1HHz.js").then((n) => n.r);
1909
1911
  let importPiSdk = defaultImportPiSdk;
1910
1912
  async function loadModelCatalog(params) {
1911
1913
  if (params?.useCache === false) modelCatalogPromise = null;
@@ -1999,7 +2001,7 @@ const AUTO_IMAGE_KEY_PROVIDERS = [
1999
2001
  const AUTO_VIDEO_KEY_PROVIDERS = ["google"];
2000
2002
  const DEFAULT_IMAGE_MODELS = {
2001
2003
  openai: "gpt-5-mini",
2002
- anthropic: "claude-opus-4-5",
2004
+ anthropic: "claude-opus-4-6",
2003
2005
  google: "gemini-3-flash-preview",
2004
2006
  minimax: "MiniMax-VL-01"
2005
2007
  };
@@ -3307,6 +3309,32 @@ function normalizeAllowFromEntry(params) {
3307
3309
  allowFrom: [params.value]
3308
3310
  }).filter((entry) => entry.trim().length > 0);
3309
3311
  }
3312
+ function resolveOwnerAllowFromList(params) {
3313
+ const raw = params.allowFrom ?? params.cfg.commands?.ownerAllowFrom;
3314
+ if (!Array.isArray(raw) || raw.length === 0) return [];
3315
+ const filtered = [];
3316
+ for (const entry of raw) {
3317
+ const trimmed = String(entry ?? "").trim();
3318
+ if (!trimmed) continue;
3319
+ const separatorIndex = trimmed.indexOf(":");
3320
+ if (separatorIndex > 0) {
3321
+ const channel = normalizeAnyChannelId(trimmed.slice(0, separatorIndex));
3322
+ if (channel) {
3323
+ if (params.providerId && channel !== params.providerId) continue;
3324
+ const remainder = trimmed.slice(separatorIndex + 1).trim();
3325
+ if (remainder) filtered.push(remainder);
3326
+ continue;
3327
+ }
3328
+ }
3329
+ filtered.push(trimmed);
3330
+ }
3331
+ return formatAllowFromList({
3332
+ dock: params.dock,
3333
+ cfg: params.cfg,
3334
+ accountId: params.accountId,
3335
+ allowFrom: filtered
3336
+ });
3337
+ }
3310
3338
  function resolveSenderCandidates(params) {
3311
3339
  const { dock, cfg, accountId } = params;
3312
3340
  const candidates = [];
@@ -3351,18 +3379,35 @@ function resolveCommandAuthorization(params) {
3351
3379
  accountId: ctx.AccountId,
3352
3380
  allowFrom: Array.isArray(allowFromRaw) ? allowFromRaw : []
3353
3381
  });
3382
+ const configOwnerAllowFromList = resolveOwnerAllowFromList({
3383
+ dock,
3384
+ cfg,
3385
+ accountId: ctx.AccountId,
3386
+ providerId,
3387
+ allowFrom: cfg.commands?.ownerAllowFrom
3388
+ });
3389
+ const contextOwnerAllowFromList = resolveOwnerAllowFromList({
3390
+ dock,
3391
+ cfg,
3392
+ accountId: ctx.AccountId,
3393
+ providerId,
3394
+ allowFrom: ctx.OwnerAllowFrom
3395
+ });
3354
3396
  const allowAll = allowFromList.length === 0 || allowFromList.some((entry) => entry.trim() === "*");
3355
- const ownerCandidates = allowAll ? [] : allowFromList.filter((entry) => entry !== "*");
3356
- if (!allowAll && ownerCandidates.length === 0 && to) {
3397
+ const ownerCandidatesForCommands = allowAll ? [] : allowFromList.filter((entry) => entry !== "*");
3398
+ if (!allowAll && ownerCandidatesForCommands.length === 0 && to) {
3357
3399
  const normalizedTo = normalizeAllowFromEntry({
3358
3400
  dock,
3359
3401
  cfg,
3360
3402
  accountId: ctx.AccountId,
3361
3403
  value: to
3362
3404
  });
3363
- if (normalizedTo.length > 0) ownerCandidates.push(...normalizedTo);
3405
+ if (normalizedTo.length > 0) ownerCandidatesForCommands.push(...normalizedTo);
3364
3406
  }
3365
- const ownerList = Array.from(new Set(ownerCandidates));
3407
+ const ownerAllowAll = configOwnerAllowFromList.some((entry) => entry.trim() === "*");
3408
+ const explicitOwners = configOwnerAllowFromList.filter((entry) => entry !== "*");
3409
+ const explicitOverrides = contextOwnerAllowFromList.filter((entry) => entry !== "*");
3410
+ const ownerList = Array.from(new Set(explicitOwners.length > 0 ? explicitOwners : ownerAllowAll ? [] : explicitOverrides.length > 0 ? explicitOverrides : ownerCandidatesForCommands));
3366
3411
  const senderCandidates = resolveSenderCandidates({
3367
3412
  dock,
3368
3413
  providerId,
@@ -3373,13 +3418,18 @@ function resolveCommandAuthorization(params) {
3373
3418
  from
3374
3419
  });
3375
3420
  const matchedSender = ownerList.length ? senderCandidates.find((candidate) => ownerList.includes(candidate)) : void 0;
3421
+ const matchedCommandOwner = ownerCandidatesForCommands.length ? senderCandidates.find((candidate) => ownerCandidatesForCommands.includes(candidate)) : void 0;
3376
3422
  const senderId = matchedSender ?? senderCandidates[0];
3377
- const isOwner = !Boolean(dock?.commands?.enforceOwnerForCommands) || allowAll || ownerList.length === 0 || Boolean(matchedSender);
3423
+ const enforceOwner = Boolean(dock?.commands?.enforceOwnerForCommands);
3424
+ const senderIsOwner = Boolean(matchedSender);
3425
+ const ownerAllowlistConfigured = ownerAllowAll || explicitOwners.length > 0;
3426
+ const isOwnerForCommands = !(enforceOwner || ownerAllowlistConfigured) ? true : ownerAllowAll ? true : ownerAllowlistConfigured ? senderIsOwner : allowAll || ownerCandidatesForCommands.length === 0 || Boolean(matchedCommandOwner);
3378
3427
  return {
3379
3428
  providerId,
3380
3429
  ownerList,
3381
3430
  senderId: senderId || void 0,
3382
- isAuthorizedSender: commandAuthorized && isOwner,
3431
+ senderIsOwner,
3432
+ isAuthorizedSender: commandAuthorized && isOwnerForCommands,
3383
3433
  from: from || void 0,
3384
3434
  to: to || void 0
3385
3435
  };
@@ -4129,7 +4179,7 @@ async function resolveSessionAuthProfileOverride(params) {
4129
4179
  const MODEL_CACHE = /* @__PURE__ */ new Map();
4130
4180
  (async () => {
4131
4181
  try {
4132
- const { discoverAuthStorage, discoverModels } = await import("./pi-model-discovery-DHPwfwKu.js");
4182
+ const { discoverAuthStorage, discoverModels } = await import("./pi-model-discovery-CV2V1HHz.js").then((n) => n.r);
4133
4183
  await ensureOpenClawModelsJson(loadConfig());
4134
4184
  const agentDir = resolveOpenClawAgentDir();
4135
4185
  const models = discoverModels(discoverAuthStorage(agentDir), agentDir).getAll();
@@ -4343,7 +4393,7 @@ async function createModelSelectionState(params) {
4343
4393
  }
4344
4394
  }
4345
4395
  if (sessionEntry && sessionStore && sessionKey && sessionEntry.authProfileOverride) {
4346
- const { ensureAuthProfileStore } = await import("./auth-profiles-3t9aTwDR.js");
4396
+ const { ensureAuthProfileStore } = await import("./model-selection-DMUrNhQP.js").then((n) => n.q);
4347
4397
  const profile = ensureAuthProfileStore(void 0, { allowKeychainPrompt: false }).profiles[sessionEntry.authProfileOverride];
4348
4398
  const providerKey = normalizeProviderId(provider);
4349
4399
  if (!profile || normalizeProviderId(profile.provider) !== providerKey) await clearSessionAuthProfileOverride({
@@ -5561,6 +5611,40 @@ function normalizeModelCompat(model) {
5561
5611
 
5562
5612
  //#endregion
5563
5613
  //#region src/agents/pi-embedded-runner/model.ts
5614
+ const OPENAI_CODEX_GPT_53_MODEL_ID = "gpt-5.3-codex";
5615
+ const OPENAI_CODEX_TEMPLATE_MODEL_IDS = ["gpt-5.2-codex"];
5616
+ function resolveOpenAICodexGpt53FallbackModel(provider, modelId, modelRegistry) {
5617
+ const normalizedProvider = normalizeProviderId(provider);
5618
+ const trimmedModelId = modelId.trim();
5619
+ if (normalizedProvider !== "openai-codex") return;
5620
+ if (trimmedModelId.toLowerCase() !== OPENAI_CODEX_GPT_53_MODEL_ID) return;
5621
+ for (const templateId of OPENAI_CODEX_TEMPLATE_MODEL_IDS) {
5622
+ const template = modelRegistry.find(normalizedProvider, templateId);
5623
+ if (!template) continue;
5624
+ return normalizeModelCompat({
5625
+ ...template,
5626
+ id: trimmedModelId,
5627
+ name: trimmedModelId
5628
+ });
5629
+ }
5630
+ return normalizeModelCompat({
5631
+ id: trimmedModelId,
5632
+ name: trimmedModelId,
5633
+ api: "openai-codex-responses",
5634
+ provider: normalizedProvider,
5635
+ baseUrl: "https://chatgpt.com/backend-api",
5636
+ reasoning: true,
5637
+ input: ["text", "image"],
5638
+ cost: {
5639
+ input: 0,
5640
+ output: 0,
5641
+ cacheRead: 0,
5642
+ cacheWrite: 0
5643
+ },
5644
+ contextWindow: DEFAULT_CONTEXT_TOKENS,
5645
+ maxTokens: DEFAULT_CONTEXT_TOKENS
5646
+ });
5647
+ }
5564
5648
  function buildInlineProviderModels(providers) {
5565
5649
  return Object.entries(providers).flatMap(([providerId, entry]) => {
5566
5650
  const trimmed = providerId.trim();
@@ -5603,6 +5687,12 @@ function resolveModel(provider, modelId, agentDir, cfg) {
5603
5687
  authStorage,
5604
5688
  modelRegistry
5605
5689
  };
5690
+ const codexForwardCompat = resolveOpenAICodexGpt53FallbackModel(provider, modelId, modelRegistry);
5691
+ if (codexForwardCompat) return {
5692
+ model: codexForwardCompat,
5693
+ authStorage,
5694
+ modelRegistry
5695
+ };
5606
5696
  const providerCfg = providers[provider];
5607
5697
  if (providerCfg || modelId.startsWith("mock-")) return {
5608
5698
  model: normalizeModelCompat({
@@ -7803,7 +7893,26 @@ function resolveMessagePrefix(cfg, agentId, opts) {
7803
7893
  if (opts?.hasAllowFrom === true) return "";
7804
7894
  return resolveIdentityNamePrefix(cfg, agentId) ?? opts?.fallback ?? "[openclaw]";
7805
7895
  }
7806
- function resolveResponsePrefix(cfg, agentId) {
7896
+ /** Helper to extract a channel config value by dynamic key. */
7897
+ function getChannelConfig(cfg, channel) {
7898
+ const value = cfg.channels?.[channel];
7899
+ return typeof value === "object" && value !== null ? value : void 0;
7900
+ }
7901
+ function resolveResponsePrefix(cfg, agentId, opts) {
7902
+ if (opts?.channel && opts?.accountId) {
7903
+ const accountPrefix = (getChannelConfig(cfg, opts.channel)?.accounts)?.[opts.accountId]?.responsePrefix;
7904
+ if (accountPrefix !== void 0) {
7905
+ if (accountPrefix === "auto") return resolveIdentityNamePrefix(cfg, agentId);
7906
+ return accountPrefix;
7907
+ }
7908
+ }
7909
+ if (opts?.channel) {
7910
+ const channelPrefix = getChannelConfig(cfg, opts.channel)?.responsePrefix;
7911
+ if (channelPrefix !== void 0) {
7912
+ if (channelPrefix === "auto") return resolveIdentityNamePrefix(cfg, agentId);
7913
+ return channelPrefix;
7914
+ }
7915
+ }
7807
7916
  const configured = cfg.messages?.responsePrefix;
7808
7917
  if (configured !== void 0) {
7809
7918
  if (configured === "auto") return resolveIdentityNamePrefix(cfg, agentId);
@@ -7816,7 +7925,10 @@ function resolveEffectiveMessagesConfig(cfg, agentId, opts) {
7816
7925
  hasAllowFrom: opts?.hasAllowFrom,
7817
7926
  fallback: opts?.fallbackMessagePrefix
7818
7927
  }),
7819
- responsePrefix: resolveResponsePrefix(cfg, agentId)
7928
+ responsePrefix: resolveResponsePrefix(cfg, agentId, {
7929
+ channel: opts?.channel,
7930
+ accountId: opts?.accountId
7931
+ })
7820
7932
  };
7821
7933
  }
7822
7934
  function resolveHumanDelayConfig(cfg, agentId) {
@@ -8057,7 +8169,7 @@ async function getMemorySearchManager(params) {
8057
8169
  const cached = QMD_MANAGER_CACHE.get(cacheKey);
8058
8170
  if (cached) return { manager: cached };
8059
8171
  try {
8060
- const { QmdMemoryManager } = await import("./qmd-manager-8xWxIGbO.js");
8172
+ const { QmdMemoryManager } = await import("./qmd-manager-BKkFEEN_.js");
8061
8173
  const primary = await QmdMemoryManager.create({
8062
8174
  cfg: params.cfg,
8063
8175
  agentId: params.agentId,
@@ -8067,7 +8179,7 @@ async function getMemorySearchManager(params) {
8067
8179
  const wrapper = new FallbackMemoryManager({
8068
8180
  primary,
8069
8181
  fallbackFactory: async () => {
8070
- const { MemoryIndexManager } = await import("./manager-DtFcs1NT.js");
8182
+ const { MemoryIndexManager } = await import("./manager-LpytrxUw.js").then((n) => n.t);
8071
8183
  return await MemoryIndexManager.get(params);
8072
8184
  }
8073
8185
  }, () => QMD_MANAGER_CACHE.delete(cacheKey));
@@ -8080,7 +8192,7 @@ async function getMemorySearchManager(params) {
8080
8192
  }
8081
8193
  }
8082
8194
  try {
8083
- const { MemoryIndexManager } = await import("./manager-DtFcs1NT.js");
8195
+ const { MemoryIndexManager } = await import("./manager-LpytrxUw.js").then((n) => n.t);
8084
8196
  return { manager: await MemoryIndexManager.get(params) };
8085
8197
  } catch (err) {
8086
8198
  return {
@@ -12208,12 +12320,12 @@ function resolveResponsePrefixTemplate(template, context) {
12208
12320
  *
12209
12321
  * Strips:
12210
12322
  * - Provider prefix (e.g., "openai/" from "openai/gpt-5.2")
12211
- * - Date suffixes (e.g., "-20251101" from "claude-opus-4-5-20251101")
12323
+ * - Date suffixes (e.g., "-20260205" from "claude-opus-4-6-20260205")
12212
12324
  * - Common version suffixes (e.g., "-latest")
12213
12325
  *
12214
12326
  * @example
12215
12327
  * extractShortModelName("openai-codex/gpt-5.2") // "gpt-5.2"
12216
- * extractShortModelName("claude-opus-4-5-20251101") // "claude-opus-4-5"
12328
+ * extractShortModelName("claude-opus-4-6-20260205") // "claude-opus-4-6"
12217
12329
  * extractShortModelName("gpt-5.2-latest") // "gpt-5.2"
12218
12330
  */
12219
12331
  function extractShortModelName(fullModel) {
@@ -12283,10 +12395,14 @@ function normalizeReplyPayload(payload, opts = {}) {
12283
12395
  */
12284
12396
  async function routeReply(params) {
12285
12397
  const { payload, channel, to, accountId, threadId, cfg, abortSignal } = params;
12398
+ const normalizedChannel = normalizeMessageChannel(channel);
12286
12399
  const normalized = normalizeReplyPayload(payload, { responsePrefix: params.sessionKey ? resolveEffectiveMessagesConfig(cfg, resolveSessionAgentId({
12287
12400
  sessionKey: params.sessionKey,
12288
12401
  config: cfg
12289
- })).responsePrefix : cfg.messages?.responsePrefix === "auto" ? void 0 : cfg.messages?.responsePrefix });
12402
+ }), {
12403
+ channel: normalizedChannel,
12404
+ accountId
12405
+ }).responsePrefix : cfg.messages?.responsePrefix === "auto" ? void 0 : cfg.messages?.responsePrefix });
12290
12406
  if (!normalized) return { ok: true };
12291
12407
  let text = normalized.text ?? "";
12292
12408
  let mediaUrls = (normalized.mediaUrls?.filter(Boolean) ?? []).length ? normalized.mediaUrls?.filter(Boolean) : normalized.mediaUrl ? [normalized.mediaUrl] : [];
@@ -12308,7 +12424,7 @@ async function routeReply(params) {
12308
12424
  const resolvedReplyToId = replyToId ?? (channelId === "slack" && threadId != null && threadId !== "" ? String(threadId) : void 0);
12309
12425
  const resolvedThreadId = channelId === "slack" ? null : threadId ?? null;
12310
12426
  try {
12311
- const { deliverOutboundPayloads } = await import("./deliver-CXpx7BNb.js");
12427
+ const { deliverOutboundPayloads } = await import("./deliver-C3bnXkg5.js").then((n) => n.n);
12312
12428
  return {
12313
12429
  ok: true,
12314
12430
  messageId: (await deliverOutboundPayloads({
@@ -12523,9 +12639,10 @@ async function dispatchReplyFromConfig(params) {
12523
12639
  }
12524
12640
  let accumulatedBlockText = "";
12525
12641
  let blockCount = 0;
12642
+ const shouldSendToolSummaries = ctx.ChatType !== "group" && ctx.CommandSource !== "native";
12526
12643
  const replyResult = await (params.replyResolver ?? getReplyFromConfig)(ctx, {
12527
12644
  ...params.replyOptions,
12528
- onToolResult: ctx.ChatType !== "group" && ctx.CommandSource !== "native" ? (payload) => {
12645
+ onToolResult: shouldSendToolSummaries ? (payload) => {
12529
12646
  const run = async () => {
12530
12647
  const ttsPayload = await maybeApplyTtsToPayload({
12531
12648
  payload,
@@ -13366,6 +13483,26 @@ function resolveDiscordUserAllowed(params) {
13366
13483
  tag: params.userTag
13367
13484
  });
13368
13485
  }
13486
+ function resolveDiscordOwnerAllowFrom(params) {
13487
+ const rawAllowList = params.channelConfig?.users ?? params.guildInfo?.users;
13488
+ if (!Array.isArray(rawAllowList) || rawAllowList.length === 0) return;
13489
+ const allowList = normalizeDiscordAllowList(rawAllowList, [
13490
+ "discord:",
13491
+ "user:",
13492
+ "pk:"
13493
+ ]);
13494
+ if (!allowList) return;
13495
+ const match = resolveDiscordAllowListMatch({
13496
+ allowList,
13497
+ candidate: {
13498
+ id: params.sender.id,
13499
+ name: params.sender.name,
13500
+ tag: params.sender.tag
13501
+ }
13502
+ });
13503
+ if (!match.allowed || !match.matchKey || match.matchKey === "*") return;
13504
+ return [match.matchKey];
13505
+ }
13369
13506
  function resolveDiscordGuildEntry(params) {
13370
13507
  const guild = params.guild;
13371
13508
  const entries = params.guildEntries;
@@ -13410,6 +13547,7 @@ function resolveDiscordChannelConfigEntry(entry) {
13410
13547
  enabled: entry.enabled,
13411
13548
  users: entry.users,
13412
13549
  systemPrompt: entry.systemPrompt,
13550
+ includeThreadStarter: entry.includeThreadStarter,
13413
13551
  autoThread: entry.autoThread
13414
13552
  };
13415
13553
  }
@@ -16035,6 +16173,20 @@ function buildTelegramGroupPeerId(chatId, messageThreadId) {
16035
16173
  function buildTelegramGroupFrom(chatId, messageThreadId) {
16036
16174
  return `telegram:group:${buildTelegramGroupPeerId(chatId, messageThreadId)}`;
16037
16175
  }
16176
+ /**
16177
+ * Build parentPeer for forum topic binding inheritance.
16178
+ * When a message comes from a forum topic, the peer ID includes the topic suffix
16179
+ * (e.g., `-1001234567890:topic:99`). To allow bindings configured for the base
16180
+ * group ID to match, we provide the parent group as `parentPeer` so the routing
16181
+ * layer can fall back to it when the exact peer doesn't match.
16182
+ */
16183
+ function buildTelegramParentPeer(params) {
16184
+ if (!params.isGroup || params.resolvedThreadId == null) return;
16185
+ return {
16186
+ kind: "group",
16187
+ id: String(params.chatId)
16188
+ };
16189
+ }
16038
16190
  function buildSenderName(msg) {
16039
16191
  return [msg.from?.first_name, msg.from?.last_name].filter(Boolean).join(" ").trim() || msg.from?.username || void 0;
16040
16192
  }
@@ -17070,7 +17222,7 @@ async function describeStickerImage(params) {
17070
17222
  const selectCatalogModel = (provider) => {
17071
17223
  const entries = catalog.filter((entry) => entry.provider.toLowerCase() === provider.toLowerCase() && modelSupportsVision(entry));
17072
17224
  if (entries.length === 0) return;
17073
- const defaultId = provider === "openai" ? "gpt-5-mini" : provider === "anthropic" ? "claude-opus-4-5" : provider === "google" ? "gemini-3-flash-preview" : "MiniMax-VL-01";
17225
+ const defaultId = provider === "openai" ? "gpt-5-mini" : provider === "anthropic" ? "claude-opus-4-6" : provider === "google" ? "gemini-3-flash-preview" : "MiniMax-VL-01";
17074
17226
  return entries.find((entry) => entry.id === defaultId) ?? entries[0];
17075
17227
  };
17076
17228
  let resolved = null;
@@ -17099,7 +17251,7 @@ async function describeStickerImage(params) {
17099
17251
  logVerbose(`telegram: describing sticker with ${provider}/${model}`);
17100
17252
  try {
17101
17253
  const buffer = await fs$1.readFile(imagePath);
17102
- const { describeImageWithModel } = await import("./image-CgTMdnmz.js");
17254
+ const { describeImageWithModel } = await import("./image-Ca_PtqY7.js").then((n) => n.n);
17103
17255
  return (await describeImageWithModel({
17104
17256
  buffer,
17105
17257
  fileName: "sticker.webp",
@@ -17456,7 +17608,7 @@ function createWhatsAppLoginTool() {
17456
17608
  force: Type.Optional(Type.Boolean())
17457
17609
  }),
17458
17610
  execute: async (_toolCallId, args) => {
17459
- const { startWebLoginWithQr, waitForWebLogin } = await import("./login-qr-CUV9HZCg.js");
17611
+ const { startWebLoginWithQr, waitForWebLogin } = await import("./login-qr-BIlr0vwe.js").then((n) => n.t);
17460
17612
  if ((args?.action ?? "start") === "wait") {
17461
17613
  const result = await waitForWebLogin({ timeoutMs: typeof args.timeoutMs === "number" ? args.timeoutMs : void 0 });
17462
17614
  return {
@@ -19229,11 +19381,22 @@ function createReplyPrefixContext(params) {
19229
19381
  };
19230
19382
  return {
19231
19383
  prefixContext,
19232
- responsePrefix: resolveEffectiveMessagesConfig(cfg, agentId).responsePrefix,
19384
+ responsePrefix: resolveEffectiveMessagesConfig(cfg, agentId, {
19385
+ channel: params.channel,
19386
+ accountId: params.accountId
19387
+ }).responsePrefix,
19233
19388
  responsePrefixContextProvider: () => prefixContext,
19234
19389
  onModelSelected
19235
19390
  };
19236
19391
  }
19392
+ function createReplyPrefixOptions(params) {
19393
+ const { responsePrefix, responsePrefixContextProvider, onModelSelected } = createReplyPrefixContext(params);
19394
+ return {
19395
+ responsePrefix,
19396
+ responsePrefixContextProvider,
19397
+ onModelSelected
19398
+ };
19399
+ }
19237
19400
 
19238
19401
  //#endregion
19239
19402
  //#region src/web/auto-reply/deliver-reply.ts
@@ -19542,12 +19705,14 @@ async function processMessage(params) {
19542
19705
  msg: params.msg
19543
19706
  }) : void 0;
19544
19707
  const configuredResponsePrefix = params.cfg.messages?.responsePrefix;
19545
- const prefixContext = createReplyPrefixContext({
19708
+ const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
19546
19709
  cfg: params.cfg,
19547
- agentId: params.route.agentId
19710
+ agentId: params.route.agentId,
19711
+ channel: "whatsapp",
19712
+ accountId: params.route.accountId
19548
19713
  });
19549
19714
  const isSelfChat = params.msg.chatType !== "group" && Boolean(params.msg.selfE164) && normalizeE164(params.msg.from) === normalizeE164(params.msg.selfE164 ?? "");
19550
- const responsePrefix = prefixContext.responsePrefix ?? (configuredResponsePrefix === void 0 && isSelfChat ? resolveIdentityNamePrefix(params.cfg, params.route.agentId) ?? "[openclaw]" : void 0);
19715
+ const responsePrefix = prefixOptions.responsePrefix ?? (configuredResponsePrefix === void 0 && isSelfChat ? resolveIdentityNamePrefix(params.cfg, params.route.agentId) ?? "[openclaw]" : void 0);
19551
19716
  const ctxPayload = finalizeInboundContext({
19552
19717
  Body: combinedBody,
19553
19718
  RawBody: params.msg.body,
@@ -19610,8 +19775,8 @@ async function processMessage(params) {
19610
19775
  cfg: params.cfg,
19611
19776
  replyResolver: params.replyResolver,
19612
19777
  dispatcherOptions: {
19778
+ ...prefixOptions,
19613
19779
  responsePrefix,
19614
- responsePrefixContextProvider: prefixContext.responsePrefixContextProvider,
19615
19780
  onHeartbeatStrip: () => {
19616
19781
  if (!didLogHeartbeatStrip) {
19617
19782
  didLogHeartbeatStrip = true;
@@ -19659,7 +19824,7 @@ async function processMessage(params) {
19659
19824
  },
19660
19825
  replyOptions: {
19661
19826
  disableBlockStreaming: typeof params.cfg.channels?.whatsapp?.blockStreaming === "boolean" ? !params.cfg.channels.whatsapp.blockStreaming : void 0,
19662
- onModelSelected: prefixContext.onModelSelected
19827
+ onModelSelected
19663
19828
  }
19664
19829
  });
19665
19830
  if (!queuedFinal) {
@@ -22048,6 +22213,15 @@ async function processDiscordMessage(ctx) {
22048
22213
  const senderTag = sender.tag;
22049
22214
  const systemPromptParts = [channelConfig?.systemPrompt?.trim() || null].filter((entry) => Boolean(entry));
22050
22215
  const groupSystemPrompt = systemPromptParts.length > 0 ? systemPromptParts.join("\n\n") : void 0;
22216
+ const ownerAllowFrom = resolveDiscordOwnerAllowFrom({
22217
+ channelConfig,
22218
+ guildInfo,
22219
+ sender: {
22220
+ id: sender.id,
22221
+ name: sender.name,
22222
+ tag: sender.tag
22223
+ }
22224
+ });
22051
22225
  const storePath = resolveStorePath(cfg.session?.store, { agentId: route.agentId });
22052
22226
  const envelopeOptions = resolveEnvelopeFormatOptions(cfg);
22053
22227
  const previousTimestamp = readSessionUpdatedAt({
@@ -22086,20 +22260,22 @@ async function processDiscordMessage(ctx) {
22086
22260
  let threadLabel;
22087
22261
  let parentSessionKey;
22088
22262
  if (threadChannel) {
22089
- const starter = await resolveDiscordThreadStarter({
22090
- channel: threadChannel,
22091
- client,
22092
- parentId: threadParentId,
22093
- parentType: threadParentType,
22094
- resolveTimestampMs
22095
- });
22096
- if (starter?.text) threadStarterBody = formatThreadStarterEnvelope({
22097
- channel: "Discord",
22098
- author: starter.author,
22099
- timestamp: starter.timestamp,
22100
- body: starter.text,
22101
- envelope: envelopeOptions
22102
- });
22263
+ if (channelConfig?.includeThreadStarter !== false) {
22264
+ const starter = await resolveDiscordThreadStarter({
22265
+ channel: threadChannel,
22266
+ client,
22267
+ parentId: threadParentId,
22268
+ parentType: threadParentType,
22269
+ resolveTimestampMs
22270
+ });
22271
+ if (starter?.text) threadStarterBody = formatThreadStarterEnvelope({
22272
+ channel: "Discord",
22273
+ author: starter.author,
22274
+ timestamp: starter.timestamp,
22275
+ body: starter.text,
22276
+ envelope: envelopeOptions
22277
+ });
22278
+ }
22103
22279
  const parentName = threadParentName ?? "parent";
22104
22280
  threadLabel = threadName ? `Discord thread #${normalizeDiscordSlug(parentName)} › ${threadName}` : `Discord thread #${normalizeDiscordSlug(parentName)}`;
22105
22281
  if (threadParentId) parentSessionKey = buildAgentSessionKey({
@@ -22159,6 +22335,7 @@ async function processDiscordMessage(ctx) {
22159
22335
  UntrustedContext: untrustedChannelMetadata ? [untrustedChannelMetadata] : void 0,
22160
22336
  GroupSystemPrompt: isGuildMessage ? groupSystemPrompt : void 0,
22161
22337
  GroupSpace: isGuildMessage ? (guildInfo?.id ?? guildSlug) || void 0 : void 0,
22338
+ OwnerAllowFrom: ownerAllowFrom,
22162
22339
  Provider: "discord",
22163
22340
  Surface: "discord",
22164
22341
  WasMentioned: effectiveWasMentioned,
@@ -22192,9 +22369,11 @@ async function processDiscordMessage(ctx) {
22192
22369
  logVerbose(`discord inbound: channel=${message.channelId} deliver=${deliverTarget} from=${ctxPayload.From} preview="${preview}"`);
22193
22370
  }
22194
22371
  const typingChannelId = deliverTarget.startsWith("channel:") ? deliverTarget.slice(8) : message.channelId;
22195
- const prefixContext = createReplyPrefixContext({
22372
+ const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
22196
22373
  cfg,
22197
- agentId: route.agentId
22374
+ agentId: route.agentId,
22375
+ channel: "discord",
22376
+ accountId: route.accountId
22198
22377
  });
22199
22378
  const tableMode = resolveMarkdownTableMode({
22200
22379
  cfg,
@@ -22202,8 +22381,7 @@ async function processDiscordMessage(ctx) {
22202
22381
  accountId
22203
22382
  });
22204
22383
  const { dispatcher, replyOptions, markDispatchIdle } = createReplyDispatcherWithTyping({
22205
- responsePrefix: prefixContext.responsePrefix,
22206
- responsePrefixContextProvider: prefixContext.responsePrefixContextProvider,
22384
+ ...prefixOptions,
22207
22385
  humanDelay: resolveHumanDelayConfig(cfg, route.agentId),
22208
22386
  deliver: async (payload) => {
22209
22387
  const replyToId = replyReference.use();
@@ -22248,9 +22426,7 @@ async function processDiscordMessage(ctx) {
22248
22426
  ...replyOptions,
22249
22427
  skillFilter: channelConfig?.skills,
22250
22428
  disableBlockStreaming: typeof discordConfig?.blockStreaming === "boolean" ? !discordConfig.blockStreaming : void 0,
22251
- onModelSelected: (ctx) => {
22252
- prefixContext.onModelSelected(ctx);
22253
- }
22429
+ onModelSelected
22254
22430
  }
22255
22431
  });
22256
22432
  markDispatchIdle();
@@ -22875,6 +23051,15 @@ async function dispatchDiscordCommandInteraction(params) {
22875
23051
  } : void 0
22876
23052
  });
22877
23053
  const conversationLabel = isDirectMessage ? user.globalName ?? user.username : channelId;
23054
+ const ownerAllowFrom = resolveDiscordOwnerAllowFrom({
23055
+ channelConfig,
23056
+ guildInfo,
23057
+ sender: {
23058
+ id: sender.id,
23059
+ name: sender.name,
23060
+ tag: sender.tag
23061
+ }
23062
+ });
22878
23063
  const ctxPayload = finalizeInboundContext({
22879
23064
  Body: prompt,
22880
23065
  RawBody: prompt,
@@ -22900,6 +23085,7 @@ async function dispatchDiscordCommandInteraction(params) {
22900
23085
  });
22901
23086
  return untrustedChannelMetadata ? [untrustedChannelMetadata] : void 0;
22902
23087
  })() : void 0,
23088
+ OwnerAllowFrom: ownerAllowFrom,
22903
23089
  SenderName: user.globalName ?? user.username,
22904
23090
  SenderId: user.id,
22905
23091
  SenderUsername: user.username,
@@ -22912,12 +23098,18 @@ async function dispatchDiscordCommandInteraction(params) {
22912
23098
  CommandAuthorized: commandAuthorized,
22913
23099
  CommandSource: "native"
22914
23100
  });
23101
+ const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
23102
+ cfg,
23103
+ agentId: route.agentId,
23104
+ channel: "discord",
23105
+ accountId: route.accountId
23106
+ });
22915
23107
  let didReply = false;
22916
23108
  await dispatchReplyWithDispatcher({
22917
23109
  ctx: ctxPayload,
22918
23110
  cfg,
22919
23111
  dispatcherOptions: {
22920
- responsePrefix: resolveEffectiveMessagesConfig(cfg, route.agentId).responsePrefix,
23112
+ ...prefixOptions,
22921
23113
  humanDelay: resolveHumanDelayConfig(cfg, route.agentId),
22922
23114
  deliver: async (payload) => {
22923
23115
  try {
@@ -22944,7 +23136,8 @@ async function dispatchDiscordCommandInteraction(params) {
22944
23136
  },
22945
23137
  replyOptions: {
22946
23138
  skillFilter: channelConfig?.skills,
22947
- disableBlockStreaming: typeof discordConfig?.blockStreaming === "boolean" ? !discordConfig.blockStreaming : void 0
23139
+ disableBlockStreaming: typeof discordConfig?.blockStreaming === "boolean" ? !discordConfig.blockStreaming : void 0,
23140
+ onModelSelected
22948
23141
  }
22949
23142
  });
22950
23143
  }
@@ -25327,15 +25520,12 @@ function formatControlUiSshHint(params) {
25327
25520
  const basePath = normalizeControlUiBasePath(params.basePath);
25328
25521
  const uiPath = basePath ? `${basePath}/` : "/";
25329
25522
  const localUrl = `http://localhost:${params.port}${uiPath}`;
25330
- const tokenParam = params.token ? `?token=${encodeURIComponent(params.token)}` : "";
25331
- const authedUrl = params.token ? `${localUrl}${tokenParam}` : void 0;
25332
25523
  const sshTarget = resolveSshTargetHint();
25333
25524
  return [
25334
25525
  "No GUI detected. Open from your computer:",
25335
25526
  `ssh -N -L ${params.port}:127.0.0.1:${params.port} ${sshTarget}`,
25336
25527
  "Then open:",
25337
25528
  localUrl,
25338
- authedUrl,
25339
25529
  "Docs:",
25340
25530
  "https://docs.openclaw.ai/gateway/remote",
25341
25531
  "https://docs.openclaw.ai/web/control-ui"
@@ -26302,16 +26492,17 @@ async function monitorIMessageProvider(opts = {}) {
26302
26492
  const preview = truncateUtf16Safe(body, 200).replace(/\n/g, "\\n");
26303
26493
  logVerbose(`imessage inbound: chatId=${chatId ?? "unknown"} from=${ctxPayload.From} len=${body.length} preview="${preview}"`);
26304
26494
  }
26305
- const prefixContext = createReplyPrefixContext({
26495
+ const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
26306
26496
  cfg,
26307
- agentId: route.agentId
26497
+ agentId: route.agentId,
26498
+ channel: "imessage",
26499
+ accountId: route.accountId
26308
26500
  });
26309
26501
  const { queuedFinal } = await dispatchInboundMessage({
26310
26502
  ctx: ctxPayload,
26311
26503
  cfg,
26312
26504
  dispatcher: createReplyDispatcher({
26313
- responsePrefix: prefixContext.responsePrefix,
26314
- responsePrefixContextProvider: prefixContext.responsePrefixContextProvider,
26505
+ ...prefixOptions,
26315
26506
  humanDelay: resolveHumanDelayConfig(cfg, route.agentId),
26316
26507
  deliver: async (payload) => {
26317
26508
  await deliverReplies$3({
@@ -26331,7 +26522,7 @@ async function monitorIMessageProvider(opts = {}) {
26331
26522
  }),
26332
26523
  replyOptions: {
26333
26524
  disableBlockStreaming: typeof accountInfo.config.blockStreaming === "boolean" ? !accountInfo.config.blockStreaming : void 0,
26334
- onModelSelected: prefixContext.onModelSelected
26525
+ onModelSelected
26335
26526
  }
26336
26527
  });
26337
26528
  if (!queuedFinal) {
@@ -28127,11 +28318,17 @@ async function monitorLineProvider(opts) {
28127
28318
  try {
28128
28319
  const textLimit = 5e3;
28129
28320
  let replyTokenUsed = false;
28321
+ const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
28322
+ cfg: config,
28323
+ agentId: route.agentId,
28324
+ channel: "line",
28325
+ accountId: route.accountId
28326
+ });
28130
28327
  const { queuedFinal } = await dispatchReplyWithBufferedBlockDispatcher({
28131
28328
  ctx: ctxPayload,
28132
28329
  cfg: config,
28133
28330
  dispatcherOptions: {
28134
- responsePrefix: resolveEffectiveMessagesConfig(config, route.agentId).responsePrefix,
28331
+ ...prefixOptions,
28135
28332
  deliver: async (payload, _info) => {
28136
28333
  const lineData = payload.channelData?.line ?? {};
28137
28334
  if (ctx.userId && !ctx.isGroup) showLoadingAnimation(ctx.userId, { accountId: ctx.accountId }).catch(() => {});
@@ -28173,7 +28370,7 @@ async function monitorLineProvider(opts) {
28173
28370
  runtime.error?.(danger(`line ${info.kind} reply failed: ${String(err)}`));
28174
28371
  }
28175
28372
  },
28176
- replyOptions: {}
28373
+ replyOptions: { onModelSelected }
28177
28374
  });
28178
28375
  if (!queuedFinal) logVerbose(`line: no response generated for message from ${ctxPayload.From}`);
28179
28376
  } catch (err) {
@@ -28544,9 +28741,11 @@ function createSignalEventHandler(deps) {
28544
28741
  const preview = body.slice(0, 200).replace(/\\n/g, "\\\\n");
28545
28742
  logVerbose(`signal inbound: from=${ctxPayload.From} len=${body.length} preview="${preview}"`);
28546
28743
  }
28547
- const prefixContext = createReplyPrefixContext({
28744
+ const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
28548
28745
  cfg: deps.cfg,
28549
- agentId: route.agentId
28746
+ agentId: route.agentId,
28747
+ channel: "signal",
28748
+ accountId: route.accountId
28550
28749
  });
28551
28750
  const typingCallbacks = createTypingCallbacks({
28552
28751
  start: async () => {
@@ -28567,8 +28766,7 @@ function createSignalEventHandler(deps) {
28567
28766
  }
28568
28767
  });
28569
28768
  const { dispatcher, replyOptions, markDispatchIdle } = createReplyDispatcherWithTyping({
28570
- responsePrefix: prefixContext.responsePrefix,
28571
- responsePrefixContextProvider: prefixContext.responsePrefixContextProvider,
28769
+ ...prefixOptions,
28572
28770
  humanDelay: resolveHumanDelayConfig(deps.cfg, route.agentId),
28573
28771
  deliver: async (payload) => {
28574
28772
  await deps.deliverReplies({
@@ -28594,9 +28792,7 @@ function createSignalEventHandler(deps) {
28594
28792
  replyOptions: {
28595
28793
  ...replyOptions,
28596
28794
  disableBlockStreaming: typeof deps.blockStreaming === "boolean" ? !deps.blockStreaming : void 0,
28597
- onModelSelected: (ctx) => {
28598
- prefixContext.onModelSelected(ctx);
28599
- }
28795
+ onModelSelected
28600
28796
  }
28601
28797
  });
28602
28798
  markDispatchIdle();
@@ -30515,13 +30711,14 @@ async function dispatchPreparedSlackMessage(prepared) {
30515
30711
  });
30516
30712
  }
30517
30713
  });
30518
- const prefixContext = createReplyPrefixContext({
30714
+ const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
30519
30715
  cfg,
30520
- agentId: route.agentId
30716
+ agentId: route.agentId,
30717
+ channel: "slack",
30718
+ accountId: route.accountId
30521
30719
  });
30522
30720
  const { dispatcher, replyOptions, markDispatchIdle } = createReplyDispatcherWithTyping({
30523
- responsePrefix: prefixContext.responsePrefix,
30524
- responsePrefixContextProvider: prefixContext.responsePrefixContextProvider,
30721
+ ...prefixOptions,
30525
30722
  humanDelay: resolveHumanDelayConfig(cfg, route.agentId),
30526
30723
  deliver: async (payload) => {
30527
30724
  const replyThreadTs = replyPlan.nextThreadTs();
@@ -30552,9 +30749,7 @@ async function dispatchPreparedSlackMessage(prepared) {
30552
30749
  skillFilter: prepared.channelConfig?.skills,
30553
30750
  hasRepliedRef,
30554
30751
  disableBlockStreaming: typeof account.config.blockStreaming === "boolean" ? !account.config.blockStreaming : void 0,
30555
- onModelSelected: (ctx) => {
30556
- prefixContext.onModelSelected(ctx);
30557
- }
30752
+ onModelSelected
30558
30753
  }
30559
30754
  });
30560
30755
  markDispatchIdle();
@@ -31548,42 +31743,49 @@ function registerSlackMonitorSlashCommands(params) {
31548
31743
  }) : void 0;
31549
31744
  const systemPromptParts = [channelConfig?.systemPrompt?.trim() || null].filter((entry) => Boolean(entry));
31550
31745
  const groupSystemPrompt = systemPromptParts.length > 0 ? systemPromptParts.join("\n\n") : void 0;
31551
- const { counts } = await dispatchReplyWithDispatcher({
31552
- ctx: finalizeInboundContext({
31553
- Body: prompt,
31554
- RawBody: prompt,
31555
- CommandBody: prompt,
31556
- CommandArgs: commandArgs,
31557
- From: isDirectMessage ? `slack:${command.user_id}` : isRoom ? `slack:channel:${command.channel_id}` : `slack:group:${command.channel_id}`,
31558
- To: `slash:${command.user_id}`,
31746
+ const ctxPayload = finalizeInboundContext({
31747
+ Body: prompt,
31748
+ RawBody: prompt,
31749
+ CommandBody: prompt,
31750
+ CommandArgs: commandArgs,
31751
+ From: isDirectMessage ? `slack:${command.user_id}` : isRoom ? `slack:channel:${command.channel_id}` : `slack:group:${command.channel_id}`,
31752
+ To: `slash:${command.user_id}`,
31753
+ ChatType: isDirectMessage ? "direct" : "channel",
31754
+ ConversationLabel: resolveConversationLabel({
31559
31755
  ChatType: isDirectMessage ? "direct" : "channel",
31560
- ConversationLabel: resolveConversationLabel({
31561
- ChatType: isDirectMessage ? "direct" : "channel",
31562
- SenderName: senderName,
31563
- GroupSubject: isRoomish ? roomLabel : void 0,
31564
- From: isDirectMessage ? `slack:${command.user_id}` : isRoom ? `slack:channel:${command.channel_id}` : `slack:group:${command.channel_id}`
31565
- }) ?? (isDirectMessage ? senderName : roomLabel),
31566
- GroupSubject: isRoomish ? roomLabel : void 0,
31567
- GroupSystemPrompt: isRoomish ? groupSystemPrompt : void 0,
31568
- UntrustedContext: untrustedChannelMetadata ? [untrustedChannelMetadata] : void 0,
31569
31756
  SenderName: senderName,
31570
- SenderId: command.user_id,
31571
- Provider: "slack",
31572
- Surface: "slack",
31573
- WasMentioned: true,
31574
- MessageSid: command.trigger_id,
31575
- Timestamp: Date.now(),
31576
- SessionKey: `agent:${route.agentId}:${slashCommand.sessionPrefix}:${command.user_id}`.toLowerCase(),
31577
- CommandTargetSessionKey: route.sessionKey,
31578
- AccountId: route.accountId,
31579
- CommandSource: "native",
31580
- CommandAuthorized: commandAuthorized,
31581
- OriginatingChannel: "slack",
31582
- OriginatingTo: `user:${command.user_id}`
31583
- }),
31757
+ GroupSubject: isRoomish ? roomLabel : void 0,
31758
+ From: isDirectMessage ? `slack:${command.user_id}` : isRoom ? `slack:channel:${command.channel_id}` : `slack:group:${command.channel_id}`
31759
+ }) ?? (isDirectMessage ? senderName : roomLabel),
31760
+ GroupSubject: isRoomish ? roomLabel : void 0,
31761
+ GroupSystemPrompt: isRoomish ? groupSystemPrompt : void 0,
31762
+ UntrustedContext: untrustedChannelMetadata ? [untrustedChannelMetadata] : void 0,
31763
+ SenderName: senderName,
31764
+ SenderId: command.user_id,
31765
+ Provider: "slack",
31766
+ Surface: "slack",
31767
+ WasMentioned: true,
31768
+ MessageSid: command.trigger_id,
31769
+ Timestamp: Date.now(),
31770
+ SessionKey: `agent:${route.agentId}:${slashCommand.sessionPrefix}:${command.user_id}`.toLowerCase(),
31771
+ CommandTargetSessionKey: route.sessionKey,
31772
+ AccountId: route.accountId,
31773
+ CommandSource: "native",
31774
+ CommandAuthorized: commandAuthorized,
31775
+ OriginatingChannel: "slack",
31776
+ OriginatingTo: `user:${command.user_id}`
31777
+ });
31778
+ const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
31779
+ cfg,
31780
+ agentId: route.agentId,
31781
+ channel: "slack",
31782
+ accountId: route.accountId
31783
+ });
31784
+ const { counts } = await dispatchReplyWithDispatcher({
31785
+ ctx: ctxPayload,
31584
31786
  cfg,
31585
31787
  dispatcherOptions: {
31586
- responsePrefix: resolveEffectiveMessagesConfig(cfg, route.agentId).responsePrefix,
31788
+ ...prefixOptions,
31587
31789
  deliver: async (payload) => {
31588
31790
  await deliverSlackSlashReplies({
31589
31791
  replies: [payload],
@@ -31602,7 +31804,10 @@ function registerSlackMonitorSlashCommands(params) {
31602
31804
  runtime.error?.(danger(`slack slash ${info.kind} reply failed: ${String(err)}`));
31603
31805
  }
31604
31806
  },
31605
- replyOptions: { skillFilter: channelConfig?.skills }
31807
+ replyOptions: {
31808
+ skillFilter: channelConfig?.skills,
31809
+ onModelSelected
31810
+ }
31606
31811
  });
31607
31812
  if (counts.final + counts.tool + counts.block === 0) await deliverSlackSlashReplies({
31608
31813
  replies: [],
@@ -32037,7 +32242,7 @@ async function fetchWithTimeout$1(url, timeoutMs, fetcher) {
32037
32242
  clearTimeout(timer);
32038
32243
  }
32039
32244
  }
32040
- function isRecord$3(value) {
32245
+ function isRecord$4(value) {
32041
32246
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
32042
32247
  }
32043
32248
  function collectTelegramUnmentionedGroupIds(groups) {
@@ -32083,8 +32288,8 @@ async function auditTelegramGroupMembership(params) {
32083
32288
  for (const chatId of params.groupIds) try {
32084
32289
  const res = await fetchWithTimeout$1(`${base}/getChatMember?chat_id=${encodeURIComponent(chatId)}&user_id=${encodeURIComponent(String(params.botId))}`, params.timeoutMs, fetcher);
32085
32290
  const json = await res.json();
32086
- if (!res.ok || !isRecord$3(json) || !json.ok) {
32087
- const desc = isRecord$3(json) && !json.ok && typeof json.description === "string" ? json.description : `getChatMember failed (${res.status})`;
32291
+ if (!res.ok || !isRecord$4(json) || !json.ok) {
32292
+ const desc = isRecord$4(json) && !json.ok && typeof json.description === "string" ? json.description : `getChatMember failed (${res.status})`;
32088
32293
  groups.push({
32089
32294
  chatId,
32090
32295
  ok: false,
@@ -32095,7 +32300,7 @@ async function auditTelegramGroupMembership(params) {
32095
32300
  });
32096
32301
  continue;
32097
32302
  }
32098
- const status = isRecord$3(json.result) ? json.result.status ?? null : null;
32303
+ const status = isRecord$4(json.result) ? json.result.status ?? null : null;
32099
32304
  const ok = status === "creator" || status === "administrator" || status === "member";
32100
32305
  groups.push({
32101
32306
  chatId,
@@ -32133,48 +32338,6 @@ function resolveTelegramAllowedUpdates() {
32133
32338
  return updates;
32134
32339
  }
32135
32340
 
32136
- //#endregion
32137
- //#region src/agents/usage.ts
32138
- const asFiniteNumber = (value) => {
32139
- if (typeof value !== "number") return;
32140
- if (!Number.isFinite(value)) return;
32141
- return value;
32142
- };
32143
- function hasNonzeroUsage(usage) {
32144
- if (!usage) return false;
32145
- return [
32146
- usage.input,
32147
- usage.output,
32148
- usage.cacheRead,
32149
- usage.cacheWrite,
32150
- usage.total
32151
- ].some((v) => typeof v === "number" && Number.isFinite(v) && v > 0);
32152
- }
32153
- function normalizeUsage(raw) {
32154
- if (!raw) return;
32155
- const input = asFiniteNumber(raw.input ?? raw.inputTokens ?? raw.input_tokens ?? raw.promptTokens ?? raw.prompt_tokens);
32156
- const output = asFiniteNumber(raw.output ?? raw.outputTokens ?? raw.output_tokens ?? raw.completionTokens ?? raw.completion_tokens);
32157
- const cacheRead = asFiniteNumber(raw.cacheRead ?? raw.cache_read ?? raw.cache_read_input_tokens);
32158
- const cacheWrite = asFiniteNumber(raw.cacheWrite ?? raw.cache_write ?? raw.cache_creation_input_tokens);
32159
- const total = asFiniteNumber(raw.total ?? raw.totalTokens ?? raw.total_tokens);
32160
- if (input === void 0 && output === void 0 && cacheRead === void 0 && cacheWrite === void 0 && total === void 0) return;
32161
- return {
32162
- input,
32163
- output,
32164
- cacheRead,
32165
- cacheWrite,
32166
- total
32167
- };
32168
- }
32169
- function derivePromptTokens(usage) {
32170
- if (!usage) return;
32171
- const input = usage.input ?? 0;
32172
- const cacheRead = usage.cacheRead ?? 0;
32173
- const cacheWrite = usage.cacheWrite ?? 0;
32174
- const sum = input + cacheRead + cacheWrite;
32175
- return sum > 0 ? sum : void 0;
32176
- }
32177
-
32178
32341
  //#endregion
32179
32342
  //#region src/infra/git-commit.ts
32180
32343
  const formatCommit = (value) => {
@@ -33252,6 +33415,7 @@ async function resolveContextReport(params) {
33252
33415
  groupChannel: params.sessionEntry?.groupChannel ?? void 0,
33253
33416
  groupSpace: params.sessionEntry?.space ?? void 0,
33254
33417
  spawnedBy: params.sessionEntry?.spawnedBy ?? void 0,
33418
+ senderIsOwner: params.command.senderIsOwner,
33255
33419
  modelProvider: params.provider,
33256
33420
  modelId: params.model
33257
33421
  });
@@ -34292,7 +34456,7 @@ const WINDOW_MINUTE_KEYS = [
34292
34456
  "durationMinutes",
34293
34457
  "minutes"
34294
34458
  ];
34295
- function isRecord$2(value) {
34459
+ function isRecord$3(value) {
34296
34460
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
34297
34461
  }
34298
34462
  function pickNumber(record, keys) {
@@ -34348,7 +34512,7 @@ function collectUsageCandidates(root) {
34348
34512
  if (!next) break;
34349
34513
  scanned += 1;
34350
34514
  const { value, depth } = next;
34351
- if (isRecord$2(value)) {
34515
+ if (isRecord$3(value)) {
34352
34516
  if (seen.has(value)) continue;
34353
34517
  seen.add(value);
34354
34518
  const score = scoreUsageRecord(value);
@@ -34358,7 +34522,7 @@ function collectUsageCandidates(root) {
34358
34522
  depth
34359
34523
  });
34360
34524
  if (depth < MAX_SCAN_DEPTH) {
34361
- for (const nested of Object.values(value)) if (isRecord$2(nested) || Array.isArray(nested)) queue.push({
34525
+ for (const nested of Object.values(value)) if (isRecord$3(nested) || Array.isArray(nested)) queue.push({
34362
34526
  value: nested,
34363
34527
  depth: depth + 1
34364
34528
  });
@@ -34366,7 +34530,7 @@ function collectUsageCandidates(root) {
34366
34530
  continue;
34367
34531
  }
34368
34532
  if (Array.isArray(value) && depth < MAX_SCAN_DEPTH) {
34369
- for (const nested of value) if (isRecord$2(nested) || Array.isArray(nested)) queue.push({
34533
+ for (const nested of value) if (isRecord$3(nested) || Array.isArray(nested)) queue.push({
34370
34534
  value: nested,
34371
34535
  depth: depth + 1
34372
34536
  });
@@ -34416,20 +34580,20 @@ async function fetchMinimaxUsage(apiKey, timeoutMs, fetchFn) {
34416
34580
  error: `HTTP ${res.status}`
34417
34581
  };
34418
34582
  const data = await res.json().catch(() => null);
34419
- if (!isRecord$2(data)) return {
34583
+ if (!isRecord$3(data)) return {
34420
34584
  provider: "minimax",
34421
34585
  displayName: PROVIDER_LABELS.minimax,
34422
34586
  windows: [],
34423
34587
  error: "Invalid JSON"
34424
34588
  };
34425
- const baseResp = isRecord$2(data.base_resp) ? data.base_resp : void 0;
34589
+ const baseResp = isRecord$3(data.base_resp) ? data.base_resp : void 0;
34426
34590
  if (baseResp && typeof baseResp.status_code === "number" && baseResp.status_code !== 0) return {
34427
34591
  provider: "minimax",
34428
34592
  displayName: PROVIDER_LABELS.minimax,
34429
34593
  windows: [],
34430
34594
  error: baseResp.status_msg?.trim() || "API error"
34431
34595
  };
34432
- const payload = isRecord$2(data.data) ? data.data : data;
34596
+ const payload = isRecord$3(data.data) ? data.data : data;
34433
34597
  const candidates = collectUsageCandidates(payload);
34434
34598
  let usageRecord = payload;
34435
34599
  let usedPercent = null;
@@ -35436,6 +35600,11 @@ const registerTelegramHandlers = ({ cfg, accountId, bot, opts, runtime, mediaMax
35436
35600
  messageThreadId: params.messageThreadId
35437
35601
  });
35438
35602
  const peerId = params.isGroup ? buildTelegramGroupPeerId(params.chatId, resolvedThreadId) : String(params.chatId);
35603
+ const parentPeer = buildTelegramParentPeer({
35604
+ isGroup: params.isGroup,
35605
+ resolvedThreadId,
35606
+ chatId: params.chatId
35607
+ });
35439
35608
  const route = resolveAgentRoute({
35440
35609
  cfg,
35441
35610
  channel: "telegram",
@@ -35443,7 +35612,8 @@ const registerTelegramHandlers = ({ cfg, accountId, bot, opts, runtime, mediaMax
35443
35612
  peer: {
35444
35613
  kind: params.isGroup ? "group" : "dm",
35445
35614
  id: peerId
35446
- }
35615
+ },
35616
+ parentPeer
35447
35617
  });
35448
35618
  const baseSessionKey = route.sessionKey;
35449
35619
  const dmThreadId = !params.isGroup ? params.messageThreadId : void 0;
@@ -35584,7 +35754,7 @@ const registerTelegramHandlers = ({ cfg, accountId, bot, opts, runtime, mediaMax
35584
35754
  }
35585
35755
  }
35586
35756
  const defaultGroupPolicy = cfg.channels?.defaults?.groupPolicy;
35587
- const groupPolicy = telegramCfg.groupPolicy ?? defaultGroupPolicy ?? "open";
35757
+ const groupPolicy = firstDefined(topicConfig?.groupPolicy, groupConfig?.groupPolicy, telegramCfg.groupPolicy, defaultGroupPolicy, "open");
35588
35758
  if (groupPolicy === "disabled") {
35589
35759
  logVerbose(`Blocked telegram group message (groupPolicy: disabled)`);
35590
35760
  return;
@@ -35835,7 +36005,7 @@ const registerTelegramHandlers = ({ cfg, accountId, bot, opts, runtime, mediaMax
35835
36005
  }
35836
36006
  }
35837
36007
  const defaultGroupPolicy = cfg.channels?.defaults?.groupPolicy;
35838
- const groupPolicy = telegramCfg.groupPolicy ?? defaultGroupPolicy ?? "open";
36008
+ const groupPolicy = firstDefined(topicConfig?.groupPolicy, groupConfig?.groupPolicy, telegramCfg.groupPolicy, defaultGroupPolicy, "open");
35839
36009
  if (groupPolicy === "disabled") {
35840
36010
  logVerbose(`Blocked telegram group message (groupPolicy: disabled)`);
35841
36011
  return;
@@ -36034,6 +36204,11 @@ const buildTelegramMessageContext = async ({ primaryCtx, allMedia, storeAllowFro
36034
36204
  const replyThreadId = threadSpec.id;
36035
36205
  const { groupConfig, topicConfig } = resolveTelegramGroupConfig(chatId, resolvedThreadId);
36036
36206
  const peerId = isGroup ? buildTelegramGroupPeerId(chatId, resolvedThreadId) : String(chatId);
36207
+ const parentPeer = buildTelegramParentPeer({
36208
+ isGroup,
36209
+ resolvedThreadId,
36210
+ chatId
36211
+ });
36037
36212
  const route = resolveAgentRoute({
36038
36213
  cfg,
36039
36214
  channel: "telegram",
@@ -36041,7 +36216,8 @@ const buildTelegramMessageContext = async ({ primaryCtx, allMedia, storeAllowFro
36041
36216
  peer: {
36042
36217
  kind: isGroup ? "group" : "dm",
36043
36218
  id: peerId
36044
- }
36219
+ },
36220
+ parentPeer
36045
36221
  });
36046
36222
  const baseSessionKey = route.sessionKey;
36047
36223
  const dmThreadId = threadSpec.scope === "dm" ? threadSpec.id : void 0;
@@ -36387,7 +36563,8 @@ const buildTelegramMessageContext = async ({ primaryCtx, allMedia, storeAllowFro
36387
36563
  sessionKey: route.mainSessionKey,
36388
36564
  channel: "telegram",
36389
36565
  to: String(chatId),
36390
- accountId: route.accountId
36566
+ accountId: route.accountId,
36567
+ threadId: dmThreadId != null ? String(dmThreadId) : void 0
36391
36568
  } : void 0,
36392
36569
  onRecordError: (err) => {
36393
36570
  logVerbose(`telegram: failed updating session meta: ${String(err)}`);
@@ -36828,9 +37005,11 @@ const dispatchTelegramMessage = async ({ context, bot, cfg, runtime, replyToMode
36828
37005
  await draftStream.flush();
36829
37006
  };
36830
37007
  const disableBlockStreaming = Boolean(draftStream) || (typeof telegramCfg.blockStreaming === "boolean" ? !telegramCfg.blockStreaming : void 0);
36831
- const prefixContext = createReplyPrefixContext({
37008
+ const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
36832
37009
  cfg,
36833
- agentId: route.agentId
37010
+ agentId: route.agentId,
37011
+ channel: "telegram",
37012
+ accountId: route.accountId
36834
37013
  });
36835
37014
  const tableMode = resolveMarkdownTableMode({
36836
37015
  cfg,
@@ -36839,7 +37018,7 @@ const dispatchTelegramMessage = async ({ context, bot, cfg, runtime, replyToMode
36839
37018
  });
36840
37019
  const chunkMode = resolveChunkMode(cfg, "telegram", route.accountId);
36841
37020
  const sticker = ctxPayload.Sticker;
36842
- if (sticker?.fileUniqueId && ctxPayload.MediaPath) {
37021
+ if (sticker?.fileId && sticker.fileUniqueId && ctxPayload.MediaPath) {
36843
37022
  const agentDir = resolveAgentDir(cfg, route.agentId);
36844
37023
  const stickerSupportsVision = await resolveStickerVisionSupport(cfg, route.agentId);
36845
37024
  let description = sticker.cachedDescription ?? null;
@@ -36863,16 +37042,18 @@ const dispatchTelegramMessage = async ({ context, bot, cfg, runtime, replyToMode
36863
37042
  ctxPayload.MediaUrls = void 0;
36864
37043
  ctxPayload.MediaTypes = void 0;
36865
37044
  }
36866
- cacheSticker({
36867
- fileId: sticker.fileId,
36868
- fileUniqueId: sticker.fileUniqueId,
36869
- emoji: sticker.emoji,
36870
- setName: sticker.setName,
36871
- description,
36872
- cachedAt: (/* @__PURE__ */ new Date()).toISOString(),
36873
- receivedFrom: ctxPayload.From
36874
- });
36875
- logVerbose(`telegram: cached sticker description for ${sticker.fileUniqueId}`);
37045
+ if (sticker.fileId) {
37046
+ cacheSticker({
37047
+ fileId: sticker.fileId,
37048
+ fileUniqueId: sticker.fileUniqueId,
37049
+ emoji: sticker.emoji,
37050
+ setName: sticker.setName,
37051
+ description,
37052
+ cachedAt: (/* @__PURE__ */ new Date()).toISOString(),
37053
+ receivedFrom: ctxPayload.From
37054
+ });
37055
+ logVerbose(`telegram: cached sticker description for ${sticker.fileUniqueId}`);
37056
+ } else logVerbose(`telegram: skipped sticker cache (missing fileId)`);
36876
37057
  }
36877
37058
  }
36878
37059
  const replyQuoteText = ctxPayload.ReplyToIsQuote && ctxPayload.ReplyToBody ? ctxPayload.ReplyToBody.trim() || void 0 : void 0;
@@ -36884,8 +37065,7 @@ const dispatchTelegramMessage = async ({ context, bot, cfg, runtime, replyToMode
36884
37065
  ctx: ctxPayload,
36885
37066
  cfg,
36886
37067
  dispatcherOptions: {
36887
- responsePrefix: prefixContext.responsePrefix,
36888
- responsePrefixContextProvider: prefixContext.responsePrefixContextProvider,
37068
+ ...prefixOptions,
36889
37069
  deliver: async (payload, info) => {
36890
37070
  if (info.kind === "final") {
36891
37071
  await flushDraft();
@@ -36929,9 +37109,7 @@ const dispatchTelegramMessage = async ({ context, bot, cfg, runtime, replyToMode
36929
37109
  skillFilter,
36930
37110
  disableBlockStreaming,
36931
37111
  onPartialReply: draftStream ? (payload) => updateDraftFromPartial(payload.text) : void 0,
36932
- onModelSelected: (ctx) => {
36933
- prefixContext.onModelSelected(ctx);
36934
- }
37112
+ onModelSelected
36935
37113
  }
36936
37114
  });
36937
37115
  draftStream?.stop();
@@ -37266,6 +37444,11 @@ const registerTelegramNativeCommands = ({ bot, cfg, runtime, accountId, telegram
37266
37444
  });
37267
37445
  return;
37268
37446
  }
37447
+ const parentPeer = buildTelegramParentPeer({
37448
+ isGroup,
37449
+ resolvedThreadId,
37450
+ chatId
37451
+ });
37269
37452
  const route = resolveAgentRoute({
37270
37453
  cfg,
37271
37454
  channel: "telegram",
@@ -37273,7 +37456,8 @@ const registerTelegramNativeCommands = ({ bot, cfg, runtime, accountId, telegram
37273
37456
  peer: {
37274
37457
  kind: isGroup ? "group" : "dm",
37275
37458
  id: isGroup ? buildTelegramGroupPeerId(chatId, resolvedThreadId) : String(chatId)
37276
- }
37459
+ },
37460
+ parentPeer
37277
37461
  });
37278
37462
  const baseSessionKey = route.sessionKey;
37279
37463
  const dmThreadId = threadSpec.scope === "dm" ? threadSpec.id : void 0;
@@ -37324,11 +37508,17 @@ const registerTelegramNativeCommands = ({ bot, cfg, runtime, accountId, telegram
37324
37508
  delivered: false,
37325
37509
  skippedNonSilent: 0
37326
37510
  };
37511
+ const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
37512
+ cfg,
37513
+ agentId: route.agentId,
37514
+ channel: "telegram",
37515
+ accountId: route.accountId
37516
+ });
37327
37517
  await dispatchReplyWithBufferedBlockDispatcher({
37328
37518
  ctx: ctxPayload,
37329
37519
  cfg,
37330
37520
  dispatcherOptions: {
37331
- responsePrefix: resolveEffectiveMessagesConfig(cfg, route.agentId).responsePrefix,
37521
+ ...prefixOptions,
37332
37522
  deliver: async (payload, _info) => {
37333
37523
  if ((await deliverReplies({
37334
37524
  replies: [payload],
@@ -37353,7 +37543,8 @@ const registerTelegramNativeCommands = ({ bot, cfg, runtime, accountId, telegram
37353
37543
  },
37354
37544
  replyOptions: {
37355
37545
  skillFilter,
37356
- disableBlockStreaming
37546
+ disableBlockStreaming,
37547
+ onModelSelected
37357
37548
  }
37358
37549
  });
37359
37550
  if (!deliveryState.delivered && deliveryState.skippedNonSilent > 0) await deliverReplies({
@@ -37458,7 +37649,7 @@ function getTelegramSequentialKey(ctx) {
37458
37649
  }
37459
37650
  const isGroup = msg?.chat?.type === "group" || msg?.chat?.type === "supergroup";
37460
37651
  const messageThreadId = msg?.message_thread_id;
37461
- const isForum = (msg?.chat)?.is_forum;
37652
+ const isForum = msg?.chat?.is_forum;
37462
37653
  const threadId = isGroup ? resolveTelegramForumThreadId({
37463
37654
  isForum,
37464
37655
  messageThreadId
@@ -37493,10 +37684,6 @@ function createTelegramBot(opts) {
37493
37684
  bot.catch((err) => {
37494
37685
  runtime.error?.(danger(`telegram bot error: ${formatUncaughtError(err)}`));
37495
37686
  });
37496
- bot.catch((err) => {
37497
- const message = err instanceof Error ? err.message : String(err);
37498
- runtime.error?.(danger(`telegram bot error: ${message}`));
37499
- });
37500
37687
  const recentUpdates = createTelegramUpdateDedupe();
37501
37688
  let lastUpdateId = typeof opts.updateOffset?.lastUpdateId === "number" ? opts.updateOffset.lastUpdateId : null;
37502
37689
  const recordUpdateId = (ctx) => {
@@ -37526,9 +37713,8 @@ function createTelegramBot(opts) {
37526
37713
  if (typeof value === "string" && value.length > MAX_RAW_UPDATE_STRING) return `${value.slice(0, MAX_RAW_UPDATE_STRING)}...`;
37527
37714
  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)`];
37528
37715
  if (value && typeof value === "object") {
37529
- const obj = value;
37530
- if (seen.has(obj)) return "[Circular]";
37531
- seen.add(obj);
37716
+ if (seen.has(value)) return "[Circular]";
37717
+ seen.add(value);
37532
37718
  }
37533
37719
  return value;
37534
37720
  });
@@ -37572,9 +37758,8 @@ function createTelegramBot(opts) {
37572
37758
  const streamMode = resolveTelegramStreamMode(telegramCfg);
37573
37759
  let botHasTopicsEnabled;
37574
37760
  const resolveBotTopicsEnabled = async (ctx) => {
37575
- const fromCtx = ctx?.me;
37576
- if (typeof fromCtx?.has_topics_enabled === "boolean") {
37577
- botHasTopicsEnabled = fromCtx.has_topics_enabled;
37761
+ if (typeof ctx?.me?.has_topics_enabled === "boolean") {
37762
+ botHasTopicsEnabled = ctx.me.has_topics_enabled;
37578
37763
  return botHasTopicsEnabled;
37579
37764
  }
37580
37765
  if (typeof botHasTopicsEnabled === "boolean") return botHasTopicsEnabled;
@@ -37696,27 +37881,28 @@ function createTelegramBot(opts) {
37696
37881
  else if (!senderName && senderUsername) senderLabel = senderUsername;
37697
37882
  if (!senderLabel && user?.id) senderLabel = `id:${user.id}`;
37698
37883
  senderLabel = senderLabel || "unknown";
37699
- const messageThreadId = reaction.message_thread_id;
37700
- const resolvedThreadId = resolveTelegramForumThreadId({
37701
- isForum: reaction.chat.is_forum === true,
37702
- messageThreadId
37703
- });
37704
37884
  const isGroup = reaction.chat.type === "group" || reaction.chat.type === "supergroup";
37885
+ const isForum = reaction.chat.is_forum === true;
37886
+ const resolvedThreadId = isForum ? resolveTelegramForumThreadId({
37887
+ isForum,
37888
+ messageThreadId: void 0
37889
+ }) : void 0;
37705
37890
  const peerId = isGroup ? buildTelegramGroupPeerId(chatId, resolvedThreadId) : String(chatId);
37706
- const baseSessionKey = resolveAgentRoute({
37891
+ const parentPeer = buildTelegramParentPeer({
37892
+ isGroup,
37893
+ resolvedThreadId,
37894
+ chatId
37895
+ });
37896
+ const sessionKey = resolveAgentRoute({
37707
37897
  cfg,
37708
37898
  channel: "telegram",
37709
37899
  accountId: account.accountId,
37710
37900
  peer: {
37711
37901
  kind: isGroup ? "group" : "dm",
37712
37902
  id: peerId
37713
- }
37903
+ },
37904
+ parentPeer
37714
37905
  }).sessionKey;
37715
- const dmThreadId = !isGroup ? messageThreadId : void 0;
37716
- const sessionKey = (dmThreadId != null ? resolveThreadSessionKeys({
37717
- baseSessionKey,
37718
- threadId: String(dmThreadId)
37719
- }) : null)?.sessionKey ?? baseSessionKey;
37720
37906
  for (const r of addedReactions) {
37721
37907
  const emoji = r.emoji;
37722
37908
  const text = `Telegram reaction added: ${emoji} by ${senderLabel} on msg ${messageId}`;
@@ -38809,6 +38995,8 @@ function normalizePunctuation(value) {
38809
38995
  //#endregion
38810
38996
  //#region src/agents/sandbox-paths.ts
38811
38997
  const UNICODE_SPACES$1 = /[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g;
38998
+ const HTTP_URL_RE = /^https?:\/\//i;
38999
+ const DATA_URL_RE = /^data:/i;
38812
39000
  function normalizeUnicodeSpaces$1(str) {
38813
39001
  return str.replace(UNICODE_SPACES$1, " ");
38814
39002
  }
@@ -38842,6 +39030,26 @@ async function assertSandboxPath(params) {
38842
39030
  await assertNoSymlink(resolved.relative, path.resolve(params.root));
38843
39031
  return resolved;
38844
39032
  }
39033
+ function assertMediaNotDataUrl(media) {
39034
+ const raw = media.trim();
39035
+ if (DATA_URL_RE.test(raw)) throw new Error("data: URLs are not supported for media. Use buffer instead.");
39036
+ }
39037
+ async function resolveSandboxedMediaSource(params) {
39038
+ const raw = params.media.trim();
39039
+ if (!raw) return raw;
39040
+ if (HTTP_URL_RE.test(raw)) return raw;
39041
+ let candidate = raw;
39042
+ if (/^file:\/\//i.test(candidate)) try {
39043
+ candidate = fileURLToPath(candidate);
39044
+ } catch {
39045
+ throw new Error(`Invalid file:// URL for sandboxed media: ${raw}`);
39046
+ }
39047
+ return (await assertSandboxPath({
39048
+ filePath: candidate,
39049
+ cwd: params.sandboxRoot,
39050
+ root: params.sandboxRoot
39051
+ })).resolved;
39052
+ }
38845
39053
  async function assertNoSymlink(relative, root) {
38846
39054
  if (!relative) return;
38847
39055
  const parts = relative.split(path.sep).filter(Boolean);
@@ -42665,7 +42873,7 @@ function migrateLegacyCronPayload(payload) {
42665
42873
  //#endregion
42666
42874
  //#region src/cron/normalize.ts
42667
42875
  const DEFAULT_OPTIONS = { applyDefaults: false };
42668
- function isRecord$1(value) {
42876
+ function isRecord$2(value) {
42669
42877
  return typeof value === "object" && value !== null && !Array.isArray(value);
42670
42878
  }
42671
42879
  function coerceSchedule(schedule) {
@@ -42731,12 +42939,12 @@ function stripLegacyDeliveryFields(payload) {
42731
42939
  if ("bestEffortDeliver" in payload) delete payload.bestEffortDeliver;
42732
42940
  }
42733
42941
  function unwrapJob(raw) {
42734
- if (isRecord$1(raw.data)) return raw.data;
42735
- if (isRecord$1(raw.job)) return raw.job;
42942
+ if (isRecord$2(raw.data)) return raw.data;
42943
+ if (isRecord$2(raw.job)) return raw.job;
42736
42944
  return raw;
42737
42945
  }
42738
42946
  function normalizeCronJobInput(raw, options = DEFAULT_OPTIONS) {
42739
- if (!isRecord$1(raw)) return null;
42947
+ if (!isRecord$2(raw)) return null;
42740
42948
  const base = unwrapJob(raw);
42741
42949
  const next = { ...base };
42742
42950
  if ("agentId" in base) {
@@ -42757,20 +42965,20 @@ function normalizeCronJobInput(raw, options = DEFAULT_OPTIONS) {
42757
42965
  if (trimmed === "false") next.enabled = false;
42758
42966
  }
42759
42967
  }
42760
- if (isRecord$1(base.schedule)) next.schedule = coerceSchedule(base.schedule);
42761
- if (isRecord$1(base.payload)) next.payload = coercePayload(base.payload);
42762
- if (isRecord$1(base.delivery)) next.delivery = coerceDelivery(base.delivery);
42763
- if (isRecord$1(base.isolation)) delete next.isolation;
42968
+ if (isRecord$2(base.schedule)) next.schedule = coerceSchedule(base.schedule);
42969
+ if (isRecord$2(base.payload)) next.payload = coercePayload(base.payload);
42970
+ if (isRecord$2(base.delivery)) next.delivery = coerceDelivery(base.delivery);
42971
+ if (isRecord$2(base.isolation)) delete next.isolation;
42764
42972
  if (options.applyDefaults) {
42765
42973
  if (!next.wakeMode) next.wakeMode = "next-heartbeat";
42766
42974
  if (typeof next.enabled !== "boolean") next.enabled = true;
42767
- if (!next.sessionTarget && isRecord$1(next.payload)) {
42975
+ if (!next.sessionTarget && isRecord$2(next.payload)) {
42768
42976
  const kind = typeof next.payload.kind === "string" ? next.payload.kind : "";
42769
42977
  if (kind === "systemEvent") next.sessionTarget = "main";
42770
42978
  if (kind === "agentTurn") next.sessionTarget = "isolated";
42771
42979
  }
42772
- if ("schedule" in next && isRecord$1(next.schedule) && next.schedule.kind === "at" && !("deleteAfterRun" in next)) next.deleteAfterRun = true;
42773
- const payload = isRecord$1(next.payload) ? next.payload : null;
42980
+ if ("schedule" in next && isRecord$2(next.schedule) && next.schedule.kind === "at" && !("deleteAfterRun" in next)) next.deleteAfterRun = true;
42981
+ const payload = isRecord$2(next.payload) ? next.payload : null;
42774
42982
  const payloadKind = payload && typeof payload.kind === "string" ? payload.kind : "";
42775
42983
  const sessionTarget = typeof next.sessionTarget === "string" ? next.sessionTarget : "";
42776
42984
  const isIsolatedAgentTurn = sessionTarget === "isolated" || sessionTarget === "" && payloadKind === "agentTurn";
@@ -42898,6 +43106,37 @@ async function buildReminderContextLines(params) {
42898
43106
  return [];
42899
43107
  }
42900
43108
  }
43109
+ function isRecord$1(value) {
43110
+ return typeof value === "object" && value !== null && !Array.isArray(value);
43111
+ }
43112
+ function stripThreadSuffixFromSessionKey(sessionKey) {
43113
+ const idx = sessionKey.toLowerCase().lastIndexOf(":thread:");
43114
+ if (idx <= 0) return sessionKey;
43115
+ const parent = sessionKey.slice(0, idx).trim();
43116
+ return parent ? parent : sessionKey;
43117
+ }
43118
+ function inferDeliveryFromSessionKey(agentSessionKey) {
43119
+ const rawSessionKey = agentSessionKey?.trim();
43120
+ if (!rawSessionKey) return null;
43121
+ const parsed = parseAgentSessionKey(stripThreadSuffixFromSessionKey(rawSessionKey));
43122
+ if (!parsed || !parsed.rest) return null;
43123
+ const parts = parsed.rest.split(":").filter(Boolean);
43124
+ if (parts.length === 0) return null;
43125
+ const head = parts[0]?.trim().toLowerCase();
43126
+ if (!head || head === "main" || head === "subagent" || head === "acp") return null;
43127
+ const markerIndex = parts.findIndex((part) => part === "dm" || part === "group" || part === "channel");
43128
+ if (markerIndex === -1) return null;
43129
+ const peerId = parts.slice(markerIndex + 1).join(":").trim();
43130
+ if (!peerId) return null;
43131
+ let channel;
43132
+ if (markerIndex >= 1) channel = parts[0]?.trim().toLowerCase();
43133
+ const delivery = {
43134
+ mode: "announce",
43135
+ to: peerId
43136
+ };
43137
+ if (channel) delivery.channel = channel;
43138
+ return delivery;
43139
+ }
42901
43140
  function createCronTool(opts) {
42902
43141
  return {
42903
43142
  label: "Cron",
@@ -42978,6 +43217,19 @@ Use jobId as the canonical identifier; id is accepted for compatibility. Use con
42978
43217
  }) : void 0;
42979
43218
  if (agentId) job.agentId = agentId;
42980
43219
  }
43220
+ if (opts?.agentSessionKey && job && typeof job === "object" && "payload" in job && job.payload?.kind === "agentTurn") {
43221
+ const deliveryValue = job.delivery;
43222
+ const delivery = isRecord$1(deliveryValue) ? deliveryValue : void 0;
43223
+ const mode = (typeof delivery?.mode === "string" ? delivery.mode : "").trim().toLowerCase();
43224
+ const hasTarget = typeof delivery?.channel === "string" && delivery.channel.trim() || typeof delivery?.to === "string" && delivery.to.trim();
43225
+ if ((deliveryValue == null || delivery) && mode !== "none" && !hasTarget) {
43226
+ const inferred = inferDeliveryFromSessionKey(opts.agentSessionKey);
43227
+ if (inferred) job.delivery = {
43228
+ ...delivery,
43229
+ ...inferred
43230
+ };
43231
+ }
43232
+ }
42981
43233
  const contextMessages = typeof params.contextMessages === "number" && Number.isFinite(params.contextMessages) ? params.contextMessages : 0;
42982
43234
  if (job && typeof job === "object" && "payload" in job && job.payload?.kind === "systemEvent") {
42983
43235
  const payload = job.payload;
@@ -43029,6 +43281,65 @@ Use jobId as the canonical identifier; id is accepted for compatibility. Use con
43029
43281
  };
43030
43282
  }
43031
43283
 
43284
+ //#endregion
43285
+ //#region src/infra/restart-sentinel.ts
43286
+ const SENTINEL_FILENAME = "restart-sentinel.json";
43287
+ function formatDoctorNonInteractiveHint(env = process.env) {
43288
+ return `Run: ${formatCliCommand("openclaw doctor --non-interactive", env)}`;
43289
+ }
43290
+ function resolveRestartSentinelPath(env = process.env) {
43291
+ return path.join(resolveStateDir(env), SENTINEL_FILENAME);
43292
+ }
43293
+ async function writeRestartSentinel(payload, env = process.env) {
43294
+ const filePath = resolveRestartSentinelPath(env);
43295
+ await fs$1.mkdir(path.dirname(filePath), { recursive: true });
43296
+ const data = {
43297
+ version: 1,
43298
+ payload
43299
+ };
43300
+ await fs$1.writeFile(filePath, `${JSON.stringify(data, null, 2)}\n`, "utf-8");
43301
+ return filePath;
43302
+ }
43303
+ async function readRestartSentinel(env = process.env) {
43304
+ const filePath = resolveRestartSentinelPath(env);
43305
+ try {
43306
+ const raw = await fs$1.readFile(filePath, "utf-8");
43307
+ let parsed;
43308
+ try {
43309
+ parsed = JSON.parse(raw);
43310
+ } catch {
43311
+ await fs$1.unlink(filePath).catch(() => {});
43312
+ return null;
43313
+ }
43314
+ if (!parsed || parsed.version !== 1 || !parsed.payload) {
43315
+ await fs$1.unlink(filePath).catch(() => {});
43316
+ return null;
43317
+ }
43318
+ return parsed;
43319
+ } catch {
43320
+ return null;
43321
+ }
43322
+ }
43323
+ async function consumeRestartSentinel(env = process.env) {
43324
+ const filePath = resolveRestartSentinelPath(env);
43325
+ const parsed = await readRestartSentinel(env);
43326
+ if (!parsed) return null;
43327
+ await fs$1.unlink(filePath).catch(() => {});
43328
+ return parsed;
43329
+ }
43330
+ function formatRestartSentinelMessage(payload) {
43331
+ return `GatewayRestart:\n${JSON.stringify(payload, null, 2)}`;
43332
+ }
43333
+ function summarizeRestartSentinel(payload) {
43334
+ return `Gateway restart ${payload.kind} ${payload.status}${payload.stats?.mode ? ` (${payload.stats.mode})` : ""}`.trim();
43335
+ }
43336
+ function trimLogTail(input, maxChars = 8e3) {
43337
+ if (!input) return null;
43338
+ const text = input.trimEnd();
43339
+ if (text.length <= maxChars) return text;
43340
+ return `…${text.slice(text.length - maxChars)}`;
43341
+ }
43342
+
43032
43343
  //#endregion
43033
43344
  //#region src/infra/restart.ts
43034
43345
  const SPAWN_TIMEOUT_MS = 2e3;
@@ -43477,26 +43788,15 @@ function isAbortError$1(err) {
43477
43788
  function shouldRethrowAbort(err) {
43478
43789
  return isAbortError$1(err) && !isTimeoutError(err);
43479
43790
  }
43480
- function buildAllowedModelKeys(cfg, defaultProvider) {
43481
- const rawAllowlist = (() => {
43482
- const modelMap = cfg?.agents?.defaults?.models ?? {};
43483
- return Object.keys(modelMap);
43484
- })();
43485
- if (rawAllowlist.length === 0) return null;
43486
- const keys = /* @__PURE__ */ new Set();
43487
- for (const raw of rawAllowlist) {
43488
- const parsed = parseModelRef(String(raw ?? ""), defaultProvider);
43489
- if (!parsed) continue;
43490
- keys.add(modelKey(parsed.provider, parsed.model));
43491
- }
43492
- return keys.size > 0 ? keys : null;
43493
- }
43494
43791
  function resolveImageFallbackCandidates(params) {
43495
43792
  const aliasIndex = buildModelAliasIndex({
43496
43793
  cfg: params.cfg ?? {},
43497
43794
  defaultProvider: params.defaultProvider
43498
43795
  });
43499
- const allowlist = buildAllowedModelKeys(params.cfg, params.defaultProvider);
43796
+ const allowlist = buildConfiguredAllowlistKeys({
43797
+ cfg: params.cfg,
43798
+ defaultProvider: params.defaultProvider
43799
+ });
43500
43800
  const seen = /* @__PURE__ */ new Set();
43501
43801
  const candidates = [];
43502
43802
  const addCandidate = (candidate, enforceAllowlist) => {
@@ -43544,7 +43844,10 @@ function resolveFallbackCandidates(params) {
43544
43844
  cfg: params.cfg ?? {},
43545
43845
  defaultProvider
43546
43846
  });
43547
- const allowlist = buildAllowedModelKeys(params.cfg, defaultProvider);
43847
+ const allowlist = buildConfiguredAllowlistKeys({
43848
+ cfg: params.cfg,
43849
+ defaultProvider
43850
+ });
43548
43851
  const seen = /* @__PURE__ */ new Set();
43549
43852
  const candidates = [];
43550
43853
  const addCandidate = (candidate, enforceAllowlist) => {
@@ -43689,6 +43992,8 @@ async function runWithImageModelFallback(params) {
43689
43992
  //#endregion
43690
43993
  //#region src/agents/tools/image-tool.ts
43691
43994
  const DEFAULT_PROMPT = "Describe the image.";
43995
+ const ANTHROPIC_IMAGE_PRIMARY = "anthropic/claude-opus-4-6";
43996
+ const ANTHROPIC_IMAGE_FALLBACK = "anthropic/claude-opus-4-5";
43692
43997
  function resolveDefaultModelRef(cfg) {
43693
43998
  if (cfg) {
43694
43999
  const resolved = resolveConfiguredModelRef({
@@ -43749,10 +44054,10 @@ function resolveImageModelConfigForTool(params) {
43749
44054
  if (primary.provider === "minimax" && providerOk) preferred = "minimax/MiniMax-VL-01";
43750
44055
  else if (providerOk && providerVisionFromConfig) preferred = providerVisionFromConfig;
43751
44056
  else if (primary.provider === "openai" && openaiOk) preferred = "openai/gpt-5-mini";
43752
- else if (primary.provider === "anthropic" && anthropicOk) preferred = "anthropic/claude-opus-4-5";
44057
+ else if (primary.provider === "anthropic" && anthropicOk) preferred = ANTHROPIC_IMAGE_PRIMARY;
43753
44058
  if (preferred?.trim()) {
43754
44059
  if (openaiOk) addFallback("openai/gpt-5-mini");
43755
- if (anthropicOk) addFallback("anthropic/claude-opus-4-5");
44060
+ if (anthropicOk) addFallback(ANTHROPIC_IMAGE_FALLBACK);
43756
44061
  const pruned = fallbacks.filter((ref) => ref !== preferred);
43757
44062
  return {
43758
44063
  primary: preferred,
@@ -43760,13 +44065,16 @@ function resolveImageModelConfigForTool(params) {
43760
44065
  };
43761
44066
  }
43762
44067
  if (openaiOk) {
43763
- if (anthropicOk) addFallback("anthropic/claude-opus-4-5");
44068
+ if (anthropicOk) addFallback(ANTHROPIC_IMAGE_FALLBACK);
43764
44069
  return {
43765
44070
  primary: "openai/gpt-5-mini",
43766
44071
  ...fallbacks.length ? { fallbacks } : {}
43767
44072
  };
43768
44073
  }
43769
- if (anthropicOk) return { primary: "anthropic/claude-opus-4-5" };
44074
+ if (anthropicOk) return {
44075
+ primary: ANTHROPIC_IMAGE_PRIMARY,
44076
+ fallbacks: [ANTHROPIC_IMAGE_FALLBACK]
44077
+ };
43770
44078
  return null;
43771
44079
  }
43772
44080
  function pickMaxBytes(cfg, maxBytesMb) {
@@ -44657,10 +44965,27 @@ function resolveHeartbeatDeliveryTarget(params) {
44657
44965
  explicitTo: heartbeat?.to,
44658
44966
  mode: "heartbeat"
44659
44967
  });
44968
+ const heartbeatAccountId = heartbeat?.accountId?.trim();
44969
+ let effectiveAccountId = heartbeatAccountId || resolvedTarget.accountId;
44970
+ if (heartbeatAccountId && resolvedTarget.channel) {
44971
+ const listAccountIds = getChannelPlugin(resolvedTarget.channel)?.config.listAccountIds;
44972
+ const accountIds = listAccountIds ? listAccountIds(cfg) : [];
44973
+ if (accountIds.length > 0) {
44974
+ const normalizedAccountId = normalizeAccountId$3(heartbeatAccountId);
44975
+ if (!new Set(accountIds.map((accountId) => normalizeAccountId$3(accountId))).has(normalizedAccountId)) return {
44976
+ channel: "none",
44977
+ reason: "unknown-account",
44978
+ accountId: normalizedAccountId,
44979
+ lastChannel: resolvedTarget.lastChannel,
44980
+ lastAccountId: resolvedTarget.lastAccountId
44981
+ };
44982
+ effectiveAccountId = normalizedAccountId;
44983
+ }
44984
+ }
44660
44985
  if (!resolvedTarget.channel || !resolvedTarget.to) return {
44661
44986
  channel: "none",
44662
44987
  reason: "no-target",
44663
- accountId: resolvedTarget.accountId,
44988
+ accountId: effectiveAccountId,
44664
44989
  lastChannel: resolvedTarget.lastChannel,
44665
44990
  lastAccountId: resolvedTarget.lastAccountId
44666
44991
  };
@@ -44668,13 +44993,13 @@ function resolveHeartbeatDeliveryTarget(params) {
44668
44993
  channel: resolvedTarget.channel,
44669
44994
  to: resolvedTarget.to,
44670
44995
  cfg,
44671
- accountId: resolvedTarget.accountId,
44996
+ accountId: effectiveAccountId,
44672
44997
  mode: "heartbeat"
44673
44998
  });
44674
44999
  if (!resolved.ok) return {
44675
45000
  channel: "none",
44676
45001
  reason: "no-target",
44677
- accountId: resolvedTarget.accountId,
45002
+ accountId: effectiveAccountId,
44678
45003
  lastChannel: resolvedTarget.lastChannel,
44679
45004
  lastAccountId: resolvedTarget.lastAccountId
44680
45005
  };
@@ -44684,7 +45009,7 @@ function resolveHeartbeatDeliveryTarget(params) {
44684
45009
  channel: resolvedTarget.channel,
44685
45010
  to: resolvedTarget.to,
44686
45011
  cfg,
44687
- accountId: resolvedTarget.accountId,
45012
+ accountId: effectiveAccountId,
44688
45013
  mode: "explicit"
44689
45014
  });
44690
45015
  if (explicit.ok && explicit.to !== resolved.to) reason = "allowFrom-fallback";
@@ -44693,7 +45018,7 @@ function resolveHeartbeatDeliveryTarget(params) {
44693
45018
  channel: resolvedTarget.channel,
44694
45019
  to: resolved.to,
44695
45020
  reason,
44696
- accountId: resolvedTarget.accountId,
45021
+ accountId: effectiveAccountId,
44697
45022
  lastChannel: resolvedTarget.lastChannel,
44698
45023
  lastAccountId: resolvedTarget.lastAccountId
44699
45024
  };
@@ -44718,9 +45043,10 @@ function resolveHeartbeatSenderId(params) {
44718
45043
  }
44719
45044
  function resolveHeartbeatSenderContext(params) {
44720
45045
  const provider = params.delivery.channel !== "none" ? params.delivery.channel : params.delivery.lastChannel;
45046
+ const accountId = params.delivery.accountId ?? (provider === params.delivery.lastChannel ? params.delivery.lastAccountId : void 0);
44721
45047
  const allowFrom = provider ? getChannelPlugin(provider)?.config.resolveAllowFrom?.({
44722
45048
  cfg: params.cfg,
44723
- accountId: provider === params.delivery.lastChannel ? params.delivery.lastAccountId : void 0
45049
+ accountId
44724
45050
  }) ?? [] : [];
44725
45051
  return {
44726
45052
  sender: resolveHeartbeatSenderId({
@@ -45810,6 +46136,24 @@ function resolveSlackAutoThreadId(params) {
45810
46136
  if (context.replyToMode === "first" && context.hasRepliedRef?.value) return;
45811
46137
  return context.currentThreadTs;
45812
46138
  }
46139
+ /**
46140
+ * Auto-inject Telegram forum topic thread ID when the message tool targets
46141
+ * the same chat the session originated from. Mirrors the Slack auto-threading
46142
+ * pattern so media, buttons, and other tool-sent messages land in the correct
46143
+ * topic instead of the General Topic.
46144
+ *
46145
+ * Unlike Slack, we do not gate on `replyToMode` here: Telegram forum topics
46146
+ * are persistent sub-channels (not ephemeral reply threads), so auto-injection
46147
+ * should always apply when the target chat matches.
46148
+ */
46149
+ function resolveTelegramAutoThreadId(params) {
46150
+ const context = params.toolContext;
46151
+ if (!context?.currentThreadTs || !context.currentChannelId) return;
46152
+ const parsedTo = parseTelegramTarget(params.to);
46153
+ const parsedChannel = parseTelegramTarget(context.currentChannelId);
46154
+ if (parsedTo.chatId.toLowerCase() !== parsedChannel.chatId.toLowerCase()) return;
46155
+ return context.currentThreadTs;
46156
+ }
45813
46157
  function resolveAttachmentMaxBytes(params) {
45814
46158
  const fallback = params.cfg.agents?.defaults?.mediaMaxMb;
45815
46159
  if (params.channel !== "bluebubbles") return typeof fallback === "number" ? fallback * 1024 * 1024 : void 0;
@@ -45858,6 +46202,42 @@ function normalizeBase64Payload(params) {
45858
46202
  contentType: params.contentType ?? mime
45859
46203
  };
45860
46204
  }
46205
+ async function normalizeSandboxMediaParams(params) {
46206
+ const sandboxRoot = params.sandboxRoot?.trim();
46207
+ for (const key of [
46208
+ "media",
46209
+ "path",
46210
+ "filePath"
46211
+ ]) {
46212
+ const raw = readStringParam(params.args, key, { trim: false });
46213
+ if (!raw) continue;
46214
+ assertMediaNotDataUrl(raw);
46215
+ if (!sandboxRoot) continue;
46216
+ const normalized = await resolveSandboxedMediaSource({
46217
+ media: raw,
46218
+ sandboxRoot
46219
+ });
46220
+ if (normalized !== raw) params.args[key] = normalized;
46221
+ }
46222
+ }
46223
+ async function normalizeSandboxMediaList(params) {
46224
+ const sandboxRoot = params.sandboxRoot?.trim();
46225
+ const normalized = [];
46226
+ const seen = /* @__PURE__ */ new Set();
46227
+ for (const value of params.values) {
46228
+ const raw = value?.trim();
46229
+ if (!raw) continue;
46230
+ assertMediaNotDataUrl(raw);
46231
+ const resolved = sandboxRoot ? await resolveSandboxedMediaSource({
46232
+ media: raw,
46233
+ sandboxRoot
46234
+ }) : raw;
46235
+ if (seen.has(resolved)) continue;
46236
+ seen.add(resolved);
46237
+ normalized.push(resolved);
46238
+ }
46239
+ return normalized;
46240
+ }
45861
46241
  async function hydrateSetGroupIconParams(params) {
45862
46242
  if (params.action !== "setGroupIcon") return;
45863
46243
  const mediaHint = readStringParam(params.args, "media", { trim: false });
@@ -46078,6 +46458,7 @@ async function handleSendAction(ctx) {
46078
46458
  required: !mediaHint && !hasCard,
46079
46459
  allowEmpty: true
46080
46460
  }) ?? "";
46461
+ if (message.includes("\\n")) message = message.replaceAll("\\n", "\n");
46081
46462
  const parsed = parseReplyDirectives(message);
46082
46463
  const mergedMediaUrls = [];
46083
46464
  const seenMedia = /* @__PURE__ */ new Set();
@@ -46091,6 +46472,12 @@ async function handleSendAction(ctx) {
46091
46472
  pushMedia(mediaHint);
46092
46473
  for (const url of parsed.mediaUrls ?? []) pushMedia(url);
46093
46474
  pushMedia(parsed.mediaUrl);
46475
+ const normalizedMediaUrls = await normalizeSandboxMediaList({
46476
+ values: mergedMediaUrls,
46477
+ sandboxRoot: input.sandboxRoot
46478
+ });
46479
+ mergedMediaUrls.length = 0;
46480
+ mergedMediaUrls.push(...normalizedMediaUrls);
46094
46481
  message = parsed.text;
46095
46482
  params.message = message;
46096
46483
  if (!params.replyTo && parsed.replyToId) params.replyTo = parsed.replyToId;
@@ -46115,6 +46502,12 @@ async function handleSendAction(ctx) {
46115
46502
  to,
46116
46503
  toolContext: input.toolContext
46117
46504
  }) : void 0;
46505
+ const telegramAutoThreadId = channel === "telegram" && !threadId ? resolveTelegramAutoThreadId({
46506
+ to,
46507
+ toolContext: input.toolContext
46508
+ }) : void 0;
46509
+ const resolvedThreadId = threadId ?? slackAutoThreadId ?? telegramAutoThreadId;
46510
+ if (resolvedThreadId && !params.threadId) params.threadId = resolvedThreadId;
46118
46511
  const outboundRoute = agentId && !dryRun ? await resolveOutboundSessionRoute({
46119
46512
  cfg,
46120
46513
  channel,
@@ -46123,7 +46516,7 @@ async function handleSendAction(ctx) {
46123
46516
  target: to,
46124
46517
  resolvedTarget,
46125
46518
  replyToId,
46126
- threadId: threadId ?? slackAutoThreadId
46519
+ threadId: resolvedThreadId
46127
46520
  }) : null;
46128
46521
  if (outboundRoute && agentId && !dryRun) await ensureOutboundSessionEntry({
46129
46522
  cfg,
@@ -46306,6 +46699,10 @@ async function runMessageAction(input) {
46306
46699
  const accountId = readStringParam(params, "accountId") ?? input.defaultAccountId;
46307
46700
  if (accountId) params.accountId = accountId;
46308
46701
  const dryRun = Boolean(input.dryRun ?? readBooleanParam(params, "dryRun"));
46702
+ await normalizeSandboxMediaParams({
46703
+ args: params,
46704
+ sandboxRoot: input.sandboxRoot
46705
+ });
46309
46706
  await hydrateSendAttachmentParams({
46310
46707
  cfg,
46311
46708
  channel,
@@ -46399,7 +46796,7 @@ function buildSendSchema(options) {
46399
46796
  message: Type.Optional(Type.String()),
46400
46797
  effectId: Type.Optional(Type.String({ description: "Message effect name/id for sendWithEffect (e.g., invisible ink)." })),
46401
46798
  effect: Type.Optional(Type.String({ description: "Alias for effectId (e.g., invisible-ink, balloons)." })),
46402
- media: Type.Optional(Type.String()),
46799
+ media: Type.Optional(Type.String({ description: "Media URL or local path. data: URLs are not supported here, use buffer." })),
46403
46800
  filename: Type.Optional(Type.String()),
46404
46801
  buffer: Type.Optional(Type.String({ description: "Base64 payload for attachments (optionally a data: URL)." })),
46405
46802
  contentType: Type.Optional(Type.String()),
@@ -46629,15 +47026,6 @@ function createMessageTool(options) {
46629
47026
  if (options?.requireExplicitTarget === true && actionNeedsExplicitTarget(action)) {
46630
47027
  if (!(typeof params.target === "string" && params.target.trim().length > 0 || typeof params.to === "string" && params.to.trim().length > 0 || typeof params.channelId === "string" && params.channelId.trim().length > 0 || Array.isArray(params.targets) && params.targets.some((value) => typeof value === "string" && value.trim().length > 0))) throw new Error("Explicit message target required for this run. Provide target/targets (and channel when needed).");
46631
47028
  }
46632
- const sandboxRoot = options?.sandboxRoot;
46633
- if (sandboxRoot) for (const key of ["filePath", "path"]) {
46634
- const raw = readStringParam(params, key, { trim: false });
46635
- if (raw) await assertSandboxPath({
46636
- filePath: raw,
46637
- cwd: sandboxRoot,
46638
- root: sandboxRoot
46639
- });
46640
- }
46641
47029
  const accountId = readStringParam(params, "accountId") ?? agentAccountId;
46642
47030
  if (accountId) params.accountId = accountId;
46643
47031
  const gateway = {
@@ -46667,6 +47055,7 @@ function createMessageTool(options) {
46667
47055
  sessionKey: options.agentSessionKey,
46668
47056
  config: cfg
46669
47057
  }) : void 0,
47058
+ sandboxRoot: options?.sandboxRoot,
46670
47059
  abortSignal: signal
46671
47060
  });
46672
47061
  const toolResult = getToolResult(result);
@@ -47119,7 +47508,7 @@ function archiveFileOnDisk(filePath, reason) {
47119
47508
  fs.renameSync(filePath, archived);
47120
47509
  return archived;
47121
47510
  }
47122
- function jsonUtf8Bytes(value) {
47511
+ function jsonUtf8Bytes$1(value) {
47123
47512
  try {
47124
47513
  return Buffer.byteLength(JSON.stringify(value), "utf8");
47125
47514
  } catch {
@@ -47131,7 +47520,7 @@ function capArrayByJsonBytes(items, maxBytes) {
47131
47520
  items,
47132
47521
  bytes: 2
47133
47522
  };
47134
- const parts = items.map((item) => jsonUtf8Bytes(item));
47523
+ const parts = items.map((item) => jsonUtf8Bytes$1(item));
47135
47524
  let bytes = 2 + parts.reduce((a, b) => a + b, 0) + (items.length - 1);
47136
47525
  let start = 0;
47137
47526
  while (bytes > maxBytes && start < items.length - 1) {
@@ -47248,22 +47637,10 @@ function extractPreviewText(message) {
47248
47637
  return null;
47249
47638
  }
47250
47639
  function isToolCall(message) {
47251
- if (message.toolName || message.tool_name) return true;
47252
- if (!Array.isArray(message.content)) return false;
47253
- return message.content.some((entry) => {
47254
- if (entry?.name) return true;
47255
- const raw = typeof entry?.type === "string" ? entry.type.toLowerCase() : "";
47256
- return raw === "toolcall" || raw === "tool_call";
47257
- });
47640
+ return hasToolCall(message);
47258
47641
  }
47259
47642
  function extractToolNames(message) {
47260
- const names = [];
47261
- if (Array.isArray(message.content)) {
47262
- for (const entry of message.content) if (typeof entry?.name === "string" && entry.name.trim()) names.push(entry.name.trim());
47263
- }
47264
- const toolName = typeof message.toolName === "string" ? message.toolName : message.tool_name;
47265
- if (typeof toolName === "string" && toolName.trim()) names.push(toolName.trim());
47266
- return names;
47643
+ return extractToolCallNames(message);
47267
47644
  }
47268
47645
  function extractMediaSummary(message) {
47269
47646
  if (!Array.isArray(message.content)) return null;
@@ -47643,8 +48020,11 @@ function getSessionDefaults(cfg) {
47643
48020
  contextTokens: contextTokens ?? null
47644
48021
  };
47645
48022
  }
47646
- function resolveSessionModelRef(cfg, entry) {
47647
- const resolved = resolveConfiguredModelRef({
48023
+ function resolveSessionModelRef(cfg, entry, agentId) {
48024
+ const resolved = agentId ? resolveDefaultModelForAgent({
48025
+ cfg,
48026
+ agentId
48027
+ }) : resolveConfiguredModelRef({
47648
48028
  cfg,
47649
48029
  defaultProvider: DEFAULT_PROVIDER,
47650
48030
  defaultModel: DEFAULT_MODEL
@@ -47712,6 +48092,9 @@ function listSessionsFromStore(params) {
47712
48092
  key
47713
48093
  }) : void 0) ?? entry?.label ?? originLabel;
47714
48094
  const deliveryFields = normalizeSessionDeliveryFields(entry);
48095
+ const resolvedModel = resolveSessionModelRef(cfg, entry, normalizeAgentId(parseAgentSessionKey(key)?.agentId ?? resolveDefaultAgentId(cfg)));
48096
+ const modelProvider = resolvedModel.provider ?? DEFAULT_PROVIDER;
48097
+ const model = resolvedModel.model ?? DEFAULT_MODEL;
47715
48098
  return {
47716
48099
  key,
47717
48100
  entry,
@@ -47737,8 +48120,8 @@ function listSessionsFromStore(params) {
47737
48120
  outputTokens: entry?.outputTokens,
47738
48121
  totalTokens: total,
47739
48122
  responseUsage: entry?.responseUsage,
47740
- modelProvider: entry?.modelProvider,
47741
- model: entry?.model,
48123
+ modelProvider,
48124
+ model,
47742
48125
  contextTokens: entry?.contextTokens,
47743
48126
  deliveryContext: deliveryFields.deliveryContext,
47744
48127
  lastChannel: deliveryFields.lastChannel ?? entry?.lastChannel,
@@ -48082,6 +48465,131 @@ const SessionsHistoryToolSchema = Type.Object({
48082
48465
  limit: Type.Optional(Type.Number({ minimum: 1 })),
48083
48466
  includeTools: Type.Optional(Type.Boolean())
48084
48467
  });
48468
+ const SESSIONS_HISTORY_MAX_BYTES = 80 * 1024;
48469
+ const SESSIONS_HISTORY_TEXT_MAX_CHARS = 4e3;
48470
+ function truncateHistoryText(text) {
48471
+ if (text.length <= SESSIONS_HISTORY_TEXT_MAX_CHARS) return {
48472
+ text,
48473
+ truncated: false
48474
+ };
48475
+ return {
48476
+ text: `${truncateUtf16Safe(text, SESSIONS_HISTORY_TEXT_MAX_CHARS)}\n…(truncated)…`,
48477
+ truncated: true
48478
+ };
48479
+ }
48480
+ function sanitizeHistoryContentBlock(block) {
48481
+ if (!block || typeof block !== "object") return {
48482
+ block,
48483
+ truncated: false
48484
+ };
48485
+ const entry = { ...block };
48486
+ let truncated = false;
48487
+ const type = typeof entry.type === "string" ? entry.type : "";
48488
+ if (typeof entry.text === "string") {
48489
+ const res = truncateHistoryText(entry.text);
48490
+ entry.text = res.text;
48491
+ truncated ||= res.truncated;
48492
+ }
48493
+ if (type === "thinking") {
48494
+ if (typeof entry.thinking === "string") {
48495
+ const res = truncateHistoryText(entry.thinking);
48496
+ entry.thinking = res.text;
48497
+ truncated ||= res.truncated;
48498
+ }
48499
+ if ("thinkingSignature" in entry) {
48500
+ delete entry.thinkingSignature;
48501
+ truncated = true;
48502
+ }
48503
+ }
48504
+ if (typeof entry.partialJson === "string") {
48505
+ const res = truncateHistoryText(entry.partialJson);
48506
+ entry.partialJson = res.text;
48507
+ truncated ||= res.truncated;
48508
+ }
48509
+ if (type === "image") {
48510
+ const data = typeof entry.data === "string" ? entry.data : void 0;
48511
+ const bytes = data ? data.length : void 0;
48512
+ if ("data" in entry) {
48513
+ delete entry.data;
48514
+ truncated = true;
48515
+ }
48516
+ entry.omitted = true;
48517
+ if (bytes !== void 0) entry.bytes = bytes;
48518
+ }
48519
+ return {
48520
+ block: entry,
48521
+ truncated
48522
+ };
48523
+ }
48524
+ function sanitizeHistoryMessage(message) {
48525
+ if (!message || typeof message !== "object") return {
48526
+ message,
48527
+ truncated: false
48528
+ };
48529
+ const entry = { ...message };
48530
+ let truncated = false;
48531
+ if ("details" in entry) {
48532
+ delete entry.details;
48533
+ truncated = true;
48534
+ }
48535
+ if ("usage" in entry) {
48536
+ delete entry.usage;
48537
+ truncated = true;
48538
+ }
48539
+ if ("cost" in entry) {
48540
+ delete entry.cost;
48541
+ truncated = true;
48542
+ }
48543
+ if (typeof entry.content === "string") {
48544
+ const res = truncateHistoryText(entry.content);
48545
+ entry.content = res.text;
48546
+ truncated ||= res.truncated;
48547
+ } else if (Array.isArray(entry.content)) {
48548
+ const updated = entry.content.map((block) => sanitizeHistoryContentBlock(block));
48549
+ entry.content = updated.map((item) => item.block);
48550
+ truncated ||= updated.some((item) => item.truncated);
48551
+ }
48552
+ if (typeof entry.text === "string") {
48553
+ const res = truncateHistoryText(entry.text);
48554
+ entry.text = res.text;
48555
+ truncated ||= res.truncated;
48556
+ }
48557
+ return {
48558
+ message: entry,
48559
+ truncated
48560
+ };
48561
+ }
48562
+ function jsonUtf8Bytes(value) {
48563
+ try {
48564
+ return Buffer.byteLength(JSON.stringify(value), "utf8");
48565
+ } catch {
48566
+ return Buffer.byteLength(String(value), "utf8");
48567
+ }
48568
+ }
48569
+ function enforceSessionsHistoryHardCap(params) {
48570
+ if (params.bytes <= params.maxBytes) return {
48571
+ items: params.items,
48572
+ bytes: params.bytes,
48573
+ hardCapped: false
48574
+ };
48575
+ const last = params.items.at(-1);
48576
+ const lastOnly = last ? [last] : [];
48577
+ const lastBytes = jsonUtf8Bytes(lastOnly);
48578
+ if (lastBytes <= params.maxBytes) return {
48579
+ items: lastOnly,
48580
+ bytes: lastBytes,
48581
+ hardCapped: true
48582
+ };
48583
+ const placeholder = [{
48584
+ role: "assistant",
48585
+ content: "[sessions_history omitted: message too large]"
48586
+ }];
48587
+ return {
48588
+ items: placeholder,
48589
+ bytes: jsonUtf8Bytes(placeholder),
48590
+ hardCapped: true
48591
+ };
48592
+ }
48085
48593
  function resolveSandboxSessionToolsVisibility$1(cfg) {
48086
48594
  return cfg.agents?.defaults?.sandbox?.sessionToolsVisibility ?? "spawned";
48087
48595
  }
@@ -48165,9 +48673,23 @@ function createSessionsHistoryTool(opts) {
48165
48673
  }
48166
48674
  });
48167
48675
  const rawMessages = Array.isArray(result?.messages) ? result.messages : [];
48676
+ const selectedMessages = includeTools ? rawMessages : stripToolMessages(rawMessages);
48677
+ const sanitizedMessages = selectedMessages.map((message) => sanitizeHistoryMessage(message));
48678
+ const contentTruncated = sanitizedMessages.some((entry) => entry.truncated);
48679
+ const cappedMessages = capArrayByJsonBytes(sanitizedMessages.map((entry) => entry.message), SESSIONS_HISTORY_MAX_BYTES);
48680
+ const droppedMessages = cappedMessages.items.length < selectedMessages.length;
48681
+ const hardened = enforceSessionsHistoryHardCap({
48682
+ items: cappedMessages.items,
48683
+ bytes: cappedMessages.bytes,
48684
+ maxBytes: SESSIONS_HISTORY_MAX_BYTES
48685
+ });
48168
48686
  return jsonResult({
48169
48687
  sessionKey: displayKey,
48170
- messages: includeTools ? rawMessages : stripToolMessages(rawMessages)
48688
+ messages: hardened.items,
48689
+ truncated: droppedMessages || contentTruncated || hardened.hardCapped,
48690
+ droppedMessages: droppedMessages || hardened.hardCapped,
48691
+ contentTruncated,
48692
+ bytes: hardened.bytes
48171
48693
  });
48172
48694
  }
48173
48695
  };
@@ -48974,6 +49496,9 @@ function createSessionsSpawnTool(opts) {
48974
49496
  message: task,
48975
49497
  sessionKey: childSessionKey,
48976
49498
  channel: requesterOrigin?.channel,
49499
+ to: requesterOrigin?.to ?? void 0,
49500
+ accountId: requesterOrigin?.accountId ?? void 0,
49501
+ threadId: requesterOrigin?.threadId != null ? String(requesterOrigin.threadId) : void 0,
48977
49502
  idempotencyKey: childIdem,
48978
49503
  deliver: false,
48979
49504
  lane: AGENT_LANE_SUBAGENT,
@@ -50826,7 +51351,7 @@ function createOpenClawCodingTools(options) {
50826
51351
  cwd: sandboxRoot ?? workspaceRoot,
50827
51352
  sandboxRoot: sandboxRoot && allowWorkspaceWrites ? sandboxRoot : void 0
50828
51353
  });
50829
- const tools = [
51354
+ const toolsByAuthorization = applyOwnerOnlyToolPolicy([
50830
51355
  ...base,
50831
51356
  ...sandboxRoot ? allowWorkspaceWrites ? [createSandboxedEditTool(sandboxRoot), createSandboxedWriteTool(sandboxRoot)] : [] : [],
50832
51357
  ...applyPatchTool ? [applyPatchTool] : [],
@@ -50869,10 +51394,10 @@ function createOpenClawCodingTools(options) {
50869
51394
  disableMessageTool: options?.disableMessageTool,
50870
51395
  requesterAgentIdOverride: agentId
50871
51396
  })
50872
- ];
50873
- const coreToolNames = new Set(tools.filter((tool) => !getPluginToolMeta(tool)).map((tool) => normalizeToolName(tool.name)).filter(Boolean));
51397
+ ], options?.senderIsOwner === true);
51398
+ const coreToolNames = new Set(toolsByAuthorization.filter((tool) => !getPluginToolMeta(tool)).map((tool) => normalizeToolName(tool.name)).filter(Boolean));
50874
51399
  const pluginGroups = buildPluginToolGroups({
50875
- tools,
51400
+ tools: toolsByAuthorization,
50876
51401
  toolMeta: (tool) => getPluginToolMeta(tool)
50877
51402
  });
50878
51403
  const resolvePolicy = (policy, label) => {
@@ -50889,7 +51414,7 @@ function createOpenClawCodingTools(options) {
50889
51414
  const groupPolicyExpanded = resolvePolicy(groupPolicy, "group tools.allow");
50890
51415
  const sandboxPolicyExpanded = expandPolicyWithPluginGroups(sandbox?.tools, pluginGroups);
50891
51416
  const subagentPolicyExpanded = expandPolicyWithPluginGroups(subagentPolicy, pluginGroups);
50892
- const toolsFiltered = profilePolicyExpanded ? filterToolsByPolicy(tools, profilePolicyExpanded) : tools;
51417
+ const toolsFiltered = profilePolicyExpanded ? filterToolsByPolicy(toolsByAuthorization, profilePolicyExpanded) : toolsByAuthorization;
50893
51418
  const providerProfileFiltered = providerProfileExpanded ? filterToolsByPolicy(toolsFiltered, providerProfileExpanded) : toolsFiltered;
50894
51419
  const globalFiltered = globalPolicyExpanded ? filterToolsByPolicy(providerProfileFiltered, globalPolicyExpanded) : providerProfileFiltered;
50895
51420
  const globalProviderFiltered = globalProviderExpanded ? filterToolsByPolicy(globalFiltered, globalProviderExpanded) : globalFiltered;
@@ -51130,7 +51655,13 @@ function repairToolUseResultPairing(messages) {
51130
51655
  }
51131
51656
  continue;
51132
51657
  }
51133
- const toolCalls = extractToolCallsFromAssistant(msg);
51658
+ const assistant = msg;
51659
+ const stopReason = assistant.stopReason;
51660
+ if (stopReason === "error" || stopReason === "aborted") {
51661
+ out.push(msg);
51662
+ continue;
51663
+ }
51664
+ const toolCalls = extractToolCallsFromAssistant(assistant);
51134
51665
  if (toolCalls.length === 0) {
51135
51666
  out.push(msg);
51136
51667
  continue;
@@ -52339,7 +52870,7 @@ async function compactEmbeddedPiSessionDirect(params) {
52339
52870
  if (!apiKeyInfo.apiKey) {
52340
52871
  if (apiKeyInfo.mode !== "aws-sdk") throw new Error(`No API key resolved for provider "${model.provider}" (auth mode: ${apiKeyInfo.mode}).`);
52341
52872
  } else if (model.provider === "github-copilot") {
52342
- const { resolveCopilotApiToken } = await import("./github-copilot-token-B_uWT0Yi.js");
52873
+ const { resolveCopilotApiToken } = await import("./github-copilot-token-pGSmVaW-.js").then((n) => n.n);
52343
52874
  const copilotToken = await resolveCopilotApiToken({ githubToken: apiKeyInfo.apiKey });
52344
52875
  authStorage.setRuntimeApiKey(model.provider, copilotToken.token);
52345
52876
  } else authStorage.setRuntimeApiKey(model.provider, apiKeyInfo.apiKey);
@@ -52408,6 +52939,7 @@ async function compactEmbeddedPiSessionDirect(params) {
52408
52939
  groupChannel: params.groupChannel,
52409
52940
  groupSpace: params.groupSpace,
52410
52941
  spawnedBy: params.spawnedBy,
52942
+ senderIsOwner: params.senderIsOwner,
52411
52943
  agentDir,
52412
52944
  workspaceDir: effectiveWorkspace,
52413
52945
  config: params.config,
@@ -53460,6 +53992,7 @@ function handleMessageUpdate(ctx, evt) {
53460
53992
  mediaUrls: hasMedia ? mediaUrls : void 0
53461
53993
  }
53462
53994
  });
53995
+ ctx.state.emittedAssistantUpdate = true;
53463
53996
  if (ctx.params.onPartialReply && ctx.state.shouldEmitPartialReplies) ctx.params.onPartialReply({
53464
53997
  text: cleanedText,
53465
53998
  mediaUrls: hasMedia ? mediaUrls : void 0
@@ -53503,6 +54036,41 @@ function handleMessageEnd(ctx, evt) {
53503
54036
  });
53504
54037
  const rawThinking = ctx.state.includeReasoning || ctx.state.streamReasoning ? extractAssistantThinking(assistantMessage) || extractThinkingFromTaggedText(rawText) : "";
53505
54038
  const formattedReasoning = rawThinking ? formatReasoningMessage(rawThinking) : "";
54039
+ const trimmedText = text.trim();
54040
+ const parsedText = trimmedText ? parseReplyDirectives(stripTrailingDirective(trimmedText)) : null;
54041
+ let cleanedText = parsedText?.text ?? "";
54042
+ let mediaUrls = parsedText?.mediaUrls;
54043
+ let hasMedia = Boolean(mediaUrls && mediaUrls.length > 0);
54044
+ if (!cleanedText && !hasMedia) {
54045
+ const rawTrimmed = rawText.trim();
54046
+ const rawCandidate = rawTrimmed.replace(/<\s*\/?\s*final\s*>/gi, "").trim() || rawTrimmed;
54047
+ if (rawCandidate) {
54048
+ const parsedFallback = parseReplyDirectives(stripTrailingDirective(rawCandidate));
54049
+ cleanedText = parsedFallback.text ?? rawCandidate;
54050
+ mediaUrls = parsedFallback.mediaUrls;
54051
+ hasMedia = Boolean(mediaUrls && mediaUrls.length > 0);
54052
+ }
54053
+ }
54054
+ if (!ctx.state.emittedAssistantUpdate && (cleanedText || hasMedia)) {
54055
+ emitAgentEvent({
54056
+ runId: ctx.params.runId,
54057
+ stream: "assistant",
54058
+ data: {
54059
+ text: cleanedText,
54060
+ delta: cleanedText,
54061
+ mediaUrls: hasMedia ? mediaUrls : void 0
54062
+ }
54063
+ });
54064
+ ctx.params.onAgentEvent?.({
54065
+ stream: "assistant",
54066
+ data: {
54067
+ text: cleanedText,
54068
+ delta: cleanedText,
54069
+ mediaUrls: hasMedia ? mediaUrls : void 0
54070
+ }
54071
+ });
54072
+ ctx.state.emittedAssistantUpdate = true;
54073
+ }
53506
54074
  const addedDuringMessage = ctx.state.assistantTexts.length > ctx.state.assistantTextBaseline;
53507
54075
  const chunkerHasBuffered = ctx.blockChunker?.hasBuffered() ?? false;
53508
54076
  ctx.finalizeAssistantTexts({
@@ -53955,6 +54523,7 @@ function subscribeEmbeddedPiSession(params) {
53955
54523
  },
53956
54524
  lastStreamedAssistant: void 0,
53957
54525
  lastStreamedAssistantCleaned: void 0,
54526
+ emittedAssistantUpdate: false,
53958
54527
  lastStreamedReasoning: void 0,
53959
54528
  lastBlockReplyText: void 0,
53960
54529
  assistantMessageIndex: 0,
@@ -53999,6 +54568,7 @@ function subscribeEmbeddedPiSession(params) {
53999
54568
  state.partialBlockState.inlineCode = createInlineCodeState();
54000
54569
  state.lastStreamedAssistant = void 0;
54001
54570
  state.lastStreamedAssistantCleaned = void 0;
54571
+ state.emittedAssistantUpdate = false;
54002
54572
  state.lastBlockReplyText = void 0;
54003
54573
  state.lastStreamedReasoning = void 0;
54004
54574
  state.lastReasoningSent = void 0;
@@ -54779,6 +55349,7 @@ async function runEmbeddedAttempt(params) {
54779
55349
  senderName: params.senderName,
54780
55350
  senderUsername: params.senderUsername,
54781
55351
  senderE164: params.senderE164,
55352
+ senderIsOwner: params.senderIsOwner,
54782
55353
  sessionKey: params.sessionKey ?? params.sessionId,
54783
55354
  agentDir,
54784
55355
  workspaceDir: effectiveWorkspace,
@@ -55486,7 +56057,7 @@ async function runEmbeddedPiAgent(params) {
55486
56057
  return;
55487
56058
  }
55488
56059
  if (model.provider === "github-copilot") {
55489
- const { resolveCopilotApiToken } = await import("./github-copilot-token-B_uWT0Yi.js");
56060
+ const { resolveCopilotApiToken } = await import("./github-copilot-token-pGSmVaW-.js").then((n) => n.n);
55490
56061
  const copilotToken = await resolveCopilotApiToken({ githubToken: apiKeyInfo.apiKey });
55491
56062
  authStorage.setRuntimeApiKey(model.provider, copilotToken.token);
55492
56063
  } else authStorage.setRuntimeApiKey(model.provider, apiKeyInfo.apiKey);
@@ -55536,7 +56107,8 @@ async function runEmbeddedPiAgent(params) {
55536
56107
  error: err
55537
56108
  });
55538
56109
  }
55539
- let overflowCompactionAttempted = false;
56110
+ const MAX_OVERFLOW_COMPACTION_ATTEMPTS = 3;
56111
+ let overflowCompactionAttempts = 0;
55540
56112
  try {
55541
56113
  while (true) {
55542
56114
  attemptedThinking.add(thinkLevel);
@@ -55554,6 +56126,7 @@ async function runEmbeddedPiAgent(params) {
55554
56126
  groupChannel: params.groupChannel,
55555
56127
  groupSpace: params.groupSpace,
55556
56128
  spawnedBy: params.spawnedBy,
56129
+ senderIsOwner: params.senderIsOwner,
55557
56130
  currentChannelId: params.currentChannelId,
55558
56131
  currentThreadTs: params.currentThreadTs,
55559
56132
  replyToMode: params.replyToMode,
@@ -55600,10 +56173,12 @@ async function runEmbeddedPiAgent(params) {
55600
56173
  if (promptError && !aborted) {
55601
56174
  const errorText = describeUnknownError(promptError);
55602
56175
  if (isContextOverflowError(errorText)) {
56176
+ const msgCount = attempt.messagesSnapshot?.length ?? 0;
56177
+ log$3.warn(`[context-overflow-diag] sessionKey=${params.sessionKey ?? params.sessionId} provider=${provider}/${modelId} messages=${msgCount} sessionFile=${params.sessionFile} compactionAttempts=${overflowCompactionAttempts} error=${errorText.slice(0, 200)}`);
55603
56178
  const isCompactionFailure = isCompactionFailureError(errorText);
55604
- if (!isCompactionFailure && !overflowCompactionAttempted) {
55605
- log$3.warn(`context overflow detected; attempting auto-compaction for ${provider}/${modelId}`);
55606
- overflowCompactionAttempted = true;
56179
+ if (!isCompactionFailure && overflowCompactionAttempts < MAX_OVERFLOW_COMPACTION_ATTEMPTS) {
56180
+ overflowCompactionAttempts++;
56181
+ log$3.warn(`context overflow detected (attempt ${overflowCompactionAttempts}/${MAX_OVERFLOW_COMPACTION_ATTEMPTS}); attempting auto-compaction for ${provider}/${modelId}`);
55607
56182
  const compactResult = await compactEmbeddedPiSessionDirect({
55608
56183
  sessionId: params.sessionId,
55609
56184
  sessionKey: params.sessionKey,
@@ -55616,6 +56191,7 @@ async function runEmbeddedPiAgent(params) {
55616
56191
  agentDir,
55617
56192
  config: params.config,
55618
56193
  skillsSnapshot: params.skillsSnapshot,
56194
+ senderIsOwner: params.senderIsOwner,
55619
56195
  provider,
55620
56196
  model: modelId,
55621
56197
  thinkLevel,
@@ -55732,6 +56308,7 @@ async function runEmbeddedPiAgent(params) {
55732
56308
  }
55733
56309
  const authFailure = isAuthAssistantError(lastAssistant);
55734
56310
  const rateLimitFailure = isRateLimitAssistantError(lastAssistant);
56311
+ const billingFailure = isBillingAssistantError(lastAssistant);
55735
56312
  const failoverFailure = isFailoverAssistantError(lastAssistant);
55736
56313
  const assistantFailoverReason = classifyFailoverReason(lastAssistant?.errorMessage ?? "");
55737
56314
  const cloudCodeAssistFormatError = attempt.cloudCodeAssistFormatError;
@@ -55761,7 +56338,7 @@ async function runEmbeddedPiAgent(params) {
55761
56338
  const message = (lastAssistant ? formatAssistantErrorText(lastAssistant, {
55762
56339
  cfg: params.config,
55763
56340
  sessionKey: params.sessionKey ?? params.sessionId
55764
- }) : void 0) || lastAssistant?.errorMessage?.trim() || (timedOut ? "LLM request timed out." : rateLimitFailure ? "LLM request rate limited." : authFailure ? "LLM request unauthorized." : "LLM request failed.");
56341
+ }) : void 0) || lastAssistant?.errorMessage?.trim() || (timedOut ? "LLM request timed out." : rateLimitFailure ? "LLM request rate limited." : billingFailure ? BILLING_ERROR_USER_MESSAGE : authFailure ? "LLM request unauthorized." : "LLM request failed.");
55765
56342
  const status = resolveFailoverStatus(assistantFailoverReason ?? "unknown") ?? (isTimeoutErrorMessage(message) ? 408 : void 0);
55766
56343
  throw new FailoverError(message, {
55767
56344
  reason: assistantFailoverReason ?? "unknown",
@@ -56667,6 +57244,7 @@ function buildCommandContext(params) {
56667
57244
  channel,
56668
57245
  channelId: auth.providerId,
56669
57246
  ownerList: auth.ownerList,
57247
+ senderIsOwner: auth.senderIsOwner,
56670
57248
  isAuthorizedSender: auth.isAuthorizedSender,
56671
57249
  senderId: auth.senderId,
56672
57250
  abortKey,
@@ -57861,6 +58439,7 @@ const handleCompactCommand = async (params) => {
57861
58439
  defaultLevel: "off"
57862
58440
  },
57863
58441
  customInstructions,
58442
+ senderIsOwner: params.command.senderIsOwner,
57864
58443
  ownerNumbers: params.command.ownerList.length > 0 ? params.command.ownerList : void 0
57865
58444
  });
57866
58445
  const compactLabel = result.ok ? result.compacted ? result.result?.tokensBefore != null && result.result?.tokensAfter != null ? `Compacted (${formatTokenCount(result.result.tokensBefore)} → ${formatTokenCount(result.result.tokensAfter)})` : result.result?.tokensBefore ? `Compacted (${formatTokenCount(result.result.tokensBefore)} before)` : "Compacted" : "Compaction skipped" : "Compaction failed";
@@ -58225,165 +58804,6 @@ const handlePluginCommand = async (params, allowTextCommands) => {
58225
58804
  };
58226
58805
  };
58227
58806
 
58228
- //#endregion
58229
- //#region src/infra/session-cost-usage.ts
58230
- const emptyTotals = () => ({
58231
- input: 0,
58232
- output: 0,
58233
- cacheRead: 0,
58234
- cacheWrite: 0,
58235
- totalTokens: 0,
58236
- totalCost: 0,
58237
- missingCostEntries: 0
58238
- });
58239
- const toFiniteNumber = (value) => {
58240
- if (typeof value !== "number") return;
58241
- if (!Number.isFinite(value)) return;
58242
- return value;
58243
- };
58244
- const extractCostTotal = (usageRaw) => {
58245
- if (!usageRaw || typeof usageRaw !== "object") return;
58246
- const cost = usageRaw.cost;
58247
- const total = toFiniteNumber(cost?.total);
58248
- if (total === void 0) return;
58249
- if (total < 0) return;
58250
- return total;
58251
- };
58252
- const parseTimestamp = (entry) => {
58253
- const raw = entry.timestamp;
58254
- if (typeof raw === "string") {
58255
- const parsed = new Date(raw);
58256
- if (!Number.isNaN(parsed.valueOf())) return parsed;
58257
- }
58258
- const message = entry.message;
58259
- const messageTimestamp = toFiniteNumber(message?.timestamp);
58260
- if (messageTimestamp !== void 0) {
58261
- const parsed = new Date(messageTimestamp);
58262
- if (!Number.isNaN(parsed.valueOf())) return parsed;
58263
- }
58264
- };
58265
- const parseUsageEntry = (entry) => {
58266
- const message = entry.message;
58267
- if (message?.role !== "assistant") return null;
58268
- const usageRaw = message?.usage ?? entry.usage;
58269
- const usage = normalizeUsage(usageRaw);
58270
- if (!usage) return null;
58271
- const provider = (typeof message?.provider === "string" ? message?.provider : void 0) ?? (typeof entry.provider === "string" ? entry.provider : void 0);
58272
- const model = (typeof message?.model === "string" ? message?.model : void 0) ?? (typeof entry.model === "string" ? entry.model : void 0);
58273
- return {
58274
- usage,
58275
- costTotal: extractCostTotal(usageRaw),
58276
- provider,
58277
- model,
58278
- timestamp: parseTimestamp(entry)
58279
- };
58280
- };
58281
- const formatDayKey = (date) => date.toLocaleDateString("en-CA", { timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone });
58282
- const applyUsageTotals = (totals, usage) => {
58283
- totals.input += usage.input ?? 0;
58284
- totals.output += usage.output ?? 0;
58285
- totals.cacheRead += usage.cacheRead ?? 0;
58286
- totals.cacheWrite += usage.cacheWrite ?? 0;
58287
- const totalTokens = usage.total ?? (usage.input ?? 0) + (usage.output ?? 0) + (usage.cacheRead ?? 0) + (usage.cacheWrite ?? 0);
58288
- totals.totalTokens += totalTokens;
58289
- };
58290
- const applyCostTotal = (totals, costTotal) => {
58291
- if (costTotal === void 0) {
58292
- totals.missingCostEntries += 1;
58293
- return;
58294
- }
58295
- totals.totalCost += costTotal;
58296
- };
58297
- async function scanUsageFile(params) {
58298
- const fileStream = fs.createReadStream(params.filePath, { encoding: "utf-8" });
58299
- const rl = readline.createInterface({
58300
- input: fileStream,
58301
- crlfDelay: Infinity
58302
- });
58303
- for await (const line of rl) {
58304
- const trimmed = line.trim();
58305
- if (!trimmed) continue;
58306
- try {
58307
- const entry = parseUsageEntry(JSON.parse(trimmed));
58308
- if (!entry) continue;
58309
- if (entry.costTotal === void 0) {
58310
- const cost = resolveModelCostConfig({
58311
- provider: entry.provider,
58312
- model: entry.model,
58313
- config: params.config
58314
- });
58315
- entry.costTotal = estimateUsageCost({
58316
- usage: entry.usage,
58317
- cost
58318
- });
58319
- }
58320
- params.onEntry(entry);
58321
- } catch {}
58322
- }
58323
- }
58324
- async function loadCostUsageSummary(params) {
58325
- const days = Math.max(1, Math.floor(params?.days ?? 30));
58326
- const now = /* @__PURE__ */ new Date();
58327
- const since = new Date(now);
58328
- since.setDate(since.getDate() - (days - 1));
58329
- const sinceTime = since.getTime();
58330
- const dailyMap = /* @__PURE__ */ new Map();
58331
- const totals = emptyTotals();
58332
- const sessionsDir = resolveSessionTranscriptsDirForAgent(params?.agentId);
58333
- const entries = await fs.promises.readdir(sessionsDir, { withFileTypes: true }).catch(() => []);
58334
- const files = (await Promise.all(entries.filter((entry) => entry.isFile() && entry.name.endsWith(".jsonl")).map(async (entry) => {
58335
- const filePath = path.join(sessionsDir, entry.name);
58336
- const stats = await fs.promises.stat(filePath).catch(() => null);
58337
- if (!stats) return null;
58338
- if (stats.mtimeMs < sinceTime) return null;
58339
- return filePath;
58340
- }))).filter((filePath) => Boolean(filePath));
58341
- for (const filePath of files) await scanUsageFile({
58342
- filePath,
58343
- config: params?.config,
58344
- onEntry: (entry) => {
58345
- const ts = entry.timestamp?.getTime();
58346
- if (!ts || ts < sinceTime) return;
58347
- const dayKey = formatDayKey(entry.timestamp ?? now);
58348
- const bucket = dailyMap.get(dayKey) ?? emptyTotals();
58349
- applyUsageTotals(bucket, entry.usage);
58350
- applyCostTotal(bucket, entry.costTotal);
58351
- dailyMap.set(dayKey, bucket);
58352
- applyUsageTotals(totals, entry.usage);
58353
- applyCostTotal(totals, entry.costTotal);
58354
- }
58355
- });
58356
- const daily = Array.from(dailyMap.entries()).map(([date, bucket]) => Object.assign({ date }, bucket)).toSorted((a, b) => a.date.localeCompare(b.date));
58357
- return {
58358
- updatedAt: Date.now(),
58359
- days,
58360
- daily,
58361
- totals
58362
- };
58363
- }
58364
- async function loadSessionCostSummary(params) {
58365
- const sessionFile = params.sessionFile ?? (params.sessionId ? resolveSessionFilePath(params.sessionId, params.sessionEntry) : void 0);
58366
- if (!sessionFile || !fs.existsSync(sessionFile)) return null;
58367
- const totals = emptyTotals();
58368
- let lastActivity;
58369
- await scanUsageFile({
58370
- filePath: sessionFile,
58371
- config: params.config,
58372
- onEntry: (entry) => {
58373
- applyUsageTotals(totals, entry.usage);
58374
- applyCostTotal(totals, entry.costTotal);
58375
- const ts = entry.timestamp?.getTime();
58376
- if (ts && (!lastActivity || ts > lastActivity)) lastActivity = ts;
58377
- }
58378
- });
58379
- return {
58380
- sessionId: params.sessionId,
58381
- sessionFile,
58382
- lastActivity,
58383
- ...totals
58384
- };
58385
- }
58386
-
58387
58807
  //#endregion
58388
58808
  //#region src/auto-reply/send-policy.ts
58389
58809
  function normalizeSendPolicyOverride(raw) {
@@ -60314,8 +60734,10 @@ const DEFAULT_CLAUDE_BACKEND = {
60314
60734
  modelArg: "--model",
60315
60735
  modelAliases: {
60316
60736
  opus: "opus",
60737
+ "opus-4.6": "opus",
60317
60738
  "opus-4.5": "opus",
60318
60739
  "opus-4": "opus",
60740
+ "claude-opus-4-6": "opus",
60319
60741
  "claude-opus-4-5": "opus",
60320
60742
  "claude-opus-4": "opus",
60321
60743
  sonnet: "sonnet",
@@ -62808,6 +63230,7 @@ async function runPreparedReply(params) {
62808
63230
  senderName: sessionCtx.SenderName?.trim() || void 0,
62809
63231
  senderUsername: sessionCtx.SenderUsername?.trim() || void 0,
62810
63232
  senderE164: sessionCtx.SenderE164?.trim() || void 0,
63233
+ senderIsOwner: command.senderIsOwner,
62811
63234
  sessionFile,
62812
63235
  workspaceDir,
62813
63236
  config: cfg,
@@ -63180,11 +63603,13 @@ async function initSessionState(params) {
63180
63603
  if (threadLabel) sessionEntry.displayName = threadLabel;
63181
63604
  const parentSessionKey = ctx.ParentSessionKey?.trim();
63182
63605
  if (isNewSession && parentSessionKey && parentSessionKey !== sessionKey && sessionStore[parentSessionKey]) {
63606
+ console.warn(`[session-init] forking from parent session: parentKey=${parentSessionKey} → sessionKey=${sessionKey} parentTokens=${sessionStore[parentSessionKey].totalTokens ?? "?"}`);
63183
63607
  const forked = forkSessionFromParent({ parentEntry: sessionStore[parentSessionKey] });
63184
63608
  if (forked) {
63185
63609
  sessionId = forked.sessionId;
63186
63610
  sessionEntry.sessionId = forked.sessionId;
63187
63611
  sessionEntry.sessionFile = forked.sessionFile;
63612
+ console.warn(`[session-init] forked session created: file=${forked.sessionFile}`);
63188
63613
  }
63189
63614
  }
63190
63615
  if (!sessionEntry.sessionFile) sessionEntry.sessionFile = resolveSessionTranscriptPath(sessionEntry.sessionId, agentId, ctx.MessageThreadId);
@@ -63192,6 +63617,10 @@ async function initSessionState(params) {
63192
63617
  sessionEntry.compactionCount = 0;
63193
63618
  sessionEntry.memoryFlushCompactionCount = void 0;
63194
63619
  sessionEntry.memoryFlushAt = void 0;
63620
+ sessionEntry.totalTokens = void 0;
63621
+ sessionEntry.inputTokens = void 0;
63622
+ sessionEntry.outputTokens = void 0;
63623
+ sessionEntry.contextTokens = void 0;
63195
63624
  }
63196
63625
  sessionStore[sessionKey] = {
63197
63626
  ...sessionStore[sessionKey],
@@ -63690,4 +64119,4 @@ async function getReplyFromConfig(ctx, opts, configOverride) {
63690
64119
  }
63691
64120
 
63692
64121
  //#endregion
63693
- export { formatUsageReportLines as $, setCommandLaneConcurrency as $n, waitForever as $t, resolveHeartbeatSenderContext as A, resolveEffectiveMessagesConfig as An, normalizeMimeList as Ar, recordRemoteNodeInfo as At, isGatewaySigusr1RestartExternallyAllowed as B, OPENAI_TTS_VOICES as Bn, verifyNodeToken as Bt, readSessionPreviewItemsFromTranscript as C, registerAgentRunContext as Cn, DEFAULT_INPUT_MAX_REDIRECTS as Cr, waitForGatewayReachable as Ct, ensureOutboundSessionEntry as D, createSlackWebClient as Dn, DEFAULT_INPUT_TIMEOUT_MS as Dr, resolveAssistantAvatarUrl as Dt, runMessageAction as E, sendMessageSlack as En, DEFAULT_INPUT_PDF_MIN_TEXT_CHARS as Er, normalizeControlUiBasePath as Et, CHANNEL_MESSAGE_ACTION_NAMES as F, clearInternalHooks as Fn, listNodePairing as Ft, migrateLegacyCronPayload as G, resolveTtsAutoMode as Gn, getHookType as Gt, setGatewaySigusr1RestartPolicy as H, isTtsEnabled as Hn, registerSkillsChangeListener as Ht, runWithModelFallback as I, createInternalHookEvent as In, rejectNodePairing as It, requestHeartbeatNow as J, resolveTtsProviderOrder as Jn, runMemoryStatus as Jt, CHANNEL_TARGETS_DESCRIPTION as K, resolveTtsConfig as Kn, isExternalHookSession as Kt, describeFailoverError as L, registerInternalHook as Ln, renamePairedNode as Lt, resolveSessionDeliveryTarget as M, formatUserTime as Mn, resolveAgentTimeoutMs as Mr, refreshRemoteNodeBins as Mt, formatTargetDisplay as N, resolveUserTimeFormat as Nn, setSkillsRemoteRegistry as Nt, resolveOutboundSessionRoute as O, getMemorySearchManager as On, extractFileContentFromSource as Or, getRemoteSkillEligibility as Ot, resetDirectoryCache as P, resolveUserTimezone as Pn, approveNodePairing as Pt, loadProviderUsageSummary as Q, getQueueSize as Qn, registerUnhandledRejectionHandler as Qt, authorizeGatewaySigusr1Restart as R, triggerInternalHook as Rn, requestNodePairing as Rt, readSessionMessages as S, onAgentEvent as Sn, DEFAULT_INPUT_IMAGE_MIMES as Sr, summarizeExistingConfig as St, stripEnvelopeFromMessages as T, normalizePollInput as Tn, DEFAULT_INPUT_PDF_MAX_PIXELS as Tr, buildControlUiAvatarUrl as Tt, normalizeCronJobCreate as U, isTtsProviderConfigured as Un, buildSafeExternalPrompt as Ut, scheduleGatewaySigusr1Restart as V, getTtsProvider as Vn, getSkillsSnapshotVersion as Vt, normalizeCronJobPatch as W, resolveTtsApiKey as Wn, detectSuspiciousPatterns as Wt, getPluginToolMeta as X, setTtsProvider as Xn, normalizeGroupActivation as Xt, setHeartbeatWakeHandler as Y, setTtsEnabled as Yn, monitorWebChannel as Yt, loadOpenClawPlugins as Z, textToSpeech as Zn, installUnhandledRejectionHandler as Zt, loadSessionEntry as _, initSubagentRegistry as _n, loadModelCatalog as _r, printWizardHeader as _t, loadCostUsageSummary as a, resolveIndicatorType as an, DEFAULT_HEARTBEAT_EVERY as ar, sendMessageIMessage as at, archiveFileOnDisk as b, emitAgentEvent as bn, DEFAULT_INPUT_FILE_MIMES as br, resolveControlUiLinks as bt, clearSessionQueues as c, getChannelActivity as cn, stripHeartbeatToken as cr, detectBinary as ct, waitForEmbeddedPiRunEnd as d, dispatchInboundMessage as dn, applyModelOverrideToSessionEntry as dr, formatControlUiSshHint as dt, buildHistoryContextFromEntries as en, CommandLane as er, formatUsageWindowSummary as et, createOpenClawTools as f, createReplyDispatcher as fn, applyVerboseOverride as fr, guardCancel as ft, loadCombinedSessionStoreForGateway as g, stopSubagentsForRequester as gn, peekSystemEvents as gr, openUrl as gt, listSessionsFromStore as h, isAbortTrigger as hn, isSystemEventContextChanged as hr, normalizeGatewayTokenInput as ht, runCliAgent as i, onHeartbeatEvent as in, DEFAULT_HEARTBEAT_ACK_MAX_CHARS as ir, handleSlackHttpRequest as it, resolveOutboundTarget as j, resolveIdentityName as jn, applyTemplate as jr, refreshRemoteBinsForConnectedNodes as jt, resolveHeartbeatDeliveryTarget as k, resolveAgentIdentity as kn, extractImageContentFromSource as kr, primeRemoteSkillsCache as kt, runEmbeddedPiAgent as l, parseDiscordTarget as ln, lookupContextTokens as lr, detectBrowserOpenSupport as lt, listAgentsForGateway as m, formatZonedTimestamp as mn, enqueueSystemEvent as mr, moveToTrash as mt, getCliSessionId as n, emitHeartbeatEvent as nn, stopDiagnosticHeartbeat as nr, resolveCommitHash as nt, normalizeSendPolicy as o, sendMessageTelegram as on, isHeartbeatContentEffectivelyEmpty as or, DEFAULT_WORKSPACE as ot, resolveAnnounceTargetFromKey as p, extractShortModelName as pn, parseVerboseOverride as pr, handleReset as pt, CHANNEL_TARGET_DESCRIPTION as q, resolveTtsPrefsPath as qn, registerMemoryCli as qt, setCliSessionId as r, getLastHeartbeatEvent as rn, isDiagnosticsEnabled as rr, hasNonzeroUsage as rt, resolveSendPolicy as s, sendMessageDiscord as sn, resolveHeartbeatPrompt as sr, applyWizardMetadata as st, getReplyFromConfig as t, resolveHeartbeatVisibility as tn, startDiagnosticHeartbeat as tr, resolveUsageProviderId as tt, abortEmbeddedPiRun as u, fetchChannelPermissionsDiscord as un, clearSessionAuthProfileOverride as ur, ensureWorkspaceAndSessions as ut, resolveGatewaySessionStoreTarget as v, AGENT_LANE_NESTED as vn, DEFAULT_INPUT_FILE_MAX_BYTES as vr, probeGatewayReachable as vt, resolveSessionTranscriptCandidates as w, sendMessageWhatsApp as wn, DEFAULT_INPUT_PDF_MAX_PAGES as wr, CONTROL_UI_AVATAR_PREFIX as wt, capArrayByJsonBytes as x, getAgentRunContext as xn, DEFAULT_INPUT_IMAGE_MAX_BYTES as xr, resolveNodeManagerOptions as xt, resolveSessionModelRef as y, clearAgentRunContext as yn, DEFAULT_INPUT_FILE_MAX_CHARS as yr, randomToken as yt, consumeGatewaySigusr1RestartAuthorization as z, OPENAI_TTS_MODELS as zn, updatePairedNodeMetadata as zt };
64122
+ export { CHANNEL_TARGET_DESCRIPTION as $, setTtsEnabled as $n, runMemoryStatus as $t, resolveOutboundTarget as A, normalizePollInput as An, DEFAULT_INPUT_PDF_MIN_TEXT_CHARS as Ar, buildControlUiAvatarUrl as At, scheduleGatewaySigusr1Restart as B, createInternalHookEvent as Bn, listNodePairing as Bt, resolveSessionTranscriptCandidates as C, AGENT_LANE_NESTED as Cn, DEFAULT_INPUT_FILE_MAX_CHARS as Cr, probeGatewayReachable as Ct, resolveOutboundSessionRoute as D, onAgentEvent as Dn, DEFAULT_INPUT_MAX_REDIRECTS as Dr, summarizeExistingConfig as Dt, ensureOutboundSessionEntry as E, getAgentRunContext as En, DEFAULT_INPUT_IMAGE_MIMES as Er, resolveNodeManagerOptions as Et, runWithModelFallback as F, resolveEffectiveMessagesConfig as Fn, applyTemplate as Fr, recordRemoteNodeInfo as Ft, readRestartSentinel as G, getTtsProvider as Gn, verifyNodeToken as Gt, consumeRestartSentinel as H, triggerInternalHook as Hn, renamePairedNode as Ht, describeFailoverError as I, formatUserTime as In, resolveAgentTimeoutMs as Ir, refreshRemoteBinsForConnectedNodes as It, writeRestartSentinel as J, resolveTtsApiKey as Jn, buildSafeExternalPrompt as Jt, summarizeRestartSentinel as K, isTtsEnabled as Kn, getSkillsSnapshotVersion as Kt, authorizeGatewaySigusr1Restart as L, resolveUserTimeFormat as Ln, refreshRemoteNodeBins as Lt, formatTargetDisplay as M, createSlackWebClient as Mn, extractFileContentFromSource as Mr, resolveAssistantAvatarUrl as Mt, resetDirectoryCache as N, getMemorySearchManager as Nn, extractImageContentFromSource as Nr, getRemoteSkillEligibility as Nt, resolveHeartbeatDeliveryTarget as O, registerAgentRunContext as On, DEFAULT_INPUT_PDF_MAX_PAGES as Or, waitForGatewayReachable as Ot, CHANNEL_MESSAGE_ACTION_NAMES as P, resolveAgentIdentity as Pn, normalizeMimeList as Pr, primeRemoteSkillsCache as Pt, CHANNEL_TARGETS_DESCRIPTION as Q, resolveTtsProviderOrder as Qn, registerMemoryCli as Qt, consumeGatewaySigusr1RestartAuthorization as R, resolveUserTimezone as Rn, setSkillsRemoteRegistry as Rt, readSessionPreviewItemsFromTranscript as S, initSubagentRegistry as Sn, DEFAULT_INPUT_FILE_MAX_BYTES as Sr, printWizardHeader as St, runMessageAction as T, emitAgentEvent as Tn, DEFAULT_INPUT_IMAGE_MAX_BYTES as Tr, resolveControlUiLinks as Tt, formatDoctorNonInteractiveHint as U, OPENAI_TTS_MODELS as Un, requestNodePairing as Ut, setGatewaySigusr1RestartPolicy as V, registerInternalHook as Vn, rejectNodePairing as Vt, formatRestartSentinelMessage as W, OPENAI_TTS_VOICES as Wn, updatePairedNodeMetadata as Wt, normalizeCronJobPatch as X, resolveTtsConfig as Xn, getHookType as Xt, normalizeCronJobCreate as Y, resolveTtsAutoMode as Yn, detectSuspiciousPatterns as Yt, migrateLegacyCronPayload as Z, resolveTtsPrefsPath as Zn, isExternalHookSession as Zt, resolveGatewaySessionStoreTarget as _, dispatchInboundMessage as _n, parseVerboseOverride as _r, guardCancel as _t, normalizeSendPolicy as a, waitForever as an, startDiagnosticHeartbeat as ar, formatUsageReportLines as at, capArrayByJsonBytes as b, isAbortTrigger as bn, peekSystemEvents as br, normalizeGatewayTokenInput as bt, runEmbeddedPiAgent as c, emitHeartbeatEvent as cn, DEFAULT_HEARTBEAT_ACK_MAX_CHARS as cr, resolveCommitHash as ct, createOpenClawTools as d, resolveIndicatorType as dn, resolveHeartbeatPrompt as dr, DEFAULT_WORKSPACE as dt, monitorWebChannel as en, setTtsProvider as er, requestHeartbeatNow as et, resolveAnnounceTargetFromKey as f, sendMessageTelegram as fn, stripHeartbeatToken as fr, applyWizardMetadata as ft, loadSessionEntry as g, fetchChannelPermissionsDiscord as gn, applyVerboseOverride as gr, formatControlUiSshHint as gt, loadCombinedSessionStoreForGateway as h, parseDiscordTarget as hn, applyModelOverrideToSessionEntry as hr, ensureWorkspaceAndSessions as ht, runCliAgent as i, registerUnhandledRejectionHandler as in, CommandLane as ir, loadProviderUsageSummary as it, resolveSessionDeliveryTarget as j, sendMessageSlack as jn, DEFAULT_INPUT_TIMEOUT_MS as jr, normalizeControlUiBasePath as jt, resolveHeartbeatSenderContext as k, sendMessageWhatsApp as kn, DEFAULT_INPUT_PDF_MAX_PIXELS as kr, CONTROL_UI_AVATAR_PREFIX as kt, abortEmbeddedPiRun as l, getLastHeartbeatEvent as ln, DEFAULT_HEARTBEAT_EVERY as lr, handleSlackHttpRequest as lt, listSessionsFromStore as m, getChannelActivity as mn, clearSessionAuthProfileOverride as mr, detectBrowserOpenSupport as mt, getCliSessionId as n, normalizeGroupActivation as nn, getQueueSize as nr, getPluginToolMeta as nt, resolveSendPolicy as o, buildHistoryContextFromEntries as on, stopDiagnosticHeartbeat as or, formatUsageWindowSummary as ot, listAgentsForGateway as p, sendMessageDiscord as pn, lookupContextTokens as pr, detectBinary as pt, trimLogTail as q, isTtsProviderConfigured as qn, registerSkillsChangeListener as qt, setCliSessionId as r, installUnhandledRejectionHandler as rn, setCommandLaneConcurrency as rr, loadOpenClawPlugins as rt, clearSessionQueues as s, resolveHeartbeatVisibility as sn, isDiagnosticsEnabled as sr, resolveUsageProviderId as st, getReplyFromConfig as t, createReplyPrefixOptions as tn, textToSpeech as tr, setHeartbeatWakeHandler as tt, waitForEmbeddedPiRunEnd as u, onHeartbeatEvent as un, isHeartbeatContentEffectivelyEmpty as ur, sendMessageIMessage as ut, resolveSessionModelRef as v, createReplyDispatcher as vn, enqueueSystemEvent as vr, handleReset as vt, stripEnvelopeFromMessages as w, clearAgentRunContext as wn, DEFAULT_INPUT_FILE_MIMES as wr, randomToken as wt, readSessionMessages as x, stopSubagentsForRequester as xn, loadModelCatalog as xr, openUrl as xt, archiveFileOnDisk as y, formatZonedTimestamp as yn, isSystemEventContextChanged as yr, moveToTrash as yt, isGatewaySigusr1RestartExternallyAllowed as z, clearInternalHooks as zn, approveNodePairing as zt };