@qqbrowser/openclaw-qbot 0.10.1 → 0.10.2

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 (214) hide show
  1. package/dist/{agents-Cd1yL8fG.js → agents-CCGNI0th.js} +1 -1
  2. package/dist/{agents.config-CaRMmWS8.js → agents.config-B9_IT_un.js} +1 -1
  3. package/dist/{agents.config-DSCcdYtv.js → agents.config-D8Q8p7re.js} +1 -1
  4. package/dist/{auth-choice-MqcWuVyu.js → auth-choice-DacG9sC7.js} +1 -1
  5. package/dist/{auth-choice-BmI4sIGs.js → auth-choice-EAV1bi1K.js} +1 -1
  6. package/dist/{banner-CAtilyXr.js → banner-DiQjNe9B.js} +1 -1
  7. package/dist/build-info.json +3 -3
  8. package/dist/bundled/boot-md/handler.js +1 -1
  9. package/dist/bundled/session-memory/handler.js +1 -1
  10. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  11. package/dist/{channel-options-CCqtIYCc.js → channel-options-DcI5T_Su.js} +1 -1
  12. package/dist/{channel-options-CKoyPq8p.js → channel-options-llKYy0-2.js} +1 -1
  13. package/dist/{channel-web-CwUfYqjg.js → channel-web-Qr8ST6tz.js} +1 -1
  14. package/dist/{channel-web-CCSMlUux.js → channel-web-TKrgB4oQ.js} +1 -1
  15. package/dist/{channels-cli-BfgVv5jH.js → channels-cli-BtyzpSQo.js} +1 -1
  16. package/dist/{channels-cli-BvGXgERj.js → channels-cli-CrdwqyiA.js} +1 -1
  17. package/dist/{cli-Bt--1dhL.js → cli-BDzG5MP5.js} +1 -1
  18. package/dist/{cli-CBg8KhmQ.js → cli-BY5POVX1.js} +1 -1
  19. package/dist/{command-registry-D_jtBegA.js → command-registry-DtMCIKRu.js} +1 -1
  20. package/dist/{compact-CYbPi7_-.js → compact-uyQDx8pN.js} +36 -36
  21. package/dist/{compact.runtime-BQu-8DFN.js → compact.runtime-BvWn8-VF.js} +1 -1
  22. package/dist/{compact.runtime-D-fOpaU3.js → compact.runtime-CbCNReBm.js} +1 -1
  23. package/dist/{compact.runtime-owWgKVDf.js → compact.runtime-DcRVnY_G.js} +1 -1
  24. package/dist/{compact.runtime-CrzmR0tV.js → compact.runtime-dgJTRf2V.js} +1 -1
  25. package/dist/{completion-cli-Bw_hBrlA.js → completion-cli-ByNU0Lbo.js} +1 -1
  26. package/dist/{completion-cli-BVbT_aR2.js → completion-cli-DHH7Zr2u.js} +1 -1
  27. package/dist/{config-cli-CwW76_j_.js → config-cli-BeVM5uz1.js} +1 -1
  28. package/dist/{config-cli-F-lkPjjz.js → config-cli-CcE1aKR3.js} +1 -1
  29. package/dist/{configure-DFlnM_zh.js → configure-CF42Va3r.js} +1 -1
  30. package/dist/{configure--c4tTVPz.js → configure-CYw7mK89.js} +1 -1
  31. package/dist/{deps-send-whatsapp.runtime-CqISN5vF.js → deps-send-whatsapp.runtime-7SqhJmWZ.js} +1 -1
  32. package/dist/{deps-send-whatsapp.runtime-C1zG74Si.js → deps-send-whatsapp.runtime-Bocaadqa.js} +1 -1
  33. package/dist/{deps-send-whatsapp.runtime-B5GMQIFv.js → deps-send-whatsapp.runtime-CjA6T7V6.js} +1 -1
  34. package/dist/{deps-send-whatsapp.runtime-CJnSJVnN.js → deps-send-whatsapp.runtime-DTyzQeR_.js} +1 -1
  35. package/dist/{doctor-completion-DI7mGC3D.js → doctor-completion-C15UB3EM.js} +1 -1
  36. package/dist/{doctor-completion-C9CPhCor.js → doctor-completion-KLuf1f33.js} +1 -1
  37. package/dist/entry.js +1 -1
  38. package/dist/extensionAPI.js +1 -1
  39. package/dist/{gateway-cli-BMmU2dsG.js → gateway-cli-CHyybU4X.js} +2 -2
  40. package/dist/{gateway-cli-Kp-caOwI.js → gateway-cli-DV3M2tJP.js} +2 -2
  41. package/dist/{health-B_-ZE5FK.js → health-2MbtCw6U.js} +1 -1
  42. package/dist/{health-CIZFVJEG.js → health-Dmtcw9K8.js} +1 -1
  43. package/dist/{hooks-cli-BoxAnC-E.js → hooks-cli-BaoD0-6l.js} +1 -1
  44. package/dist/{hooks-cli-CnCOjVv0.js → hooks-cli-DWCe4aHR.js} +1 -1
  45. package/dist/index.js +2 -2
  46. package/dist/llm-slug-generator.js +1 -1
  47. package/dist/{models-BBYqej07.js → models-DKf-4KoV.js} +1 -1
  48. package/dist/{models-cli-CMMhnlHo.js → models-cli-Bc8cIZ0A.js} +1 -1
  49. package/dist/{models-cli-CqbDyDn2.js → models-cli-Ble64nV3.js} +1 -1
  50. package/dist/{npm-resolution-CBlwQq3a.js → npm-resolution-BzXV2s2P.js} +1 -1
  51. package/dist/{npm-resolution--_-0q2ks.js → npm-resolution-CZUqHH_2.js} +1 -1
  52. package/dist/{onboard-DZG0HnuP.js → onboard-B8dVlGVk.js} +2 -2
  53. package/dist/{onboard-DlCEww7K.js → onboard-By9pkNca.js} +2 -2
  54. package/dist/{onboard-channels-BDMtq3ex.js → onboard-channels-C5lcb7dF.js} +1 -1
  55. package/dist/{onboard-channels-BO3AN_eA.js → onboard-channels-DFB6deX0.js} +1 -1
  56. package/dist/{onboarding-m-m__16h.js → onboarding-C7vbkuBI.js} +1 -1
  57. package/dist/{onboarding-CxRTJCBM.js → onboarding-DCldCoVy.js} +1 -1
  58. package/dist/{onboarding.finalize-BJxMhYUa.js → onboarding.finalize-C-b9zSIO.js} +1 -1
  59. package/dist/{onboarding.finalize-UiX3YmbI.js → onboarding.finalize-XCttW8IU.js} +1 -1
  60. package/dist/{pi-embedded-X_Svd4Wi.js → pi-embedded-CoHiJa9Q.js} +8 -8
  61. package/dist/{pi-embedded-6yGEd2xd.js → pi-embedded-DLlQ5e_w.js} +8 -8
  62. package/dist/{plugin-registry-DYwEy5eM.js → plugin-registry-C_HKxFxs.js} +1 -1
  63. package/dist/{plugin-registry-CN2aCPP7.js → plugin-registry-DBgXa8jD.js} +1 -1
  64. package/dist/plugin-sdk/{channel-web-Bg8DNyeb.js → channel-web-CMlv9Yzv.js} +1 -1
  65. package/dist/plugin-sdk/{channel-web-B795Ild9.cjs → channel-web-D1tzaMsH.cjs} +1 -1
  66. package/dist/plugin-sdk/{channel-web-D5zxPW-x.js → channel-web-DowgDxtO.js} +1 -1
  67. package/dist/plugin-sdk/{channel-web-CW42ALB5.cjs → channel-web-VsaRZCG2.cjs} +1 -1
  68. package/dist/plugin-sdk/{compact.runtime-Cr6oI5li.js → compact.runtime-B4M-VPyN.js} +1 -1
  69. package/dist/plugin-sdk/{compact.runtime-BR00C0_i.cjs → compact.runtime-BeWqnWW5.cjs} +1 -1
  70. package/dist/plugin-sdk/{compact.runtime-DOcQzBT5.cjs → compact.runtime-BnF9vU5j.cjs} +1 -1
  71. package/dist/plugin-sdk/{compact.runtime-D-3vVYGF.js → compact.runtime-C5vcsriA.js} +1 -1
  72. package/dist/plugin-sdk/{compact.runtime-BBqQuOlJ.cjs → compact.runtime-CS04yjUP.cjs} +1 -1
  73. package/dist/plugin-sdk/{compact.runtime-CGKItjCQ.js → compact.runtime-CepgZBh6.js} +1 -1
  74. package/dist/plugin-sdk/{compact.runtime-C-sPm0kL.cjs → compact.runtime-CuGn1L3D.cjs} +1 -1
  75. package/dist/plugin-sdk/{compact.runtime-CAiT8DtI.js → compact.runtime-DNocZUm6.js} +1 -1
  76. package/dist/plugin-sdk/{compact.runtime-CmQT69OD.cjs → compact.runtime-DQRsRwKH.cjs} +1 -1
  77. package/dist/plugin-sdk/{compact.runtime-BXuXwnQ_.cjs → compact.runtime-DnWYG9Ij.cjs} +1 -1
  78. package/dist/plugin-sdk/{compact.runtime-BxzvSPrQ.js → compact.runtime-W8dIsxRV.js} +1 -1
  79. package/dist/plugin-sdk/{compact.runtime-B1fslZX1.js → compact.runtime-hS2NXspw.js} +1 -1
  80. package/dist/plugin-sdk/compat.cjs +1 -1
  81. package/dist/plugin-sdk/compat.js +1 -1
  82. package/dist/plugin-sdk/{deps-send-whatsapp.runtime-WXiE5pA7.js → deps-send-whatsapp.runtime-B5Nz8XrQ.js} +1 -1
  83. package/dist/plugin-sdk/{deps-send-whatsapp.runtime-DKoOiTZZ.cjs → deps-send-whatsapp.runtime-B5R8WAYy.cjs} +1 -1
  84. package/dist/plugin-sdk/{deps-send-whatsapp.runtime-DlO-S_iA.js → deps-send-whatsapp.runtime-B6ua6LoP.js} +1 -1
  85. package/dist/plugin-sdk/{deps-send-whatsapp.runtime-BUuj08qp.cjs → deps-send-whatsapp.runtime-BPMIzR5x.cjs} +1 -1
  86. package/dist/plugin-sdk/{deps-send-whatsapp.runtime-iI9qWUzR.cjs → deps-send-whatsapp.runtime-Bpq7VeGO.cjs} +1 -1
  87. package/dist/plugin-sdk/{deps-send-whatsapp.runtime-3kX5dnHC.js → deps-send-whatsapp.runtime-D3YUudyV.js} +1 -1
  88. package/dist/plugin-sdk/{deps-send-whatsapp.runtime-Xn1KqyPS.js → deps-send-whatsapp.runtime-DFxWO5_f.js} +1 -1
  89. package/dist/plugin-sdk/{deps-send-whatsapp.runtime-CE9LgvzJ.cjs → deps-send-whatsapp.runtime-DZ_pLOPK.cjs} +1 -1
  90. package/dist/plugin-sdk/{deps-send-whatsapp.runtime-t0Z0IyDq.cjs → deps-send-whatsapp.runtime-DyoJd0Hw.cjs} +1 -1
  91. package/dist/plugin-sdk/{deps-send-whatsapp.runtime-rOnSc6qE.js → deps-send-whatsapp.runtime-ZkaerhQ1.js} +1 -1
  92. package/dist/plugin-sdk/{deps-send-whatsapp.runtime-QUlRFE48.cjs → deps-send-whatsapp.runtime-_wzNB18A.cjs} +1 -1
  93. package/dist/plugin-sdk/{deps-send-whatsapp.runtime-DKVfDIzU.js → deps-send-whatsapp.runtime-bBd46QxW.js} +1 -1
  94. package/dist/plugin-sdk/{dispatch-DAaOM5c1.cjs → dispatch-B8dzPpi1.cjs} +8 -8
  95. package/dist/plugin-sdk/{dispatch-DYRrW05S.js → dispatch-B9FQyNfe.js} +36 -36
  96. package/dist/plugin-sdk/{dispatch-Dl0eaYcY.cjs → dispatch-BB5AfYlI.cjs} +8 -8
  97. package/dist/plugin-sdk/{dispatch-_tJF5hSh.cjs → dispatch-BIaey_BU.cjs} +8 -8
  98. package/dist/plugin-sdk/{dispatch-B13B2T1k.js → dispatch-BY1FkQOr.js} +8 -8
  99. package/dist/plugin-sdk/{dispatch-cPg1rBWu.cjs → dispatch-Bybxc9Yl.cjs} +8 -8
  100. package/dist/plugin-sdk/{dispatch-BlOkbw2U.js → dispatch-CADw_Fi7.js} +8 -8
  101. package/dist/plugin-sdk/{dispatch-Dap2ZPC9.js → dispatch-CZqPeEcw.js} +8 -8
  102. package/dist/plugin-sdk/{dispatch-BaBcLOry.js → dispatch-DafB1x1O.js} +8 -8
  103. package/dist/plugin-sdk/{dispatch-D2Km7gvG.cjs → dispatch-DcyylSdu.cjs} +8 -8
  104. package/dist/plugin-sdk/index.cjs +1 -1
  105. package/dist/plugin-sdk/index.js +1 -1
  106. package/dist/plugin-sdk/irc.cjs +1 -1
  107. package/dist/plugin-sdk/irc.js +1 -1
  108. package/dist/plugin-sdk/matrix.cjs +1 -1
  109. package/dist/plugin-sdk/matrix.js +1 -1
  110. package/dist/plugin-sdk/msteams.cjs +1 -1
  111. package/dist/plugin-sdk/msteams.js +1 -1
  112. package/dist/plugin-sdk/nextcloud-talk.cjs +1 -1
  113. package/dist/plugin-sdk/nextcloud-talk.js +1 -1
  114. package/dist/plugin-sdk/{reply-JD6VIW5N.cjs → reply-6D8nZUZ1.cjs} +8 -8
  115. package/dist/plugin-sdk/{reply-73PF8kN_.js → reply-gpVkJsEs.js} +8 -8
  116. package/dist/plugin-sdk/{slash-dispatch.runtime-DAgDLU__.js → slash-dispatch.runtime-2hUZv0o4.js} +1 -1
  117. package/dist/plugin-sdk/{slash-dispatch.runtime-BfheQLfD.js → slash-dispatch.runtime-B4sdtKqK.js} +1 -1
  118. package/dist/plugin-sdk/{slash-dispatch.runtime-CmVqJqfV.js → slash-dispatch.runtime-BCAWJ135.js} +1 -1
  119. package/dist/plugin-sdk/{slash-dispatch.runtime-wWa-kKvH.js → slash-dispatch.runtime-BJX-7mTD.js} +1 -1
  120. package/dist/plugin-sdk/{slash-dispatch.runtime-C6cMCwSp.js → slash-dispatch.runtime-BY3aBzxK.js} +1 -1
  121. package/dist/plugin-sdk/{slash-dispatch.runtime-BVXTmhZU.js → slash-dispatch.runtime-CHFbytW1.js} +1 -1
  122. package/dist/plugin-sdk/{slash-dispatch.runtime-BcO6NdxL.cjs → slash-dispatch.runtime-Cf-EuMPD.cjs} +1 -1
  123. package/dist/plugin-sdk/{slash-dispatch.runtime-CYmmyw9o.cjs → slash-dispatch.runtime-CukipBLa.cjs} +1 -1
  124. package/dist/plugin-sdk/{slash-dispatch.runtime-DNI9fZFo.cjs → slash-dispatch.runtime-D7JTU7km.cjs} +1 -1
  125. package/dist/plugin-sdk/{slash-dispatch.runtime-BQWrcjEG.cjs → slash-dispatch.runtime-DZq0olM2.cjs} +1 -1
  126. package/dist/plugin-sdk/{slash-dispatch.runtime-Cp5-cPgM.cjs → slash-dispatch.runtime-ILA0KH-p.cjs} +1 -1
  127. package/dist/plugin-sdk/{slash-dispatch.runtime-CD6AFEn3.cjs → slash-dispatch.runtime-_i2UiDTt.cjs} +1 -1
  128. package/dist/plugin-sdk/{subagent-registry-runtime-BINR9wKz.cjs → subagent-registry-runtime-7wfZ9Ydg.cjs} +1 -1
  129. package/dist/plugin-sdk/{subagent-registry-runtime-q6csFFiS.js → subagent-registry-runtime-B6Go3QMY.js} +1 -1
  130. package/dist/plugin-sdk/{subagent-registry-runtime-CPYQLLoh.cjs → subagent-registry-runtime-Bf71VzVF.cjs} +1 -1
  131. package/dist/plugin-sdk/{subagent-registry-runtime-DCd8DMgz.js → subagent-registry-runtime-CKlyWpvM.js} +1 -1
  132. package/dist/plugin-sdk/{subagent-registry-runtime-BfT45xXa.cjs → subagent-registry-runtime-CcyvhbJH.cjs} +1 -1
  133. package/dist/plugin-sdk/{subagent-registry-runtime-DYhr9YcP.js → subagent-registry-runtime-D4y3Fxlu.js} +1 -1
  134. package/dist/plugin-sdk/{subagent-registry-runtime-BBwsJL9B.cjs → subagent-registry-runtime-DFCUhuvT.cjs} +1 -1
  135. package/dist/plugin-sdk/{subagent-registry-runtime-CjnSOShL.js → subagent-registry-runtime-DWZUy1eI.js} +1 -1
  136. package/dist/plugin-sdk/{subagent-registry-runtime-B9uDb_ij.js → subagent-registry-runtime-DkCs3cQj.js} +1 -1
  137. package/dist/plugin-sdk/{subagent-registry-runtime-DB8YDuGj.js → subagent-registry-runtime-RrhCNI-u.js} +1 -1
  138. package/dist/plugin-sdk/{subagent-registry-runtime-iiOzLeYb.cjs → subagent-registry-runtime-S2yCcuWA.cjs} +1 -1
  139. package/dist/plugin-sdk/{subagent-registry-runtime-ClkQBnJu.cjs → subagent-registry-runtime-zTYi4rJR.cjs} +1 -1
  140. package/dist/plugin-sdk/{web-Bh78uOi8.cjs → web-C-_Bja5u.cjs} +1 -1
  141. package/dist/plugin-sdk/{web-C4ezqWIt.js → web-C7h16O4t.js} +1 -1
  142. package/dist/plugin-sdk/{web-B7d3p3kx.cjs → web-Cf2Ivjcn.cjs} +1 -1
  143. package/dist/plugin-sdk/{web-DFDao2So.cjs → web-CfvlhITy.cjs} +1 -1
  144. package/dist/plugin-sdk/{web-JciOW43P.js → web-DzgvdKmn.js} +1 -1
  145. package/dist/plugin-sdk/{web-Bg2LIMdb.cjs → web-RmaRbUK1.cjs} +1 -1
  146. package/dist/plugin-sdk/{web-SwpoHf2A.js → web-bHdImk0G.js} +1 -1
  147. package/dist/plugin-sdk/{web-DjbeDvyv.js → web-bT52Rp59.js} +1 -1
  148. package/dist/plugin-sdk/{web-vSFigMHz.cjs → web-pFlzmHcu.cjs} +1 -1
  149. package/dist/plugin-sdk/{web-BEuW8Yqw.js → web-rFQBs9b0.js} +1 -1
  150. package/dist/plugin-sdk/{web--8MBOleK.js → web-uQqWClDT.js} +1 -1
  151. package/dist/plugin-sdk/{web-BPQv-4Qv.cjs → web-wnw_PMil.cjs} +1 -1
  152. package/dist/plugin-sdk/whatsapp.cjs +1 -1
  153. package/dist/plugin-sdk/whatsapp.js +1 -1
  154. package/dist/{plugins-cli-PVHBZeb8.js → plugins-cli-BjLj52hA.js} +1 -1
  155. package/dist/{plugins-cli-CnXgwZzI.js → plugins-cli-CwQOOOym.js} +1 -1
  156. package/dist/ports-BDZyt9rk.js +2 -0
  157. package/dist/ports-DmJX-iq9.js +2 -0
  158. package/dist/{program-D53eGuSf.js → program-RvezCMDs.js} +2 -2
  159. package/dist/{program-context-n-ovYq69.js → program-context-C4vPkfWW.js} +1 -1
  160. package/dist/{prompt-select-styled-DolCW-_j.js → prompt-select-styled-C-zw_5_b.js} +1 -1
  161. package/dist/{prompt-select-styled-DZnefcrY.js → prompt-select-styled-CoP6cSMX.js} +1 -1
  162. package/dist/{provider-auth-helpers-BLm2bdp5.js → provider-auth-helpers-DeCLF5oV.js} +1 -1
  163. package/dist/{provider-auth-helpers-DPz0vN_c.js → provider-auth-helpers-Rv3hdZ7j.js} +1 -1
  164. package/dist/{push-apns-BBv62ncV.js → push-apns-BfTKAzRZ.js} +1 -1
  165. package/dist/{push-apns-DIV5dBPP.js → push-apns-CeY33Rxc.js} +1 -1
  166. package/dist/{register.agent-DQdoMfmw.js → register.agent-CANRVL5k.js} +1 -1
  167. package/dist/{register.agent-DHOTtB8X.js → register.agent-He4UYNpV.js} +1 -1
  168. package/dist/{register.configure-C2N82brC.js → register.configure-CqsxTDtC.js} +1 -1
  169. package/dist/{register.configure-C6zjzaEo.js → register.configure-CwuLuKsv.js} +1 -1
  170. package/dist/{register.maintenance-CStaPxaB.js → register.maintenance-B5cnDjLy.js} +1 -1
  171. package/dist/{register.maintenance-aKBTd9Zp.js → register.maintenance-CHJQh81L.js} +1 -1
  172. package/dist/{register.message-DHDcOA8X.js → register.message-CEcXemHd.js} +1 -1
  173. package/dist/{register.message-Dh72QHKA.js → register.message-DoA6MALf.js} +1 -1
  174. package/dist/{register.onboard-DB9FWAKT.js → register.onboard-B01N1AYH.js} +1 -1
  175. package/dist/{register.onboard-Bu9gpFlA.js → register.onboard-B5iQpfVG.js} +1 -1
  176. package/dist/{register.setup-D76IRs4s.js → register.setup-BTKZzyRh.js} +1 -1
  177. package/dist/{register.setup-CeG2ETmr.js → register.setup-CPGByOtO.js} +1 -1
  178. package/dist/{register.status-health-sessions-mPGKFjIz.js → register.status-health-sessions-CPmSNp3F.js} +1 -1
  179. package/dist/{register.status-health-sessions-Dtpd1P2M.js → register.status-health-sessions-hrQLxH-w.js} +1 -1
  180. package/dist/{register.subclis-Drp2dGBe.js → register.subclis-CqVDIyhT.js} +1 -1
  181. package/dist/{reply-DwfVhea1.js → reply-mWIMy_ju.js} +8 -8
  182. package/dist/{run-main-CjwjyWA6.js → run-main-B2f6FBb0.js} +1 -1
  183. package/dist/{server-node-events-CL0pWoMa.js → server-node-events-BtKnElP0.js} +1 -1
  184. package/dist/{server-node-events-ChPQ984b.js → server-node-events-DnyBXZtB.js} +1 -1
  185. package/dist/{slash-dispatch.runtime-jR7ZpRLo.js → slash-dispatch.runtime-B8S9VVjy.js} +1 -1
  186. package/dist/{slash-dispatch.runtime-CHDiNcch.js → slash-dispatch.runtime-CS58xiJF.js} +1 -1
  187. package/dist/{slash-dispatch.runtime-DgsOlRbg.js → slash-dispatch.runtime-CZrxUnBW.js} +1 -1
  188. package/dist/{slash-dispatch.runtime-Bh87LG5X.js → slash-dispatch.runtime-Cq_OU6GL.js} +1 -1
  189. package/dist/{status-o3Gfr-6l.js → status-C3OhTrWE.js} +1 -1
  190. package/dist/{status-BSHWBrg0.js → status-tL-XCvJC.js} +1 -1
  191. package/dist/{subagent-registry-runtime-B8nEWxYm.js → subagent-registry-runtime-BvPAovsV.js} +1 -1
  192. package/dist/{subagent-registry-runtime-D5PhzS7u.js → subagent-registry-runtime-ClREKCLG.js} +1 -1
  193. package/dist/{subagent-registry-runtime-C6xoTyr_.js → subagent-registry-runtime-D2cjV86K.js} +1 -1
  194. package/dist/{subagent-registry-runtime-DU6-3b5M.js → subagent-registry-runtime-dcrGDOTV.js} +1 -1
  195. package/dist/{update-cli-DU5tRH3c.js → update-cli-CZsuMrHE.js} +1 -1
  196. package/dist/{update-cli-CL_cUjuq.js → update-cli-DAPHNGDM.js} +1 -1
  197. package/dist/{update-runner-DG-1TYYc.js → update-runner-DZkN4otc.js} +1 -1
  198. package/dist/{update-runner-DABdlxfN.js → update-runner-DhaHCCx3.js} +1 -1
  199. package/dist/{web-C0WkwHal.js → web-BPloShgg.js} +1 -1
  200. package/dist/{web-u71NbOpT.js → web-BbOH61Lx.js} +1 -1
  201. package/dist/{web-DPQjx48C.js → web-CMSYMAHG.js} +1 -1
  202. package/dist/{web-Dfi2WjvN.js → web-WBvnAfBv.js} +1 -1
  203. package/extensions/qqbrowser-skill-control/index.js +1 -1
  204. package/node_modules/@google/genai/dist/index.cjs +8 -8
  205. package/node_modules/@google/genai/dist/index.mjs +8 -8
  206. package/node_modules/@google/genai/dist/node/index.cjs +8 -8
  207. package/node_modules/@google/genai/dist/node/index.mjs +8 -8
  208. package/node_modules/@google/genai/dist/vertex_internal/index.cjs +1 -1
  209. package/node_modules/@google/genai/dist/vertex_internal/index.js +1 -1
  210. package/node_modules/@google/genai/dist/web/index.mjs +8 -8
  211. package/node_modules/@google/genai/package.json +1 -1
  212. package/package.json +1 -1
  213. package/dist/ports-BAaLOkJp.js +0 -2
  214. package/dist/ports-DDWP1p0X.js +0 -2
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./paths-Bcdg3ma0.cjs`),t=require(`./paths-D90l3h_o.cjs`),n=require(`./sessions-BmhjMXlm.cjs`),r=require(`./logger-DUYnS-W3.cjs`);require(`./proxy-env-DQoJjkWE.cjs`),require(`./send-CimU95QQ.cjs`);const i=require(`./common-BJ0tHoNJ.cjs`),a=require(`./resolve-outbound-target-Fq8une1d.cjs`),o=require(`./send-CAreQYLU.cjs`),s=require(`./reply-JD6VIW5N.cjs`);require(`./github-copilot-token-zskwAEpd.cjs`),require(`./send-BWEZ_8nL.cjs`);const c=require(`./channel-web-CW42ALB5.cjs`);require(`./tokens-CXsPDJTr.cjs`),require(`./audio-transcription-runner-Cxs7u0B3.cjs`),require(`./image-UKq4Bn2r.cjs`),require(`./fetch-guard-7tObWdgY.cjs`),require(`./api-key-rotation-D-zSLAf_.cjs`),require(`./local-roots-I2icTm2P.cjs`),require(`./proxy-fetch-BzcKzknk.cjs`),require(`./deliver-EThzALwn.cjs`),require(`./commands-registry-BIGWymiv.cjs`),require(`./fetch-ClKErpni.cjs`),require(`./diagnostic-CYR5dxDE.cjs`),require(`./pi-model-discovery-CyBFRafV.cjs`),require(`./ir-Bg_avpt0.cjs`),require(`./render-6fCdtAr6.cjs`),require(`./send-Cer1bA2g.cjs`),require(`./outbound-attachment-BBJPbiLF.cjs`),require(`./send-CoEAieJt.cjs`),require(`./channel-activity-BUieXBdg.cjs`),require(`./tables-DiiF7bbj.cjs`),require(`./fetch-DQxuOB8o.cjs`),require(`./skill-commands-C9g2UiKr.cjs`),require(`./query-expansion-0zYzKrrd.cjs`),require(`./manager-vyHAgafh.cjs`),require(`./outbound-CwWXHNwp.cjs`),require(`./session-CwinrWG4.cjs`);const l=require(`./login-0ui1gfZM.cjs`);let u=require(`zod`),d=require(`node:path`);d=e.p(d);function f(e){return{success:!1,error:{issues:[{path:[],message:e}]}}}function p(){return{safeParse(e){return e===void 0?{success:!0,data:void 0}:!e||typeof e!=`object`||Array.isArray(e)?f(`expected config object`):Object.keys(e).length>0?f(`config must be empty`):{success:!0,data:e}},jsonSchema:{type:`object`,additionalProperties:!1,properties:{}}}}function m(e,t){let n=e.channels?.[t];return!!(n?.accounts&&Object.keys(n.accounts).length>0)}function h(e){return e.alwaysUseAccounts||e.accountId!==`default`?!0:m(e.cfg,e.channelKey)}function g(e){let n=e.name?.trim();if(!n)return e.cfg;let r=t.zt(e.accountId),i=e.cfg.channels?.[e.channelKey],a=typeof i==`object`&&i?i:void 0;if(!h({cfg:e.cfg,channelKey:e.channelKey,accountId:r,alwaysUseAccounts:e.alwaysUseAccounts})&&r===`default`){let t=a??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channelKey]:{...t,name:n}}}}let o=a?.accounts??{},s=o[r]??{},c=r===`default`?(({name:e,...t})=>t)(a??{}):a??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channelKey]:{...c,accounts:{...o,[r]:{...s,name:n}}}}}}function _(e){if(e.alwaysUseAccounts)return e.cfg;let n=e.cfg.channels?.[e.channelKey],r=n?.name?.trim();if(!r)return e.cfg;let i={...n?.accounts},a=i.default??{};a.name||(i[t.Rt]={...a,name:r});let{name:o,...s}=n??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channelKey]:{...s,accounts:i}}}}const v=u.z.union([u.z.string(),u.z.number()]);u.z.array(v).optional();function y(e){let t=e;return typeof t.toJSONSchema==`function`?{schema:t.toJSONSchema({target:`draft-07`,unrepresentable:`any`})}:{schema:{type:`object`,additionalProperties:!0}}}function b(e,t,n={}){let r={...e??void 0};for(let[e,i]of Object.entries(t)){if(i===void 0){n.unsetOnUndefined?.includes(e)&&delete r[e];continue}r[e]=i}return r}function x(e,t,n){return{...e,channels:{...e.channels,whatsapp:b(e.channels?.whatsapp,t,n)}}}const S={openai:[`OPENAI_API_KEY`],anthropic:[`ANTHROPIC_API_KEY`],google:[`GEMINI_API_KEY`],minimax:[`MINIMAX_API_KEY`],"minimax-cn":[`MINIMAX_API_KEY`],moonshot:[`MOONSHOT_API_KEY`],"kimi-coding":[`KIMI_API_KEY`,`KIMICODE_API_KEY`],synthetic:[`SYNTHETIC_API_KEY`],venice:[`VENICE_API_KEY`],zai:[`ZAI_API_KEY`,`Z_AI_API_KEY`],xiaomi:[`XIAOMI_API_KEY`],openrouter:[`OPENROUTER_API_KEY`],"cloudflare-ai-gateway":[`CLOUDFLARE_AI_GATEWAY_API_KEY`],litellm:[`LITELLM_API_KEY`],"vercel-ai-gateway":[`AI_GATEWAY_API_KEY`],opencode:[`OPENCODE_API_KEY`,`OPENCODE_ZEN_API_KEY`],"opencode-go":[`OPENCODE_API_KEY`,`OPENCODE_ZEN_API_KEY`],together:[`TOGETHER_API_KEY`],huggingface:[`HUGGINGFACE_HUB_TOKEN`,`HF_TOKEN`],qianfan:[`QIANFAN_API_KEY`],xai:[`XAI_API_KEY`],mistral:[`MISTRAL_API_KEY`],kilocode:[`KILOCODE_API_KEY`],modelstudio:[`MODELSTUDIO_API_KEY`],volcengine:[`VOLCANO_ENGINE_API_KEY`],byteplus:[`BYTEPLUS_API_KEY`]},C=[`VOYAGE_API_KEY`,`GROQ_API_KEY`,`DEEPGRAM_API_KEY`,`CEREBRAS_API_KEY`,`NVIDIA_API_KEY`,`COPILOT_GITHUB_TOKEN`,`GH_TOKEN`,`GITHUB_TOKEN`,`ANTHROPIC_OAUTH_TOKEN`,`CHUTES_OAUTH_TOKEN`,`CHUTES_API_KEY`,`QWEN_OAUTH_TOKEN`,`QWEN_PORTAL_API_KEY`,`MINIMAX_OAUTH_TOKEN`,`OLLAMA_API_KEY`,`VLLM_API_KEY`],w=[...new Set(Object.values(S).flatMap(e=>e))];[...new Set([...w,...C])];async function T(e){let n=e.listAccountIds(e.cfg),r=e.currentId?.trim()||e.defaultAccountId||`default`,i=await e.prompter.select({message:`${e.label} account`,options:[...n.map(e=>({value:e,label:e===`default`?`default (primary)`:e})),{value:`__new__`,label:`Add a new account`}],initialValue:r});if(i!==`__new__`)return t.zt(i);let a=await e.prompter.text({message:`New ${e.label} account id`,validate:e=>e?.trim()?void 0:`Required`}),o=t.zt(String(a));return String(a).trim()!==o&&await e.prompter.note(`Normalized account id to "${o}".`,`${e.label} account`),o}const E=async e=>await T(e);function D(e){return e.split(/[\n,;]+/g).map(e=>e.trim()).filter(Boolean)}function O(e,t){let n=e.map(e=>String(e).trim()).filter(Boolean).map(e=>{if(e===`*`)return`*`;if(!t)return e;let n=t(e);return typeof n==`string`?n.trim():``}).filter(Boolean);return[...new Set(n)]}function k(e){return e.accountId?.trim()?t.zt(e.accountId):e.defaultAccountId}async function A(e){let n=e.accountOverride?.trim(),r=n?t.zt(n):e.defaultAccountId;return e.shouldPromptAccountIds&&!n&&(r=await E({cfg:e.cfg,prompter:e.prompter,label:e.label,currentId:r,listAccountIds:e.listAccountIds,defaultAccountId:e.defaultAccountId})),r}const j=`whatsapp`;function M(e,t){return x(e,{dmPolicy:t})}function N(e,t){return x(e,{allowFrom:t},{unsetOnUndefined:[`allowFrom`]})}function P(e,t){return x(e,{selfChatMode:t})}async function F(e,t){let{authDir:i}=n.ks({cfg:e,accountId:t});return await r.g(d.default.join(i,`creds.json`))}async function I(e){let{prompter:t,existingAllowFrom:n}=e;await t.note(`We need the sender/owner number so OpenClaw can allowlist you.`,`WhatsApp number`);let i=await t.text({message:`Your personal WhatsApp number (the phone you will message from)`,placeholder:`+15555550123`,initialValue:n[0],validate:e=>{let t=String(e??``).trim();if(!t)return`Required`;if(!r.h(t))return`Invalid number: ${t}`}}),a=r.h(String(i).trim());if(!a)throw Error(`Invalid WhatsApp owner number (expected E.164 after validation).`);return{normalized:a,allowFrom:O([...n.filter(e=>e!==`*`),a],r.h)}}async function L(e){let{normalized:t,allowFrom:n}=await I({prompter:e.prompter,existingAllowFrom:e.existingAllowFrom}),r=P(e.cfg,!0);return r=M(r,`allowlist`),r=N(r,n),await e.prompter.note([...e.messageLines,`- allowFrom includes ${t}`].join(`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./paths-Bcdg3ma0.cjs`),t=require(`./paths-D90l3h_o.cjs`),n=require(`./sessions-BmhjMXlm.cjs`),r=require(`./logger-DUYnS-W3.cjs`);require(`./proxy-env-DQoJjkWE.cjs`),require(`./send-CimU95QQ.cjs`);const i=require(`./common-BJ0tHoNJ.cjs`),a=require(`./resolve-outbound-target-Fq8une1d.cjs`),o=require(`./send-CAreQYLU.cjs`),s=require(`./reply-6D8nZUZ1.cjs`);require(`./github-copilot-token-zskwAEpd.cjs`),require(`./send-BWEZ_8nL.cjs`);const c=require(`./channel-web-VsaRZCG2.cjs`);require(`./tokens-CXsPDJTr.cjs`),require(`./audio-transcription-runner-Cxs7u0B3.cjs`),require(`./image-UKq4Bn2r.cjs`),require(`./fetch-guard-7tObWdgY.cjs`),require(`./api-key-rotation-D-zSLAf_.cjs`),require(`./local-roots-I2icTm2P.cjs`),require(`./proxy-fetch-BzcKzknk.cjs`),require(`./deliver-EThzALwn.cjs`),require(`./commands-registry-BIGWymiv.cjs`),require(`./fetch-ClKErpni.cjs`),require(`./diagnostic-CYR5dxDE.cjs`),require(`./pi-model-discovery-CyBFRafV.cjs`),require(`./ir-Bg_avpt0.cjs`),require(`./render-6fCdtAr6.cjs`),require(`./send-Cer1bA2g.cjs`),require(`./outbound-attachment-BBJPbiLF.cjs`),require(`./send-CoEAieJt.cjs`),require(`./channel-activity-BUieXBdg.cjs`),require(`./tables-DiiF7bbj.cjs`),require(`./fetch-DQxuOB8o.cjs`),require(`./skill-commands-C9g2UiKr.cjs`),require(`./query-expansion-0zYzKrrd.cjs`),require(`./manager-vyHAgafh.cjs`),require(`./outbound-CwWXHNwp.cjs`),require(`./session-CwinrWG4.cjs`);const l=require(`./login-0ui1gfZM.cjs`);let u=require(`zod`),d=require(`node:path`);d=e.p(d);function f(e){return{success:!1,error:{issues:[{path:[],message:e}]}}}function p(){return{safeParse(e){return e===void 0?{success:!0,data:void 0}:!e||typeof e!=`object`||Array.isArray(e)?f(`expected config object`):Object.keys(e).length>0?f(`config must be empty`):{success:!0,data:e}},jsonSchema:{type:`object`,additionalProperties:!1,properties:{}}}}function m(e,t){let n=e.channels?.[t];return!!(n?.accounts&&Object.keys(n.accounts).length>0)}function h(e){return e.alwaysUseAccounts||e.accountId!==`default`?!0:m(e.cfg,e.channelKey)}function g(e){let n=e.name?.trim();if(!n)return e.cfg;let r=t.zt(e.accountId),i=e.cfg.channels?.[e.channelKey],a=typeof i==`object`&&i?i:void 0;if(!h({cfg:e.cfg,channelKey:e.channelKey,accountId:r,alwaysUseAccounts:e.alwaysUseAccounts})&&r===`default`){let t=a??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channelKey]:{...t,name:n}}}}let o=a?.accounts??{},s=o[r]??{},c=r===`default`?(({name:e,...t})=>t)(a??{}):a??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channelKey]:{...c,accounts:{...o,[r]:{...s,name:n}}}}}}function _(e){if(e.alwaysUseAccounts)return e.cfg;let n=e.cfg.channels?.[e.channelKey],r=n?.name?.trim();if(!r)return e.cfg;let i={...n?.accounts},a=i.default??{};a.name||(i[t.Rt]={...a,name:r});let{name:o,...s}=n??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channelKey]:{...s,accounts:i}}}}const v=u.z.union([u.z.string(),u.z.number()]);u.z.array(v).optional();function y(e){let t=e;return typeof t.toJSONSchema==`function`?{schema:t.toJSONSchema({target:`draft-07`,unrepresentable:`any`})}:{schema:{type:`object`,additionalProperties:!0}}}function b(e,t,n={}){let r={...e??void 0};for(let[e,i]of Object.entries(t)){if(i===void 0){n.unsetOnUndefined?.includes(e)&&delete r[e];continue}r[e]=i}return r}function x(e,t,n){return{...e,channels:{...e.channels,whatsapp:b(e.channels?.whatsapp,t,n)}}}const S={openai:[`OPENAI_API_KEY`],anthropic:[`ANTHROPIC_API_KEY`],google:[`GEMINI_API_KEY`],minimax:[`MINIMAX_API_KEY`],"minimax-cn":[`MINIMAX_API_KEY`],moonshot:[`MOONSHOT_API_KEY`],"kimi-coding":[`KIMI_API_KEY`,`KIMICODE_API_KEY`],synthetic:[`SYNTHETIC_API_KEY`],venice:[`VENICE_API_KEY`],zai:[`ZAI_API_KEY`,`Z_AI_API_KEY`],xiaomi:[`XIAOMI_API_KEY`],openrouter:[`OPENROUTER_API_KEY`],"cloudflare-ai-gateway":[`CLOUDFLARE_AI_GATEWAY_API_KEY`],litellm:[`LITELLM_API_KEY`],"vercel-ai-gateway":[`AI_GATEWAY_API_KEY`],opencode:[`OPENCODE_API_KEY`,`OPENCODE_ZEN_API_KEY`],"opencode-go":[`OPENCODE_API_KEY`,`OPENCODE_ZEN_API_KEY`],together:[`TOGETHER_API_KEY`],huggingface:[`HUGGINGFACE_HUB_TOKEN`,`HF_TOKEN`],qianfan:[`QIANFAN_API_KEY`],xai:[`XAI_API_KEY`],mistral:[`MISTRAL_API_KEY`],kilocode:[`KILOCODE_API_KEY`],modelstudio:[`MODELSTUDIO_API_KEY`],volcengine:[`VOLCANO_ENGINE_API_KEY`],byteplus:[`BYTEPLUS_API_KEY`]},C=[`VOYAGE_API_KEY`,`GROQ_API_KEY`,`DEEPGRAM_API_KEY`,`CEREBRAS_API_KEY`,`NVIDIA_API_KEY`,`COPILOT_GITHUB_TOKEN`,`GH_TOKEN`,`GITHUB_TOKEN`,`ANTHROPIC_OAUTH_TOKEN`,`CHUTES_OAUTH_TOKEN`,`CHUTES_API_KEY`,`QWEN_OAUTH_TOKEN`,`QWEN_PORTAL_API_KEY`,`MINIMAX_OAUTH_TOKEN`,`OLLAMA_API_KEY`,`VLLM_API_KEY`],w=[...new Set(Object.values(S).flatMap(e=>e))];[...new Set([...w,...C])];async function T(e){let n=e.listAccountIds(e.cfg),r=e.currentId?.trim()||e.defaultAccountId||`default`,i=await e.prompter.select({message:`${e.label} account`,options:[...n.map(e=>({value:e,label:e===`default`?`default (primary)`:e})),{value:`__new__`,label:`Add a new account`}],initialValue:r});if(i!==`__new__`)return t.zt(i);let a=await e.prompter.text({message:`New ${e.label} account id`,validate:e=>e?.trim()?void 0:`Required`}),o=t.zt(String(a));return String(a).trim()!==o&&await e.prompter.note(`Normalized account id to "${o}".`,`${e.label} account`),o}const E=async e=>await T(e);function D(e){return e.split(/[\n,;]+/g).map(e=>e.trim()).filter(Boolean)}function O(e,t){let n=e.map(e=>String(e).trim()).filter(Boolean).map(e=>{if(e===`*`)return`*`;if(!t)return e;let n=t(e);return typeof n==`string`?n.trim():``}).filter(Boolean);return[...new Set(n)]}function k(e){return e.accountId?.trim()?t.zt(e.accountId):e.defaultAccountId}async function A(e){let n=e.accountOverride?.trim(),r=n?t.zt(n):e.defaultAccountId;return e.shouldPromptAccountIds&&!n&&(r=await E({cfg:e.cfg,prompter:e.prompter,label:e.label,currentId:r,listAccountIds:e.listAccountIds,defaultAccountId:e.defaultAccountId})),r}const j=`whatsapp`;function M(e,t){return x(e,{dmPolicy:t})}function N(e,t){return x(e,{allowFrom:t},{unsetOnUndefined:[`allowFrom`]})}function P(e,t){return x(e,{selfChatMode:t})}async function F(e,t){let{authDir:i}=n.ks({cfg:e,accountId:t});return await r.g(d.default.join(i,`creds.json`))}async function I(e){let{prompter:t,existingAllowFrom:n}=e;await t.note(`We need the sender/owner number so OpenClaw can allowlist you.`,`WhatsApp number`);let i=await t.text({message:`Your personal WhatsApp number (the phone you will message from)`,placeholder:`+15555550123`,initialValue:n[0],validate:e=>{let t=String(e??``).trim();if(!t)return`Required`;if(!r.h(t))return`Invalid number: ${t}`}}),a=r.h(String(i).trim());if(!a)throw Error(`Invalid WhatsApp owner number (expected E.164 after validation).`);return{normalized:a,allowFrom:O([...n.filter(e=>e!==`*`),a],r.h)}}async function L(e){let{normalized:t,allowFrom:n}=await I({prompter:e.prompter,existingAllowFrom:e.existingAllowFrom}),r=P(e.cfg,!0);return r=M(r,`allowlist`),r=N(r,n),await e.prompter.note([...e.messageLines,`- allowFrom includes ${t}`].join(`
2
2
  `),e.title),r}function R(e){let t=D(e);if(t.length===0)return{entries:[]};let n=[];for(let e of t){if(e===`*`){n.push(`*`);continue}let t=r.h(e);if(!t)return{entries:[],invalidEntry:e};n.push(t)}return{entries:O(n,r.h)}}async function z(e,t,n,i){let a=e.channels?.whatsapp?.dmPolicy??`pairing`,o=e.channels?.whatsapp?.allowFrom??[],c=o.length>0?o.join(`, `):`unset`;if(i?.forceAllowlist)return await L({cfg:e,prompter:n,existingAllowFrom:o,title:`WhatsApp allowlist`,messageLines:[`Allowlist mode enabled.`]});if(await n.note(["WhatsApp direct chats are gated by `channels.whatsapp.dmPolicy` + `channels.whatsapp.allowFrom`.",`- pairing (default): unknown senders get a pairing code; owner approves`,`- allowlist: unknown senders are blocked`,`- open: public inbound DMs (requires allowFrom to include "*")`,`- disabled: ignore WhatsApp DMs`,``,`Current: dmPolicy=${a}, allowFrom=${c}`,`Docs: ${s.r(`/whatsapp`,`whatsapp`)}`].join(`
