@seanhogg/builderforce-agents 2026.9.5 → 2026.9.6

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 (205) hide show
  1. package/dist/{agent-CBRDuLO-.js → agent-59_cdTZl.js} +1 -1
  2. package/dist/{agent-CCY1r5YW.js → agent-CvMM49lm.js} +1 -1
  3. package/dist/{agents-DW3hte-y.js → agents-2d7A-Uwz.js} +1 -1
  4. package/dist/{agents-Ce4bN10e.js → agents-BdOgv61S.js} +1 -1
  5. package/dist/{audio-preflight-BvzGdNYy.js → audio-preflight-CmX2XJ3N.js} +1 -1
  6. package/dist/{audio-preflight-BYMboYmW.js → audio-preflight-Dnw3oDJr.js} +1 -1
  7. package/dist/{audio-preflight-CEOxJosQ.js → audio-preflight-HcRdB0oH.js} +1 -1
  8. package/dist/{audio-preflight-CswNxppe.js → audio-preflight-Sh649dxR.js} +1 -1
  9. package/dist/{auth-choice-DSLN0TLU.js → auth-choice-D06_TWBf.js} +1 -1
  10. package/dist/{auth-choice-BTrUlYmE.js → auth-choice-DyxxR025.js} +1 -1
  11. package/dist/{auth-choice.apply-BZ7E08Yb.js → auth-choice.apply-CUuLdlQd.js} +1 -1
  12. package/dist/{auth-choice.apply-D3EY1pZ3.js → auth-choice.apply-CfFhu_Vk.js} +1 -1
  13. package/dist/{auth-choice.apply-5dpCNO0l.js → auth-choice.apply-D57XA_d9.js} +1 -1
  14. package/dist/{auth-choice.apply-3tPFL-eH.js → auth-choice.apply-s_rOXFVz.js} +1 -1
  15. package/dist/{auth-choice.apply.transformers-B_Q6e8Yk.js → auth-choice.apply.transformers-CqQSUnsx.js} +1 -1
  16. package/dist/{auth-choice.apply.transformers-D1EzC906.js → auth-choice.apply.transformers-DXBWOilg.js} +1 -1
  17. package/dist/{auth-choice.apply.transformers-BJbpyCWs.js → auth-choice.apply.transformers-DizfkAmz.js} +1 -1
  18. package/dist/{auth-choice.apply.transformers-vLzCo5ew.js → auth-choice.apply.transformers-vyvtAxcX.js} +1 -1
  19. package/dist/{banner-DVNoUX5I.js → banner-BXpp_pEd.js} +1 -1
  20. package/dist/build-info.json +3 -3
  21. package/dist/{builderforce-Bs_G8kBN.js → builderforce-BdJAOfvE.js} +2 -2
  22. package/dist/{builderforce-BN_So1di.js → builderforce-BrFUSx35.js} +2 -2
  23. package/dist/{builderforce-directory-sync-BCZK4FYJ.js → builderforce-directory-sync-CFiQew6N.js} +1 -1
  24. package/dist/{builderforce-directory-sync-DHfiUf2g.js → builderforce-directory-sync-DIQQT09l.js} +1 -1
  25. package/dist/{builderforce-onboarding-Bbjz8F-r.js → builderforce-onboarding-CoGJY95Q.js} +1 -1
  26. package/dist/{builderforce-onboarding-8lL2bgtL.js → builderforce-onboarding-DyYM_cib.js} +1 -1
  27. package/dist/{builderforcellm-syscheck-CyZiwcdF.js → builderforcellm-syscheck-CfFrfeV2.js} +1 -1
  28. package/dist/{builderforcellm-syscheck-DMjMJNFI.js → builderforcellm-syscheck-DGZKIwPC.js} +1 -1
  29. package/dist/bundled/boot-md/handler.js +1 -1
  30. package/dist/bundled/session-memory/handler.js +1 -1
  31. package/dist/{channel-options-Zk5QnNPR.js → channel-options--DZ4jYy9.js} +1 -1
  32. package/dist/{channel-options-Cbz6vcgo.js → channel-options-xVK4amr4.js} +1 -1
  33. package/dist/{channel-web-1xD-Ad2T.js → channel-web-9vO41fn2.js} +1 -1
  34. package/dist/{channels-cli-CiVlP8_q.js → channels-cli-Ch1sZ58k.js} +1 -1
  35. package/dist/{channels-cli-BOcpgY_W.js → channels-cli-YMSOJUmp.js} +1 -1
  36. package/dist/chrome-Bi-3xZj-.js +4 -0
  37. package/dist/chrome-C6oWWmHX.js +4 -0
  38. package/dist/{cli-6znoaKr2.js → cli-gsxv7DrZ.js} +1 -1
  39. package/dist/{cli-BPwpRE1j.js → cli-zC5qoRAp.js} +1 -1
  40. package/dist/{command-registry-BTxAGdlS.js → command-registry-BXLjR3kb.js} +1 -1
  41. package/dist/{command-registry-BZINHmI9.js → command-registry-I83E6HLw.js} +1 -1
  42. package/dist/{completion-cli-BwCfUaHz.js → completion-cli-BQCxFDqY.js} +1 -1
  43. package/dist/{completion-cli-vR4Sx9zB.js → completion-cli-CDy8f_Fg.js} +1 -1
  44. package/dist/{completion-cli-C8kMJ401.js → completion-cli-DbIxXK1B.js} +1 -1
  45. package/dist/{completion-cli-D8WkqtSU.js → completion-cli-ydxyAE7J.js} +1 -1
  46. package/dist/{config-cli-BYFA4Nin.js → config-cli-5ZSrACPR.js} +1 -1
  47. package/dist/{config-cli-DVpEv0oj.js → config-cli-BvJso6op.js} +1 -1
  48. package/dist/{configure-COeSbyyP.js → configure-1e4C38zp.js} +1 -1
  49. package/dist/{configure-CW2bJ91q.js → configure-B_oI_bg-.js} +1 -1
  50. package/dist/{configure-B_juJzVi.js → configure-Dp71zeJI.js} +1 -1
  51. package/dist/{configure-CgkUUUpM.js → configure-NxmuXXEd.js} +1 -1
  52. package/dist/{deliver-qM1Zkf4i.js → deliver-C6HTqnzY.js} +1 -1
  53. package/dist/{deliver-BNMupwo6.js → deliver-CdwCHH01.js} +1 -1
  54. package/dist/{deliver-Bs-FVPQ4.js → deliver-DFhj1d_t.js} +1 -1
  55. package/dist/{deliver-C5lVQcrs.js → deliver-XGIFv80r.js} +1 -1
  56. package/dist/{deps-DWFMK9Xg.js → deps-C4YVdrEi.js} +1 -1
  57. package/dist/{doctor-completion-s5vcMc-C.js → doctor-completion-DhIR9uqB.js} +1 -1
  58. package/dist/{doctor-completion-BdMxCat-.js → doctor-completion-Dpy-8HV9.js} +1 -1
  59. package/dist/{embedded-CRoX1qTh.js → embedded-Cw4g0mzl.js} +7 -7
  60. package/dist/{embedded-DpSS2q2a.js → embedded-DG3sEMyg.js} +7 -7
  61. package/dist/{embedded-helpers-BrfnCpCe.js → embedded-helpers-3FEGD_4b.js} +1 -1
  62. package/dist/{embedded-helpers-Q5h1lA6D.js → embedded-helpers-DGDYymYx.js} +1 -1
  63. package/dist/entry.js +1 -1
  64. package/dist/extensionAPI.js +1 -1
  65. package/dist/{gateway-cli-oSSOT67p.js → gateway-cli-BBu6KI7r.js} +4 -4
  66. package/dist/{gateway-cli-DzxNTkvL.js → gateway-cli-CSmbpS6n.js} +4 -4
  67. package/dist/{health-_L8Avf4v.js → health-AOM42u9C.js} +1 -1
  68. package/dist/{health-hXlukqbf.js → health-CRIXA8je.js} +1 -1
  69. package/dist/{health-B_qWRpsT.js → health-Cuh0tZl2.js} +1 -1
  70. package/dist/{hooks-cli-C-vbyL2y.js → hooks-cli-BeqvyPiX.js} +1 -1
  71. package/dist/{hooks-cli-7gBXRQ81.js → hooks-cli-CYI9ZvNI.js} +1 -1
  72. package/dist/index.js +2 -2
  73. package/dist/{ink-session-DpO3VOYc.js → ink-session-MNcfJzij.js} +1 -1
  74. package/dist/{ink-session-CZj35xTR.js → ink-session-VqYNJYzq.js} +1 -1
  75. package/dist/llm-slug-generator.js +1 -1
  76. package/dist/{mamba-state-engine-CFwb8DcP.js → mamba-state-engine-BYmUnYwn.js} +1 -1
  77. package/dist/{mamba-state-engine-Ck2JCfL6.js → mamba-state-engine-BloJzrxU.js} +1 -1
  78. package/dist/{models-PPv9KRbb.js → models-B6kkCBLd.js} +1 -1
  79. package/dist/{models-cli-btaamH96.js → models-cli-C7u8eLls.js} +1 -1
  80. package/dist/{models-cli-BUDSwmIY.js → models-cli-DpbpZwjy.js} +1 -1
  81. package/dist/{models-DMrs_Zsc.js → models-hEa3avo7.js} +1 -1
  82. package/dist/{onboard-4JByma4r.js → onboard-BHlI_UVY.js} +2 -2
  83. package/dist/{onboard-Dq_XQQXY.js → onboard-BW5J0Ym8.js} +2 -2
  84. package/dist/{onboard-channels-Dzyeem1L.js → onboard-channels-BkrhZ79I.js} +1 -1
  85. package/dist/{onboard-channels-D4g6xuSC.js → onboard-channels-DXIqdoto.js} +1 -1
  86. package/dist/{onboard-channels-Dir2EguP.js → onboard-channels-V51s9X-h.js} +1 -1
  87. package/dist/{onboard-channels-UZOCuxN7.js → onboard-channels-fyGQ1v4S.js} +1 -1
  88. package/dist/{onboard-interactive-DvNhkCNr.js → onboard-interactive-ClPMlCIl.js} +1 -1
  89. package/dist/{onboard-interactive-DyyEDd9a.js → onboard-interactive-D6IBBU8m.js} +1 -1
  90. package/dist/{onboard-interactive-CwNfYxGe.js → onboard-interactive-DEeqmoeW.js} +1 -1
  91. package/dist/{onboard-interactive-Co2bcd7g.js → onboard-interactive-DSZak3YX.js} +1 -1
  92. package/dist/{onboarding-DBL-H1Qu.js → onboarding-CYOfGpd5.js} +3 -3
  93. package/dist/{onboarding-CIxLpuFP.js → onboarding-DIxm_q7P.js} +3 -3
  94. package/dist/{onboarding.finalize-CGGbkAOL.js → onboarding.finalize-Co5L0rNp.js} +1 -1
  95. package/dist/{onboarding.finalize-R3TfibWY.js → onboarding.finalize-DAwpQa7n.js} +1 -1
  96. package/dist/{outbound-send-deps-CsJgGsii.js → outbound-send-deps-Cys_MtmC.js} +1 -1
  97. package/dist/{plugin-registry-Ty9w94Rd.js → plugin-registry-BM1-sG-e.js} +1 -1
  98. package/dist/{plugin-registry-BkGhcUDV.js → plugin-registry-CAy3I1K1.js} +1 -1
  99. package/dist/{plugin-registry-BenvgIsJ.js → plugin-registry-DjmzOS3n.js} +1 -1
  100. package/dist/{plugin-registry-DZirturB.js → plugin-registry-l2iN7_1l.js} +1 -1
  101. package/dist/plugin-sdk/agent-runtime/src/builderforce/ports.d.ts +1 -1
  102. package/dist/plugin-sdk/agent-runtime/src/infra/limbic-system-service.d.ts +2 -3
  103. package/dist/plugin-sdk/{audio-preflight-lhP946UF.js → audio-preflight-BbtfbLzo.js} +1 -1
  104. package/dist/plugin-sdk/{channel-web-CzXHQXgb.js → channel-web-BHose9yJ.js} +1 -1
  105. package/dist/plugin-sdk/index.js +1 -1
  106. package/dist/plugin-sdk/packages/agent-tools/src/index.d.ts +0 -1
  107. package/dist/plugin-sdk/packages/agent-tools/src/psychometric-dims.d.ts +2 -2
  108. package/dist/plugin-sdk/packages/agent-tools/src/psychometrics.d.ts +38 -5
  109. package/dist/plugin-sdk/packages/agent-tools/src/spec.d.ts +3 -1
  110. package/dist/plugin-sdk/{reply-DkmZ32IH.js → reply-V98uAjNN.js} +5 -5
  111. package/dist/plugin-sdk/{runner-DeqVi2ay.js → runner-BpFNG45j.js} +1 -1
  112. package/dist/plugin-sdk/{src-yVjde9hC.js → src-pvdIxmTY.js} +2 -2
  113. package/dist/plugin-sdk/{tool-loop-detection-AO2R09bJ.js → tool-loop-detection-Bjiit8CZ.js} +1 -1
  114. package/dist/plugin-sdk/{web-D-h3WpSq.js → web-Bq6nGRsB.js} +1 -1
  115. package/dist/{plugins-r-hGfiMK.js → plugins-BbovMu2g.js} +1 -1
  116. package/dist/{plugins-ChYVZuHy.js → plugins-DrkC1ANW.js} +1 -1
  117. package/dist/{plugins-cli-CKQ2X7tA.js → plugins-cli-CqtTn-Gv.js} +1 -1
  118. package/dist/{plugins-cli-CB7e9eCK.js → plugins-cli-DWlQnRpV.js} +1 -1
  119. package/dist/{program-D71K23KC.js → program-DOGUG9Uz.js} +2 -2
  120. package/dist/{program-context-B9V62ZJg.js → program-context-DBtTOKkf.js} +1 -1
  121. package/dist/{project-context-Cnqfr64Z.js → project-context-C5KLsMTc.js} +1 -1
  122. package/dist/{project-context-DXP12xhk.js → project-context-Cg0S9eFT.js} +1 -1
  123. package/dist/project-context-DbBD_r4v.js +1 -0
  124. package/dist/project-context-nIzFswHk.js +1 -0
  125. package/dist/project-context-store-B96x1Lfk.js +1 -0
  126. package/dist/{project-context-store-C8TROXjr.js → project-context-store-BS994lZX.js} +1 -1
  127. package/dist/{project-context-store-ClFt-YDL.js → project-context-store-BSIWJD6S.js} +1 -1
  128. package/dist/project-context-store-BzX1YdMP.js +1 -0
  129. package/dist/{prompt-select-styled-Cect8vJu.js → prompt-select-styled-2q_0LOx1.js} +1 -1
  130. package/dist/{prompt-select-styled-CJBJZiX_.js → prompt-select-styled-D31D9EIl.js} +1 -1
  131. package/dist/{provider-auth-helpers-DItSj71N.js → provider-auth-helpers-9Ut-MHV9.js} +1 -1
  132. package/dist/{provider-auth-helpers-ByvJdQT3.js → provider-auth-helpers-u1GAP4Bi.js} +1 -1
  133. package/dist/{provider-dispatcher-E-RjX6WG.js → provider-dispatcher-4KsB_bCw.js} +1 -1
  134. package/dist/{provider-dispatcher-D6-kUWf8.js → provider-dispatcher-CG7kSp65.js} +1 -1
  135. package/dist/{push-apns-B6YfFR5s.js → push-apns-CEzi4ars.js} +1 -1
  136. package/dist/{push-apns-n8P3oclR.js → push-apns-oUAHr48A.js} +1 -1
  137. package/dist/{pw-ai-BpY-eMJT.js → pw-ai-CfV_5FWo.js} +1 -1
  138. package/dist/{pw-ai-Bu1w-1rC.js → pw-ai-Dx8XRyPq.js} +1 -1
  139. package/dist/{register.agent-CAsV5dRf.js → register.agent-C84ud-cS.js} +1 -1
  140. package/dist/{register.agent-DQ4zQymV.js → register.agent-Db9SzkZg.js} +1 -1
  141. package/dist/{register.configure-HcPL-Na2.js → register.configure-BfPiEcFk.js} +1 -1
  142. package/dist/{register.configure-B-xRsB-s.js → register.configure-WYMz_fwM.js} +1 -1
  143. package/dist/{register.connect-BcZeAJ1s.js → register.connect-CMN7lqC5.js} +1 -1
  144. package/dist/{register.connect-ChZQOiYF.js → register.connect-Dqhd81kK.js} +1 -1
  145. package/dist/{register.maintenance-C-7Arpam.js → register.maintenance-BpQE-3eC.js} +1 -1
  146. package/dist/{register.maintenance-Jdfg2LKA.js → register.maintenance-DjKxt-jl.js} +1 -1
  147. package/dist/{register.message-D1IU3K0a.js → register.message-C4Gf388m.js} +1 -1
  148. package/dist/{register.message-C3cFBIXY.js → register.message-D5A7-_wN.js} +1 -1
  149. package/dist/{register.onboard-DJ2QNnOi.js → register.onboard-BF5tXr7K.js} +1 -1
  150. package/dist/{register.onboard-DjrhC3jh.js → register.onboard-BO_OtYg9.js} +1 -1
  151. package/dist/{register.setup-BNUqkiVa.js → register.setup-BzDbYjEw.js} +1 -1
  152. package/dist/{register.setup-C8XgG5Zt.js → register.setup-CaWt1bhf.js} +1 -1
  153. package/dist/{register.status-health-sessions-DcqlqAhs.js → register.status-health-sessions-BbYzFw1X.js} +1 -1
  154. package/dist/{register.status-health-sessions-CBTZZ0Rh.js → register.status-health-sessions-CDD6Eoxf.js} +1 -1
  155. package/dist/{register.subclis-CqVl0uO4.js → register.subclis-Cfb5FUTI.js} +1 -1
  156. package/dist/{register.subclis-Meewq2dj.js → register.subclis-yYbEKj9a.js} +1 -1
  157. package/dist/{reply-BsRbeUhd.js → reply-CpGH-3If.js} +8 -8
  158. package/dist/{run-main-CFVoPcgN.js → run-main-B82VAQTQ.js} +1 -1
  159. package/dist/{runner-68-X3KHf.js → runner-BLCTET8O.js} +2 -2
  160. package/dist/{runner-CfNJMPWu.js → runner-C651oVfk.js} +2 -2
  161. package/dist/{runner-BgUG2-RV.js → runner-DCn9sBTn.js} +3 -3
  162. package/dist/{runner-BKHYCYMH.js → runner-xF3_-mDL.js} +3 -3
  163. package/dist/{server-node-events-DusCxrVm.js → server-node-events-Bam08x5E.js} +1 -1
  164. package/dist/{server-node-events-BahizW3Z.js → server-node-events-kbTUUaAA.js} +1 -1
  165. package/dist/{session-dirs-RIA98OsG.js → session-dirs-BBGuanHN.js} +1 -1
  166. package/dist/{session-dirs-Cutn9srI.js → session-dirs-DV-c-o7M.js} +1 -1
  167. package/dist/{src-BRo9ywDM.js → src-BM8G-tIl.js} +3 -3
  168. package/dist/{src-DxNC0IHE.js → src-D2-7sOAX.js} +3 -3
  169. package/dist/{src-NJhXretA.js → src-D5vOHX9i.js} +2 -2
  170. package/dist/{src-Enbbh3hH.js → src-Dptpvd0V.js} +2 -2
  171. package/dist/{status-DPza6sZ1.js → status-BcT4AI8l.js} +1 -1
  172. package/dist/{status-CMdPdaSM.js → status-C9D1ex2G.js} +1 -1
  173. package/dist/{status-CFDh5snF.js → status-D_YsiWpP.js} +1 -1
  174. package/dist/{status-SyaizSN6.js → status-V8zvPBOv.js} +1 -1
  175. package/dist/{status-C1toWVvJ.js → status-i_sJ6Ikx.js} +1 -1
  176. package/dist/{subagent-registry-oB_F2U2W.js → subagent-registry-BUKplZi1.js} +8 -8
  177. package/dist/{subagent-registry-DFzwOGge.js → subagent-registry-BgUoQjBB.js} +1 -1
  178. package/dist/{subagent-registry-C1opJIrJ.js → subagent-registry-DrrF3JoH.js} +1 -1
  179. package/dist/{tool-loop-detection-DxqiqYam.js → tool-loop-detection-Bv0aRyd6.js} +1 -1
  180. package/dist/{tool-loop-detection-3W6bLEza.js → tool-loop-detection-CgUkrbCZ.js} +1 -1
  181. package/dist/{tool-loop-detection-C3z1wqgV.js → tool-loop-detection-CshVZIOE.js} +1 -1
  182. package/dist/{tool-loop-detection-DNM8YCNW.js → tool-loop-detection-bpZ-S3A1.js} +1 -1
  183. package/dist/{tui-Dy1FnApe.js → tui-CdYI5f3k.js} +2 -2
  184. package/dist/{tui-lng2vIp3.js → tui-DgBGTw2s.js} +2 -2
  185. package/dist/{tui-cli-BTFEL897.js → tui-cli-BNeRzoEe.js} +1 -1
  186. package/dist/{tui-cli-D-cDh9DV.js → tui-cli-BZ--mp9s.js} +1 -1
  187. package/dist/{tui-stream-assembler-B_AQD4Kg.js → tui-stream-assembler-BNJE9PoS.js} +1 -1
  188. package/dist/{tui-stream-assembler-Bn1WXUGG.js → tui-stream-assembler-xFcJqFJ9.js} +1 -1
  189. package/dist/{update-cli-BdT4-P_D.js → update-cli-BATUCF7p.js} +1 -1
  190. package/dist/{update-cli-DMMSWPXh.js → update-cli-BRBoX_97.js} +1 -1
  191. package/dist/{web-BiSkmACr.js → web-BdYyXjsX.js} +1 -1
  192. package/dist/{web-CXrAweDC.js → web-C5hfXVCy.js} +1 -1
  193. package/dist/{web-BS6WUf7c.js → web-CsWqmV_E.js} +1 -1
  194. package/dist/{web-CfYUd-lX.js → web-fg3nA4Qq.js} +1 -1
  195. package/dist/{workflow-cli-Du4IfE1A.js → workflow-cli-D-o_-jfU.js} +1 -1
  196. package/dist/{workflow-cli-BuEKJ4ut.js → workflow-cli-DDWSXyi0.js} +1 -1
  197. package/package.json +6 -5
  198. package/dist/chrome-C6fODzE5.js +0 -4
  199. package/dist/chrome-Cm-kVyuA.js +0 -4
  200. package/dist/plugin-sdk/agent-runtime/src/builderforce/limbic.d.ts +0 -14
  201. package/dist/plugin-sdk/packages/agent-tools/src/limbic.d.ts +0 -104
  202. package/dist/project-context-DS52UwJZ.js +0 -1
  203. package/dist/project-context-PiiAmwVd.js +0 -1
  204. package/dist/project-context-store-B2GYSwld.js +0 -1
  205. package/dist/project-context-store-DNx9ScQ_.js +0 -1