3
3
  `),`WhatsApp DM access`),await n.select({message:`WhatsApp phone setup`,options:[{value:`personal`,label:`This is my personal phone number`},{value:`separate`,label:`Separate phone just for OpenClaw`}]})===`personal`)return await L({cfg:e,prompter:n,existingAllowFrom:o,title:`WhatsApp personal phone`,messageLines:[`Personal phone mode enabled.`,`- dmPolicy set to allowlist (pairing skipped)`]});let l=await n.select({message:`WhatsApp DM policy`,options:[{value:`pairing`,label:`Pairing (recommended)`},{value:`allowlist`,label:`Allowlist only (block unknown senders)`},{value:`open`,label:`Open (public inbound DMs)`},{value:`disabled`,label:`Disabled (ignore WhatsApp DMs)`}]}),u=P(e,!1);if(u=M(u,l),l===`open`){let e=O([`*`,...o],r.h);return u=N(u,e.length>0?e:[`*`]),u}if(l===`disabled`)return u;let d=o.length>0?[{value:`keep`,label:`Keep current allowFrom`},{value:`unset`,label:`Unset allowFrom (use pairing approvals only)`},{value:`list`,label:`Set allowFrom to specific numbers`}]:[{value:`unset`,label:`Unset allowFrom (default)`},{value:`list`,label:`Set allowFrom to specific numbers`}],f=await n.select({message:`WhatsApp allowFrom (optional pre-allowlist)`,options:d.map(e=>({value:e.value,label:e.label}))});if(f!==`keep`)if(f===`unset`)u=N(u,void 0);else{let e=await n.text({message:`Allowed sender numbers (comma-separated, E.164)`,placeholder:`+15555550123, +447700900123`,validate:e=>{let t=String(e??``).trim();if(!t)return`Required`;let n=R(t);if(n.entries.length===0&&!n.invalidEntry)return`Required`;if(n.invalidEntry)return`Invalid number: ${n.invalidEntry}`}}),t=R(String(e));u=N(u,t.entries)}return u}const B={channel:j,getStatus:async({cfg:e,accountOverrides:t})=>{let r=n.Ds(e),i=k({accountId:t.whatsapp,defaultAccountId:r}),a=await F(e,i);return{channel:j,configured:a,statusLines:[`WhatsApp (${i===`default`?`default`:i}): ${a?`linked`:`not linked`}`],selectionHint:a?`linked`:`not linked`,quickstartScore:a?5:4}},configure:async({cfg:e,runtime:t,prompter:r,options:i,accountOverrides:a,shouldPromptAccountIds:o,forceAllowFrom:c})=>{let u=await A({cfg:e,prompter:r,label:`WhatsApp`,accountOverride:a.whatsapp,shouldPromptAccountIds:!!(o||i?.promptWhatsAppAccountId),listAccountIds:n.Es,defaultAccountId:n.Ds(e)}),d=e;u!==`default`&&(d={...d,channels:{...d.channels,whatsapp:{...d.channels?.whatsapp,accounts:{...d.channels?.whatsapp?.accounts,[u]:{...d.channels?.whatsapp?.accounts?.[u],enabled:d.channels?.whatsapp?.accounts?.[u]?.enabled??!0}}}}});let f=await F(d,u),{authDir:p}=n.ks({cfg:d,accountId:u});if(f||await r.note([`Scan the QR with WhatsApp on your phone.`,`Credentials are stored under ${p}/ for future runs.`,`Docs: ${s.r(`/whatsapp`,`whatsapp`)}`].join(`
4
4
  `),`WhatsApp linking`),await r.confirm({message:f?`WhatsApp already linked. Re-link now?`:`Link WhatsApp now (QR)?`,initialValue:!f}))try{await l.t(!1,void 0,t,u)}catch(e){t.error(`WhatsApp login failed: ${String(e)}`),await r.note(`Docs: ${s.r(`/whatsapp`,`whatsapp`)}`,`WhatsApp help`)}else f||await r.note(`Run \`${n.mc(`openclaw channels login`)}\` later to link WhatsApp.`,`WhatsApp`);return d=await z(d,t,r,{forceAllowlist:c}),{cfg:d,accountId:u}},onAccountRecorded:(e,t)=>{t?.onWhatsAppAccountId?.(e)}};function V(e){return typeof e==`string`&&e.trim().length>0?e.trim():void 0}function H(e){let t=[];for(let n of e.accounts){let r=e.readAccount(n);if(!r||r.enabled===!1)continue;let i=V(r.accountId)??`default`;e.collectIssues({account:r,accountId:i,issues:t})}return t}function U(e){return r.f(e)?{accountId:e.accountId,enabled:e.enabled,linked:e.linked,connected:e.connected,running:e.running,reconnectAttempts:e.reconnectAttempts,lastError:e.lastError}:null}function W(e){return H({accounts:e,readAccount:U,collectIssues:({account:e,accountId:t,issues:r})=>{let i=e.linked===!0,a=e.running===!0,o=e.connected===!0,s=typeof e.reconnectAttempts==`number`?e.reconnectAttempts:null,c=V(e.lastError);if(!i){r.push({channel:`whatsapp`,accountId:t,kind:`auth`,message:`Not linked (no WhatsApp Web session).`,fix:`Run: ${n.mc(`openclaw channels login`)} (scan QR on the gateway host).`});return}a&&!o&&r.push({channel:`whatsapp`,accountId:t,kind:`runtime`,message:`Linked but disconnected${s==null?``:` (reconnectAttempts=${s})`}${c?`: ${c}`:`.`}`,fix:`Run: ${n.mc(`openclaw doctor`)} (or restart the gateway). If it persists, relink via channels login and check logs.`})}})}exports.DEFAULT_ACCOUNT_ID=t.Rt,exports.WhatsAppConfigSchema=n.rt,exports.applyAccountNameToChannelSection=g,exports.buildChannelConfigSchema=y,exports.collectWhatsAppStatusIssues=W,exports.createActionGate=i.r,exports.emptyPluginConfigSchema=p,exports.formatPairingApproveHint=n.pc,exports.formatWhatsAppConfigAllowFromEntries=n.gs,exports.getChatChannelMeta=n.Gs,exports.listWhatsAppAccountIds=n.Es,exports.listWhatsAppDirectoryGroupsFromConfig=n.Wo,exports.listWhatsAppDirectoryPeersFromConfig=n.Go,exports.looksLikeWhatsAppTargetId=n.xs,exports.migrateBaseNameToDefaultAccount=_,exports.normalizeAccountId=t.zt,exports.normalizeE164=r.h,exports.normalizeWhatsAppMessagingTarget=n.Ss,exports.readStringParam=i.f,exports.resolveAllowlistProviderRuntimeGroupPolicy=o.Pt,exports.resolveDefaultGroupPolicy=o.Ft,exports.resolveDefaultWhatsAppAccountId=n.Ds,exports.resolveWhatsAppAccount=n.Os,exports.resolveWhatsAppConfigAllowFrom=n.vs,exports.resolveWhatsAppConfigDefaultTo=n.ys,exports.resolveWhatsAppGroupIntroHint=n.Fo,exports.resolveWhatsAppGroupRequireMention=n.Lo,exports.resolveWhatsAppGroupToolPolicy=n.Ro,exports.resolveWhatsAppHeartbeatRecipients=c.r,exports.resolveWhatsAppMentionStripPatterns=n.Io,exports.resolveWhatsAppOutboundTarget=a.t,exports.whatsappOnboardingAdapter=B;
@@ -1,4 +1,4 @@
1
- import{Rt as e,zt as t}from"./paths-cBAF6Bj0.js";import{Bo as n,Cs as r,Mo as i,No as a,Po as o,Ss as s,Ts as c,Vo as l,Vs as u,_s as d,fs as f,hs as p,jo as m,lc as ee,ms as h,rt as g,uc as _,vs as te,ws as ne}from"./sessions-B06a3AKE.js";import{f as v,g as y,h as b}from"./logger-vBDTZWl3.js";import"./paths-CnHSNSeR.js";import"./proxy-env-B765haXA.js";import"./send-d5RoIkxA.js";import{f as x,r as S}from"./common-CxLmdAIn.js";import{t as C}from"./resolve-outbound-target-BNv_T3Bk.js";import{Ft as re,Pt as ie}from"./send-MEvv6c7w.js";import{r as w}from"./reply-73PF8kN_.js";import"./github-copilot-token-N8vnLZPw.js";import"./send-D2LjU2py.js";import{r as ae}from"./channel-web-Bg8DNyeb.js";import"./tokens-B8ys7Q2e.js";import"./audio-transcription-runner-DZIEX1Rl.js";import"./image-Jmj-a1pv.js";import"./fetch-guard-nFWUH1s9.js";import"./api-key-rotation-ta953lKF.js";import"./local-roots-qEhx-D42.js";import"./proxy-fetch-CYVChsKE.js";import"./deliver-DQDZRjZ0.js";import"./commands-registry-Cf8DaBmw.js";import"./fetch-CCLWsYaQ.js";import"./diagnostic-BvrdTMl3.js";import"./pi-model-discovery-BQiHbl8F.js";import"./ir-Ca3EdqFl.js";import"./render-CBsnn-2A.js";import"./send-Dc43nN-I.js";import"./outbound-attachment-CTR1-VEH.js";import"./send-DMk529J8.js";import"./channel-activity--Ax2m0qQ.js";import"./tables-DOLEnfD6.js";import"./fetch-C-HRWp5R.js";import"./skill-commands-CgDUjb3J.js";import"./query-expansion-C_DnhmUy.js";import"./manager-zyDhj7B-.js";import"./outbound-BYU5HTrX.js";import"./session-CR8fsPgs.js";import{t as T}from"./login-DqVo92p1.js";import{z as E}from"zod";import D from"node:path";function O(e){return{success:!1,error:{issues:[{path:[],message:e}]}}}function k(){return{safeParse(e){return e===void 0?{success:!0,data:void 0}:!e||typeof e!=`object`||Array.isArray(e)?O(`expected config object`):Object.keys(e).length>0?O(`config must be empty`):{success:!0,data:e}},jsonSchema:{type:`object`,additionalProperties:!1,properties:{}}}}function A(e,t){let n=e.channels?.[t];return!!(n?.accounts&&Object.keys(n.accounts).length>0)}function j(e){return e.alwaysUseAccounts||e.accountId!==`default`?!0:A(e.cfg,e.channelKey)}function M(e){let n=e.name?.trim();if(!n)return e.cfg;let r=t(e.accountId),i=e.cfg.channels?.[e.channelKey],a=typeof i==`object`&&i?i:void 0;if(!j({cfg:e.cfg,channelKey:e.channelKey,accountId:r,alwaysUseAccounts:e.alwaysUseAccounts})&&r===`default`){let t=a??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channelKey]:{...t,name:n}}}}let o=a?.accounts??{},s=o[r]??{},c=r===`default`?(({name:e,...t})=>t)(a??{}):a??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channelKey]:{...c,accounts:{...o,[r]:{...s,name:n}}}}}}function N(t){if(t.alwaysUseAccounts)return t.cfg;let n=t.cfg.channels?.[t.channelKey],r=n?.name?.trim();if(!r)return t.cfg;let i={...n?.accounts},a=i.default??{};a.name||(i[e]={...a,name:r});let{name:o,...s}=n??{};return{...t.cfg,channels:{...t.cfg.channels,[t.channelKey]:{...s,accounts:i}}}}const P=E.union([E.string(),E.number()]);E.array(P).optional();function F(e){let t=e;return typeof t.toJSONSchema==`function`?{schema:t.toJSONSchema({target:`draft-07`,unrepresentable:`any`})}:{schema:{type:`object`,additionalProperties:!0}}}function I(e,t,n={}){let r={...e??void 0};for(let[e,i]of Object.entries(t)){if(i===void 0){n.unsetOnUndefined?.includes(e)&&delete r[e];continue}r[e]=i}return r}function L(e,t,n){return{...e,channels:{...e.channels,whatsapp:I(e.channels?.whatsapp,t,n)}}}const R={openai:[`OPENAI_API_KEY`],anthropic:[`ANTHROPIC_API_KEY`],google:[`GEMINI_API_KEY`],minimax:[`MINIMAX_API_KEY`],"minimax-cn":[`MINIMAX_API_KEY`],moonshot:[`MOONSHOT_API_KEY`],"kimi-coding":[`KIMI_API_KEY`,`KIMICODE_API_KEY`],synthetic:[`SYNTHETIC_API_KEY`],venice:[`VENICE_API_KEY`],zai:[`ZAI_API_KEY`,`Z_AI_API_KEY`],xiaomi:[`XIAOMI_API_KEY`],openrouter:[`OPENROUTER_API_KEY`],"cloudflare-ai-gateway":[`CLOUDFLARE_AI_GATEWAY_API_KEY`],litellm:[`LITELLM_API_KEY`],"vercel-ai-gateway":[`AI_GATEWAY_API_KEY`],opencode:[`OPENCODE_API_KEY`,`OPENCODE_ZEN_API_KEY`],"opencode-go":[`OPENCODE_API_KEY`,`OPENCODE_ZEN_API_KEY`],together:[`TOGETHER_API_KEY`],huggingface:[`HUGGINGFACE_HUB_TOKEN`,`HF_TOKEN`],qianfan:[`QIANFAN_API_KEY`],xai:[`XAI_API_KEY`],mistral:[`MISTRAL_API_KEY`],kilocode:[`KILOCODE_API_KEY`],modelstudio:[`MODELSTUDIO_API_KEY`],volcengine:[`VOLCANO_ENGINE_API_KEY`],byteplus:[`BYTEPLUS_API_KEY`]},z=[`VOYAGE_API_KEY`,`GROQ_API_KEY`,`DEEPGRAM_API_KEY`,`CEREBRAS_API_KEY`,`NVIDIA_API_KEY`,`COPILOT_GITHUB_TOKEN`,`GH_TOKEN`,`GITHUB_TOKEN`,`ANTHROPIC_OAUTH_TOKEN`,`CHUTES_OAUTH_TOKEN`,`CHUTES_API_KEY`,`QWEN_OAUTH_TOKEN`,`QWEN_PORTAL_API_KEY`,`MINIMAX_OAUTH_TOKEN`,`OLLAMA_API_KEY`,`VLLM_API_KEY`],oe=[...new Set(Object.values(R).flatMap(e=>e))];[...new Set([...oe,...z])];async function B(e){let n=e.listAccountIds(e.cfg),r=e.currentId?.trim()||e.defaultAccountId||`default`,i=await e.prompter.select({message:`${e.label} account`,options:[...n.map(e=>({value:e,label:e===`default`?`default (primary)`:e})),{value:`__new__`,label:`Add a new account`}],initialValue:r});if(i!==`__new__`)return t(i);let a=await e.prompter.text({message:`New ${e.label} account id`,validate:e=>e?.trim()?void 0:`Required`}),o=t(String(a));return String(a).trim()!==o&&await e.prompter.note(`Normalized account id to "${o}".`,`${e.label} account`),o}const V=async e=>await B(e);function H(e){return e.split(/[\n,;]+/g).map(e=>e.trim()).filter(Boolean)}function U(e,t){let n=e.map(e=>String(e).trim()).filter(Boolean).map(e=>{if(e===`*`)return`*`;if(!t)return e;let n=t(e);return typeof n==`string`?n.trim():``}).filter(Boolean);return[...new Set(n)]}function W(e){return e.accountId?.trim()?t(e.accountId):e.defaultAccountId}async function G(e){let n=e.accountOverride?.trim(),r=n?t(n):e.defaultAccountId;return e.shouldPromptAccountIds&&!n&&(r=await V({cfg:e.cfg,prompter:e.prompter,label:e.label,currentId:r,listAccountIds:e.listAccountIds,defaultAccountId:e.defaultAccountId})),r}const K=`whatsapp`;function q(e,t){return L(e,{dmPolicy:t})}function J(e,t){return L(e,{allowFrom:t},{unsetOnUndefined:[`allowFrom`]})}function Y(e,t){return L(e,{selfChatMode:t})}async function X(e,t){let{authDir:n}=c({cfg:e,accountId:t});return await y(D.join(n,`creds.json`))}async function se(e){let{prompter:t,existingAllowFrom:n}=e;await t.note(`We need the sender/owner number so OpenClaw can allowlist you.`,`WhatsApp number`);let r=await t.text({message:`Your personal WhatsApp number (the phone you will message from)`,placeholder:`+15555550123`,initialValue:n[0],validate:e=>{let t=String(e??``).trim();if(!t)return`Required`;if(!b(t))return`Invalid number: ${t}`}}),i=b(String(r).trim());if(!i)throw Error(`Invalid WhatsApp owner number (expected E.164 after validation).`);return{normalized:i,allowFrom:U([...n.filter(e=>e!==`*`),i],b)}}async function Z(e){let{normalized:t,allowFrom:n}=await se({prompter:e.prompter,existingAllowFrom:e.existingAllowFrom}),r=Y(e.cfg,!0);return r=q(r,`allowlist`),r=J(r,n),await e.prompter.note([...e.messageLines,`- allowFrom includes ${t}`].join(`
1
+ import{Rt as e,zt as t}from"./paths-cBAF6Bj0.js";import{Bo as n,Cs as r,Mo as i,No as a,Po as o,Ss as s,Ts as c,Vo as l,Vs as u,_s as d,fs as f,hs as p,jo as m,lc as ee,ms as h,rt as g,uc as _,vs as te,ws as ne}from"./sessions-B06a3AKE.js";import{f as v,g as y,h as b}from"./logger-vBDTZWl3.js";import"./paths-CnHSNSeR.js";import"./proxy-env-B765haXA.js";import"./send-d5RoIkxA.js";import{f as x,r as S}from"./common-CxLmdAIn.js";import{t as C}from"./resolve-outbound-target-BNv_T3Bk.js";import{Ft as re,Pt as ie}from"./send-MEvv6c7w.js";import{r as w}from"./reply-gpVkJsEs.js";import"./github-copilot-token-N8vnLZPw.js";import"./send-D2LjU2py.js";import{r as ae}from"./channel-web-CMlv9Yzv.js";import"./tokens-B8ys7Q2e.js";import"./audio-transcription-runner-DZIEX1Rl.js";import"./image-Jmj-a1pv.js";import"./fetch-guard-nFWUH1s9.js";import"./api-key-rotation-ta953lKF.js";import"./local-roots-qEhx-D42.js";import"./proxy-fetch-CYVChsKE.js";import"./deliver-DQDZRjZ0.js";import"./commands-registry-Cf8DaBmw.js";import"./fetch-CCLWsYaQ.js";import"./diagnostic-BvrdTMl3.js";import"./pi-model-discovery-BQiHbl8F.js";import"./ir-Ca3EdqFl.js";import"./render-CBsnn-2A.js";import"./send-Dc43nN-I.js";import"./outbound-attachment-CTR1-VEH.js";import"./send-DMk529J8.js";import"./channel-activity--Ax2m0qQ.js";import"./tables-DOLEnfD6.js";import"./fetch-C-HRWp5R.js";import"./skill-commands-CgDUjb3J.js";import"./query-expansion-C_DnhmUy.js";import"./manager-zyDhj7B-.js";import"./outbound-BYU5HTrX.js";import"./session-CR8fsPgs.js";import{t as T}from"./login-DqVo92p1.js";import{z as E}from"zod";import D from"node:path";function O(e){return{success:!1,error:{issues:[{path:[],message:e}]}}}function k(){return{safeParse(e){return e===void 0?{success:!0,data:void 0}:!e||typeof e!=`object`||Array.isArray(e)?O(`expected config object`):Object.keys(e).length>0?O(`config must be empty`):{success:!0,data:e}},jsonSchema:{type:`object`,additionalProperties:!1,properties:{}}}}function A(e,t){let n=e.channels?.[t];return!!(n?.accounts&&Object.keys(n.accounts).length>0)}function j(e){return e.alwaysUseAccounts||e.accountId!==`default`?!0:A(e.cfg,e.channelKey)}function M(e){let n=e.name?.trim();if(!n)return e.cfg;let r=t(e.accountId),i=e.cfg.channels?.[e.channelKey],a=typeof i==`object`&&i?i:void 0;if(!j({cfg:e.cfg,channelKey:e.channelKey,accountId:r,alwaysUseAccounts:e.alwaysUseAccounts})&&r===`default`){let t=a??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channelKey]:{...t,name:n}}}}let o=a?.accounts??{},s=o[r]??{},c=r===`default`?(({name:e,...t})=>t)(a??{}):a??{};return{...e.cfg,channels:{...e.cfg.channels,[e.channelKey]:{...c,accounts:{...o,[r]:{...s,name:n}}}}}}function N(t){if(t.alwaysUseAccounts)return t.cfg;let n=t.cfg.channels?.[t.channelKey],r=n?.name?.trim();if(!r)return t.cfg;let i={...n?.accounts},a=i.default??{};a.name||(i[e]={...a,name:r});let{name:o,...s}=n??{};return{...t.cfg,channels:{...t.cfg.channels,[t.channelKey]:{...s,accounts:i}}}}const P=E.union([E.string(),E.number()]);E.array(P).optional();function F(e){let t=e;return typeof t.toJSONSchema==`function`?{schema:t.toJSONSchema({target:`draft-07`,unrepresentable:`any`})}:{schema:{type:`object`,additionalProperties:!0}}}function I(e,t,n={}){let r={...e??void 0};for(let[e,i]of Object.entries(t)){if(i===void 0){n.unsetOnUndefined?.includes(e)&&delete r[e];continue}r[e]=i}return r}function L(e,t,n){return{...e,channels:{...e.channels,whatsapp:I(e.channels?.whatsapp,t,n)}}}const R={openai:[`OPENAI_API_KEY`],anthropic:[`ANTHROPIC_API_KEY`],google:[`GEMINI_API_KEY`],minimax:[`MINIMAX_API_KEY`],"minimax-cn":[`MINIMAX_API_KEY`],moonshot:[`MOONSHOT_API_KEY`],"kimi-coding":[`KIMI_API_KEY`,`KIMICODE_API_KEY`],synthetic:[`SYNTHETIC_API_KEY`],venice:[`VENICE_API_KEY`],zai:[`ZAI_API_KEY`,`Z_AI_API_KEY`],xiaomi:[`XIAOMI_API_KEY`],openrouter:[`OPENROUTER_API_KEY`],"cloudflare-ai-gateway":[`CLOUDFLARE_AI_GATEWAY_API_KEY`],litellm:[`LITELLM_API_KEY`],"vercel-ai-gateway":[`AI_GATEWAY_API_KEY`],opencode:[`OPENCODE_API_KEY`,`OPENCODE_ZEN_API_KEY`],"opencode-go":[`OPENCODE_API_KEY`,`OPENCODE_ZEN_API_KEY`],together:[`TOGETHER_API_KEY`],huggingface:[`HUGGINGFACE_HUB_TOKEN`,`HF_TOKEN`],qianfan:[`QIANFAN_API_KEY`],xai:[`XAI_API_KEY`],mistral:[`MISTRAL_API_KEY`],kilocode:[`KILOCODE_API_KEY`],modelstudio:[`MODELSTUDIO_API_KEY`],volcengine:[`VOLCANO_ENGINE_API_KEY`],byteplus:[`BYTEPLUS_API_KEY`]},z=[`VOYAGE_API_KEY`,`GROQ_API_KEY`,`DEEPGRAM_API_KEY`,`CEREBRAS_API_KEY`,`NVIDIA_API_KEY`,`COPILOT_GITHUB_TOKEN`,`GH_TOKEN`,`GITHUB_TOKEN`,`ANTHROPIC_OAUTH_TOKEN`,`CHUTES_OAUTH_TOKEN`,`CHUTES_API_KEY`,`QWEN_OAUTH_TOKEN`,`QWEN_PORTAL_API_KEY`,`MINIMAX_OAUTH_TOKEN`,`OLLAMA_API_KEY`,`VLLM_API_KEY`],oe=[...new Set(Object.values(R).flatMap(e=>e))];[...new Set([...oe,...z])];async function B(e){let n=e.listAccountIds(e.cfg),r=e.currentId?.trim()||e.defaultAccountId||`default`,i=await e.prompter.select({message:`${e.label} account`,options:[...n.map(e=>({value:e,label:e===`default`?`default (primary)`:e})),{value:`__new__`,label:`Add a new account`}],initialValue:r});if(i!==`__new__`)return t(i);let a=await e.prompter.text({message:`New ${e.label} account id`,validate:e=>e?.trim()?void 0:`Required`}),o=t(String(a));return String(a).trim()!==o&&await e.prompter.note(`Normalized account id to "${o}".`,`${e.label} account`),o}const V=async e=>await B(e);function H(e){return e.split(/[\n,;]+/g).map(e=>e.trim()).filter(Boolean)}function U(e,t){let n=e.map(e=>String(e).trim()).filter(Boolean).map(e=>{if(e===`*`)return`*`;if(!t)return e;let n=t(e);return typeof n==`string`?n.trim():``}).filter(Boolean);return[...new Set(n)]}function W(e){return e.accountId?.trim()?t(e.accountId):e.defaultAccountId}async function G(e){let n=e.accountOverride?.trim(),r=n?t(n):e.defaultAccountId;return e.shouldPromptAccountIds&&!n&&(r=await V({cfg:e.cfg,prompter:e.prompter,label:e.label,currentId:r,listAccountIds:e.listAccountIds,defaultAccountId:e.defaultAccountId})),r}const K=`whatsapp`;function q(e,t){return L(e,{dmPolicy:t})}function J(e,t){return L(e,{allowFrom:t},{unsetOnUndefined:[`allowFrom`]})}function Y(e,t){return L(e,{selfChatMode:t})}async function X(e,t){let{authDir:n}=c({cfg:e,accountId:t});return await y(D.join(n,`creds.json`))}async function se(e){let{prompter:t,existingAllowFrom:n}=e;await t.note(`We need the sender/owner number so OpenClaw can allowlist you.`,`WhatsApp number`);let r=await t.text({message:`Your personal WhatsApp number (the phone you will message from)`,placeholder:`+15555550123`,initialValue:n[0],validate:e=>{let t=String(e??``).trim();if(!t)return`Required`;if(!b(t))return`Invalid number: ${t}`}}),i=b(String(r).trim());if(!i)throw Error(`Invalid WhatsApp owner number (expected E.164 after validation).`);return{normalized:i,allowFrom:U([...n.filter(e=>e!==`*`),i],b)}}async function Z(e){let{normalized:t,allowFrom:n}=await se({prompter:e.prompter,existingAllowFrom:e.existingAllowFrom}),r=Y(e.cfg,!0);return r=q(r,`allowlist`),r=J(r,n),await e.prompter.note([...e.messageLines,`- allowFrom includes ${t}`].join(`
2
2
  `),e.title),r}function Q(e){let t=H(e);if(t.length===0)return{entries:[]};let n=[];for(let e of t){if(e===`*`){n.push(`*`);continue}let t=b(e);if(!t)return{entries:[],invalidEntry:e};n.push(t)}return{entries:U(n,b)}}async function ce(e,t,n,r){let i=e.channels?.whatsapp?.dmPolicy??`pairing`,a=e.channels?.whatsapp?.allowFrom??[],o=a.length>0?a.join(`, `):`unset`;if(r?.forceAllowlist)return await Z({cfg:e,prompter:n,existingAllowFrom:a,title:`WhatsApp allowlist`,messageLines:[`Allowlist mode enabled.`]});if(await n.note(["WhatsApp direct chats are gated by `channels.whatsapp.dmPolicy` + `channels.whatsapp.allowFrom`.",`- pairing (default): unknown senders get a pairing code; owner approves`,`- allowlist: unknown senders are blocked`,`- open: public inbound DMs (requires allowFrom to include "*")`,`- disabled: ignore WhatsApp DMs`,``,`Current: dmPolicy=${i}, allowFrom=${o}`,`Docs: ${w(`/whatsapp`,`whatsapp`)}`].join(`
3
3
  `),`WhatsApp DM access`),await n.select({message:`WhatsApp phone setup`,options:[{value:`personal`,label:`This is my personal phone number`},{value:`separate`,label:`Separate phone just for OpenClaw`}]})===`personal`)return await Z({cfg:e,prompter:n,existingAllowFrom:a,title:`WhatsApp personal phone`,messageLines:[`Personal phone mode enabled.`,`- dmPolicy set to allowlist (pairing skipped)`]});let s=await n.select({message:`WhatsApp DM policy`,options:[{value:`pairing`,label:`Pairing (recommended)`},{value:`allowlist`,label:`Allowlist only (block unknown senders)`},{value:`open`,label:`Open (public inbound DMs)`},{value:`disabled`,label:`Disabled (ignore WhatsApp DMs)`}]}),c=Y(e,!1);if(c=q(c,s),s===`open`){let e=U([`*`,...a],b);return c=J(c,e.length>0?e:[`*`]),c}if(s===`disabled`)return c;let l=a.length>0?[{value:`keep`,label:`Keep current allowFrom`},{value:`unset`,label:`Unset allowFrom (use pairing approvals only)`},{value:`list`,label:`Set allowFrom to specific numbers`}]:[{value:`unset`,label:`Unset allowFrom (default)`},{value:`list`,label:`Set allowFrom to specific numbers`}],u=await n.select({message:`WhatsApp allowFrom (optional pre-allowlist)`,options:l.map(e=>({value:e.value,label:e.label}))});if(u!==`keep`)if(u===`unset`)c=J(c,void 0);else{let e=await n.text({message:`Allowed sender numbers (comma-separated, E.164)`,placeholder:`+15555550123, +447700900123`,validate:e=>{let t=String(e??``).trim();if(!t)return`Required`;let n=Q(t);if(n.entries.length===0&&!n.invalidEntry)return`Required`;if(n.invalidEntry)return`Invalid number: ${n.invalidEntry}`}}),t=Q(String(e));c=J(c,t.entries)}return c}const le={channel:K,getStatus:async({cfg:e,accountOverrides:t})=>{let n=r(e),i=W({accountId:t.whatsapp,defaultAccountId:n}),a=await X(e,i);return{channel:K,configured:a,statusLines:[`WhatsApp (${i===`default`?`default`:i}): ${a?`linked`:`not linked`}`],selectionHint:a?`linked`:`not linked`,quickstartScore:a?5:4}},configure:async({cfg:e,runtime:t,prompter:n,options:i,accountOverrides:a,shouldPromptAccountIds:o,forceAllowFrom:l})=>{let u=await G({cfg:e,prompter:n,label:`WhatsApp`,accountOverride:a.whatsapp,shouldPromptAccountIds:!!(o||i?.promptWhatsAppAccountId),listAccountIds:s,defaultAccountId:r(e)}),d=e;u!==`default`&&(d={...d,channels:{...d.channels,whatsapp:{...d.channels?.whatsapp,accounts:{...d.channels?.whatsapp?.accounts,[u]:{...d.channels?.whatsapp?.accounts?.[u],enabled:d.channels?.whatsapp?.accounts?.[u]?.enabled??!0}}}}});let f=await X(d,u),{authDir:p}=c({cfg:d,accountId:u});if(f||await n.note([`Scan the QR with WhatsApp on your phone.`,`Credentials are stored under ${p}/ for future runs.`,`Docs: ${w(`/whatsapp`,`whatsapp`)}`].join(`
4
4
  `),`WhatsApp linking`),await n.confirm({message:f?`WhatsApp already linked. Re-link now?`:`Link WhatsApp now (QR)?`,initialValue:!f}))try{await T(!1,void 0,t,u)}catch(e){t.error(`WhatsApp login failed: ${String(e)}`),await n.note(`Docs: ${w(`/whatsapp`,`whatsapp`)}`,`WhatsApp help`)}else f||await n.note(`Run \`${_(`openclaw channels login`)}\` later to link WhatsApp.`,`WhatsApp`);return d=await ce(d,t,n,{forceAllowlist:l}),{cfg:d,accountId:u}},onAccountRecorded:(e,t)=>{t?.onWhatsAppAccountId?.(e)}};function $(e){return typeof e==`string`&&e.trim().length>0?e.trim():void 0}function ue(e){let t=[];for(let n of e.accounts){let r=e.readAccount(n);if(!r||r.enabled===!1)continue;let i=$(r.accountId)??`default`;e.collectIssues({account:r,accountId:i,issues:t})}return t}function de(e){return v(e)?{accountId:e.accountId,enabled:e.enabled,linked:e.linked,connected:e.connected,running:e.running,reconnectAttempts:e.reconnectAttempts,lastError:e.lastError}:null}function fe(e){return ue({accounts:e,readAccount:de,collectIssues:({account:e,accountId:t,issues:n})=>{let r=e.linked===!0,i=e.running===!0,a=e.connected===!0,o=typeof e.reconnectAttempts==`number`?e.reconnectAttempts:null,s=$(e.lastError);if(!r){n.push({channel:`whatsapp`,accountId:t,kind:`auth`,message:`Not linked (no WhatsApp Web session).`,fix:`Run: ${_(`openclaw channels login`)} (scan QR on the gateway host).`});return}i&&!a&&n.push({channel:`whatsapp`,accountId:t,kind:`runtime`,message:`Linked but disconnected${o==null?``:` (reconnectAttempts=${o})`}${s?`: ${s}`:`.`}`,fix:`Run: ${_(`openclaw doctor`)} (or restart the gateway). If it persists, relink via channels login and check logs.`})}})}export{e as DEFAULT_ACCOUNT_ID,g as WhatsAppConfigSchema,M as applyAccountNameToChannelSection,F as buildChannelConfigSchema,fe as collectWhatsAppStatusIssues,S as createActionGate,k as emptyPluginConfigSchema,ee as formatPairingApproveHint,f as formatWhatsAppConfigAllowFromEntries,u as getChatChannelMeta,s as listWhatsAppAccountIds,n as listWhatsAppDirectoryGroupsFromConfig,l as listWhatsAppDirectoryPeersFromConfig,d as looksLikeWhatsAppTargetId,N as migrateBaseNameToDefaultAccount,t as normalizeAccountId,b as normalizeE164,te as normalizeWhatsAppMessagingTarget,x as readStringParam,ie as resolveAllowlistProviderRuntimeGroupPolicy,re as resolveDefaultGroupPolicy,r as resolveDefaultWhatsAppAccountId,ne as resolveWhatsAppAccount,h as resolveWhatsAppConfigAllowFrom,p as resolveWhatsAppConfigDefaultTo,m as resolveWhatsAppGroupIntroHint,a as resolveWhatsAppGroupRequireMention,o as resolveWhatsAppGroupToolPolicy,ae as resolveWhatsAppHeartbeatRecipients,i as resolveWhatsAppMentionStripPatterns,C as resolveWhatsAppOutboundTarget,le as whatsappOnboardingAdapter};
@@ -1,4 +1,4 @@
1
- import{g as e}from"./paths-B4IRk3wi.js";import{A as t,p as n}from"./subsystem-C5XF2Fy5.js";import{S as r,g as i,x as a,y as o}from"./utils-UGOV_184.js";import{Lo as s,nc as c,qs as l}from"./model-selection-BLbnMb5E.js";import"./reply-DwfVhea1.js";import"./agent-scope-DXZc3eNT.js";import"./openclaw-root-D_0Q6--h.js";import"./github-copilot-token-DGYAlOmV.js";import"./boolean-Ch3DfXPy.js";import"./env-D7wNuBx1.js";import"./env-overrides-DXJbFrwI.js";import{N as u,P as d}from"./registry-hFAtCSWG.js";import{S as f,m as p}from"./skills-CzUpDbU-.js";import"./frontmatter-BkZkwkVO.js";import"./plugins-CYLrFT4h.js";import"./logger-Bl8URnrW.js";import"./exec-DHqLtFYt.js";import"./windows-spawn-AB7ItGAE.js";import"./redact-3_CiXMY6.js";import"./path-alias-guards-mvyLCPlN.js";import"./errors-Bunti32V.js";import"./send-C7rOdjPO.js";import"./send-BwblpWbK.js";import"./paths-yLEk_25I.js";import"./chat-envelope-HVpKusFc.js";import"./audio-transcription-runner-BwjMhAUa.js";import"./image-BP1cfEh1.js";import"./models-config-BlQ39qlq.js";import"./tool-display-DjuSUUbH.js";import"./fetch-guard-7BAwnP4a.js";import"./api-key-rotation-Rz2ESQSA.js";import"./local-roots-aA-4ohTq.js";import"./model-catalog-D-hkNWin.js";import"./proxy-fetch-BADsUK4d.js";import"./tokens-XGbQGn67.js";import"./deliver-DUNkj4hy.js";import"./commands-CGpM84iR.js";import"./commands-registry-DlvNUkXz.js";import"./pairing-store-EmfFQVcs.js";import"./fetch-Dikjvc5M.js";import"./call-JB-cGR9n.js";import"./with-timeout-WveKxvFV.js";import"./diagnostic-BEZszppF.js";import"./send-NbU9-scF2.js";import"./pi-model-discovery-DnJkNRc-.js";import"./exec-approvals-allowlist-B-Yf6RsU.js";import"./exec-safe-bin-runtime-policy-CRPHdPbF.js";import"./ir-CNTx85qV.js";import"./render-D8OWO2hT.js";import"./target-errors-CoEHv_2r.js";import"./read-only-account-inspect-B0cm8yrv.js";import"./channel-selection-si1OzWyQ.js";import"./plugin-auto-enable-CTgkkJK7.js";import"./send-DmHpf5Fz.js";import"./outbound-attachment-9-8VNvRG.js";import"./delivery-queue-CKbauSFq.js";import"./send-AQ3CJLpI.js";import"./channel-activity-Dw6F-ehJ.js";import"./tables-fl9iXahm.js";import"./fetch-Bn0mWg6a.js";import"./skill-commands-DlHVddAk.js";import"./workspace-dirs-BhF1Dzxt.js";import"./pairing-token-B8RdfK2y.js";import"./restart-BeJuoXCx.js";import"./runtime-web-tools-C4F6aaRh.js";import"./command-secret-targets-CfXtLkLF.js";import"./session-cost-usage-BgqKixv0.js";import"./connection-auth-smZlFWxD.js";import"./onboard-helpers-D90u4wVK.js";import"./prompt-style-CXKekIBY.js";import"./pairing-labels-PIuZfthz.js";import"./memory-cli-BouV_wyL.js";import"./query-expansion-0OxEb1Io.js";import"./manager-CI6O4QH6.js";import{t as m}from"./links-CySwdMcF.js";import"./cli-utils-BY7dLMFy.js";import"./help-format-BRbF_INg.js";import"./progress-LNttnI-y.js";import"./exec-approvals-BpBNEy6i.js";import"./nodes-screen-8nRBsfID.js";import"./system-run-command-E8ymBXHh.js";import"./runtime-DYttInEE.js";import"./stagger-DmFYysrJ.js";import{n as h,t as g}from"./enable-CjFPAUgo.js";import{u as _}from"./install-safe-path-iesxijn2.js";import"./npm-pack-install-B23L-AtF.js";import"./skill-scanner-CUUF3Fvo.js";import{c as v,l as y,n as b,r as x,s as S}from"./installs-DzSskdtJ.js";import{r as C,t as w}from"./plugin-install-plan-BmyB3dR1.js";import{n as T,t as E}from"./table-CY440fI1.js";import{i as D,n as O,r as k}from"./npm-resolution-CBlwQq3a.js";import{n as A}from"./update-D9EwPybG.js";import j from"node:fs";import M from"node:os";import N from"node:path";import P from"node:fs/promises";function F(e,t){let n=N.relative(e,t);return!n||n===`.`||n===`..`||n.startsWith(`..${N.sep}`)||n.startsWith(`../`)||n.startsWith(`..\\`)||N.isAbsolute(n)?null:n.replaceAll(`\\`,`/`)}function I(e){return{stock:f(),global:N.join(i(),`extensions`),workspace:e.workspaceDir?N.join(e.workspaceDir,`.openclaw`,`extensions`):void 0}}function L(e,t){let n=e.source;if(e.origin===`bundled`&&t.stock){let e=F(t.stock,n);if(e)return{value:`stock:${e}`,rootKey:`stock`}}if(e.origin===`workspace`&&t.workspace){let e=F(t.workspace,n);if(e)return{value:`workspace:${e}`,rootKey:`workspace`}}if(e.origin===`global`&&t.global){let e=F(t.global,n);if(e)return{value:`global:${e}`,rootKey:`global`}}return{value:a(n)}}function R(e){if(!e.hasInstall||e.installRecord?.source===`path`)return null;let t;try{t=y(e.pluginId,e.extensionsDir)}catch{return null}let n=e.installRecord?.installPath;return n&&N.resolve(n)===N.resolve(t)?n:t}function z(e,t){let n={entry:!1,install:!1,allowlist:!1,loadPath:!1,memorySlot:!1},r=e.plugins??{},i=r.entries;if(i&&t in i){let{[t]:e,...r}=i;i=Object.keys(r).length>0?r:void 0,n.entry=!0}let a=r.installs,o=a?.[t];if(a&&t in a){let{[t]:e,...r}=a;a=Object.keys(r).length>0?r:void 0,n.install=!0}let s=r.allow;Array.isArray(s)&&s.includes(t)&&(s=s.filter(e=>e!==t),s.length===0&&(s=void 0),n.allowlist=!0);let c=r.load;if(o?.source===`path`&&o.sourcePath){let e=o.sourcePath,t=c?.paths;if(Array.isArray(t)&&t.includes(e)){let r=t.filter(t=>t!==e);c=r.length>0?{...c,paths:r}:void 0,n.loadPath=!0}}let l=r.slots;l?.memory===t&&(l={...l,memory:d(`memory`)},n.memorySlot=!0),l&&Object.keys(l).length===0&&(l=void 0);let u={...r,entries:i,installs:a,allow:s,load:c,slots:l};return u.entries===void 0&&delete u.entries,u.installs===void 0&&delete u.installs,u.allow===void 0&&delete u.allow,u.load===void 0&&delete u.load,u.slots===void 0&&delete u.slots,{config:{...e,plugins:Object.keys(u).length>0?u:void 0},actions:n}}async function B(e){let{config:t,pluginId:n,deleteFiles:r=!0,extensionsDir:i}=e,a=n in(t.plugins?.entries??{}),o=n in(t.plugins?.installs??{});if(!a&&!o)return{ok:!1,error:`Plugin not found: ${n}`};let s=t.plugins?.installs?.[n],c=s?.source===`path`,{config:l,actions:u}=z(t,n),d={...u,directory:!1},f=[],p=r&&!c?R({pluginId:n,hasInstall:o,installRecord:s,extensionsDir:i}):null;if(p){let e=await P.access(p).then(()=>!0).catch(()=>!1)??!1;try{await P.rm(p,{recursive:!0,force:!0}),d.directory=e}catch(e){f.push(`Failed to remove plugin directory ${p}: ${e instanceof Error?e.message:String(e)}`)}}return{ok:!0,config:l,pluginId:n,actions:d,warnings:f}}function V(e){let t=e.trim();if(!t.toLowerCase().startsWith(`file:`))return null;let n=t.slice(5);return n?n.startsWith(`///`)?{ok:!0,path:n.slice(2)}:n.startsWith(`//localhost/`)?{ok:!0,path:n.slice(11)}:n.startsWith(`//`)?{ok:!1,error:`unsupported file: URL host (expected "file:<path>" or "file:///abs/path")`}:{ok:!0,path:n}:{ok:!1,error:`unsupported file: spec: missing path`}}function H(e,n=!1){let r=e.status===`loaded`?t.success(`loaded`):e.status===`disabled`?t.warn(`disabled`):t.error(`error`),i=t.command(e.name||e.id),o=e.name&&e.name!==e.id?t.muted(` (${e.id})`):``,s=e.description?t.muted(e.description.length>60?`${e.description.slice(0,57)}...`:e.description):t.muted(`(no description)`);if(!n)return`${i}${o} ${r} - ${s}`;let c=[`${i}${o} ${r}`,` source: ${t.muted(a(e.source))}`,` origin: ${e.origin}`];return e.version&&c.push(` version: ${e.version}`),e.providerIds.length>0&&c.push(` providers: ${e.providerIds.join(`, `)}`),e.error&&c.push(t.error(` error: ${e.error}`)),c.join(`
1
+ import{g as e}from"./paths-B4IRk3wi.js";import{A as t,p as n}from"./subsystem-C5XF2Fy5.js";import{S as r,g as i,x as a,y as o}from"./utils-UGOV_184.js";import{Lo as s,nc as c,qs as l}from"./model-selection-BLbnMb5E.js";import"./reply-mWIMy_ju.js";import"./agent-scope-DXZc3eNT.js";import"./openclaw-root-D_0Q6--h.js";import"./github-copilot-token-DGYAlOmV.js";import"./boolean-Ch3DfXPy.js";import"./env-D7wNuBx1.js";import"./env-overrides-DXJbFrwI.js";import{N as u,P as d}from"./registry-hFAtCSWG.js";import{S as f,m as p}from"./skills-CzUpDbU-.js";import"./frontmatter-BkZkwkVO.js";import"./plugins-CYLrFT4h.js";import"./logger-Bl8URnrW.js";import"./exec-DHqLtFYt.js";import"./windows-spawn-AB7ItGAE.js";import"./redact-3_CiXMY6.js";import"./path-alias-guards-mvyLCPlN.js";import"./errors-Bunti32V.js";import"./send-C7rOdjPO.js";import"./send-BwblpWbK.js";import"./paths-yLEk_25I.js";import"./chat-envelope-HVpKusFc.js";import"./audio-transcription-runner-BwjMhAUa.js";import"./image-BP1cfEh1.js";import"./models-config-BlQ39qlq.js";import"./tool-display-DjuSUUbH.js";import"./fetch-guard-7BAwnP4a.js";import"./api-key-rotation-Rz2ESQSA.js";import"./local-roots-aA-4ohTq.js";import"./model-catalog-D-hkNWin.js";import"./proxy-fetch-BADsUK4d.js";import"./tokens-XGbQGn67.js";import"./deliver-DUNkj4hy.js";import"./commands-CGpM84iR.js";import"./commands-registry-DlvNUkXz.js";import"./pairing-store-EmfFQVcs.js";import"./fetch-Dikjvc5M.js";import"./call-JB-cGR9n.js";import"./with-timeout-WveKxvFV.js";import"./diagnostic-BEZszppF.js";import"./send-NbU9-scF2.js";import"./pi-model-discovery-DnJkNRc-.js";import"./exec-approvals-allowlist-B-Yf6RsU.js";import"./exec-safe-bin-runtime-policy-CRPHdPbF.js";import"./ir-CNTx85qV.js";import"./render-D8OWO2hT.js";import"./target-errors-CoEHv_2r.js";import"./read-only-account-inspect-B0cm8yrv.js";import"./channel-selection-si1OzWyQ.js";import"./plugin-auto-enable-CTgkkJK7.js";import"./send-DmHpf5Fz.js";import"./outbound-attachment-9-8VNvRG.js";import"./delivery-queue-CKbauSFq.js";import"./send-AQ3CJLpI.js";import"./channel-activity-Dw6F-ehJ.js";import"./tables-fl9iXahm.js";import"./fetch-Bn0mWg6a.js";import"./skill-commands-DlHVddAk.js";import"./workspace-dirs-BhF1Dzxt.js";import"./pairing-token-B8RdfK2y.js";import"./restart-BeJuoXCx.js";import"./runtime-web-tools-C4F6aaRh.js";import"./command-secret-targets-CfXtLkLF.js";import"./session-cost-usage-BgqKixv0.js";import"./connection-auth-smZlFWxD.js";import"./onboard-helpers-D90u4wVK.js";import"./prompt-style-CXKekIBY.js";import"./pairing-labels-PIuZfthz.js";import"./memory-cli-BouV_wyL.js";import"./query-expansion-0OxEb1Io.js";import"./manager-CI6O4QH6.js";import{t as m}from"./links-CySwdMcF.js";import"./cli-utils-BY7dLMFy.js";import"./help-format-BRbF_INg.js";import"./progress-LNttnI-y.js";import"./exec-approvals-BpBNEy6i.js";import"./nodes-screen-8nRBsfID.js";import"./system-run-command-E8ymBXHh.js";import"./runtime-DYttInEE.js";import"./stagger-DmFYysrJ.js";import{n as h,t as g}from"./enable-CjFPAUgo.js";import{u as _}from"./install-safe-path-iesxijn2.js";import"./npm-pack-install-B23L-AtF.js";import"./skill-scanner-CUUF3Fvo.js";import{c as v,l as y,n as b,r as x,s as S}from"./installs-DzSskdtJ.js";import{r as C,t as w}from"./plugin-install-plan-BmyB3dR1.js";import{n as T,t as E}from"./table-CY440fI1.js";import{i as D,n as O,r as k}from"./npm-resolution-BzXV2s2P.js";import{n as A}from"./update-D9EwPybG.js";import j from"node:fs";import M from"node:os";import N from"node:path";import P from"node:fs/promises";function F(e,t){let n=N.relative(e,t);return!n||n===`.`||n===`..`||n.startsWith(`..${N.sep}`)||n.startsWith(`../`)||n.startsWith(`..\\`)||N.isAbsolute(n)?null:n.replaceAll(`\\`,`/`)}function I(e){return{stock:f(),global:N.join(i(),`extensions`),workspace:e.workspaceDir?N.join(e.workspaceDir,`.openclaw`,`extensions`):void 0}}function L(e,t){let n=e.source;if(e.origin===`bundled`&&t.stock){let e=F(t.stock,n);if(e)return{value:`stock:${e}`,rootKey:`stock`}}if(e.origin===`workspace`&&t.workspace){let e=F(t.workspace,n);if(e)return{value:`workspace:${e}`,rootKey:`workspace`}}if(e.origin===`global`&&t.global){let e=F(t.global,n);if(e)return{value:`global:${e}`,rootKey:`global`}}return{value:a(n)}}function R(e){if(!e.hasInstall||e.installRecord?.source===`path`)return null;let t;try{t=y(e.pluginId,e.extensionsDir)}catch{return null}let n=e.installRecord?.installPath;return n&&N.resolve(n)===N.resolve(t)?n:t}function z(e,t){let n={entry:!1,install:!1,allowlist:!1,loadPath:!1,memorySlot:!1},r=e.plugins??{},i=r.entries;if(i&&t in i){let{[t]:e,...r}=i;i=Object.keys(r).length>0?r:void 0,n.entry=!0}let a=r.installs,o=a?.[t];if(a&&t in a){let{[t]:e,...r}=a;a=Object.keys(r).length>0?r:void 0,n.install=!0}let s=r.allow;Array.isArray(s)&&s.includes(t)&&(s=s.filter(e=>e!==t),s.length===0&&(s=void 0),n.allowlist=!0);let c=r.load;if(o?.source===`path`&&o.sourcePath){let e=o.sourcePath,t=c?.paths;if(Array.isArray(t)&&t.includes(e)){let r=t.filter(t=>t!==e);c=r.length>0?{...c,paths:r}:void 0,n.loadPath=!0}}let l=r.slots;l?.memory===t&&(l={...l,memory:d(`memory`)},n.memorySlot=!0),l&&Object.keys(l).length===0&&(l=void 0);let u={...r,entries:i,installs:a,allow:s,load:c,slots:l};return u.entries===void 0&&delete u.entries,u.installs===void 0&&delete u.installs,u.allow===void 0&&delete u.allow,u.load===void 0&&delete u.load,u.slots===void 0&&delete u.slots,{config:{...e,plugins:Object.keys(u).length>0?u:void 0},actions:n}}async function B(e){let{config:t,pluginId:n,deleteFiles:r=!0,extensionsDir:i}=e,a=n in(t.plugins?.entries??{}),o=n in(t.plugins?.installs??{});if(!a&&!o)return{ok:!1,error:`Plugin not found: ${n}`};let s=t.plugins?.installs?.[n],c=s?.source===`path`,{config:l,actions:u}=z(t,n),d={...u,directory:!1},f=[],p=r&&!c?R({pluginId:n,hasInstall:o,installRecord:s,extensionsDir:i}):null;if(p){let e=await P.access(p).then(()=>!0).catch(()=>!1)??!1;try{await P.rm(p,{recursive:!0,force:!0}),d.directory=e}catch(e){f.push(`Failed to remove plugin directory ${p}: ${e instanceof Error?e.message:String(e)}`)}}return{ok:!0,config:l,pluginId:n,actions:d,warnings:f}}function V(e){let t=e.trim();if(!t.toLowerCase().startsWith(`file:`))return null;let n=t.slice(5);return n?n.startsWith(`///`)?{ok:!0,path:n.slice(2)}:n.startsWith(`//localhost/`)?{ok:!0,path:n.slice(11)}:n.startsWith(`//`)?{ok:!1,error:`unsupported file: URL host (expected "file:<path>" or "file:///abs/path")`}:{ok:!0,path:n}:{ok:!1,error:`unsupported file: spec: missing path`}}function H(e,n=!1){let r=e.status===`loaded`?t.success(`loaded`):e.status===`disabled`?t.warn(`disabled`):t.error(`error`),i=t.command(e.name||e.id),o=e.name&&e.name!==e.id?t.muted(` (${e.id})`):``,s=e.description?t.muted(e.description.length>60?`${e.description.slice(0,57)}...`:e.description):t.muted(`(no description)`);if(!n)return`${i}${o} ${r} - ${s}`;let c=[`${i}${o} ${r}`,` source: ${t.muted(a(e.source))}`,` origin: ${e.origin}`];return e.version&&c.push(` version: ${e.version}`),e.providerIds.length>0&&c.push(` providers: ${e.providerIds.join(`, `)}`),e.error&&c.push(t.error(` error: ${e.error}`)),c.join(`
2
2
  `)}function U(e,t){let n=D({config:e}),r=n.plugins.find(e=>e.id===t);if(!r)return{config:e,warnings:[]};let i=u({config:e,selectedId:r.id,selectedKind:r.kind,registry:n});return{config:i.config,warnings:i.warnings}}function W(){return{info:e=>n.log(e),warn:e=>n.log(t.warn(e))}}function G(e){if(e.length!==0)for(let r of e)n.log(t.warn(r))}async function K(e){let r=e.config.plugins?.load?.paths??[],i=Array.from(new Set([...r,e.bundledSource.localPath])),a={...e.config,plugins:{...e.config.plugins,load:{...e.config.plugins?.load,paths:i},entries:{...e.config.plugins?.entries,[e.bundledSource.pluginId]:{...e.config.plugins?.entries?.[e.bundledSource.pluginId],enabled:!0}}}};a=b(a,{pluginId:e.bundledSource.pluginId,source:`path`,spec:e.rawSpec,sourcePath:e.bundledSource.localPath,installPath:e.bundledSource.localPath});let o=U(a,e.bundledSource.pluginId);a=o.config,await c(a),G(o.warnings),n.log(t.warn(e.warning)),n.log(`Installed plugin: ${e.bundledSource.pluginId}`),n.log(`Restart the gateway to load plugins.`)}async function q(e){let{raw:i,opts:a}=e,s=V(i);s&&!s.ok&&(n.error(s.error),process.exit(1));let u=o(s&&s.ok?s.path:i),d=l();if(j.existsSync(u)){if(a.link){let e=d.plugins?.load?.paths??[],t=Array.from(new Set([...e,u])),i=await v({path:u,dryRun:!0});i.ok||(n.error(i.error),process.exit(1));let a=g({...d,plugins:{...d.plugins,load:{...d.plugins?.load,paths:t}}},i.pluginId).config;a=b(a,{pluginId:i.pluginId,source:`path`,sourcePath:u,installPath:u,version:i.version});let o=U(a,i.pluginId);a=o.config,await c(a),G(o.warnings),n.log(`Linked plugin path: ${r(u)}`),n.log(`Restart the gateway to load plugins.`);return}let e=await v({path:u,logger:W()});e.ok||(n.error(e.error),process.exit(1)),p();let t=g(d,e.pluginId).config,i=_(u)?`archive`:`path`;t=b(t,{pluginId:e.pluginId,source:i,sourcePath:u,installPath:e.targetDir,version:e.version});let o=U(t,e.pluginId);t=o.config,await c(t),G(o.warnings),n.log(`Installed plugin: ${e.pluginId}`),n.log(`Restart the gateway to load plugins.`);return}a.link&&(n.error("`--link` requires a local path."),process.exit(1)),k(i,[`.ts`,`.js`,`.mjs`,`.cjs`,`.tgz`,`.tar.gz`,`.tar`,`.zip`])&&(n.error(`Path not found: ${u}`),process.exit(1));let f=w({rawSpec:i,findBundledSource:e=>x({lookup:e})});if(f){await K({config:d,rawSpec:i,bundledSource:f.bundledSource,warning:f.warning});return}let m=await S({spec:i,logger:W()});if(!m.ok){let e=C({rawSpec:i,code:m.code,findBundledSource:e=>x({lookup:e})});e||(n.error(m.error),process.exit(1)),await K({config:d,rawSpec:i,bundledSource:e.bundledSource,warning:e.warning});return}p();let h=g(d,m.pluginId).config,y=O(i,!!a.pin,m.targetDir,m.version,m.npmResolution,n.log,t.warn);h=b(h,{pluginId:m.pluginId,...y});let T=U(h,m.pluginId);h=T.config,await c(h),G(T.warnings),n.log(`Installed plugin: ${m.pluginId}`),n.log(`Restart the gateway to load plugins.`)}function J(i){let o=i.command(`plugins`).description(`Manage OpenClaw plugins and extensions`).addHelpText(`after`,()=>`\n${t.muted(`Docs:`)} ${m(`/cli/plugins`,`docs.openclaw.ai/cli/plugins`)}\n`);o.command(`list`).description(`List discovered plugins`).option(`--json`,`Print JSON`).option(`--enabled`,`Only show enabled plugins`,!1).option(`--verbose`,`Show detailed entries`,!1).action(e=>{let r=D(),i=e.enabled?r.plugins.filter(e=>e.status===`loaded`):r.plugins;if(e.json){let e={workspaceDir:r.workspaceDir,plugins:i,diagnostics:r.diagnostics};n.log(JSON.stringify(e,null,2));return}if(i.length===0){n.log(t.muted(`No plugins found.`));return}let a=i.filter(e=>e.status===`loaded`).length;if(n.log(`${t.heading(`Plugins`)} ${t.muted(`(${a}/${i.length} loaded)`)}`),!e.verbose){let e=E(),a=I({workspaceDir:r.workspaceDir}),o=new Set,s=i.map(e=>{let n=e.description?t.muted(e.description):``,r=L(e,a);r.rootKey&&o.add(r.rootKey);let i=n?`${r.value}\n${n}`:r.value;return{Name:e.name||e.id,ID:e.name&&e.name!==e.id?e.id:``,Status:e.status===`loaded`?t.success(`loaded`):e.status===`disabled`?t.warn(`disabled`):t.error(`error`),Source:i,Version:e.version??``}});if(o.size>0){n.log(t.muted(`Source roots:`));for(let e of[`stock`,`workspace`,`global`]){if(!o.has(e))continue;let r=a[e];r&&n.log(` ${t.command(`${e}:`)} ${t.muted(r)}`)}n.log(``)}n.log(T({width:e,columns:[{key:`Name`,header:`Name`,minWidth:14,flex:!0},{key:`ID`,header:`ID`,minWidth:10,flex:!0},{key:`Status`,header:`Status`,minWidth:10},{key:`Source`,header:`Source`,minWidth:26,flex:!0},{key:`Version`,header:`Version`,minWidth:8}],rows:s}).trimEnd());return}let o=[];for(let e of i)o.push(H(e,!0)),o.push(``);n.log(o.join(`
3
3
  `).trim())}),o.command(`info`).description(`Show plugin details`).argument(`<id>`,`Plugin id`).option(`--json`,`Print JSON`).action((e,i)=>{let o=D().plugins.find(t=>t.id===e||t.name===e);o||(n.error(`Plugin not found: ${e}`),process.exit(1));let s=l().plugins?.installs?.[o.id];if(i.json){n.log(JSON.stringify(o,null,2));return}let c=[];c.push(t.heading(o.name||o.id)),o.name&&o.name!==o.id&&c.push(t.muted(`id: ${o.id}`)),o.description&&c.push(o.description),c.push(``),c.push(`${t.muted(`Status:`)} ${o.status}`),c.push(`${t.muted(`Source:`)} ${a(o.source)}`),c.push(`${t.muted(`Origin:`)} ${o.origin}`),o.version&&c.push(`${t.muted(`Version:`)} ${o.version}`),o.toolNames.length>0&&c.push(`${t.muted(`Tools:`)} ${o.toolNames.join(`, `)}`),o.hookNames.length>0&&c.push(`${t.muted(`Hooks:`)} ${o.hookNames.join(`, `)}`),o.gatewayMethods.length>0&&c.push(`${t.muted(`Gateway methods:`)} ${o.gatewayMethods.join(`, `)}`),o.providerIds.length>0&&c.push(`${t.muted(`Providers:`)} ${o.providerIds.join(`, `)}`),o.cliCommands.length>0&&c.push(`${t.muted(`CLI commands:`)} ${o.cliCommands.join(`, `)}`),o.services.length>0&&c.push(`${t.muted(`Services:`)} ${o.services.join(`, `)}`),o.error&&c.push(`${t.error(`Error:`)} ${o.error}`),s&&(c.push(``),c.push(`${t.muted(`Install:`)} ${s.source}`),s.spec&&c.push(`${t.muted(`Spec:`)} ${s.spec}`),s.sourcePath&&c.push(`${t.muted(`Source path:`)} ${r(s.sourcePath)}`),s.installPath&&c.push(`${t.muted(`Install path:`)} ${r(s.installPath)}`),s.version&&c.push(`${t.muted(`Recorded version:`)} ${s.version}`),s.installedAt&&c.push(`${t.muted(`Installed at:`)} ${s.installedAt}`)),n.log(c.join(`
4
4
  `))}),o.command(`enable`).description(`Enable a plugin in config`).argument(`<id>`,`Plugin id`).action(async e=>{let r=g(l(),e),i=r.config,a=U(i,e);if(i=a.config,await c(i),G(a.warnings),r.enabled){n.log(`Enabled plugin "${e}". Restart the gateway to apply.`);return}n.log(t.warn(`Plugin "${e}" could not be enabled (${r.reason??`unknown reason`}).`))}),o.command(`disable`).description(`Disable a plugin in config`).argument(`<id>`,`Plugin id`).action(async e=>{await c(h(l(),e,!1)),n.log(`Disabled plugin "${e}". Restart the gateway to apply.`)}),o.command(`uninstall`).description(`Uninstall a plugin`).argument(`<id>`,`Plugin id`).option(`--keep-files`,`Keep installed files on disk`,!1).option(`--keep-config`,`Deprecated alias for --keep-files`,!1).option(`--force`,`Skip confirmation prompt`,!1).option(`--dry-run`,`Show what would be removed without making changes`,!1).action(async(i,a)=>{let o=l(),u=D({config:o}),d=N.join(e(process.env,M.homedir),`extensions`),f=!!(a.keepFiles||a.keepConfig);a.keepConfig&&n.log(t.warn("`--keep-config` is deprecated, use `--keep-files`."));let p=u.plugins.find(e=>e.id===i||e.name===i),m=p?.id??i,h=m in(o.plugins?.entries??{}),g=m in(o.plugins?.installs??{});!h&&!g&&(p?n.error(`Plugin "${m}" is not managed by plugins config/install records and cannot be uninstalled.`):n.error(`Plugin not found: ${i}`),process.exit(1));let _=o.plugins?.installs?.[m],v=_?.source===`path`,y=[];h&&y.push(`config entry`),g&&y.push(`install record`),o.plugins?.allow?.includes(m)&&y.push(`allowlist entry`),v&&_?.sourcePath&&o.plugins?.load?.paths?.includes(_.sourcePath)&&y.push(`load path`),o.plugins?.slots?.memory===m&&y.push(`memory slot (will reset to "memory-core")`);let b=f?null:R({pluginId:m,hasInstall:g,installRecord:_,extensionsDir:d});b&&y.push(`directory: ${r(b)}`);let x=p?.name||m;if(n.log(`Plugin: ${t.command(x)}${x===m?``:t.muted(` (${m})`)}`),n.log(`Will remove: ${y.length>0?y.join(`, `):`(nothing)`}`),a.dryRun){n.log(t.muted(`Dry run, no changes made.`));return}if(!a.force&&!await s(`Uninstall plugin "${m}"?`)){n.log(`Cancelled.`);return}let S=await B({config:o,pluginId:m,deleteFiles:!f,extensionsDir:d});S.ok||(n.error(S.error),process.exit(1));for(let e of S.warnings)n.log(t.warn(e));await c(S.config);let C=[];S.actions.entry&&C.push(`config entry`),S.actions.install&&C.push(`install record`),S.actions.allowlist&&C.push(`allowlist`),S.actions.loadPath&&C.push(`load path`),S.actions.memorySlot&&C.push(`memory slot`),S.actions.directory&&C.push(`directory`),n.log(`Uninstalled plugin "${m}". Removed: ${C.length>0?C.join(`, `):`nothing`}.`),n.log(`Restart the gateway to apply changes.`)}),o.command(`install`).description(`Install a plugin (path, archive, or npm spec)`).argument(`<path-or-spec>`,`Path (.ts/.js/.zip/.tgz/.tar.gz) or an npm package spec`).option(`-l, --link`,`Link a local path instead of copying`,!1).option(`--pin`,`Record npm installs as exact resolved <name>@<version>`,!1).action(async(e,t)=>{await q({raw:e,opts:t})}),o.command(`update`).description(`Update installed plugins (npm installs only)`).argument(`[id]`,`Plugin id (omit with --all)`).option(`--all`,`Update all tracked plugins`,!1).option(`--dry-run`,`Show what would change without writing`,!1).action(async(e,r)=>{let i=l(),a=i.plugins?.installs??{},o=r.all?Object.keys(a):e?[e]:[];if(o.length===0){if(r.all){n.log(`No npm-installed plugins to update.`);return}n.error(`Provide a plugin id or use --all.`),process.exit(1)}let u=await A({config:i,pluginIds:o,dryRun:r.dryRun,logger:{info:e=>n.log(e),warn:e=>n.log(t.warn(e))},onIntegrityDrift:async e=>{let r=e.resolvedSpec??e.spec;return n.log(t.warn(`Integrity drift detected for "${e.pluginId}" (${r})\nExpected: ${e.expectedIntegrity}\nActual: ${e.actualIntegrity}`)),e.dryRun?!0:await s(`Continue updating "${e.pluginId}" with this artifact?`)}});for(let e of u.outcomes){if(e.status===`error`){n.log(t.error(e.message));continue}if(e.status===`skipped`){n.log(t.warn(e.message));continue}n.log(e.message)}!r.dryRun&&u.changed&&(await c(u.config),n.log(`Restart the gateway to load plugins.`))}),o.command(`doctor`).description(`Report plugin load issues`).action(()=>{let e=D(),r=e.plugins.filter(e=>e.status===`error`),i=e.diagnostics.filter(e=>e.level===`error`);if(r.length===0&&i.length===0){n.log(`No plugin issues detected.`);return}let a=[];if(r.length>0){a.push(t.error(`Plugin errors:`));for(let e of r)a.push(`- ${e.id}: ${e.error??`failed to load`} (${e.source})`)}if(i.length>0){a.length>0&&a.push(``),a.push(t.warn(`Diagnostics:`));for(let e of i){let t=e.pluginId?`${e.pluginId}: `:``;a.push(`- ${t}${e.message}`)}}let o=m(`/plugin`,`docs.openclaw.ai/plugin`);a.push(``),a.push(`${t.muted(`Docs:`)} ${o}`),n.log(a.join(`
@@ -1,4 +1,4 @@
1
- import{A as e,p as t}from"./subsystem-BLbY429l.js";import{g as n}from"./paths-BjD3T_xq.js";import"./boolean-D15s2V33.js";import{Bo as r,jo as i,xa as a}from"./auth-profiles-C8rZRS0X.js";import"./agent-scope-DAWJwFfl.js";import{b as o,h as s,v as c,x as l}from"./utils-CGdo13HV.js";import"./openclaw-root-CnsBf6ZU.js";import"./github-copilot-token-C79yeDKS.js";import"./env-overrides-DHtB4kK3.js";import"./version-q3SkUw2K.js";import{N as u,P as d}from"./registry-BptzrW8D.js";import{S as f,m as p}from"./skills-Bz_S4lPh.js";import"./frontmatter-C7mzDNxd.js";import"./plugins-DNlgeTTc.js";import"./logger-kQAOe3qp.js";import"./exec-B3eleY5O.js";import"./windows-spawn-7oINn5ao.js";import"./redact-CnRxK70G.js";import"./path-alias-guards-kY_ZbWs-.js";import"./errors-6SQWM9dj.js";import"./send-vNcod64S.js";import"./send-CyarIb2w.js";import"./compact-CYbPi7_-.js";import"./paths-BfjJY2VL.js";import"./chat-envelope-Bznn2SoS.js";import"./models-config-DZzS67GS.js";import"./tokens-DRM8vzJx.js";import"./with-timeout-c1CzdShT.js";import"./deliver-SqSusZP3.js";import"./diagnostic-D1H7_8QG.js";import"./send-Dj7NBAWg.js";import"./pi-model-discovery-BPkhPDMr.js";import"./exec-approvals-allowlist-CGjRWREs.js";import"./exec-safe-bin-runtime-policy-v44u39fl.js";import"./model-catalog-mt0IcDfR.js";import"./fetch-B4bz67_N.js";import"./audio-transcription-runner-BIKj1CBU.js";import"./fetch-guard-DaZmvp-L.js";import"./image-BVbOr9yV.js";import"./tool-display-DJDtttQg.js";import"./api-key-rotation-BpEL4aeX.js";import"./proxy-fetch-gWETR3cl.js";import"./ir-DdjufzKF.js";import"./render-DrrPmnMI.js";import"./target-errors-D6wejRd6.js";import"./commands-Dy7duWlt.js";import"./commands-registry-DT6FDUev.js";import"./session-cost-usage-CHtVgnE8.js";import"./session-utils-Bpdyx2A2.js";import"./sqlite-CILF3z9U.js";import"./call-BWx7hNtl.js";import"./pi-tools.policy-B6q8YOfg.js";import"./pairing-store-BaaVy1zB.js";import"./fetch-Dh-apy46.js";import"./skill-commands-DCqPy_Aa.js";import"./workspace-dirs-A8Vib9_B.js";import"./pairing-token-zdbQ951y.js";import"./channel-activity-BhiLsKvM.js";import"./tables-DENKrP-W.js";import"./kill-tree-D6nPx1_o.js";import"./runtime-web-tools-BYhCkBV8.js";import"./runtime-CK7gqwEF.js";import"./node-shell-BVZylVP6.js";import"./stagger-DxzgG2jd.js";import"./channel-selection-BPxE8JR7.js";import"./plugin-auto-enable-adba5Evb.js";import"./send-ChILboDj.js";import"./outbound-attachment-CVcDBkAD.js";import"./delivery-queue-nkPJu0fY.js";import"./send-COpehmAB.js";import"./system-run-command-DsWBVvSK.js";import"./fetch-Ce-scEU-.js";import"./command-secret-targets-BEjtBf5Z.js";import"./connection-auth-CjaeEu5D.js";import"./onboard-helpers-DOlI17Ac.js";import"./prompt-style-BThRSQJR.js";import"./pairing-labels-CZ-aX-up.js";import"./search-manager-CV2YsAym.js";import"./manager-CxZRoQkE.js";import"./memory-cli-C8fBBPgv.js";import{t as m}from"./links-CBnmRP9D.js";import"./cli-utils-BleB1eys.js";import"./help-format-B4aEI7V9.js";import"./progress-d1m2sqR1.js";import"./exec-approvals-BXO9Cezj.js";import{n as h,t as g}from"./enable-PO3qN4Lf.js";import{u as _}from"./install-safe-path-C6kc_8NW.js";import"./npm-pack-install-C0te3Oap.js";import"./skill-scanner-CkxXNioD.js";import{c as v,l as y,n as b,r as x,s as S}from"./installs-CKzq-YqL.js";import{r as C,t as w}from"./plugin-install-plan-sIOiMBS1.js";import{n as T,t as E}from"./table-CR7TFMew.js";import{i as D,n as O,r as k}from"./npm-resolution--_-0q2ks.js";import{n as A}from"./update-CMneH_48.js";import j from"node:os";import M from"node:path";import N from"node:fs";import P from"node:fs/promises";function F(e,t){let n=M.relative(e,t);return!n||n===`.`||n===`..`||n.startsWith(`..${M.sep}`)||n.startsWith(`../`)||n.startsWith(`..\\`)||M.isAbsolute(n)?null:n.replaceAll(`\\`,`/`)}function I(e){return{stock:f(),global:M.join(s(),`extensions`),workspace:e.workspaceDir?M.join(e.workspaceDir,`.openclaw`,`extensions`):void 0}}function L(e,t){let n=e.source;if(e.origin===`bundled`&&t.stock){let e=F(t.stock,n);if(e)return{value:`stock:${e}`,rootKey:`stock`}}if(e.origin===`workspace`&&t.workspace){let e=F(t.workspace,n);if(e)return{value:`workspace:${e}`,rootKey:`workspace`}}if(e.origin===`global`&&t.global){let e=F(t.global,n);if(e)return{value:`global:${e}`,rootKey:`global`}}return{value:o(n)}}function R(e){if(!e.hasInstall||e.installRecord?.source===`path`)return null;let t;try{t=y(e.pluginId,e.extensionsDir)}catch{return null}let n=e.installRecord?.installPath;return n&&M.resolve(n)===M.resolve(t)?n:t}function z(e,t){let n={entry:!1,install:!1,allowlist:!1,loadPath:!1,memorySlot:!1},r=e.plugins??{},i=r.entries;if(i&&t in i){let{[t]:e,...r}=i;i=Object.keys(r).length>0?r:void 0,n.entry=!0}let a=r.installs,o=a?.[t];if(a&&t in a){let{[t]:e,...r}=a;a=Object.keys(r).length>0?r:void 0,n.install=!0}let s=r.allow;Array.isArray(s)&&s.includes(t)&&(s=s.filter(e=>e!==t),s.length===0&&(s=void 0),n.allowlist=!0);let c=r.load;if(o?.source===`path`&&o.sourcePath){let e=o.sourcePath,t=c?.paths;if(Array.isArray(t)&&t.includes(e)){let r=t.filter(t=>t!==e);c=r.length>0?{...c,paths:r}:void 0,n.loadPath=!0}}let l=r.slots;l?.memory===t&&(l={...l,memory:d(`memory`)},n.memorySlot=!0),l&&Object.keys(l).length===0&&(l=void 0);let u={...r,entries:i,installs:a,allow:s,load:c,slots:l};return u.entries===void 0&&delete u.entries,u.installs===void 0&&delete u.installs,u.allow===void 0&&delete u.allow,u.load===void 0&&delete u.load,u.slots===void 0&&delete u.slots,{config:{...e,plugins:Object.keys(u).length>0?u:void 0},actions:n}}async function B(e){let{config:t,pluginId:n,deleteFiles:r=!0,extensionsDir:i}=e,a=n in(t.plugins?.entries??{}),o=n in(t.plugins?.installs??{});if(!a&&!o)return{ok:!1,error:`Plugin not found: ${n}`};let s=t.plugins?.installs?.[n],c=s?.source===`path`,{config:l,actions:u}=z(t,n),d={...u,directory:!1},f=[],p=r&&!c?R({pluginId:n,hasInstall:o,installRecord:s,extensionsDir:i}):null;if(p){let e=await P.access(p).then(()=>!0).catch(()=>!1)??!1;try{await P.rm(p,{recursive:!0,force:!0}),d.directory=e}catch(e){f.push(`Failed to remove plugin directory ${p}: ${e instanceof Error?e.message:String(e)}`)}}return{ok:!0,config:l,pluginId:n,actions:d,warnings:f}}function V(e){let t=e.trim();if(!t.toLowerCase().startsWith(`file:`))return null;let n=t.slice(5);return n?n.startsWith(`///`)?{ok:!0,path:n.slice(2)}:n.startsWith(`//localhost/`)?{ok:!0,path:n.slice(11)}:n.startsWith(`//`)?{ok:!1,error:`unsupported file: URL host (expected "file:<path>" or "file:///abs/path")`}:{ok:!0,path:n}:{ok:!1,error:`unsupported file: spec: missing path`}}function H(t,n=!1){let r=t.status===`loaded`?e.success(`loaded`):t.status===`disabled`?e.warn(`disabled`):e.error(`error`),i=e.command(t.name||t.id),a=t.name&&t.name!==t.id?e.muted(` (${t.id})`):``,s=t.description?e.muted(t.description.length>60?`${t.description.slice(0,57)}...`:t.description):e.muted(`(no description)`);if(!n)return`${i}${a} ${r} - ${s}`;let c=[`${i}${a} ${r}`,` source: ${e.muted(o(t.source))}`,` origin: ${t.origin}`];return t.version&&c.push(` version: ${t.version}`),t.providerIds.length>0&&c.push(` providers: ${t.providerIds.join(`, `)}`),t.error&&c.push(e.error(` error: ${t.error}`)),c.join(`
1
+ import{A as e,p as t}from"./subsystem-BLbY429l.js";import{g as n}from"./paths-BjD3T_xq.js";import"./boolean-D15s2V33.js";import{Bo as r,jo as i,xa as a}from"./auth-profiles-C8rZRS0X.js";import"./agent-scope-DAWJwFfl.js";import{b as o,h as s,v as c,x as l}from"./utils-CGdo13HV.js";import"./openclaw-root-CnsBf6ZU.js";import"./github-copilot-token-C79yeDKS.js";import"./env-overrides-DHtB4kK3.js";import"./version-q3SkUw2K.js";import{N as u,P as d}from"./registry-BptzrW8D.js";import{S as f,m as p}from"./skills-Bz_S4lPh.js";import"./frontmatter-C7mzDNxd.js";import"./plugins-DNlgeTTc.js";import"./logger-kQAOe3qp.js";import"./exec-B3eleY5O.js";import"./windows-spawn-7oINn5ao.js";import"./redact-CnRxK70G.js";import"./path-alias-guards-kY_ZbWs-.js";import"./errors-6SQWM9dj.js";import"./send-vNcod64S.js";import"./send-CyarIb2w.js";import"./compact-uyQDx8pN.js";import"./paths-BfjJY2VL.js";import"./chat-envelope-Bznn2SoS.js";import"./models-config-DZzS67GS.js";import"./tokens-DRM8vzJx.js";import"./with-timeout-c1CzdShT.js";import"./deliver-SqSusZP3.js";import"./diagnostic-D1H7_8QG.js";import"./send-Dj7NBAWg.js";import"./pi-model-discovery-BPkhPDMr.js";import"./exec-approvals-allowlist-CGjRWREs.js";import"./exec-safe-bin-runtime-policy-v44u39fl.js";import"./model-catalog-mt0IcDfR.js";import"./fetch-B4bz67_N.js";import"./audio-transcription-runner-BIKj1CBU.js";import"./fetch-guard-DaZmvp-L.js";import"./image-BVbOr9yV.js";import"./tool-display-DJDtttQg.js";import"./api-key-rotation-BpEL4aeX.js";import"./proxy-fetch-gWETR3cl.js";import"./ir-DdjufzKF.js";import"./render-DrrPmnMI.js";import"./target-errors-D6wejRd6.js";import"./commands-Dy7duWlt.js";import"./commands-registry-DT6FDUev.js";import"./session-cost-usage-CHtVgnE8.js";import"./session-utils-Bpdyx2A2.js";import"./sqlite-CILF3z9U.js";import"./call-BWx7hNtl.js";import"./pi-tools.policy-B6q8YOfg.js";import"./pairing-store-BaaVy1zB.js";import"./fetch-Dh-apy46.js";import"./skill-commands-DCqPy_Aa.js";import"./workspace-dirs-A8Vib9_B.js";import"./pairing-token-zdbQ951y.js";import"./channel-activity-BhiLsKvM.js";import"./tables-DENKrP-W.js";import"./kill-tree-D6nPx1_o.js";import"./runtime-web-tools-BYhCkBV8.js";import"./runtime-CK7gqwEF.js";import"./node-shell-BVZylVP6.js";import"./stagger-DxzgG2jd.js";import"./channel-selection-BPxE8JR7.js";import"./plugin-auto-enable-adba5Evb.js";import"./send-ChILboDj.js";import"./outbound-attachment-CVcDBkAD.js";import"./delivery-queue-nkPJu0fY.js";import"./send-COpehmAB.js";import"./system-run-command-DsWBVvSK.js";import"./fetch-Ce-scEU-.js";import"./command-secret-targets-BEjtBf5Z.js";import"./connection-auth-CjaeEu5D.js";import"./onboard-helpers-DOlI17Ac.js";import"./prompt-style-BThRSQJR.js";import"./pairing-labels-CZ-aX-up.js";import"./search-manager-CV2YsAym.js";import"./manager-CxZRoQkE.js";import"./memory-cli-C8fBBPgv.js";import{t as m}from"./links-CBnmRP9D.js";import"./cli-utils-BleB1eys.js";import"./help-format-B4aEI7V9.js";import"./progress-d1m2sqR1.js";import"./exec-approvals-BXO9Cezj.js";import{n as h,t as g}from"./enable-PO3qN4Lf.js";import{u as _}from"./install-safe-path-C6kc_8NW.js";import"./npm-pack-install-C0te3Oap.js";import"./skill-scanner-CkxXNioD.js";import{c as v,l as y,n as b,r as x,s as S}from"./installs-CKzq-YqL.js";import{r as C,t as w}from"./plugin-install-plan-sIOiMBS1.js";import{n as T,t as E}from"./table-CR7TFMew.js";import{i as D,n as O,r as k}from"./npm-resolution-CZUqHH_2.js";import{n as A}from"./update-CMneH_48.js";import j from"node:os";import M from"node:path";import N from"node:fs";import P from"node:fs/promises";function F(e,t){let n=M.relative(e,t);return!n||n===`.`||n===`..`||n.startsWith(`..${M.sep}`)||n.startsWith(`../`)||n.startsWith(`..\\`)||M.isAbsolute(n)?null:n.replaceAll(`\\`,`/`)}function I(e){return{stock:f(),global:M.join(s(),`extensions`),workspace:e.workspaceDir?M.join(e.workspaceDir,`.openclaw`,`extensions`):void 0}}function L(e,t){let n=e.source;if(e.origin===`bundled`&&t.stock){let e=F(t.stock,n);if(e)return{value:`stock:${e}`,rootKey:`stock`}}if(e.origin===`workspace`&&t.workspace){let e=F(t.workspace,n);if(e)return{value:`workspace:${e}`,rootKey:`workspace`}}if(e.origin===`global`&&t.global){let e=F(t.global,n);if(e)return{value:`global:${e}`,rootKey:`global`}}return{value:o(n)}}function R(e){if(!e.hasInstall||e.installRecord?.source===`path`)return null;let t;try{t=y(e.pluginId,e.extensionsDir)}catch{return null}let n=e.installRecord?.installPath;return n&&M.resolve(n)===M.resolve(t)?n:t}function z(e,t){let n={entry:!1,install:!1,allowlist:!1,loadPath:!1,memorySlot:!1},r=e.plugins??{},i=r.entries;if(i&&t in i){let{[t]:e,...r}=i;i=Object.keys(r).length>0?r:void 0,n.entry=!0}let a=r.installs,o=a?.[t];if(a&&t in a){let{[t]:e,...r}=a;a=Object.keys(r).length>0?r:void 0,n.install=!0}let s=r.allow;Array.isArray(s)&&s.includes(t)&&(s=s.filter(e=>e!==t),s.length===0&&(s=void 0),n.allowlist=!0);let c=r.load;if(o?.source===`path`&&o.sourcePath){let e=o.sourcePath,t=c?.paths;if(Array.isArray(t)&&t.includes(e)){let r=t.filter(t=>t!==e);c=r.length>0?{...c,paths:r}:void 0,n.loadPath=!0}}let l=r.slots;l?.memory===t&&(l={...l,memory:d(`memory`)},n.memorySlot=!0),l&&Object.keys(l).length===0&&(l=void 0);let u={...r,entries:i,installs:a,allow:s,load:c,slots:l};return u.entries===void 0&&delete u.entries,u.installs===void 0&&delete u.installs,u.allow===void 0&&delete u.allow,u.load===void 0&&delete u.load,u.slots===void 0&&delete u.slots,{config:{...e,plugins:Object.keys(u).length>0?u:void 0},actions:n}}async function B(e){let{config:t,pluginId:n,deleteFiles:r=!0,extensionsDir:i}=e,a=n in(t.plugins?.entries??{}),o=n in(t.plugins?.installs??{});if(!a&&!o)return{ok:!1,error:`Plugin not found: ${n}`};let s=t.plugins?.installs?.[n],c=s?.source===`path`,{config:l,actions:u}=z(t,n),d={...u,directory:!1},f=[],p=r&&!c?R({pluginId:n,hasInstall:o,installRecord:s,extensionsDir:i}):null;if(p){let e=await P.access(p).then(()=>!0).catch(()=>!1)??!1;try{await P.rm(p,{recursive:!0,force:!0}),d.directory=e}catch(e){f.push(`Failed to remove plugin directory ${p}: ${e instanceof Error?e.message:String(e)}`)}}return{ok:!0,config:l,pluginId:n,actions:d,warnings:f}}function V(e){let t=e.trim();if(!t.toLowerCase().startsWith(`file:`))return null;let n=t.slice(5);return n?n.startsWith(`///`)?{ok:!0,path:n.slice(2)}:n.startsWith(`//localhost/`)?{ok:!0,path:n.slice(11)}:n.startsWith(`//`)?{ok:!1,error:`unsupported file: URL host (expected "file:<path>" or "file:///abs/path")`}:{ok:!0,path:n}:{ok:!1,error:`unsupported file: spec: missing path`}}function H(t,n=!1){let r=t.status===`loaded`?e.success(`loaded`):t.status===`disabled`?e.warn(`disabled`):e.error(`error`),i=e.command(t.name||t.id),a=t.name&&t.name!==t.id?e.muted(` (${t.id})`):``,s=t.description?e.muted(t.description.length>60?`${t.description.slice(0,57)}...`:t.description):e.muted(`(no description)`);if(!n)return`${i}${a} ${r} - ${s}`;let c=[`${i}${a} ${r}`,` source: ${e.muted(o(t.source))}`,` origin: ${t.origin}`];return t.version&&c.push(` version: ${t.version}`),t.providerIds.length>0&&c.push(` providers: ${t.providerIds.join(`, `)}`),t.error&&c.push(e.error(` error: ${t.error}`)),c.join(`
2
2
  `)}function U(e,t){let n=D({config:e}),r=n.plugins.find(e=>e.id===t);if(!r)return{config:e,warnings:[]};let i=u({config:e,selectedId:r.id,selectedKind:r.kind,registry:n});return{config:i.config,warnings:i.warnings}}function W(){return{info:e=>t.log(e),warn:n=>t.log(e.warn(n))}}function G(n){if(n.length!==0)for(let r of n)t.log(e.warn(r))}async function K(n){let i=n.config.plugins?.load?.paths??[],a=Array.from(new Set([...i,n.bundledSource.localPath])),o={...n.config,plugins:{...n.config.plugins,load:{...n.config.plugins?.load,paths:a},entries:{...n.config.plugins?.entries,[n.bundledSource.pluginId]:{...n.config.plugins?.entries?.[n.bundledSource.pluginId],enabled:!0}}}};o=b(o,{pluginId:n.bundledSource.pluginId,source:`path`,spec:n.rawSpec,sourcePath:n.bundledSource.localPath,installPath:n.bundledSource.localPath});let s=U(o,n.bundledSource.pluginId);o=s.config,await r(o),G(s.warnings),t.log(e.warn(n.warning)),t.log(`Installed plugin: ${n.bundledSource.pluginId}`),t.log(`Restart the gateway to load plugins.`)}async function q(n){let{raw:a,opts:o}=n,s=V(a);s&&!s.ok&&(t.error(s.error),process.exit(1));let u=c(s&&s.ok?s.path:a),d=i();if(N.existsSync(u)){if(o.link){let e=d.plugins?.load?.paths??[],n=Array.from(new Set([...e,u])),i=await v({path:u,dryRun:!0});i.ok||(t.error(i.error),process.exit(1));let a=g({...d,plugins:{...d.plugins,load:{...d.plugins?.load,paths:n}}},i.pluginId).config;a=b(a,{pluginId:i.pluginId,source:`path`,sourcePath:u,installPath:u,version:i.version});let o=U(a,i.pluginId);a=o.config,await r(a),G(o.warnings),t.log(`Linked plugin path: ${l(u)}`),t.log(`Restart the gateway to load plugins.`);return}let e=await v({path:u,logger:W()});e.ok||(t.error(e.error),process.exit(1)),p();let n=g(d,e.pluginId).config,i=_(u)?`archive`:`path`;n=b(n,{pluginId:e.pluginId,source:i,sourcePath:u,installPath:e.targetDir,version:e.version});let a=U(n,e.pluginId);n=a.config,await r(n),G(a.warnings),t.log(`Installed plugin: ${e.pluginId}`),t.log(`Restart the gateway to load plugins.`);return}o.link&&(t.error("`--link` requires a local path."),process.exit(1)),k(a,[`.ts`,`.js`,`.mjs`,`.cjs`,`.tgz`,`.tar.gz`,`.tar`,`.zip`])&&(t.error(`Path not found: ${u}`),process.exit(1));let f=w({rawSpec:a,findBundledSource:e=>x({lookup:e})});if(f){await K({config:d,rawSpec:a,bundledSource:f.bundledSource,warning:f.warning});return}let m=await S({spec:a,logger:W()});if(!m.ok){let e=C({rawSpec:a,code:m.code,findBundledSource:e=>x({lookup:e})});e||(t.error(m.error),process.exit(1)),await K({config:d,rawSpec:a,bundledSource:e.bundledSource,warning:e.warning});return}p();let h=g(d,m.pluginId).config,y=O(a,!!o.pin,m.targetDir,m.version,m.npmResolution,t.log,e.warn);h=b(h,{pluginId:m.pluginId,...y});let T=U(h,m.pluginId);h=T.config,await r(h),G(T.warnings),t.log(`Installed plugin: ${m.pluginId}`),t.log(`Restart the gateway to load plugins.`)}function J(s){let c=s.command(`plugins`).description(`Manage OpenClaw plugins and extensions`).addHelpText(`after`,()=>`\n${e.muted(`Docs:`)} ${m(`/cli/plugins`,`docs.openclaw.ai/cli/plugins`)}\n`);c.command(`list`).description(`List discovered plugins`).option(`--json`,`Print JSON`).option(`--enabled`,`Only show enabled plugins`,!1).option(`--verbose`,`Show detailed entries`,!1).action(n=>{let r=D(),i=n.enabled?r.plugins.filter(e=>e.status===`loaded`):r.plugins;if(n.json){let e={workspaceDir:r.workspaceDir,plugins:i,diagnostics:r.diagnostics};t.log(JSON.stringify(e,null,2));return}if(i.length===0){t.log(e.muted(`No plugins found.`));return}let a=i.filter(e=>e.status===`loaded`).length;if(t.log(`${e.heading(`Plugins`)} ${e.muted(`(${a}/${i.length} loaded)`)}`),!n.verbose){let n=E(),a=I({workspaceDir:r.workspaceDir}),o=new Set,s=i.map(t=>{let n=t.description?e.muted(t.description):``,r=L(t,a);r.rootKey&&o.add(r.rootKey);let i=n?`${r.value}\n${n}`:r.value;return{Name:t.name||t.id,ID:t.name&&t.name!==t.id?t.id:``,Status:t.status===`loaded`?e.success(`loaded`):t.status===`disabled`?e.warn(`disabled`):e.error(`error`),Source:i,Version:t.version??``}});if(o.size>0){t.log(e.muted(`Source roots:`));for(let n of[`stock`,`workspace`,`global`]){if(!o.has(n))continue;let r=a[n];r&&t.log(` ${e.command(`${n}:`)} ${e.muted(r)}`)}t.log(``)}t.log(T({width:n,columns:[{key:`Name`,header:`Name`,minWidth:14,flex:!0},{key:`ID`,header:`ID`,minWidth:10,flex:!0},{key:`Status`,header:`Status`,minWidth:10},{key:`Source`,header:`Source`,minWidth:26,flex:!0},{key:`Version`,header:`Version`,minWidth:8}],rows:s}).trimEnd());return}let o=[];for(let e of i)o.push(H(e,!0)),o.push(``);t.log(o.join(`
3
3
  `).trim())}),c.command(`info`).description(`Show plugin details`).argument(`<id>`,`Plugin id`).option(`--json`,`Print JSON`).action((n,r)=>{let a=D().plugins.find(e=>e.id===n||e.name===n);a||(t.error(`Plugin not found: ${n}`),process.exit(1));let s=i().plugins?.installs?.[a.id];if(r.json){t.log(JSON.stringify(a,null,2));return}let c=[];c.push(e.heading(a.name||a.id)),a.name&&a.name!==a.id&&c.push(e.muted(`id: ${a.id}`)),a.description&&c.push(a.description),c.push(``),c.push(`${e.muted(`Status:`)} ${a.status}`),c.push(`${e.muted(`Source:`)} ${o(a.source)}`),c.push(`${e.muted(`Origin:`)} ${a.origin}`),a.version&&c.push(`${e.muted(`Version:`)} ${a.version}`),a.toolNames.length>0&&c.push(`${e.muted(`Tools:`)} ${a.toolNames.join(`, `)}`),a.hookNames.length>0&&c.push(`${e.muted(`Hooks:`)} ${a.hookNames.join(`, `)}`),a.gatewayMethods.length>0&&c.push(`${e.muted(`Gateway methods:`)} ${a.gatewayMethods.join(`, `)}`),a.providerIds.length>0&&c.push(`${e.muted(`Providers:`)} ${a.providerIds.join(`, `)}`),a.cliCommands.length>0&&c.push(`${e.muted(`CLI commands:`)} ${a.cliCommands.join(`, `)}`),a.services.length>0&&c.push(`${e.muted(`Services:`)} ${a.services.join(`, `)}`),a.error&&c.push(`${e.error(`Error:`)} ${a.error}`),s&&(c.push(``),c.push(`${e.muted(`Install:`)} ${s.source}`),s.spec&&c.push(`${e.muted(`Spec:`)} ${s.spec}`),s.sourcePath&&c.push(`${e.muted(`Source path:`)} ${l(s.sourcePath)}`),s.installPath&&c.push(`${e.muted(`Install path:`)} ${l(s.installPath)}`),s.version&&c.push(`${e.muted(`Recorded version:`)} ${s.version}`),s.installedAt&&c.push(`${e.muted(`Installed at:`)} ${s.installedAt}`)),t.log(c.join(`
4
4
  `))}),c.command(`enable`).description(`Enable a plugin in config`).argument(`<id>`,`Plugin id`).action(async n=>{let a=g(i(),n),o=a.config,s=U(o,n);if(o=s.config,await r(o),G(s.warnings),a.enabled){t.log(`Enabled plugin "${n}". Restart the gateway to apply.`);return}t.log(e.warn(`Plugin "${n}" could not be enabled (${a.reason??`unknown reason`}).`))}),c.command(`disable`).description(`Disable a plugin in config`).argument(`<id>`,`Plugin id`).action(async e=>{await r(h(i(),e,!1)),t.log(`Disabled plugin "${e}". Restart the gateway to apply.`)}),c.command(`uninstall`).description(`Uninstall a plugin`).argument(`<id>`,`Plugin id`).option(`--keep-files`,`Keep installed files on disk`,!1).option(`--keep-config`,`Deprecated alias for --keep-files`,!1).option(`--force`,`Skip confirmation prompt`,!1).option(`--dry-run`,`Show what would be removed without making changes`,!1).action(async(o,s)=>{let c=i(),u=D({config:c}),d=M.join(n(process.env,j.homedir),`extensions`),f=!!(s.keepFiles||s.keepConfig);s.keepConfig&&t.log(e.warn("`--keep-config` is deprecated, use `--keep-files`."));let p=u.plugins.find(e=>e.id===o||e.name===o),m=p?.id??o,h=m in(c.plugins?.entries??{}),g=m in(c.plugins?.installs??{});!h&&!g&&(p?t.error(`Plugin "${m}" is not managed by plugins config/install records and cannot be uninstalled.`):t.error(`Plugin not found: ${o}`),process.exit(1));let _=c.plugins?.installs?.[m],v=_?.source===`path`,y=[];h&&y.push(`config entry`),g&&y.push(`install record`),c.plugins?.allow?.includes(m)&&y.push(`allowlist entry`),v&&_?.sourcePath&&c.plugins?.load?.paths?.includes(_.sourcePath)&&y.push(`load path`),c.plugins?.slots?.memory===m&&y.push(`memory slot (will reset to "memory-core")`);let b=f?null:R({pluginId:m,hasInstall:g,installRecord:_,extensionsDir:d});b&&y.push(`directory: ${l(b)}`);let x=p?.name||m;if(t.log(`Plugin: ${e.command(x)}${x===m?``:e.muted(` (${m})`)}`),t.log(`Will remove: ${y.length>0?y.join(`, `):`(nothing)`}`),s.dryRun){t.log(e.muted(`Dry run, no changes made.`));return}if(!s.force&&!await a(`Uninstall plugin "${m}"?`)){t.log(`Cancelled.`);return}let S=await B({config:c,pluginId:m,deleteFiles:!f,extensionsDir:d});S.ok||(t.error(S.error),process.exit(1));for(let n of S.warnings)t.log(e.warn(n));await r(S.config);let C=[];S.actions.entry&&C.push(`config entry`),S.actions.install&&C.push(`install record`),S.actions.allowlist&&C.push(`allowlist`),S.actions.loadPath&&C.push(`load path`),S.actions.memorySlot&&C.push(`memory slot`),S.actions.directory&&C.push(`directory`),t.log(`Uninstalled plugin "${m}". Removed: ${C.length>0?C.join(`, `):`nothing`}.`),t.log(`Restart the gateway to apply changes.`)}),c.command(`install`).description(`Install a plugin (path, archive, or npm spec)`).argument(`<path-or-spec>`,`Path (.ts/.js/.zip/.tgz/.tar.gz) or an npm package spec`).option(`-l, --link`,`Link a local path instead of copying`,!1).option(`--pin`,`Record npm installs as exact resolved <name>@<version>`,!1).action(async(e,t)=>{await q({raw:e,opts:t})}),c.command(`update`).description(`Update installed plugins (npm installs only)`).argument(`[id]`,`Plugin id (omit with --all)`).option(`--all`,`Update all tracked plugins`,!1).option(`--dry-run`,`Show what would change without writing`,!1).action(async(n,o)=>{let s=i(),c=s.plugins?.installs??{},l=o.all?Object.keys(c):n?[n]:[];if(l.length===0){if(o.all){t.log(`No npm-installed plugins to update.`);return}t.error(`Provide a plugin id or use --all.`),process.exit(1)}let u=await A({config:s,pluginIds:l,dryRun:o.dryRun,logger:{info:e=>t.log(e),warn:n=>t.log(e.warn(n))},onIntegrityDrift:async n=>{let r=n.resolvedSpec??n.spec;return t.log(e.warn(`Integrity drift detected for "${n.pluginId}" (${r})\nExpected: ${n.expectedIntegrity}\nActual: ${n.actualIntegrity}`)),n.dryRun?!0:await a(`Continue updating "${n.pluginId}" with this artifact?`)}});for(let n of u.outcomes){if(n.status===`error`){t.log(e.error(n.message));continue}if(n.status===`skipped`){t.log(e.warn(n.message));continue}t.log(n.message)}!o.dryRun&&u.changed&&(await r(u.config),t.log(`Restart the gateway to load plugins.`))}),c.command(`doctor`).description(`Report plugin load issues`).action(()=>{let n=D(),r=n.plugins.filter(e=>e.status===`error`),i=n.diagnostics.filter(e=>e.level===`error`);if(r.length===0&&i.length===0){t.log(`No plugin issues detected.`);return}let a=[];if(r.length>0){a.push(e.error(`Plugin errors:`));for(let e of r)a.push(`- ${e.id}: ${e.error??`failed to load`} (${e.source})`)}if(i.length>0){a.length>0&&a.push(``),a.push(e.warn(`Diagnostics:`));for(let e of i){let t=e.pluginId?`${e.pluginId}: `:``;a.push(`- ${t}${e.message}`)}}let o=m(`/plugin`,`docs.openclaw.ai/plugin`);a.push(``),a.push(`${e.muted(`Docs:`)} ${o}`),t.log(a.join(`
@@ -0,0 +1,2 @@
1
+ import{t as e}from"./subsystem-C5XF2Fy5.js";import{C as t}from"./utils-UGOV_184.js";import{ca as n,la as r}from"./model-selection-BLbnMb5E.js";import{execFileSync as i}from"node:child_process";import{createServer as a}from"node:net";const o=e(`ports`),s={SIGTERM:`TERM`,SIGKILL:`KILL`};function c(e){return typeof e==`string`?e:e instanceof Buffer?e.toString(`utf8`):``}function l(e,t,n){let r=Error(e,{cause:n instanceof Error?n:void 0});return r.code=t,r}function u(e){if(!e||typeof e!=`object`)return;let t=e.code;if(typeof t==`string`&&t.length>0)return t;let n=e.cause;if(n&&typeof n==`object`){let e=n.code;if(typeof e==`string`&&e.length>0)return e}}function d(e){let t=u(e);if(t===`ENOENT`||t===`EACCES`||t===`EPERM`)return!0;let n=e instanceof Error?e.message:String(e);return/lsof.*(permission denied|not permitted|operation not permitted|eacces|eperm)/i.test(n)}function f(e){if(!e)return[];let t=new Set;for(let n of e.split(/\r?\n/)){let e=n.trim();if(!e)continue;let r=(e.includes(`:`)?e.slice(e.indexOf(`:`)+1):e).match(/\d+/g)??[];for(let e of r){let n=Number.parseInt(e,10);Number.isFinite(n)&&n>0&&t.add(n)}}return[...t]}function p(e,t){let n=[`-k`,`-${s[t]}`,`${e}/tcp`];try{return f(i(`fuser`,n,{encoding:`utf-8`,stdio:[`ignore`,`pipe`,`pipe`]})).map(e=>({pid:e}))}catch(e){let t=e,n=t.code,r=t.status,i=f([c(t.stdout),c(t.stderr)].filter(Boolean).join(`
2
+ `));if(r===1)return i.map(e=>({pid:e}));throw n===`ENOENT`?l(`fuser not found; required for --force when lsof is unavailable`,`ENOENT`,e):n===`EACCES`||n===`EPERM`?l(`fuser permission denied while forcing gateway port`,n,e):e instanceof Error?e:Error(String(e))}}async function m(e){try{return await n({port:e,exclusive:!0}),!1}catch(e){if(e.code===`EADDRINUSE`)return!0;throw e instanceof Error?e:Error(String(e))}}function h(e){let t=e.split(/\r?\n/).filter(Boolean),n=[],r={};for(let e of t)e.startsWith(`p`)?(r.pid&&n.push(r),r={pid:Number.parseInt(e.slice(1),10)}):e.startsWith(`c`)&&(r.command=e.slice(1));return r.pid&&n.push(r),n}function g(e){if(process.platform===`win32`){o.debug(`listPortListeners: using netstat for port ${e}`);try{let t=i(`netstat`,[`-ano`,`-p`,`TCP`],{encoding:`utf-8`}).split(/\r?\n/).filter(Boolean),n=[];for(let r of t){let t=r.trim().split(/\s+/);if(t.length>=5&&t[3]===`LISTENING`&&t[1].split(`:`).pop()===String(e)){let e=Number.parseInt(t[4],10);!Number.isNaN(e)&&e>0&&(n.some(t=>t.pid===e)||n.push({pid:e}))}}return o.debug(`listPortListeners: found ${n.length} listener(s) on port ${e}`),n}catch(e){throw o.error(`listPortListeners: netstat failed: ${String(e)}`),Error(`netstat failed: ${String(e)}`,{cause:e})}}try{return h(i(r(),[`-nP`,`-iTCP:${e}`,`-sTCP:LISTEN`,`-FpFc`],{encoding:`utf-8`}))}catch(e){let t=e,n=t.status??void 0,r=t.code;if(r===`ENOENT`)throw l(`lsof not found; required for --force`,`ENOENT`,e);if(r===`EACCES`||r===`EPERM`)throw l(`lsof permission denied while inspecting gateway port`,r,e);if(n===1){let n=c(t.stderr).trim();if(n&&/permission denied|not permitted|operation not permitted|can't stat/i.test(n))throw l(`lsof permission denied while inspecting gateway port: ${n}`,`EACCES`,e);return[]}throw e instanceof Error?e:Error(String(e))}}function _(e){let t=g(e);for(let e of t)try{process.kill(e.pid,`SIGTERM`)}catch(t){throw Error(`failed to kill pid ${e.pid}${e.command?` (${e.command})`:``}: ${String(t)}`,{cause:t})}return t}function v(e,t){for(let n of e)try{process.kill(n.pid,t)}catch(e){throw Error(`failed to kill pid ${n.pid}${n.command?` (${n.command})`:``}: ${String(e)}`,{cause:e})}}async function y(e,n={}){let r=Math.max(n.timeoutMs??1500,0),i=Math.max(n.intervalMs??100,1),a=Math.min(Math.max(n.sigtermTimeoutMs??600,0),r),s=[],c=!1;o.info(`forceFreePortAndWait: starting for port ${e}, platform=${process.platform}`);try{s=_(e),o.info(`forceFreePortAndWait: forceFreePort succeeded, killed ${s.length} process(es)`)}catch(t){if(o.warn(`forceFreePortAndWait: forceFreePort failed: ${String(t)}`),!d(t))throw t;c=!0,o.info(`forceFreePortAndWait: using fuser fallback`),s=p(e,`SIGTERM`)}let l=async()=>c?m(e):g(e).length>0;if(!await l())return{killed:s,waitedMs:0,escalatedToSigkill:!1};let u=0,f=i>0?Math.ceil(a/i):0;for(let e=0;e<f;e++){if(!await l())return{killed:s,waitedMs:u,escalatedToSigkill:!1};await t(i),u+=i}if(!await l())return{killed:s,waitedMs:u,escalatedToSigkill:!1};c?p(e,`SIGKILL`):v(g(e),`SIGKILL`);let h=Math.max(r-u,0),y=i>0?Math.ceil(h/i):0;for(let e=0;e<y;e++){if(!await l())return{killed:s,waitedMs:u,escalatedToSigkill:!0};await t(i),u+=i}if(!await l())return{killed:s,waitedMs:u,escalatedToSigkill:!0};if(c)throw Error(`port ${e} still has listeners after --force (fuser fallback)`);let b=g(e);throw Error(`port ${e} still has listeners after --force: ${b.map(e=>e.pid).join(`, `)}`)}function b(e,t=`0.0.0.0`){return new Promise((n,r)=>{let i=a();i.unref(),i.once(`error`,e=>{i.close(),e.code===`EADDRINUSE`?n(!1):r(e)}),i.listen(e,t,()=>{i.close(()=>n(!0))})})}async function x(e,n={}){let r=Math.max(n.timeoutMs??3e3,0),i=Math.max(n.intervalMs??150,1),a=n.host,o=0;for(;o<r;){if(await b(e,a))return o;await t(i),o+=i}if(await b(e,a))return o;throw Error(`port ${e} still not bindable after ${o}ms (TIME_WAIT or kernel hold)`)}export{x as n,y as t};
@@ -0,0 +1,2 @@
1
+ import{t as e}from"./subsystem-BLbY429l.js";import{Jr as t,qr as n}from"./auth-profiles-C8rZRS0X.js";import{S as r}from"./utils-CGdo13HV.js";import{execFileSync as i}from"node:child_process";import{createServer as a}from"node:net";const o=e(`ports`),s={SIGTERM:`TERM`,SIGKILL:`KILL`};function c(e){return typeof e==`string`?e:e instanceof Buffer?e.toString(`utf8`):``}function l(e,t,n){let r=Error(e,{cause:n instanceof Error?n:void 0});return r.code=t,r}function u(e){if(!e||typeof e!=`object`)return;let t=e.code;if(typeof t==`string`&&t.length>0)return t;let n=e.cause;if(n&&typeof n==`object`){let e=n.code;if(typeof e==`string`&&e.length>0)return e}}function d(e){let t=u(e);if(t===`ENOENT`||t===`EACCES`||t===`EPERM`)return!0;let n=e instanceof Error?e.message:String(e);return/lsof.*(permission denied|not permitted|operation not permitted|eacces|eperm)/i.test(n)}function f(e){if(!e)return[];let t=new Set;for(let n of e.split(/\r?\n/)){let e=n.trim();if(!e)continue;let r=(e.includes(`:`)?e.slice(e.indexOf(`:`)+1):e).match(/\d+/g)??[];for(let e of r){let n=Number.parseInt(e,10);Number.isFinite(n)&&n>0&&t.add(n)}}return[...t]}function p(e,t){let n=[`-k`,`-${s[t]}`,`${e}/tcp`];try{return f(i(`fuser`,n,{encoding:`utf-8`,stdio:[`ignore`,`pipe`,`pipe`]})).map(e=>({pid:e}))}catch(e){let t=e,n=t.code,r=t.status,i=f([c(t.stdout),c(t.stderr)].filter(Boolean).join(`
2
+ `));if(r===1)return i.map(e=>({pid:e}));throw n===`ENOENT`?l(`fuser not found; required for --force when lsof is unavailable`,`ENOENT`,e):n===`EACCES`||n===`EPERM`?l(`fuser permission denied while forcing gateway port`,n,e):e instanceof Error?e:Error(String(e))}}async function m(e){try{return await n({port:e,exclusive:!0}),!1}catch(e){if(e.code===`EADDRINUSE`)return!0;throw e instanceof Error?e:Error(String(e))}}function h(e){let t=e.split(/\r?\n/).filter(Boolean),n=[],r={};for(let e of t)e.startsWith(`p`)?(r.pid&&n.push(r),r={pid:Number.parseInt(e.slice(1),10)}):e.startsWith(`c`)&&(r.command=e.slice(1));return r.pid&&n.push(r),n}function g(e){if(process.platform===`win32`){o.debug(`listPortListeners: using netstat for port ${e}`);try{let t=i(`netstat`,[`-ano`,`-p`,`TCP`],{encoding:`utf-8`}).split(/\r?\n/).filter(Boolean),n=[];for(let r of t){let t=r.trim().split(/\s+/);if(t.length>=5&&t[3]===`LISTENING`&&t[1].split(`:`).pop()===String(e)){let e=Number.parseInt(t[4],10);!Number.isNaN(e)&&e>0&&(n.some(t=>t.pid===e)||n.push({pid:e}))}}return o.debug(`listPortListeners: found ${n.length} listener(s) on port ${e}`),n}catch(e){throw o.error(`listPortListeners: netstat failed: ${String(e)}`),Error(`netstat failed: ${String(e)}`,{cause:e})}}try{return h(i(t(),[`-nP`,`-iTCP:${e}`,`-sTCP:LISTEN`,`-FpFc`],{encoding:`utf-8`}))}catch(e){let t=e,n=t.status??void 0,r=t.code;if(r===`ENOENT`)throw l(`lsof not found; required for --force`,`ENOENT`,e);if(r===`EACCES`||r===`EPERM`)throw l(`lsof permission denied while inspecting gateway port`,r,e);if(n===1){let n=c(t.stderr).trim();if(n&&/permission denied|not permitted|operation not permitted|can't stat/i.test(n))throw l(`lsof permission denied while inspecting gateway port: ${n}`,`EACCES`,e);return[]}throw e instanceof Error?e:Error(String(e))}}function _(e){let t=g(e);for(let e of t)try{process.kill(e.pid,`SIGTERM`)}catch(t){throw Error(`failed to kill pid ${e.pid}${e.command?` (${e.command})`:``}: ${String(t)}`,{cause:t})}return t}function v(e,t){for(let n of e)try{process.kill(n.pid,t)}catch(e){throw Error(`failed to kill pid ${n.pid}${n.command?` (${n.command})`:``}: ${String(e)}`,{cause:e})}}async function y(e,t={}){let n=Math.max(t.timeoutMs??1500,0),i=Math.max(t.intervalMs??100,1),a=Math.min(Math.max(t.sigtermTimeoutMs??600,0),n),s=[],c=!1;o.info(`forceFreePortAndWait: starting for port ${e}, platform=${process.platform}`);try{s=_(e),o.info(`forceFreePortAndWait: forceFreePort succeeded, killed ${s.length} process(es)`)}catch(t){if(o.warn(`forceFreePortAndWait: forceFreePort failed: ${String(t)}`),!d(t))throw t;c=!0,o.info(`forceFreePortAndWait: using fuser fallback`),s=p(e,`SIGTERM`)}let l=async()=>c?m(e):g(e).length>0;if(!await l())return{killed:s,waitedMs:0,escalatedToSigkill:!1};let u=0,f=i>0?Math.ceil(a/i):0;for(let e=0;e<f;e++){if(!await l())return{killed:s,waitedMs:u,escalatedToSigkill:!1};await r(i),u+=i}if(!await l())return{killed:s,waitedMs:u,escalatedToSigkill:!1};c?p(e,`SIGKILL`):v(g(e),`SIGKILL`);let h=Math.max(n-u,0),y=i>0?Math.ceil(h/i):0;for(let e=0;e<y;e++){if(!await l())return{killed:s,waitedMs:u,escalatedToSigkill:!0};await r(i),u+=i}if(!await l())return{killed:s,waitedMs:u,escalatedToSigkill:!0};if(c)throw Error(`port ${e} still has listeners after --force (fuser fallback)`);let b=g(e);throw Error(`port ${e} still has listeners after --force: ${b.map(e=>e.pid).join(`, `)}`)}function b(e,t=`0.0.0.0`){return new Promise((n,r)=>{let i=a();i.unref(),i.once(`error`,e=>{i.close(),e.code===`EADDRINUSE`?n(!1):r(e)}),i.listen(e,t,()=>{i.close(()=>n(!0))})})}async function x(e,t={}){let n=Math.max(t.timeoutMs??3e3,0),i=Math.max(t.intervalMs??150,1),a=t.host,o=0;for(;o<n;){if(await b(e,a))return o;await r(i),o+=i}if(await b(e,a))return o;throw Error(`port ${e} still not bindable after ${o}ms (TIME_WAIT or kernel hold)`)}export{y as n,x as r,_ as t};
@@ -1,2 +1,2 @@
1
- import{A as e,B as t,Q as n,R as r,W as i,X as a,Y as o,Z as s,k as c,p as l,w as u}from"./subsystem-BLbY429l.js";import"./paths-BjD3T_xq.js";import"./boolean-D15s2V33.js";import{i as d}from"./entry.js";import"./auth-profiles-C8rZRS0X.js";import{n as f,r as p}from"./command-format-CLxIPuLR.js";import"./agent-scope-DAWJwFfl.js";import{c as m}from"./utils-CGdo13HV.js";import"./openclaw-root-CnsBf6ZU.js";import"./github-copilot-token-C79yeDKS.js";import"./env-overrides-DHtB4kK3.js";import{t as h}from"./version-q3SkUw2K.js";import"./registry-BptzrW8D.js";import"./skills-Bz_S4lPh.js";import"./frontmatter-C7mzDNxd.js";import"./plugins-DNlgeTTc.js";import"./logger-kQAOe3qp.js";import"./exec-B3eleY5O.js";import"./windows-spawn-7oINn5ao.js";import"./redact-CnRxK70G.js";import"./path-alias-guards-kY_ZbWs-.js";import"./errors-6SQWM9dj.js";import"./send-vNcod64S.js";import"./send-CyarIb2w.js";import{Sn as g}from"./compact-CYbPi7_-.js";import"./paths-BfjJY2VL.js";import"./chat-envelope-Bznn2SoS.js";import"./models-config-DZzS67GS.js";import"./tokens-DRM8vzJx.js";import"./with-timeout-c1CzdShT.js";import"./deliver-SqSusZP3.js";import"./diagnostic-D1H7_8QG.js";import"./send-Dj7NBAWg.js";import"./pi-model-discovery-BPkhPDMr.js";import"./exec-approvals-allowlist-CGjRWREs.js";import"./exec-safe-bin-runtime-policy-v44u39fl.js";import"./model-catalog-mt0IcDfR.js";import"./fetch-B4bz67_N.js";import"./audio-transcription-runner-BIKj1CBU.js";import"./fetch-guard-DaZmvp-L.js";import"./image-BVbOr9yV.js";import"./tool-display-DJDtttQg.js";import"./api-key-rotation-BpEL4aeX.js";import"./proxy-fetch-gWETR3cl.js";import"./ir-DdjufzKF.js";import"./render-DrrPmnMI.js";import"./target-errors-D6wejRd6.js";import"./commands-Dy7duWlt.js";import"./commands-registry-DT6FDUev.js";import"./session-cost-usage-CHtVgnE8.js";import"./session-utils-Bpdyx2A2.js";import"./sqlite-CILF3z9U.js";import"./call-BWx7hNtl.js";import"./pi-tools.policy-B6q8YOfg.js";import"./pairing-store-BaaVy1zB.js";import"./fetch-Dh-apy46.js";import"./skill-commands-DCqPy_Aa.js";import"./workspace-dirs-A8Vib9_B.js";import"./pairing-token-zdbQ951y.js";import"./channel-activity-BhiLsKvM.js";import"./tables-DENKrP-W.js";import"./kill-tree-D6nPx1_o.js";import"./runtime-web-tools-BYhCkBV8.js";import"./runtime-CK7gqwEF.js";import"./node-shell-BVZylVP6.js";import"./stagger-DxzgG2jd.js";import"./channel-selection-BPxE8JR7.js";import"./plugin-auto-enable-adba5Evb.js";import"./send-ChILboDj.js";import"./outbound-attachment-CVcDBkAD.js";import"./delivery-queue-nkPJu0fY.js";import"./send-COpehmAB.js";import"./system-run-command-DsWBVvSK.js";import"./fetch-Ce-scEU-.js";import"./command-secret-targets-BEjtBf5Z.js";import"./connection-auth-CjaeEu5D.js";import"./onboard-helpers-DOlI17Ac.js";import"./prompt-style-BThRSQJR.js";import"./pairing-labels-CZ-aX-up.js";import"./search-manager-CV2YsAym.js";import"./manager-CxZRoQkE.js";import"./memory-cli-C8fBBPgv.js";import{t as _}from"./links-CBnmRP9D.js";import"./cli-utils-BleB1eys.js";import"./help-format-B4aEI7V9.js";import"./progress-d1m2sqR1.js";import"./exec-approvals-BXO9Cezj.js";import"./plugin-registry-DYwEy5eM.js";import{n as v}from"./channel-options-CKoyPq8p.js";import{t as y}from"./register.subclis-Drp2dGBe.js";import{a as b,r as x}from"./command-registry-D_jtBegA.js";import{r as S}from"./program-context-CH9p6anW.js";import"./ports-BAaLOkJp.js";import{n as C,r as w,t as T}from"./banner-CAtilyXr.js";import{Command as E,InvalidArgumentError as D}from"commander";function O(){let e,t=()=>(e===void 0&&(e=v()),e);return{programVersion:h,get channelOptions(){return t()},get messageChannelOptions(){return t().join(`|`)},get agentChannelOptions(){return[`last`,...t()].join(`|`)}}}const k=r.join(`|`);function A(e){let n=t(e);if(!n)throw new D(`Invalid --log-level (use ${k})`);return n}const j=p(),M=m(j),N=new Set([...x(),...y()]),P=[[`openclaw models --help`,`Show detailed help for the models command.`],[`openclaw channels login --verbose`,`Link personal WhatsApp Web and show QR + connection logs.`],[`openclaw message send --target +15555550123 --message "Hi" --json`,`Send via your web session and print JSON result.`],[`openclaw gateway --port 18789`,`Run the WebSocket Gateway locally.`],[`openclaw --dev gateway`,`Run a dev Gateway (isolated state/config) on ws://127.0.0.1:19001.`],[`openclaw gateway --force`,`Kill anything bound to the default gateway port, then start it.`],[`openclaw gateway ...`,`Gateway control via WebSocket.`],[`openclaw agent --to +15555550123 --message "Run summary" --deliver`,`Talk directly to the agent using the Gateway; optionally send the WhatsApp reply.`],[`openclaw message send --channel telegram --target @mychat --message "Hi"`,`Send via your Telegram bot.`]];function F(t,r){t.name(j).description(``).version(r.programVersion).option(`--dev`,`Dev profile: isolate state under ~/.qbotclaw-dev, default gateway port 19001, and shift derived ports (browser/canvas)`).option(`--profile <name>`,`Use a named profile (isolates OPENCLAW_STATE_DIR/OPENCLAW_CONFIG_PATH under ~/.qbotclaw-<name>)`).option(`--log-level <level>`,`Global log level override for file + console (${k})`,A),t.option(`--no-color`,`Disable ANSI colors`,!1),t.helpOption(`-h, --help`,`Display help for command`),t.helpCommand(`help [command]`,`Display help for command`),t.configureHelp({sortSubcommands:!0,sortOptions:!0,optionTerm:t=>e.option(t.flags),subcommandTerm:n=>{let r=n.parent===t&&N.has(n.name());return e.command(r?`${n.name()} *`:n.name())}});let i=t=>{let n=t;return RegExp(`^Usage:\\s+${M}\\s+\\[options\\]\\s+\\[command\\]\\s*$`,`m`).test(n)&&/^Commands:/m.test(n)&&(n=n.replace(/^Commands:/m,`Commands:\n ${e.muted(`Hint: commands suffixed with * have subcommands. Run <command> --help for details.`)}`)),n.replace(/^Usage:/gm,e.heading(`Usage:`)).replace(/^Options:/gm,e.heading(`Options:`)).replace(/^Commands:/gm,e.heading(`Commands:`))};if(t.configureOutput({writeOut:e=>{process.stdout.write(i(e))},writeErr:e=>{process.stderr.write(i(e))},outputError:(t,n)=>n(e.error(t))}),a(process.argv,`-V`)||a(process.argv,`--version`)||n(process.argv)){let e=g({moduleUrl:import.meta.url});console.log(e?`OpenClaw ${r.programVersion} (${e})`:`OpenClaw ${r.programVersion}`),process.exit(0)}t.addHelpText(`beforeAll`,()=>{if(w())return``;let e=c();return`\n${C(r.programVersion,{richTty:e})}\n`});let o=P.map(([t,n])=>` ${e.command(f(t,j))}\n ${e.muted(n)}`).join(`
2
- `);t.addHelpText(`afterAll`,({command:n})=>{if(n!==t)return``;let r=_(`/cli`,`docs.openclaw.ai/cli`);return`\n${e.heading(`Examples:`)}\n${o}\n\n${e.muted(`Docs:`)} ${r}\n`})}function I(e){let t=e;for(;t.parent&&t.parent.parent;)t=t.parent;let n=t.name(),r=p();!n||n===r||(process.title=`${r}-${n}`)}const L=new Set([`message`,`channels`,`directory`,`agents`,`configure`,`onboard`,`status`,`health`]),R=new Set([`backup`,`doctor`,`completion`,`secrets`]),z=new Set([`config set`]);let B,V;function H(e){let[t,n]=e;return t?!!(R.has(t)||t===`config`&&n===`validate`):!1}function U(){return B??=import(`./config-guard-CqUJ8uaF.js`).then(e=>e.t),B}function W(){return V??=import(`./plugin-registry-DYwEy5eM.js`).then(e=>e.n),V}function G(e){let t=e;for(;t.parent;)t=t.parent;return t}function K(e){let t=G(e);if(typeof t.getOptionValueSource!=`function`||t.getOptionValueSource(`logLevel`)!==`cli`)return;let n=t.opts().logLevel;return typeof n==`string`?n:void 0}function q(e,t){if(!a(t,`--json`))return!1;let n=`${e[0]??``} ${e[1]??``}`.trim();return!z.has(n)}function J(e,t){e.hook(`preAction`,async(e,n)=>{I(n);let r=process.argv;if(s(r))return;let a=i(r,2);d(process.env.OPENCLAW_HIDE_BANNER)||a[0]===`update`||a[0]===`completion`||a[0]===`plugins`&&a[1]===`update`||T(t);let c=o(r,{includeDebug:!0});u(c);let f=K(n);if(f&&(process.env.OPENCLAW_LOG_LEVEL=f),c||(process.env.NODE_NO_WARNINGS??=`1`),H(a))return;let p=q(a,r),{ensureConfigReady:m}=await U();if(await m({runtime:l,commandPath:a,...p?{suppressDoctorStdout:!0}:{}}),L.has(a[0])){let{ensurePluginRegistryLoaded:e}=await W();e()}})}function Y(){let e=new E,t=O(),n=process.argv;return S(e,t),F(e,t),J(e,t.programVersion),b(e,t,n),e}export{Y as buildProgram};
1
+ import{A as e,B as t,Q as n,R as r,W as i,X as a,Y as o,Z as s,k as c,p as l,w as u}from"./subsystem-BLbY429l.js";import"./paths-BjD3T_xq.js";import"./boolean-D15s2V33.js";import{i as d}from"./entry.js";import"./auth-profiles-C8rZRS0X.js";import{n as f,r as p}from"./command-format-CLxIPuLR.js";import"./agent-scope-DAWJwFfl.js";import{c as m}from"./utils-CGdo13HV.js";import"./openclaw-root-CnsBf6ZU.js";import"./github-copilot-token-C79yeDKS.js";import"./env-overrides-DHtB4kK3.js";import{t as h}from"./version-q3SkUw2K.js";import"./registry-BptzrW8D.js";import"./skills-Bz_S4lPh.js";import"./frontmatter-C7mzDNxd.js";import"./plugins-DNlgeTTc.js";import"./logger-kQAOe3qp.js";import"./exec-B3eleY5O.js";import"./windows-spawn-7oINn5ao.js";import"./redact-CnRxK70G.js";import"./path-alias-guards-kY_ZbWs-.js";import"./errors-6SQWM9dj.js";import"./send-vNcod64S.js";import"./send-CyarIb2w.js";import{Sn as g}from"./compact-uyQDx8pN.js";import"./paths-BfjJY2VL.js";import"./chat-envelope-Bznn2SoS.js";import"./models-config-DZzS67GS.js";import"./tokens-DRM8vzJx.js";import"./with-timeout-c1CzdShT.js";import"./deliver-SqSusZP3.js";import"./diagnostic-D1H7_8QG.js";import"./send-Dj7NBAWg.js";import"./pi-model-discovery-BPkhPDMr.js";import"./exec-approvals-allowlist-CGjRWREs.js";import"./exec-safe-bin-runtime-policy-v44u39fl.js";import"./model-catalog-mt0IcDfR.js";import"./fetch-B4bz67_N.js";import"./audio-transcription-runner-BIKj1CBU.js";import"./fetch-guard-DaZmvp-L.js";import"./image-BVbOr9yV.js";import"./tool-display-DJDtttQg.js";import"./api-key-rotation-BpEL4aeX.js";import"./proxy-fetch-gWETR3cl.js";import"./ir-DdjufzKF.js";import"./render-DrrPmnMI.js";import"./target-errors-D6wejRd6.js";import"./commands-Dy7duWlt.js";import"./commands-registry-DT6FDUev.js";import"./session-cost-usage-CHtVgnE8.js";import"./session-utils-Bpdyx2A2.js";import"./sqlite-CILF3z9U.js";import"./call-BWx7hNtl.js";import"./pi-tools.policy-B6q8YOfg.js";import"./pairing-store-BaaVy1zB.js";import"./fetch-Dh-apy46.js";import"./skill-commands-DCqPy_Aa.js";import"./workspace-dirs-A8Vib9_B.js";import"./pairing-token-zdbQ951y.js";import"./channel-activity-BhiLsKvM.js";import"./tables-DENKrP-W.js";import"./kill-tree-D6nPx1_o.js";import"./runtime-web-tools-BYhCkBV8.js";import"./runtime-CK7gqwEF.js";import"./node-shell-BVZylVP6.js";import"./stagger-DxzgG2jd.js";import"./channel-selection-BPxE8JR7.js";import"./plugin-auto-enable-adba5Evb.js";import"./send-ChILboDj.js";import"./outbound-attachment-CVcDBkAD.js";import"./delivery-queue-nkPJu0fY.js";import"./send-COpehmAB.js";import"./system-run-command-DsWBVvSK.js";import"./fetch-Ce-scEU-.js";import"./command-secret-targets-BEjtBf5Z.js";import"./connection-auth-CjaeEu5D.js";import"./onboard-helpers-DOlI17Ac.js";import"./prompt-style-BThRSQJR.js";import"./pairing-labels-CZ-aX-up.js";import"./search-manager-CV2YsAym.js";import"./manager-CxZRoQkE.js";import"./memory-cli-C8fBBPgv.js";import{t as _}from"./links-CBnmRP9D.js";import"./cli-utils-BleB1eys.js";import"./help-format-B4aEI7V9.js";import"./progress-d1m2sqR1.js";import"./exec-approvals-BXO9Cezj.js";import"./plugin-registry-C_HKxFxs.js";import{n as v}from"./channel-options-llKYy0-2.js";import{t as y}from"./register.subclis-CqVDIyhT.js";import{a as b,r as x}from"./command-registry-DtMCIKRu.js";import{r as S}from"./program-context-CH9p6anW.js";import"./ports-DmJX-iq9.js";import{n as C,r as w,t as T}from"./banner-DiQjNe9B.js";import{Command as E,InvalidArgumentError as D}from"commander";function O(){let e,t=()=>(e===void 0&&(e=v()),e);return{programVersion:h,get channelOptions(){return t()},get messageChannelOptions(){return t().join(`|`)},get agentChannelOptions(){return[`last`,...t()].join(`|`)}}}const k=r.join(`|`);function A(e){let n=t(e);if(!n)throw new D(`Invalid --log-level (use ${k})`);return n}const j=p(),M=m(j),N=new Set([...x(),...y()]),P=[[`openclaw models --help`,`Show detailed help for the models command.`],[`openclaw channels login --verbose`,`Link personal WhatsApp Web and show QR + connection logs.`],[`openclaw message send --target +15555550123 --message "Hi" --json`,`Send via your web session and print JSON result.`],[`openclaw gateway --port 18789`,`Run the WebSocket Gateway locally.`],[`openclaw --dev gateway`,`Run a dev Gateway (isolated state/config) on ws://127.0.0.1:19001.`],[`openclaw gateway --force`,`Kill anything bound to the default gateway port, then start it.`],[`openclaw gateway ...`,`Gateway control via WebSocket.`],[`openclaw agent --to +15555550123 --message "Run summary" --deliver`,`Talk directly to the agent using the Gateway; optionally send the WhatsApp reply.`],[`openclaw message send --channel telegram --target @mychat --message "Hi"`,`Send via your Telegram bot.`]];function F(t,r){t.name(j).description(``).version(r.programVersion).option(`--dev`,`Dev profile: isolate state under ~/.qbotclaw-dev, default gateway port 19001, and shift derived ports (browser/canvas)`).option(`--profile <name>`,`Use a named profile (isolates OPENCLAW_STATE_DIR/OPENCLAW_CONFIG_PATH under ~/.qbotclaw-<name>)`).option(`--log-level <level>`,`Global log level override for file + console (${k})`,A),t.option(`--no-color`,`Disable ANSI colors`,!1),t.helpOption(`-h, --help`,`Display help for command`),t.helpCommand(`help [command]`,`Display help for command`),t.configureHelp({sortSubcommands:!0,sortOptions:!0,optionTerm:t=>e.option(t.flags),subcommandTerm:n=>{let r=n.parent===t&&N.has(n.name());return e.command(r?`${n.name()} *`:n.name())}});let i=t=>{let n=t;return RegExp(`^Usage:\\s+${M}\\s+\\[options\\]\\s+\\[command\\]\\s*$`,`m`).test(n)&&/^Commands:/m.test(n)&&(n=n.replace(/^Commands:/m,`Commands:\n ${e.muted(`Hint: commands suffixed with * have subcommands. Run <command> --help for details.`)}`)),n.replace(/^Usage:/gm,e.heading(`Usage:`)).replace(/^Options:/gm,e.heading(`Options:`)).replace(/^Commands:/gm,e.heading(`Commands:`))};if(t.configureOutput({writeOut:e=>{process.stdout.write(i(e))},writeErr:e=>{process.stderr.write(i(e))},outputError:(t,n)=>n(e.error(t))}),a(process.argv,`-V`)||a(process.argv,`--version`)||n(process.argv)){let e=g({moduleUrl:import.meta.url});console.log(e?`OpenClaw ${r.programVersion} (${e})`:`OpenClaw ${r.programVersion}`),process.exit(0)}t.addHelpText(`beforeAll`,()=>{if(w())return``;let e=c();return`\n${C(r.programVersion,{richTty:e})}\n`});let o=P.map(([t,n])=>` ${e.command(f(t,j))}\n ${e.muted(n)}`).join(`
2
+ `);t.addHelpText(`afterAll`,({command:n})=>{if(n!==t)return``;let r=_(`/cli`,`docs.openclaw.ai/cli`);return`\n${e.heading(`Examples:`)}\n${o}\n\n${e.muted(`Docs:`)} ${r}\n`})}function I(e){let t=e;for(;t.parent&&t.parent.parent;)t=t.parent;let n=t.name(),r=p();!n||n===r||(process.title=`${r}-${n}`)}const L=new Set([`message`,`channels`,`directory`,`agents`,`configure`,`onboard`,`status`,`health`]),R=new Set([`backup`,`doctor`,`completion`,`secrets`]),z=new Set([`config set`]);let B,V;function H(e){let[t,n]=e;return t?!!(R.has(t)||t===`config`&&n===`validate`):!1}function U(){return B??=import(`./config-guard-CqUJ8uaF.js`).then(e=>e.t),B}function W(){return V??=import(`./plugin-registry-C_HKxFxs.js`).then(e=>e.n),V}function G(e){let t=e;for(;t.parent;)t=t.parent;return t}function K(e){let t=G(e);if(typeof t.getOptionValueSource!=`function`||t.getOptionValueSource(`logLevel`)!==`cli`)return;let n=t.opts().logLevel;return typeof n==`string`?n:void 0}function q(e,t){if(!a(t,`--json`))return!1;let n=`${e[0]??``} ${e[1]??``}`.trim();return!z.has(n)}function J(e,t){e.hook(`preAction`,async(e,n)=>{I(n);let r=process.argv;if(s(r))return;let a=i(r,2);d(process.env.OPENCLAW_HIDE_BANNER)||a[0]===`update`||a[0]===`completion`||a[0]===`plugins`&&a[1]===`update`||T(t);let c=o(r,{includeDebug:!0});u(c);let f=K(n);if(f&&(process.env.OPENCLAW_LOG_LEVEL=f),c||(process.env.NODE_NO_WARNINGS??=`1`),H(a))return;let p=q(a,r),{ensureConfigReady:m}=await U();if(await m({runtime:l,commandPath:a,...p?{suppressDoctorStdout:!0}:{}}),L.has(a[0])){let{ensurePluginRegistryLoaded:e}=await W();e()}})}function Y(){let e=new E,t=O(),n=process.argv;return S(e,t),F(e,t),J(e,t.programVersion),b(e,t,n),e}export{Y as buildProgram};
@@ -1 +1 @@
1
- import{G as e,J as t,U as n}from"./subsystem-C5XF2Fy5.js";import{t as r}from"./env-D7wNuBx1.js";import{r as i}from"./helpers-Cp8gcO6u.js";async function a(e,t){let r=t.at(-1),a=(r?.parent??e).rawArgs,o=i(r),s=r?.name()?[r.name(),...o]:o,c=n({programName:e.name(),rawArgs:a,fallbackArgv:s});await e.parseAsync(c)}function o(e,t){let n=e.commands,r=n.indexOf(t);return r<0?!1:(n.splice(r,1),!0)}function s(e,t){let n=e.commands.find(e=>e.name()===t);return n?o(e,n):!1}const c=e=>!(r(process.env.OPENCLAW_DISABLE_LAZY_SUBCOMMANDS)||t(e)),l=e=>r(process.env.OPENCLAW_DISABLE_LAZY_SUBCOMMANDS),u=async()=>{let e=await import(`./model-selection-BLbnMb5E.js`).then(e=>e.Bs);return(await e.readConfigFileSnapshot()).valid?e.loadConfig():null},d=[{name:`acp`,description:`Agent Control Protocol tools`,hasSubcommands:!0,register:async e=>{(await import(`./acp-cli-D_WC9SZX.js`)).registerAcpCli(e)}},{name:`gateway`,description:`Run, inspect, and query the WebSocket Gateway`,hasSubcommands:!0,register:async e=>{(await import(`./gateway-cli-Kp-caOwI.js`)).registerGatewayCli(e)}},{name:`daemon`,description:`Gateway service (legacy alias)`,hasSubcommands:!0,register:async e=>{(await import(`./daemon-cli-BdDHNRqp.js`).then(e=>e.t)).registerDaemonCli(e)}},{name:`logs`,description:`Tail gateway file logs via RPC`,hasSubcommands:!1,register:async e=>{(await import(`./logs-cli-C52caOop.js`)).registerLogsCli(e)}},{name:`system`,description:`System events, heartbeat, and presence`,hasSubcommands:!0,register:async e=>{(await import(`./system-cli-Ddixb0SQ.js`)).registerSystemCli(e)}},{name:`models`,description:`Discover, scan, and configure models`,hasSubcommands:!0,register:async e=>{(await import(`./models-cli-CMMhnlHo.js`)).registerModelsCli(e)}},{name:`approvals`,description:`Manage exec approvals (gateway or node host)`,hasSubcommands:!0,register:async e=>{(await import(`./exec-approvals-cli-CsUGu6m3.js`)).registerExecApprovalsCli(e)}},{name:`nodes`,description:`Manage gateway-owned node pairing and node commands`,hasSubcommands:!0,register:async e=>{(await import(`./nodes-cli-B3aNQG30.js`)).registerNodesCli(e)}},{name:`devices`,description:`Device pairing + token management`,hasSubcommands:!0,register:async e=>{(await import(`./devices-cli-Dl-0fQmR.js`)).registerDevicesCli(e)}},{name:`node`,description:`Run and manage the headless node host service`,hasSubcommands:!0,register:async e=>{(await import(`./node-cli-Bzu1efMB.js`)).registerNodeCli(e)}},{name:`sandbox`,description:`Manage sandbox containers for agent isolation`,hasSubcommands:!0,register:async e=>{(await import(`./sandbox-cli-Jo5nYeug.js`)).registerSandboxCli(e)}},{name:`tui`,description:`Open a terminal UI connected to the Gateway`,hasSubcommands:!1,register:async e=>{(await import(`./tui-cli-FxvETbln.js`)).registerTuiCli(e)}},{name:`cron`,description:`Manage cron jobs via the Gateway scheduler`,hasSubcommands:!0,register:async e=>{(await import(`./cron-cli-L9wLLocl.js`)).registerCronCli(e)}},{name:`dns`,description:`DNS helpers for wide-area discovery (Tailscale + CoreDNS)`,hasSubcommands:!0,register:async e=>{(await import(`./dns-cli-C7L4RYOm.js`)).registerDnsCli(e)}},{name:`docs`,description:`Search the live OpenClaw docs`,hasSubcommands:!1,register:async e=>{(await import(`./docs-cli-DnLLU7eX.js`)).registerDocsCli(e)}},{name:`hooks`,description:`Manage internal agent hooks`,hasSubcommands:!0,register:async e=>{(await import(`./hooks-cli-CnCOjVv0.js`)).registerHooksCli(e)}},{name:`webhooks`,description:`Webhook helpers and integrations`,hasSubcommands:!0,register:async e=>{(await import(`./webhooks-cli-ICOwBPSv.js`)).registerWebhooksCli(e)}},{name:`qr`,description:`Generate iOS pairing QR/setup code`,hasSubcommands:!1,register:async e=>{(await import(`./qr-cli-ZtDsXyLO.js`)).registerQrCli(e)}},{name:`clawbot`,description:`Legacy clawbot command aliases`,hasSubcommands:!0,register:async e=>{(await import(`./clawbot-cli-B0iTJ-pm.js`)).registerClawbotCli(e)}},{name:`pairing`,description:`Secure DM pairing (approve inbound requests)`,hasSubcommands:!0,register:async e=>{let{registerPluginCliCommands:t}=await import(`./cli-CBg8KhmQ.js`),n=await u();n&&t(e,n),(await import(`./pairing-cli-CxJy8LPo.js`)).registerPairingCli(e)}},{name:`plugins`,description:`Manage OpenClaw plugins and extensions`,hasSubcommands:!0,register:async e=>{(await import(`./plugins-cli-PVHBZeb8.js`)).registerPluginsCli(e);let{registerPluginCliCommands:t}=await import(`./cli-CBg8KhmQ.js`),n=await u();n&&t(e,n)}},{name:`channels`,description:`Manage connected chat channels (Telegram, Discord, etc.)`,hasSubcommands:!0,register:async e=>{(await import(`./channels-cli-BvGXgERj.js`)).registerChannelsCli(e)}},{name:`directory`,description:`Lookup contact and group IDs (self, peers, groups) for supported chat channels`,hasSubcommands:!0,register:async e=>{(await import(`./directory-cli-CpMjutQb.js`)).registerDirectoryCli(e)}},{name:`security`,description:`Security tools and local config audits`,hasSubcommands:!0,register:async e=>{(await import(`./security-cli-Cuc8IQKB.js`)).registerSecurityCli(e)}},{name:`secrets`,description:`Secrets runtime reload controls`,hasSubcommands:!0,register:async e=>{(await import(`./secrets-cli-BstBe0UA.js`)).registerSecretsCli(e)}},{name:`skills`,description:`List and inspect available skills`,hasSubcommands:!0,register:async e=>{(await import(`./skills-cli-DLmqhAB-.js`)).registerSkillsCli(e)}},{name:`update`,description:`Update OpenClaw and inspect update channel status`,hasSubcommands:!0,register:async e=>{(await import(`./update-cli-DU5tRH3c.js`)).registerUpdateCli(e)}},{name:`completion`,description:`Generate shell completion script`,hasSubcommands:!1,register:async e=>{(await import(`./completion-cli-Bw_hBrlA.js`).then(e=>e.n)).registerCompletionCli(e)}}];function f(){return d}function p(){return d.filter(e=>e.hasSubcommands).map(e=>e.name)}async function m(e,t){let n=d.find(e=>e.name===t);return n?(s(e,n.name),await n.register(e),!0):!1}function h(e,t){let n=e.command(t.name).description(t.description);n.allowUnknownOption(!0),n.allowExcessArguments(!0),n.action(async(...r)=>{o(e,n),await t.register(e),await a(e,r)})}function g(t,n=process.argv){if(l(n)){for(let e of d)e.register(t);return}let r=e(n);if(r&&c(n)){let e=d.find(e=>e.name===r);if(e){h(t,e);return}}for(let e of d)h(t,e)}const _=e=>!t(e),v=[{commands:[{name:`setup`,description:`Initialize local config and agent workspace`,hasSubcommands:!1}],register:async({program:e})=>{(await import(`./register.setup-CeG2ETmr.js`)).registerSetupCommand(e)}},{commands:[{name:`onboard`,description:`Interactive onboarding wizard for gateway, workspace, and skills`,hasSubcommands:!1}],register:async({program:e})=>{(await import(`./register.onboard-DB9FWAKT.js`)).registerOnboardCommand(e)}},{commands:[{name:`configure`,description:`Interactive setup wizard for credentials, channels, gateway, and agent defaults`,hasSubcommands:!1}],register:async({program:e})=>{(await import(`./register.configure-C6zjzaEo.js`)).registerConfigureCommand(e)}},{commands:[{name:`config`,description:`Non-interactive config helpers (get/set/unset/file/validate). Default: starts setup wizard.`,hasSubcommands:!0}],register:async({program:e})=>{(await import(`./config-cli-F-lkPjjz.js`)).registerConfigCli(e)}},{commands:[{name:`backup`,description:`Create and verify local backup archives for OpenClaw state`,hasSubcommands:!0}],register:async({program:e})=>{(await import(`./register.backup-Vh8RK6fp.js`)).registerBackupCommand(e)}},{commands:[{name:`doctor`,description:`Health checks + quick fixes for the gateway and channels`,hasSubcommands:!1},{name:`dashboard`,description:`Open the Control UI with your current token`,hasSubcommands:!1},{name:`reset`,description:`Reset local config/state (keeps the CLI installed)`,hasSubcommands:!1},{name:`uninstall`,description:`Uninstall the gateway service + local data (CLI remains)`,hasSubcommands:!1}],register:async({program:e})=>{(await import(`./register.maintenance-CStaPxaB.js`)).registerMaintenanceCommands(e)}},{commands:[{name:`message`,description:`Send, read, and manage messages`,hasSubcommands:!0}],register:async({program:e,ctx:t})=>{(await import(`./register.message-DHDcOA8X.js`)).registerMessageCommands(e,t)}},{commands:[{name:`memory`,description:`Search and reindex memory files`,hasSubcommands:!0}],register:async({program:e})=>{(await import(`./memory-cli-BouV_wyL.js`).then(e=>e.t)).registerMemoryCli(e)}},{commands:[{name:`agent`,description:`Run one agent turn via the Gateway`,hasSubcommands:!1},{name:`agents`,description:`Manage isolated agents (workspaces, auth, routing)`,hasSubcommands:!0}],register:async({program:e,ctx:t})=>{(await import(`./register.agent-DQdoMfmw.js`)).registerAgentCommands(e,{agentChannelOptions:t.agentChannelOptions})}},{commands:[{name:`status`,description:`Show channel health and recent session recipients`,hasSubcommands:!1},{name:`health`,description:`Fetch health from the running gateway`,hasSubcommands:!1},{name:`sessions`,description:`List stored conversation sessions`,hasSubcommands:!0}],register:async({program:e})=>{(await import(`./register.status-health-sessions-Dtpd1P2M.js`)).registerStatusHealthSessionsCommands(e)}},{commands:[{name:`browser`,description:`Manage OpenClaw's dedicated browser (Chrome/Chromium)`,hasSubcommands:!0}],register:async({program:e})=>{(await import(`./browser-cli-Bf-Pzjxs.js`)).registerBrowserCli(e)}}];function y(e){let t=new Set,n=[];for(let r of v)for(let i of r.commands)e&&!e(i)||t.has(i.name)||(t.add(i.name),n.push(i.name));return n}function b(){return y()}function x(){return y(e=>e.hasSubcommands)}function S(e,t){for(let n of t.commands)s(e,n.name)}function C(e,t,n,r){let i=e.command(r.name).description(r.description);i.allowUnknownOption(!0),i.allowExcessArguments(!0),i.action(async(...r)=>{S(e,n),await n.register({program:e,ctx:t,argv:process.argv}),await a(e,r)})}async function w(e,t,n,r=process.argv){let i=v.find(e=>e.commands.some(e=>e.name===n));return i?(S(e,i),await i.register({program:e,ctx:t,argv:r}),!0):!1}function T(t,n,r){let i=e(r);if(i&&_(r)){let e=v.find(e=>e.commands.some(e=>e.name===i));if(e){let r=e.commands.find(e=>e.name===i);r&&C(t,n,e,r);return}}for(let e of v)for(let r of e.commands)C(t,n,e,r)}function E(e,t,n=process.argv){T(e,t,n),g(e,n)}const D=Symbol.for(`openclaw.cli.programContext`);function O(e,t){e[D]=t}function k(e){return e[D]}export{w as a,f as c,x as i,m as l,O as n,E as o,b as r,p as s,k as t};
1
+ import{G as e,J as t,U as n}from"./subsystem-C5XF2Fy5.js";import{t as r}from"./env-D7wNuBx1.js";import{r as i}from"./helpers-Cp8gcO6u.js";async function a(e,t){let r=t.at(-1),a=(r?.parent??e).rawArgs,o=i(r),s=r?.name()?[r.name(),...o]:o,c=n({programName:e.name(),rawArgs:a,fallbackArgv:s});await e.parseAsync(c)}function o(e,t){let n=e.commands,r=n.indexOf(t);return r<0?!1:(n.splice(r,1),!0)}function s(e,t){let n=e.commands.find(e=>e.name()===t);return n?o(e,n):!1}const c=e=>!(r(process.env.OPENCLAW_DISABLE_LAZY_SUBCOMMANDS)||t(e)),l=e=>r(process.env.OPENCLAW_DISABLE_LAZY_SUBCOMMANDS),u=async()=>{let e=await import(`./model-selection-BLbnMb5E.js`).then(e=>e.Bs);return(await e.readConfigFileSnapshot()).valid?e.loadConfig():null},d=[{name:`acp`,description:`Agent Control Protocol tools`,hasSubcommands:!0,register:async e=>{(await import(`./acp-cli-D_WC9SZX.js`)).registerAcpCli(e)}},{name:`gateway`,description:`Run, inspect, and query the WebSocket Gateway`,hasSubcommands:!0,register:async e=>{(await import(`./gateway-cli-DV3M2tJP.js`)).registerGatewayCli(e)}},{name:`daemon`,description:`Gateway service (legacy alias)`,hasSubcommands:!0,register:async e=>{(await import(`./daemon-cli-BdDHNRqp.js`).then(e=>e.t)).registerDaemonCli(e)}},{name:`logs`,description:`Tail gateway file logs via RPC`,hasSubcommands:!1,register:async e=>{(await import(`./logs-cli-C52caOop.js`)).registerLogsCli(e)}},{name:`system`,description:`System events, heartbeat, and presence`,hasSubcommands:!0,register:async e=>{(await import(`./system-cli-Ddixb0SQ.js`)).registerSystemCli(e)}},{name:`models`,description:`Discover, scan, and configure models`,hasSubcommands:!0,register:async e=>{(await import(`./models-cli-Bc8cIZ0A.js`)).registerModelsCli(e)}},{name:`approvals`,description:`Manage exec approvals (gateway or node host)`,hasSubcommands:!0,register:async e=>{(await import(`./exec-approvals-cli-CsUGu6m3.js`)).registerExecApprovalsCli(e)}},{name:`nodes`,description:`Manage gateway-owned node pairing and node commands`,hasSubcommands:!0,register:async e=>{(await import(`./nodes-cli-B3aNQG30.js`)).registerNodesCli(e)}},{name:`devices`,description:`Device pairing + token management`,hasSubcommands:!0,register:async e=>{(await import(`./devices-cli-Dl-0fQmR.js`)).registerDevicesCli(e)}},{name:`node`,description:`Run and manage the headless node host service`,hasSubcommands:!0,register:async e=>{(await import(`./node-cli-Bzu1efMB.js`)).registerNodeCli(e)}},{name:`sandbox`,description:`Manage sandbox containers for agent isolation`,hasSubcommands:!0,register:async e=>{(await import(`./sandbox-cli-Jo5nYeug.js`)).registerSandboxCli(e)}},{name:`tui`,description:`Open a terminal UI connected to the Gateway`,hasSubcommands:!1,register:async e=>{(await import(`./tui-cli-FxvETbln.js`)).registerTuiCli(e)}},{name:`cron`,description:`Manage cron jobs via the Gateway scheduler`,hasSubcommands:!0,register:async e=>{(await import(`./cron-cli-L9wLLocl.js`)).registerCronCli(e)}},{name:`dns`,description:`DNS helpers for wide-area discovery (Tailscale + CoreDNS)`,hasSubcommands:!0,register:async e=>{(await import(`./dns-cli-C7L4RYOm.js`)).registerDnsCli(e)}},{name:`docs`,description:`Search the live OpenClaw docs`,hasSubcommands:!1,register:async e=>{(await import(`./docs-cli-DnLLU7eX.js`)).registerDocsCli(e)}},{name:`hooks`,description:`Manage internal agent hooks`,hasSubcommands:!0,register:async e=>{(await import(`./hooks-cli-DWCe4aHR.js`)).registerHooksCli(e)}},{name:`webhooks`,description:`Webhook helpers and integrations`,hasSubcommands:!0,register:async e=>{(await import(`./webhooks-cli-ICOwBPSv.js`)).registerWebhooksCli(e)}},{name:`qr`,description:`Generate iOS pairing QR/setup code`,hasSubcommands:!1,register:async e=>{(await import(`./qr-cli-ZtDsXyLO.js`)).registerQrCli(e)}},{name:`clawbot`,description:`Legacy clawbot command aliases`,hasSubcommands:!0,register:async e=>{(await import(`./clawbot-cli-B0iTJ-pm.js`)).registerClawbotCli(e)}},{name:`pairing`,description:`Secure DM pairing (approve inbound requests)`,hasSubcommands:!0,register:async e=>{let{registerPluginCliCommands:t}=await import(`./cli-BY5POVX1.js`),n=await u();n&&t(e,n),(await import(`./pairing-cli-CxJy8LPo.js`)).registerPairingCli(e)}},{name:`plugins`,description:`Manage OpenClaw plugins and extensions`,hasSubcommands:!0,register:async e=>{(await import(`./plugins-cli-BjLj52hA.js`)).registerPluginsCli(e);let{registerPluginCliCommands:t}=await import(`./cli-BY5POVX1.js`),n=await u();n&&t(e,n)}},{name:`channels`,description:`Manage connected chat channels (Telegram, Discord, etc.)`,hasSubcommands:!0,register:async e=>{(await import(`./channels-cli-CrdwqyiA.js`)).registerChannelsCli(e)}},{name:`directory`,description:`Lookup contact and group IDs (self, peers, groups) for supported chat channels`,hasSubcommands:!0,register:async e=>{(await import(`./directory-cli-CpMjutQb.js`)).registerDirectoryCli(e)}},{name:`security`,description:`Security tools and local config audits`,hasSubcommands:!0,register:async e=>{(await import(`./security-cli-Cuc8IQKB.js`)).registerSecurityCli(e)}},{name:`secrets`,description:`Secrets runtime reload controls`,hasSubcommands:!0,register:async e=>{(await import(`./secrets-cli-BstBe0UA.js`)).registerSecretsCli(e)}},{name:`skills`,description:`List and inspect available skills`,hasSubcommands:!0,register:async e=>{(await import(`./skills-cli-DLmqhAB-.js`)).registerSkillsCli(e)}},{name:`update`,description:`Update OpenClaw and inspect update channel status`,hasSubcommands:!0,register:async e=>{(await import(`./update-cli-CZsuMrHE.js`)).registerUpdateCli(e)}},{name:`completion`,description:`Generate shell completion script`,hasSubcommands:!1,register:async e=>{(await import(`./completion-cli-ByNU0Lbo.js`).then(e=>e.n)).registerCompletionCli(e)}}];function f(){return d}function p(){return d.filter(e=>e.hasSubcommands).map(e=>e.name)}async function m(e,t){let n=d.find(e=>e.name===t);return n?(s(e,n.name),await n.register(e),!0):!1}function h(e,t){let n=e.command(t.name).description(t.description);n.allowUnknownOption(!0),n.allowExcessArguments(!0),n.action(async(...r)=>{o(e,n),await t.register(e),await a(e,r)})}function g(t,n=process.argv){if(l(n)){for(let e of d)e.register(t);return}let r=e(n);if(r&&c(n)){let e=d.find(e=>e.name===r);if(e){h(t,e);return}}for(let e of d)h(t,e)}const _=e=>!t(e),v=[{commands:[{name:`setup`,description:`Initialize local config and agent workspace`,hasSubcommands:!1}],register:async({program:e})=>{(await import(`./register.setup-CPGByOtO.js`)).registerSetupCommand(e)}},{commands:[{name:`onboard`,description:`Interactive onboarding wizard for gateway, workspace, and skills`,hasSubcommands:!1}],register:async({program:e})=>{(await import(`./register.onboard-B01N1AYH.js`)).registerOnboardCommand(e)}},{commands:[{name:`configure`,description:`Interactive setup wizard for credentials, channels, gateway, and agent defaults`,hasSubcommands:!1}],register:async({program:e})=>{(await import(`./register.configure-CwuLuKsv.js`)).registerConfigureCommand(e)}},{commands:[{name:`config`,description:`Non-interactive config helpers (get/set/unset/file/validate). Default: starts setup wizard.`,hasSubcommands:!0}],register:async({program:e})=>{(await import(`./config-cli-CcE1aKR3.js`)).registerConfigCli(e)}},{commands:[{name:`backup`,description:`Create and verify local backup archives for OpenClaw state`,hasSubcommands:!0}],register:async({program:e})=>{(await import(`./register.backup-Vh8RK6fp.js`)).registerBackupCommand(e)}},{commands:[{name:`doctor`,description:`Health checks + quick fixes for the gateway and channels`,hasSubcommands:!1},{name:`dashboard`,description:`Open the Control UI with your current token`,hasSubcommands:!1},{name:`reset`,description:`Reset local config/state (keeps the CLI installed)`,hasSubcommands:!1},{name:`uninstall`,description:`Uninstall the gateway service + local data (CLI remains)`,hasSubcommands:!1}],register:async({program:e})=>{(await import(`./register.maintenance-B5cnDjLy.js`)).registerMaintenanceCommands(e)}},{commands:[{name:`message`,description:`Send, read, and manage messages`,hasSubcommands:!0}],register:async({program:e,ctx:t})=>{(await import(`./register.message-CEcXemHd.js`)).registerMessageCommands(e,t)}},{commands:[{name:`memory`,description:`Search and reindex memory files`,hasSubcommands:!0}],register:async({program:e})=>{(await import(`./memory-cli-BouV_wyL.js`).then(e=>e.t)).registerMemoryCli(e)}},{commands:[{name:`agent`,description:`Run one agent turn via the Gateway`,hasSubcommands:!1},{name:`agents`,description:`Manage isolated agents (workspaces, auth, routing)`,hasSubcommands:!0}],register:async({program:e,ctx:t})=>{(await import(`./register.agent-CANRVL5k.js`)).registerAgentCommands(e,{agentChannelOptions:t.agentChannelOptions})}},{commands:[{name:`status`,description:`Show channel health and recent session recipients`,hasSubcommands:!1},{name:`health`,description:`Fetch health from the running gateway`,hasSubcommands:!1},{name:`sessions`,description:`List stored conversation sessions`,hasSubcommands:!0}],register:async({program:e})=>{(await import(`./register.status-health-sessions-hrQLxH-w.js`)).registerStatusHealthSessionsCommands(e)}},{commands:[{name:`browser`,description:`Manage OpenClaw's dedicated browser (Chrome/Chromium)`,hasSubcommands:!0}],register:async({program:e})=>{(await import(`./browser-cli-Bf-Pzjxs.js`)).registerBrowserCli(e)}}];function y(e){let t=new Set,n=[];for(let r of v)for(let i of r.commands)e&&!e(i)||t.has(i.name)||(t.add(i.name),n.push(i.name));return n}function b(){return y()}function x(){return y(e=>e.hasSubcommands)}function S(e,t){for(let n of t.commands)s(e,n.name)}function C(e,t,n,r){let i=e.command(r.name).description(r.description);i.allowUnknownOption(!0),i.allowExcessArguments(!0),i.action(async(...r)=>{S(e,n),await n.register({program:e,ctx:t,argv:process.argv}),await a(e,r)})}async function w(e,t,n,r=process.argv){let i=v.find(e=>e.commands.some(e=>e.name===n));return i?(S(e,i),await i.register({program:e,ctx:t,argv:r}),!0):!1}function T(t,n,r){let i=e(r);if(i&&_(r)){let e=v.find(e=>e.commands.some(e=>e.name===i));if(e){let r=e.commands.find(e=>e.name===i);r&&C(t,n,e,r);return}}for(let e of v)for(let r of e.commands)C(t,n,e,r)}function E(e,t,n=process.argv){T(e,t,n),g(e,n)}const D=Symbol.for(`openclaw.cli.programContext`);function O(e,t){e[D]=t}function k(e){return e[D]}export{w as a,f as c,x as i,m as l,O as n,E as o,b as r,p as s,k as t};
@@ -1,4 +1,4 @@
1
- import{d as e,g as t,m as n,t as r,u as i,y as a}from"./paths-B4IRk3wi.js";import{N as o,p as s}from"./subsystem-C5XF2Fy5.js";import{C as c,S as l,g as u,y as d}from"./utils-UGOV_184.js";import{$a as f,$l as p,A as m,Bo as h,Br as g,Co as _,Ga as v,Hn as y,Ja as b,Oi as x,Vl as S,Yl as C,Zs as w,_ as T,a as ee,ai as E,as as D,da as O,ds as k,fu as A,go as j,h as M,hs as N,ii as te,jt as ne,ls as re,nc as ie,ou as ae,pu as oe,rs as se,sa as ce,so as le,su as ue}from"./model-selection-BLbnMb5E.js";import{Dr as de,Nr as fe,Xt as pe,Zt as me,a as he,i as ge,o as _e,ot as ve}from"./reply-DwfVhea1.js";import{_ as ye,a as be,d as P,f as F}from"./agent-scope-DXZc3eNT.js";import{E as xe}from"./session-key-D3P0tf5P.js";import{t as Se}from"./openclaw-root-D_0Q6--h.js";import{a as I,d as Ce}from"./types.secrets-C-5U96pc.js";import{t as L}from"./command-format-BbDT1tlm.js";import{t as we}from"./env-D7wNuBx1.js";import{n as Te}from"./plugins-CYLrFT4h.js";import{n as Ee,t as R}from"./exec-DHqLtFYt.js";import{c as De,n as Oe,r as ke,s as Ae}from"./paths-yLEk_25I.js";import{n as je}from"./model-catalog-D-hkNWin.js";import{n as Me,t as Ne}from"./call-JB-cGR9n.js";import{f as Pe,m as Fe,p as Ie}from"./send-NbU9-scF2.js";import{g as Le}from"./read-only-account-inspect-B0cm8yrv.js";import{r as Re,t as ze}from"./wsl-Ok7GaSJ6.js";import{h as Be,n as Ve,p as He,s as Ue}from"./onboard-helpers-D90u4wVK.js";import{n as z,r as We,t as Ge}from"./prompt-style-CXKekIBY.js";import{i as Ke}from"./memory-cli-BouV_wyL.js";import{a as qe,i as Je}from"./manager-CI6O4QH6.js";import{g as Ye,m as Xe,p as Ze,u as Qe}from"./arg-split-DE5RqDHq.js";import{t as $e}from"./skills-status-D4Y1BJYL.js";import{t as B}from"./note-D4GAwgha.js";import{t as et}from"./channels-status-issues-PRgOT90w.js";import{a as tt,o as nt}from"./daemon-install-plan.shared-BkwZgIAY.js";import{n as V,r as rt,t as it}from"./gateway-install-token-Dt7hDXoR.js";import{n as at,t as H}from"./daemon-runtime-DHiDbRuC.js";import{i as ot,u as st}from"./systemd-D7odsu4K.js";import{a as ct,i as lt,n as U,o as ut,s as dt,t as ft}from"./service-BtB9epJk.js";import{c as pt,i as mt,n as ht,o as gt,r as _t,s as vt,t as yt,u as bt}from"./systemd-hints-CEQj6yrs.js";import{t as xt}from"./diagnostics-BgbeL9KE.js";import{n as St,t as Ct}from"./inspect-BKV-I1UE.js";import{r as wt}from"./health-B_-ZE5FK.js";import{i as Tt,r as Et}from"./control-ui-assets-BIa0GGDg.js";import{t as Dt}from"./channel-account-context-BMPAMZEv.js";import{t as Ot,u as kt}from"./update-runner-DG-1TYYc.js";import{n as At}from"./logging-CbMVr2MA.js";import{n as jt}from"./oauth-tls-preflight-ByNjbUR5.js";import{n as Mt,r as Nt,t as Pt}from"./doctor-config-flow-BVpr8-q9.js";import{t as Ft}from"./systemd-linger-C2MJD6KG.js";import{t as It}from"./health-format-VBr6LEpt.js";import{n as Lt}from"./doctor-completion-C9CPhCor.js";import W from"node:fs";import G from"node:os";import K from"node:path";import{promisify as Rt}from"node:util";import q from"node:fs/promises";import{execFile as zt}from"node:child_process";import{confirm as Bt,intro as Vt,outro as Ht,select as Ut}from"@clack/prompts";async function Wt(e,t){let n=S({cfg:e,store:C(),provider:`anthropic`,legacyProfileId:`anthropic:default`});return!n.migrated||n.changes.length===0||(B(n.changes.map(e=>`- ${e}`).join(`
1
+ import{d as e,g as t,m as n,t as r,u as i,y as a}from"./paths-B4IRk3wi.js";import{N as o,p as s}from"./subsystem-C5XF2Fy5.js";import{C as c,S as l,g as u,y as d}from"./utils-UGOV_184.js";import{$a as f,$l as p,A as m,Bo as h,Br as g,Co as _,Ga as v,Hn as y,Ja as b,Oi as x,Vl as S,Yl as C,Zs as w,_ as T,a as ee,ai as E,as as D,da as O,ds as k,fu as A,go as j,h as M,hs as N,ii as te,jt as ne,ls as re,nc as ie,ou as ae,pu as oe,rs as se,sa as ce,so as le,su as ue}from"./model-selection-BLbnMb5E.js";import{Dr as de,Nr as fe,Xt as pe,Zt as me,a as he,i as ge,o as _e,ot as ve}from"./reply-mWIMy_ju.js";import{_ as ye,a as be,d as P,f as F}from"./agent-scope-DXZc3eNT.js";import{E as xe}from"./session-key-D3P0tf5P.js";import{t as Se}from"./openclaw-root-D_0Q6--h.js";import{a as I,d as Ce}from"./types.secrets-C-5U96pc.js";import{t as L}from"./command-format-BbDT1tlm.js";import{t as we}from"./env-D7wNuBx1.js";import{n as Te}from"./plugins-CYLrFT4h.js";import{n as Ee,t as R}from"./exec-DHqLtFYt.js";import{c as De,n as Oe,r as ke,s as Ae}from"./paths-yLEk_25I.js";import{n as je}from"./model-catalog-D-hkNWin.js";import{n as Me,t as Ne}from"./call-JB-cGR9n.js";import{f as Pe,m as Fe,p as Ie}from"./send-NbU9-scF2.js";import{g as Le}from"./read-only-account-inspect-B0cm8yrv.js";import{r as Re,t as ze}from"./wsl-Ok7GaSJ6.js";import{h as Be,n as Ve,p as He,s as Ue}from"./onboard-helpers-D90u4wVK.js";import{n as z,r as We,t as Ge}from"./prompt-style-CXKekIBY.js";import{i as Ke}from"./memory-cli-BouV_wyL.js";import{a as qe,i as Je}from"./manager-CI6O4QH6.js";import{g as Ye,m as Xe,p as Ze,u as Qe}from"./arg-split-DE5RqDHq.js";import{t as $e}from"./skills-status-D4Y1BJYL.js";import{t as B}from"./note-D4GAwgha.js";import{t as et}from"./channels-status-issues-PRgOT90w.js";import{a as tt,o as nt}from"./daemon-install-plan.shared-BkwZgIAY.js";import{n as V,r as rt,t as it}from"./gateway-install-token-Dt7hDXoR.js";import{n as at,t as H}from"./daemon-runtime-DHiDbRuC.js";import{i as ot,u as st}from"./systemd-D7odsu4K.js";import{a as ct,i as lt,n as U,o as ut,s as dt,t as ft}from"./service-BtB9epJk.js";import{c as pt,i as mt,n as ht,o as gt,r as _t,s as vt,t as yt,u as bt}from"./systemd-hints-CEQj6yrs.js";import{t as xt}from"./diagnostics-BgbeL9KE.js";import{n as St,t as Ct}from"./inspect-BKV-I1UE.js";import{r as wt}from"./health-2MbtCw6U.js";import{i as Tt,r as Et}from"./control-ui-assets-BIa0GGDg.js";import{t as Dt}from"./channel-account-context-BMPAMZEv.js";import{t as Ot,u as kt}from"./update-runner-DZkN4otc.js";import{n as At}from"./logging-CbMVr2MA.js";import{n as jt}from"./oauth-tls-preflight-ByNjbUR5.js";import{n as Mt,r as Nt,t as Pt}from"./doctor-config-flow-BVpr8-q9.js";import{t as Ft}from"./systemd-linger-C2MJD6KG.js";import{t as It}from"./health-format-VBr6LEpt.js";import{n as Lt}from"./doctor-completion-KLuf1f33.js";import W from"node:fs";import G from"node:os";import K from"node:path";import{promisify as Rt}from"node:util";import q from"node:fs/promises";import{execFile as zt}from"node:child_process";import{confirm as Bt,intro as Vt,outro as Ht,select as Ut}from"@clack/prompts";async function Wt(e,t){let n=S({cfg:e,store:C(),provider:`anthropic`,legacyProfileId:`anthropic:default`});return!n.migrated||n.changes.length===0||(B(n.changes.map(e=>`- ${e}`).join(`
2
2
  `),`Auth profiles`),!await t.confirm({message:`Update Anthropic OAuth profile id in config now?`,initialValue:!0}))?e:n.config}function Gt(e,t){if(!e)return{next:e,changed:!1};let n=!1,r={};for(let[i,a]of Object.entries(e)){let e=a.filter(e=>!t.has(e));e.length!==a.length&&(n=!0),e.length>0&&(r[i]=e)}return{next:Object.keys(r).length>0?r:void 0,changed:n}}function Kt(e,t){let n=e.auth?.profiles,r=e.auth?.order,i=n?{...n}:void 0,a=!1;if(i)for(let e of t)e in i&&(delete i[e],a=!0);let o=Gt(r,t);if(o.changed&&(a=!0),!a)return{next:e,changed:!1};let s=i||o.next?{...e.auth,profiles:i&&Object.keys(i).length>0?i:void 0,order:o.next}:void 0;return{next:{...e,auth:s},changed:!0}}async function qt(e,t){let n=C(void 0,{allowKeychainPrompt:!1}),r=new Set;if((n.profiles[`anthropic:claude-cli`]||e.auth?.profiles?.[`anthropic:claude-cli`])&&r.add(ae),(n.profiles[`openai-codex:codex-cli`]||e.auth?.profiles?.[`openai-codex:codex-cli`])&&r.add(ue),r.size===0)return e;let i=[`Deprecated external CLI auth profiles detected (no longer supported):`];if(r.has(`anthropic:claude-cli`)&&i.push(`- ${ae} (Anthropic): use setup-token → ${L(`openclaw models auth setup-token`)}`),r.has(`openai-codex:codex-cli`)&&i.push(`- ${ue} (OpenAI Codex): use OAuth → ${L(`openclaw models auth login --provider openai-codex`)}`),B(i.join(`
3
3
  `),`Auth profiles`),!await t.confirmRepair({message:`Remove deprecated CLI auth profiles now?`,initialValue:!0}))return e;await p({updater:e=>{let t=!1;for(let n of r)e.profiles[n]&&(delete e.profiles[n],t=!0),e.usageStats?.[n]&&(delete e.usageStats[n],t=!0);if(e.order)for(let[n,i]of Object.entries(e.order)){let a=i.filter(e=>!r.has(e));a.length!==i.length&&(t=!0,a.length>0?e.order[n]=a:delete e.order[n])}if(e.lastGood)for(let[n,i]of Object.entries(e.lastGood))r.has(i)&&(delete e.lastGood[n],t=!0);return t}});let a=Kt(e,r);return a.changed&&B(Array.from(r.values()).map(e=>`- removed ${e} from config`).join(`
4
4
  `),`Doctor changes`),a.next}function Jt(e){if(e.kind===`disabled`){if(e.reason===`billing`)return`Top up credits (provider billing) or switch provider.`;if(e.reason===`auth_permanent`||e.reason===`auth`)return`Refresh or replace credentials, then retry.`}return`Wait for cooldown or switch provider.`}function Yt(e){return e.reasonCode===`invalid_expires`?`Invalid token expires metadata. Set a future Unix ms timestamp or remove expires.`:e.provider===`anthropic`&&e.profileId===`anthropic:claude-cli`?`Deprecated profile. Use ${L(`openclaw models auth setup-token`)} or ${L(`openclaw configure`)}.`:e.provider===`openai-codex`&&e.profileId===`openai-codex:codex-cli`?`Deprecated profile. Use ${L(`openclaw models auth login --provider openai-codex`)} or ${L(`openclaw configure`)}.`:`Re-auth via \`${L(`openclaw configure`)}\` or \`${L(`openclaw onboard`)}\`.`}function Xt(e){let t=e.remainingMs===void 0?``:` (${_e(e.remainingMs)})`,n=Yt(e),r=e.reasonCode?` [${e.reasonCode}]`:``;return`- ${e.profileId}: ${e.status}${r}${t}${n?` — ${n}`:``}`}async function Zt(e){let t=C(void 0,{allowKeychainPrompt:e.allowKeychainPrompt}),n=(()=>{let e=Date.now(),n=[];for(let r of Object.keys(t.usageStats??{})){let i=ne(t,r);if(!i||e>=i)continue;let a=t.usageStats?.[r],o=_e(i-e),s=typeof a?.disabledUntil==`number`&&e<a.disabledUntil,c=s?`disabled${a.disabledReason?`:${a.disabledReason}`:``}`:`cooldown`,l=Jt({kind:s?`disabled`:`cooldown`,reason:a?.disabledReason});n.push(`- ${r}: ${c} (${o})${l?` — ${l}`:``}`)}return n})();n.length>0&&B(n.join(`
@@ -1,4 +1,4 @@
1
- import{N as e,p as t}from"./subsystem-BLbY429l.js";import{d as n,g as r,m as i,t as a,u as o,y as s}from"./paths-BjD3T_xq.js";import{i as c}from"./entry.js";import{$a as l,Ai as u,Bo as d,Fo as f,Ki as p,Kn as m,Kr as h,Ni as g,On as _,Ri as v,Tc as y,Ua as b,Va as x,Xr as S,Ya as ee,Yc as C,Zc as w,_c as T,ca as E,du as D,fu as O,gr as k,hu as A,jt as te,kc as j,l as ne,mu as re,qa as ie,qn as ae,ta as oe,ul as se,wa as ce,zc as le}from"./auth-profiles-C8rZRS0X.js";import{t as M}from"./command-format-CLxIPuLR.js";import{_ as ue,a as de,d as N,f as P}from"./agent-scope-DAWJwFfl.js";import{E as fe}from"./session-key-C7F_iqYg.js";import{S as pe,h as me,v as he,x as F}from"./utils-CGdo13HV.js";import{t as ge}from"./openclaw-root-CnsBf6ZU.js";import{a as I,d as _e}from"./types.secrets-D4tbc3Wq.js";import{n as ve}from"./plugins-DNlgeTTc.js";import{n as ye,t as L}from"./exec-B3eleY5O.js";import{Cr as be,Or as xe,Pr as Se,Sr as Ce,an as we,in as Te,l as Ee,rn as De}from"./compact-CYbPi7_-.js";import{c as Oe,n as ke,r as Ae,s as je}from"./paths-BfjJY2VL.js";import{C as Me,S as Ne,w as Pe}from"./send-Dj7NBAWg.js";import{n as Fe}from"./model-catalog-mt0IcDfR.js";import{n as Ie,t as Le}from"./call-BWx7hNtl.js";import{u as Re}from"./pi-tools.policy-B6q8YOfg.js";import{g as ze,m as Be,p as Ve,u as He}from"./arg-split-BOqSMBuf.js";import{r as Ue,t as We}from"./wsl-DHxB2Ew_.js";import{h as Ge,n as Ke,p as qe,s as Je}from"./onboard-helpers-DOlI17Ac.js";import{n as R,r as Ye,t as Xe}from"./prompt-style-BThRSQJR.js";import{r as Ze}from"./search-manager-CV2YsAym.js";import{a as Qe,i as $e}from"./manager-CxZRoQkE.js";import{t as et}from"./skills-status-DpSboPY1.js";import{t as z}from"./note-Dp-d_utk.js";import{t as tt}from"./channels-status-issues-8eFrGKyf.js";import{a as nt,o as rt}from"./daemon-install-plan.shared-Dx3DBXCG.js";import{n as B,r as it,t as at}from"./gateway-install-token-cSJrfU_1.js";import{n as ot,t as V}from"./daemon-runtime-VcpeBRJV.js";import{i as st,u as ct}from"./systemd-DbevZh65.js";import{a as lt,i as ut,n as dt,o as ft,s as pt,t as mt}from"./service-DZ9EbS15.js";import{c as ht,i as gt,n as _t,o as vt,r as yt,s as bt,t as xt,u as St}from"./systemd-hints-lXpMy-kY.js";import{t as Ct}from"./diagnostics-Cdctg9K_.js";import{n as wt,t as Tt}from"./inspect-z59cgmYc.js";import{r as Et}from"./health-CIZFVJEG.js";import{i as Dt,r as Ot}from"./control-ui-assets-CTHGGgaX.js";import{t as kt}from"./channel-account-context-DAcarnqW.js";import{t as At,u as jt}from"./update-runner-DABdlxfN.js";import{n as Mt}from"./logging-B7XHbCNn.js";import{n as Nt}from"./oauth-tls-preflight-BSBRDIfC.js";import{n as Pt,r as Ft,t as It}from"./doctor-config-flow-Dio3s4x6.js";import{t as Lt}from"./systemd-linger-cWKbFNpu.js";import{t as Rt}from"./health-format-B1nj3Wfn.js";import{n as zt}from"./doctor-completion-DI7mGC3D.js";import{execFile as Bt}from"node:child_process";import H from"node:os";import U from"node:path";import W from"node:fs";import{promisify as Vt}from"node:util";import G from"node:fs/promises";import{confirm as Ht,intro as Ut,outro as Wt,select as Gt}from"@clack/prompts";async function Kt(e,t){let n=T({cfg:e,store:y(),provider:`anthropic`,legacyProfileId:`anthropic:default`});return!n.migrated||n.changes.length===0||(z(n.changes.map(e=>`- ${e}`).join(`
1
+ import{N as e,p as t}from"./subsystem-BLbY429l.js";import{d as n,g as r,m as i,t as a,u as o,y as s}from"./paths-BjD3T_xq.js";import{i as c}from"./entry.js";import{$a as l,Ai as u,Bo as d,Fo as f,Ki as p,Kn as m,Kr as h,Ni as g,On as _,Ri as v,Tc as y,Ua as b,Va as x,Xr as S,Ya as ee,Yc as C,Zc as w,_c as T,ca as E,du as D,fu as O,gr as k,hu as A,jt as te,kc as j,l as ne,mu as re,qa as ie,qn as ae,ta as oe,ul as se,wa as ce,zc as le}from"./auth-profiles-C8rZRS0X.js";import{t as M}from"./command-format-CLxIPuLR.js";import{_ as ue,a as de,d as N,f as P}from"./agent-scope-DAWJwFfl.js";import{E as fe}from"./session-key-C7F_iqYg.js";import{S as pe,h as me,v as he,x as F}from"./utils-CGdo13HV.js";import{t as ge}from"./openclaw-root-CnsBf6ZU.js";import{a as I,d as _e}from"./types.secrets-D4tbc3Wq.js";import{n as ve}from"./plugins-DNlgeTTc.js";import{n as ye,t as L}from"./exec-B3eleY5O.js";import{Cr as be,Or as xe,Pr as Se,Sr as Ce,an as we,in as Te,l as Ee,rn as De}from"./compact-uyQDx8pN.js";import{c as Oe,n as ke,r as Ae,s as je}from"./paths-BfjJY2VL.js";import{C as Me,S as Ne,w as Pe}from"./send-Dj7NBAWg.js";import{n as Fe}from"./model-catalog-mt0IcDfR.js";import{n as Ie,t as Le}from"./call-BWx7hNtl.js";import{u as Re}from"./pi-tools.policy-B6q8YOfg.js";import{g as ze,m as Be,p as Ve,u as He}from"./arg-split-BOqSMBuf.js";import{r as Ue,t as We}from"./wsl-DHxB2Ew_.js";import{h as Ge,n as Ke,p as qe,s as Je}from"./onboard-helpers-DOlI17Ac.js";import{n as R,r as Ye,t as Xe}from"./prompt-style-BThRSQJR.js";import{r as Ze}from"./search-manager-CV2YsAym.js";import{a as Qe,i as $e}from"./manager-CxZRoQkE.js";import{t as et}from"./skills-status-DpSboPY1.js";import{t as z}from"./note-Dp-d_utk.js";import{t as tt}from"./channels-status-issues-8eFrGKyf.js";import{a as nt,o as rt}from"./daemon-install-plan.shared-Dx3DBXCG.js";import{n as B,r as it,t as at}from"./gateway-install-token-cSJrfU_1.js";import{n as ot,t as V}from"./daemon-runtime-VcpeBRJV.js";import{i as st,u as ct}from"./systemd-DbevZh65.js";import{a as lt,i as ut,n as dt,o as ft,s as pt,t as mt}from"./service-DZ9EbS15.js";import{c as ht,i as gt,n as _t,o as vt,r as yt,s as bt,t as xt,u as St}from"./systemd-hints-lXpMy-kY.js";import{t as Ct}from"./diagnostics-Cdctg9K_.js";import{n as wt,t as Tt}from"./inspect-z59cgmYc.js";import{r as Et}from"./health-Dmtcw9K8.js";import{i as Dt,r as Ot}from"./control-ui-assets-CTHGGgaX.js";import{t as kt}from"./channel-account-context-DAcarnqW.js";import{t as At,u as jt}from"./update-runner-DhaHCCx3.js";import{n as Mt}from"./logging-B7XHbCNn.js";import{n as Nt}from"./oauth-tls-preflight-BSBRDIfC.js";import{n as Pt,r as Ft,t as It}from"./doctor-config-flow-Dio3s4x6.js";import{t as Lt}from"./systemd-linger-cWKbFNpu.js";import{t as Rt}from"./health-format-B1nj3Wfn.js";import{n as zt}from"./doctor-completion-C15UB3EM.js";import{execFile as Bt}from"node:child_process";import H from"node:os";import U from"node:path";import W from"node:fs";import{promisify as Vt}from"node:util";import G from"node:fs/promises";import{confirm as Ht,intro as Ut,outro as Wt,select as Gt}from"@clack/prompts";async function Kt(e,t){let n=T({cfg:e,store:y(),provider:`anthropic`,legacyProfileId:`anthropic:default`});return!n.migrated||n.changes.length===0||(z(n.changes.map(e=>`- ${e}`).join(`
2
2
  `),`Auth profiles`),!await t.confirm({message:`Update Anthropic OAuth profile id in config now?`,initialValue:!0}))?e:n.config}function qt(e,t){if(!e)return{next:e,changed:!1};let n=!1,r={};for(let[i,a]of Object.entries(e)){let e=a.filter(e=>!t.has(e));e.length!==a.length&&(n=!0),e.length>0&&(r[i]=e)}return{next:Object.keys(r).length>0?r:void 0,changed:n}}function Jt(e,t){let n=e.auth?.profiles,r=e.auth?.order,i=n?{...n}:void 0,a=!1;if(i)for(let e of t)e in i&&(delete i[e],a=!0);let o=qt(r,t);if(o.changed&&(a=!0),!a)return{next:e,changed:!1};let s=i||o.next?{...e.auth,profiles:i&&Object.keys(i).length>0?i:void 0,order:o.next}:void 0;return{next:{...e,auth:s},changed:!0}}async function Yt(e,t){let n=y(void 0,{allowKeychainPrompt:!1}),r=new Set;if((n.profiles[`anthropic:claude-cli`]||e.auth?.profiles?.[`anthropic:claude-cli`])&&r.add(re),(n.profiles[`openai-codex:codex-cli`]||e.auth?.profiles?.[`openai-codex:codex-cli`])&&r.add(A),r.size===0)return e;let i=[`Deprecated external CLI auth profiles detected (no longer supported):`];if(r.has(`anthropic:claude-cli`)&&i.push(`- ${re} (Anthropic): use setup-token → ${M(`openclaw models auth setup-token`)}`),r.has(`openai-codex:codex-cli`)&&i.push(`- ${A} (OpenAI Codex): use OAuth → ${M(`openclaw models auth login --provider openai-codex`)}`),z(i.join(`
3
3
  `),`Auth profiles`),!await t.confirmRepair({message:`Remove deprecated CLI auth profiles now?`,initialValue:!0}))return e;await j({updater:e=>{let t=!1;for(let n of r)e.profiles[n]&&(delete e.profiles[n],t=!0),e.usageStats?.[n]&&(delete e.usageStats[n],t=!0);if(e.order)for(let[n,i]of Object.entries(e.order)){let a=i.filter(e=>!r.has(e));a.length!==i.length&&(t=!0,a.length>0?e.order[n]=a:delete e.order[n])}if(e.lastGood)for(let[n,i]of Object.entries(e.lastGood))r.has(i)&&(delete e.lastGood[n],t=!0);return t}});let a=Jt(e,r);return a.changed&&z(Array.from(r.values()).map(e=>`- removed ${e} from config`).join(`
4
4
  `),`Doctor changes`),a.next}function Xt(e){if(e.kind===`disabled`){if(e.reason===`billing`)return`Top up credits (provider billing) or switch provider.`;if(e.reason===`auth_permanent`||e.reason===`auth`)return`Refresh or replace credentials, then retry.`}return`Wait for cooldown or switch provider.`}function Zt(e){return e.reasonCode===`invalid_expires`?`Invalid token expires metadata. Set a future Unix ms timestamp or remove expires.`:e.provider===`anthropic`&&e.profileId===`anthropic:claude-cli`?`Deprecated profile. Use ${M(`openclaw models auth setup-token`)} or ${M(`openclaw configure`)}.`:e.provider===`openai-codex`&&e.profileId===`openai-codex:codex-cli`?`Deprecated profile. Use ${M(`openclaw models auth login --provider openai-codex`)} or ${M(`openclaw configure`)}.`:`Re-auth via \`${M(`openclaw configure`)}\` or \`${M(`openclaw onboard`)}\`.`}function Qt(e){let t=e.remainingMs===void 0?``:` (${we(e.remainingMs)})`,n=Zt(e),r=e.reasonCode?` [${e.reasonCode}]`:``;return`- ${e.profileId}: ${e.status}${r}${t}${n?` — ${n}`:``}`}async function $t(e){let t=y(void 0,{allowKeychainPrompt:e.allowKeychainPrompt}),n=(()=>{let e=Date.now(),n=[];for(let r of Object.keys(t.usageStats??{})){let i=ne(t,r);if(!i||e>=i)continue;let a=t.usageStats?.[r],o=we(i-e),s=typeof a?.disabledUntil==`number`&&e<a.disabledUntil,c=s?`disabled${a.disabledReason?`:${a.disabledReason}`:``}`:`cooldown`,l=Xt({kind:s?`disabled`:`cooldown`,reason:a?.disabledReason});n.push(`- ${r}: ${c} (${o})${l?` — ${l}`:``}`)}return n})();n.length>0&&z(n.join(`
@@ -1,4 +1,4 @@
1
- import{t as e}from"./subsystem-BLbY429l.js";import{Gc as t,Sc as n,Tc as r}from"./auth-profiles-C8rZRS0X.js";import{c as i,l as a}from"./compact-CYbPi7_-.js";import{r as o}from"./prompt-style-BThRSQJR.js";import{m as s}from"./openai-codex-model-default-DuRfnfUm.js";import{h as c}from"./auth-token-DZLZ3d_I.js";import{n as l}from"./logging-B7XHbCNn.js";import{r as u,t as d}from"./oauth-tls-preflight-BSBRDIfC.js";import{loginOpenAICodex as f}from"@mariozechner/pi-ai/oauth";import{intro as p,note as m,outro as h,spinner as g}from"@clack/prompts";const _=`Iv1.b507a08c87ecfe98`;function v(e){if(!e||typeof e!=`object`)throw Error(`Unexpected response from GitHub`);return e}async function y(e){let t=new URLSearchParams({client_id:_,scope:e.scope}),n=await fetch(`https://github.com/login/device/code`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/x-www-form-urlencoded`},body:t});if(!n.ok)throw Error(`GitHub device code failed: HTTP ${n.status}`);let r=v(await n.json());if(!r.device_code||!r.user_code||!r.verification_uri)throw Error(`GitHub device code response missing fields`);return r}async function b(e){let t=new URLSearchParams({client_id:_,device_code:e.deviceCode,grant_type:`urn:ietf:params:oauth:grant-type:device_code`});for(;Date.now()<e.expiresAt;){let n=await fetch(`https://github.com/login/oauth/access_token`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/x-www-form-urlencoded`},body:t});if(!n.ok)throw Error(`GitHub device token failed: HTTP ${n.status}`);let r=v(await n.json());if(`access_token`in r&&typeof r.access_token==`string`)return r.access_token;let i=`error`in r?r.error:`unknown`;if(i===`authorization_pending`){await new Promise(t=>setTimeout(t,e.intervalMs));continue}if(i===`slow_down`){await new Promise(t=>setTimeout(t,e.intervalMs+2e3));continue}throw i===`expired_token`?Error(`GitHub device code expired; run login again`):i===`access_denied`?Error(`GitHub login cancelled`):Error(`GitHub device flow error: ${i}`)}throw Error(`GitHub device code expired; run login again`)}async function x(e,t){if(!process.stdin.isTTY)throw Error(`github-copilot login requires an interactive TTY.`);p(o(`GitHub Copilot login`));let i=e.profileId?.trim()||`github-copilot:github`;r(void 0,{allowKeychainPrompt:!1}).profiles[i]&&!e.yes&&m(`Auth profile already exists: ${i}\nRe-running will overwrite it.`,o(`Existing credentials`));let a=g();a.start(`Requesting device code from GitHub...`);let u=await y({scope:`read:user`});a.stop(`Device code ready`),m([`Visit: ${u.verification_uri}`,`Code: ${u.user_code}`].join(`
1
+ import{t as e}from"./subsystem-BLbY429l.js";import{Gc as t,Sc as n,Tc as r}from"./auth-profiles-C8rZRS0X.js";import{c as i,l as a}from"./compact-uyQDx8pN.js";import{r as o}from"./prompt-style-BThRSQJR.js";import{m as s}from"./openai-codex-model-default-DuRfnfUm.js";import{h as c}from"./auth-token-DZLZ3d_I.js";import{n as l}from"./logging-B7XHbCNn.js";import{r as u,t as d}from"./oauth-tls-preflight-BSBRDIfC.js";import{loginOpenAICodex as f}from"@mariozechner/pi-ai/oauth";import{intro as p,note as m,outro as h,spinner as g}from"@clack/prompts";const _=`Iv1.b507a08c87ecfe98`;function v(e){if(!e||typeof e!=`object`)throw Error(`Unexpected response from GitHub`);return e}async function y(e){let t=new URLSearchParams({client_id:_,scope:e.scope}),n=await fetch(`https://github.com/login/device/code`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/x-www-form-urlencoded`},body:t});if(!n.ok)throw Error(`GitHub device code failed: HTTP ${n.status}`);let r=v(await n.json());if(!r.device_code||!r.user_code||!r.verification_uri)throw Error(`GitHub device code response missing fields`);return r}async function b(e){let t=new URLSearchParams({client_id:_,device_code:e.deviceCode,grant_type:`urn:ietf:params:oauth:grant-type:device_code`});for(;Date.now()<e.expiresAt;){let n=await fetch(`https://github.com/login/oauth/access_token`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/x-www-form-urlencoded`},body:t});if(!n.ok)throw Error(`GitHub device token failed: HTTP ${n.status}`);let r=v(await n.json());if(`access_token`in r&&typeof r.access_token==`string`)return r.access_token;let i=`error`in r?r.error:`unknown`;if(i===`authorization_pending`){await new Promise(t=>setTimeout(t,e.intervalMs));continue}if(i===`slow_down`){await new Promise(t=>setTimeout(t,e.intervalMs+2e3));continue}throw i===`expired_token`?Error(`GitHub device code expired; run login again`):i===`access_denied`?Error(`GitHub login cancelled`):Error(`GitHub device flow error: ${i}`)}throw Error(`GitHub device code expired; run login again`)}async function x(e,t){if(!process.stdin.isTTY)throw Error(`github-copilot login requires an interactive TTY.`);p(o(`GitHub Copilot login`));let i=e.profileId?.trim()||`github-copilot:github`;r(void 0,{allowKeychainPrompt:!1}).profiles[i]&&!e.yes&&m(`Auth profile already exists: ${i}\nRe-running will overwrite it.`,o(`Existing credentials`));let a=g();a.start(`Requesting device code from GitHub...`);let u=await y({scope:`read:user`});a.stop(`Device code ready`),m([`Visit: ${u.verification_uri}`,`Code: ${u.user_code}`].join(`
2
2
  `),o(`Authorize`));let d=Date.now()+u.expires_in*1e3,f=Math.max(1e3,u.interval*1e3),_=g();_.start(`Waiting for GitHub authorization...`);let v=await b({deviceCode:u.device_code,intervalMs:f,expiresAt:d});_.stop(`GitHub access token acquired`),n({profileId:i,credential:{type:`token`,provider:`github-copilot`,token:v}}),await s(e=>c(e,{provider:`github-copilot`,profileId:i,mode:`token`})),l(t),t.log(`Auth profile: ${i} (github-copilot/token)`),h(`Done`)}const S=e(`plugins`);function C(e){return a({config:e.config,workspaceDir:e.workspaceDir,logger:i(S)}).providers.map(e=>e.provider)}const w=e=>e.trim().length>0?void 0:`Required`;function T(e){let t=e.manualPromptMessage??`Paste the redirect URL`,n;return{onAuth:async({url:r})=>{if(e.isRemote){e.spin.stop(`OAuth URL ready`),e.runtime.log(`\nOpen this URL in your LOCAL browser:\n\n${r}\n`),n=e.prompter.text({message:t,validate:w}).then(e=>String(e));return}e.spin.update(e.localBrowserMessage),await e.openUrl(r),e.runtime.log(`Open: ${r}`)},onPrompt:async t=>{if(n)return n;let r=await e.prompter.text({message:t.message,placeholder:t.placeholder,validate:w});return String(r)}}}async function E(e){let{prompter:t,runtime:n,isRemote:r,openUrl:i,localBrowserMessage:a}=e,o=await u();if(!o.ok&&o.kind===`tls-cert`){let e=d(o);throw n.error(e),await t.note(e,`OAuth prerequisites`),Error(o.message)}await t.note(r?[`You are running in a remote/VPS environment.`,`A URL will be shown for you to open in your LOCAL browser.`,`After signing in, paste the redirect URL back here.`].join(`
3
3
  `):[`Browser will open for OpenAI authentication.`,`If the callback doesn't auto-complete, paste the redirect URL.`,`OpenAI OAuth uses localhost:1455 for the callback.`].join(`
4
4
  `),`OpenAI Codex OAuth`);let s=t.progress(`Starting OAuth flow…`);try{let{onAuth:e,onPrompt:o}=T({isRemote:r,prompter:t,runtime:n,spin:s,openUrl:i,localBrowserMessage:a??`Complete sign-in in browser…`}),c=await f({onAuth:e,onPrompt:o,onProgress:e=>s.update(e)});return s.stop(`OpenAI OAuth complete`),c??null}catch(e){throw s.stop(`OpenAI OAuth failed`),n.error(String(e)),await t.note(`Trouble with OAuth? See https://docs.openclaw.ai/start/faq`,`OAuth help`),e}}function D(e,n){let r=n?.trim();if(!r)return null;let i=t(r);return e.find(e=>t(e.id)===i)??e.find(e=>e.aliases?.some(e=>t(e)===i)??!1)??null}function O(e,t){let n=t?.trim();if(!n)return null;let r=n.toLowerCase();return e.auth.find(e=>e.id.toLowerCase()===r)??e.auth.find(e=>e.label.toLowerCase()===r)??null}function k(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}function A(e,t){if(!k(e)||!k(t))return t;let n={...e};for(let[e,r]of Object.entries(t)){let t=n[e];k(t)&&k(r)?n[e]=A(t,r):n[e]=r}return n}function j(e,t){let n={...e.agents?.defaults?.models};n[t]=n[t]??{};let r=e.agents?.defaults?.model;return{...e,agents:{...e.agents,defaults:{...e.agents?.defaults,models:n,model:{...r&&typeof r==`object`&&`fallbacks`in r?{fallbacks:r.fallbacks}:void 0,primary:t}}}}}export{E as a,x as c,D as i,A as n,T as o,O as r,C as s,j as t};
@@ -1,4 +1,4 @@
1
- import{t as e}from"./subsystem-C5XF2Fy5.js";import{Kl as t,Yl as n,d as r}from"./model-selection-BLbnMb5E.js";import{at as i,ot as a}from"./reply-DwfVhea1.js";import{r as o}from"./prompt-style-CXKekIBY.js";import{m as s}from"./openai-codex-model-default-Bx8i3bOg.js";import{h as c}from"./auth-token-Dp6bxT29.js";import{n as l}from"./logging-CbMVr2MA.js";import{r as u,t as d}from"./oauth-tls-preflight-ByNjbUR5.js";import{loginOpenAICodex as f}from"@mariozechner/pi-ai/oauth";import{intro as p,note as m,outro as h,spinner as g}from"@clack/prompts";const _=`Iv1.b507a08c87ecfe98`;function v(e){if(!e||typeof e!=`object`)throw Error(`Unexpected response from GitHub`);return e}async function y(e){let t=new URLSearchParams({client_id:_,scope:e.scope}),n=await fetch(`https://github.com/login/device/code`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/x-www-form-urlencoded`},body:t});if(!n.ok)throw Error(`GitHub device code failed: HTTP ${n.status}`);let r=v(await n.json());if(!r.device_code||!r.user_code||!r.verification_uri)throw Error(`GitHub device code response missing fields`);return r}async function b(e){let t=new URLSearchParams({client_id:_,device_code:e.deviceCode,grant_type:`urn:ietf:params:oauth:grant-type:device_code`});for(;Date.now()<e.expiresAt;){let n=await fetch(`https://github.com/login/oauth/access_token`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/x-www-form-urlencoded`},body:t});if(!n.ok)throw Error(`GitHub device token failed: HTTP ${n.status}`);let r=v(await n.json());if(`access_token`in r&&typeof r.access_token==`string`)return r.access_token;let i=`error`in r?r.error:`unknown`;if(i===`authorization_pending`){await new Promise(t=>setTimeout(t,e.intervalMs));continue}if(i===`slow_down`){await new Promise(t=>setTimeout(t,e.intervalMs+2e3));continue}throw i===`expired_token`?Error(`GitHub device code expired; run login again`):i===`access_denied`?Error(`GitHub login cancelled`):Error(`GitHub device flow error: ${i}`)}throw Error(`GitHub device code expired; run login again`)}async function x(e,r){if(!process.stdin.isTTY)throw Error(`github-copilot login requires an interactive TTY.`);p(o(`GitHub Copilot login`));let i=e.profileId?.trim()||`github-copilot:github`;n(void 0,{allowKeychainPrompt:!1}).profiles[i]&&!e.yes&&m(`Auth profile already exists: ${i}\nRe-running will overwrite it.`,o(`Existing credentials`));let a=g();a.start(`Requesting device code from GitHub...`);let u=await y({scope:`read:user`});a.stop(`Device code ready`),m([`Visit: ${u.verification_uri}`,`Code: ${u.user_code}`].join(`
1
+ import{t as e}from"./subsystem-C5XF2Fy5.js";import{Kl as t,Yl as n,d as r}from"./model-selection-BLbnMb5E.js";import{at as i,ot as a}from"./reply-mWIMy_ju.js";import{r as o}from"./prompt-style-CXKekIBY.js";import{m as s}from"./openai-codex-model-default-Bx8i3bOg.js";import{h as c}from"./auth-token-Dp6bxT29.js";import{n as l}from"./logging-CbMVr2MA.js";import{r as u,t as d}from"./oauth-tls-preflight-ByNjbUR5.js";import{loginOpenAICodex as f}from"@mariozechner/pi-ai/oauth";import{intro as p,note as m,outro as h,spinner as g}from"@clack/prompts";const _=`Iv1.b507a08c87ecfe98`;function v(e){if(!e||typeof e!=`object`)throw Error(`Unexpected response from GitHub`);return e}async function y(e){let t=new URLSearchParams({client_id:_,scope:e.scope}),n=await fetch(`https://github.com/login/device/code`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/x-www-form-urlencoded`},body:t});if(!n.ok)throw Error(`GitHub device code failed: HTTP ${n.status}`);let r=v(await n.json());if(!r.device_code||!r.user_code||!r.verification_uri)throw Error(`GitHub device code response missing fields`);return r}async function b(e){let t=new URLSearchParams({client_id:_,device_code:e.deviceCode,grant_type:`urn:ietf:params:oauth:grant-type:device_code`});for(;Date.now()<e.expiresAt;){let n=await fetch(`https://github.com/login/oauth/access_token`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/x-www-form-urlencoded`},body:t});if(!n.ok)throw Error(`GitHub device token failed: HTTP ${n.status}`);let r=v(await n.json());if(`access_token`in r&&typeof r.access_token==`string`)return r.access_token;let i=`error`in r?r.error:`unknown`;if(i===`authorization_pending`){await new Promise(t=>setTimeout(t,e.intervalMs));continue}if(i===`slow_down`){await new Promise(t=>setTimeout(t,e.intervalMs+2e3));continue}throw i===`expired_token`?Error(`GitHub device code expired; run login again`):i===`access_denied`?Error(`GitHub login cancelled`):Error(`GitHub device flow error: ${i}`)}throw Error(`GitHub device code expired; run login again`)}async function x(e,r){if(!process.stdin.isTTY)throw Error(`github-copilot login requires an interactive TTY.`);p(o(`GitHub Copilot login`));let i=e.profileId?.trim()||`github-copilot:github`;n(void 0,{allowKeychainPrompt:!1}).profiles[i]&&!e.yes&&m(`Auth profile already exists: ${i}\nRe-running will overwrite it.`,o(`Existing credentials`));let a=g();a.start(`Requesting device code from GitHub...`);let u=await y({scope:`read:user`});a.stop(`Device code ready`),m([`Visit: ${u.verification_uri}`,`Code: ${u.user_code}`].join(`
2
2
  `),o(`Authorize`));let d=Date.now()+u.expires_in*1e3,f=Math.max(1e3,u.interval*1e3),_=g();_.start(`Waiting for GitHub authorization...`);let v=await b({deviceCode:u.device_code,intervalMs:f,expiresAt:d});_.stop(`GitHub access token acquired`),t({profileId:i,credential:{type:`token`,provider:`github-copilot`,token:v}}),await s(e=>c(e,{provider:`github-copilot`,profileId:i,mode:`token`})),l(r),r.log(`Auth profile: ${i} (github-copilot/token)`),h(`Done`)}const S=e(`plugins`);function C(e){return a({config:e.config,workspaceDir:e.workspaceDir,logger:i(S)}).providers.map(e=>e.provider)}const w=e=>e.trim().length>0?void 0:`Required`;function T(e){let t=e.manualPromptMessage??`Paste the redirect URL`,n;return{onAuth:async({url:r})=>{if(e.isRemote){e.spin.stop(`OAuth URL ready`),e.runtime.log(`\nOpen this URL in your LOCAL browser:\n\n${r}\n`),n=e.prompter.text({message:t,validate:w}).then(e=>String(e));return}e.spin.update(e.localBrowserMessage),await e.openUrl(r),e.runtime.log(`Open: ${r}`)},onPrompt:async t=>{if(n)return n;let r=await e.prompter.text({message:t.message,placeholder:t.placeholder,validate:w});return String(r)}}}async function E(e){let{prompter:t,runtime:n,isRemote:r,openUrl:i,localBrowserMessage:a}=e,o=await u();if(!o.ok&&o.kind===`tls-cert`){let e=d(o);throw n.error(e),await t.note(e,`OAuth prerequisites`),Error(o.message)}await t.note(r?[`You are running in a remote/VPS environment.`,`A URL will be shown for you to open in your LOCAL browser.`,`After signing in, paste the redirect URL back here.`].join(`
3
3
  `):[`Browser will open for OpenAI authentication.`,`If the callback doesn't auto-complete, paste the redirect URL.`,`OpenAI OAuth uses localhost:1455 for the callback.`].join(`
4
4
  `),`OpenAI Codex OAuth`);let s=t.progress(`Starting OAuth flow…`);try{let{onAuth:e,onPrompt:o}=T({isRemote:r,prompter:t,runtime:n,spin:s,openUrl:i,localBrowserMessage:a??`Complete sign-in in browser…`}),c=await f({onAuth:e,onPrompt:o,onProgress:e=>s.update(e)});return s.stop(`OpenAI OAuth complete`),c??null}catch(e){throw s.stop(`OpenAI OAuth failed`),n.error(String(e)),await t.note(`Trouble with OAuth? See https://docs.openclaw.ai/start/faq`,`OAuth help`),e}}function D(e,t){let n=t?.trim();if(!n)return null;let i=r(n);return e.find(e=>r(e.id)===i)??e.find(e=>e.aliases?.some(e=>r(e)===i)??!1)??null}function O(e,t){let n=t?.trim();if(!n)return null;let r=n.toLowerCase();return e.auth.find(e=>e.id.toLowerCase()===r)??e.auth.find(e=>e.label.toLowerCase()===r)??null}function k(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}function A(e,t){if(!k(e)||!k(t))return t;let n={...e};for(let[e,r]of Object.entries(t)){let t=n[e];k(t)&&k(r)?n[e]=A(t,r):n[e]=r}return n}function j(e,t){let n={...e.agents?.defaults?.models};n[t]=n[t]??{};let r=e.agents?.defaults?.model;return{...e,agents:{...e.agents,defaults:{...e.agents?.defaults,models:n,model:{...r&&typeof r==`object`&&`fallbacks`in r?{fallbacks:r.fallbacks}:void 0,primary:t}}}}}export{E as a,x as c,D as i,A as n,T as o,O as r,C as s,j as t};
@@ -1,2 +1,2 @@
1
- import{g as e}from"./paths-B4IRk3wi.js";import{b as t,s as n,t as r}from"./subsystem-C5XF2Fy5.js";import{Ai as i,Mi as a,ji as o,qt as s}from"./model-selection-BLbnMb5E.js";import{C as c}from"./reply-DwfVhea1.js";import{E as l}from"./session-key-D3P0tf5P.js";import{n as u,t as d}from"./redact-3_CiXMY6.js";import f from"node:path";import p from"chalk";import m from"node:fs/promises";import{createHash as h,createPrivateKey as g,sign as _}from"node:crypto";import v from"node:http2";let y=`auto`;function b(e){y=e}function x(){return y}const S=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,C={mode:`tools`,patterns:d()},w=new Map;let T;const E=new Map,D=new Map,O=r(`gateway/ws`),ee=new Set([`connId`,`id`,`method`,`ok`,`event`]);function k(e){let t=[];if(!e)return t;for(let[n,r]of Object.entries(e))r!==void 0&&(ee.has(n)||t.push(`${p.dim(n)}=${P(r)}`));return t}function A(e){if((e.kind===`req`||e.kind===`res`)&&e.method)return p.bold(e.method);if(e.kind===`event`&&e.event)return p.bold(e.event)}function j(e,t){if(!(e!==`res`||t===void 0))return t?p.greenBright(`✓`):p.redBright(`✗`)}function M(e){let t=[e.prefix,e.statusToken,e.headline,e.durationToken,...e.restMeta,...e.trailing].filter(e=>!!e);O.info(t.join(` `))}function te(){return n(`gateway/ws`)}function N(e){let t=e.trim();return S.test(t)?`${t.slice(0,8)}…${t.slice(-4)}`:t.length<=24?t:`${t.slice(0,12)}…${t.slice(-4)}`}function P(e){try{if(e instanceof Error){let t=[];e.name&&t.push(e.name),e.message&&t.push(e.message);let n=`code`in e&&(typeof e.code==`string`||typeof e.code==`number`)?String(e.code):``;n&&t.push(`code=${n}`);let r=t.filter(Boolean).join(`: `).trim();if(r)return r.length>240?`${r.slice(0,240)}...`:r}if(e&&typeof e==`object`){let t=e;if(typeof t.message==`string`&&t.message.trim()){let e=typeof t.name==`string`?t.name.trim():``,n=typeof t.code==`string`||typeof t.code==`number`?String(t.code):``,r=[e,t.message.trim()].filter(Boolean);n&&r.push(`code=${n}`);let i=r.join(`: `).trim();return i.length>240?`${i.slice(0,240)}...`:i}}let t=typeof e==`string`||typeof e==`number`?String(e):JSON.stringify(e);if(!t)return``;let n=u(t,C);return n.length>240?`${n.slice(0,240)}...`:n}catch{return String(e)}}function F(e,t=160){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,Math.max(0,t-1))}…`}function I(e){if(!e||typeof e!=`object`)return{};let t=e,n=typeof t.runId==`string`?t.runId:void 0,r=typeof t.stream==`string`?t.stream:void 0,i=typeof t.seq==`number`?t.seq:void 0,a=typeof t.sessionKey==`string`?t.sessionKey:void 0,o=t.data&&typeof t.data==`object`?t.data:void 0,s={};if(n&&(s.run=N(n)),a){let e=l(a);e?(s.agent=e.agentId,s.session=e.rest):s.session=a}if(r&&(s.stream=r),i!==void 0&&(s.aseq=i),!o)return s;if(r===`assistant`){let e=typeof o.text==`string`?o.text:void 0;e?.trim()&&(s.text=F(e));let t=Array.isArray(o.mediaUrls)?o.mediaUrls:void 0;return t&&t.length>0&&(s.media=t.length),s}if(r===`tool`){let e=typeof o.phase==`string`?o.phase:void 0,t=typeof o.name==`string`?o.name:void 0;(e||t)&&(s.tool=`${e??`?`}:${t??`?`}`);let n=typeof o.toolCallId==`string`?o.toolCallId:void 0;n&&(s.call=N(n));let r=typeof o.meta==`string`?o.meta:void 0;return r?.trim()&&(s.meta=r),typeof o.isError==`boolean`&&(s.err=o.isError),s}if(r===`lifecycle`){let e=typeof o.phase==`string`?o.phase:void 0;e&&(s.phase=e),typeof o.aborted==`boolean`&&(s.aborted=o.aborted);let t=typeof o.error==`string`?o.error:void 0;return t?.trim()&&(s.error=F(t,120)),s}let c=typeof o.reason==`string`?o.reason:void 0;return c?.trim()&&(s.reason=c),s}function L(e,r,i){if(!n(`gateway/ws`))return;let a=x();if(!t()){ne(e,r,i);return}if(a===`compact`||a===`auto`){re(e,r,i);return}let o=Date.now(),s=typeof i?.connId==`string`?i.connId:void 0,c=typeof i?.id==`string`?i.id:void 0,l=typeof i?.method==`string`?i.method:void 0,u=typeof i?.ok==`boolean`?i.ok:void 0,d=typeof i?.event==`string`?i.event:void 0,f=s&&c?`${s}:${c}`:void 0;e===`in`&&r===`req`&&f&&D.set(f,o);let m=e===`out`&&r===`res`&&f?(()=>{let e=D.get(f);if(e!==void 0)return D.delete(f),o-e})():void 0,h=e===`in`?`←`:`→`,g=`${(e===`in`?p.greenBright:p.cyanBright)(h)} ${p.bold(r)}`,_=A({kind:r,method:l,event:d}),v=j(r,u),y=typeof m==`number`?p.dim(`${m}ms`):void 0,b=k(i),S=[];s&&S.push(`${p.dim(`conn`)}=${p.gray(N(s))}`),c&&S.push(`${p.dim(`id`)}=${p.gray(N(c))}`),M({prefix:g,statusToken:v,headline:_,durationToken:y,restMeta:b,trailing:S})}function ne(e,t,n){let r=typeof n?.connId==`string`?n.connId:void 0,i=typeof n?.id==`string`?n.id:void 0,a=typeof n?.ok==`boolean`?n.ok:void 0,o=typeof n?.method==`string`?n.method:void 0,s=r&&i?`${r}:${i}`:void 0;if(e===`in`&&t===`req`&&s){E.set(s,Date.now()),E.size>2e3&&E.clear();return}if(t===`parse-error`){let e=typeof n?.error==`string`?P(n.error):void 0;O.warn([`${p.redBright(`✗`)} ${p.bold(`parse-error`)}`,e?`${p.dim(`error`)}=${e}`:void 0,`${p.dim(`conn`)}=${p.gray(N(r??`?`))}`].filter(e=>!!e).join(` `));return}if(e!==`out`||t!==`res`)return;let c=s?E.get(s):void 0;s&&E.delete(s);let l=typeof c==`number`?Date.now()-c:void 0;if(!(a===!1||typeof l==`number`&&l>=50))return;let u=j(`res`,a),d=typeof l==`number`?p.dim(`${l}ms`):void 0,f=k(n);M({prefix:`${p.yellowBright(`⇄`)} ${p.bold(`res`)}`,statusToken:u,headline:o?p.bold(o):void 0,durationToken:d,restMeta:f,trailing:[r?`${p.dim(`conn`)}=${p.gray(N(r))}`:``,i?`${p.dim(`id`)}=${p.gray(N(i))}`:``].filter(Boolean)})}function re(e,t,n){let r=Date.now(),i=typeof n?.connId==`string`?n.connId:void 0,a=typeof n?.id==`string`?n.id:void 0,o=typeof n?.method==`string`?n.method:void 0,s=typeof n?.ok==`boolean`?n.ok:void 0,c=i&&a?`${i}:${a}`:void 0;if(t===`req`&&e===`in`&&c){w.set(c,{ts:r,method:o,meta:n});return}let l=t===`req`||t===`res`?`⇄`:e===`in`?`←`:`→`,u=`${(t===`req`||t===`res`?p.yellowBright:e===`in`?p.greenBright:p.cyanBright)(l)} ${p.bold(t)}`,d=j(t,s),f=t===`res`&&e===`out`&&c?w.get(c)?.ts:void 0;t===`res`&&e===`out`&&c&&w.delete(c);let m=typeof f==`number`?p.dim(`${r-f}ms`):void 0,h=A({kind:t,method:o,event:typeof n?.event==`string`?n.event:void 0}),g=k(n),_=[];i&&i!==T&&(_.push(`${p.dim(`conn`)}=${p.gray(N(i))}`),T=i),a&&_.push(`${p.dim(`id`)}=${p.gray(N(a))}`),M({prefix:u,statusToken:d,headline:h,durationToken:m,restMeta:g,trailing:_})}function R(e){if(e)return e.split(`;`)[0]?.trim().toLowerCase()||void 0}function z(e){return typeof e==`string`&&e.startsWith(`image/`)}function ie(e){return e.length>0&&e.length%4==0&&/^[A-Za-z0-9+/]+={0,2}$/.test(e)}function ae(e,t,n){let r=e.mimeType??``,i=e.content,a=e.fileName||e.type||`attachment-${t+1}`;if(typeof i!=`string`)throw Error(`attachment ${a}: content must be base64 string`);if(n.requireImageMime&&!r.startsWith(`image/`))throw Error(`attachment ${a}: only image/* supported`);let o=i.trim();if(n.stripDataUrlPrefix){let e=/^data:[^;]+;base64,(.*)$/.exec(o);e&&(o=e[1])}return{label:a,mime:r,base64:o}}function oe(e,t){if(!ie(e.base64))throw Error(`attachment ${e.label}: invalid base64 content`);let n=s(e.base64);if(n<=0||n>t.maxBytes)throw Error(`attachment ${e.label}: exceeds size limit (${n} > ${t.maxBytes} bytes)`);return n}async function se(e,t,n){let r=n?.maxBytes??5e6,i=n?.log;if(!t||t.length===0)return{message:e,images:[]};let a=[];for(let[e,n]of t.entries()){if(!n)continue;let t=ae(n,e,{stripDataUrlPrefix:!0,requireImageMime:!1});oe(t,{maxBytes:r});let{base64:o,label:s,mime:l}=t,u=R(l),d=R(await c(o));if(d&&!z(d)){i?.warn(`attachment ${s}: detected non-image (${d}), dropping`);continue}if(!d&&!z(u)){i?.warn(`attachment ${s}: unable to detect image mime type, dropping`);continue}d&&u&&d!==u&&i?.warn(`attachment ${s}: mime mismatch (${u} -> ${d}), using sniffed`),a.push({type:`image`,data:o,mimeType:d??u??l})}return{message:e,images:a}}function ce(e){return e?.map(e=>({type:typeof e?.type==`string`?e.type:void 0,mimeType:typeof e?.mimeType==`string`?e.mimeType:void 0,fileName:typeof e?.fileName==`string`?e.fileName:void 0,content:typeof e?.content==`string`?e.content:ArrayBuffer.isView(e?.content)?Buffer.from(e.content.buffer,e.content.byteOffset,e.content.byteLength).toString(`base64`):e?.content instanceof ArrayBuffer?Buffer.from(e.content).toString(`base64`):void 0})).filter(e=>e.content)??[]}const le=i();let B=null;function V(t){let n=t??e();return f.join(n,`push/apns-registrations.json`)}function H(e){return e.trim()}function U(e){return e.trim().replace(/[<>\s]/g,``).toLowerCase()}function W(e){return e.trim()}function G(e){return/^[0-9a-f]{32,}$/i.test(e)}function ue(e){let t=e.trim();if(t)try{let e=JSON.parse(t);return typeof e.reason==`string`&&e.reason.trim().length>0?e.reason.trim():t.slice(0,200)}catch{return t.slice(0,200)}}function K(e){return Buffer.from(e).toString(`base64`).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function q(e){return K(Buffer.from(JSON.stringify(e)))}function de(e){let t=h(`sha256`).update(e.privateKey).digest(`hex`);return`${e.teamId}:${e.keyId}:${t}`}function fe(e,t=Date.now()){let n=de(e);if(B&&B.cacheKey===n&&t<B.expiresAtMs)return B.token;let r=Math.floor(t/1e3),i=`${q({alg:`ES256`,kid:e.keyId,typ:`JWT`})}.${q({iss:e.teamId,iat:r})}`,a=`${i}.${K(_(`sha256`,Buffer.from(i,`utf8`),{key:g(e.privateKey),dsaEncoding:`ieee-p1363`}))}`;return B={cacheKey:n,token:a,expiresAtMs:t+3e6},a}function J(e){return e.trim().replace(/\\n/g,`
1
+ import{g as e}from"./paths-B4IRk3wi.js";import{b as t,s as n,t as r}from"./subsystem-C5XF2Fy5.js";import{Ai as i,Mi as a,ji as o,qt as s}from"./model-selection-BLbnMb5E.js";import{C as c}from"./reply-mWIMy_ju.js";import{E as l}from"./session-key-D3P0tf5P.js";import{n as u,t as d}from"./redact-3_CiXMY6.js";import f from"node:path";import p from"chalk";import m from"node:fs/promises";import{createHash as h,createPrivateKey as g,sign as _}from"node:crypto";import v from"node:http2";let y=`auto`;function b(e){y=e}function x(){return y}const S=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,C={mode:`tools`,patterns:d()},w=new Map;let T;const E=new Map,D=new Map,O=r(`gateway/ws`),ee=new Set([`connId`,`id`,`method`,`ok`,`event`]);function k(e){let t=[];if(!e)return t;for(let[n,r]of Object.entries(e))r!==void 0&&(ee.has(n)||t.push(`${p.dim(n)}=${P(r)}`));return t}function A(e){if((e.kind===`req`||e.kind===`res`)&&e.method)return p.bold(e.method);if(e.kind===`event`&&e.event)return p.bold(e.event)}function j(e,t){if(!(e!==`res`||t===void 0))return t?p.greenBright(`✓`):p.redBright(`✗`)}function M(e){let t=[e.prefix,e.statusToken,e.headline,e.durationToken,...e.restMeta,...e.trailing].filter(e=>!!e);O.info(t.join(` `))}function te(){return n(`gateway/ws`)}function N(e){let t=e.trim();return S.test(t)?`${t.slice(0,8)}…${t.slice(-4)}`:t.length<=24?t:`${t.slice(0,12)}…${t.slice(-4)}`}function P(e){try{if(e instanceof Error){let t=[];e.name&&t.push(e.name),e.message&&t.push(e.message);let n=`code`in e&&(typeof e.code==`string`||typeof e.code==`number`)?String(e.code):``;n&&t.push(`code=${n}`);let r=t.filter(Boolean).join(`: `).trim();if(r)return r.length>240?`${r.slice(0,240)}...`:r}if(e&&typeof e==`object`){let t=e;if(typeof t.message==`string`&&t.message.trim()){let e=typeof t.name==`string`?t.name.trim():``,n=typeof t.code==`string`||typeof t.code==`number`?String(t.code):``,r=[e,t.message.trim()].filter(Boolean);n&&r.push(`code=${n}`);let i=r.join(`: `).trim();return i.length>240?`${i.slice(0,240)}...`:i}}let t=typeof e==`string`||typeof e==`number`?String(e):JSON.stringify(e);if(!t)return``;let n=u(t,C);return n.length>240?`${n.slice(0,240)}...`:n}catch{return String(e)}}function F(e,t=160){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,Math.max(0,t-1))}…`}function I(e){if(!e||typeof e!=`object`)return{};let t=e,n=typeof t.runId==`string`?t.runId:void 0,r=typeof t.stream==`string`?t.stream:void 0,i=typeof t.seq==`number`?t.seq:void 0,a=typeof t.sessionKey==`string`?t.sessionKey:void 0,o=t.data&&typeof t.data==`object`?t.data:void 0,s={};if(n&&(s.run=N(n)),a){let e=l(a);e?(s.agent=e.agentId,s.session=e.rest):s.session=a}if(r&&(s.stream=r),i!==void 0&&(s.aseq=i),!o)return s;if(r===`assistant`){let e=typeof o.text==`string`?o.text:void 0;e?.trim()&&(s.text=F(e));let t=Array.isArray(o.mediaUrls)?o.mediaUrls:void 0;return t&&t.length>0&&(s.media=t.length),s}if(r===`tool`){let e=typeof o.phase==`string`?o.phase:void 0,t=typeof o.name==`string`?o.name:void 0;(e||t)&&(s.tool=`${e??`?`}:${t??`?`}`);let n=typeof o.toolCallId==`string`?o.toolCallId:void 0;n&&(s.call=N(n));let r=typeof o.meta==`string`?o.meta:void 0;return r?.trim()&&(s.meta=r),typeof o.isError==`boolean`&&(s.err=o.isError),s}if(r===`lifecycle`){let e=typeof o.phase==`string`?o.phase:void 0;e&&(s.phase=e),typeof o.aborted==`boolean`&&(s.aborted=o.aborted);let t=typeof o.error==`string`?o.error:void 0;return t?.trim()&&(s.error=F(t,120)),s}let c=typeof o.reason==`string`?o.reason:void 0;return c?.trim()&&(s.reason=c),s}function L(e,r,i){if(!n(`gateway/ws`))return;let a=x();if(!t()){ne(e,r,i);return}if(a===`compact`||a===`auto`){re(e,r,i);return}let o=Date.now(),s=typeof i?.connId==`string`?i.connId:void 0,c=typeof i?.id==`string`?i.id:void 0,l=typeof i?.method==`string`?i.method:void 0,u=typeof i?.ok==`boolean`?i.ok:void 0,d=typeof i?.event==`string`?i.event:void 0,f=s&&c?`${s}:${c}`:void 0;e===`in`&&r===`req`&&f&&D.set(f,o);let m=e===`out`&&r===`res`&&f?(()=>{let e=D.get(f);if(e!==void 0)return D.delete(f),o-e})():void 0,h=e===`in`?`←`:`→`,g=`${(e===`in`?p.greenBright:p.cyanBright)(h)} ${p.bold(r)}`,_=A({kind:r,method:l,event:d}),v=j(r,u),y=typeof m==`number`?p.dim(`${m}ms`):void 0,b=k(i),S=[];s&&S.push(`${p.dim(`conn`)}=${p.gray(N(s))}`),c&&S.push(`${p.dim(`id`)}=${p.gray(N(c))}`),M({prefix:g,statusToken:v,headline:_,durationToken:y,restMeta:b,trailing:S})}function ne(e,t,n){let r=typeof n?.connId==`string`?n.connId:void 0,i=typeof n?.id==`string`?n.id:void 0,a=typeof n?.ok==`boolean`?n.ok:void 0,o=typeof n?.method==`string`?n.method:void 0,s=r&&i?`${r}:${i}`:void 0;if(e===`in`&&t===`req`&&s){E.set(s,Date.now()),E.size>2e3&&E.clear();return}if(t===`parse-error`){let e=typeof n?.error==`string`?P(n.error):void 0;O.warn([`${p.redBright(`✗`)} ${p.bold(`parse-error`)}`,e?`${p.dim(`error`)}=${e}`:void 0,`${p.dim(`conn`)}=${p.gray(N(r??`?`))}`].filter(e=>!!e).join(` `));return}if(e!==`out`||t!==`res`)return;let c=s?E.get(s):void 0;s&&E.delete(s);let l=typeof c==`number`?Date.now()-c:void 0;if(!(a===!1||typeof l==`number`&&l>=50))return;let u=j(`res`,a),d=typeof l==`number`?p.dim(`${l}ms`):void 0,f=k(n);M({prefix:`${p.yellowBright(`⇄`)} ${p.bold(`res`)}`,statusToken:u,headline:o?p.bold(o):void 0,durationToken:d,restMeta:f,trailing:[r?`${p.dim(`conn`)}=${p.gray(N(r))}`:``,i?`${p.dim(`id`)}=${p.gray(N(i))}`:``].filter(Boolean)})}function re(e,t,n){let r=Date.now(),i=typeof n?.connId==`string`?n.connId:void 0,a=typeof n?.id==`string`?n.id:void 0,o=typeof n?.method==`string`?n.method:void 0,s=typeof n?.ok==`boolean`?n.ok:void 0,c=i&&a?`${i}:${a}`:void 0;if(t===`req`&&e===`in`&&c){w.set(c,{ts:r,method:o,meta:n});return}let l=t===`req`||t===`res`?`⇄`:e===`in`?`←`:`→`,u=`${(t===`req`||t===`res`?p.yellowBright:e===`in`?p.greenBright:p.cyanBright)(l)} ${p.bold(t)}`,d=j(t,s),f=t===`res`&&e===`out`&&c?w.get(c)?.ts:void 0;t===`res`&&e===`out`&&c&&w.delete(c);let m=typeof f==`number`?p.dim(`${r-f}ms`):void 0,h=A({kind:t,method:o,event:typeof n?.event==`string`?n.event:void 0}),g=k(n),_=[];i&&i!==T&&(_.push(`${p.dim(`conn`)}=${p.gray(N(i))}`),T=i),a&&_.push(`${p.dim(`id`)}=${p.gray(N(a))}`),M({prefix:u,statusToken:d,headline:h,durationToken:m,restMeta:g,trailing:_})}function R(e){if(e)return e.split(`;`)[0]?.trim().toLowerCase()||void 0}function z(e){return typeof e==`string`&&e.startsWith(`image/`)}function ie(e){return e.length>0&&e.length%4==0&&/^[A-Za-z0-9+/]+={0,2}$/.test(e)}function ae(e,t,n){let r=e.mimeType??``,i=e.content,a=e.fileName||e.type||`attachment-${t+1}`;if(typeof i!=`string`)throw Error(`attachment ${a}: content must be base64 string`);if(n.requireImageMime&&!r.startsWith(`image/`))throw Error(`attachment ${a}: only image/* supported`);let o=i.trim();if(n.stripDataUrlPrefix){let e=/^data:[^;]+;base64,(.*)$/.exec(o);e&&(o=e[1])}return{label:a,mime:r,base64:o}}function oe(e,t){if(!ie(e.base64))throw Error(`attachment ${e.label}: invalid base64 content`);let n=s(e.base64);if(n<=0||n>t.maxBytes)throw Error(`attachment ${e.label}: exceeds size limit (${n} > ${t.maxBytes} bytes)`);return n}async function se(e,t,n){let r=n?.maxBytes??5e6,i=n?.log;if(!t||t.length===0)return{message:e,images:[]};let a=[];for(let[e,n]of t.entries()){if(!n)continue;let t=ae(n,e,{stripDataUrlPrefix:!0,requireImageMime:!1});oe(t,{maxBytes:r});let{base64:o,label:s,mime:l}=t,u=R(l),d=R(await c(o));if(d&&!z(d)){i?.warn(`attachment ${s}: detected non-image (${d}), dropping`);continue}if(!d&&!z(u)){i?.warn(`attachment ${s}: unable to detect image mime type, dropping`);continue}d&&u&&d!==u&&i?.warn(`attachment ${s}: mime mismatch (${u} -> ${d}), using sniffed`),a.push({type:`image`,data:o,mimeType:d??u??l})}return{message:e,images:a}}function ce(e){return e?.map(e=>({type:typeof e?.type==`string`?e.type:void 0,mimeType:typeof e?.mimeType==`string`?e.mimeType:void 0,fileName:typeof e?.fileName==`string`?e.fileName:void 0,content:typeof e?.content==`string`?e.content:ArrayBuffer.isView(e?.content)?Buffer.from(e.content.buffer,e.content.byteOffset,e.content.byteLength).toString(`base64`):e?.content instanceof ArrayBuffer?Buffer.from(e.content).toString(`base64`):void 0})).filter(e=>e.content)??[]}const le=i();let B=null;function V(t){let n=t??e();return f.join(n,`push/apns-registrations.json`)}function H(e){return e.trim()}function U(e){return e.trim().replace(/[<>\s]/g,``).toLowerCase()}function W(e){return e.trim()}function G(e){return/^[0-9a-f]{32,}$/i.test(e)}function ue(e){let t=e.trim();if(t)try{let e=JSON.parse(t);return typeof e.reason==`string`&&e.reason.trim().length>0?e.reason.trim():t.slice(0,200)}catch{return t.slice(0,200)}}function K(e){return Buffer.from(e).toString(`base64`).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}function q(e){return K(Buffer.from(JSON.stringify(e)))}function de(e){let t=h(`sha256`).update(e.privateKey).digest(`hex`);return`${e.teamId}:${e.keyId}:${t}`}function fe(e,t=Date.now()){let n=de(e);if(B&&B.cacheKey===n&&t<B.expiresAtMs)return B.token;let r=Math.floor(t/1e3),i=`${q({alg:`ES256`,kid:e.keyId,typ:`JWT`})}.${q({iss:e.teamId,iat:r})}`,a=`${i}.${K(_(`sha256`,Buffer.from(i,`utf8`),{key:g(e.privateKey),dsaEncoding:`ieee-p1363`}))}`;return B={cacheKey:n,token:a,expiresAtMs:t+3e6},a}function J(e){return e.trim().replace(/\\n/g,`
2
2
  `)}function Y(e){let t=e?.trim()??``;return t.length>0?t:null}async function X(e){let t=await o(V(e));return!t||typeof t!=`object`?{registrationsByNodeId:{}}:{registrationsByNodeId:t.registrationsByNodeId&&typeof t.registrationsByNodeId==`object`&&!Array.isArray(t.registrationsByNodeId)?t.registrationsByNodeId:{}}}async function pe(e,t){await a(V(t),e)}function Z(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();return t===`sandbox`||t===`production`?t:null}async function me(e){let t=H(e.nodeId),n=U(e.token),r=W(e.topic),i=Z(e.environment)??`sandbox`;if(!t)throw Error(`nodeId required`);if(!r)throw Error(`topic required`);if(!G(n))throw Error(`invalid APNs token`);return await le(async()=>{let a=await X(e.baseDir),o={nodeId:t,token:n,topic:r,environment:i,updatedAtMs:Date.now()};return a.registrationsByNodeId[t]=o,await pe(a,e.baseDir),o})}async function he(e,t){let n=H(e);return n?(await X(t)).registrationsByNodeId[n]??null:null}async function ge(e=process.env){let t=Y(e.OPENCLAW_APNS_TEAM_ID),n=Y(e.OPENCLAW_APNS_KEY_ID);if(!t||!n)return{ok:!1,error:`APNs auth missing: set OPENCLAW_APNS_TEAM_ID and OPENCLAW_APNS_KEY_ID`};let r=Y(e.OPENCLAW_APNS_PRIVATE_KEY_P8)??Y(e.OPENCLAW_APNS_PRIVATE_KEY);if(r)return{ok:!0,value:{teamId:t,keyId:n,privateKey:J(r)}};let i=Y(e.OPENCLAW_APNS_PRIVATE_KEY_PATH);if(!i)return{ok:!1,error:`APNs private key missing: set OPENCLAW_APNS_PRIVATE_KEY_P8 or OPENCLAW_APNS_PRIVATE_KEY_PATH`};try{return{ok:!0,value:{teamId:t,keyId:n,privateKey:J(await m.readFile(i,`utf8`))}}}catch(e){return{ok:!1,error:`failed reading OPENCLAW_APNS_PRIVATE_KEY_PATH (${i}): ${e instanceof Error?e.message:String(e)}`}}}async function _e(e){let t=e.environment===`production`?`https://api.push.apple.com`:`https://api.sandbox.push.apple.com`,n=JSON.stringify(e.payload),r=`/3/device/${e.token}`;return await new Promise((i,a)=>{let o=v.connect(t),s=!1,c=e=>{s||(s=!0,o.destroy(),a(e))},l=e=>{s||(s=!0,o.close(),i(e))};o.once(`error`,e=>c(e));let u=o.request({":method":`POST`,":path":r,authorization:`bearer ${e.bearerToken}`,"apns-topic":e.topic,"apns-push-type":e.pushType,"apns-priority":e.priority,"apns-expiration":`0`,"content-type":`application/json`,"content-length":Buffer.byteLength(n).toString()}),d=0,f,p=``;u.setEncoding(`utf8`),u.setTimeout(e.timeoutMs,()=>{u.close(v.constants.NGHTTP2_CANCEL),c(Error(`APNs request timed out after ${e.timeoutMs}ms`))}),u.on(`response`,e=>{let t=e[`:status`];d=typeof t==`number`?t:Number(t??0);let n=e[`apns-id`];typeof n==`string`&&n.trim().length>0&&(f=n.trim())}),u.on(`data`,e=>{typeof e==`string`&&(p+=e)}),u.on(`end`,()=>{l({status:d,apnsId:f,body:p})}),u.on(`error`,e=>c(e)),u.end(n)})}function ve(e){return typeof e==`number`&&Number.isFinite(e)?Math.max(1e3,Math.trunc(e)):1e4}function ye(e){let t=U(e.registration.token);if(!G(t))throw Error(`invalid APNs token`);let n=W(e.registration.topic);if(!n)throw Error(`topic required`);return{token:t,topic:n,environment:e.registration.environment,bearerToken:fe(e.auth)}}function be(e){return{ok:e.response.status===200,status:e.response.status,apnsId:e.response.apnsId,reason:ue(e.response.body),tokenSuffix:e.token.slice(-8),topic:e.topic,environment:e.environment}}function Q(e){return{kind:e.kind,nodeId:e.nodeId,ts:Date.now(),...e.reason?{reason:e.reason}:{}}}async function $(e){let{token:t,topic:n,environment:r,bearerToken:i}=ye({auth:e.auth,registration:e.registration});return be({response:await(e.requestSender??_e)({token:t,topic:n,environment:r,bearerToken:i,payload:e.payload,timeoutMs:ve(e.timeoutMs),pushType:e.pushType,priority:e.priority}),token:t,topic:n,environment:r})}async function xe(e){let t={aps:{alert:{title:e.title,body:e.body},sound:`default`},openclaw:Q({kind:`push.test`,nodeId:e.nodeId})};return await $({auth:e.auth,registration:e.registration,payload:t,timeoutMs:e.timeoutMs,requestSender:e.requestSender,pushType:`alert`,priority:`10`})}async function Se(e){let t={aps:{"content-available":1},openclaw:Q({kind:`node.wake`,reason:e.wakeReason??`node.invoke`,nodeId:e.nodeId})};return await $({auth:e.auth,registration:e.registration,payload:t,timeoutMs:e.timeoutMs,requestSender:e.requestSender,pushType:`background`,priority:`5`})}export{xe as a,se as c,te as d,I as f,ge as i,P as l,Z as n,Se as o,b as p,me as r,ce as s,he as t,L as u};