@@ -1 +1 @@
1
- import{g as resolveStateDir,i as isNixMode,m as resolveOAuthDir,o as resolveConfigPath,u as resolveGatewayPort}from"./paths-BHg-VHB4.js";import"./registry-Cv7CoWAs.js";import{_ as resolveHomeDir,x as shortenHomeInString,y as resolveUserPath,z as theme}from"./utils-BP60e80M.js";import{p as defaultRuntime}from"./subsystem-C4b1Von0.js";import"./boolean-ssGoaBPk.js";import"./env-BoE8QSib.js";import"./warning-filter-nSTjpMIH.js";import"./auth-profiles-BARnVAUE.js";import{t as formatCliCommand}from"./command-format-DTMaGKs7.js";import"./logger-AbH8mdkv.js";import"./session-key-D--2AEus.js";import"./builderforce-root-D3-p8W2n.js";import"./exec-CGuYALEs.js";import{k as resolveDefaultAgentWorkspaceDir}from"./agent-scope-BcoQBOwz.js";import"./env-file-BIKVpYUN.js";import{a as readConfigFileSnapshot,r as loadConfig}from"./io-BySzqKzT.js";import"./manifest-registry-DtqFvEIR.js";import"./config-Bwt58P9r.js";import"./model-discovery-DxpimsRF.js";import"./model-catalog-wcISK04b.js";import"./frontmatter-DgRc5y_l.js";import"./skills-W00EPvKR.js";import"./plugin-skills-BSUncenp.js";import"./skills-status-BCwjn1Id.js";import"./refresh-bgGvF0aF.js";import"./client-DeQ0LbP9.js";import"./call-CjC3SRPv.js";import"./message-channel-C-yw5fZm.js";import"./subagent-registry-oB_F2U2W.js";import"./sessions-ko0LxxGk.js";import"./src-BRo9ywDM.js";import"./project-context-store-ClFt-YDL.js";import"./tokens-BNwTTeJb.js";import"./plugins-DJGW_fnS.js";import"./accounts-Z5bJpNrG.js";import"./bindings-D0uket3l.js";import"./send-gG3CFJwv.js";import"./send-DqJCViFb.js";import"./with-timeout-By0c7Ur9.js";import"./deliver-Bs-FVPQ4.js";import"./accounts-DoJYLMfS.js";import"./send-mCN63Hkn.js";import"./image-ops-Bg9yFwjX.js";import"./redact-bWj_-q3j.js";import"./errors-t5wHPcwh.js";import"./embedded-helpers-Q5h1lA6D.js";import"./sandbox-BcH7kS1y.js";import"./chrome-IJYO1tSE.js";import"./tailscale-CgCG7AVQ.js";import"./auth-B4Kn3eee.js";import"./server-context-D3iiIzvV.js";import"./routes-7QTsp3sA.js";import"./paths-GamzES41.js";import"./ssrf-BiSQzdcA.js";import"./store-C5LmVaEC.js";import"./ports-LqFTyTSK.js";import"./trash-zs6gNxed.js";import"./accounts-BT-NzzBc.js";import"./paths-BQ9W7Bs0.js";import"./tool-images-DV2HMmx4.js";import"./workspace-Cz9mCy0P.js";import"./reply-prefix-9hmbzubX.js";import"./sqlite-BEgCClMz.js";import"./memory-cli-COgt0ROi.js";import"./manager-Cob4Ofzr.js";import"./gemini-auth-BZgBIY0M.js";import"./retry-Cc6xusE8.js";import"./common-BRdxH-uH.js";import"./runner-68-X3KHf.js";import"./tool-display-BIswnHaq.js";import"./chunk-UPhdkZNp.js";import"./markdown-tables-CpqWBduK.js";import"./fetch-guard-CoGEds8D.js";import"./fetch-CUsKv8oj.js";import"./ir-6L-eU4id.js";import"./render-1ABBE2Y6.js";import"./builderforcellm-syscheck-CyZiwcdF.js";import"./session-utils-VCGKYbgW.js";import"./coding-tools.policy-DIeVRurg.js";import"./pairing-store-tegvJa08.js";import"./fetch-CrbOFvsL.js";import"./exec-approvals-Cn0K-HtJ.js";import"./nodes-screen-OI7tHqlU.js";import"./session-cost-usage-BgZfN_WR.js";import"./provider-usage-BLkm6ojE.js";import"./send-BIR1Jhc5.js";import"./outbound-attachment-3GZbMqo1.js";import"./delivery-queue-DQXq7KUU.js";import"./project-context-DXP12xhk.js";import"./control-service-Cml__v8i.js";import"./stagger-CUH5rlmS.js";import"./channel-selection-DFf_nAm7.js";import"./send-9rUcCK7O.js";import"./resolve-route-D3X-bXU-.js";import"./channel-activity-By7lsk7N.js";import"./tables-DZSV6me6.js";import{t as formatDocsLink}from"./links-B6LU5cXN.js";import{n as runCommandWithRuntime}from"./cli-utils-ByV85M53.js";import"./help-format-DIDk_7gh.js";import"./progress-BQMO_-7I.js";import"./replies-CL0uQgU7.js";import{d as openUrl,g as resolveControlUiLinks,i as detectBrowserOpenSupport,o as formatControlUiSshHint}from"./onboard-helpers-Di5OXlap.js";import{n as stylePromptMessage,r as stylePromptTitle,t as stylePromptHint}from"./prompt-style-CZOeG0sw.js";import"./pairing-labels-DofkNLS2.js";import"./active-listener-BC31MA4v.js";import"./mamba-state-engine-CFwb8DcP.js";import"./transformers-stream-nSL4Xu31.js";import{t as copyToClipboard}from"./clipboard-C_wIOgJ9.js";import"./catalog-CEJqw4s-.js";import"./note-BvXfFmlu.js";import"./helpers-DDS6DSK4.js";import"./plugin-auto-enable-tSxWjjZC.js";import"./channels-status-issues-DLF6QGGM.js";import"./register.subclis-Meewq2dj.js";import"./command-registry-BTxAGdlS.js";import"./program-context-D37YNAO5.js";import"./completion-cli-C8kMJ401.js";import"./daemon-runtime-Ddsn0FJm.js";import"./runtime-guard-BThrXAmT.js";import"./systemd-DpT8tcbh.js";import{t as resolveGatewayService}from"./service-ugwM110q.js";import"./lifecycle-core-DM4IEWmJ.js";import"./diagnostics-D4pveUt2.js";import{c as runDaemonStop}from"./daemon-cli-DOnPzRrW.js";import"./health-hXlukqbf.js";import"./control-ui-assets-BweA3rDY.js";import"./update-check-Co1T5sBs.js";import"./dm-policy-shared-D3GiLoDG.js";import"./session-dirs-RIA98OsG.js";import"./logging-CRzk-5ye.js";import"./systemd-linger-CuzOv-tn.js";import"./health-format-CtcXvo40.js";import{n as doctorCommand,t as selectStyled}from"./prompt-select-styled-Cect8vJu.js";import"./doctor-completion-BdMxCat-.js";import path from"node:path";import fs from"node:fs/promises";import{cancel,confirm,isCancel,multiselect}from"@clack/prompts";async function dashboardCommand(runtime=defaultRuntime,options={}){let snapshot=await readConfigFileSnapshot(),cfg=snapshot.valid?snapshot.config:{},port=resolveGatewayPort(cfg),bind=cfg.gateway?.bind??`loopback`,basePath=cfg.gateway?.controlUi?.basePath,customBindHost=cfg.gateway?.customBindHost,token=cfg.gateway?.auth?.token??process.env.BUILDERFORCE_AGENTS_GATEWAY_TOKEN??``,links=resolveControlUiLinks({port,bind:bind===`lan`?`loopback`:bind,customBindHost,basePath}),dashboardUrl=token?`${links.httpUrl}#token=${encodeURIComponent(token)}`:links.httpUrl;runtime.log(`Dashboard URL: ${dashboardUrl}`);let copied=await copyToClipboard(dashboardUrl).catch(()=>!1);runtime.log(copied?`Copied to clipboard.`:`Copy to clipboard unavailable.`);let opened=!1,hint;options.noOpen?hint=`Browser launch disabled (--no-open). Use the URL above.`:((await detectBrowserOpenSupport()).ok&&(opened=await openUrl(dashboardUrl)),opened||(hint=formatControlUiSshHint({port,basePath,token:token||void 0}))),opened?runtime.log(`Opened in your browser. Keep that tab to control BuilderForceAgents.`):hint&&runtime.log(hint)}function collectWorkspaceDirs(cfg){let dirs=new Set,defaults=cfg?.agents?.defaults;typeof defaults?.workspace==`string`&&defaults.workspace.trim()&&dirs.add(resolveUserPath(defaults.workspace));let list=Array.isArray(cfg?.agents?.list)?cfg?.agents?.list:[];for(let agent of list){let workspace=agent.workspace;typeof workspace==`string`&&workspace.trim()&&dirs.add(resolveUserPath(workspace))}return dirs.size===0&&dirs.add(resolveDefaultAgentWorkspaceDir()),[...dirs]}function buildCleanupPlan(params){return{configInsideState:isPathWithin(params.configPath,params.stateDir),oauthInsideState:isPathWithin(params.oauthDir,params.stateDir),workspaceDirs:collectWorkspaceDirs(params.cfg)}}function isPathWithin(child,parent){let relative=path.relative(parent,child);return relative===``||!relative.startsWith(`..`)&&!path.isAbsolute(relative)}function isUnsafeRemovalTarget(target){if(!target.trim())return!0;let resolved=path.resolve(target);if(resolved===path.parse(resolved).root)return!0;let home=resolveHomeDir();return!!(home&&resolved===path.resolve(home))}async function removePath(target,runtime,opts){if(!target?.trim())return{ok:!1,skipped:!0};let resolved=path.resolve(target),displayLabel=shortenHomeInString(opts?.label??resolved);if(isUnsafeRemovalTarget(resolved))return runtime.error(`Refusing to remove unsafe path: ${displayLabel}`),{ok:!1};if(opts?.dryRun)return runtime.log(`[dry-run] remove ${displayLabel}`),{ok:!0,skipped:!0};try{return await fs.rm(resolved,{recursive:!0,force:!0}),runtime.log(`Removed ${displayLabel}`),{ok:!0}}catch(err){return runtime.error(`Failed to remove ${displayLabel}: ${String(err)}`),{ok:!1}}}async function listAgentSessionDirs(stateDir){let root=path.join(stateDir,`agents`);try{return(await fs.readdir(root,{withFileTypes:!0})).filter(entry=>entry.isDirectory()).map(entry=>path.join(root,entry.name,`sessions`))}catch{return[]}}function resolveCleanupPlanFromDisk(){let cfg=loadConfig(),stateDir=resolveStateDir(),configPath=resolveConfigPath(),oauthDir=resolveOAuthDir();return{cfg,stateDir,configPath,oauthDir,...buildCleanupPlan({cfg,stateDir,configPath,oauthDir})}}async function stopGatewayIfRunning(runtime){if(isNixMode)return;let service=resolveGatewayService(),loaded=!1;try{loaded=await service.isLoaded({env:process.env})}catch(err){runtime.error(`Gateway service check failed: ${String(err)}`);return}if(loaded)try{await service.stop({env:process.env,stdout:process.stdout})}catch(err){runtime.error(`Gateway stop failed: ${String(err)}`)}}async function resetCommand(runtime,opts){let interactive=!opts.nonInteractive;if(!interactive&&!opts.yes){runtime.error(`Non-interactive mode requires --yes.`),runtime.exit(1);return}let scope=opts.scope;if(!scope){if(!interactive){runtime.error(`Non-interactive mode requires --scope.`),runtime.exit(1);return}let selection=await selectStyled({message:`Reset scope`,options:[{value:`config`,label:`Config only`,hint:`builderforce.json`},{value:`config+creds+sessions`,label:`Config + credentials + sessions`,hint:`keeps workspace + auth profiles`},{value:`full`,label:`Full reset`,hint:`state dir + workspace`}],initialValue:`config+creds+sessions`});if(isCancel(selection)){cancel(stylePromptTitle(`Reset cancelled.`)??`Reset cancelled.`),runtime.exit(0);return}scope=selection}if(![`config`,`config+creds+sessions`,`full`].includes(scope)){runtime.error(`Invalid --scope. Expected "config", "config+creds+sessions", or "full".`),runtime.exit(1);return}if(interactive&&!opts.yes){let ok=await confirm({message:stylePromptMessage(`Proceed with ${scope} reset?`)});if(isCancel(ok)||!ok){cancel(stylePromptTitle(`Reset cancelled.`)??`Reset cancelled.`),runtime.exit(0);return}}let dryRun=!!opts.dryRun,{stateDir,configPath,oauthDir,configInsideState,oauthInsideState,workspaceDirs}=resolveCleanupPlanFromDisk();if(scope!==`config`&&(dryRun?runtime.log(`[dry-run] stop gateway service`):await stopGatewayIfRunning(runtime)),scope===`config`){await removePath(configPath,runtime,{dryRun,label:configPath});return}if(scope===`config+creds+sessions`){await removePath(configPath,runtime,{dryRun,label:configPath}),await removePath(oauthDir,runtime,{dryRun,label:oauthDir});let sessionDirs=await listAgentSessionDirs(stateDir);for(let dir of sessionDirs)await removePath(dir,runtime,{dryRun,label:dir});runtime.log(`Next: ${formatCliCommand(`builderforce onboard --install-daemon`)}`);return}if(scope===`full`){await removePath(stateDir,runtime,{dryRun,label:stateDir}),configInsideState||await removePath(configPath,runtime,{dryRun,label:configPath}),oauthInsideState||await removePath(oauthDir,runtime,{dryRun,label:oauthDir});for(let workspace of workspaceDirs)await removePath(workspace,runtime,{dryRun,label:workspace});runtime.log(`Next: ${formatCliCommand(`builderforce onboard --install-daemon`)}`);return}}const multiselectStyled=params=>multiselect({...params,message:stylePromptMessage(params.message),options:params.options.map(opt=>opt.hint===void 0?opt:{...opt,hint:stylePromptHint(opt.hint)})});function buildScopeSelection(opts){let hadExplicit=!!(opts.all||opts.service||opts.state||opts.workspace||opts.app),scopes=new Set;return(opts.all||opts.service)&&scopes.add(`service`),(opts.all||opts.state)&&scopes.add(`state`),(opts.all||opts.workspace)&&scopes.add(`workspace`),(opts.all||opts.app)&&scopes.add(`app`),{scopes,hadExplicit}}async function stopAndUninstallService(runtime){if(isNixMode)return runtime.error(`Nix mode detected; service uninstall is disabled.`),!1;let service=resolveGatewayService(),loaded=!1;try{loaded=await service.isLoaded({env:process.env})}catch(err){return runtime.error(`Gateway service check failed: ${String(err)}`),!1}if(!loaded)return runtime.log(`Gateway service ${service.notLoadedText}.`),!0;try{await service.stop({env:process.env,stdout:process.stdout})}catch(err){runtime.error(`Gateway stop failed: ${String(err)}`)}try{return await service.uninstall({env:process.env,stdout:process.stdout}),!0}catch(err){return runtime.error(`Gateway uninstall failed: ${String(err)}`),!1}}async function removeMacApp(runtime,dryRun){process.platform===`darwin`&&await removePath(`/Applications/BuilderForceAgents.app`,runtime,{dryRun,label:`/Applications/BuilderForceAgents.app`})}async function uninstallCommand(runtime,opts){let{scopes,hadExplicit}=buildScopeSelection(opts),interactive=!opts.nonInteractive;if(!interactive&&!opts.yes){runtime.error(`Non-interactive mode requires --yes.`),runtime.exit(1);return}if(!hadExplicit){if(!interactive){runtime.error(`Non-interactive mode requires explicit scopes (use --all).`),runtime.exit(1);return}let selection=await multiselectStyled({message:`Uninstall which components?`,options:[{value:`service`,label:`Gateway service`,hint:`launchd / systemd / schtasks`},{value:`state`,label:`State + config`,hint:`~/.builderforce`},{value:`workspace`,label:`Workspace`,hint:`agent files`},{value:`app`,label:`macOS app`,hint:`/Applications/BuilderForceAgents.app`}],initialValues:[`service`,`state`,`workspace`]});if(isCancel(selection)){cancel(stylePromptTitle(`Uninstall cancelled.`)??`Uninstall cancelled.`),runtime.exit(0);return}for(let value of selection)scopes.add(value)}if(scopes.size===0){runtime.log(`Nothing selected.`);return}if(interactive&&!opts.yes){let ok=await confirm({message:stylePromptMessage(`Proceed with uninstall?`)});if(isCancel(ok)||!ok){cancel(stylePromptTitle(`Uninstall cancelled.`)??`Uninstall cancelled.`),runtime.exit(0);return}}let dryRun=!!opts.dryRun,{stateDir,configPath,oauthDir,configInsideState,oauthInsideState,workspaceDirs}=resolveCleanupPlanFromDisk();if(scopes.has(`service`)&&(dryRun?runtime.log(`[dry-run] remove gateway service`):await stopAndUninstallService(runtime)),scopes.has(`state`)&&(await removePath(stateDir,runtime,{dryRun,label:stateDir}),configInsideState||await removePath(configPath,runtime,{dryRun,label:configPath}),oauthInsideState||await removePath(oauthDir,runtime,{dryRun,label:oauthDir})),scopes.has(`workspace`))for(let workspace of workspaceDirs)await removePath(workspace,runtime,{dryRun,label:workspace});if(scopes.has(`app`)&&await removeMacApp(runtime,dryRun),runtime.log(`CLI still installed. Remove via npm/pnpm if desired.`),scopes.has(`state`)&&!scopes.has(`workspace`)){let home=resolveHomeDir();home&&workspaceDirs.some(dir=>dir.startsWith(path.resolve(home)))&&runtime.log(`Tip: workspaces were preserved. Re-run with --workspace to remove them.`)}}function registerMaintenanceCommands(program){program.command(`doctor`).description(`Health checks + quick fixes for the gateway and channels`).addHelpText(`after`,()=>`\n${theme.muted(`Docs:`)} ${formatDocsLink(`/cli/doctor`,`docs.builderforce.ai/cli/doctor`)}\n`).option(`--no-workspace-suggestions`,`Disable workspace memory system suggestions`,!1).option(`--yes`,`Accept defaults without prompting`,!1).option(`--repair`,`Apply recommended repairs without prompting`,!1).option(`--fix`,`Apply recommended repairs (alias for --repair)`,!1).option(`--force`,`Apply aggressive repairs (overwrites custom service config)`,!1).option(`--non-interactive`,`Run without prompts (safe migrations only)`,!1).option(`--generate-gateway-token`,`Generate and configure a gateway token`,!1).option(`--deep`,`Scan system services for extra gateway installs`,!1).action(async opts=>{await runCommandWithRuntime(defaultRuntime,async()=>{await doctorCommand(defaultRuntime,{workspaceSuggestions:opts.workspaceSuggestions,yes:!!opts.yes,repair:!!opts.repair||!!opts.fix,force:!!opts.force,nonInteractive:!!opts.nonInteractive,generateGatewayToken:!!opts.generateGatewayToken,deep:!!opts.deep}),defaultRuntime.exit(0)})}),program.command(`dashboard`).description(`Open the Control UI with your current token`).addHelpText(`after`,()=>`\n${theme.muted(`Docs:`)} ${formatDocsLink(`/cli/dashboard`,`docs.builderforce.ai/cli/dashboard`)}\n`).option(`--no-open`,`Print URL but do not launch a browser`,!1).action(async opts=>{await runCommandWithRuntime(defaultRuntime,async()=>{await dashboardCommand(defaultRuntime,{noOpen:!!opts.noOpen})})}),program.command(`reset`).description(`Reset local config/state (keeps the CLI installed)`).addHelpText(`after`,()=>`\n${theme.muted(`Docs:`)} ${formatDocsLink(`/cli/reset`,`docs.builderforce.ai/cli/reset`)}\n`).option(`--scope <scope>`,`config|config+creds+sessions|full (default: interactive prompt)`).option(`--yes`,`Skip confirmation prompts`,!1).option(`--non-interactive`,`Disable prompts (requires --scope + --yes)`,!1).option(`--dry-run`,`Print actions without removing files`,!1).action(async opts=>{await runCommandWithRuntime(defaultRuntime,async()=>{await resetCommand(defaultRuntime,{scope:opts.scope,yes:!!opts.yes,nonInteractive:!!opts.nonInteractive,dryRun:!!opts.dryRun})})}),program.command(`uninstall`).description(`Uninstall the gateway service + local data (CLI remains)`).addHelpText(`after`,()=>`\n${theme.muted(`Docs:`)} ${formatDocsLink(`/cli/uninstall`,`docs.builderforce.ai/cli/uninstall`)}\n`).option(`--service`,`Remove the gateway service`,!1).option(`--state`,`Remove state + config`,!1).option(`--workspace`,`Remove workspace dirs`,!1).option(`--app`,`Remove the macOS app`,!1).option(`--all`,`Remove service + state + workspace + app`,!1).option(`--yes`,`Skip confirmation prompts`,!1).option(`--non-interactive`,`Disable prompts (requires --yes)`,!1).option(`--dry-run`,`Print actions without removing files`,!1).action(async opts=>{await runCommandWithRuntime(defaultRuntime,async()=>{await uninstallCommand(defaultRuntime,{service:!!opts.service,state:!!opts.state,workspace:!!opts.workspace,app:!!opts.app,all:!!opts.all,yes:!!opts.yes,nonInteractive:!!opts.nonInteractive,dryRun:!!opts.dryRun})})}),program.command(`stop`).description(`Stop the running gateway service (launchd/systemd/schtasks)`).addHelpText(`after`,()=>`\n${theme.muted(`Docs:`)} ${formatDocsLink(`/cli/gateway`,`docs.builderforce.ai/cli/gateway`)}\n`).option(`--json`,`Output JSON`,!1).action(async opts=>{await runCommandWithRuntime(defaultRuntime,async()=>{await runDaemonStop({json:!!opts.json})})})}export{registerMaintenanceCommands};
1
+ import{g as resolveStateDir,i as isNixMode,m as resolveOAuthDir,o as resolveConfigPath,u as resolveGatewayPort}from"./paths-BHg-VHB4.js";import"./registry-Cv7CoWAs.js";import{_ as resolveHomeDir,x as shortenHomeInString,y as resolveUserPath,z as theme}from"./utils-BP60e80M.js";import{p as defaultRuntime}from"./subsystem-C4b1Von0.js";import"./boolean-ssGoaBPk.js";import"./env-BoE8QSib.js";import"./warning-filter-nSTjpMIH.js";import"./auth-profiles-BARnVAUE.js";import{t as formatCliCommand}from"./command-format-DTMaGKs7.js";import"./logger-AbH8mdkv.js";import"./session-key-D--2AEus.js";import"./builderforce-root-D3-p8W2n.js";import"./exec-CGuYALEs.js";import{k as resolveDefaultAgentWorkspaceDir}from"./agent-scope-BcoQBOwz.js";import"./env-file-BIKVpYUN.js";import{a as readConfigFileSnapshot,r as loadConfig}from"./io-BySzqKzT.js";import"./manifest-registry-DtqFvEIR.js";import"./config-Bwt58P9r.js";import"./model-discovery-DxpimsRF.js";import"./model-catalog-wcISK04b.js";import"./frontmatter-DgRc5y_l.js";import"./skills-W00EPvKR.js";import"./plugin-skills-BSUncenp.js";import"./skills-status-BCwjn1Id.js";import"./refresh-bgGvF0aF.js";import"./client-DeQ0LbP9.js";import"./call-CjC3SRPv.js";import"./message-channel-C-yw5fZm.js";import"./subagent-registry-BUKplZi1.js";import"./sessions-ko0LxxGk.js";import"./src-BM8G-tIl.js";import"./project-context-store-BSIWJD6S.js";import"./tokens-BNwTTeJb.js";import"./plugins-DJGW_fnS.js";import"./accounts-Z5bJpNrG.js";import"./bindings-D0uket3l.js";import"./send-gG3CFJwv.js";import"./send-DqJCViFb.js";import"./with-timeout-By0c7Ur9.js";import"./deliver-DFhj1d_t.js";import"./accounts-DoJYLMfS.js";import"./send-mCN63Hkn.js";import"./image-ops-Bg9yFwjX.js";import"./redact-bWj_-q3j.js";import"./errors-t5wHPcwh.js";import"./embedded-helpers-DGDYymYx.js";import"./sandbox-BcH7kS1y.js";import"./chrome-IJYO1tSE.js";import"./tailscale-CgCG7AVQ.js";import"./auth-B4Kn3eee.js";import"./server-context-D3iiIzvV.js";import"./routes-7QTsp3sA.js";import"./paths-GamzES41.js";import"./ssrf-BiSQzdcA.js";import"./store-C5LmVaEC.js";import"./ports-LqFTyTSK.js";import"./trash-zs6gNxed.js";import"./accounts-BT-NzzBc.js";import"./paths-BQ9W7Bs0.js";import"./tool-images-DV2HMmx4.js";import"./workspace-Cz9mCy0P.js";import"./reply-prefix-9hmbzubX.js";import"./sqlite-BEgCClMz.js";import"./memory-cli-COgt0ROi.js";import"./manager-Cob4Ofzr.js";import"./gemini-auth-BZgBIY0M.js";import"./retry-Cc6xusE8.js";import"./common-BRdxH-uH.js";import"./runner-BLCTET8O.js";import"./tool-display-BIswnHaq.js";import"./chunk-UPhdkZNp.js";import"./markdown-tables-CpqWBduK.js";import"./fetch-guard-CoGEds8D.js";import"./fetch-CUsKv8oj.js";import"./ir-6L-eU4id.js";import"./render-1ABBE2Y6.js";import"./builderforcellm-syscheck-CfFrfeV2.js";import"./session-utils-VCGKYbgW.js";import"./coding-tools.policy-DIeVRurg.js";import"./pairing-store-tegvJa08.js";import"./fetch-CrbOFvsL.js";import"./exec-approvals-Cn0K-HtJ.js";import"./nodes-screen-OI7tHqlU.js";import"./session-cost-usage-BgZfN_WR.js";import"./provider-usage-BLkm6ojE.js";import"./send-BIR1Jhc5.js";import"./outbound-attachment-3GZbMqo1.js";import"./delivery-queue-DQXq7KUU.js";import"./project-context-C5KLsMTc.js";import"./control-service-Cml__v8i.js";import"./stagger-CUH5rlmS.js";import"./channel-selection-DFf_nAm7.js";import"./send-9rUcCK7O.js";import"./resolve-route-D3X-bXU-.js";import"./channel-activity-By7lsk7N.js";import"./tables-DZSV6me6.js";import{t as formatDocsLink}from"./links-B6LU5cXN.js";import{n as runCommandWithRuntime}from"./cli-utils-ByV85M53.js";import"./help-format-DIDk_7gh.js";import"./progress-BQMO_-7I.js";import"./replies-CL0uQgU7.js";import{d as openUrl,g as resolveControlUiLinks,i as detectBrowserOpenSupport,o as formatControlUiSshHint}from"./onboard-helpers-Di5OXlap.js";import{n as stylePromptMessage,r as stylePromptTitle,t as stylePromptHint}from"./prompt-style-CZOeG0sw.js";import"./pairing-labels-DofkNLS2.js";import"./active-listener-BC31MA4v.js";import"./mamba-state-engine-BYmUnYwn.js";import"./transformers-stream-nSL4Xu31.js";import{t as copyToClipboard}from"./clipboard-C_wIOgJ9.js";import"./catalog-CEJqw4s-.js";import"./note-BvXfFmlu.js";import"./helpers-DDS6DSK4.js";import"./plugin-auto-enable-tSxWjjZC.js";import"./channels-status-issues-DLF6QGGM.js";import"./register.subclis-yYbEKj9a.js";import"./command-registry-BXLjR3kb.js";import"./program-context-D37YNAO5.js";import"./completion-cli-DbIxXK1B.js";import"./daemon-runtime-Ddsn0FJm.js";import"./runtime-guard-BThrXAmT.js";import"./systemd-DpT8tcbh.js";import{t as resolveGatewayService}from"./service-ugwM110q.js";import"./lifecycle-core-DM4IEWmJ.js";import"./diagnostics-D4pveUt2.js";import{c as runDaemonStop}from"./daemon-cli-DOnPzRrW.js";import"./health-CRIXA8je.js";import"./control-ui-assets-BweA3rDY.js";import"./update-check-Co1T5sBs.js";import"./dm-policy-shared-D3GiLoDG.js";import"./session-dirs-BBGuanHN.js";import"./logging-CRzk-5ye.js";import"./systemd-linger-CuzOv-tn.js";import"./health-format-CtcXvo40.js";import{n as doctorCommand,t as selectStyled}from"./prompt-select-styled-2q_0LOx1.js";import"./doctor-completion-Dpy-8HV9.js";import path from"node:path";import fs from"node:fs/promises";import{cancel,confirm,isCancel,multiselect}from"@clack/prompts";async function dashboardCommand(runtime=defaultRuntime,options={}){let snapshot=await readConfigFileSnapshot(),cfg=snapshot.valid?snapshot.config:{},port=resolveGatewayPort(cfg),bind=cfg.gateway?.bind??`loopback`,basePath=cfg.gateway?.controlUi?.basePath,customBindHost=cfg.gateway?.customBindHost,token=cfg.gateway?.auth?.token??process.env.BUILDERFORCE_AGENTS_GATEWAY_TOKEN??``,links=resolveControlUiLinks({port,bind:bind===`lan`?`loopback`:bind,customBindHost,basePath}),dashboardUrl=token?`${links.httpUrl}#token=${encodeURIComponent(token)}`:links.httpUrl;runtime.log(`Dashboard URL: ${dashboardUrl}`);let copied=await copyToClipboard(dashboardUrl).catch(()=>!1);runtime.log(copied?`Copied to clipboard.`:`Copy to clipboard unavailable.`);let opened=!1,hint;options.noOpen?hint=`Browser launch disabled (--no-open). Use the URL above.`:((await detectBrowserOpenSupport()).ok&&(opened=await openUrl(dashboardUrl)),opened||(hint=formatControlUiSshHint({port,basePath,token:token||void 0}))),opened?runtime.log(`Opened in your browser. Keep that tab to control BuilderForceAgents.`):hint&&runtime.log(hint)}function collectWorkspaceDirs(cfg){let dirs=new Set,defaults=cfg?.agents?.defaults;typeof defaults?.workspace==`string`&&defaults.workspace.trim()&&dirs.add(resolveUserPath(defaults.workspace));let list=Array.isArray(cfg?.agents?.list)?cfg?.agents?.list:[];for(let agent of list){let workspace=agent.workspace;typeof workspace==`string`&&workspace.trim()&&dirs.add(resolveUserPath(workspace))}return dirs.size===0&&dirs.add(resolveDefaultAgentWorkspaceDir()),[...dirs]}function buildCleanupPlan(params){return{configInsideState:isPathWithin(params.configPath,params.stateDir),oauthInsideState:isPathWithin(params.oauthDir,params.stateDir),workspaceDirs:collectWorkspaceDirs(params.cfg)}}function isPathWithin(child,parent){let relative=path.relative(parent,child);return relative===``||!relative.startsWith(`..`)&&!path.isAbsolute(relative)}function isUnsafeRemovalTarget(target){if(!target.trim())return!0;let resolved=path.resolve(target);if(resolved===path.parse(resolved).root)return!0;let home=resolveHomeDir();return!!(home&&resolved===path.resolve(home))}async function removePath(target,runtime,opts){if(!target?.trim())return{ok:!1,skipped:!0};let resolved=path.resolve(target),displayLabel=shortenHomeInString(opts?.label??resolved);if(isUnsafeRemovalTarget(resolved))return runtime.error(`Refusing to remove unsafe path: ${displayLabel}`),{ok:!1};if(opts?.dryRun)return runtime.log(`[dry-run] remove ${displayLabel}`),{ok:!0,skipped:!0};try{return await fs.rm(resolved,{recursive:!0,force:!0}),runtime.log(`Removed ${displayLabel}`),{ok:!0}}catch(err){return runtime.error(`Failed to remove ${displayLabel}: ${String(err)}`),{ok:!1}}}async function listAgentSessionDirs(stateDir){let root=path.join(stateDir,`agents`);try{return(await fs.readdir(root,{withFileTypes:!0})).filter(entry=>entry.isDirectory()).map(entry=>path.join(root,entry.name,`sessions`))}catch{return[]}}function resolveCleanupPlanFromDisk(){let cfg=loadConfig(),stateDir=resolveStateDir(),configPath=resolveConfigPath(),oauthDir=resolveOAuthDir();return{cfg,stateDir,configPath,oauthDir,...buildCleanupPlan({cfg,stateDir,configPath,oauthDir})}}async function stopGatewayIfRunning(runtime){if(isNixMode)return;let service=resolveGatewayService(),loaded=!1;try{loaded=await service.isLoaded({env:process.env})}catch(err){runtime.error(`Gateway service check failed: ${String(err)}`);return}if(loaded)try{await service.stop({env:process.env,stdout:process.stdout})}catch(err){runtime.error(`Gateway stop failed: ${String(err)}`)}}async function resetCommand(runtime,opts){let interactive=!opts.nonInteractive;if(!interactive&&!opts.yes){runtime.error(`Non-interactive mode requires --yes.`),runtime.exit(1);return}let scope=opts.scope;if(!scope){if(!interactive){runtime.error(`Non-interactive mode requires --scope.`),runtime.exit(1);return}let selection=await selectStyled({message:`Reset scope`,options:[{value:`config`,label:`Config only`,hint:`builderforce.json`},{value:`config+creds+sessions`,label:`Config + credentials + sessions`,hint:`keeps workspace + auth profiles`},{value:`full`,label:`Full reset`,hint:`state dir + workspace`}],initialValue:`config+creds+sessions`});if(isCancel(selection)){cancel(stylePromptTitle(`Reset cancelled.`)??`Reset cancelled.`),runtime.exit(0);return}scope=selection}if(![`config`,`config+creds+sessions`,`full`].includes(scope)){runtime.error(`Invalid --scope. Expected "config", "config+creds+sessions", or "full".`),runtime.exit(1);return}if(interactive&&!opts.yes){let ok=await confirm({message:stylePromptMessage(`Proceed with ${scope} reset?`)});if(isCancel(ok)||!ok){cancel(stylePromptTitle(`Reset cancelled.`)??`Reset cancelled.`),runtime.exit(0);return}}let dryRun=!!opts.dryRun,{stateDir,configPath,oauthDir,configInsideState,oauthInsideState,workspaceDirs}=resolveCleanupPlanFromDisk();if(scope!==`config`&&(dryRun?runtime.log(`[dry-run] stop gateway service`):await stopGatewayIfRunning(runtime)),scope===`config`){await removePath(configPath,runtime,{dryRun,label:configPath});return}if(scope===`config+creds+sessions`){await removePath(configPath,runtime,{dryRun,label:configPath}),await removePath(oauthDir,runtime,{dryRun,label:oauthDir});let sessionDirs=await listAgentSessionDirs(stateDir);for(let dir of sessionDirs)await removePath(dir,runtime,{dryRun,label:dir});runtime.log(`Next: ${formatCliCommand(`builderforce onboard --install-daemon`)}`);return}if(scope===`full`){await removePath(stateDir,runtime,{dryRun,label:stateDir}),configInsideState||await removePath(configPath,runtime,{dryRun,label:configPath}),oauthInsideState||await removePath(oauthDir,runtime,{dryRun,label:oauthDir});for(let workspace of workspaceDirs)await removePath(workspace,runtime,{dryRun,label:workspace});runtime.log(`Next: ${formatCliCommand(`builderforce onboard --install-daemon`)}`);return}}const multiselectStyled=params=>multiselect({...params,message:stylePromptMessage(params.message),options:params.options.map(opt=>opt.hint===void 0?opt:{...opt,hint:stylePromptHint(opt.hint)})});function buildScopeSelection(opts){let hadExplicit=!!(opts.all||opts.service||opts.state||opts.workspace||opts.app),scopes=new Set;return(opts.all||opts.service)&&scopes.add(`service`),(opts.all||opts.state)&&scopes.add(`state`),(opts.all||opts.workspace)&&scopes.add(`workspace`),(opts.all||opts.app)&&scopes.add(`app`),{scopes,hadExplicit}}async function stopAndUninstallService(runtime){if(isNixMode)return runtime.error(`Nix mode detected; service uninstall is disabled.`),!1;let service=resolveGatewayService(),loaded=!1;try{loaded=await service.isLoaded({env:process.env})}catch(err){return runtime.error(`Gateway service check failed: ${String(err)}`),!1}if(!loaded)return runtime.log(`Gateway service ${service.notLoadedText}.`),!0;try{await service.stop({env:process.env,stdout:process.stdout})}catch(err){runtime.error(`Gateway stop failed: ${String(err)}`)}try{return await service.uninstall({env:process.env,stdout:process.stdout}),!0}catch(err){return runtime.error(`Gateway uninstall failed: ${String(err)}`),!1}}async function removeMacApp(runtime,dryRun){process.platform===`darwin`&&await removePath(`/Applications/BuilderForceAgents.app`,runtime,{dryRun,label:`/Applications/BuilderForceAgents.app`})}async function uninstallCommand(runtime,opts){let{scopes,hadExplicit}=buildScopeSelection(opts),interactive=!opts.nonInteractive;if(!interactive&&!opts.yes){runtime.error(`Non-interactive mode requires --yes.`),runtime.exit(1);return}if(!hadExplicit){if(!interactive){runtime.error(`Non-interactive mode requires explicit scopes (use --all).`),runtime.exit(1);return}let selection=await multiselectStyled({message:`Uninstall which components?`,options:[{value:`service`,label:`Gateway service`,hint:`launchd / systemd / schtasks`},{value:`state`,label:`State + config`,hint:`~/.builderforce`},{value:`workspace`,label:`Workspace`,hint:`agent files`},{value:`app`,label:`macOS app`,hint:`/Applications/BuilderForceAgents.app`}],initialValues:[`service`,`state`,`workspace`]});if(isCancel(selection)){cancel(stylePromptTitle(`Uninstall cancelled.`)??`Uninstall cancelled.`),runtime.exit(0);return}for(let value of selection)scopes.add(value)}if(scopes.size===0){runtime.log(`Nothing selected.`);return}if(interactive&&!opts.yes){let ok=await confirm({message:stylePromptMessage(`Proceed with uninstall?`)});if(isCancel(ok)||!ok){cancel(stylePromptTitle(`Uninstall cancelled.`)??`Uninstall cancelled.`),runtime.exit(0);return}}let dryRun=!!opts.dryRun,{stateDir,configPath,oauthDir,configInsideState,oauthInsideState,workspaceDirs}=resolveCleanupPlanFromDisk();if(scopes.has(`service`)&&(dryRun?runtime.log(`[dry-run] remove gateway service`):await stopAndUninstallService(runtime)),scopes.has(`state`)&&(await removePath(stateDir,runtime,{dryRun,label:stateDir}),configInsideState||await removePath(configPath,runtime,{dryRun,label:configPath}),oauthInsideState||await removePath(oauthDir,runtime,{dryRun,label:oauthDir})),scopes.has(`workspace`))for(let workspace of workspaceDirs)await removePath(workspace,runtime,{dryRun,label:workspace});if(scopes.has(`app`)&&await removeMacApp(runtime,dryRun),runtime.log(`CLI still installed. Remove via npm/pnpm if desired.`),scopes.has(`state`)&&!scopes.has(`workspace`)){let home=resolveHomeDir();home&&workspaceDirs.some(dir=>dir.startsWith(path.resolve(home)))&&runtime.log(`Tip: workspaces were preserved. Re-run with --workspace to remove them.`)}}function registerMaintenanceCommands(program){program.command(`doctor`).description(`Health checks + quick fixes for the gateway and channels`).addHelpText(`after`,()=>`\n${theme.muted(`Docs:`)} ${formatDocsLink(`/cli/doctor`,`docs.builderforce.ai/cli/doctor`)}\n`).option(`--no-workspace-suggestions`,`Disable workspace memory system suggestions`,!1).option(`--yes`,`Accept defaults without prompting`,!1).option(`--repair`,`Apply recommended repairs without prompting`,!1).option(`--fix`,`Apply recommended repairs (alias for --repair)`,!1).option(`--force`,`Apply aggressive repairs (overwrites custom service config)`,!1).option(`--non-interactive`,`Run without prompts (safe migrations only)`,!1).option(`--generate-gateway-token`,`Generate and configure a gateway token`,!1).option(`--deep`,`Scan system services for extra gateway installs`,!1).action(async opts=>{await runCommandWithRuntime(defaultRuntime,async()=>{await doctorCommand(defaultRuntime,{workspaceSuggestions:opts.workspaceSuggestions,yes:!!opts.yes,repair:!!opts.repair||!!opts.fix,force:!!opts.force,nonInteractive:!!opts.nonInteractive,generateGatewayToken:!!opts.generateGatewayToken,deep:!!opts.deep}),defaultRuntime.exit(0)})}),program.command(`dashboard`).description(`Open the Control UI with your current token`).addHelpText(`after`,()=>`\n${theme.muted(`Docs:`)} ${formatDocsLink(`/cli/dashboard`,`docs.builderforce.ai/cli/dashboard`)}\n`).option(`--no-open`,`Print URL but do not launch a browser`,!1).action(async opts=>{await runCommandWithRuntime(defaultRuntime,async()=>{await dashboardCommand(defaultRuntime,{noOpen:!!opts.noOpen})})}),program.command(`reset`).description(`Reset local config/state (keeps the CLI installed)`).addHelpText(`after`,()=>`\n${theme.muted(`Docs:`)} ${formatDocsLink(`/cli/reset`,`docs.builderforce.ai/cli/reset`)}\n`).option(`--scope <scope>`,`config|config+creds+sessions|full (default: interactive prompt)`).option(`--yes`,`Skip confirmation prompts`,!1).option(`--non-interactive`,`Disable prompts (requires --scope + --yes)`,!1).option(`--dry-run`,`Print actions without removing files`,!1).action(async opts=>{await runCommandWithRuntime(defaultRuntime,async()=>{await resetCommand(defaultRuntime,{scope:opts.scope,yes:!!opts.yes,nonInteractive:!!opts.nonInteractive,dryRun:!!opts.dryRun})})}),program.command(`uninstall`).description(`Uninstall the gateway service + local data (CLI remains)`).addHelpText(`after`,()=>`\n${theme.muted(`Docs:`)} ${formatDocsLink(`/cli/uninstall`,`docs.builderforce.ai/cli/uninstall`)}\n`).option(`--service`,`Remove the gateway service`,!1).option(`--state`,`Remove state + config`,!1).option(`--workspace`,`Remove workspace dirs`,!1).option(`--app`,`Remove the macOS app`,!1).option(`--all`,`Remove service + state + workspace + app`,!1).option(`--yes`,`Skip confirmation prompts`,!1).option(`--non-interactive`,`Disable prompts (requires --yes)`,!1).option(`--dry-run`,`Print actions without removing files`,!1).action(async opts=>{await runCommandWithRuntime(defaultRuntime,async()=>{await uninstallCommand(defaultRuntime,{service:!!opts.service,state:!!opts.state,workspace:!!opts.workspace,app:!!opts.app,all:!!opts.all,yes:!!opts.yes,nonInteractive:!!opts.nonInteractive,dryRun:!!opts.dryRun})})}),program.command(`stop`).description(`Stop the running gateway service (launchd/systemd/schtasks)`).addHelpText(`after`,()=>`\n${theme.muted(`Docs:`)} ${formatDocsLink(`/cli/gateway`,`docs.builderforce.ai/cli/gateway`)}\n`).option(`--json`,`Output JSON`,!1).action(async opts=>{await runCommandWithRuntime(defaultRuntime,async()=>{await runDaemonStop({json:!!opts.json})})})}export{registerMaintenanceCommands};
@@ -1,4 +1,4 @@
1
- import"./paths-5FcIFMsj.js";import{B as theme,O as danger,P as setVerbose,z as isRich}from"./utils-DbaBVFaK.js";import"./embedded-helpers-BrfnCpCe.js";import{K as CHANNEL_MESSAGE_ACTION_NAMES,L as runMessageAction,W as formatTargetDisplay,ot as CHANNEL_TARGETS_DESCRIPTION,st as CHANNEL_TARGET_DESCRIPTION}from"./reply-BsRbeUhd.js";import"./session-key-EoB0qaG9.js";import"./builderforce-root-D64_sXEi.js";import{i as defaultRuntime}from"./subsystem-B3TqcCrZ.js";import{o as getChatChannelMeta,u as normalizeChatChannelId}from"./registry-TdK-aV05.js";import"./logger-Bch0bx9c.js";import"./exec-DdcIjeyn.js";import"./agent-scope-DPtjOxzp.js";import"./model-selection-DX_WOc2P.js";import"./env-file-BI2jpOmF.js";import"./boolean-Cn4K2fc9.js";import"./env-BHP32i7Q.js";import{r as loadConfig}from"./io-YzT_09GD.js";import"./manifest-registry-BVDm_CP0.js";import"./config-8x9ZIdfF.js";import"./runner-CfNJMPWu.js";import"./model-catalog-C7PdRY6w.js";import"./sandbox-DzuXOMNa.js";import"./chrome-Dk-WNIhp.js";import"./tailscale-B-VKIlWm.js";import"./auth-CDcrUXYB.js";import"./server-context-DsuST81W.js";import"./frontmatter-DyJ2unbL.js";import"./skills-B4r9m770.js";import"./plugin-skills-C39wi4uD.js";import"./routes-DoGqdgOP.js";import"./redact-C3oo7_aY.js";import"./errors-CjmtpPBP.js";import"./paths-C1QKdGJX.js";import"./ssrf-4MnoQ7Sz.js";import"./image-ops-CONrkLJK.js";import"./store-BoTKCB2d.js";import"./ports-BNC_iRpw.js";import"./trash-Czxs8cUf.js";import"./sessions-OZNhnSwZ.js";import{h as GATEWAY_CLIENT_NAMES,m as GATEWAY_CLIENT_MODES}from"./message-channel-DrfCCUg4.js";import{t as getChannelPlugin}from"./plugins-COtQnUML.js";import"./accounts-CTKk3xPO.js";import"./accounts-DFqpWzeU.js";import"./accounts-CbQihLRU.js";import"./bindings-DMDv84HS.js";import"./send-Dmzp1gNF.js";import"./send-DEgD1Cfd.js";import"./paths-CkcK939O.js";import"./src-DxNC0IHE.js";import"./tool-images-DsKy1uNN.js";import"./tool-display-TRKLY-yH.js";import"./fetch-guard-BQuCLA1C.js";import"./api-key-rotation-ChHXb1Pq.js";import"./fetch-CDeJQlzN.js";import"./sqlite-DEiKj1vi.js";import"./tokens-Ct4DyfhX.js";import"./project-context-store-C8TROXjr.js";import"./with-timeout-YbYylXgf.js";import{T as runGlobalGatewayStopSafely}from"./deliver-C5lVQcrs.js";import"./send-DlPwTVpG.js";import"./workspace-ChbaDWgp.js";import"./reply-prefix-BwtP84WV.js";import"./memory-cli-DWEtZrJ5.js";import"./manager-VPNjVm0W.js";import"./retry-Jis-ZZfm.js";import"./client-DhlZRznX.js";import"./call-DwWslKWv.js";import"./common-NHQnma5l.js";import"./chunk-h7FZEwW2.js";import"./markdown-tables-DOq8FfUr.js";import"./ir-AM9J0QtO.js";import"./render-CSLaFZoy.js";import"./builderforcellm-syscheck-DMjMJNFI.js";import"./send-DglIOKdS.js";import"./outbound-attachment-TWzrIR9Q.js";import"./fetch-B6_hd7w9.js";import"./delivery-queue-BZWZDdpJ.js";import"./channel-activity-qRD5c3VV.js";import"./tables-DirB1oU7.js";import"./pairing-store-DIpKOfDK.js";import{t as formatDocsLink}from"./links-CYRGsVCu.js";import{n as runCommandWithRuntime}from"./cli-utils-BLNnV_WG.js";import{t as formatHelpExamples}from"./help-format-NhTn4dWd.js";import{n as withProgress}from"./progress-OKwbfa23.js";import"./resolve-route-BvfmiLqC.js";import"./replies-BoxyKuBS.js";import"./refresh-DgTiir08.js";import"./coding-tools.policy-BJQuylwM.js";import"./send-BgdpJymE.js";import"./onboard-helpers-CPmBeDvt.js";import"./prompt-style-BwwmGo3-.js";import"./pairing-labels-CELZqNBC.js";import"./session-cost-usage-pgxrRRW4.js";import"./provider-usage-CbH7sm73.js";import"./active-listener-DBdxNyOd.js";import"./exec-approvals-kmxxyvIe.js";import"./nodes-screen-BWDONgPE.js";import"./project-context-Cnqfr64Z.js";import"./control-service-BhSaBRxC.js";import"./stagger-NaB6u1z1.js";import"./channel-selection-CQ5MM7Hi.js";import"./mamba-state-engine-Ck2JCfL6.js";import"./transformers-stream-QS2dnQob.js";import{t as createDefaultDeps}from"./deps-DWFMK9Xg.js";import{t as collectOption}from"./helpers-WeAzElGL.js";import{t as ensurePluginRegistryLoaded}from"./plugin-registry-BkGhcUDV.js";import{t as renderTable}from"./table-BKeTpiIp.js";import{t as createOutboundSendDeps}from"./outbound-send-deps-DS_1j6Dm.js";const resolveChannelLabel$1=channel=>{let pluginLabel=getChannelPlugin(channel)?.meta.label;if(pluginLabel)return pluginLabel;let normalized=normalizeChatChannelId(channel);return normalized?getChatChannelMeta(normalized).label:channel};function formatOutboundDeliverySummary(channel,result){if(!result)return`✅ Sent via ${resolveChannelLabel$1(channel)}. Message ID: unknown`;let base=`✅ Sent via ${resolveChannelLabel$1(result.channel)}. Message ID: ${result.messageId}`;return`chatId`in result?`${base} (chat ${result.chatId})`:`channelId`in result?`${base} (channel ${result.channelId})`:`roomId`in result?`${base} (room ${result.roomId})`:`conversationId`in result?`${base} (conversation ${result.conversationId})`:base}function formatGatewaySummary(params){return`✅ ${params.action??`Sent`} via gateway${params.channel?` (${params.channel})`:``}. Message ID: ${params.messageId??`unknown`}`}const shortenText=(value,maxLen)=>{let chars=Array.from(value);return chars.length<=maxLen?value:`${chars.slice(0,Math.max(0,maxLen-1)).join(``)}…`},resolveChannelLabel=channel=>getChannelPlugin(channel)?.meta.label??channel;function extractMessageId(payload){if(!payload||typeof payload!=`object`)return null;let direct=payload.messageId;if(typeof direct==`string`&&direct.trim())return direct.trim();let result=payload.result;if(result&&typeof result==`object`){let nested=result.messageId;if(typeof nested==`string`&&nested.trim())return nested.trim()}return null}function buildMessageCliJson(result){return{action:result.action,channel:result.channel,dryRun:result.dryRun,handledBy:result.handledBy,payload:result.payload}}function renderObjectSummary(payload,opts){if(!payload||typeof payload!=`object`)return[String(payload)];let obj=payload,keys=Object.keys(obj);if(keys.length===0)return[theme.muted(`(empty)`)];let rows=keys.slice(0,20).map(k=>{let v=obj[k];return{Key:k,Value:shortenText(v==null?`null`:Array.isArray(v)?`${v.length} items`:typeof v==`object`?`object`:typeof v==`string`?v:typeof v==`number`?String(v):typeof v==`boolean`?v?`true`:`false`:typeof v==`bigint`||typeof v==`symbol`?v.toString():typeof v==`function`?`function`:`unknown`,96)}});return[renderTable({width:opts.width,columns:[{key:`Key`,header:`Key`,minWidth:16},{key:`Value`,header:`Value`,flex:!0,minWidth:24}],rows}).trimEnd()]}function renderMessageList(messages,opts,emptyLabel){let rows=messages.slice(0,25).map(m=>{let msg=m,id=typeof msg.id==`string`&&msg.id||typeof msg.ts==`string`&&msg.ts||typeof msg.messageId==`string`&&msg.messageId||``,authorObj=msg.author,author=typeof msg.authorTag==`string`&&msg.authorTag||typeof authorObj?.username==`string`&&authorObj.username||typeof msg.user==`string`&&msg.user||``,time=typeof msg.timestamp==`string`&&msg.timestamp||typeof msg.ts==`string`&&msg.ts||``,text=typeof msg.content==`string`&&msg.content||typeof msg.text==`string`&&msg.text||``;return{Time:shortenText(time,28),Author:shortenText(author,22),Text:shortenText(text.replace(/\s+/g,` `).trim(),90),Id:shortenText(id,22)}});return rows.length===0?[theme.muted(emptyLabel)]:[renderTable({width:opts.width,columns:[{key:`Time`,header:`Time`,minWidth:14},{key:`Author`,header:`Author`,minWidth:10},{key:`Text`,header:`Text`,flex:!0,minWidth:24},{key:`Id`,header:`Id`,minWidth:10}],rows}).trimEnd()]}function renderMessagesFromPayload(payload,opts){if(!payload||typeof payload!=`object`)return null;let messages=payload.messages;return Array.isArray(messages)?renderMessageList(messages,opts,`No messages.`):null}function renderPinsFromPayload(payload,opts){if(!payload||typeof payload!=`object`)return null;let pins=payload.pins;return Array.isArray(pins)?renderMessageList(pins,opts,`No pins.`):null}function extractDiscordSearchResultsMessages(results){if(!results||typeof results!=`object`)return null;let raw=results.messages;if(!Array.isArray(raw))return null;let flattened=[];for(let entry of raw)Array.isArray(entry)&&entry.length>0?flattened.push(entry[0]):entry&&typeof entry==`object`&&flattened.push(entry);return flattened.length?flattened:null}function renderReactions(payload,opts){if(!payload||typeof payload!=`object`)return null;let reactions=payload.reactions;if(!Array.isArray(reactions))return null;let rows=reactions.slice(0,50).map(r=>{let entry=r,emojiObj=entry.emoji;return{Emoji:typeof emojiObj?.raw==`string`&&emojiObj.raw||typeof entry.name==`string`&&entry.name||typeof entry.emoji==`string`&&entry.emoji||``,Count:typeof entry.count==`number`?String(entry.count):``,Users:shortenText((Array.isArray(entry.users)?entry.users.slice(0,8).map(u=>{if(typeof u==`string`)return u;if(!u||typeof u!=`object`)return``;let user=u;return typeof user.tag==`string`&&user.tag||typeof user.username==`string`&&user.username||typeof user.id==`string`&&user.id||``}).filter(Boolean):[]).join(`, `),72)}});return rows.length===0?[theme.muted(`No reactions.`)]:[renderTable({width:opts.width,columns:[{key:`Emoji`,header:`Emoji`,minWidth:8},{key:`Count`,header:`Count`,align:`right`,minWidth:6},{key:`Users`,header:`Users`,flex:!0,minWidth:20}],rows}).trimEnd()]}function formatMessageCliText(result){let rich=isRich(),ok=text=>rich?theme.success(text):text,muted=text=>rich?theme.muted(text):text,heading=text=>rich?theme.heading(text):text,opts={width:Math.max(60,(process.stdout.columns??120)-1)};if(result.handledBy===`dry-run`)return[muted(`[dry-run] would run ${result.action} via ${result.channel}`)];if(result.kind===`broadcast`){let results=result.payload.results??[],rows=results.map(entry=>({Channel:resolveChannelLabel(entry.channel),Target:shortenText(formatTargetDisplay({channel:entry.channel,target:entry.to}),36),Status:entry.ok?`ok`:`error`,Error:entry.ok?``:shortenText(entry.error??`unknown error`,48)})),okCount=results.filter(entry=>entry.ok).length,total=results.length;return[ok(`✅ Broadcast complete (${okCount}/${total} succeeded, ${total-okCount} failed)`),renderTable({width:opts.width,columns:[{key:`Channel`,header:`Channel`,minWidth:10},{key:`Target`,header:`Target`,minWidth:12,flex:!0},{key:`Status`,header:`Status`,minWidth:6},{key:`Error`,header:`Error`,minWidth:20,flex:!0}],rows:rows.slice(0,50)}).trimEnd()]}if(result.kind===`send`){if(result.handledBy===`core`&&result.sendResult){let send=result.sendResult;if(send.via===`direct`){let directResult=send.result;return[ok(formatOutboundDeliverySummary(send.channel,directResult))]}let gatewayResult=send.result;return[ok(formatGatewaySummary({channel:send.channel,messageId:gatewayResult?.messageId??null}))]}let label=resolveChannelLabel(result.channel),msgId=extractMessageId(result.payload);return[ok(`✅ Sent via ${label}.${msgId?` Message ID: ${msgId}`:``}`)]}if(result.kind===`poll`){if(result.handledBy===`core`&&result.pollResult){let poll=result.pollResult,pollId=poll.result?.pollId,msgId=poll.result?.messageId??null,lines=[ok(formatGatewaySummary({action:`Poll sent`,channel:poll.channel,messageId:msgId}))];return pollId&&lines.push(ok(`Poll id: ${pollId}`)),lines}let label=resolveChannelLabel(result.channel),msgId=extractMessageId(result.payload);return[ok(`✅ Poll sent via ${label}.${msgId?` Message ID: ${msgId}`:``}`)]}let payload=result.payload,lines=[];if(result.action===`react`){let added=payload.added,removed=payload.removed;if(typeof added==`string`&&added.trim())return lines.push(ok(`✅ Reaction added: ${added.trim()}`)),lines;if(typeof removed==`string`&&removed.trim())return lines.push(ok(`✅ Reaction removed: ${removed.trim()}`)),lines;if(Array.isArray(removed)){let list=removed.map(x=>String(x).trim()).filter(Boolean).join(`, `);return lines.push(ok(`✅ Reactions removed${list?`: ${list}`:``}`)),lines}return lines.push(ok(`✅ Reaction updated.`)),lines}let reactionsTable=renderReactions(payload,opts);if(reactionsTable&&result.action===`reactions`)return lines.push(heading(`Reactions`)),lines.push(reactionsTable[0]??``),lines;if(result.action===`read`){let messagesTable=renderMessagesFromPayload(payload,opts);if(messagesTable)return lines.push(heading(`Messages`)),lines.push(messagesTable[0]??``),lines}if(result.action===`list-pins`){let pinsTable=renderPinsFromPayload(payload,opts);if(pinsTable)return lines.push(heading(`Pinned messages`)),lines.push(pinsTable[0]??``),lines}if(result.action===`search`){let results=payload.results,list=extractDiscordSearchResultsMessages(results);if(list)return lines.push(heading(`Search results`)),lines.push(renderMessageList(list,opts,`No results.`)[0]??``),lines}lines.push(ok(`✅ ${result.action} via ${resolveChannelLabel(result.channel)}.`));let summary=renderObjectSummary(payload,opts);return summary.length&&(lines.push(``),lines.push(...summary),lines.push(``),lines.push(muted(`Tip: use --json for full output.`))),lines}async function messageCommand(opts,deps,runtime){let cfg=loadConfig(),actionInput=(typeof opts.action==`string`?opts.action.trim():``)||`send`,actionMatch=CHANNEL_MESSAGE_ACTION_NAMES.find(name=>name.toLowerCase()===actionInput.toLowerCase());if(!actionMatch)throw Error(`Unknown message action: ${actionInput}`);let action=actionMatch,outboundDeps=createOutboundSendDeps(deps),run=async()=>await runMessageAction({cfg,action,params:opts,deps:outboundDeps,gateway:{clientName:GATEWAY_CLIENT_NAMES.CLI,mode:GATEWAY_CLIENT_MODES.CLI}}),json=opts.json===!0,dryRun=opts.dryRun===!0,result=!json&&!dryRun&&(action===`send`||action===`poll`)?await withProgress({label:action===`poll`?`Sending poll...`:`Sending...`,indeterminate:!0,enabled:!0},run):await run();if(json){runtime.log(JSON.stringify(buildMessageCliJson(result),null,2));return}for(let line of formatMessageCliText(result))runtime.log(line)}function normalizeMessageOptions(opts){let{account,...rest}=opts;return{...rest,accountId:typeof account==`string`?account:void 0}}async function runPluginStopHooks(){await runGlobalGatewayStopSafely({event:{reason:`cli message action complete`},ctx:{},onError:err=>defaultRuntime.error(danger(`gateway_stop hook failed: ${String(err)}`))})}function createMessageCliHelpers(message,messageChannelOptions){return{withMessageBase:command=>command.option(`--channel <channel>`,`Channel: ${messageChannelOptions}`).option(`--account <id>`,`Channel account id (accountId)`).option(`--json`,`Output result as JSON`,!1).option(`--dry-run`,`Print payload and skip sending`,!1).option(`--verbose`,`Verbose logging`,!1),withMessageTarget:command=>command.option(`-t, --target <dest>`,CHANNEL_TARGET_DESCRIPTION),withRequiredMessageTarget:command=>command.requiredOption(`-t, --target <dest>`,CHANNEL_TARGET_DESCRIPTION),runMessageAction:async(action,opts)=>{setVerbose(!!opts.verbose),ensurePluginRegistryLoaded();let deps=createDefaultDeps(),failed=!1;await runCommandWithRuntime(defaultRuntime,async()=>{await messageCommand({...normalizeMessageOptions(opts),action},deps,defaultRuntime)},err=>{failed=!0,defaultRuntime.error(danger(String(err)))}),await runPluginStopHooks(),defaultRuntime.exit(failed?1:0)}}}function registerMessageBroadcastCommand(message,helpers){helpers.withMessageBase(message.command(`broadcast`).description(`Broadcast a message to multiple targets`)).requiredOption(`--targets <target...>`,CHANNEL_TARGETS_DESCRIPTION).option(`--message <text>`,`Message to send`).option(`--media <url>`,`Media URL`).action(async options=>{await helpers.runMessageAction(`broadcast`,options)})}function registerMessageDiscordAdminCommands(message,helpers){let role=message.command(`role`).description(`Role actions`);helpers.withMessageBase(role.command(`info`).description(`List roles`).requiredOption(`--guild-id <id>`,`Guild id`)).action(async opts=>{await helpers.runMessageAction(`role-info`,opts)}),helpers.withMessageBase(role.command(`add`).description(`Add role to a member`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--user-id <id>`,`User id`).requiredOption(`--role-id <id>`,`Role id`)).action(async opts=>{await helpers.runMessageAction(`role-add`,opts)}),helpers.withMessageBase(role.command(`remove`).description(`Remove role from a member`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--user-id <id>`,`User id`).requiredOption(`--role-id <id>`,`Role id`)).action(async opts=>{await helpers.runMessageAction(`role-remove`,opts)});let channel=message.command(`channel`).description(`Channel actions`);helpers.withMessageBase(helpers.withRequiredMessageTarget(channel.command(`info`).description(`Fetch channel info`))).action(async opts=>{await helpers.runMessageAction(`channel-info`,opts)}),helpers.withMessageBase(channel.command(`list`).description(`List channels`).requiredOption(`--guild-id <id>`,`Guild id`)).action(async opts=>{await helpers.runMessageAction(`channel-list`,opts)});let member=message.command(`member`).description(`Member actions`);helpers.withMessageBase(member.command(`info`).description(`Fetch member info`).requiredOption(`--user-id <id>`,`User id`)).option(`--guild-id <id>`,`Guild id (Discord)`).action(async opts=>{await helpers.runMessageAction(`member-info`,opts)});let voice=message.command(`voice`).description(`Voice actions`);helpers.withMessageBase(voice.command(`status`).description(`Fetch voice status`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--user-id <id>`,`User id`)).action(async opts=>{await helpers.runMessageAction(`voice-status`,opts)});let event=message.command(`event`).description(`Event actions`);helpers.withMessageBase(event.command(`list`).description(`List scheduled events`).requiredOption(`--guild-id <id>`,`Guild id`)).action(async opts=>{await helpers.runMessageAction(`event-list`,opts)}),helpers.withMessageBase(event.command(`create`).description(`Create a scheduled event`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--event-name <name>`,`Event name`).requiredOption(`--start-time <iso>`,`Event start time`)).option(`--end-time <iso>`,`Event end time`).option(`--desc <text>`,`Event description`).option(`--channel-id <id>`,`Channel id`).option(`--location <text>`,`Event location`).option(`--event-type <stage|external|voice>`,`Event type`).action(async opts=>{await helpers.runMessageAction(`event-create`,opts)}),helpers.withMessageBase(message.command(`timeout`).description(`Timeout a member`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--user-id <id>`,`User id`)).option(`--duration-min <n>`,`Timeout duration minutes`).option(`--until <iso>`,`Timeout until`).option(`--reason <text>`,`Moderation reason`).action(async opts=>{await helpers.runMessageAction(`timeout`,opts)}),helpers.withMessageBase(message.command(`kick`).description(`Kick a member`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--user-id <id>`,`User id`)).option(`--reason <text>`,`Moderation reason`).action(async opts=>{await helpers.runMessageAction(`kick`,opts)}),helpers.withMessageBase(message.command(`ban`).description(`Ban a member`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--user-id <id>`,`User id`)).option(`--reason <text>`,`Moderation reason`).option(`--delete-days <n>`,`Ban delete message days`).action(async opts=>{await helpers.runMessageAction(`ban`,opts)})}function registerMessageEmojiCommands(message,helpers){let emoji=message.command(`emoji`).description(`Emoji actions`);helpers.withMessageBase(emoji.command(`list`).description(`List emojis`)).option(`--guild-id <id>`,`Guild id (Discord)`).action(async opts=>{await helpers.runMessageAction(`emoji-list`,opts)}),helpers.withMessageBase(emoji.command(`upload`).description(`Upload an emoji`).requiredOption(`--guild-id <id>`,`Guild id`)).requiredOption(`--emoji-name <name>`,`Emoji name`).requiredOption(`--media <path-or-url>`,`Emoji media (path or URL)`).option(`--role-ids <id>`,`Role id (repeat)`,collectOption,[]).action(async opts=>{await helpers.runMessageAction(`emoji-upload`,opts)})}function registerMessageStickerCommands(message,helpers){let sticker=message.command(`sticker`).description(`Sticker actions`);helpers.withMessageBase(helpers.withRequiredMessageTarget(sticker.command(`send`).description(`Send stickers`))).requiredOption(`--sticker-id <id>`,`Sticker id (repeat)`,collectOption).option(`-m, --message <text>`,`Optional message body`).action(async opts=>{await helpers.runMessageAction(`sticker`,opts)}),helpers.withMessageBase(sticker.command(`upload`).description(`Upload a sticker`).requiredOption(`--guild-id <id>`,`Guild id`)).requiredOption(`--sticker-name <name>`,`Sticker name`).requiredOption(`--sticker-desc <text>`,`Sticker description`).requiredOption(`--sticker-tags <tags>`,`Sticker tags`).requiredOption(`--media <path-or-url>`,`Sticker media (path or URL)`).action(async opts=>{await helpers.runMessageAction(`sticker-upload`,opts)})}function registerMessagePermissionsCommand(message,helpers){helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`permissions`).description(`Fetch channel permissions`))).action(async opts=>{await helpers.runMessageAction(`permissions`,opts)})}function registerMessageSearchCommand(message,helpers){helpers.withMessageBase(message.command(`search`).description(`Search Discord messages`)).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--query <text>`,`Search query`).option(`--channel-id <id>`,`Channel id`).option(`--channel-ids <id>`,`Channel id (repeat)`,collectOption,[]).option(`--author-id <id>`,`Author id`).option(`--author-ids <id>`,`Author id (repeat)`,collectOption,[]).option(`--limit <n>`,`Result limit`).action(async opts=>{await helpers.runMessageAction(`search`,opts)})}function registerMessagePinCommands(message,helpers){helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`pin`).description(`Pin a message`))).requiredOption(`--message-id <id>`,`Message id`).action(async opts=>{await helpers.runMessageAction(`pin`,opts)}),helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`unpin`).description(`Unpin a message`))).requiredOption(`--message-id <id>`,`Message id`).action(async opts=>{await helpers.runMessageAction(`unpin`,opts)}),helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`pins`).description(`List pinned messages`))).option(`--limit <n>`,`Result limit`).action(async opts=>{await helpers.runMessageAction(`list-pins`,opts)})}function registerMessagePollCommand(message,helpers){helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`poll`).description(`Send a poll`))).requiredOption(`--poll-question <text>`,`Poll question`).option(`--poll-option <choice>`,`Poll option (repeat 2-12 times)`,collectOption,[]).option(`--poll-multi`,`Allow multiple selections`,!1).option(`--poll-duration-hours <n>`,`Poll duration in hours (Discord)`).option(`--poll-duration-seconds <n>`,`Poll duration in seconds (Telegram; 5-600)`).option(`--poll-anonymous`,`Send an anonymous poll (Telegram)`,!1).option(`--poll-public`,`Send a non-anonymous poll (Telegram)`,!1).option(`-m, --message <text>`,`Optional message body`).option(`--silent`,`Send poll silently without notification (Telegram + Discord where supported)`,!1).option(`--thread-id <id>`,`Thread id (Telegram forum topic / Slack thread ts)`).action(async opts=>{await helpers.runMessageAction(`poll`,opts)})}function registerMessageReactionsCommands(message,helpers){helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`react`).description(`Add or remove a reaction`))).requiredOption(`--message-id <id>`,`Message id`).option(`--emoji <emoji>`,`Emoji for reactions`).option(`--remove`,`Remove reaction`,!1).option(`--participant <id>`,`WhatsApp reaction participant`).option(`--from-me`,`WhatsApp reaction fromMe`,!1).option(`--target-author <id>`,`Signal reaction target author (uuid or phone)`).option(`--target-author-uuid <uuid>`,`Signal reaction target author uuid`).action(async opts=>{await helpers.runMessageAction(`react`,opts)}),helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`reactions`).description(`List reactions on a message`))).requiredOption(`--message-id <id>`,`Message id`).option(`--limit <n>`,`Result limit`).action(async opts=>{await helpers.runMessageAction(`reactions`,opts)})}function registerMessageReadEditDeleteCommands(message,helpers){helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`read`).description(`Read recent messages`))).option(`--limit <n>`,`Result limit`).option(`--before <id>`,`Read/search before id`).option(`--after <id>`,`Read/search after id`).option(`--around <id>`,`Read around id`).option(`--include-thread`,`Include thread replies (Discord)`,!1).action(async opts=>{await helpers.runMessageAction(`read`,opts)}),helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`edit`).description(`Edit a message`).requiredOption(`--message-id <id>`,`Message id`).requiredOption(`-m, --message <text>`,`Message body`))).option(`--thread-id <id>`,`Thread id (Telegram forum thread)`).action(async opts=>{await helpers.runMessageAction(`edit`,opts)}),helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`delete`).description(`Delete a message`).requiredOption(`--message-id <id>`,`Message id`))).action(async opts=>{await helpers.runMessageAction(`delete`,opts)})}function registerMessageSendCommand(message,helpers){helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`send`).description(`Send a message`).option(`-m, --message <text>`,`Message body (required unless --media is set)`)).option(`--media <path-or-url>`,`Attach media (image/audio/video/document). Accepts local paths or URLs.`).option(`--buttons <json>`,`Telegram inline keyboard buttons as JSON (array of button rows)`).option(`--components <json>`,`Discord components payload as JSON`).option(`--card <json>`,`Adaptive Card JSON object (when supported by the channel)`).option(`--reply-to <id>`,`Reply-to message id`).option(`--thread-id <id>`,`Thread id (Telegram forum thread)`).option(`--gif-playback`,`Treat video media as GIF playback (WhatsApp only).`,!1).option(`--silent`,`Send message silently without notification (Telegram + Discord)`,!1)).action(async opts=>{await helpers.runMessageAction(`send`,opts)})}function registerMessageThreadCommands(message,helpers){let thread=message.command(`thread`).description(`Thread actions`);helpers.withMessageBase(helpers.withRequiredMessageTarget(thread.command(`create`).description(`Create a thread`).requiredOption(`--thread-name <name>`,`Thread name`))).option(`--message-id <id>`,`Message id (optional)`).option(`-m, --message <text>`,`Initial thread message text`).option(`--auto-archive-min <n>`,`Thread auto-archive minutes`).action(async opts=>{await helpers.runMessageAction(`thread-create`,opts)}),helpers.withMessageBase(thread.command(`list`).description(`List threads`).requiredOption(`--guild-id <id>`,`Guild id`)).option(`--channel-id <id>`,`Channel id`).option(`--include-archived`,`Include archived threads`,!1).option(`--before <id>`,`Read/search before id`).option(`--limit <n>`,`Result limit`).action(async opts=>{await helpers.runMessageAction(`thread-list`,opts)}),helpers.withMessageBase(helpers.withRequiredMessageTarget(thread.command(`reply`).description(`Reply in a thread`).requiredOption(`-m, --message <text>`,`Message body`))).option(`--media <path-or-url>`,`Attach media (image/audio/video/document). Accepts local paths or URLs.`).option(`--reply-to <id>`,`Reply-to message id`).action(async opts=>{await helpers.runMessageAction(`thread-reply`,opts)})}function registerMessageCommands(program,ctx){let message=program.command(`message`).description(`Send, read, and manage messages and channel actions`).addHelpText(`after`,()=>`
1
+ import"./paths-5FcIFMsj.js";import{B as theme,O as danger,P as setVerbose,z as isRich}from"./utils-DbaBVFaK.js";import"./embedded-helpers-3FEGD_4b.js";import{K as CHANNEL_MESSAGE_ACTION_NAMES,L as runMessageAction,W as formatTargetDisplay,ot as CHANNEL_TARGETS_DESCRIPTION,st as CHANNEL_TARGET_DESCRIPTION}from"./reply-CpGH-3If.js";import"./session-key-EoB0qaG9.js";import"./builderforce-root-D64_sXEi.js";import{i as defaultRuntime}from"./subsystem-B3TqcCrZ.js";import{o as getChatChannelMeta,u as normalizeChatChannelId}from"./registry-TdK-aV05.js";import"./logger-Bch0bx9c.js";import"./exec-DdcIjeyn.js";import"./agent-scope-DPtjOxzp.js";import"./model-selection-DX_WOc2P.js";import"./env-file-BI2jpOmF.js";import"./boolean-Cn4K2fc9.js";import"./env-BHP32i7Q.js";import{r as loadConfig}from"./io-YzT_09GD.js";import"./manifest-registry-BVDm_CP0.js";import"./config-8x9ZIdfF.js";import"./runner-C651oVfk.js";import"./model-catalog-C7PdRY6w.js";import"./sandbox-DzuXOMNa.js";import"./chrome-Dk-WNIhp.js";import"./tailscale-B-VKIlWm.js";import"./auth-CDcrUXYB.js";import"./server-context-DsuST81W.js";import"./frontmatter-DyJ2unbL.js";import"./skills-B4r9m770.js";import"./plugin-skills-C39wi4uD.js";import"./routes-DoGqdgOP.js";import"./redact-C3oo7_aY.js";import"./errors-CjmtpPBP.js";import"./paths-C1QKdGJX.js";import"./ssrf-4MnoQ7Sz.js";import"./image-ops-CONrkLJK.js";import"./store-BoTKCB2d.js";import"./ports-BNC_iRpw.js";import"./trash-Czxs8cUf.js";import"./sessions-OZNhnSwZ.js";import{h as GATEWAY_CLIENT_NAMES,m as GATEWAY_CLIENT_MODES}from"./message-channel-DrfCCUg4.js";import{t as getChannelPlugin}from"./plugins-COtQnUML.js";import"./accounts-CTKk3xPO.js";import"./accounts-DFqpWzeU.js";import"./accounts-CbQihLRU.js";import"./bindings-DMDv84HS.js";import"./send-Dmzp1gNF.js";import"./send-DEgD1Cfd.js";import"./paths-CkcK939O.js";import"./src-D2-7sOAX.js";import"./tool-images-DsKy1uNN.js";import"./tool-display-TRKLY-yH.js";import"./fetch-guard-BQuCLA1C.js";import"./api-key-rotation-ChHXb1Pq.js";import"./fetch-CDeJQlzN.js";import"./sqlite-DEiKj1vi.js";import"./tokens-Ct4DyfhX.js";import"./project-context-store-BS994lZX.js";import"./with-timeout-YbYylXgf.js";import{T as runGlobalGatewayStopSafely}from"./deliver-XGIFv80r.js";import"./send-DlPwTVpG.js";import"./workspace-ChbaDWgp.js";import"./reply-prefix-BwtP84WV.js";import"./memory-cli-DWEtZrJ5.js";import"./manager-VPNjVm0W.js";import"./retry-Jis-ZZfm.js";import"./client-DhlZRznX.js";import"./call-DwWslKWv.js";import"./common-NHQnma5l.js";import"./chunk-h7FZEwW2.js";import"./markdown-tables-DOq8FfUr.js";import"./ir-AM9J0QtO.js";import"./render-CSLaFZoy.js";import"./builderforcellm-syscheck-DGZKIwPC.js";import"./send-DglIOKdS.js";import"./outbound-attachment-TWzrIR9Q.js";import"./fetch-B6_hd7w9.js";import"./delivery-queue-BZWZDdpJ.js";import"./channel-activity-qRD5c3VV.js";import"./tables-DirB1oU7.js";import"./pairing-store-DIpKOfDK.js";import{t as formatDocsLink}from"./links-CYRGsVCu.js";import{n as runCommandWithRuntime}from"./cli-utils-BLNnV_WG.js";import{t as formatHelpExamples}from"./help-format-NhTn4dWd.js";import{n as withProgress}from"./progress-OKwbfa23.js";import"./resolve-route-BvfmiLqC.js";import"./replies-BoxyKuBS.js";import"./refresh-DgTiir08.js";import"./coding-tools.policy-BJQuylwM.js";import"./send-BgdpJymE.js";import"./onboard-helpers-CPmBeDvt.js";import"./prompt-style-BwwmGo3-.js";import"./pairing-labels-CELZqNBC.js";import"./session-cost-usage-pgxrRRW4.js";import"./provider-usage-CbH7sm73.js";import"./active-listener-DBdxNyOd.js";import"./exec-approvals-kmxxyvIe.js";import"./nodes-screen-BWDONgPE.js";import"./project-context-Cg0S9eFT.js";import"./control-service-BhSaBRxC.js";import"./stagger-NaB6u1z1.js";import"./channel-selection-CQ5MM7Hi.js";import"./mamba-state-engine-BloJzrxU.js";import"./transformers-stream-QS2dnQob.js";import{t as createDefaultDeps}from"./deps-C4YVdrEi.js";import{t as collectOption}from"./helpers-WeAzElGL.js";import{t as ensurePluginRegistryLoaded}from"./plugin-registry-CAy3I1K1.js";import{t as renderTable}from"./table-BKeTpiIp.js";import{t as createOutboundSendDeps}from"./outbound-send-deps-DS_1j6Dm.js";const resolveChannelLabel$1=channel=>{let pluginLabel=getChannelPlugin(channel)?.meta.label;if(pluginLabel)return pluginLabel;let normalized=normalizeChatChannelId(channel);return normalized?getChatChannelMeta(normalized).label:channel};function formatOutboundDeliverySummary(channel,result){if(!result)return`✅ Sent via ${resolveChannelLabel$1(channel)}. Message ID: unknown`;let base=`✅ Sent via ${resolveChannelLabel$1(result.channel)}. Message ID: ${result.messageId}`;return`chatId`in result?`${base} (chat ${result.chatId})`:`channelId`in result?`${base} (channel ${result.channelId})`:`roomId`in result?`${base} (room ${result.roomId})`:`conversationId`in result?`${base} (conversation ${result.conversationId})`:base}function formatGatewaySummary(params){return`✅ ${params.action??`Sent`} via gateway${params.channel?` (${params.channel})`:``}. Message ID: ${params.messageId??`unknown`}`}const shortenText=(value,maxLen)=>{let chars=Array.from(value);return chars.length<=maxLen?value:`${chars.slice(0,Math.max(0,maxLen-1)).join(``)}…`},resolveChannelLabel=channel=>getChannelPlugin(channel)?.meta.label??channel;function extractMessageId(payload){if(!payload||typeof payload!=`object`)return null;let direct=payload.messageId;if(typeof direct==`string`&&direct.trim())return direct.trim();let result=payload.result;if(result&&typeof result==`object`){let nested=result.messageId;if(typeof nested==`string`&&nested.trim())return nested.trim()}return null}function buildMessageCliJson(result){return{action:result.action,channel:result.channel,dryRun:result.dryRun,handledBy:result.handledBy,payload:result.payload}}function renderObjectSummary(payload,opts){if(!payload||typeof payload!=`object`)return[String(payload)];let obj=payload,keys=Object.keys(obj);if(keys.length===0)return[theme.muted(`(empty)`)];let rows=keys.slice(0,20).map(k=>{let v=obj[k];return{Key:k,Value:shortenText(v==null?`null`:Array.isArray(v)?`${v.length} items`:typeof v==`object`?`object`:typeof v==`string`?v:typeof v==`number`?String(v):typeof v==`boolean`?v?`true`:`false`:typeof v==`bigint`||typeof v==`symbol`?v.toString():typeof v==`function`?`function`:`unknown`,96)}});return[renderTable({width:opts.width,columns:[{key:`Key`,header:`Key`,minWidth:16},{key:`Value`,header:`Value`,flex:!0,minWidth:24}],rows}).trimEnd()]}function renderMessageList(messages,opts,emptyLabel){let rows=messages.slice(0,25).map(m=>{let msg=m,id=typeof msg.id==`string`&&msg.id||typeof msg.ts==`string`&&msg.ts||typeof msg.messageId==`string`&&msg.messageId||``,authorObj=msg.author,author=typeof msg.authorTag==`string`&&msg.authorTag||typeof authorObj?.username==`string`&&authorObj.username||typeof msg.user==`string`&&msg.user||``,time=typeof msg.timestamp==`string`&&msg.timestamp||typeof msg.ts==`string`&&msg.ts||``,text=typeof msg.content==`string`&&msg.content||typeof msg.text==`string`&&msg.text||``;return{Time:shortenText(time,28),Author:shortenText(author,22),Text:shortenText(text.replace(/\s+/g,` `).trim(),90),Id:shortenText(id,22)}});return rows.length===0?[theme.muted(emptyLabel)]:[renderTable({width:opts.width,columns:[{key:`Time`,header:`Time`,minWidth:14},{key:`Author`,header:`Author`,minWidth:10},{key:`Text`,header:`Text`,flex:!0,minWidth:24},{key:`Id`,header:`Id`,minWidth:10}],rows}).trimEnd()]}function renderMessagesFromPayload(payload,opts){if(!payload||typeof payload!=`object`)return null;let messages=payload.messages;return Array.isArray(messages)?renderMessageList(messages,opts,`No messages.`):null}function renderPinsFromPayload(payload,opts){if(!payload||typeof payload!=`object`)return null;let pins=payload.pins;return Array.isArray(pins)?renderMessageList(pins,opts,`No pins.`):null}function extractDiscordSearchResultsMessages(results){if(!results||typeof results!=`object`)return null;let raw=results.messages;if(!Array.isArray(raw))return null;let flattened=[];for(let entry of raw)Array.isArray(entry)&&entry.length>0?flattened.push(entry[0]):entry&&typeof entry==`object`&&flattened.push(entry);return flattened.length?flattened:null}function renderReactions(payload,opts){if(!payload||typeof payload!=`object`)return null;let reactions=payload.reactions;if(!Array.isArray(reactions))return null;let rows=reactions.slice(0,50).map(r=>{let entry=r,emojiObj=entry.emoji;return{Emoji:typeof emojiObj?.raw==`string`&&emojiObj.raw||typeof entry.name==`string`&&entry.name||typeof entry.emoji==`string`&&entry.emoji||``,Count:typeof entry.count==`number`?String(entry.count):``,Users:shortenText((Array.isArray(entry.users)?entry.users.slice(0,8).map(u=>{if(typeof u==`string`)return u;if(!u||typeof u!=`object`)return``;let user=u;return typeof user.tag==`string`&&user.tag||typeof user.username==`string`&&user.username||typeof user.id==`string`&&user.id||``}).filter(Boolean):[]).join(`, `),72)}});return rows.length===0?[theme.muted(`No reactions.`)]:[renderTable({width:opts.width,columns:[{key:`Emoji`,header:`Emoji`,minWidth:8},{key:`Count`,header:`Count`,align:`right`,minWidth:6},{key:`Users`,header:`Users`,flex:!0,minWidth:20}],rows}).trimEnd()]}function formatMessageCliText(result){let rich=isRich(),ok=text=>rich?theme.success(text):text,muted=text=>rich?theme.muted(text):text,heading=text=>rich?theme.heading(text):text,opts={width:Math.max(60,(process.stdout.columns??120)-1)};if(result.handledBy===`dry-run`)return[muted(`[dry-run] would run ${result.action} via ${result.channel}`)];if(result.kind===`broadcast`){let results=result.payload.results??[],rows=results.map(entry=>({Channel:resolveChannelLabel(entry.channel),Target:shortenText(formatTargetDisplay({channel:entry.channel,target:entry.to}),36),Status:entry.ok?`ok`:`error`,Error:entry.ok?``:shortenText(entry.error??`unknown error`,48)})),okCount=results.filter(entry=>entry.ok).length,total=results.length;return[ok(`✅ Broadcast complete (${okCount}/${total} succeeded, ${total-okCount} failed)`),renderTable({width:opts.width,columns:[{key:`Channel`,header:`Channel`,minWidth:10},{key:`Target`,header:`Target`,minWidth:12,flex:!0},{key:`Status`,header:`Status`,minWidth:6},{key:`Error`,header:`Error`,minWidth:20,flex:!0}],rows:rows.slice(0,50)}).trimEnd()]}if(result.kind===`send`){if(result.handledBy===`core`&&result.sendResult){let send=result.sendResult;if(send.via===`direct`){let directResult=send.result;return[ok(formatOutboundDeliverySummary(send.channel,directResult))]}let gatewayResult=send.result;return[ok(formatGatewaySummary({channel:send.channel,messageId:gatewayResult?.messageId??null}))]}let label=resolveChannelLabel(result.channel),msgId=extractMessageId(result.payload);return[ok(`✅ Sent via ${label}.${msgId?` Message ID: ${msgId}`:``}`)]}if(result.kind===`poll`){if(result.handledBy===`core`&&result.pollResult){let poll=result.pollResult,pollId=poll.result?.pollId,msgId=poll.result?.messageId??null,lines=[ok(formatGatewaySummary({action:`Poll sent`,channel:poll.channel,messageId:msgId}))];return pollId&&lines.push(ok(`Poll id: ${pollId}`)),lines}let label=resolveChannelLabel(result.channel),msgId=extractMessageId(result.payload);return[ok(`✅ Poll sent via ${label}.${msgId?` Message ID: ${msgId}`:``}`)]}let payload=result.payload,lines=[];if(result.action===`react`){let added=payload.added,removed=payload.removed;if(typeof added==`string`&&added.trim())return lines.push(ok(`✅ Reaction added: ${added.trim()}`)),lines;if(typeof removed==`string`&&removed.trim())return lines.push(ok(`✅ Reaction removed: ${removed.trim()}`)),lines;if(Array.isArray(removed)){let list=removed.map(x=>String(x).trim()).filter(Boolean).join(`, `);return lines.push(ok(`✅ Reactions removed${list?`: ${list}`:``}`)),lines}return lines.push(ok(`✅ Reaction updated.`)),lines}let reactionsTable=renderReactions(payload,opts);if(reactionsTable&&result.action===`reactions`)return lines.push(heading(`Reactions`)),lines.push(reactionsTable[0]??``),lines;if(result.action===`read`){let messagesTable=renderMessagesFromPayload(payload,opts);if(messagesTable)return lines.push(heading(`Messages`)),lines.push(messagesTable[0]??``),lines}if(result.action===`list-pins`){let pinsTable=renderPinsFromPayload(payload,opts);if(pinsTable)return lines.push(heading(`Pinned messages`)),lines.push(pinsTable[0]??``),lines}if(result.action===`search`){let results=payload.results,list=extractDiscordSearchResultsMessages(results);if(list)return lines.push(heading(`Search results`)),lines.push(renderMessageList(list,opts,`No results.`)[0]??``),lines}lines.push(ok(`✅ ${result.action} via ${resolveChannelLabel(result.channel)}.`));let summary=renderObjectSummary(payload,opts);return summary.length&&(lines.push(``),lines.push(...summary),lines.push(``),lines.push(muted(`Tip: use --json for full output.`))),lines}async function messageCommand(opts,deps,runtime){let cfg=loadConfig(),actionInput=(typeof opts.action==`string`?opts.action.trim():``)||`send`,actionMatch=CHANNEL_MESSAGE_ACTION_NAMES.find(name=>name.toLowerCase()===actionInput.toLowerCase());if(!actionMatch)throw Error(`Unknown message action: ${actionInput}`);let action=actionMatch,outboundDeps=createOutboundSendDeps(deps),run=async()=>await runMessageAction({cfg,action,params:opts,deps:outboundDeps,gateway:{clientName:GATEWAY_CLIENT_NAMES.CLI,mode:GATEWAY_CLIENT_MODES.CLI}}),json=opts.json===!0,dryRun=opts.dryRun===!0,result=!json&&!dryRun&&(action===`send`||action===`poll`)?await withProgress({label:action===`poll`?`Sending poll...`:`Sending...`,indeterminate:!0,enabled:!0},run):await run();if(json){runtime.log(JSON.stringify(buildMessageCliJson(result),null,2));return}for(let line of formatMessageCliText(result))runtime.log(line)}function normalizeMessageOptions(opts){let{account,...rest}=opts;return{...rest,accountId:typeof account==`string`?account:void 0}}async function runPluginStopHooks(){await runGlobalGatewayStopSafely({event:{reason:`cli message action complete`},ctx:{},onError:err=>defaultRuntime.error(danger(`gateway_stop hook failed: ${String(err)}`))})}function createMessageCliHelpers(message,messageChannelOptions){return{withMessageBase:command=>command.option(`--channel <channel>`,`Channel: ${messageChannelOptions}`).option(`--account <id>`,`Channel account id (accountId)`).option(`--json`,`Output result as JSON`,!1).option(`--dry-run`,`Print payload and skip sending`,!1).option(`--verbose`,`Verbose logging`,!1),withMessageTarget:command=>command.option(`-t, --target <dest>`,CHANNEL_TARGET_DESCRIPTION),withRequiredMessageTarget:command=>command.requiredOption(`-t, --target <dest>`,CHANNEL_TARGET_DESCRIPTION),runMessageAction:async(action,opts)=>{setVerbose(!!opts.verbose),ensurePluginRegistryLoaded();let deps=createDefaultDeps(),failed=!1;await runCommandWithRuntime(defaultRuntime,async()=>{await messageCommand({...normalizeMessageOptions(opts),action},deps,defaultRuntime)},err=>{failed=!0,defaultRuntime.error(danger(String(err)))}),await runPluginStopHooks(),defaultRuntime.exit(failed?1:0)}}}function registerMessageBroadcastCommand(message,helpers){helpers.withMessageBase(message.command(`broadcast`).description(`Broadcast a message to multiple targets`)).requiredOption(`--targets <target...>`,CHANNEL_TARGETS_DESCRIPTION).option(`--message <text>`,`Message to send`).option(`--media <url>`,`Media URL`).action(async options=>{await helpers.runMessageAction(`broadcast`,options)})}function registerMessageDiscordAdminCommands(message,helpers){let role=message.command(`role`).description(`Role actions`);helpers.withMessageBase(role.command(`info`).description(`List roles`).requiredOption(`--guild-id <id>`,`Guild id`)).action(async opts=>{await helpers.runMessageAction(`role-info`,opts)}),helpers.withMessageBase(role.command(`add`).description(`Add role to a member`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--user-id <id>`,`User id`).requiredOption(`--role-id <id>`,`Role id`)).action(async opts=>{await helpers.runMessageAction(`role-add`,opts)}),helpers.withMessageBase(role.command(`remove`).description(`Remove role from a member`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--user-id <id>`,`User id`).requiredOption(`--role-id <id>`,`Role id`)).action(async opts=>{await helpers.runMessageAction(`role-remove`,opts)});let channel=message.command(`channel`).description(`Channel actions`);helpers.withMessageBase(helpers.withRequiredMessageTarget(channel.command(`info`).description(`Fetch channel info`))).action(async opts=>{await helpers.runMessageAction(`channel-info`,opts)}),helpers.withMessageBase(channel.command(`list`).description(`List channels`).requiredOption(`--guild-id <id>`,`Guild id`)).action(async opts=>{await helpers.runMessageAction(`channel-list`,opts)});let member=message.command(`member`).description(`Member actions`);helpers.withMessageBase(member.command(`info`).description(`Fetch member info`).requiredOption(`--user-id <id>`,`User id`)).option(`--guild-id <id>`,`Guild id (Discord)`).action(async opts=>{await helpers.runMessageAction(`member-info`,opts)});let voice=message.command(`voice`).description(`Voice actions`);helpers.withMessageBase(voice.command(`status`).description(`Fetch voice status`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--user-id <id>`,`User id`)).action(async opts=>{await helpers.runMessageAction(`voice-status`,opts)});let event=message.command(`event`).description(`Event actions`);helpers.withMessageBase(event.command(`list`).description(`List scheduled events`).requiredOption(`--guild-id <id>`,`Guild id`)).action(async opts=>{await helpers.runMessageAction(`event-list`,opts)}),helpers.withMessageBase(event.command(`create`).description(`Create a scheduled event`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--event-name <name>`,`Event name`).requiredOption(`--start-time <iso>`,`Event start time`)).option(`--end-time <iso>`,`Event end time`).option(`--desc <text>`,`Event description`).option(`--channel-id <id>`,`Channel id`).option(`--location <text>`,`Event location`).option(`--event-type <stage|external|voice>`,`Event type`).action(async opts=>{await helpers.runMessageAction(`event-create`,opts)}),helpers.withMessageBase(message.command(`timeout`).description(`Timeout a member`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--user-id <id>`,`User id`)).option(`--duration-min <n>`,`Timeout duration minutes`).option(`--until <iso>`,`Timeout until`).option(`--reason <text>`,`Moderation reason`).action(async opts=>{await helpers.runMessageAction(`timeout`,opts)}),helpers.withMessageBase(message.command(`kick`).description(`Kick a member`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--user-id <id>`,`User id`)).option(`--reason <text>`,`Moderation reason`).action(async opts=>{await helpers.runMessageAction(`kick`,opts)}),helpers.withMessageBase(message.command(`ban`).description(`Ban a member`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--user-id <id>`,`User id`)).option(`--reason <text>`,`Moderation reason`).option(`--delete-days <n>`,`Ban delete message days`).action(async opts=>{await helpers.runMessageAction(`ban`,opts)})}function registerMessageEmojiCommands(message,helpers){let emoji=message.command(`emoji`).description(`Emoji actions`);helpers.withMessageBase(emoji.command(`list`).description(`List emojis`)).option(`--guild-id <id>`,`Guild id (Discord)`).action(async opts=>{await helpers.runMessageAction(`emoji-list`,opts)}),helpers.withMessageBase(emoji.command(`upload`).description(`Upload an emoji`).requiredOption(`--guild-id <id>`,`Guild id`)).requiredOption(`--emoji-name <name>`,`Emoji name`).requiredOption(`--media <path-or-url>`,`Emoji media (path or URL)`).option(`--role-ids <id>`,`Role id (repeat)`,collectOption,[]).action(async opts=>{await helpers.runMessageAction(`emoji-upload`,opts)})}function registerMessageStickerCommands(message,helpers){let sticker=message.command(`sticker`).description(`Sticker actions`);helpers.withMessageBase(helpers.withRequiredMessageTarget(sticker.command(`send`).description(`Send stickers`))).requiredOption(`--sticker-id <id>`,`Sticker id (repeat)`,collectOption).option(`-m, --message <text>`,`Optional message body`).action(async opts=>{await helpers.runMessageAction(`sticker`,opts)}),helpers.withMessageBase(sticker.command(`upload`).description(`Upload a sticker`).requiredOption(`--guild-id <id>`,`Guild id`)).requiredOption(`--sticker-name <name>`,`Sticker name`).requiredOption(`--sticker-desc <text>`,`Sticker description`).requiredOption(`--sticker-tags <tags>`,`Sticker tags`).requiredOption(`--media <path-or-url>`,`Sticker media (path or URL)`).action(async opts=>{await helpers.runMessageAction(`sticker-upload`,opts)})}function registerMessagePermissionsCommand(message,helpers){helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`permissions`).description(`Fetch channel permissions`))).action(async opts=>{await helpers.runMessageAction(`permissions`,opts)})}function registerMessageSearchCommand(message,helpers){helpers.withMessageBase(message.command(`search`).description(`Search Discord messages`)).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--query <text>`,`Search query`).option(`--channel-id <id>`,`Channel id`).option(`--channel-ids <id>`,`Channel id (repeat)`,collectOption,[]).option(`--author-id <id>`,`Author id`).option(`--author-ids <id>`,`Author id (repeat)`,collectOption,[]).option(`--limit <n>`,`Result limit`).action(async opts=>{await helpers.runMessageAction(`search`,opts)})}function registerMessagePinCommands(message,helpers){helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`pin`).description(`Pin a message`))).requiredOption(`--message-id <id>`,`Message id`).action(async opts=>{await helpers.runMessageAction(`pin`,opts)}),helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`unpin`).description(`Unpin a message`))).requiredOption(`--message-id <id>`,`Message id`).action(async opts=>{await helpers.runMessageAction(`unpin`,opts)}),helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`pins`).description(`List pinned messages`))).option(`--limit <n>`,`Result limit`).action(async opts=>{await helpers.runMessageAction(`list-pins`,opts)})}function registerMessagePollCommand(message,helpers){helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`poll`).description(`Send a poll`))).requiredOption(`--poll-question <text>`,`Poll question`).option(`--poll-option <choice>`,`Poll option (repeat 2-12 times)`,collectOption,[]).option(`--poll-multi`,`Allow multiple selections`,!1).option(`--poll-duration-hours <n>`,`Poll duration in hours (Discord)`).option(`--poll-duration-seconds <n>`,`Poll duration in seconds (Telegram; 5-600)`).option(`--poll-anonymous`,`Send an anonymous poll (Telegram)`,!1).option(`--poll-public`,`Send a non-anonymous poll (Telegram)`,!1).option(`-m, --message <text>`,`Optional message body`).option(`--silent`,`Send poll silently without notification (Telegram + Discord where supported)`,!1).option(`--thread-id <id>`,`Thread id (Telegram forum topic / Slack thread ts)`).action(async opts=>{await helpers.runMessageAction(`poll`,opts)})}function registerMessageReactionsCommands(message,helpers){helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`react`).description(`Add or remove a reaction`))).requiredOption(`--message-id <id>`,`Message id`).option(`--emoji <emoji>`,`Emoji for reactions`).option(`--remove`,`Remove reaction`,!1).option(`--participant <id>`,`WhatsApp reaction participant`).option(`--from-me`,`WhatsApp reaction fromMe`,!1).option(`--target-author <id>`,`Signal reaction target author (uuid or phone)`).option(`--target-author-uuid <uuid>`,`Signal reaction target author uuid`).action(async opts=>{await helpers.runMessageAction(`react`,opts)}),helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`reactions`).description(`List reactions on a message`))).requiredOption(`--message-id <id>`,`Message id`).option(`--limit <n>`,`Result limit`).action(async opts=>{await helpers.runMessageAction(`reactions`,opts)})}function registerMessageReadEditDeleteCommands(message,helpers){helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`read`).description(`Read recent messages`))).option(`--limit <n>`,`Result limit`).option(`--before <id>`,`Read/search before id`).option(`--after <id>`,`Read/search after id`).option(`--around <id>`,`Read around id`).option(`--include-thread`,`Include thread replies (Discord)`,!1).action(async opts=>{await helpers.runMessageAction(`read`,opts)}),helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`edit`).description(`Edit a message`).requiredOption(`--message-id <id>`,`Message id`).requiredOption(`-m, --message <text>`,`Message body`))).option(`--thread-id <id>`,`Thread id (Telegram forum thread)`).action(async opts=>{await helpers.runMessageAction(`edit`,opts)}),helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`delete`).description(`Delete a message`).requiredOption(`--message-id <id>`,`Message id`))).action(async opts=>{await helpers.runMessageAction(`delete`,opts)})}function registerMessageSendCommand(message,helpers){helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`send`).description(`Send a message`).option(`-m, --message <text>`,`Message body (required unless --media is set)`)).option(`--media <path-or-url>`,`Attach media (image/audio/video/document). Accepts local paths or URLs.`).option(`--buttons <json>`,`Telegram inline keyboard buttons as JSON (array of button rows)`).option(`--components <json>`,`Discord components payload as JSON`).option(`--card <json>`,`Adaptive Card JSON object (when supported by the channel)`).option(`--reply-to <id>`,`Reply-to message id`).option(`--thread-id <id>`,`Thread id (Telegram forum thread)`).option(`--gif-playback`,`Treat video media as GIF playback (WhatsApp only).`,!1).option(`--silent`,`Send message silently without notification (Telegram + Discord)`,!1)).action(async opts=>{await helpers.runMessageAction(`send`,opts)})}function registerMessageThreadCommands(message,helpers){let thread=message.command(`thread`).description(`Thread actions`);helpers.withMessageBase(helpers.withRequiredMessageTarget(thread.command(`create`).description(`Create a thread`).requiredOption(`--thread-name <name>`,`Thread name`))).option(`--message-id <id>`,`Message id (optional)`).option(`-m, --message <text>`,`Initial thread message text`).option(`--auto-archive-min <n>`,`Thread auto-archive minutes`).action(async opts=>{await helpers.runMessageAction(`thread-create`,opts)}),helpers.withMessageBase(thread.command(`list`).description(`List threads`).requiredOption(`--guild-id <id>`,`Guild id`)).option(`--channel-id <id>`,`Channel id`).option(`--include-archived`,`Include archived threads`,!1).option(`--before <id>`,`Read/search before id`).option(`--limit <n>`,`Result limit`).action(async opts=>{await helpers.runMessageAction(`thread-list`,opts)}),helpers.withMessageBase(helpers.withRequiredMessageTarget(thread.command(`reply`).description(`Reply in a thread`).requiredOption(`-m, --message <text>`,`Message body`))).option(`--media <path-or-url>`,`Attach media (image/audio/video/document). Accepts local paths or URLs.`).option(`--reply-to <id>`,`Reply-to message id`).action(async opts=>{await helpers.runMessageAction(`thread-reply`,opts)})}function registerMessageCommands(program,ctx){let message=program.command(`message`).description(`Send, read, and manage messages and channel actions`).addHelpText(`after`,()=>`
2
2
  ${theme.heading(`Examples:`)}
3
3
  ${formatHelpExamples([[`builderforce message send --target +15555550123 --message "Hi"`,`Send a text message.`],[`builderforce message send --target +15555550123 --message "Hi" --media photo.jpg`,`Send a message with media.`],[`builderforce message poll --channel discord --target channel:123 --poll-question "Snack?" --poll-option Pizza --poll-option Sushi`,`Create a Discord poll.`],[`builderforce message react --channel discord --target 123 --message-id 456 --emoji "✅"`,`React to a message.`]])}
4
4
 
@@ -1,4 +1,4 @@
1
- import"./paths-BHg-VHB4.js";import{o as getChatChannelMeta,u as normalizeChatChannelId}from"./registry-Cv7CoWAs.js";import{D as danger,N as setVerbose,R as isRich,z as theme}from"./utils-BP60e80M.js";import{p as defaultRuntime}from"./subsystem-C4b1Von0.js";import"./boolean-ssGoaBPk.js";import"./env-BoE8QSib.js";import"./warning-filter-nSTjpMIH.js";import"./auth-profiles-BARnVAUE.js";import"./logger-AbH8mdkv.js";import"./session-key-D--2AEus.js";import"./builderforce-root-D3-p8W2n.js";import"./exec-CGuYALEs.js";import"./agent-scope-BcoQBOwz.js";import"./env-file-BIKVpYUN.js";import{r as loadConfig}from"./io-BySzqKzT.js";import"./manifest-registry-DtqFvEIR.js";import"./config-Bwt58P9r.js";import"./model-discovery-DxpimsRF.js";import"./model-catalog-wcISK04b.js";import"./frontmatter-DgRc5y_l.js";import"./skills-W00EPvKR.js";import"./plugin-skills-BSUncenp.js";import"./refresh-bgGvF0aF.js";import"./client-DeQ0LbP9.js";import"./call-CjC3SRPv.js";import{h as GATEWAY_CLIENT_NAMES,m as GATEWAY_CLIENT_MODES}from"./message-channel-C-yw5fZm.js";import{Ct as CHANNEL_TARGETS_DESCRIPTION,et as runMessageAction,lt as CHANNEL_MESSAGE_ACTION_NAMES,st as formatTargetDisplay,wt as CHANNEL_TARGET_DESCRIPTION}from"./subagent-registry-oB_F2U2W.js";import"./sessions-ko0LxxGk.js";import"./src-BRo9ywDM.js";import"./project-context-store-ClFt-YDL.js";import"./tokens-BNwTTeJb.js";import{t as getChannelPlugin}from"./plugins-DJGW_fnS.js";import"./accounts-Z5bJpNrG.js";import"./bindings-D0uket3l.js";import"./send-gG3CFJwv.js";import"./send-DqJCViFb.js";import"./with-timeout-By0c7Ur9.js";import{T as runGlobalGatewayStopSafely}from"./deliver-Bs-FVPQ4.js";import"./accounts-DoJYLMfS.js";import"./send-mCN63Hkn.js";import"./image-ops-Bg9yFwjX.js";import"./redact-bWj_-q3j.js";import"./errors-t5wHPcwh.js";import"./embedded-helpers-Q5h1lA6D.js";import"./sandbox-BcH7kS1y.js";import"./chrome-IJYO1tSE.js";import"./tailscale-CgCG7AVQ.js";import"./auth-B4Kn3eee.js";import"./server-context-D3iiIzvV.js";import"./routes-7QTsp3sA.js";import"./paths-GamzES41.js";import"./ssrf-BiSQzdcA.js";import"./store-C5LmVaEC.js";import"./ports-LqFTyTSK.js";import"./trash-zs6gNxed.js";import"./accounts-BT-NzzBc.js";import"./paths-BQ9W7Bs0.js";import"./tool-images-DV2HMmx4.js";import"./workspace-Cz9mCy0P.js";import"./reply-prefix-9hmbzubX.js";import"./sqlite-BEgCClMz.js";import"./memory-cli-COgt0ROi.js";import"./manager-Cob4Ofzr.js";import"./gemini-auth-BZgBIY0M.js";import"./retry-Cc6xusE8.js";import"./common-BRdxH-uH.js";import"./runner-68-X3KHf.js";import"./tool-display-BIswnHaq.js";import"./chunk-UPhdkZNp.js";import"./markdown-tables-CpqWBduK.js";import"./fetch-guard-CoGEds8D.js";import"./fetch-CUsKv8oj.js";import"./ir-6L-eU4id.js";import"./render-1ABBE2Y6.js";import"./builderforcellm-syscheck-CyZiwcdF.js";import"./session-utils-VCGKYbgW.js";import"./coding-tools.policy-DIeVRurg.js";import"./pairing-store-tegvJa08.js";import"./fetch-CrbOFvsL.js";import"./exec-approvals-Cn0K-HtJ.js";import"./nodes-screen-OI7tHqlU.js";import"./session-cost-usage-BgZfN_WR.js";import"./provider-usage-BLkm6ojE.js";import"./send-BIR1Jhc5.js";import"./outbound-attachment-3GZbMqo1.js";import"./delivery-queue-DQXq7KUU.js";import"./project-context-DXP12xhk.js";import"./control-service-Cml__v8i.js";import"./stagger-CUH5rlmS.js";import"./channel-selection-DFf_nAm7.js";import"./send-9rUcCK7O.js";import"./resolve-route-D3X-bXU-.js";import"./channel-activity-By7lsk7N.js";import"./tables-DZSV6me6.js";import{t as formatDocsLink}from"./links-B6LU5cXN.js";import{n as runCommandWithRuntime}from"./cli-utils-ByV85M53.js";import{t as formatHelpExamples}from"./help-format-DIDk_7gh.js";import{n as withProgress}from"./progress-BQMO_-7I.js";import"./replies-CL0uQgU7.js";import"./onboard-helpers-Di5OXlap.js";import"./prompt-style-CZOeG0sw.js";import"./pairing-labels-DofkNLS2.js";import"./active-listener-BC31MA4v.js";import"./mamba-state-engine-CFwb8DcP.js";import"./transformers-stream-nSL4Xu31.js";import{t as ensurePluginRegistryLoaded}from"./plugin-registry-Ty9w94Rd.js";import{t as collectOption}from"./helpers-lceKHGsd.js";import{t as renderTable}from"./table-CiK88EDX.js";import{n as createDefaultDeps,t as createOutboundSendDeps}from"./outbound-send-deps-CsJgGsii.js";const resolveChannelLabel$1=channel=>{let pluginLabel=getChannelPlugin(channel)?.meta.label;if(pluginLabel)return pluginLabel;let normalized=normalizeChatChannelId(channel);return normalized?getChatChannelMeta(normalized).label:channel};function formatOutboundDeliverySummary(channel,result){if(!result)return`✅ Sent via ${resolveChannelLabel$1(channel)}. Message ID: unknown`;let base=`✅ Sent via ${resolveChannelLabel$1(result.channel)}. Message ID: ${result.messageId}`;return`chatId`in result?`${base} (chat ${result.chatId})`:`channelId`in result?`${base} (channel ${result.channelId})`:`roomId`in result?`${base} (room ${result.roomId})`:`conversationId`in result?`${base} (conversation ${result.conversationId})`:base}function formatGatewaySummary(params){return`✅ ${params.action??`Sent`} via gateway${params.channel?` (${params.channel})`:``}. Message ID: ${params.messageId??`unknown`}`}const shortenText=(value,maxLen)=>{let chars=Array.from(value);return chars.length<=maxLen?value:`${chars.slice(0,Math.max(0,maxLen-1)).join(``)}…`},resolveChannelLabel=channel=>getChannelPlugin(channel)?.meta.label??channel;function extractMessageId(payload){if(!payload||typeof payload!=`object`)return null;let direct=payload.messageId;if(typeof direct==`string`&&direct.trim())return direct.trim();let result=payload.result;if(result&&typeof result==`object`){let nested=result.messageId;if(typeof nested==`string`&&nested.trim())return nested.trim()}return null}function buildMessageCliJson(result){return{action:result.action,channel:result.channel,dryRun:result.dryRun,handledBy:result.handledBy,payload:result.payload}}function renderObjectSummary(payload,opts){if(!payload||typeof payload!=`object`)return[String(payload)];let obj=payload,keys=Object.keys(obj);if(keys.length===0)return[theme.muted(`(empty)`)];let rows=keys.slice(0,20).map(k=>{let v=obj[k];return{Key:k,Value:shortenText(v==null?`null`:Array.isArray(v)?`${v.length} items`:typeof v==`object`?`object`:typeof v==`string`?v:typeof v==`number`?String(v):typeof v==`boolean`?v?`true`:`false`:typeof v==`bigint`||typeof v==`symbol`?v.toString():typeof v==`function`?`function`:`unknown`,96)}});return[renderTable({width:opts.width,columns:[{key:`Key`,header:`Key`,minWidth:16},{key:`Value`,header:`Value`,flex:!0,minWidth:24}],rows}).trimEnd()]}function renderMessageList(messages,opts,emptyLabel){let rows=messages.slice(0,25).map(m=>{let msg=m,id=typeof msg.id==`string`&&msg.id||typeof msg.ts==`string`&&msg.ts||typeof msg.messageId==`string`&&msg.messageId||``,authorObj=msg.author,author=typeof msg.authorTag==`string`&&msg.authorTag||typeof authorObj?.username==`string`&&authorObj.username||typeof msg.user==`string`&&msg.user||``,time=typeof msg.timestamp==`string`&&msg.timestamp||typeof msg.ts==`string`&&msg.ts||``,text=typeof msg.content==`string`&&msg.content||typeof msg.text==`string`&&msg.text||``;return{Time:shortenText(time,28),Author:shortenText(author,22),Text:shortenText(text.replace(/\s+/g,` `).trim(),90),Id:shortenText(id,22)}});return rows.length===0?[theme.muted(emptyLabel)]:[renderTable({width:opts.width,columns:[{key:`Time`,header:`Time`,minWidth:14},{key:`Author`,header:`Author`,minWidth:10},{key:`Text`,header:`Text`,flex:!0,minWidth:24},{key:`Id`,header:`Id`,minWidth:10}],rows}).trimEnd()]}function renderMessagesFromPayload(payload,opts){if(!payload||typeof payload!=`object`)return null;let messages=payload.messages;return Array.isArray(messages)?renderMessageList(messages,opts,`No messages.`):null}function renderPinsFromPayload(payload,opts){if(!payload||typeof payload!=`object`)return null;let pins=payload.pins;return Array.isArray(pins)?renderMessageList(pins,opts,`No pins.`):null}function extractDiscordSearchResultsMessages(results){if(!results||typeof results!=`object`)return null;let raw=results.messages;if(!Array.isArray(raw))return null;let flattened=[];for(let entry of raw)Array.isArray(entry)&&entry.length>0?flattened.push(entry[0]):entry&&typeof entry==`object`&&flattened.push(entry);return flattened.length?flattened:null}function renderReactions(payload,opts){if(!payload||typeof payload!=`object`)return null;let reactions=payload.reactions;if(!Array.isArray(reactions))return null;let rows=reactions.slice(0,50).map(r=>{let entry=r,emojiObj=entry.emoji;return{Emoji:typeof emojiObj?.raw==`string`&&emojiObj.raw||typeof entry.name==`string`&&entry.name||typeof entry.emoji==`string`&&entry.emoji||``,Count:typeof entry.count==`number`?String(entry.count):``,Users:shortenText((Array.isArray(entry.users)?entry.users.slice(0,8).map(u=>{if(typeof u==`string`)return u;if(!u||typeof u!=`object`)return``;let user=u;return typeof user.tag==`string`&&user.tag||typeof user.username==`string`&&user.username||typeof user.id==`string`&&user.id||``}).filter(Boolean):[]).join(`, `),72)}});return rows.length===0?[theme.muted(`No reactions.`)]:[renderTable({width:opts.width,columns:[{key:`Emoji`,header:`Emoji`,minWidth:8},{key:`Count`,header:`Count`,align:`right`,minWidth:6},{key:`Users`,header:`Users`,flex:!0,minWidth:20}],rows}).trimEnd()]}function formatMessageCliText(result){let rich=isRich(),ok=text=>rich?theme.success(text):text,muted=text=>rich?theme.muted(text):text,heading=text=>rich?theme.heading(text):text,opts={width:Math.max(60,(process.stdout.columns??120)-1)};if(result.handledBy===`dry-run`)return[muted(`[dry-run] would run ${result.action} via ${result.channel}`)];if(result.kind===`broadcast`){let results=result.payload.results??[],rows=results.map(entry=>({Channel:resolveChannelLabel(entry.channel),Target:shortenText(formatTargetDisplay({channel:entry.channel,target:entry.to}),36),Status:entry.ok?`ok`:`error`,Error:entry.ok?``:shortenText(entry.error??`unknown error`,48)})),okCount=results.filter(entry=>entry.ok).length,total=results.length;return[ok(`✅ Broadcast complete (${okCount}/${total} succeeded, ${total-okCount} failed)`),renderTable({width:opts.width,columns:[{key:`Channel`,header:`Channel`,minWidth:10},{key:`Target`,header:`Target`,minWidth:12,flex:!0},{key:`Status`,header:`Status`,minWidth:6},{key:`Error`,header:`Error`,minWidth:20,flex:!0}],rows:rows.slice(0,50)}).trimEnd()]}if(result.kind===`send`){if(result.handledBy===`core`&&result.sendResult){let send=result.sendResult;if(send.via===`direct`){let directResult=send.result;return[ok(formatOutboundDeliverySummary(send.channel,directResult))]}let gatewayResult=send.result;return[ok(formatGatewaySummary({channel:send.channel,messageId:gatewayResult?.messageId??null}))]}let label=resolveChannelLabel(result.channel),msgId=extractMessageId(result.payload);return[ok(`✅ Sent via ${label}.${msgId?` Message ID: ${msgId}`:``}`)]}if(result.kind===`poll`){if(result.handledBy===`core`&&result.pollResult){let poll=result.pollResult,pollId=poll.result?.pollId,msgId=poll.result?.messageId??null,lines=[ok(formatGatewaySummary({action:`Poll sent`,channel:poll.channel,messageId:msgId}))];return pollId&&lines.push(ok(`Poll id: ${pollId}`)),lines}let label=resolveChannelLabel(result.channel),msgId=extractMessageId(result.payload);return[ok(`✅ Poll sent via ${label}.${msgId?` Message ID: ${msgId}`:``}`)]}let payload=result.payload,lines=[];if(result.action===`react`){let added=payload.added,removed=payload.removed;if(typeof added==`string`&&added.trim())return lines.push(ok(`✅ Reaction added: ${added.trim()}`)),lines;if(typeof removed==`string`&&removed.trim())return lines.push(ok(`✅ Reaction removed: ${removed.trim()}`)),lines;if(Array.isArray(removed)){let list=removed.map(x=>String(x).trim()).filter(Boolean).join(`, `);return lines.push(ok(`✅ Reactions removed${list?`: ${list}`:``}`)),lines}return lines.push(ok(`✅ Reaction updated.`)),lines}let reactionsTable=renderReactions(payload,opts);if(reactionsTable&&result.action===`reactions`)return lines.push(heading(`Reactions`)),lines.push(reactionsTable[0]??``),lines;if(result.action===`read`){let messagesTable=renderMessagesFromPayload(payload,opts);if(messagesTable)return lines.push(heading(`Messages`)),lines.push(messagesTable[0]??``),lines}if(result.action===`list-pins`){let pinsTable=renderPinsFromPayload(payload,opts);if(pinsTable)return lines.push(heading(`Pinned messages`)),lines.push(pinsTable[0]??``),lines}if(result.action===`search`){let results=payload.results,list=extractDiscordSearchResultsMessages(results);if(list)return lines.push(heading(`Search results`)),lines.push(renderMessageList(list,opts,`No results.`)[0]??``),lines}lines.push(ok(`✅ ${result.action} via ${resolveChannelLabel(result.channel)}.`));let summary=renderObjectSummary(payload,opts);return summary.length&&(lines.push(``),lines.push(...summary),lines.push(``),lines.push(muted(`Tip: use --json for full output.`))),lines}async function messageCommand(opts,deps,runtime){let cfg=loadConfig(),actionInput=(typeof opts.action==`string`?opts.action.trim():``)||`send`,actionMatch=CHANNEL_MESSAGE_ACTION_NAMES.find(name=>name.toLowerCase()===actionInput.toLowerCase());if(!actionMatch)throw Error(`Unknown message action: ${actionInput}`);let action=actionMatch,outboundDeps=createOutboundSendDeps(deps),run=async()=>await runMessageAction({cfg,action,params:opts,deps:outboundDeps,gateway:{clientName:GATEWAY_CLIENT_NAMES.CLI,mode:GATEWAY_CLIENT_MODES.CLI}}),json=opts.json===!0,dryRun=opts.dryRun===!0,result=!json&&!dryRun&&(action===`send`||action===`poll`)?await withProgress({label:action===`poll`?`Sending poll...`:`Sending...`,indeterminate:!0,enabled:!0},run):await run();if(json){runtime.log(JSON.stringify(buildMessageCliJson(result),null,2));return}for(let line of formatMessageCliText(result))runtime.log(line)}function normalizeMessageOptions(opts){let{account,...rest}=opts;return{...rest,accountId:typeof account==`string`?account:void 0}}async function runPluginStopHooks(){await runGlobalGatewayStopSafely({event:{reason:`cli message action complete`},ctx:{},onError:err=>defaultRuntime.error(danger(`gateway_stop hook failed: ${String(err)}`))})}function createMessageCliHelpers(message,messageChannelOptions){return{withMessageBase:command=>command.option(`--channel <channel>`,`Channel: ${messageChannelOptions}`).option(`--account <id>`,`Channel account id (accountId)`).option(`--json`,`Output result as JSON`,!1).option(`--dry-run`,`Print payload and skip sending`,!1).option(`--verbose`,`Verbose logging`,!1),withMessageTarget:command=>command.option(`-t, --target <dest>`,CHANNEL_TARGET_DESCRIPTION),withRequiredMessageTarget:command=>command.requiredOption(`-t, --target <dest>`,CHANNEL_TARGET_DESCRIPTION),runMessageAction:async(action,opts)=>{setVerbose(!!opts.verbose),ensurePluginRegistryLoaded();let deps=createDefaultDeps(),failed=!1;await runCommandWithRuntime(defaultRuntime,async()=>{await messageCommand({...normalizeMessageOptions(opts),action},deps,defaultRuntime)},err=>{failed=!0,defaultRuntime.error(danger(String(err)))}),await runPluginStopHooks(),defaultRuntime.exit(failed?1:0)}}}function registerMessageBroadcastCommand(message,helpers){helpers.withMessageBase(message.command(`broadcast`).description(`Broadcast a message to multiple targets`)).requiredOption(`--targets <target...>`,CHANNEL_TARGETS_DESCRIPTION).option(`--message <text>`,`Message to send`).option(`--media <url>`,`Media URL`).action(async options=>{await helpers.runMessageAction(`broadcast`,options)})}function registerMessageDiscordAdminCommands(message,helpers){let role=message.command(`role`).description(`Role actions`);helpers.withMessageBase(role.command(`info`).description(`List roles`).requiredOption(`--guild-id <id>`,`Guild id`)).action(async opts=>{await helpers.runMessageAction(`role-info`,opts)}),helpers.withMessageBase(role.command(`add`).description(`Add role to a member`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--user-id <id>`,`User id`).requiredOption(`--role-id <id>`,`Role id`)).action(async opts=>{await helpers.runMessageAction(`role-add`,opts)}),helpers.withMessageBase(role.command(`remove`).description(`Remove role from a member`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--user-id <id>`,`User id`).requiredOption(`--role-id <id>`,`Role id`)).action(async opts=>{await helpers.runMessageAction(`role-remove`,opts)});let channel=message.command(`channel`).description(`Channel actions`);helpers.withMessageBase(helpers.withRequiredMessageTarget(channel.command(`info`).description(`Fetch channel info`))).action(async opts=>{await helpers.runMessageAction(`channel-info`,opts)}),helpers.withMessageBase(channel.command(`list`).description(`List channels`).requiredOption(`--guild-id <id>`,`Guild id`)).action(async opts=>{await helpers.runMessageAction(`channel-list`,opts)});let member=message.command(`member`).description(`Member actions`);helpers.withMessageBase(member.command(`info`).description(`Fetch member info`).requiredOption(`--user-id <id>`,`User id`)).option(`--guild-id <id>`,`Guild id (Discord)`).action(async opts=>{await helpers.runMessageAction(`member-info`,opts)});let voice=message.command(`voice`).description(`Voice actions`);helpers.withMessageBase(voice.command(`status`).description(`Fetch voice status`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--user-id <id>`,`User id`)).action(async opts=>{await helpers.runMessageAction(`voice-status`,opts)});let event=message.command(`event`).description(`Event actions`);helpers.withMessageBase(event.command(`list`).description(`List scheduled events`).requiredOption(`--guild-id <id>`,`Guild id`)).action(async opts=>{await helpers.runMessageAction(`event-list`,opts)}),helpers.withMessageBase(event.command(`create`).description(`Create a scheduled event`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--event-name <name>`,`Event name`).requiredOption(`--start-time <iso>`,`Event start time`)).option(`--end-time <iso>`,`Event end time`).option(`--desc <text>`,`Event description`).option(`--channel-id <id>`,`Channel id`).option(`--location <text>`,`Event location`).option(`--event-type <stage|external|voice>`,`Event type`).action(async opts=>{await helpers.runMessageAction(`event-create`,opts)}),helpers.withMessageBase(message.command(`timeout`).description(`Timeout a member`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--user-id <id>`,`User id`)).option(`--duration-min <n>`,`Timeout duration minutes`).option(`--until <iso>`,`Timeout until`).option(`--reason <text>`,`Moderation reason`).action(async opts=>{await helpers.runMessageAction(`timeout`,opts)}),helpers.withMessageBase(message.command(`kick`).description(`Kick a member`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--user-id <id>`,`User id`)).option(`--reason <text>`,`Moderation reason`).action(async opts=>{await helpers.runMessageAction(`kick`,opts)}),helpers.withMessageBase(message.command(`ban`).description(`Ban a member`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--user-id <id>`,`User id`)).option(`--reason <text>`,`Moderation reason`).option(`--delete-days <n>`,`Ban delete message days`).action(async opts=>{await helpers.runMessageAction(`ban`,opts)})}function registerMessageEmojiCommands(message,helpers){let emoji=message.command(`emoji`).description(`Emoji actions`);helpers.withMessageBase(emoji.command(`list`).description(`List emojis`)).option(`--guild-id <id>`,`Guild id (Discord)`).action(async opts=>{await helpers.runMessageAction(`emoji-list`,opts)}),helpers.withMessageBase(emoji.command(`upload`).description(`Upload an emoji`).requiredOption(`--guild-id <id>`,`Guild id`)).requiredOption(`--emoji-name <name>`,`Emoji name`).requiredOption(`--media <path-or-url>`,`Emoji media (path or URL)`).option(`--role-ids <id>`,`Role id (repeat)`,collectOption,[]).action(async opts=>{await helpers.runMessageAction(`emoji-upload`,opts)})}function registerMessageStickerCommands(message,helpers){let sticker=message.command(`sticker`).description(`Sticker actions`);helpers.withMessageBase(helpers.withRequiredMessageTarget(sticker.command(`send`).description(`Send stickers`))).requiredOption(`--sticker-id <id>`,`Sticker id (repeat)`,collectOption).option(`-m, --message <text>`,`Optional message body`).action(async opts=>{await helpers.runMessageAction(`sticker`,opts)}),helpers.withMessageBase(sticker.command(`upload`).description(`Upload a sticker`).requiredOption(`--guild-id <id>`,`Guild id`)).requiredOption(`--sticker-name <name>`,`Sticker name`).requiredOption(`--sticker-desc <text>`,`Sticker description`).requiredOption(`--sticker-tags <tags>`,`Sticker tags`).requiredOption(`--media <path-or-url>`,`Sticker media (path or URL)`).action(async opts=>{await helpers.runMessageAction(`sticker-upload`,opts)})}function registerMessagePermissionsCommand(message,helpers){helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`permissions`).description(`Fetch channel permissions`))).action(async opts=>{await helpers.runMessageAction(`permissions`,opts)})}function registerMessageSearchCommand(message,helpers){helpers.withMessageBase(message.command(`search`).description(`Search Discord messages`)).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--query <text>`,`Search query`).option(`--channel-id <id>`,`Channel id`).option(`--channel-ids <id>`,`Channel id (repeat)`,collectOption,[]).option(`--author-id <id>`,`Author id`).option(`--author-ids <id>`,`Author id (repeat)`,collectOption,[]).option(`--limit <n>`,`Result limit`).action(async opts=>{await helpers.runMessageAction(`search`,opts)})}function registerMessagePinCommands(message,helpers){helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`pin`).description(`Pin a message`))).requiredOption(`--message-id <id>`,`Message id`).action(async opts=>{await helpers.runMessageAction(`pin`,opts)}),helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`unpin`).description(`Unpin a message`))).requiredOption(`--message-id <id>`,`Message id`).action(async opts=>{await helpers.runMessageAction(`unpin`,opts)}),helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`pins`).description(`List pinned messages`))).option(`--limit <n>`,`Result limit`).action(async opts=>{await helpers.runMessageAction(`list-pins`,opts)})}function registerMessagePollCommand(message,helpers){helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`poll`).description(`Send a poll`))).requiredOption(`--poll-question <text>`,`Poll question`).option(`--poll-option <choice>`,`Poll option (repeat 2-12 times)`,collectOption,[]).option(`--poll-multi`,`Allow multiple selections`,!1).option(`--poll-duration-hours <n>`,`Poll duration in hours (Discord)`).option(`--poll-duration-seconds <n>`,`Poll duration in seconds (Telegram; 5-600)`).option(`--poll-anonymous`,`Send an anonymous poll (Telegram)`,!1).option(`--poll-public`,`Send a non-anonymous poll (Telegram)`,!1).option(`-m, --message <text>`,`Optional message body`).option(`--silent`,`Send poll silently without notification (Telegram + Discord where supported)`,!1).option(`--thread-id <id>`,`Thread id (Telegram forum topic / Slack thread ts)`).action(async opts=>{await helpers.runMessageAction(`poll`,opts)})}function registerMessageReactionsCommands(message,helpers){helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`react`).description(`Add or remove a reaction`))).requiredOption(`--message-id <id>`,`Message id`).option(`--emoji <emoji>`,`Emoji for reactions`).option(`--remove`,`Remove reaction`,!1).option(`--participant <id>`,`WhatsApp reaction participant`).option(`--from-me`,`WhatsApp reaction fromMe`,!1).option(`--target-author <id>`,`Signal reaction target author (uuid or phone)`).option(`--target-author-uuid <uuid>`,`Signal reaction target author uuid`).action(async opts=>{await helpers.runMessageAction(`react`,opts)}),helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`reactions`).description(`List reactions on a message`))).requiredOption(`--message-id <id>`,`Message id`).option(`--limit <n>`,`Result limit`).action(async opts=>{await helpers.runMessageAction(`reactions`,opts)})}function registerMessageReadEditDeleteCommands(message,helpers){helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`read`).description(`Read recent messages`))).option(`--limit <n>`,`Result limit`).option(`--before <id>`,`Read/search before id`).option(`--after <id>`,`Read/search after id`).option(`--around <id>`,`Read around id`).option(`--include-thread`,`Include thread replies (Discord)`,!1).action(async opts=>{await helpers.runMessageAction(`read`,opts)}),helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`edit`).description(`Edit a message`).requiredOption(`--message-id <id>`,`Message id`).requiredOption(`-m, --message <text>`,`Message body`))).option(`--thread-id <id>`,`Thread id (Telegram forum thread)`).action(async opts=>{await helpers.runMessageAction(`edit`,opts)}),helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`delete`).description(`Delete a message`).requiredOption(`--message-id <id>`,`Message id`))).action(async opts=>{await helpers.runMessageAction(`delete`,opts)})}function registerMessageSendCommand(message,helpers){helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`send`).description(`Send a message`).option(`-m, --message <text>`,`Message body (required unless --media is set)`)).option(`--media <path-or-url>`,`Attach media (image/audio/video/document). Accepts local paths or URLs.`).option(`--buttons <json>`,`Telegram inline keyboard buttons as JSON (array of button rows)`).option(`--components <json>`,`Discord components payload as JSON`).option(`--card <json>`,`Adaptive Card JSON object (when supported by the channel)`).option(`--reply-to <id>`,`Reply-to message id`).option(`--thread-id <id>`,`Thread id (Telegram forum thread)`).option(`--gif-playback`,`Treat video media as GIF playback (WhatsApp only).`,!1).option(`--silent`,`Send message silently without notification (Telegram + Discord)`,!1)).action(async opts=>{await helpers.runMessageAction(`send`,opts)})}function registerMessageThreadCommands(message,helpers){let thread=message.command(`thread`).description(`Thread actions`);helpers.withMessageBase(helpers.withRequiredMessageTarget(thread.command(`create`).description(`Create a thread`).requiredOption(`--thread-name <name>`,`Thread name`))).option(`--message-id <id>`,`Message id (optional)`).option(`-m, --message <text>`,`Initial thread message text`).option(`--auto-archive-min <n>`,`Thread auto-archive minutes`).action(async opts=>{await helpers.runMessageAction(`thread-create`,opts)}),helpers.withMessageBase(thread.command(`list`).description(`List threads`).requiredOption(`--guild-id <id>`,`Guild id`)).option(`--channel-id <id>`,`Channel id`).option(`--include-archived`,`Include archived threads`,!1).option(`--before <id>`,`Read/search before id`).option(`--limit <n>`,`Result limit`).action(async opts=>{await helpers.runMessageAction(`thread-list`,opts)}),helpers.withMessageBase(helpers.withRequiredMessageTarget(thread.command(`reply`).description(`Reply in a thread`).requiredOption(`-m, --message <text>`,`Message body`))).option(`--media <path-or-url>`,`Attach media (image/audio/video/document). Accepts local paths or URLs.`).option(`--reply-to <id>`,`Reply-to message id`).action(async opts=>{await helpers.runMessageAction(`thread-reply`,opts)})}function registerMessageCommands(program,ctx){let message=program.command(`message`).description(`Send, read, and manage messages and channel actions`).addHelpText(`after`,()=>`
1
+ import"./paths-BHg-VHB4.js";import{o as getChatChannelMeta,u as normalizeChatChannelId}from"./registry-Cv7CoWAs.js";import{D as danger,N as setVerbose,R as isRich,z as theme}from"./utils-BP60e80M.js";import{p as defaultRuntime}from"./subsystem-C4b1Von0.js";import"./boolean-ssGoaBPk.js";import"./env-BoE8QSib.js";import"./warning-filter-nSTjpMIH.js";import"./auth-profiles-BARnVAUE.js";import"./logger-AbH8mdkv.js";import"./session-key-D--2AEus.js";import"./builderforce-root-D3-p8W2n.js";import"./exec-CGuYALEs.js";import"./agent-scope-BcoQBOwz.js";import"./env-file-BIKVpYUN.js";import{r as loadConfig}from"./io-BySzqKzT.js";import"./manifest-registry-DtqFvEIR.js";import"./config-Bwt58P9r.js";import"./model-discovery-DxpimsRF.js";import"./model-catalog-wcISK04b.js";import"./frontmatter-DgRc5y_l.js";import"./skills-W00EPvKR.js";import"./plugin-skills-BSUncenp.js";import"./refresh-bgGvF0aF.js";import"./client-DeQ0LbP9.js";import"./call-CjC3SRPv.js";import{h as GATEWAY_CLIENT_NAMES,m as GATEWAY_CLIENT_MODES}from"./message-channel-C-yw5fZm.js";import{Ct as CHANNEL_TARGETS_DESCRIPTION,et as runMessageAction,lt as CHANNEL_MESSAGE_ACTION_NAMES,st as formatTargetDisplay,wt as CHANNEL_TARGET_DESCRIPTION}from"./subagent-registry-BUKplZi1.js";import"./sessions-ko0LxxGk.js";import"./src-BM8G-tIl.js";import"./project-context-store-BSIWJD6S.js";import"./tokens-BNwTTeJb.js";import{t as getChannelPlugin}from"./plugins-DJGW_fnS.js";import"./accounts-Z5bJpNrG.js";import"./bindings-D0uket3l.js";import"./send-gG3CFJwv.js";import"./send-DqJCViFb.js";import"./with-timeout-By0c7Ur9.js";import{T as runGlobalGatewayStopSafely}from"./deliver-DFhj1d_t.js";import"./accounts-DoJYLMfS.js";import"./send-mCN63Hkn.js";import"./image-ops-Bg9yFwjX.js";import"./redact-bWj_-q3j.js";import"./errors-t5wHPcwh.js";import"./embedded-helpers-DGDYymYx.js";import"./sandbox-BcH7kS1y.js";import"./chrome-IJYO1tSE.js";import"./tailscale-CgCG7AVQ.js";import"./auth-B4Kn3eee.js";import"./server-context-D3iiIzvV.js";import"./routes-7QTsp3sA.js";import"./paths-GamzES41.js";import"./ssrf-BiSQzdcA.js";import"./store-C5LmVaEC.js";import"./ports-LqFTyTSK.js";import"./trash-zs6gNxed.js";import"./accounts-BT-NzzBc.js";import"./paths-BQ9W7Bs0.js";import"./tool-images-DV2HMmx4.js";import"./workspace-Cz9mCy0P.js";import"./reply-prefix-9hmbzubX.js";import"./sqlite-BEgCClMz.js";import"./memory-cli-COgt0ROi.js";import"./manager-Cob4Ofzr.js";import"./gemini-auth-BZgBIY0M.js";import"./retry-Cc6xusE8.js";import"./common-BRdxH-uH.js";import"./runner-BLCTET8O.js";import"./tool-display-BIswnHaq.js";import"./chunk-UPhdkZNp.js";import"./markdown-tables-CpqWBduK.js";import"./fetch-guard-CoGEds8D.js";import"./fetch-CUsKv8oj.js";import"./ir-6L-eU4id.js";import"./render-1ABBE2Y6.js";import"./builderforcellm-syscheck-CfFrfeV2.js";import"./session-utils-VCGKYbgW.js";import"./coding-tools.policy-DIeVRurg.js";import"./pairing-store-tegvJa08.js";import"./fetch-CrbOFvsL.js";import"./exec-approvals-Cn0K-HtJ.js";import"./nodes-screen-OI7tHqlU.js";import"./session-cost-usage-BgZfN_WR.js";import"./provider-usage-BLkm6ojE.js";import"./send-BIR1Jhc5.js";import"./outbound-attachment-3GZbMqo1.js";import"./delivery-queue-DQXq7KUU.js";import"./project-context-C5KLsMTc.js";import"./control-service-Cml__v8i.js";import"./stagger-CUH5rlmS.js";import"./channel-selection-DFf_nAm7.js";import"./send-9rUcCK7O.js";import"./resolve-route-D3X-bXU-.js";import"./channel-activity-By7lsk7N.js";import"./tables-DZSV6me6.js";import{t as formatDocsLink}from"./links-B6LU5cXN.js";import{n as runCommandWithRuntime}from"./cli-utils-ByV85M53.js";import{t as formatHelpExamples}from"./help-format-DIDk_7gh.js";import{n as withProgress}from"./progress-BQMO_-7I.js";import"./replies-CL0uQgU7.js";import"./onboard-helpers-Di5OXlap.js";import"./prompt-style-CZOeG0sw.js";import"./pairing-labels-DofkNLS2.js";import"./active-listener-BC31MA4v.js";import"./mamba-state-engine-BYmUnYwn.js";import"./transformers-stream-nSL4Xu31.js";import{t as ensurePluginRegistryLoaded}from"./plugin-registry-BM1-sG-e.js";import{t as collectOption}from"./helpers-lceKHGsd.js";import{t as renderTable}from"./table-CiK88EDX.js";import{n as createDefaultDeps,t as createOutboundSendDeps}from"./outbound-send-deps-Cys_MtmC.js";const resolveChannelLabel$1=channel=>{let pluginLabel=getChannelPlugin(channel)?.meta.label;if(pluginLabel)return pluginLabel;let normalized=normalizeChatChannelId(channel);return normalized?getChatChannelMeta(normalized).label:channel};function formatOutboundDeliverySummary(channel,result){if(!result)return`✅ Sent via ${resolveChannelLabel$1(channel)}. Message ID: unknown`;let base=`✅ Sent via ${resolveChannelLabel$1(result.channel)}. Message ID: ${result.messageId}`;return`chatId`in result?`${base} (chat ${result.chatId})`:`channelId`in result?`${base} (channel ${result.channelId})`:`roomId`in result?`${base} (room ${result.roomId})`:`conversationId`in result?`${base} (conversation ${result.conversationId})`:base}function formatGatewaySummary(params){return`✅ ${params.action??`Sent`} via gateway${params.channel?` (${params.channel})`:``}. Message ID: ${params.messageId??`unknown`}`}const shortenText=(value,maxLen)=>{let chars=Array.from(value);return chars.length<=maxLen?value:`${chars.slice(0,Math.max(0,maxLen-1)).join(``)}…`},resolveChannelLabel=channel=>getChannelPlugin(channel)?.meta.label??channel;function extractMessageId(payload){if(!payload||typeof payload!=`object`)return null;let direct=payload.messageId;if(typeof direct==`string`&&direct.trim())return direct.trim();let result=payload.result;if(result&&typeof result==`object`){let nested=result.messageId;if(typeof nested==`string`&&nested.trim())return nested.trim()}return null}function buildMessageCliJson(result){return{action:result.action,channel:result.channel,dryRun:result.dryRun,handledBy:result.handledBy,payload:result.payload}}function renderObjectSummary(payload,opts){if(!payload||typeof payload!=`object`)return[String(payload)];let obj=payload,keys=Object.keys(obj);if(keys.length===0)return[theme.muted(`(empty)`)];let rows=keys.slice(0,20).map(k=>{let v=obj[k];return{Key:k,Value:shortenText(v==null?`null`:Array.isArray(v)?`${v.length} items`:typeof v==`object`?`object`:typeof v==`string`?v:typeof v==`number`?String(v):typeof v==`boolean`?v?`true`:`false`:typeof v==`bigint`||typeof v==`symbol`?v.toString():typeof v==`function`?`function`:`unknown`,96)}});return[renderTable({width:opts.width,columns:[{key:`Key`,header:`Key`,minWidth:16},{key:`Value`,header:`Value`,flex:!0,minWidth:24}],rows}).trimEnd()]}function renderMessageList(messages,opts,emptyLabel){let rows=messages.slice(0,25).map(m=>{let msg=m,id=typeof msg.id==`string`&&msg.id||typeof msg.ts==`string`&&msg.ts||typeof msg.messageId==`string`&&msg.messageId||``,authorObj=msg.author,author=typeof msg.authorTag==`string`&&msg.authorTag||typeof authorObj?.username==`string`&&authorObj.username||typeof msg.user==`string`&&msg.user||``,time=typeof msg.timestamp==`string`&&msg.timestamp||typeof msg.ts==`string`&&msg.ts||``,text=typeof msg.content==`string`&&msg.content||typeof msg.text==`string`&&msg.text||``;return{Time:shortenText(time,28),Author:shortenText(author,22),Text:shortenText(text.replace(/\s+/g,` `).trim(),90),Id:shortenText(id,22)}});return rows.length===0?[theme.muted(emptyLabel)]:[renderTable({width:opts.width,columns:[{key:`Time`,header:`Time`,minWidth:14},{key:`Author`,header:`Author`,minWidth:10},{key:`Text`,header:`Text`,flex:!0,minWidth:24},{key:`Id`,header:`Id`,minWidth:10}],rows}).trimEnd()]}function renderMessagesFromPayload(payload,opts){if(!payload||typeof payload!=`object`)return null;let messages=payload.messages;return Array.isArray(messages)?renderMessageList(messages,opts,`No messages.`):null}function renderPinsFromPayload(payload,opts){if(!payload||typeof payload!=`object`)return null;let pins=payload.pins;return Array.isArray(pins)?renderMessageList(pins,opts,`No pins.`):null}function extractDiscordSearchResultsMessages(results){if(!results||typeof results!=`object`)return null;let raw=results.messages;if(!Array.isArray(raw))return null;let flattened=[];for(let entry of raw)Array.isArray(entry)&&entry.length>0?flattened.push(entry[0]):entry&&typeof entry==`object`&&flattened.push(entry);return flattened.length?flattened:null}function renderReactions(payload,opts){if(!payload||typeof payload!=`object`)return null;let reactions=payload.reactions;if(!Array.isArray(reactions))return null;let rows=reactions.slice(0,50).map(r=>{let entry=r,emojiObj=entry.emoji;return{Emoji:typeof emojiObj?.raw==`string`&&emojiObj.raw||typeof entry.name==`string`&&entry.name||typeof entry.emoji==`string`&&entry.emoji||``,Count:typeof entry.count==`number`?String(entry.count):``,Users:shortenText((Array.isArray(entry.users)?entry.users.slice(0,8).map(u=>{if(typeof u==`string`)return u;if(!u||typeof u!=`object`)return``;let user=u;return typeof user.tag==`string`&&user.tag||typeof user.username==`string`&&user.username||typeof user.id==`string`&&user.id||``}).filter(Boolean):[]).join(`, `),72)}});return rows.length===0?[theme.muted(`No reactions.`)]:[renderTable({width:opts.width,columns:[{key:`Emoji`,header:`Emoji`,minWidth:8},{key:`Count`,header:`Count`,align:`right`,minWidth:6},{key:`Users`,header:`Users`,flex:!0,minWidth:20}],rows}).trimEnd()]}function formatMessageCliText(result){let rich=isRich(),ok=text=>rich?theme.success(text):text,muted=text=>rich?theme.muted(text):text,heading=text=>rich?theme.heading(text):text,opts={width:Math.max(60,(process.stdout.columns??120)-1)};if(result.handledBy===`dry-run`)return[muted(`[dry-run] would run ${result.action} via ${result.channel}`)];if(result.kind===`broadcast`){let results=result.payload.results??[],rows=results.map(entry=>({Channel:resolveChannelLabel(entry.channel),Target:shortenText(formatTargetDisplay({channel:entry.channel,target:entry.to}),36),Status:entry.ok?`ok`:`error`,Error:entry.ok?``:shortenText(entry.error??`unknown error`,48)})),okCount=results.filter(entry=>entry.ok).length,total=results.length;return[ok(`✅ Broadcast complete (${okCount}/${total} succeeded, ${total-okCount} failed)`),renderTable({width:opts.width,columns:[{key:`Channel`,header:`Channel`,minWidth:10},{key:`Target`,header:`Target`,minWidth:12,flex:!0},{key:`Status`,header:`Status`,minWidth:6},{key:`Error`,header:`Error`,minWidth:20,flex:!0}],rows:rows.slice(0,50)}).trimEnd()]}if(result.kind===`send`){if(result.handledBy===`core`&&result.sendResult){let send=result.sendResult;if(send.via===`direct`){let directResult=send.result;return[ok(formatOutboundDeliverySummary(send.channel,directResult))]}let gatewayResult=send.result;return[ok(formatGatewaySummary({channel:send.channel,messageId:gatewayResult?.messageId??null}))]}let label=resolveChannelLabel(result.channel),msgId=extractMessageId(result.payload);return[ok(`✅ Sent via ${label}.${msgId?` Message ID: ${msgId}`:``}`)]}if(result.kind===`poll`){if(result.handledBy===`core`&&result.pollResult){let poll=result.pollResult,pollId=poll.result?.pollId,msgId=poll.result?.messageId??null,lines=[ok(formatGatewaySummary({action:`Poll sent`,channel:poll.channel,messageId:msgId}))];return pollId&&lines.push(ok(`Poll id: ${pollId}`)),lines}let label=resolveChannelLabel(result.channel),msgId=extractMessageId(result.payload);return[ok(`✅ Poll sent via ${label}.${msgId?` Message ID: ${msgId}`:``}`)]}let payload=result.payload,lines=[];if(result.action===`react`){let added=payload.added,removed=payload.removed;if(typeof added==`string`&&added.trim())return lines.push(ok(`✅ Reaction added: ${added.trim()}`)),lines;if(typeof removed==`string`&&removed.trim())return lines.push(ok(`✅ Reaction removed: ${removed.trim()}`)),lines;if(Array.isArray(removed)){let list=removed.map(x=>String(x).trim()).filter(Boolean).join(`, `);return lines.push(ok(`✅ Reactions removed${list?`: ${list}`:``}`)),lines}return lines.push(ok(`✅ Reaction updated.`)),lines}let reactionsTable=renderReactions(payload,opts);if(reactionsTable&&result.action===`reactions`)return lines.push(heading(`Reactions`)),lines.push(reactionsTable[0]??``),lines;if(result.action===`read`){let messagesTable=renderMessagesFromPayload(payload,opts);if(messagesTable)return lines.push(heading(`Messages`)),lines.push(messagesTable[0]??``),lines}if(result.action===`list-pins`){let pinsTable=renderPinsFromPayload(payload,opts);if(pinsTable)return lines.push(heading(`Pinned messages`)),lines.push(pinsTable[0]??``),lines}if(result.action===`search`){let results=payload.results,list=extractDiscordSearchResultsMessages(results);if(list)return lines.push(heading(`Search results`)),lines.push(renderMessageList(list,opts,`No results.`)[0]??``),lines}lines.push(ok(`✅ ${result.action} via ${resolveChannelLabel(result.channel)}.`));let summary=renderObjectSummary(payload,opts);return summary.length&&(lines.push(``),lines.push(...summary),lines.push(``),lines.push(muted(`Tip: use --json for full output.`))),lines}async function messageCommand(opts,deps,runtime){let cfg=loadConfig(),actionInput=(typeof opts.action==`string`?opts.action.trim():``)||`send`,actionMatch=CHANNEL_MESSAGE_ACTION_NAMES.find(name=>name.toLowerCase()===actionInput.toLowerCase());if(!actionMatch)throw Error(`Unknown message action: ${actionInput}`);let action=actionMatch,outboundDeps=createOutboundSendDeps(deps),run=async()=>await runMessageAction({cfg,action,params:opts,deps:outboundDeps,gateway:{clientName:GATEWAY_CLIENT_NAMES.CLI,mode:GATEWAY_CLIENT_MODES.CLI}}),json=opts.json===!0,dryRun=opts.dryRun===!0,result=!json&&!dryRun&&(action===`send`||action===`poll`)?await withProgress({label:action===`poll`?`Sending poll...`:`Sending...`,indeterminate:!0,enabled:!0},run):await run();if(json){runtime.log(JSON.stringify(buildMessageCliJson(result),null,2));return}for(let line of formatMessageCliText(result))runtime.log(line)}function normalizeMessageOptions(opts){let{account,...rest}=opts;return{...rest,accountId:typeof account==`string`?account:void 0}}async function runPluginStopHooks(){await runGlobalGatewayStopSafely({event:{reason:`cli message action complete`},ctx:{},onError:err=>defaultRuntime.error(danger(`gateway_stop hook failed: ${String(err)}`))})}function createMessageCliHelpers(message,messageChannelOptions){return{withMessageBase:command=>command.option(`--channel <channel>`,`Channel: ${messageChannelOptions}`).option(`--account <id>`,`Channel account id (accountId)`).option(`--json`,`Output result as JSON`,!1).option(`--dry-run`,`Print payload and skip sending`,!1).option(`--verbose`,`Verbose logging`,!1),withMessageTarget:command=>command.option(`-t, --target <dest>`,CHANNEL_TARGET_DESCRIPTION),withRequiredMessageTarget:command=>command.requiredOption(`-t, --target <dest>`,CHANNEL_TARGET_DESCRIPTION),runMessageAction:async(action,opts)=>{setVerbose(!!opts.verbose),ensurePluginRegistryLoaded();let deps=createDefaultDeps(),failed=!1;await runCommandWithRuntime(defaultRuntime,async()=>{await messageCommand({...normalizeMessageOptions(opts),action},deps,defaultRuntime)},err=>{failed=!0,defaultRuntime.error(danger(String(err)))}),await runPluginStopHooks(),defaultRuntime.exit(failed?1:0)}}}function registerMessageBroadcastCommand(message,helpers){helpers.withMessageBase(message.command(`broadcast`).description(`Broadcast a message to multiple targets`)).requiredOption(`--targets <target...>`,CHANNEL_TARGETS_DESCRIPTION).option(`--message <text>`,`Message to send`).option(`--media <url>`,`Media URL`).action(async options=>{await helpers.runMessageAction(`broadcast`,options)})}function registerMessageDiscordAdminCommands(message,helpers){let role=message.command(`role`).description(`Role actions`);helpers.withMessageBase(role.command(`info`).description(`List roles`).requiredOption(`--guild-id <id>`,`Guild id`)).action(async opts=>{await helpers.runMessageAction(`role-info`,opts)}),helpers.withMessageBase(role.command(`add`).description(`Add role to a member`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--user-id <id>`,`User id`).requiredOption(`--role-id <id>`,`Role id`)).action(async opts=>{await helpers.runMessageAction(`role-add`,opts)}),helpers.withMessageBase(role.command(`remove`).description(`Remove role from a member`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--user-id <id>`,`User id`).requiredOption(`--role-id <id>`,`Role id`)).action(async opts=>{await helpers.runMessageAction(`role-remove`,opts)});let channel=message.command(`channel`).description(`Channel actions`);helpers.withMessageBase(helpers.withRequiredMessageTarget(channel.command(`info`).description(`Fetch channel info`))).action(async opts=>{await helpers.runMessageAction(`channel-info`,opts)}),helpers.withMessageBase(channel.command(`list`).description(`List channels`).requiredOption(`--guild-id <id>`,`Guild id`)).action(async opts=>{await helpers.runMessageAction(`channel-list`,opts)});let member=message.command(`member`).description(`Member actions`);helpers.withMessageBase(member.command(`info`).description(`Fetch member info`).requiredOption(`--user-id <id>`,`User id`)).option(`--guild-id <id>`,`Guild id (Discord)`).action(async opts=>{await helpers.runMessageAction(`member-info`,opts)});let voice=message.command(`voice`).description(`Voice actions`);helpers.withMessageBase(voice.command(`status`).description(`Fetch voice status`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--user-id <id>`,`User id`)).action(async opts=>{await helpers.runMessageAction(`voice-status`,opts)});let event=message.command(`event`).description(`Event actions`);helpers.withMessageBase(event.command(`list`).description(`List scheduled events`).requiredOption(`--guild-id <id>`,`Guild id`)).action(async opts=>{await helpers.runMessageAction(`event-list`,opts)}),helpers.withMessageBase(event.command(`create`).description(`Create a scheduled event`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--event-name <name>`,`Event name`).requiredOption(`--start-time <iso>`,`Event start time`)).option(`--end-time <iso>`,`Event end time`).option(`--desc <text>`,`Event description`).option(`--channel-id <id>`,`Channel id`).option(`--location <text>`,`Event location`).option(`--event-type <stage|external|voice>`,`Event type`).action(async opts=>{await helpers.runMessageAction(`event-create`,opts)}),helpers.withMessageBase(message.command(`timeout`).description(`Timeout a member`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--user-id <id>`,`User id`)).option(`--duration-min <n>`,`Timeout duration minutes`).option(`--until <iso>`,`Timeout until`).option(`--reason <text>`,`Moderation reason`).action(async opts=>{await helpers.runMessageAction(`timeout`,opts)}),helpers.withMessageBase(message.command(`kick`).description(`Kick a member`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--user-id <id>`,`User id`)).option(`--reason <text>`,`Moderation reason`).action(async opts=>{await helpers.runMessageAction(`kick`,opts)}),helpers.withMessageBase(message.command(`ban`).description(`Ban a member`).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--user-id <id>`,`User id`)).option(`--reason <text>`,`Moderation reason`).option(`--delete-days <n>`,`Ban delete message days`).action(async opts=>{await helpers.runMessageAction(`ban`,opts)})}function registerMessageEmojiCommands(message,helpers){let emoji=message.command(`emoji`).description(`Emoji actions`);helpers.withMessageBase(emoji.command(`list`).description(`List emojis`)).option(`--guild-id <id>`,`Guild id (Discord)`).action(async opts=>{await helpers.runMessageAction(`emoji-list`,opts)}),helpers.withMessageBase(emoji.command(`upload`).description(`Upload an emoji`).requiredOption(`--guild-id <id>`,`Guild id`)).requiredOption(`--emoji-name <name>`,`Emoji name`).requiredOption(`--media <path-or-url>`,`Emoji media (path or URL)`).option(`--role-ids <id>`,`Role id (repeat)`,collectOption,[]).action(async opts=>{await helpers.runMessageAction(`emoji-upload`,opts)})}function registerMessageStickerCommands(message,helpers){let sticker=message.command(`sticker`).description(`Sticker actions`);helpers.withMessageBase(helpers.withRequiredMessageTarget(sticker.command(`send`).description(`Send stickers`))).requiredOption(`--sticker-id <id>`,`Sticker id (repeat)`,collectOption).option(`-m, --message <text>`,`Optional message body`).action(async opts=>{await helpers.runMessageAction(`sticker`,opts)}),helpers.withMessageBase(sticker.command(`upload`).description(`Upload a sticker`).requiredOption(`--guild-id <id>`,`Guild id`)).requiredOption(`--sticker-name <name>`,`Sticker name`).requiredOption(`--sticker-desc <text>`,`Sticker description`).requiredOption(`--sticker-tags <tags>`,`Sticker tags`).requiredOption(`--media <path-or-url>`,`Sticker media (path or URL)`).action(async opts=>{await helpers.runMessageAction(`sticker-upload`,opts)})}function registerMessagePermissionsCommand(message,helpers){helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`permissions`).description(`Fetch channel permissions`))).action(async opts=>{await helpers.runMessageAction(`permissions`,opts)})}function registerMessageSearchCommand(message,helpers){helpers.withMessageBase(message.command(`search`).description(`Search Discord messages`)).requiredOption(`--guild-id <id>`,`Guild id`).requiredOption(`--query <text>`,`Search query`).option(`--channel-id <id>`,`Channel id`).option(`--channel-ids <id>`,`Channel id (repeat)`,collectOption,[]).option(`--author-id <id>`,`Author id`).option(`--author-ids <id>`,`Author id (repeat)`,collectOption,[]).option(`--limit <n>`,`Result limit`).action(async opts=>{await helpers.runMessageAction(`search`,opts)})}function registerMessagePinCommands(message,helpers){helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`pin`).description(`Pin a message`))).requiredOption(`--message-id <id>`,`Message id`).action(async opts=>{await helpers.runMessageAction(`pin`,opts)}),helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`unpin`).description(`Unpin a message`))).requiredOption(`--message-id <id>`,`Message id`).action(async opts=>{await helpers.runMessageAction(`unpin`,opts)}),helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`pins`).description(`List pinned messages`))).option(`--limit <n>`,`Result limit`).action(async opts=>{await helpers.runMessageAction(`list-pins`,opts)})}function registerMessagePollCommand(message,helpers){helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`poll`).description(`Send a poll`))).requiredOption(`--poll-question <text>`,`Poll question`).option(`--poll-option <choice>`,`Poll option (repeat 2-12 times)`,collectOption,[]).option(`--poll-multi`,`Allow multiple selections`,!1).option(`--poll-duration-hours <n>`,`Poll duration in hours (Discord)`).option(`--poll-duration-seconds <n>`,`Poll duration in seconds (Telegram; 5-600)`).option(`--poll-anonymous`,`Send an anonymous poll (Telegram)`,!1).option(`--poll-public`,`Send a non-anonymous poll (Telegram)`,!1).option(`-m, --message <text>`,`Optional message body`).option(`--silent`,`Send poll silently without notification (Telegram + Discord where supported)`,!1).option(`--thread-id <id>`,`Thread id (Telegram forum topic / Slack thread ts)`).action(async opts=>{await helpers.runMessageAction(`poll`,opts)})}function registerMessageReactionsCommands(message,helpers){helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`react`).description(`Add or remove a reaction`))).requiredOption(`--message-id <id>`,`Message id`).option(`--emoji <emoji>`,`Emoji for reactions`).option(`--remove`,`Remove reaction`,!1).option(`--participant <id>`,`WhatsApp reaction participant`).option(`--from-me`,`WhatsApp reaction fromMe`,!1).option(`--target-author <id>`,`Signal reaction target author (uuid or phone)`).option(`--target-author-uuid <uuid>`,`Signal reaction target author uuid`).action(async opts=>{await helpers.runMessageAction(`react`,opts)}),helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`reactions`).description(`List reactions on a message`))).requiredOption(`--message-id <id>`,`Message id`).option(`--limit <n>`,`Result limit`).action(async opts=>{await helpers.runMessageAction(`reactions`,opts)})}function registerMessageReadEditDeleteCommands(message,helpers){helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`read`).description(`Read recent messages`))).option(`--limit <n>`,`Result limit`).option(`--before <id>`,`Read/search before id`).option(`--after <id>`,`Read/search after id`).option(`--around <id>`,`Read around id`).option(`--include-thread`,`Include thread replies (Discord)`,!1).action(async opts=>{await helpers.runMessageAction(`read`,opts)}),helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`edit`).description(`Edit a message`).requiredOption(`--message-id <id>`,`Message id`).requiredOption(`-m, --message <text>`,`Message body`))).option(`--thread-id <id>`,`Thread id (Telegram forum thread)`).action(async opts=>{await helpers.runMessageAction(`edit`,opts)}),helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`delete`).description(`Delete a message`).requiredOption(`--message-id <id>`,`Message id`))).action(async opts=>{await helpers.runMessageAction(`delete`,opts)})}function registerMessageSendCommand(message,helpers){helpers.withMessageBase(helpers.withRequiredMessageTarget(message.command(`send`).description(`Send a message`).option(`-m, --message <text>`,`Message body (required unless --media is set)`)).option(`--media <path-or-url>`,`Attach media (image/audio/video/document). Accepts local paths or URLs.`).option(`--buttons <json>`,`Telegram inline keyboard buttons as JSON (array of button rows)`).option(`--components <json>`,`Discord components payload as JSON`).option(`--card <json>`,`Adaptive Card JSON object (when supported by the channel)`).option(`--reply-to <id>`,`Reply-to message id`).option(`--thread-id <id>`,`Thread id (Telegram forum thread)`).option(`--gif-playback`,`Treat video media as GIF playback (WhatsApp only).`,!1).option(`--silent`,`Send message silently without notification (Telegram + Discord)`,!1)).action(async opts=>{await helpers.runMessageAction(`send`,opts)})}function registerMessageThreadCommands(message,helpers){let thread=message.command(`thread`).description(`Thread actions`);helpers.withMessageBase(helpers.withRequiredMessageTarget(thread.command(`create`).description(`Create a thread`).requiredOption(`--thread-name <name>`,`Thread name`))).option(`--message-id <id>`,`Message id (optional)`).option(`-m, --message <text>`,`Initial thread message text`).option(`--auto-archive-min <n>`,`Thread auto-archive minutes`).action(async opts=>{await helpers.runMessageAction(`thread-create`,opts)}),helpers.withMessageBase(thread.command(`list`).description(`List threads`).requiredOption(`--guild-id <id>`,`Guild id`)).option(`--channel-id <id>`,`Channel id`).option(`--include-archived`,`Include archived threads`,!1).option(`--before <id>`,`Read/search before id`).option(`--limit <n>`,`Result limit`).action(async opts=>{await helpers.runMessageAction(`thread-list`,opts)}),helpers.withMessageBase(helpers.withRequiredMessageTarget(thread.command(`reply`).description(`Reply in a thread`).requiredOption(`-m, --message <text>`,`Message body`))).option(`--media <path-or-url>`,`Attach media (image/audio/video/document). Accepts local paths or URLs.`).option(`--reply-to <id>`,`Reply-to message id`).action(async opts=>{await helpers.runMessageAction(`thread-reply`,opts)})}function registerMessageCommands(program,ctx){let message=program.command(`message`).description(`Send, read, and manage messages and channel actions`).addHelpText(`after`,()=>`
2
2
  ${theme.heading(`Examples:`)}
3
3
  ${formatHelpExamples([[`builderforce message send --target +15555550123 --message "Hi"`,`Send a text message.`],[`builderforce message send --target +15555550123 --message "Hi" --media photo.jpg`,`Send a message with media.`],[`builderforce message poll --channel discord --target channel:123 --poll-question "Snack?" --poll-option Pizza --poll-option Sushi`,`Create a Discord poll.`],[`builderforce message react --channel discord --target 123 --message-id 456 --emoji "✅"`,`React to a message.`]])}
4
4
 
@@ -1 +1 @@
1
- import"./paths-BHg-VHB4.js";import"./registry-Cv7CoWAs.js";import{z as theme}from"./utils-BP60e80M.js";import{p as defaultRuntime}from"./subsystem-C4b1Von0.js";import"./boolean-ssGoaBPk.js";import"./env-BoE8QSib.js";import"./warning-filter-nSTjpMIH.js";import"./auth-profiles-BARnVAUE.js";import"./logger-AbH8mdkv.js";import"./session-key-D--2AEus.js";import"./builderforce-root-D3-p8W2n.js";import"./exec-CGuYALEs.js";import"./agent-scope-BcoQBOwz.js";import"./env-file-BIKVpYUN.js";import"./io-BySzqKzT.js";import"./manifest-registry-DtqFvEIR.js";import"./config-Bwt58P9r.js";import"./model-discovery-DxpimsRF.js";import"./model-catalog-wcISK04b.js";import"./frontmatter-DgRc5y_l.js";import"./skills-W00EPvKR.js";import"./plugin-skills-BSUncenp.js";import"./refresh-bgGvF0aF.js";import"./client-DeQ0LbP9.js";import"./call-CjC3SRPv.js";import"./message-channel-C-yw5fZm.js";import"./subagent-registry-oB_F2U2W.js";import"./sessions-ko0LxxGk.js";import"./src-BRo9ywDM.js";import"./project-context-store-ClFt-YDL.js";import"./tokens-BNwTTeJb.js";import"./plugins-DJGW_fnS.js";import"./accounts-Z5bJpNrG.js";import"./bindings-D0uket3l.js";import"./send-gG3CFJwv.js";import"./send-DqJCViFb.js";import"./with-timeout-By0c7Ur9.js";import"./deliver-Bs-FVPQ4.js";import"./accounts-DoJYLMfS.js";import"./send-mCN63Hkn.js";import"./image-ops-Bg9yFwjX.js";import"./redact-bWj_-q3j.js";import"./errors-t5wHPcwh.js";import"./embedded-helpers-Q5h1lA6D.js";import"./sandbox-BcH7kS1y.js";import"./chrome-IJYO1tSE.js";import"./tailscale-CgCG7AVQ.js";import"./auth-B4Kn3eee.js";import"./server-context-D3iiIzvV.js";import"./routes-7QTsp3sA.js";import"./paths-GamzES41.js";import"./ssrf-BiSQzdcA.js";import"./store-C5LmVaEC.js";import"./ports-LqFTyTSK.js";import"./trash-zs6gNxed.js";import"./accounts-BT-NzzBc.js";import"./paths-BQ9W7Bs0.js";import"./tool-images-DV2HMmx4.js";import"./workspace-Cz9mCy0P.js";import"./reply-prefix-9hmbzubX.js";import"./sqlite-BEgCClMz.js";import"./memory-cli-COgt0ROi.js";import"./manager-Cob4Ofzr.js";import"./gemini-auth-BZgBIY0M.js";import"./retry-Cc6xusE8.js";import"./common-BRdxH-uH.js";import"./runner-68-X3KHf.js";import"./tool-display-BIswnHaq.js";import"./chunk-UPhdkZNp.js";import"./markdown-tables-CpqWBduK.js";import"./fetch-guard-CoGEds8D.js";import"./fetch-CUsKv8oj.js";import"./ir-6L-eU4id.js";import"./render-1ABBE2Y6.js";import"./builderforcellm-syscheck-CyZiwcdF.js";import"./session-utils-VCGKYbgW.js";import"./coding-tools.policy-DIeVRurg.js";import"./pairing-store-tegvJa08.js";import"./fetch-CrbOFvsL.js";import"./exec-approvals-Cn0K-HtJ.js";import"./nodes-screen-OI7tHqlU.js";import"./session-cost-usage-BgZfN_WR.js";import"./provider-usage-BLkm6ojE.js";import"./send-BIR1Jhc5.js";import"./outbound-attachment-3GZbMqo1.js";import"./delivery-queue-DQXq7KUU.js";import"./project-context-DXP12xhk.js";import"./control-service-Cml__v8i.js";import"./stagger-CUH5rlmS.js";import"./channel-selection-DFf_nAm7.js";import"./send-9rUcCK7O.js";import"./resolve-route-D3X-bXU-.js";import"./channel-activity-By7lsk7N.js";import"./tables-DZSV6me6.js";import{t as formatDocsLink}from"./links-B6LU5cXN.js";import{n as runCommandWithRuntime}from"./cli-utils-ByV85M53.js";import"./help-format-DIDk_7gh.js";import"./progress-BQMO_-7I.js";import"./replies-CL0uQgU7.js";import"./onboard-helpers-Di5OXlap.js";import"./prompt-style-CZOeG0sw.js";import"./pairing-labels-DofkNLS2.js";import"./active-listener-BC31MA4v.js";import"./mamba-state-engine-CFwb8DcP.js";import"./transformers-stream-nSL4Xu31.js";import"./note-BvXfFmlu.js";import"./clack-prompter-ZmHdfPGJ.js";import"./helpers-DDS6DSK4.js";import"./daemon-runtime-Ddsn0FJm.js";import"./runtime-guard-BThrXAmT.js";import"./systemd-DpT8tcbh.js";import"./service-ugwM110q.js";import"./health-hXlukqbf.js";import"./onboarding-DBL-H1Qu.js";import"./shared-DjBPjC55.js";import"./onboard-auth.credentials-BSSFRvb0.js";import"./auth-token-DGaO7TMn.js";import"./logging-CRzk-5ye.js";import{n as formatAuthChoiceChoicesForCli}from"./auth-choice-options-BFZquTtL.js";import"./openai-model-default-DIE-Ey58.js";import"./model-picker-Dl3do2OD.js";import"./systemd-linger-CuzOv-tn.js";import"./onboard-custom-BIT8LAFx.js";import{n as ONBOARD_PROVIDER_AUTH_FLAGS,t as onboardCommand}from"./onboard-4JByma4r.js";import"./onboard-interactive-DvNhkCNr.js";function resolveInstallDaemonFlag(command,opts){if(!command||typeof command!=`object`)return;let getOptionValueSource=`getOptionValueSource`in command?command.getOptionValueSource:void 0;if(typeof getOptionValueSource==`function`){if(getOptionValueSource.call(command,`skipDaemon`)===`cli`)return!1;if(getOptionValueSource.call(command,`installDaemon`)===`cli`)return!!opts.installDaemon}}const AUTH_CHOICE_HELP=formatAuthChoiceChoicesForCli({includeLegacyAliases:!0,includeSkip:!0});function registerOnboardCommand(program){let command=program.command(`onboard`).description(`Interactive wizard to set up the gateway, workspace, and skills`).addHelpText(`after`,()=>`\n${theme.muted(`Docs:`)} ${formatDocsLink(`/cli/onboard`,`docs.builderforce.ai/cli/onboard`)}\n`).option(`--workspace <dir>`,`Agent workspace directory (default: ~/.builderforce/workspace)`).option(`--reset`,`Reset config + credentials + sessions + workspace before running wizard`).option(`--non-interactive`,`Run without prompts`,!1).option(`--accept-risk`,`Acknowledge that agents are powerful and full system access is risky (required for --non-interactive)`,!1).option(`--flow <flow>`,`Wizard flow: quickstart|advanced|manual`).option(`--mode <mode>`,`Wizard mode: local|remote`).option(`--auth-choice <choice>`,`Auth (default: builderforcellm): ${AUTH_CHOICE_HELP}`).option(`--token-provider <id>`,`Token provider id (non-interactive; used with --auth-choice token)`).option(`--token <token>`,`Token value (non-interactive; used with --auth-choice token)`).option(`--token-profile-id <id>`,`Auth profile id (non-interactive; default: <provider>:manual)`).option(`--token-expires-in <duration>`,`Optional token expiry duration (e.g. 365d, 12h)`).option(`--cloudflare-ai-gateway-account-id <id>`,`Cloudflare Account ID`).option(`--cloudflare-ai-gateway-gateway-id <id>`,`Cloudflare AI Gateway ID`);for(let providerFlag of ONBOARD_PROVIDER_AUTH_FLAGS)command.option(providerFlag.cliOption,providerFlag.description);command.option(`--custom-base-url <url>`,`Custom provider base URL`).option(`--custom-api-key <key>`,`Custom provider API key (optional)`).option(`--custom-model-id <id>`,`Custom provider model ID`).option(`--custom-provider-id <id>`,`Custom provider ID (optional; auto-derived by default)`).option(`--custom-compatibility <mode>`,`Custom provider API compatibility: openai|anthropic (default: openai)`).option(`--gateway-port <port>`,`Gateway port`).option(`--gateway-bind <mode>`,`Gateway bind: loopback|tailnet|lan|auto|custom`).option(`--gateway-auth <mode>`,`Gateway auth: token|password`).option(`--gateway-token <token>`,`Gateway token (token auth)`).option(`--gateway-password <password>`,`Gateway password (password auth)`).option(`--remote-url <url>`,`Remote Gateway WebSocket URL`).option(`--remote-token <token>`,`Remote Gateway token (optional)`).option(`--tailscale <mode>`,`Tailscale: off|serve|funnel`).option(`--tailscale-reset-on-exit`,`Reset tailscale serve/funnel on exit`).option(`--install-daemon`,`Install gateway service`).option(`--no-install-daemon`,`Skip gateway service install`).option(`--skip-daemon`,`Skip gateway service install`).option(`--daemon-runtime <runtime>`,`Daemon runtime: node|bun`).option(`--skip-channels`,`Skip channel setup`).option(`--skip-skills`,`Skip skills setup`).option(`--skip-health`,`Skip health check`).option(`--skip-ui`,`Skip Control UI/TUI prompts`).option(`--node-manager <name>`,`Node manager for skills: npm|pnpm|bun`).option(`--json`,`Output JSON summary`,!1),command.action(async(opts,commandRuntime)=>{await runCommandWithRuntime(defaultRuntime,async()=>{let installDaemon=resolveInstallDaemonFlag(commandRuntime,{installDaemon:!!opts.installDaemon}),gatewayPort=typeof opts.gatewayPort==`string`?Number.parseInt(opts.gatewayPort,10):void 0;await onboardCommand({workspace:opts.workspace,nonInteractive:!!opts.nonInteractive,acceptRisk:!!opts.acceptRisk,flow:opts.flow,mode:opts.mode,authChoice:opts.authChoice,tokenProvider:opts.tokenProvider,token:opts.token,tokenProfileId:opts.tokenProfileId,tokenExpiresIn:opts.tokenExpiresIn,anthropicApiKey:opts.anthropicApiKey,openaiApiKey:opts.openaiApiKey,openrouterApiKey:opts.openrouterApiKey,aiGatewayApiKey:opts.aiGatewayApiKey,cloudflareAiGatewayAccountId:opts.cloudflareAiGatewayAccountId,cloudflareAiGatewayGatewayId:opts.cloudflareAiGatewayGatewayId,cloudflareAiGatewayApiKey:opts.cloudflareAiGatewayApiKey,moonshotApiKey:opts.moonshotApiKey,kimiCodeApiKey:opts.kimiCodeApiKey,geminiApiKey:opts.geminiApiKey,zaiApiKey:opts.zaiApiKey,xiaomiApiKey:opts.xiaomiApiKey,qianfanApiKey:opts.qianfanApiKey,minimaxApiKey:opts.minimaxApiKey,syntheticApiKey:opts.syntheticApiKey,veniceApiKey:opts.veniceApiKey,togetherApiKey:opts.togetherApiKey,huggingfaceApiKey:opts.huggingfaceApiKey,opencodeZenApiKey:opts.opencodeZenApiKey,xaiApiKey:opts.xaiApiKey,litellmApiKey:opts.litellmApiKey,customBaseUrl:opts.customBaseUrl,customApiKey:opts.customApiKey,customModelId:opts.customModelId,customProviderId:opts.customProviderId,customCompatibility:opts.customCompatibility,gatewayPort:typeof gatewayPort==`number`&&Number.isFinite(gatewayPort)?gatewayPort:void 0,gatewayBind:opts.gatewayBind,gatewayAuth:opts.gatewayAuth,gatewayToken:opts.gatewayToken,gatewayPassword:opts.gatewayPassword,remoteUrl:opts.remoteUrl,remoteToken:opts.remoteToken,tailscale:opts.tailscale,tailscaleResetOnExit:!!opts.tailscaleResetOnExit,reset:!!opts.reset,installDaemon,daemonRuntime:opts.daemonRuntime,skipChannels:!!opts.skipChannels,skipSkills:!!opts.skipSkills,skipHealth:!!opts.skipHealth,skipUi:!!opts.skipUi,nodeManager:opts.nodeManager,json:!!opts.json},defaultRuntime)})})}export{registerOnboardCommand};
1
+ import"./paths-BHg-VHB4.js";import"./registry-Cv7CoWAs.js";import{z as theme}from"./utils-BP60e80M.js";import{p as defaultRuntime}from"./subsystem-C4b1Von0.js";import"./boolean-ssGoaBPk.js";import"./env-BoE8QSib.js";import"./warning-filter-nSTjpMIH.js";import"./auth-profiles-BARnVAUE.js";import"./logger-AbH8mdkv.js";import"./session-key-D--2AEus.js";import"./builderforce-root-D3-p8W2n.js";import"./exec-CGuYALEs.js";import"./agent-scope-BcoQBOwz.js";import"./env-file-BIKVpYUN.js";import"./io-BySzqKzT.js";import"./manifest-registry-DtqFvEIR.js";import"./config-Bwt58P9r.js";import"./model-discovery-DxpimsRF.js";import"./model-catalog-wcISK04b.js";import"./frontmatter-DgRc5y_l.js";import"./skills-W00EPvKR.js";import"./plugin-skills-BSUncenp.js";import"./refresh-bgGvF0aF.js";import"./client-DeQ0LbP9.js";import"./call-CjC3SRPv.js";import"./message-channel-C-yw5fZm.js";import"./subagent-registry-BUKplZi1.js";import"./sessions-ko0LxxGk.js";import"./src-BM8G-tIl.js";import"./project-context-store-BSIWJD6S.js";import"./tokens-BNwTTeJb.js";import"./plugins-DJGW_fnS.js";import"./accounts-Z5bJpNrG.js";import"./bindings-D0uket3l.js";import"./send-gG3CFJwv.js";import"./send-DqJCViFb.js";import"./with-timeout-By0c7Ur9.js";import"./deliver-DFhj1d_t.js";import"./accounts-DoJYLMfS.js";import"./send-mCN63Hkn.js";import"./image-ops-Bg9yFwjX.js";import"./redact-bWj_-q3j.js";import"./errors-t5wHPcwh.js";import"./embedded-helpers-DGDYymYx.js";import"./sandbox-BcH7kS1y.js";import"./chrome-IJYO1tSE.js";import"./tailscale-CgCG7AVQ.js";import"./auth-B4Kn3eee.js";import"./server-context-D3iiIzvV.js";import"./routes-7QTsp3sA.js";import"./paths-GamzES41.js";import"./ssrf-BiSQzdcA.js";import"./store-C5LmVaEC.js";import"./ports-LqFTyTSK.js";import"./trash-zs6gNxed.js";import"./accounts-BT-NzzBc.js";import"./paths-BQ9W7Bs0.js";import"./tool-images-DV2HMmx4.js";import"./workspace-Cz9mCy0P.js";import"./reply-prefix-9hmbzubX.js";import"./sqlite-BEgCClMz.js";import"./memory-cli-COgt0ROi.js";import"./manager-Cob4Ofzr.js";import"./gemini-auth-BZgBIY0M.js";import"./retry-Cc6xusE8.js";import"./common-BRdxH-uH.js";import"./runner-BLCTET8O.js";import"./tool-display-BIswnHaq.js";import"./chunk-UPhdkZNp.js";import"./markdown-tables-CpqWBduK.js";import"./fetch-guard-CoGEds8D.js";import"./fetch-CUsKv8oj.js";import"./ir-6L-eU4id.js";import"./render-1ABBE2Y6.js";import"./builderforcellm-syscheck-CfFrfeV2.js";import"./session-utils-VCGKYbgW.js";import"./coding-tools.policy-DIeVRurg.js";import"./pairing-store-tegvJa08.js";import"./fetch-CrbOFvsL.js";import"./exec-approvals-Cn0K-HtJ.js";import"./nodes-screen-OI7tHqlU.js";import"./session-cost-usage-BgZfN_WR.js";import"./provider-usage-BLkm6ojE.js";import"./send-BIR1Jhc5.js";import"./outbound-attachment-3GZbMqo1.js";import"./delivery-queue-DQXq7KUU.js";import"./project-context-C5KLsMTc.js";import"./control-service-Cml__v8i.js";import"./stagger-CUH5rlmS.js";import"./channel-selection-DFf_nAm7.js";import"./send-9rUcCK7O.js";import"./resolve-route-D3X-bXU-.js";import"./channel-activity-By7lsk7N.js";import"./tables-DZSV6me6.js";import{t as formatDocsLink}from"./links-B6LU5cXN.js";import{n as runCommandWithRuntime}from"./cli-utils-ByV85M53.js";import"./help-format-DIDk_7gh.js";import"./progress-BQMO_-7I.js";import"./replies-CL0uQgU7.js";import"./onboard-helpers-Di5OXlap.js";import"./prompt-style-CZOeG0sw.js";import"./pairing-labels-DofkNLS2.js";import"./active-listener-BC31MA4v.js";import"./mamba-state-engine-BYmUnYwn.js";import"./transformers-stream-nSL4Xu31.js";import"./note-BvXfFmlu.js";import"./clack-prompter-ZmHdfPGJ.js";import"./helpers-DDS6DSK4.js";import"./daemon-runtime-Ddsn0FJm.js";import"./runtime-guard-BThrXAmT.js";import"./systemd-DpT8tcbh.js";import"./service-ugwM110q.js";import"./health-CRIXA8je.js";import"./onboarding-CYOfGpd5.js";import"./shared-DjBPjC55.js";import"./onboard-auth.credentials-BSSFRvb0.js";import"./auth-token-DGaO7TMn.js";import"./logging-CRzk-5ye.js";import{n as formatAuthChoiceChoicesForCli}from"./auth-choice-options-BFZquTtL.js";import"./openai-model-default-DIE-Ey58.js";import"./model-picker-Dl3do2OD.js";import"./systemd-linger-CuzOv-tn.js";import"./onboard-custom-BIT8LAFx.js";import{n as ONBOARD_PROVIDER_AUTH_FLAGS,t as onboardCommand}from"./onboard-BHlI_UVY.js";import"./onboard-interactive-ClPMlCIl.js";function resolveInstallDaemonFlag(command,opts){if(!command||typeof command!=`object`)return;let getOptionValueSource=`getOptionValueSource`in command?command.getOptionValueSource:void 0;if(typeof getOptionValueSource==`function`){if(getOptionValueSource.call(command,`skipDaemon`)===`cli`)return!1;if(getOptionValueSource.call(command,`installDaemon`)===`cli`)return!!opts.installDaemon}}const AUTH_CHOICE_HELP=formatAuthChoiceChoicesForCli({includeLegacyAliases:!0,includeSkip:!0});function registerOnboardCommand(program){let command=program.command(`onboard`).description(`Interactive wizard to set up the gateway, workspace, and skills`).addHelpText(`after`,()=>`\n${theme.muted(`Docs:`)} ${formatDocsLink(`/cli/onboard`,`docs.builderforce.ai/cli/onboard`)}\n`).option(`--workspace <dir>`,`Agent workspace directory (default: ~/.builderforce/workspace)`).option(`--reset`,`Reset config + credentials + sessions + workspace before running wizard`).option(`--non-interactive`,`Run without prompts`,!1).option(`--accept-risk`,`Acknowledge that agents are powerful and full system access is risky (required for --non-interactive)`,!1).option(`--flow <flow>`,`Wizard flow: quickstart|advanced|manual`).option(`--mode <mode>`,`Wizard mode: local|remote`).option(`--auth-choice <choice>`,`Auth (default: builderforcellm): ${AUTH_CHOICE_HELP}`).option(`--token-provider <id>`,`Token provider id (non-interactive; used with --auth-choice token)`).option(`--token <token>`,`Token value (non-interactive; used with --auth-choice token)`).option(`--token-profile-id <id>`,`Auth profile id (non-interactive; default: <provider>:manual)`).option(`--token-expires-in <duration>`,`Optional token expiry duration (e.g. 365d, 12h)`).option(`--cloudflare-ai-gateway-account-id <id>`,`Cloudflare Account ID`).option(`--cloudflare-ai-gateway-gateway-id <id>`,`Cloudflare AI Gateway ID`);for(let providerFlag of ONBOARD_PROVIDER_AUTH_FLAGS)command.option(providerFlag.cliOption,providerFlag.description);command.option(`--custom-base-url <url>`,`Custom provider base URL`).option(`--custom-api-key <key>`,`Custom provider API key (optional)`).option(`--custom-model-id <id>`,`Custom provider model ID`).option(`--custom-provider-id <id>`,`Custom provider ID (optional; auto-derived by default)`).option(`--custom-compatibility <mode>`,`Custom provider API compatibility: openai|anthropic (default: openai)`).option(`--gateway-port <port>`,`Gateway port`).option(`--gateway-bind <mode>`,`Gateway bind: loopback|tailnet|lan|auto|custom`).option(`--gateway-auth <mode>`,`Gateway auth: token|password`).option(`--gateway-token <token>`,`Gateway token (token auth)`).option(`--gateway-password <password>`,`Gateway password (password auth)`).option(`--remote-url <url>`,`Remote Gateway WebSocket URL`).option(`--remote-token <token>`,`Remote Gateway token (optional)`).option(`--tailscale <mode>`,`Tailscale: off|serve|funnel`).option(`--tailscale-reset-on-exit`,`Reset tailscale serve/funnel on exit`).option(`--install-daemon`,`Install gateway service`).option(`--no-install-daemon`,`Skip gateway service install`).option(`--skip-daemon`,`Skip gateway service install`).option(`--daemon-runtime <runtime>`,`Daemon runtime: node|bun`).option(`--skip-channels`,`Skip channel setup`).option(`--skip-skills`,`Skip skills setup`).option(`--skip-health`,`Skip health check`).option(`--skip-ui`,`Skip Control UI/TUI prompts`).option(`--node-manager <name>`,`Node manager for skills: npm|pnpm|bun`).option(`--json`,`Output JSON summary`,!1),command.action(async(opts,commandRuntime)=>{await runCommandWithRuntime(defaultRuntime,async()=>{let installDaemon=resolveInstallDaemonFlag(commandRuntime,{installDaemon:!!opts.installDaemon}),gatewayPort=typeof opts.gatewayPort==`string`?Number.parseInt(opts.gatewayPort,10):void 0;await onboardCommand({workspace:opts.workspace,nonInteractive:!!opts.nonInteractive,acceptRisk:!!opts.acceptRisk,flow:opts.flow,mode:opts.mode,authChoice:opts.authChoice,tokenProvider:opts.tokenProvider,token:opts.token,tokenProfileId:opts.tokenProfileId,tokenExpiresIn:opts.tokenExpiresIn,anthropicApiKey:opts.anthropicApiKey,openaiApiKey:opts.openaiApiKey,openrouterApiKey:opts.openrouterApiKey,aiGatewayApiKey:opts.aiGatewayApiKey,cloudflareAiGatewayAccountId:opts.cloudflareAiGatewayAccountId,cloudflareAiGatewayGatewayId:opts.cloudflareAiGatewayGatewayId,cloudflareAiGatewayApiKey:opts.cloudflareAiGatewayApiKey,moonshotApiKey:opts.moonshotApiKey,kimiCodeApiKey:opts.kimiCodeApiKey,geminiApiKey:opts.geminiApiKey,zaiApiKey:opts.zaiApiKey,xiaomiApiKey:opts.xiaomiApiKey,qianfanApiKey:opts.qianfanApiKey,minimaxApiKey:opts.minimaxApiKey,syntheticApiKey:opts.syntheticApiKey,veniceApiKey:opts.veniceApiKey,togetherApiKey:opts.togetherApiKey,huggingfaceApiKey:opts.huggingfaceApiKey,opencodeZenApiKey:opts.opencodeZenApiKey,xaiApiKey:opts.xaiApiKey,litellmApiKey:opts.litellmApiKey,customBaseUrl:opts.customBaseUrl,customApiKey:opts.customApiKey,customModelId:opts.customModelId,customProviderId:opts.customProviderId,customCompatibility:opts.customCompatibility,gatewayPort:typeof gatewayPort==`number`&&Number.isFinite(gatewayPort)?gatewayPort:void 0,gatewayBind:opts.gatewayBind,gatewayAuth:opts.gatewayAuth,gatewayToken:opts.gatewayToken,gatewayPassword:opts.gatewayPassword,remoteUrl:opts.remoteUrl,remoteToken:opts.remoteToken,tailscale:opts.tailscale,tailscaleResetOnExit:!!opts.tailscaleResetOnExit,reset:!!opts.reset,installDaemon,daemonRuntime:opts.daemonRuntime,skipChannels:!!opts.skipChannels,skipSkills:!!opts.skipSkills,skipHealth:!!opts.skipHealth,skipUi:!!opts.skipUi,nodeManager:opts.nodeManager,json:!!opts.json},defaultRuntime)})})}export{registerOnboardCommand};
@@ -1 +1 @@
1
- import"./paths-5FcIFMsj.js";import{B as theme}from"./utils-DbaBVFaK.js";import"./embedded-helpers-BrfnCpCe.js";import"./reply-BsRbeUhd.js";import"./session-key-EoB0qaG9.js";import"./builderforce-root-D64_sXEi.js";import{i as defaultRuntime}from"./subsystem-B3TqcCrZ.js";import"./registry-TdK-aV05.js";import"./logger-Bch0bx9c.js";import"./exec-DdcIjeyn.js";import"./agent-scope-DPtjOxzp.js";import"./model-selection-DX_WOc2P.js";import"./env-file-BI2jpOmF.js";import"./boolean-Cn4K2fc9.js";import"./env-BHP32i7Q.js";import"./io-YzT_09GD.js";import"./manifest-registry-BVDm_CP0.js";import"./config-8x9ZIdfF.js";import"./runner-CfNJMPWu.js";import"./model-catalog-C7PdRY6w.js";import"./sandbox-DzuXOMNa.js";import"./chrome-Dk-WNIhp.js";import"./tailscale-B-VKIlWm.js";import"./auth-CDcrUXYB.js";import"./server-context-DsuST81W.js";import"./frontmatter-DyJ2unbL.js";import"./skills-B4r9m770.js";import"./plugin-skills-C39wi4uD.js";import"./routes-DoGqdgOP.js";import"./redact-C3oo7_aY.js";import"./errors-CjmtpPBP.js";import"./paths-C1QKdGJX.js";import"./ssrf-4MnoQ7Sz.js";import"./image-ops-CONrkLJK.js";import"./store-BoTKCB2d.js";import"./ports-BNC_iRpw.js";import"./trash-Czxs8cUf.js";import"./sessions-OZNhnSwZ.js";import"./message-channel-DrfCCUg4.js";import"./plugins-COtQnUML.js";import"./accounts-CTKk3xPO.js";import"./accounts-DFqpWzeU.js";import"./accounts-CbQihLRU.js";import"./bindings-DMDv84HS.js";import"./send-Dmzp1gNF.js";import"./send-DEgD1Cfd.js";import"./paths-CkcK939O.js";import"./src-DxNC0IHE.js";import"./tool-images-DsKy1uNN.js";import"./tool-display-TRKLY-yH.js";import"./fetch-guard-BQuCLA1C.js";import"./api-key-rotation-ChHXb1Pq.js";import"./fetch-CDeJQlzN.js";import"./sqlite-DEiKj1vi.js";import"./tokens-Ct4DyfhX.js";import"./project-context-store-C8TROXjr.js";import"./with-timeout-YbYylXgf.js";import"./deliver-C5lVQcrs.js";import"./send-DlPwTVpG.js";import"./workspace-ChbaDWgp.js";import"./reply-prefix-BwtP84WV.js";import"./memory-cli-DWEtZrJ5.js";import"./manager-VPNjVm0W.js";import"./retry-Jis-ZZfm.js";import"./client-DhlZRznX.js";import"./call-DwWslKWv.js";import"./common-NHQnma5l.js";import"./chunk-h7FZEwW2.js";import"./markdown-tables-DOq8FfUr.js";import"./ir-AM9J0QtO.js";import"./render-CSLaFZoy.js";import"./builderforcellm-syscheck-DMjMJNFI.js";import"./send-DglIOKdS.js";import"./outbound-attachment-TWzrIR9Q.js";import"./fetch-B6_hd7w9.js";import"./delivery-queue-BZWZDdpJ.js";import"./channel-activity-qRD5c3VV.js";import"./tables-DirB1oU7.js";import"./pairing-store-DIpKOfDK.js";import{t as formatDocsLink}from"./links-CYRGsVCu.js";import{n as runCommandWithRuntime}from"./cli-utils-BLNnV_WG.js";import"./help-format-NhTn4dWd.js";import"./progress-OKwbfa23.js";import"./resolve-route-BvfmiLqC.js";import"./replies-BoxyKuBS.js";import"./refresh-DgTiir08.js";import"./coding-tools.policy-BJQuylwM.js";import"./send-BgdpJymE.js";import"./onboard-helpers-CPmBeDvt.js";import"./prompt-style-BwwmGo3-.js";import"./pairing-labels-CELZqNBC.js";import"./session-cost-usage-pgxrRRW4.js";import"./provider-usage-CbH7sm73.js";import"./active-listener-DBdxNyOd.js";import"./exec-approvals-kmxxyvIe.js";import"./nodes-screen-BWDONgPE.js";import"./project-context-Cnqfr64Z.js";import"./control-service-BhSaBRxC.js";import"./stagger-NaB6u1z1.js";import"./channel-selection-CQ5MM7Hi.js";import"./mamba-state-engine-Ck2JCfL6.js";import"./transformers-stream-QS2dnQob.js";import"./runtime-guard-BiPTd1ED.js";import"./note-CvzMolLy.js";import"./clack-prompter-6Booc-eg.js";import"./helpers-_XD3UAOf.js";import"./daemon-runtime-CHo7loUb.js";import"./systemd-CTHIdkg9.js";import"./service-BXrSjb3e.js";import"./health-B_qWRpsT.js";import"./onboarding-CIxLpuFP.js";import"./shared-eZqGzEHT.js";import"./onboard-auth.credentials-YrdiGOgn.js";import"./auth-token-CWT7TW8z.js";import"./logging-9jbJihk2.js";import{n as formatAuthChoiceChoicesForCli}from"./auth-choice-options-CQx1xEID.js";import"./openai-model-default-DR3m7RLi.js";import"./model-picker-CjrWGzFG.js";import"./systemd-linger-RhNkOjuf.js";import"./onboard-custom-B3GdG4Gx.js";import{n as ONBOARD_PROVIDER_AUTH_FLAGS,t as onboardCommand}from"./onboard-Dq_XQQXY.js";import"./onboard-interactive-DyyEDd9a.js";function resolveInstallDaemonFlag(command,opts){if(!command||typeof command!=`object`)return;let getOptionValueSource=`getOptionValueSource`in command?command.getOptionValueSource:void 0;if(typeof getOptionValueSource==`function`){if(getOptionValueSource.call(command,`skipDaemon`)===`cli`)return!1;if(getOptionValueSource.call(command,`installDaemon`)===`cli`)return!!opts.installDaemon}}const AUTH_CHOICE_HELP=formatAuthChoiceChoicesForCli({includeLegacyAliases:!0,includeSkip:!0});function registerOnboardCommand(program){let command=program.command(`onboard`).description(`Interactive wizard to set up the gateway, workspace, and skills`).addHelpText(`after`,()=>`\n${theme.muted(`Docs:`)} ${formatDocsLink(`/cli/onboard`,`docs.builderforce.ai/cli/onboard`)}\n`).option(`--workspace <dir>`,`Agent workspace directory (default: ~/.builderforce/workspace)`).option(`--reset`,`Reset config + credentials + sessions + workspace before running wizard`).option(`--non-interactive`,`Run without prompts`,!1).option(`--accept-risk`,`Acknowledge that agents are powerful and full system access is risky (required for --non-interactive)`,!1).option(`--flow <flow>`,`Wizard flow: quickstart|advanced|manual`).option(`--mode <mode>`,`Wizard mode: local|remote`).option(`--auth-choice <choice>`,`Auth (default: builderforcellm): ${AUTH_CHOICE_HELP}`).option(`--token-provider <id>`,`Token provider id (non-interactive; used with --auth-choice token)`).option(`--token <token>`,`Token value (non-interactive; used with --auth-choice token)`).option(`--token-profile-id <id>`,`Auth profile id (non-interactive; default: <provider>:manual)`).option(`--token-expires-in <duration>`,`Optional token expiry duration (e.g. 365d, 12h)`).option(`--cloudflare-ai-gateway-account-id <id>`,`Cloudflare Account ID`).option(`--cloudflare-ai-gateway-gateway-id <id>`,`Cloudflare AI Gateway ID`);for(let providerFlag of ONBOARD_PROVIDER_AUTH_FLAGS)command.option(providerFlag.cliOption,providerFlag.description);command.option(`--custom-base-url <url>`,`Custom provider base URL`).option(`--custom-api-key <key>`,`Custom provider API key (optional)`).option(`--custom-model-id <id>`,`Custom provider model ID`).option(`--custom-provider-id <id>`,`Custom provider ID (optional; auto-derived by default)`).option(`--custom-compatibility <mode>`,`Custom provider API compatibility: openai|anthropic (default: openai)`).option(`--gateway-port <port>`,`Gateway port`).option(`--gateway-bind <mode>`,`Gateway bind: loopback|tailnet|lan|auto|custom`).option(`--gateway-auth <mode>`,`Gateway auth: token|password`).option(`--gateway-token <token>`,`Gateway token (token auth)`).option(`--gateway-password <password>`,`Gateway password (password auth)`).option(`--remote-url <url>`,`Remote Gateway WebSocket URL`).option(`--remote-token <token>`,`Remote Gateway token (optional)`).option(`--tailscale <mode>`,`Tailscale: off|serve|funnel`).option(`--tailscale-reset-on-exit`,`Reset tailscale serve/funnel on exit`).option(`--install-daemon`,`Install gateway service`).option(`--no-install-daemon`,`Skip gateway service install`).option(`--skip-daemon`,`Skip gateway service install`).option(`--daemon-runtime <runtime>`,`Daemon runtime: node|bun`).option(`--skip-channels`,`Skip channel setup`).option(`--skip-skills`,`Skip skills setup`).option(`--skip-health`,`Skip health check`).option(`--skip-ui`,`Skip Control UI/TUI prompts`).option(`--node-manager <name>`,`Node manager for skills: npm|pnpm|bun`).option(`--json`,`Output JSON summary`,!1),command.action(async(opts,commandRuntime)=>{await runCommandWithRuntime(defaultRuntime,async()=>{let installDaemon=resolveInstallDaemonFlag(commandRuntime,{installDaemon:!!opts.installDaemon}),gatewayPort=typeof opts.gatewayPort==`string`?Number.parseInt(opts.gatewayPort,10):void 0;await onboardCommand({workspace:opts.workspace,nonInteractive:!!opts.nonInteractive,acceptRisk:!!opts.acceptRisk,flow:opts.flow,mode:opts.mode,authChoice:opts.authChoice,tokenProvider:opts.tokenProvider,token:opts.token,tokenProfileId:opts.tokenProfileId,tokenExpiresIn:opts.tokenExpiresIn,anthropicApiKey:opts.anthropicApiKey,openaiApiKey:opts.openaiApiKey,openrouterApiKey:opts.openrouterApiKey,aiGatewayApiKey:opts.aiGatewayApiKey,cloudflareAiGatewayAccountId:opts.cloudflareAiGatewayAccountId,cloudflareAiGatewayGatewayId:opts.cloudflareAiGatewayGatewayId,cloudflareAiGatewayApiKey:opts.cloudflareAiGatewayApiKey,moonshotApiKey:opts.moonshotApiKey,kimiCodeApiKey:opts.kimiCodeApiKey,geminiApiKey:opts.geminiApiKey,zaiApiKey:opts.zaiApiKey,xiaomiApiKey:opts.xiaomiApiKey,qianfanApiKey:opts.qianfanApiKey,minimaxApiKey:opts.minimaxApiKey,syntheticApiKey:opts.syntheticApiKey,veniceApiKey:opts.veniceApiKey,togetherApiKey:opts.togetherApiKey,huggingfaceApiKey:opts.huggingfaceApiKey,opencodeZenApiKey:opts.opencodeZenApiKey,xaiApiKey:opts.xaiApiKey,litellmApiKey:opts.litellmApiKey,customBaseUrl:opts.customBaseUrl,customApiKey:opts.customApiKey,customModelId:opts.customModelId,customProviderId:opts.customProviderId,customCompatibility:opts.customCompatibility,gatewayPort:typeof gatewayPort==`number`&&Number.isFinite(gatewayPort)?gatewayPort:void 0,gatewayBind:opts.gatewayBind,gatewayAuth:opts.gatewayAuth,gatewayToken:opts.gatewayToken,gatewayPassword:opts.gatewayPassword,remoteUrl:opts.remoteUrl,remoteToken:opts.remoteToken,tailscale:opts.tailscale,tailscaleResetOnExit:!!opts.tailscaleResetOnExit,reset:!!opts.reset,installDaemon,daemonRuntime:opts.daemonRuntime,skipChannels:!!opts.skipChannels,skipSkills:!!opts.skipSkills,skipHealth:!!opts.skipHealth,skipUi:!!opts.skipUi,nodeManager:opts.nodeManager,json:!!opts.json},defaultRuntime)})})}export{registerOnboardCommand};
1
+ import"./paths-5FcIFMsj.js";import{B as theme}from"./utils-DbaBVFaK.js";import"./embedded-helpers-3FEGD_4b.js";import"./reply-CpGH-3If.js";import"./session-key-EoB0qaG9.js";import"./builderforce-root-D64_sXEi.js";import{i as defaultRuntime}from"./subsystem-B3TqcCrZ.js";import"./registry-TdK-aV05.js";import"./logger-Bch0bx9c.js";import"./exec-DdcIjeyn.js";import"./agent-scope-DPtjOxzp.js";import"./model-selection-DX_WOc2P.js";import"./env-file-BI2jpOmF.js";import"./boolean-Cn4K2fc9.js";import"./env-BHP32i7Q.js";import"./io-YzT_09GD.js";import"./manifest-registry-BVDm_CP0.js";import"./config-8x9ZIdfF.js";import"./runner-C651oVfk.js";import"./model-catalog-C7PdRY6w.js";import"./sandbox-DzuXOMNa.js";import"./chrome-Dk-WNIhp.js";import"./tailscale-B-VKIlWm.js";import"./auth-CDcrUXYB.js";import"./server-context-DsuST81W.js";import"./frontmatter-DyJ2unbL.js";import"./skills-B4r9m770.js";import"./plugin-skills-C39wi4uD.js";import"./routes-DoGqdgOP.js";import"./redact-C3oo7_aY.js";import"./errors-CjmtpPBP.js";import"./paths-C1QKdGJX.js";import"./ssrf-4MnoQ7Sz.js";import"./image-ops-CONrkLJK.js";import"./store-BoTKCB2d.js";import"./ports-BNC_iRpw.js";import"./trash-Czxs8cUf.js";import"./sessions-OZNhnSwZ.js";import"./message-channel-DrfCCUg4.js";import"./plugins-COtQnUML.js";import"./accounts-CTKk3xPO.js";import"./accounts-DFqpWzeU.js";import"./accounts-CbQihLRU.js";import"./bindings-DMDv84HS.js";import"./send-Dmzp1gNF.js";import"./send-DEgD1Cfd.js";import"./paths-CkcK939O.js";import"./src-D2-7sOAX.js";import"./tool-images-DsKy1uNN.js";import"./tool-display-TRKLY-yH.js";import"./fetch-guard-BQuCLA1C.js";import"./api-key-rotation-ChHXb1Pq.js";import"./fetch-CDeJQlzN.js";import"./sqlite-DEiKj1vi.js";import"./tokens-Ct4DyfhX.js";import"./project-context-store-BS994lZX.js";import"./with-timeout-YbYylXgf.js";import"./deliver-XGIFv80r.js";import"./send-DlPwTVpG.js";import"./workspace-ChbaDWgp.js";import"./reply-prefix-BwtP84WV.js";import"./memory-cli-DWEtZrJ5.js";import"./manager-VPNjVm0W.js";import"./retry-Jis-ZZfm.js";import"./client-DhlZRznX.js";import"./call-DwWslKWv.js";import"./common-NHQnma5l.js";import"./chunk-h7FZEwW2.js";import"./markdown-tables-DOq8FfUr.js";import"./ir-AM9J0QtO.js";import"./render-CSLaFZoy.js";import"./builderforcellm-syscheck-DGZKIwPC.js";import"./send-DglIOKdS.js";import"./outbound-attachment-TWzrIR9Q.js";import"./fetch-B6_hd7w9.js";import"./delivery-queue-BZWZDdpJ.js";import"./channel-activity-qRD5c3VV.js";import"./tables-DirB1oU7.js";import"./pairing-store-DIpKOfDK.js";import{t as formatDocsLink}from"./links-CYRGsVCu.js";import{n as runCommandWithRuntime}from"./cli-utils-BLNnV_WG.js";import"./help-format-NhTn4dWd.js";import"./progress-OKwbfa23.js";import"./resolve-route-BvfmiLqC.js";import"./replies-BoxyKuBS.js";import"./refresh-DgTiir08.js";import"./coding-tools.policy-BJQuylwM.js";import"./send-BgdpJymE.js";import"./onboard-helpers-CPmBeDvt.js";import"./prompt-style-BwwmGo3-.js";import"./pairing-labels-CELZqNBC.js";import"./session-cost-usage-pgxrRRW4.js";import"./provider-usage-CbH7sm73.js";import"./active-listener-DBdxNyOd.js";import"./exec-approvals-kmxxyvIe.js";import"./nodes-screen-BWDONgPE.js";import"./project-context-Cg0S9eFT.js";import"./control-service-BhSaBRxC.js";import"./stagger-NaB6u1z1.js";import"./channel-selection-CQ5MM7Hi.js";import"./mamba-state-engine-BloJzrxU.js";import"./transformers-stream-QS2dnQob.js";import"./runtime-guard-BiPTd1ED.js";import"./note-CvzMolLy.js";import"./clack-prompter-6Booc-eg.js";import"./helpers-_XD3UAOf.js";import"./daemon-runtime-CHo7loUb.js";import"./systemd-CTHIdkg9.js";import"./service-BXrSjb3e.js";import"./health-Cuh0tZl2.js";import"./onboarding-DIxm_q7P.js";import"./shared-eZqGzEHT.js";import"./onboard-auth.credentials-YrdiGOgn.js";import"./auth-token-CWT7TW8z.js";import"./logging-9jbJihk2.js";import{n as formatAuthChoiceChoicesForCli}from"./auth-choice-options-CQx1xEID.js";import"./openai-model-default-DR3m7RLi.js";import"./model-picker-CjrWGzFG.js";import"./systemd-linger-RhNkOjuf.js";import"./onboard-custom-B3GdG4Gx.js";import{n as ONBOARD_PROVIDER_AUTH_FLAGS,t as onboardCommand}from"./onboard-BW5J0Ym8.js";import"./onboard-interactive-D6IBBU8m.js";function resolveInstallDaemonFlag(command,opts){if(!command||typeof command!=`object`)return;let getOptionValueSource=`getOptionValueSource`in command?command.getOptionValueSource:void 0;if(typeof getOptionValueSource==`function`){if(getOptionValueSource.call(command,`skipDaemon`)===`cli`)return!1;if(getOptionValueSource.call(command,`installDaemon`)===`cli`)return!!opts.installDaemon}}const AUTH_CHOICE_HELP=formatAuthChoiceChoicesForCli({includeLegacyAliases:!0,includeSkip:!0});function registerOnboardCommand(program){let command=program.command(`onboard`).description(`Interactive wizard to set up the gateway, workspace, and skills`).addHelpText(`after`,()=>`\n${theme.muted(`Docs:`)} ${formatDocsLink(`/cli/onboard`,`docs.builderforce.ai/cli/onboard`)}\n`).option(`--workspace <dir>`,`Agent workspace directory (default: ~/.builderforce/workspace)`).option(`--reset`,`Reset config + credentials + sessions + workspace before running wizard`).option(`--non-interactive`,`Run without prompts`,!1).option(`--accept-risk`,`Acknowledge that agents are powerful and full system access is risky (required for --non-interactive)`,!1).option(`--flow <flow>`,`Wizard flow: quickstart|advanced|manual`).option(`--mode <mode>`,`Wizard mode: local|remote`).option(`--auth-choice <choice>`,`Auth (default: builderforcellm): ${AUTH_CHOICE_HELP}`).option(`--token-provider <id>`,`Token provider id (non-interactive; used with --auth-choice token)`).option(`--token <token>`,`Token value (non-interactive; used with --auth-choice token)`).option(`--token-profile-id <id>`,`Auth profile id (non-interactive; default: <provider>:manual)`).option(`--token-expires-in <duration>`,`Optional token expiry duration (e.g. 365d, 12h)`).option(`--cloudflare-ai-gateway-account-id <id>`,`Cloudflare Account ID`).option(`--cloudflare-ai-gateway-gateway-id <id>`,`Cloudflare AI Gateway ID`);for(let providerFlag of ONBOARD_PROVIDER_AUTH_FLAGS)command.option(providerFlag.cliOption,providerFlag.description);command.option(`--custom-base-url <url>`,`Custom provider base URL`).option(`--custom-api-key <key>`,`Custom provider API key (optional)`).option(`--custom-model-id <id>`,`Custom provider model ID`).option(`--custom-provider-id <id>`,`Custom provider ID (optional; auto-derived by default)`).option(`--custom-compatibility <mode>`,`Custom provider API compatibility: openai|anthropic (default: openai)`).option(`--gateway-port <port>`,`Gateway port`).option(`--gateway-bind <mode>`,`Gateway bind: loopback|tailnet|lan|auto|custom`).option(`--gateway-auth <mode>`,`Gateway auth: token|password`).option(`--gateway-token <token>`,`Gateway token (token auth)`).option(`--gateway-password <password>`,`Gateway password (password auth)`).option(`--remote-url <url>`,`Remote Gateway WebSocket URL`).option(`--remote-token <token>`,`Remote Gateway token (optional)`).option(`--tailscale <mode>`,`Tailscale: off|serve|funnel`).option(`--tailscale-reset-on-exit`,`Reset tailscale serve/funnel on exit`).option(`--install-daemon`,`Install gateway service`).option(`--no-install-daemon`,`Skip gateway service install`).option(`--skip-daemon`,`Skip gateway service install`).option(`--daemon-runtime <runtime>`,`Daemon runtime: node|bun`).option(`--skip-channels`,`Skip channel setup`).option(`--skip-skills`,`Skip skills setup`).option(`--skip-health`,`Skip health check`).option(`--skip-ui`,`Skip Control UI/TUI prompts`).option(`--node-manager <name>`,`Node manager for skills: npm|pnpm|bun`).option(`--json`,`Output JSON summary`,!1),command.action(async(opts,commandRuntime)=>{await runCommandWithRuntime(defaultRuntime,async()=>{let installDaemon=resolveInstallDaemonFlag(commandRuntime,{installDaemon:!!opts.installDaemon}),gatewayPort=typeof opts.gatewayPort==`string`?Number.parseInt(opts.gatewayPort,10):void 0;await onboardCommand({workspace:opts.workspace,nonInteractive:!!opts.nonInteractive,acceptRisk:!!opts.acceptRisk,flow:opts.flow,mode:opts.mode,authChoice:opts.authChoice,tokenProvider:opts.tokenProvider,token:opts.token,tokenProfileId:opts.tokenProfileId,tokenExpiresIn:opts.tokenExpiresIn,anthropicApiKey:opts.anthropicApiKey,openaiApiKey:opts.openaiApiKey,openrouterApiKey:opts.openrouterApiKey,aiGatewayApiKey:opts.aiGatewayApiKey,cloudflareAiGatewayAccountId:opts.cloudflareAiGatewayAccountId,cloudflareAiGatewayGatewayId:opts.cloudflareAiGatewayGatewayId,cloudflareAiGatewayApiKey:opts.cloudflareAiGatewayApiKey,moonshotApiKey:opts.moonshotApiKey,kimiCodeApiKey:opts.kimiCodeApiKey,geminiApiKey:opts.geminiApiKey,zaiApiKey:opts.zaiApiKey,xiaomiApiKey:opts.xiaomiApiKey,qianfanApiKey:opts.qianfanApiKey,minimaxApiKey:opts.minimaxApiKey,syntheticApiKey:opts.syntheticApiKey,veniceApiKey:opts.veniceApiKey,togetherApiKey:opts.togetherApiKey,huggingfaceApiKey:opts.huggingfaceApiKey,opencodeZenApiKey:opts.opencodeZenApiKey,xaiApiKey:opts.xaiApiKey,litellmApiKey:opts.litellmApiKey,customBaseUrl:opts.customBaseUrl,customApiKey:opts.customApiKey,customModelId:opts.customModelId,customProviderId:opts.customProviderId,customCompatibility:opts.customCompatibility,gatewayPort:typeof gatewayPort==`number`&&Number.isFinite(gatewayPort)?gatewayPort:void 0,gatewayBind:opts.gatewayBind,gatewayAuth:opts.gatewayAuth,gatewayToken:opts.gatewayToken,gatewayPassword:opts.gatewayPassword,remoteUrl:opts.remoteUrl,remoteToken:opts.remoteToken,tailscale:opts.tailscale,tailscaleResetOnExit:!!opts.tailscaleResetOnExit,reset:!!opts.reset,installDaemon,daemonRuntime:opts.daemonRuntime,skipChannels:!!opts.skipChannels,skipSkills:!!opts.skipSkills,skipHealth:!!opts.skipHealth,skipUi:!!opts.skipUi,nodeManager:opts.nodeManager,json:!!opts.json},defaultRuntime)})})}export{registerOnboardCommand};
@@ -1 +1 @@
1
- import"./paths-5FcIFMsj.js";import{B as theme,C as shortenHomePath}from"./utils-DbaBVFaK.js";import"./embedded-helpers-BrfnCpCe.js";import"./reply-BsRbeUhd.js";import"./session-key-EoB0qaG9.js";import"./builderforce-root-D64_sXEi.js";import{i as defaultRuntime}from"./subsystem-B3TqcCrZ.js";import"./registry-TdK-aV05.js";import"./logger-Bch0bx9c.js";import"./exec-DdcIjeyn.js";import{m as DEFAULT_AGENT_WORKSPACE_DIR,w as ensureAgentWorkspace}from"./agent-scope-DPtjOxzp.js";import"./model-selection-DX_WOc2P.js";import"./env-file-BI2jpOmF.js";import"./boolean-Cn4K2fc9.js";import"./env-BHP32i7Q.js";import{c as writeConfigFile,n as createConfigIO}from"./io-YzT_09GD.js";import"./manifest-registry-BVDm_CP0.js";import"./config-8x9ZIdfF.js";import"./runner-CfNJMPWu.js";import"./model-catalog-C7PdRY6w.js";import"./sandbox-DzuXOMNa.js";import"./chrome-Dk-WNIhp.js";import"./tailscale-B-VKIlWm.js";import"./auth-CDcrUXYB.js";import"./server-context-DsuST81W.js";import"./frontmatter-DyJ2unbL.js";import"./skills-B4r9m770.js";import"./plugin-skills-C39wi4uD.js";import"./routes-DoGqdgOP.js";import"./redact-C3oo7_aY.js";import"./errors-CjmtpPBP.js";import"./paths-C1QKdGJX.js";import"./ssrf-4MnoQ7Sz.js";import"./image-ops-CONrkLJK.js";import"./store-BoTKCB2d.js";import"./ports-BNC_iRpw.js";import"./trash-Czxs8cUf.js";import"./sessions-OZNhnSwZ.js";import"./message-channel-DrfCCUg4.js";import"./plugins-COtQnUML.js";import"./accounts-CTKk3xPO.js";import"./accounts-DFqpWzeU.js";import"./accounts-CbQihLRU.js";import"./bindings-DMDv84HS.js";import"./send-Dmzp1gNF.js";import"./send-DEgD1Cfd.js";import{o as resolveSessionTranscriptsDir}from"./paths-CkcK939O.js";import"./src-DxNC0IHE.js";import"./tool-images-DsKy1uNN.js";import"./tool-display-TRKLY-yH.js";import"./fetch-guard-BQuCLA1C.js";import"./api-key-rotation-ChHXb1Pq.js";import"./fetch-CDeJQlzN.js";import"./sqlite-DEiKj1vi.js";import"./tokens-Ct4DyfhX.js";import"./project-context-store-C8TROXjr.js";import"./with-timeout-YbYylXgf.js";import"./deliver-C5lVQcrs.js";import"./send-DlPwTVpG.js";import"./workspace-ChbaDWgp.js";import"./reply-prefix-BwtP84WV.js";import"./memory-cli-DWEtZrJ5.js";import"./manager-VPNjVm0W.js";import"./retry-Jis-ZZfm.js";import"./client-DhlZRznX.js";import"./call-DwWslKWv.js";import"./common-NHQnma5l.js";import"./chunk-h7FZEwW2.js";import"./markdown-tables-DOq8FfUr.js";import"./ir-AM9J0QtO.js";import"./render-CSLaFZoy.js";import"./builderforcellm-syscheck-DMjMJNFI.js";import"./send-DglIOKdS.js";import"./outbound-attachment-TWzrIR9Q.js";import"./fetch-B6_hd7w9.js";import"./delivery-queue-BZWZDdpJ.js";import"./channel-activity-qRD5c3VV.js";import"./tables-DirB1oU7.js";import"./pairing-store-DIpKOfDK.js";import{t as formatDocsLink}from"./links-CYRGsVCu.js";import{n as runCommandWithRuntime}from"./cli-utils-BLNnV_WG.js";import"./help-format-NhTn4dWd.js";import"./progress-OKwbfa23.js";import"./resolve-route-BvfmiLqC.js";import"./replies-BoxyKuBS.js";import"./refresh-DgTiir08.js";import"./coding-tools.policy-BJQuylwM.js";import"./send-BgdpJymE.js";import"./onboard-helpers-CPmBeDvt.js";import"./prompt-style-BwwmGo3-.js";import"./pairing-labels-CELZqNBC.js";import"./session-cost-usage-pgxrRRW4.js";import"./provider-usage-CbH7sm73.js";import"./active-listener-DBdxNyOd.js";import"./exec-approvals-kmxxyvIe.js";import"./nodes-screen-BWDONgPE.js";import"./project-context-Cnqfr64Z.js";import"./control-service-BhSaBRxC.js";import"./stagger-NaB6u1z1.js";import"./channel-selection-CQ5MM7Hi.js";import"./mamba-state-engine-Ck2JCfL6.js";import"./transformers-stream-QS2dnQob.js";import"./runtime-guard-BiPTd1ED.js";import{t as hasExplicitOptions}from"./command-options-BrcCiCUA.js";import"./note-CvzMolLy.js";import"./clack-prompter-6Booc-eg.js";import"./helpers-_XD3UAOf.js";import"./daemon-runtime-CHo7loUb.js";import"./systemd-CTHIdkg9.js";import"./service-BXrSjb3e.js";import"./health-B_qWRpsT.js";import"./onboarding-CIxLpuFP.js";import"./shared-eZqGzEHT.js";import"./onboard-auth.credentials-YrdiGOgn.js";import"./auth-token-CWT7TW8z.js";import{n as logConfigUpdated,t as formatConfigPath}from"./logging-9jbJihk2.js";import"./openai-model-default-DR3m7RLi.js";import"./model-picker-CjrWGzFG.js";import"./systemd-linger-RhNkOjuf.js";import"./onboard-custom-B3GdG4Gx.js";import{t as onboardCommand}from"./onboard-Dq_XQQXY.js";import"./onboard-interactive-DyyEDd9a.js";import JSON5 from"json5";import fs from"node:fs/promises";async function readConfigFileRaw(configPath){try{let raw=await fs.readFile(configPath,`utf-8`),parsed=JSON5.parse(raw);return parsed&&typeof parsed==`object`?{exists:!0,parsed}:{exists:!0,parsed:{}}}catch{return{exists:!1,parsed:{}}}}async function setupCommand(opts,runtime=defaultRuntime){let desiredWorkspace=typeof opts?.workspace==`string`&&opts.workspace.trim()?opts.workspace.trim():void 0,configPath=createConfigIO().configPath,existingRaw=await readConfigFileRaw(configPath),cfg=existingRaw.parsed,defaults=cfg.agents?.defaults??{},workspace=desiredWorkspace??defaults.workspace??DEFAULT_AGENT_WORKSPACE_DIR,next={...cfg,agents:{...cfg.agents,defaults:{...defaults,workspace}}};!existingRaw.exists||defaults.workspace!==workspace?(await writeConfigFile(next),existingRaw.exists?logConfigUpdated(runtime,{path:configPath,suffix:`(set agents.defaults.workspace)`}):runtime.log(`Wrote ${formatConfigPath(configPath)}`)):runtime.log(`Config OK: ${formatConfigPath(configPath)}`);let ws=await ensureAgentWorkspace({dir:workspace,ensureBootstrapFiles:!next.agents?.defaults?.skipBootstrap});runtime.log(`Workspace OK: ${shortenHomePath(ws.dir)}`);let sessionsDir=resolveSessionTranscriptsDir();await fs.mkdir(sessionsDir,{recursive:!0}),runtime.log(`Sessions OK: ${shortenHomePath(sessionsDir)}`)}function registerSetupCommand(program){program.command(`setup`).description(`Initialize ~/.builderforce/builderforce.json and the agent workspace`).addHelpText(`after`,()=>`\n${theme.muted(`Docs:`)} ${formatDocsLink(`/cli/setup`,`docs.builderforce.ai/cli/setup`)}\n`).option(`--workspace <dir>`,`Agent workspace directory (default: ~/.builderforce/workspace; stored as agents.defaults.workspace)`).option(`--wizard`,`Run the interactive onboarding wizard`,!1).option(`--non-interactive`,`Run the wizard without prompts`,!1).option(`--mode <mode>`,`Wizard mode: local|remote`).option(`--remote-url <url>`,`Remote Gateway WebSocket URL`).option(`--remote-token <token>`,`Remote Gateway token (optional)`).action(async(opts,command)=>{await runCommandWithRuntime(defaultRuntime,async()=>{let hasWizardFlags=hasExplicitOptions(command,[`wizard`,`nonInteractive`,`mode`,`remoteUrl`,`remoteToken`]);if(opts.wizard||hasWizardFlags){await onboardCommand({workspace:opts.workspace,nonInteractive:!!opts.nonInteractive,mode:opts.mode,remoteUrl:opts.remoteUrl,remoteToken:opts.remoteToken},defaultRuntime);return}await setupCommand({workspace:opts.workspace},defaultRuntime)})})}export{registerSetupCommand};
1
+ import"./paths-5FcIFMsj.js";import{B as theme,C as shortenHomePath}from"./utils-DbaBVFaK.js";import"./embedded-helpers-3FEGD_4b.js";import"./reply-CpGH-3If.js";import"./session-key-EoB0qaG9.js";import"./builderforce-root-D64_sXEi.js";import{i as defaultRuntime}from"./subsystem-B3TqcCrZ.js";import"./registry-TdK-aV05.js";import"./logger-Bch0bx9c.js";import"./exec-DdcIjeyn.js";import{m as DEFAULT_AGENT_WORKSPACE_DIR,w as ensureAgentWorkspace}from"./agent-scope-DPtjOxzp.js";import"./model-selection-DX_WOc2P.js";import"./env-file-BI2jpOmF.js";import"./boolean-Cn4K2fc9.js";import"./env-BHP32i7Q.js";import{c as writeConfigFile,n as createConfigIO}from"./io-YzT_09GD.js";import"./manifest-registry-BVDm_CP0.js";import"./config-8x9ZIdfF.js";import"./runner-C651oVfk.js";import"./model-catalog-C7PdRY6w.js";import"./sandbox-DzuXOMNa.js";import"./chrome-Dk-WNIhp.js";import"./tailscale-B-VKIlWm.js";import"./auth-CDcrUXYB.js";import"./server-context-DsuST81W.js";import"./frontmatter-DyJ2unbL.js";import"./skills-B4r9m770.js";import"./plugin-skills-C39wi4uD.js";import"./routes-DoGqdgOP.js";import"./redact-C3oo7_aY.js";import"./errors-CjmtpPBP.js";import"./paths-C1QKdGJX.js";import"./ssrf-4MnoQ7Sz.js";import"./image-ops-CONrkLJK.js";import"./store-BoTKCB2d.js";import"./ports-BNC_iRpw.js";import"./trash-Czxs8cUf.js";import"./sessions-OZNhnSwZ.js";import"./message-channel-DrfCCUg4.js";import"./plugins-COtQnUML.js";import"./accounts-CTKk3xPO.js";import"./accounts-DFqpWzeU.js";import"./accounts-CbQihLRU.js";import"./bindings-DMDv84HS.js";import"./send-Dmzp1gNF.js";import"./send-DEgD1Cfd.js";import{o as resolveSessionTranscriptsDir}from"./paths-CkcK939O.js";import"./src-D2-7sOAX.js";import"./tool-images-DsKy1uNN.js";import"./tool-display-TRKLY-yH.js";import"./fetch-guard-BQuCLA1C.js";import"./api-key-rotation-ChHXb1Pq.js";import"./fetch-CDeJQlzN.js";import"./sqlite-DEiKj1vi.js";import"./tokens-Ct4DyfhX.js";import"./project-context-store-BS994lZX.js";import"./with-timeout-YbYylXgf.js";import"./deliver-XGIFv80r.js";import"./send-DlPwTVpG.js";import"./workspace-ChbaDWgp.js";import"./reply-prefix-BwtP84WV.js";import"./memory-cli-DWEtZrJ5.js";import"./manager-VPNjVm0W.js";import"./retry-Jis-ZZfm.js";import"./client-DhlZRznX.js";import"./call-DwWslKWv.js";import"./common-NHQnma5l.js";import"./chunk-h7FZEwW2.js";import"./markdown-tables-DOq8FfUr.js";import"./ir-AM9J0QtO.js";import"./render-CSLaFZoy.js";import"./builderforcellm-syscheck-DGZKIwPC.js";import"./send-DglIOKdS.js";import"./outbound-attachment-TWzrIR9Q.js";import"./fetch-B6_hd7w9.js";import"./delivery-queue-BZWZDdpJ.js";import"./channel-activity-qRD5c3VV.js";import"./tables-DirB1oU7.js";import"./pairing-store-DIpKOfDK.js";import{t as formatDocsLink}from"./links-CYRGsVCu.js";import{n as runCommandWithRuntime}from"./cli-utils-BLNnV_WG.js";import"./help-format-NhTn4dWd.js";import"./progress-OKwbfa23.js";import"./resolve-route-BvfmiLqC.js";import"./replies-BoxyKuBS.js";import"./refresh-DgTiir08.js";import"./coding-tools.policy-BJQuylwM.js";import"./send-BgdpJymE.js";import"./onboard-helpers-CPmBeDvt.js";import"./prompt-style-BwwmGo3-.js";import"./pairing-labels-CELZqNBC.js";import"./session-cost-usage-pgxrRRW4.js";import"./provider-usage-CbH7sm73.js";import"./active-listener-DBdxNyOd.js";import"./exec-approvals-kmxxyvIe.js";import"./nodes-screen-BWDONgPE.js";import"./project-context-Cg0S9eFT.js";import"./control-service-BhSaBRxC.js";import"./stagger-NaB6u1z1.js";import"./channel-selection-CQ5MM7Hi.js";import"./mamba-state-engine-BloJzrxU.js";import"./transformers-stream-QS2dnQob.js";import"./runtime-guard-BiPTd1ED.js";import{t as hasExplicitOptions}from"./command-options-BrcCiCUA.js";import"./note-CvzMolLy.js";import"./clack-prompter-6Booc-eg.js";import"./helpers-_XD3UAOf.js";import"./daemon-runtime-CHo7loUb.js";import"./systemd-CTHIdkg9.js";import"./service-BXrSjb3e.js";import"./health-Cuh0tZl2.js";import"./onboarding-DIxm_q7P.js";import"./shared-eZqGzEHT.js";import"./onboard-auth.credentials-YrdiGOgn.js";import"./auth-token-CWT7TW8z.js";import{n as logConfigUpdated,t as formatConfigPath}from"./logging-9jbJihk2.js";import"./openai-model-default-DR3m7RLi.js";import"./model-picker-CjrWGzFG.js";import"./systemd-linger-RhNkOjuf.js";import"./onboard-custom-B3GdG4Gx.js";import{t as onboardCommand}from"./onboard-BW5J0Ym8.js";import"./onboard-interactive-D6IBBU8m.js";import JSON5 from"json5";import fs from"node:fs/promises";async function readConfigFileRaw(configPath){try{let raw=await fs.readFile(configPath,`utf-8`),parsed=JSON5.parse(raw);return parsed&&typeof parsed==`object`?{exists:!0,parsed}:{exists:!0,parsed:{}}}catch{return{exists:!1,parsed:{}}}}async function setupCommand(opts,runtime=defaultRuntime){let desiredWorkspace=typeof opts?.workspace==`string`&&opts.workspace.trim()?opts.workspace.trim():void 0,configPath=createConfigIO().configPath,existingRaw=await readConfigFileRaw(configPath),cfg=existingRaw.parsed,defaults=cfg.agents?.defaults??{},workspace=desiredWorkspace??defaults.workspace??DEFAULT_AGENT_WORKSPACE_DIR,next={...cfg,agents:{...cfg.agents,defaults:{...defaults,workspace}}};!existingRaw.exists||defaults.workspace!==workspace?(await writeConfigFile(next),existingRaw.exists?logConfigUpdated(runtime,{path:configPath,suffix:`(set agents.defaults.workspace)`}):runtime.log(`Wrote ${formatConfigPath(configPath)}`)):runtime.log(`Config OK: ${formatConfigPath(configPath)}`);let ws=await ensureAgentWorkspace({dir:workspace,ensureBootstrapFiles:!next.agents?.defaults?.skipBootstrap});runtime.log(`Workspace OK: ${shortenHomePath(ws.dir)}`);let sessionsDir=resolveSessionTranscriptsDir();await fs.mkdir(sessionsDir,{recursive:!0}),runtime.log(`Sessions OK: ${shortenHomePath(sessionsDir)}`)}function registerSetupCommand(program){program.command(`setup`).description(`Initialize ~/.builderforce/builderforce.json and the agent workspace`).addHelpText(`after`,()=>`\n${theme.muted(`Docs:`)} ${formatDocsLink(`/cli/setup`,`docs.builderforce.ai/cli/setup`)}\n`).option(`--workspace <dir>`,`Agent workspace directory (default: ~/.builderforce/workspace; stored as agents.defaults.workspace)`).option(`--wizard`,`Run the interactive onboarding wizard`,!1).option(`--non-interactive`,`Run the wizard without prompts`,!1).option(`--mode <mode>`,`Wizard mode: local|remote`).option(`--remote-url <url>`,`Remote Gateway WebSocket URL`).option(`--remote-token <token>`,`Remote Gateway token (optional)`).action(async(opts,command)=>{await runCommandWithRuntime(defaultRuntime,async()=>{let hasWizardFlags=hasExplicitOptions(command,[`wizard`,`nonInteractive`,`mode`,`remoteUrl`,`remoteToken`]);if(opts.wizard||hasWizardFlags){await onboardCommand({workspace:opts.workspace,nonInteractive:!!opts.nonInteractive,mode:opts.mode,remoteUrl:opts.remoteUrl,remoteToken:opts.remoteToken},defaultRuntime);return}await setupCommand({workspace:opts.workspace},defaultRuntime)})})}export{registerSetupCommand};