@seanhogg/builderforce-agents 2026.10.12 → 2026.10.13
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.
- package/dist/{agent-DvDtjczG.js → agent-CeWx2EpQ.js} +1 -1
- package/dist/{agent-DiLX8OzY.js → agent-DrcnpqOF.js} +1 -1
- package/dist/{agents-BawpdEjP.js → agents-CRJM6qhK.js} +1 -1
- package/dist/{agents-COWLUJqm.js → agents-hATFRfwk.js} +1 -1
- package/dist/{audio-preflight-CYQiI74L.js → audio-preflight-B9CfGDD2.js} +1 -1
- package/dist/{audio-preflight-BN1u9Tpc.js → audio-preflight-DHHeocUj.js} +1 -1
- package/dist/{auth-choice-D9VN-WjA.js → auth-choice-CWbPLRN0.js} +1 -1
- package/dist/{auth-choice-3cdcHeim.js → auth-choice-CzhKgWJy.js} +1 -1
- package/dist/{auth-choice.apply-Cd0RR0Z-.js → auth-choice.apply-C0RTYtRN.js} +1 -1
- package/dist/{auth-choice.apply-CMDgoDNN.js → auth-choice.apply-ChrTTHkK.js} +1 -1
- package/dist/{auth-choice.apply-BAeGyEKW.js → auth-choice.apply-D4LYzI8l.js} +1 -1
- package/dist/{auth-choice.apply-CSXvPCea.js → auth-choice.apply-Dy4rVG6K.js} +1 -1
- package/dist/{auth-choice.apply.transformers-DkX2-OZa.js → auth-choice.apply.transformers-9v6HFzNs.js} +1 -1
- package/dist/{auth-choice.apply.transformers-CEVxl3ul.js → auth-choice.apply.transformers-Be8599JD.js} +1 -1
- package/dist/{auth-choice.apply.transformers-B2Nr9M7m.js → auth-choice.apply.transformers-CgfGlqy1.js} +1 -1
- package/dist/{auth-choice.apply.transformers-Dpy9gODo.js → auth-choice.apply.transformers-D9a8-sLS.js} +1 -1
- package/dist/{banner-C93QSUTe.js → banner-8F7-gU1V.js} +1 -1
- package/dist/build-info.json +3 -3
- package/dist/{builderforce-Dl4bZ63C.js → builderforce-CCfM1c79.js} +1 -1
- package/dist/{builderforce-C_tuO46t.js → builderforce-CImLd8Zo.js} +1 -1
- package/dist/bundled/boot-md/handler.js +1 -1
- package/dist/bundled/session-memory/handler.js +1 -1
- package/dist/{channel-options-CiYpNR-1.js → channel-options-CRng-5hZ.js} +1 -1
- package/dist/{channel-options-Cziy0WDc.js → channel-options-D5kOIN7b.js} +1 -1
- package/dist/{channel-web-Ae15MleJ.js → channel-web-B5HSpL4k.js} +1 -1
- package/dist/{channels-cli-CZM033Me.js → channels-cli-COl9TDHT.js} +1 -1
- package/dist/{channels-cli-yi1vxpvO.js → channels-cli-bR8QwOv3.js} +1 -1
- package/dist/chrome-ChzFLAeJ.js +4 -0
- package/dist/chrome-CrqJ4Ijz.js +4 -0
- package/dist/{cli-Bwv_-VuS.js → cli-BqJMHFNK.js} +1 -1
- package/dist/{cli-D8fndSEi.js → cli-DBn0qbHS.js} +1 -1
- package/dist/{command-registry-Cjom5ab0.js → command-registry-BqhtXJa7.js} +1 -1
- package/dist/{command-registry-8uEx2JjY.js → command-registry-DVH79C3B.js} +1 -1
- package/dist/{completion-cli-PTFpWp8Q.js → completion-cli-BFR0u1Uh.js} +1 -1
- package/dist/{completion-cli-LUuqgvVQ.js → completion-cli-BuUAEqQw.js} +1 -1
- package/dist/{completion-cli-DRsz70D2.js → completion-cli-CwaIh4zw.js} +1 -1
- package/dist/{completion-cli-BsXDz7T2.js → completion-cli-Da3-oE7r.js} +1 -1
- package/dist/{config-cli-BIx0enD5.js → config-cli-Bhrj7H1i.js} +1 -1
- package/dist/{config-cli-BFhOXrua.js → config-cli-DOHKZ1lO.js} +1 -1
- package/dist/{configure-D96xLIb6.js → configure-B-Yta1X3.js} +1 -1
- package/dist/{configure-S7YE6hn1.js → configure-BHVk4Ax9.js} +1 -1
- package/dist/{configure-dDKfCq_g.js → configure-D9YZEK_D.js} +1 -1
- package/dist/{configure-C7xdw9Kq.js → configure-DPE2hDzY.js} +1 -1
- package/dist/{deps-CGiO_NDu.js → deps-CrAVOWsA.js} +1 -1
- package/dist/{doctor-completion-ChhIrLd3.js → doctor-completion-CkjrUmbI.js} +1 -1
- package/dist/{doctor-completion-BUZwWoWB.js → doctor-completion-Dh9ah5lH.js} +1 -1
- package/dist/{embedded-DJYMy81Q.js → embedded-BrqzM5oT.js} +12 -12
- package/dist/{embedded-DjDnQMNx.js → embedded-wYxo-ADm.js} +12 -12
- package/dist/entry.js +1 -1
- package/dist/extensionAPI.js +1 -1
- package/dist/{gateway-cli-CN114d5j.js → gateway-cli-C2nh9UyY.js} +2 -2
- package/dist/{gateway-cli-Dzl70YBF.js → gateway-cli-CGkTLhet.js} +2 -2
- package/dist/{health-Cf1YoTRN.js → health-CEz2-7et.js} +1 -1
- package/dist/{health-AlkF1nUa.js → health-CFVx21sO.js} +1 -1
- package/dist/{health-ySVOGGNu.js → health-aKuq4xwa.js} +1 -1
- package/dist/{hooks-cli-6jeFEGg3.js → hooks-cli-DPSrycwI.js} +1 -1
- package/dist/{hooks-cli-DVPMCXUq.js → hooks-cli-uPHs7qnC.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/llm-slug-generator.js +1 -1
- package/dist/{models-CGUxphfN.js → models--TwKHn8b.js} +1 -1
- package/dist/{models-CIMM_Z3u.js → models-BXJebxTU.js} +1 -1
- package/dist/{models-cli-Cijh2uON.js → models-cli-O1zCgeoA.js} +1 -1
- package/dist/{models-cli-Oys3e_I3.js → models-cli-iKu1IVeH.js} +1 -1
- package/dist/{onboard-DAEXNhNd.js → onboard--0I8pdee.js} +1 -1
- package/dist/{onboard-b2fWbf0Q.js → onboard-C40OvMZO.js} +1 -1
- package/dist/{onboard-channels-elaccQRE.js → onboard-channels-BbpyejX4.js} +1 -1
- package/dist/{onboard-channels-Bsd11scA.js → onboard-channels-CoJnsCfd.js} +1 -1
- package/dist/{onboard-channels-C_Q7OUow.js → onboard-channels-ZI4QC9WU.js} +1 -1
- package/dist/{onboard-channels-Tl1X4Pl_.js → onboard-channels-uvIeLPXK.js} +1 -1
- package/dist/{onboard-interactive-DyGNiYRI.js → onboard-interactive-B3Z0XLT6.js} +1 -1
- package/dist/{onboard-interactive-C0qmgHsH.js → onboard-interactive-CJdxqQ1b.js} +1 -1
- package/dist/{onboard-interactive-86s992_v.js → onboard-interactive-COnCCTTW.js} +1 -1
- package/dist/{onboard-interactive-CvMSTjPK.js → onboard-interactive-jss8R9r9.js} +1 -1
- package/dist/{onboarding-DzvbhsaR.js → onboarding-B1BmYWrs.js} +2 -2
- package/dist/{onboarding-B0tbaqZ7.js → onboarding-CdRbvLgp.js} +2 -2
- package/dist/{onboarding.finalize-D-Pi9Blv.js → onboarding.finalize-B0AjF6qZ.js} +1 -1
- package/dist/{onboarding.finalize-CERLBlRF.js → onboarding.finalize-WsL-ijTc.js} +1 -1
- package/dist/{outbound-send-deps-CzhBrVa7.js → outbound-send-deps-DuML6h7r.js} +1 -1
- package/dist/{plugin-registry-DtrHn5NR.js → plugin-registry-BjWNyeVY.js} +1 -1
- package/dist/{plugin-registry-Avx51RIY.js → plugin-registry-Cf_sv-ny.js} +1 -1
- package/dist/{plugin-registry-CFkQDTOt.js → plugin-registry-DdFb5usc.js} +1 -1
- package/dist/{plugin-registry-BEmyRfmb.js → plugin-registry-DrEpL5ac.js} +1 -1
- package/dist/plugin-sdk/{accounts-BwreSNAR.js → accounts-Cy3WCbWg.js} +1 -1
- package/dist/plugin-sdk/{active-listener-DpQ7aGYd.js → active-listener-DVWVNlT9.js} +1 -1
- package/dist/plugin-sdk/agent-runtime/src/agents/tool-retry.d.ts +40 -32
- package/dist/plugin-sdk/agent-runtime/src/builderforce/model/agent-types.d.ts +6 -0
- package/dist/plugin-sdk/{agent-scope-BQByW0cD.js → agent-scope-DgKN27hJ.js} +1 -1
- package/dist/plugin-sdk/{api-key-rotation-yqTCeKjV.js → api-key-rotation-D37jV9ZW.js} +1 -1
- package/dist/plugin-sdk/{audio-preflight-B6uTvVfA.js → audio-preflight-D4xyO8Zq.js} +1 -1
- package/dist/plugin-sdk/{auth-json-Dw6ij9Pa.js → auth-json-nASe57Uw.js} +1 -1
- package/dist/plugin-sdk/{bindings-CDEzl4kl.js → bindings-CH-YLOLC.js} +1 -1
- package/dist/plugin-sdk/{channel-web-DKbpA9xC.js → channel-web-huZSNTX3.js} +1 -1
- package/dist/plugin-sdk/{chrome-DriEqJRH.js → chrome-CRUzg3kA.js} +1 -1
- package/dist/plugin-sdk/{chunk-cW0POl22.js → chunk-C94IAOuf.js} +1 -1
- package/dist/plugin-sdk/{command-format-CAX9XFjI.js → command-format-B3XMq_73.js} +1 -1
- package/dist/plugin-sdk/{common-BxEWhN2X.js → common-n0l_XN-S.js} +1 -1
- package/dist/plugin-sdk/{config-3vPn_hmp.js → config--Ci8Y91R.js} +2 -2
- package/dist/plugin-sdk/{fetch-DH0Y8iyO.js → fetch-B-GxSYRO.js} +1 -1
- package/dist/plugin-sdk/index.js +1 -1
- package/dist/plugin-sdk/{login-Dhdx0bVL.js → login-DZliYZg8.js} +1 -1
- package/dist/plugin-sdk/{login-qr-DAjOuijP.js → login-qr-DKcGvAjv.js} +1 -1
- package/dist/plugin-sdk/{manager-i8psl2Er.js → manager-DioOqJm_.js} +1 -1
- package/dist/plugin-sdk/{markdown-tables-Epim9b-0.js → markdown-tables-BUfhHgfs.js} +1 -1
- package/dist/plugin-sdk/{message-channel-sBPQc_-T.js → message-channel-CuZ2xOAM.js} +1 -1
- package/dist/plugin-sdk/{model-catalog-COVRezOQ.js → model-catalog-DIQ5a-o4.js} +1 -1
- package/dist/plugin-sdk/{model-selection-Crz-xYNU.js → model-selection-_H_U9jWH.js} +1 -1
- package/dist/plugin-sdk/{outbound-CPutSvae.js → outbound-Djibdmi7.js} +1 -1
- package/dist/plugin-sdk/{plugins-CaUOZBVb.js → plugins-BdkC9v5E.js} +1 -1
- package/dist/plugin-sdk/{pw-ai-jI9AWvKe.js → pw-ai-Bbi8Us-p.js} +1 -1
- package/dist/plugin-sdk/{qmd-manager-BRe5fGZw.js → qmd-manager-Dxn0jCpE.js} +1 -1
- package/dist/plugin-sdk/{registry-DJq2Cvo9.js → registry-CZHRcH-q.js} +1 -1
- package/dist/plugin-sdk/{render-BUCRXPIk.js → render-CuA_WRX5.js} +1 -1
- package/dist/plugin-sdk/{replies-CYjI7bye.js → replies-Cf69aZLA.js} +1 -1
- package/dist/plugin-sdk/{reply-B5o-SSYy.js → reply-BOVC-7UD.js} +13 -13
- package/dist/plugin-sdk/{reply-prefix-CCymsmsP.js → reply-prefix-w7kAvH11.js} +1 -1
- package/dist/plugin-sdk/{resolve-route-DN1J7Wyc.js → resolve-route-0sbvl4ZN.js} +1 -1
- package/dist/plugin-sdk/{runner-C2pDJlRw.js → runner-DKoKK09-.js} +4 -4
- package/dist/plugin-sdk/{session-BnleckVX.js → session-DGLuyt10.js} +1 -1
- package/dist/plugin-sdk/{sqlite-BlMLqMl8.js → sqlite-JjFgDV-H.js} +1 -1
- package/dist/plugin-sdk/{subsystem-COTa5Ly_.js → subsystem-D0Ril4rt.js} +1 -1
- package/dist/plugin-sdk/{tool-images-DSpchb4x.js → tool-images-WRTP95FT.js} +1 -1
- package/dist/plugin-sdk/{tool-loop-detection-16p7mJ8N.js → tool-loop-detection-g8gPTCgJ.js} +1 -1
- package/dist/plugin-sdk/web-Cdu8TkUy.js +1 -0
- package/dist/plugin-sdk/{whatsapp-actions-C2B3iw8n.js → whatsapp-actions-CsSzy7G0.js} +1 -1
- package/dist/{plugins-DAlgx58e.js → plugins-Dr1wmnAf.js} +1 -1
- package/dist/{plugins-De7aK3yK.js → plugins-JhEblShx.js} +1 -1
- package/dist/{plugins-cli-CwdUVWjG.js → plugins-cli-DW4hoeeV.js} +1 -1
- package/dist/{plugins-cli-CfVCrrhx.js → plugins-cli-GewV3E8e.js} +1 -1
- package/dist/{program-CFL6mW3l.js → program-bggmBKuL.js} +2 -2
- package/dist/{program-context-DP4Xq9zC.js → program-context-BCTE8zEF.js} +1 -1
- package/dist/{prompt-select-styled-NxrGT7OR.js → prompt-select-styled-BtjhlTEH.js} +1 -1
- package/dist/{prompt-select-styled-Csz9HlSx.js → prompt-select-styled-CaNl41mG.js} +1 -1
- package/dist/{provider-auth-helpers-BMBw21Tn.js → provider-auth-helpers-CWUfg9zf.js} +1 -1
- package/dist/{provider-auth-helpers-VWPvSXPH.js → provider-auth-helpers-y1X8xKVE.js} +1 -1
- package/dist/{provider-dispatcher-CSOHd9zJ.js → provider-dispatcher-CRsPmKhJ.js} +1 -1
- package/dist/{provider-dispatcher-Bg9orQPy.js → provider-dispatcher-D9GbE_Ce.js} +1 -1
- package/dist/{push-apns-rMu8MKXi.js → push-apns-Cb1sQEEa.js} +1 -1
- package/dist/{push-apns-ep5WkyGz.js → push-apns-Cr-6aD3y.js} +1 -1
- package/dist/{pw-ai-UXo3gDGy.js → pw-ai-CG-kY5NP.js} +1 -1
- package/dist/{pw-ai-CIN6tj0G.js → pw-ai-DcZPg2vm.js} +1 -1
- package/dist/{register.agent-BynXVz7v.js → register.agent-B33EZBoL.js} +1 -1
- package/dist/{register.agent-RNVNKBP3.js → register.agent-DfYqZls1.js} +1 -1
- package/dist/{register.configure-BdqREs1-.js → register.configure-CREcJhKA.js} +1 -1
- package/dist/{register.configure-DDrvpBnA.js → register.configure-D8an7wc5.js} +1 -1
- package/dist/{register.maintenance-DT6t7mD_.js → register.maintenance-D84M5XLR.js} +1 -1
- package/dist/{register.maintenance-BSKHOCTV.js → register.maintenance-Dnp_Ii2x.js} +1 -1
- package/dist/{register.message-7KIfSUxS.js → register.message-B6E0uAEu.js} +1 -1
- package/dist/{register.message-DDhEvcaX.js → register.message-WOWC4tyf.js} +1 -1
- package/dist/{register.onboard-CKhooa7L.js → register.onboard-AgVEhehS.js} +1 -1
- package/dist/{register.onboard-CswvuzLx.js → register.onboard-Cwozk0Tx.js} +1 -1
- package/dist/{register.setup-1BmR-qlh.js → register.setup-BKyCvo9_.js} +1 -1
- package/dist/{register.setup-CivwfXf_.js → register.setup-C9IeGiAd.js} +1 -1
- package/dist/{register.status-health-sessions-CLdHZiJm.js → register.status-health-sessions-CYZctjpx.js} +1 -1
- package/dist/{register.status-health-sessions-BXpljfv3.js → register.status-health-sessions-CcL6srRC.js} +1 -1
- package/dist/{register.subclis-D_fHb-Aj.js → register.subclis-AFsfDByV.js} +1 -1
- package/dist/{register.subclis-CTTxdHaJ.js → register.subclis-C0DxtuRO.js} +1 -1
- package/dist/{reply-D9wUWhMx.js → reply-BuUSdq2L.js} +9 -9
- package/dist/{run-main-DNyQhVQT.js → run-main-CgJMiKPV.js} +1 -1
- package/dist/{runner-BNnckkaT.js → runner-C8oNv-9y.js} +3 -3
- package/dist/{runner-EHybuAt7.js → runner-nDoIXX7n.js} +3 -3
- package/dist/{server-node-events-BGrnw4ZT.js → server-node-events-BMsKmU5S.js} +1 -1
- package/dist/{server-node-events-D4WVcVHy.js → server-node-events-fS8TluXq.js} +1 -1
- package/dist/{session-dirs-eNN7E3kA.js → session-dirs-Bkfs-7vN.js} +1 -1
- package/dist/{session-dirs-C-pVBwSV.js → session-dirs-rYDCA_mQ.js} +1 -1
- package/dist/{status-Demw1HZ7.js → status-Ad1eFPKR.js} +1 -1
- package/dist/{status-CBieo24v.js → status-BMzVz5KY.js} +1 -1
- package/dist/{status-rkFgCaBM.js → status-CXRyaGws.js} +1 -1
- package/dist/{status-wTMmjZ7M.js → status-DpEUFAMk.js} +1 -1
- package/dist/{status-BhJw9Htq.js → status-oaiZkYBt.js} +1 -1
- package/dist/{subagent-registry-Bje3RAgk.js → subagent-registry-gVTWLPpL.js} +1 -1
- package/dist/{subagent-registry-B0kpBIxD.js → subagent-registry-hM0OCDzv.js} +1 -1
- package/dist/{subagent-registry-Cj5yC7B4.js → subagent-registry-m_x-JRkR.js} +9 -9
- package/dist/{tui-BCtecmPL.js → tui-HTtOgZ_X.js} +2 -2
- package/dist/{tui-BqHLI73U.js → tui-LemSel3H.js} +2 -2
- package/dist/{tui-cli-2R0xjpqW.js → tui-cli-BpzicV5H.js} +1 -1
- package/dist/{tui-cli-Dvd8BwzD.js → tui-cli-CruoIP1K.js} +1 -1
- package/dist/{update-cli-DUObGvw1.js → update-cli-Wa-nZ_Lq.js} +1 -1
- package/dist/{update-cli-Bt7Vfi7c.js → update-cli-zv67YxK1.js} +1 -1
- package/dist/{web--KblE8ax.js → web-BrsbhB1i.js} +1 -1
- package/dist/{web-C-yTnRvS.js → web-BzkO4Pbe.js} +1 -1
- package/dist/{web-0VRcRcFj.js → web-D_QYY7Gt.js} +1 -1
- package/dist/{web-BcUIWAAJ.js → web-jPbmSTQm.js} +1 -1
- package/package.json +1 -1
- package/dist/chrome-CmCESKt9.js +0 -4
- package/dist/chrome-D6qk0wxW.js +0 -4
- package/dist/plugin-sdk/web-CzJYJZZs.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./paths-BHg-VHB4.js";import{r as DEFAULT_CHAT_CHANNEL}from"./registry-Cv7CoWAs.js";import{N as setVerbose,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-CuAFgjuQ.js";import{t as formatCliCommand}from"./command-format-DTMaGKs7.js";import"./src-DvWaTze9.js";import"./logger-wuOr7HKl.js";import{d as normalizeAgentId}from"./session-key-CksCYipj.js";import"./builderforce-root-DY1qbWNX.js";import"./exec-COgsU9ql.js";import{n as listAgentIds}from"./agent-scope-CufEmNj_.js";import"./env-file-DeS6x2OL.js";import"./src-C8c9naq-.js";import{r as loadConfig}from"./io-CsCa3_1Z.js";import"./manifest-registry-009gLJ4l.js";import"./config-DmxNxDRW.js";import"./model-discovery-RTHjxEvZ.js";import"./model-catalog-D8OQ7p7I.js";import"./frontmatter-CaY7feZm.js";import"./skills-D3MwwPOH.js";import"./plugin-skills-pSFUbhg_.js";import"./refresh-C4vwneXT.js";import"./client-CGgp3zkQ.js";import{i as randomIdempotencyKey,n as callGateway}from"./call-O-iC_P5t.js";import{h as GATEWAY_CLIENT_NAMES,l as normalizeMessageChannel,m as GATEWAY_CLIENT_MODES}from"./message-channel-z5YRpR2d.js";import"./subagent-registry-
|
|
1
|
+
import"./paths-BHg-VHB4.js";import{r as DEFAULT_CHAT_CHANNEL}from"./registry-Cv7CoWAs.js";import{N as setVerbose,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-CuAFgjuQ.js";import{t as formatCliCommand}from"./command-format-DTMaGKs7.js";import"./src-DvWaTze9.js";import"./logger-wuOr7HKl.js";import{d as normalizeAgentId}from"./session-key-CksCYipj.js";import"./builderforce-root-DY1qbWNX.js";import"./exec-COgsU9ql.js";import{n as listAgentIds}from"./agent-scope-CufEmNj_.js";import"./env-file-DeS6x2OL.js";import"./src-C8c9naq-.js";import{r as loadConfig}from"./io-CsCa3_1Z.js";import"./manifest-registry-009gLJ4l.js";import"./config-DmxNxDRW.js";import"./model-discovery-RTHjxEvZ.js";import"./model-catalog-D8OQ7p7I.js";import"./frontmatter-CaY7feZm.js";import"./skills-D3MwwPOH.js";import"./plugin-skills-pSFUbhg_.js";import"./refresh-C4vwneXT.js";import"./client-CGgp3zkQ.js";import{i as randomIdempotencyKey,n as callGateway}from"./call-O-iC_P5t.js";import{h as GATEWAY_CLIENT_NAMES,l as normalizeMessageChannel,m as GATEWAY_CLIENT_MODES}from"./message-channel-z5YRpR2d.js";import"./subagent-registry-m_x-JRkR.js";import"./sessions-CmJXMlLP.js";import"./project-context-store-BNXYrLJz.js";import"./tokens-CFKkpUIu.js";import"./plugins-1Mn6RiNf.js";import"./accounts-BkTLjSrD.js";import"./bindings-CKSDlQ1i.js";import"./send-CGcNbbV7.js";import"./send-DPRTlcZh.js";import"./with-timeout-CBXVw0An.js";import"./deliver--eLCRJc2.js";import"./accounts-Cx82nj4E.js";import"./send-DfHAMPcD.js";import"./image-ops-CotJhwRR.js";import"./redact-CgO7wehS.js";import"./errors-tAt19c1E.js";import"./embedded-helpers-BZGiFZlP.js";import"./sandbox-C-Owvt1-.js";import"./chrome-BfwLDcFc.js";import"./tailscale-DV-yOmYe.js";import"./auth-ChecwOXS.js";import"./server-context-BjYYSEVE.js";import"./routes-Dnfsevhw.js";import"./paths-BnOjueoX.js";import"./ssrf-DJXLYZ0d.js";import"./store-DHD2IEgd.js";import"./ports-DTku9NSx.js";import"./trash-C3zmJ_O7.js";import"./accounts-DcoaLXKI.js";import"./paths-ClsbsPQP.js";import"./tool-images-CCpqFtrL.js";import"./workspace-waBqRxiy.js";import"./reply-prefix-Cg7AqaK0.js";import"./sqlite-CIGM1WKg.js";import"./memory-cli-CiwWAhp5.js";import"./manager-Bjb9ptCz.js";import"./gemini-auth-KBXMhaRQ.js";import"./retry-B151Hej5.js";import"./common-BfwMxpLu.js";import"./runner-DwPaM8kz.js";import"./tool-display-Cs4hDP1f.js";import"./chunk-Dly7lM4r.js";import"./markdown-tables-B1Rx8hv6.js";import"./fetch-guard-DnXqPKae.js";import"./fetch-Cn_THzz8.js";import"./ir-CSdQJPqu.js";import"./render-DlHYsbvQ.js";import"./builderforcellm-syscheck-tquUDu_7.js";import"./session-utils-D2_j4c6U.js";import"./coding-tools.policy-BwdtwuXY.js";import"./pairing-store-BCsvhT6-.js";import"./fetch-DnWD6ydH.js";import"./exec-approvals-D7ZPAZpt.js";import"./nodes-screen-D6GHv_S0.js";import"./session-cost-usage-S0nkbPoW.js";import"./usage-format-5sp5AMSu.js";import"./provider-usage-DsI3qJRy.js";import"./send-BOSlm5fG.js";import"./outbound-attachment-BaTYE4qp.js";import"./delivery-queue-Cp3t4Upn.js";import"./project-context-BdK18hVI.js";import"./control-service-Ca0CBlhO.js";import"./stagger-CRe77dWL.js";import"./channel-selection-BLwXhb9t.js";import"./send-BOBan2eG.js";import"./resolve-route-DEIW5uKy.js";import"./channel-activity-DX36RadH.js";import"./tables-CojSfTth.js";import{t as formatDocsLink}from"./links-BKzP7VVP.js";import{n as runCommandWithRuntime}from"./cli-utils-C9pW69LF.js";import{t as formatHelpExamples}from"./help-format-CfFf-w62.js";import{n as withProgress}from"./progress-Cqb-jAjT.js";import"./replies-DATdLu15.js";import"./onboard-helpers-D2vxAtv8.js";import"./prompt-style-BMWmaqSC.js";import"./pairing-labels-BUXpRejW.js";import"./active-listener-Di9e1YAD.js";import"./mamba-state-engine-DJt_RpLC.js";import"./transformers-stream-Buj40qHl.js";import{t as hasExplicitOptions}from"./command-options-DbMbMxM2.js";import"./catalog-li4bSIE2.js";import"./note-DgDXuE0F.js";import"./clack-prompter-B52CP7eY.js";import"./helpers-DPPVplyk.js";import"./plugin-auto-enable-DT7HMdAA.js";import"./install-safe-path-ObPl6zIf.js";import"./npm-registry-spec-BV1VDmuN.js";import"./skill-scanner-C2gXLVti.js";import"./installs-C7X7CT9a.js";import"./onboard-channels-ZI4QC9WU.js";import"./config-validation-DZ_PL8zv.js";import{t as collectOption}from"./helpers-DPw5_6PJ.js";import{n as createDefaultDeps}from"./outbound-send-deps-DuML6h7r.js";import"./agents.config-D6Yhwmnh.js";import{n as resolveSessionKeyForRequest,t as agentCommand}from"./agent-CeWx2EpQ.js";import"./shared-DUsuqnhk.js";import"./onboard-auth.credentials-CV8n9m_T.js";import"./auth-token-yWeJoLJ8.js";import"./logging-ayt7F7vy.js";import"./provider-auth-helpers-CWUfg9zf.js";import{i as agentsAddCommand,n as agentsSetIdentityCommand,r as agentsDeleteCommand,t as agentsListCommand}from"./agents-CRJM6qhK.js";import"./auth-choice.apply-Dy4rVG6K.js";import"./openai-model-default-CzXGNcAh.js";import"./model-picker-Do5aHFkC.js";import"./auth-choice.apply.transformers-Be8599JD.js";import"./auth-choice-KcathmTY.js";function parseTimeoutSeconds(opts){let raw=opts.timeout===void 0?opts.cfg.agents?.defaults?.timeoutSeconds??600:Number.parseInt(String(opts.timeout),10);if(Number.isNaN(raw)||raw<0)throw Error(`--timeout must be a non-negative integer (seconds; 0 means no timeout)`);return raw}function formatPayloadForLog(payload){let lines=[];payload.text&&lines.push(payload.text.trimEnd());let mediaUrl=typeof payload.mediaUrl==`string`&&payload.mediaUrl.trim()?payload.mediaUrl.trim():void 0,media=payload.mediaUrls??(mediaUrl?[mediaUrl]:[]);for(let url of media)lines.push(`MEDIA:${url}`);return lines.join(`
|
|
2
2
|
`).trimEnd()}async function agentViaGatewayCommand(opts,runtime){let body=(opts.message??``).trim();if(!body)throw Error(`Message (--message) is required`);if(!opts.to&&!opts.sessionId&&!opts.agent)throw Error(`Pass --to <E.164>, --session-id, or --agent to choose a session`);let cfg=loadConfig(),agentIdRaw=opts.agent?.trim(),agentId=agentIdRaw?normalizeAgentId(agentIdRaw):void 0;if(agentId&&!listAgentIds(cfg).includes(agentId))throw Error(`Unknown agent id "${agentIdRaw}". Use "${formatCliCommand(`builderforce agents list`)}" to see configured agents.`);let timeoutSeconds=parseTimeoutSeconds({cfg,timeout:opts.timeout}),gatewayTimeoutMs=timeoutSeconds===0?2147e6:Math.max(1e4,(timeoutSeconds+30)*1e3),sessionKey=resolveSessionKeyForRequest({cfg,agentId,to:opts.to,sessionId:opts.sessionId}).sessionKey,channel=normalizeMessageChannel(opts.channel)??DEFAULT_CHAT_CHANNEL,idempotencyKey=opts.runId?.trim()||randomIdempotencyKey(),response=await withProgress({label:`Waiting for agent reply…`,indeterminate:!0,enabled:opts.json!==!0},async()=>await callGateway({method:`agent`,params:{message:body,agentId,to:opts.to,replyTo:opts.replyTo,sessionId:opts.sessionId,sessionKey,thinking:opts.thinking,deliver:!!opts.deliver,channel,replyChannel:opts.replyChannel,replyAccountId:opts.replyAccount,timeout:timeoutSeconds,lane:opts.lane,extraSystemPrompt:opts.extraSystemPrompt,idempotencyKey},expectFinal:!0,timeoutMs:gatewayTimeoutMs,clientName:GATEWAY_CLIENT_NAMES.CLI,mode:GATEWAY_CLIENT_MODES.CLI}));if(opts.json)return runtime.log(JSON.stringify(response,null,2)),response;let payloads=response?.result?.payloads??[];if(payloads.length===0)return runtime.log(response?.summary?String(response.summary):`No reply from agent.`),response;for(let payload of payloads){let out=formatPayloadForLog(payload);out&&runtime.log(out)}return response}async function agentCliCommand(opts,runtime,deps){let localOpts={...opts,agentId:opts.agent,replyAccountId:opts.replyAccount};if(opts.local===!0)return await agentCommand(localOpts,runtime,deps);try{return await agentViaGatewayCommand(opts,runtime)}catch(err){return runtime.error?.(`Gateway agent failed; falling back to embedded: ${String(err)}`),await agentCommand(localOpts,runtime,deps)}}function registerAgentCommands(program,args){program.command(`agent`).description(`Run an agent turn via the Gateway (use --local for embedded)`).requiredOption(`-m, --message <text>`,`Message body for the agent`).option(`-t, --to <number>`,`Recipient number in E.164 used to derive the session key`).option(`--session-id <id>`,`Use an explicit session id`).option(`--agent <id>`,`Agent id (overrides routing bindings)`).option(`--thinking <level>`,`Thinking level: off | minimal | low | medium | high`).option(`--verbose <on|off>`,`Persist agent verbose level for the session`).option(`--channel <channel>`,`Delivery channel: ${args.agentChannelOptions} (default: ${DEFAULT_CHAT_CHANNEL})`).option(`--reply-to <target>`,`Delivery target override (separate from session routing)`).option(`--reply-channel <channel>`,`Delivery channel override (separate from routing)`).option(`--reply-account <id>`,`Delivery account id override`).option(`--local`,`Run the embedded agent locally (requires model provider API keys in your shell)`,!1).option(`--deliver`,`Send the agent's reply back to the selected channel`,!1).option(`--json`,`Output result as JSON`,!1).option(`--timeout <seconds>`,`Override agent command timeout (seconds, default 600 or config value)`).addHelpText(`after`,()=>`
|
|
3
3
|
${theme.heading(`Examples:`)}
|
|
4
4
|
${formatHelpExamples([[`builderforce agent --to +15555550123 --message "status update"`,`Start a new session.`],[`builderforce agent --agent ops --message "Summarize logs"`,`Use a specific agent.`],[`builderforce agent --session-id 1234 --message "Summarize inbox" --thinking medium`,`Target a session with explicit thinking level.`],[`builderforce agent --to +15555550123 --message "Trace logs" --verbose on --json`,`Enable verbose logging and JSON output.`],[`builderforce agent --to +15555550123 --message "Summon reply" --deliver`,`Deliver reply.`],[`builderforce agent --agent ops --message "Generate report" --deliver --reply-channel slack --reply-to "#reports"`,`Send reply to a different channel/target.`]])}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./paths-5FcIFMsj.js";import{B as theme,C as shortenHomePath,P as setVerbose,b as resolveUserPath}from"./utils-DbaBVFaK.js";import"./embedded-helpers-2fP2Yq8h.js";import"./reply-
|
|
1
|
+
import"./paths-5FcIFMsj.js";import{B as theme,C as shortenHomePath,P as setVerbose,b as resolveUserPath}from"./utils-DbaBVFaK.js";import"./embedded-helpers-2fP2Yq8h.js";import"./reply-BuUSdq2L.js";import{d as normalizeAgentId,n as DEFAULT_ACCOUNT_ID,r as DEFAULT_AGENT_ID}from"./session-key-EoB0qaG9.js";import"./builderforce-root-D64_sXEi.js";import{i as defaultRuntime}from"./subsystem-B3TqcCrZ.js";import{r as DEFAULT_CHAT_CHANNEL}from"./registry-TdK-aV05.js";import"./logger-Bch0bx9c.js";import"./exec-DdcIjeyn.js";import{A as resolveWorkspaceFilePath,C as WORKSPACE_RUNTIME_DIRNAME,_ as DEFAULT_IDENTITY_FILENAME,c as resolveAgentWorkspaceDir,i as resolveAgentDir,l as resolveDefaultAgentId,n as listAgentIds,t as listAgentEntries}from"./agent-scope-DPtjOxzp.js";import"./src-CA0fU67C.js";import{in as ensureAuthProfileStore,sn as resolveAuthStorePath}from"./model-selection-Doyvd4lU.js";import{t as formatCliCommand}from"./command-format-D806O2pt.js";import"./env-file-D1MDi-AM.js";import"./boolean-Cnh1KNl1.js";import"./env-BIdU5BAp.js";import"./src-BifagO7i.js";import{c as writeConfigFile,r as loadConfig}from"./io-BNtgT4VB.js";import"./manifest-registry-BJCfNV1a.js";import"./config-BD801bpx.js";import"./runner-C3k1sKdu.js";import"./model-catalog-BoiWqBTw.js";import"./sandbox-1jtP0nhr.js";import"./chrome-Bfprrnm1.js";import"./tailscale-DLkpGquM.js";import"./auth-lebUHrkd.js";import"./server-context-DKdrUePN.js";import"./frontmatter-3D1EdC1L.js";import"./skills-Ba4ftrB-.js";import"./plugin-skills-B11rggZh.js";import"./routes-CRrqIFJR.js";import"./redact-BHdfp2MZ.js";import"./errors-B1MIg3g-.js";import"./paths-cR8ct-Y3.js";import"./ssrf-p9k-iapc.js";import"./image-ops-C8IUQKjn.js";import"./store-CmHBQ-yX.js";import"./ports-DgmEDNOm.js";import"./trash-DD2Hc5oq.js";import"./sessions-BPr0-lkT.js";import{h as GATEWAY_CLIENT_NAMES,l as normalizeMessageChannel,m as GATEWAY_CLIENT_MODES}from"./message-channel-D_jXxXQj.js";import{n as listChannelPlugins,r as normalizeChannelId,t as getChannelPlugin}from"./plugins-D5zP6ENo.js";import"./accounts-o35LU_iy.js";import"./accounts-rmXEiebi.js";import"./accounts-BLueHgKj.js";import"./bindings-DR59065T.js";import"./send-l9WWK31e.js";import"./send-CVgJk5kN.js";import{s as resolveSessionTranscriptsDirForAgent}from"./paths-DJ6rztqJ.js";import"./tool-images-B7b_OiMz.js";import"./tool-display-ByOZtWvA.js";import"./fetch-guard-8mwt3-hm.js";import"./api-key-rotation-Yn3MpU4F.js";import"./fetch-BuOLY9KP.js";import"./sqlite-C39E12XS.js";import"./tokens-CCU3zO-D.js";import"./project-context-store-Dbbjk8CQ.js";import"./with-timeout-CPd4-suw.js";import"./deliver-BiGCWHvZ.js";import"./send-CRSlal5z.js";import"./workspace-D4LK4thI.js";import"./reply-prefix-zIMgi6K6.js";import"./memory-cli-D-Khe5Ij.js";import"./manager-DNIg84rj.js";import"./retry-DlVhg5qu.js";import"./client-xfoidwPI.js";import{i as randomIdempotencyKey,n as callGateway}from"./call-CJq3iGqu.js";import"./common-BTbIhLyt.js";import"./chunk-FCBlVOyo.js";import"./markdown-tables-P6uoUSFa.js";import"./ir-5BNoIXZm.js";import"./render-D1dVTEB1.js";import"./builderforcellm-syscheck-Cp4LMft_.js";import"./send-D_6wd5Y3.js";import"./outbound-attachment-C7wByQO5.js";import"./fetch-DnVtDecb.js";import"./delivery-queue-CXKynF1P.js";import"./channel-activity-CCNDbdD3.js";import"./tables-ERcoWFDp.js";import"./pairing-store-C8gtsUDG.js";import{t as formatDocsLink}from"./links-BgWWaaOT.js";import{n as runCommandWithRuntime}from"./cli-utils-LBYKdNFb.js";import{t as formatHelpExamples}from"./help-format-Qfk2vDNX.js";import{n as withProgress}from"./progress-BfOtdN6b.js";import"./resolve-route-D49haUnv.js";import"./replies-DAwcEPGb.js";import"./refresh-TiC_kLgE.js";import"./coding-tools.policy-COe2xa9K.js";import"./send-BIMaIwQV.js";import{a as ensureWorkspaceAndSessions,l as moveToTrash}from"./onboard-helpers-BmYUjl4j.js";import"./prompt-style-BpVK43GK.js";import"./pairing-labels-CD0lPAfY.js";import"./session-cost-usage-BjH7mxVj.js";import"./usage-format-DGf8ZWPH.js";import"./provider-usage-QGVVADJa.js";import"./active-listener-Dcg19lJG.js";import"./exec-approvals-BpVPDVtV.js";import"./nodes-screen-C3TDIi8d.js";import"./project-context-BLpMH93w.js";import"./control-service-DKBAemtq.js";import"./stagger-8EkqkqJv.js";import"./channel-selection-DyAvzlY8.js";import"./mamba-state-engine-BQuRdgMU.js";import"./transformers-stream-D7nRu4Qu.js";import{t as createDefaultDeps}from"./deps-CrAVOWsA.js";import{t as collectOption}from"./helpers-CESJCicC.js";import"./catalog-rgiY__UQ.js";import{t as hasExplicitOptions}from"./command-options-DzGFCQYs.js";import"./note-B6NtFdXt.js";import{t as WizardCancelledError}from"./prompts-Bchzq3K0.js";import{t as createClackPrompter}from"./clack-prompter-Dg23_riR.js";import{t as resolveChannelDefaultAccountId}from"./helpers-DTDCy17p.js";import"./plugin-auto-enable-zKMSAekH.js";import"./install-safe-path-DsLq2BUJ.js";import"./npm-registry-spec-DIW6RsGN.js";import"./skill-scanner-BUNvEK3Z.js";import"./installs-ZToTbCYE.js";import{n as setupChannels}from"./onboard-channels-uvIeLPXK.js";import{t as requireValidConfigSnapshot}from"./config-validation-PDTMTi8w.js";import{a as pruneAgentConfig,c as parseIdentityMarkdown,i as loadAgentIdentity,n as buildAgentSummaries,o as identityHasValues,r as findAgentEntryIndex,t as applyAgentConfig}from"./agents.config-BllQ7zna.js";import{n as resolveSessionKeyForRequest,t as agentCommand}from"./agent-DrcnpqOF.js";import"./shared-DXDwFhUI.js";import"./onboard-auth.credentials-uekJMiYv.js";import"./auth-token-CPSeBkJC.js";import{n as logConfigUpdated}from"./logging-DHa3jQN3.js";import"./provider-auth-helpers-y1X8xKVE.js";import{t as promptAuthChoiceGrouped}from"./auth-choice-prompt-Cg9HlfLS.js";import{t as applyAuthChoice}from"./auth-choice.apply-ChrTTHkK.js";import"./openai-model-default-BirkY0mR.js";import"./model-picker-CCvGdvzM.js";import"./auth-choice.apply.transformers-CgfGlqy1.js";import{n as warnIfModelConfigLooksOff}from"./auth-choice-C8gCFmQ5.js";import path from"node:path";import fs from"node:fs/promises";function parseTimeoutSeconds(opts){let raw=opts.timeout===void 0?opts.cfg.agents?.defaults?.timeoutSeconds??600:Number.parseInt(String(opts.timeout),10);if(Number.isNaN(raw)||raw<0)throw Error(`--timeout must be a non-negative integer (seconds; 0 means no timeout)`);return raw}function formatPayloadForLog(payload){let lines=[];payload.text&&lines.push(payload.text.trimEnd());let mediaUrl=typeof payload.mediaUrl==`string`&&payload.mediaUrl.trim()?payload.mediaUrl.trim():void 0,media=payload.mediaUrls??(mediaUrl?[mediaUrl]:[]);for(let url of media)lines.push(`MEDIA:${url}`);return lines.join(`
|
|
2
2
|
`).trimEnd()}async function agentViaGatewayCommand(opts,runtime){let body=(opts.message??``).trim();if(!body)throw Error(`Message (--message) is required`);if(!opts.to&&!opts.sessionId&&!opts.agent)throw Error(`Pass --to <E.164>, --session-id, or --agent to choose a session`);let cfg=loadConfig(),agentIdRaw=opts.agent?.trim(),agentId=agentIdRaw?normalizeAgentId(agentIdRaw):void 0;if(agentId&&!listAgentIds(cfg).includes(agentId))throw Error(`Unknown agent id "${agentIdRaw}". Use "${formatCliCommand(`builderforce agents list`)}" to see configured agents.`);let timeoutSeconds=parseTimeoutSeconds({cfg,timeout:opts.timeout}),gatewayTimeoutMs=timeoutSeconds===0?2147e6:Math.max(1e4,(timeoutSeconds+30)*1e3),sessionKey=resolveSessionKeyForRequest({cfg,agentId,to:opts.to,sessionId:opts.sessionId}).sessionKey,channel=normalizeMessageChannel(opts.channel)??DEFAULT_CHAT_CHANNEL,idempotencyKey=opts.runId?.trim()||randomIdempotencyKey(),response=await withProgress({label:`Waiting for agent reply…`,indeterminate:!0,enabled:opts.json!==!0},async()=>await callGateway({method:`agent`,params:{message:body,agentId,to:opts.to,replyTo:opts.replyTo,sessionId:opts.sessionId,sessionKey,thinking:opts.thinking,deliver:!!opts.deliver,channel,replyChannel:opts.replyChannel,replyAccountId:opts.replyAccount,timeout:timeoutSeconds,lane:opts.lane,extraSystemPrompt:opts.extraSystemPrompt,idempotencyKey},expectFinal:!0,timeoutMs:gatewayTimeoutMs,clientName:GATEWAY_CLIENT_NAMES.CLI,mode:GATEWAY_CLIENT_MODES.CLI}));if(opts.json)return runtime.log(JSON.stringify(response,null,2)),response;let payloads=response?.result?.payloads??[];if(payloads.length===0)return runtime.log(response?.summary?String(response.summary):`No reply from agent.`),response;for(let payload of payloads){let out=formatPayloadForLog(payload);out&&runtime.log(out)}return response}async function agentCliCommand(opts,runtime,deps){let localOpts={...opts,agentId:opts.agent,replyAccountId:opts.replyAccount};if(opts.local===!0)return await agentCommand(localOpts,runtime,deps);try{return await agentViaGatewayCommand(opts,runtime)}catch(err){return runtime.error?.(`Gateway agent failed; falling back to embedded: ${String(err)}`),await agentCommand(localOpts,runtime,deps)}}function bindingMatchKey(match){let accountId=match.accountId?.trim()||DEFAULT_ACCOUNT_ID;return[match.channel,accountId,match.peer?.kind??``,match.peer?.id??``,match.guildId??``,match.teamId??``].join(`|`)}function describeBinding(binding){let match=binding.match,parts=[match.channel];return match.accountId&&parts.push(`accountId=${match.accountId}`),match.peer&&parts.push(`peer=${match.peer.kind}:${match.peer.id}`),match.guildId&&parts.push(`guild=${match.guildId}`),match.teamId&&parts.push(`team=${match.teamId}`),parts.join(` `)}function applyAgentBindings(cfg,bindings){let existing=cfg.bindings??[],existingMatchMap=new Map;for(let binding of existing){let key=bindingMatchKey(binding.match);existingMatchMap.has(key)||existingMatchMap.set(key,normalizeAgentId(binding.agentId))}let added=[],skipped=[],conflicts=[];for(let binding of bindings){let agentId=normalizeAgentId(binding.agentId),key=bindingMatchKey(binding.match),existingAgentId=existingMatchMap.get(key);if(existingAgentId){existingAgentId===agentId?skipped.push(binding):conflicts.push({binding,existingAgentId});continue}existingMatchMap.set(key,agentId),added.push({...binding,agentId})}return added.length===0?{config:cfg,added,skipped,conflicts}:{config:{...cfg,bindings:[...existing,...added]},added,skipped,conflicts}}function resolveDefaultAccountId$1(cfg,provider){let plugin=getChannelPlugin(provider);return plugin?resolveChannelDefaultAccountId({plugin,cfg}):DEFAULT_ACCOUNT_ID}function buildChannelBindings(params){let bindings=[],agentId=normalizeAgentId(params.agentId);for(let channel of params.selection){let match={channel},accountId=params.accountIds?.[channel]?.trim();accountId?match.accountId=accountId:getChannelPlugin(channel)?.meta.forceAccountBinding&&(match.accountId=resolveDefaultAccountId$1(params.config,channel)),bindings.push({agentId,match})}return bindings}function parseBindingSpecs(params){let bindings=[],errors=[],specs=params.specs??[],agentId=normalizeAgentId(params.agentId);for(let raw of specs){let trimmed=raw?.trim();if(!trimmed)continue;let[channelRaw,accountRaw]=trimmed.split(`:`,2),channel=normalizeChannelId(channelRaw);if(!channel){errors.push(`Unknown channel "${channelRaw}".`);continue}let accountId=accountRaw?.trim();if(accountRaw!==void 0&&!accountId){errors.push(`Invalid binding "${trimmed}" (empty account id).`);continue}accountId||getChannelPlugin(channel)?.meta.forceAccountBinding&&(accountId=resolveDefaultAccountId$1(params.config,channel));let match={channel};accountId&&(match.accountId=accountId),bindings.push({agentId,match})}return{bindings,errors}}function createQuietRuntime(runtime){return{...runtime,log:()=>{}}}async function requireValidConfig(runtime){return await requireValidConfigSnapshot(runtime)}async function fileExists(pathname){try{return await fs.stat(pathname),!0}catch{return!1}}async function agentsAddCommand(opts,runtime=defaultRuntime,params){let cfg=await requireValidConfig(runtime);if(!cfg)return;let workspaceFlag=opts.workspace?.trim(),nameInput=opts.name?.trim(),hasFlags=params?.hasFlags===!0,nonInteractive=!!(opts.nonInteractive||hasFlags);if(nonInteractive&&!workspaceFlag){runtime.error(`Non-interactive mode requires --workspace. Re-run without flags to use the wizard.`),runtime.exit(1);return}if(nonInteractive){if(!nameInput){runtime.error(`Agent name is required in non-interactive mode.`),runtime.exit(1);return}if(!workspaceFlag){runtime.error(`Non-interactive mode requires --workspace. Re-run without flags to use the wizard.`),runtime.exit(1);return}let agentId=normalizeAgentId(nameInput);if(agentId===DEFAULT_AGENT_ID){runtime.error(`"${DEFAULT_AGENT_ID}" is reserved. Choose another name.`),runtime.exit(1);return}if(agentId!==nameInput&&runtime.log(`Normalized agent id to "${agentId}".`),findAgentEntryIndex(listAgentEntries(cfg),agentId)>=0){runtime.error(`Agent "${agentId}" already exists.`),runtime.exit(1);return}let workspaceDir=resolveUserPath(workspaceFlag),agentDir=opts.agentDir?.trim()?resolveUserPath(opts.agentDir.trim()):resolveAgentDir(cfg,agentId),model=opts.model?.trim(),nextConfig=applyAgentConfig(cfg,{agentId,name:nameInput,workspace:workspaceDir,agentDir,...model?{model}:{}}),bindingParse=parseBindingSpecs({agentId,specs:opts.bind,config:nextConfig});if(bindingParse.errors.length>0){runtime.error(bindingParse.errors.join(`
|
|
3
3
|
`)),runtime.exit(1);return}let bindingResult=bindingParse.bindings.length>0?applyAgentBindings(nextConfig,bindingParse.bindings):{config:nextConfig,added:[],skipped:[],conflicts:[]};await writeConfigFile(bindingResult.config),opts.json||logConfigUpdated(runtime),await ensureWorkspaceAndSessions(workspaceDir,opts.json?createQuietRuntime(runtime):runtime,{skipBootstrap:!!bindingResult.config.agents?.defaults?.skipBootstrap,agentId});let payload={agentId,name:nameInput,workspace:workspaceDir,agentDir,model,bindings:{added:bindingResult.added.map(describeBinding),skipped:bindingResult.skipped.map(describeBinding),conflicts:bindingResult.conflicts.map(conflict=>`${describeBinding(conflict.binding)} (agent=${conflict.existingAgentId})`)}};opts.json?runtime.log(JSON.stringify(payload,null,2)):(runtime.log(`Agent: ${agentId}`),runtime.log(`Workspace: ${shortenHomePath(workspaceDir)}`),runtime.log(`Agent dir: ${shortenHomePath(agentDir)}`),model&&runtime.log(`Model: ${model}`),bindingResult.conflicts.length>0&&runtime.error([`Skipped bindings already claimed by another agent:`,...bindingResult.conflicts.map(conflict=>`- ${describeBinding(conflict.binding)} (agent=${conflict.existingAgentId})`)].join(`
|
|
4
4
|
`)));return}let prompter=createClackPrompter();try{await prompter.intro(`Add BuilderForceAgents agent`);let name=nameInput??await prompter.text({message:`Agent name`,validate:value=>{if(!value?.trim())return`Required`;if(normalizeAgentId(value)===DEFAULT_AGENT_ID)return`"${DEFAULT_AGENT_ID}" is reserved. Choose another name.`}}),agentName=String(name??``).trim(),agentId=normalizeAgentId(agentName);if(agentName!==agentId&&await prompter.note(`Normalized id to "${agentId}".`,`Agent id`),listAgentEntries(cfg).find(agent=>normalizeAgentId(agent.id)===agentId)&&!await prompter.confirm({message:`Agent "${agentId}" already exists. Update it?`,initialValue:!1})){await prompter.outro(`No changes made.`);return}let workspaceDefault=resolveAgentWorkspaceDir(cfg,agentId),workspaceInput=await prompter.text({message:`Workspace directory`,initialValue:workspaceDefault,validate:value=>value?.trim()?void 0:`Required`}),workspaceDir=resolveUserPath(String(workspaceInput??``).trim()||workspaceDefault),agentDir=resolveAgentDir(cfg,agentId),nextConfig=applyAgentConfig(cfg,{agentId,name:agentName,workspace:workspaceDir,agentDir}),defaultAgentId=resolveDefaultAgentId(cfg);if(defaultAgentId!==agentId){let sourceAuthPath=resolveAuthStorePath(resolveAgentDir(cfg,defaultAgentId)),destAuthPath=resolveAuthStorePath(agentDir);path.resolve(sourceAuthPath).toLowerCase()!==path.resolve(destAuthPath).toLowerCase()&&await fileExists(sourceAuthPath)&&!await fileExists(destAuthPath)&&await prompter.confirm({message:`Copy auth profiles from "${defaultAgentId}"?`,initialValue:!1})&&(await fs.mkdir(path.dirname(destAuthPath),{recursive:!0}),await fs.copyFile(sourceAuthPath,destAuthPath),await prompter.note(`Copied auth profiles from "${defaultAgentId}".`,`Auth profiles`))}if(await prompter.confirm({message:`Configure model/auth for this agent now?`,initialValue:!1})){let authResult=await applyAuthChoice({authChoice:await promptAuthChoiceGrouped({prompter,store:await ensureAuthProfileStore(agentDir,{allowKeychainPrompt:!1}),includeSkip:!0}),config:nextConfig,prompter,runtime,agentDir,setDefaultModel:!1,agentId});nextConfig=authResult.config,authResult.agentModelOverride&&(nextConfig=applyAgentConfig(nextConfig,{agentId,model:authResult.agentModelOverride}))}await warnIfModelConfigLooksOff(nextConfig,prompter,{agentId,agentDir});let selection=[],channelAccountIds={};if(nextConfig=await setupChannels(nextConfig,runtime,prompter,{allowSignalInstall:!0,onSelection:value=>{selection=value},promptAccountIds:!0,onAccountId:(channel,accountId)=>{channelAccountIds[channel]=accountId}}),selection.length>0)if(await prompter.confirm({message:`Route selected channels to this agent now? (bindings)`,initialValue:!1})){let desiredBindings=buildChannelBindings({agentId,selection,config:nextConfig,accountIds:channelAccountIds}),result=applyAgentBindings(nextConfig,desiredBindings);nextConfig=result.config,result.conflicts.length>0&&await prompter.note([`Skipped bindings already claimed by another agent:`,...result.conflicts.map(conflict=>`- ${describeBinding(conflict.binding)} (agent=${conflict.existingAgentId})`)].join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./paths-5FcIFMsj.js";import{B as theme}from"./utils-DbaBVFaK.js";import"./embedded-helpers-2fP2Yq8h.js";import"./reply-
|
|
1
|
+
import"./paths-5FcIFMsj.js";import{B as theme}from"./utils-DbaBVFaK.js";import"./embedded-helpers-2fP2Yq8h.js";import"./reply-BuUSdq2L.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"./src-CA0fU67C.js";import"./model-selection-Doyvd4lU.js";import"./env-file-D1MDi-AM.js";import"./boolean-Cnh1KNl1.js";import"./env-BIdU5BAp.js";import"./src-BifagO7i.js";import"./io-BNtgT4VB.js";import"./manifest-registry-BJCfNV1a.js";import"./config-BD801bpx.js";import"./runner-C3k1sKdu.js";import"./model-catalog-BoiWqBTw.js";import"./sandbox-1jtP0nhr.js";import"./chrome-Bfprrnm1.js";import"./tailscale-DLkpGquM.js";import"./auth-lebUHrkd.js";import"./server-context-DKdrUePN.js";import"./frontmatter-3D1EdC1L.js";import"./skills-Ba4ftrB-.js";import"./plugin-skills-B11rggZh.js";import"./routes-CRrqIFJR.js";import"./redact-BHdfp2MZ.js";import"./errors-B1MIg3g-.js";import"./paths-cR8ct-Y3.js";import"./ssrf-p9k-iapc.js";import"./image-ops-C8IUQKjn.js";import"./store-CmHBQ-yX.js";import"./ports-DgmEDNOm.js";import"./trash-DD2Hc5oq.js";import"./sessions-BPr0-lkT.js";import"./message-channel-D_jXxXQj.js";import"./plugins-D5zP6ENo.js";import"./accounts-o35LU_iy.js";import"./accounts-rmXEiebi.js";import"./accounts-BLueHgKj.js";import"./bindings-DR59065T.js";import"./send-l9WWK31e.js";import"./send-CVgJk5kN.js";import"./paths-DJ6rztqJ.js";import"./tool-images-B7b_OiMz.js";import"./tool-display-ByOZtWvA.js";import"./fetch-guard-8mwt3-hm.js";import"./api-key-rotation-Yn3MpU4F.js";import"./fetch-BuOLY9KP.js";import"./sqlite-C39E12XS.js";import"./tokens-CCU3zO-D.js";import"./project-context-store-Dbbjk8CQ.js";import"./with-timeout-CPd4-suw.js";import"./deliver-BiGCWHvZ.js";import"./send-CRSlal5z.js";import"./workspace-D4LK4thI.js";import"./reply-prefix-zIMgi6K6.js";import"./memory-cli-D-Khe5Ij.js";import"./manager-DNIg84rj.js";import"./retry-DlVhg5qu.js";import"./client-xfoidwPI.js";import"./call-CJq3iGqu.js";import"./common-BTbIhLyt.js";import"./chunk-FCBlVOyo.js";import"./markdown-tables-P6uoUSFa.js";import"./ir-5BNoIXZm.js";import"./render-D1dVTEB1.js";import"./builderforcellm-syscheck-Cp4LMft_.js";import"./send-D_6wd5Y3.js";import"./outbound-attachment-C7wByQO5.js";import"./fetch-DnVtDecb.js";import"./delivery-queue-CXKynF1P.js";import"./channel-activity-CCNDbdD3.js";import"./tables-ERcoWFDp.js";import"./pairing-store-C8gtsUDG.js";import{t as formatDocsLink}from"./links-BgWWaaOT.js";import{n as runCommandWithRuntime}from"./cli-utils-LBYKdNFb.js";import"./help-format-Qfk2vDNX.js";import"./progress-BfOtdN6b.js";import"./resolve-route-D49haUnv.js";import"./replies-DAwcEPGb.js";import"./refresh-TiC_kLgE.js";import"./coding-tools.policy-COe2xa9K.js";import"./send-BIMaIwQV.js";import"./onboard-helpers-BmYUjl4j.js";import"./prompt-style-BpVK43GK.js";import"./pairing-labels-CD0lPAfY.js";import"./session-cost-usage-BjH7mxVj.js";import"./usage-format-DGf8ZWPH.js";import"./provider-usage-QGVVADJa.js";import"./active-listener-Dcg19lJG.js";import"./exec-approvals-BpVPDVtV.js";import"./nodes-screen-C3TDIi8d.js";import"./project-context-BLpMH93w.js";import"./control-service-DKBAemtq.js";import"./stagger-8EkqkqJv.js";import"./channel-selection-DyAvzlY8.js";import"./mamba-state-engine-BQuRdgMU.js";import"./transformers-stream-D7nRu4Qu.js";import"./runtime-guard-DhksRHci.js";import"./catalog-rgiY__UQ.js";import"./skills-status-vWC0PU8J.js";import"./note-B6NtFdXt.js";import"./clack-prompter-Dg23_riR.js";import"./helpers-DTDCy17p.js";import"./plugin-auto-enable-zKMSAekH.js";import"./install-safe-path-DsLq2BUJ.js";import"./npm-registry-spec-DIW6RsGN.js";import"./skill-scanner-BUNvEK3Z.js";import"./installs-ZToTbCYE.js";import"./onboard-channels-uvIeLPXK.js";import"./daemon-runtime-0CbmdgMr.js";import"./systemd-BG3_QT6W.js";import"./service-D-NLDyK3.js";import"./widearea-dns-CZR56vQb.js";import"./bonjour-discovery-Dq1G1iS-.js";import"./health-CFVx21sO.js";import"./control-ui-assets-CWgH1Tda.js";import"./skills-install-BSLbO1e-.js";import"./shared-DXDwFhUI.js";import"./onboard-auth.credentials-uekJMiYv.js";import"./auth-token-CPSeBkJC.js";import"./logging-DHa3jQN3.js";import"./provider-auth-helpers-y1X8xKVE.js";import"./auth-choice.apply-ChrTTHkK.js";import"./openai-model-default-BirkY0mR.js";import"./model-picker-CCvGdvzM.js";import"./auth-choice.apply.transformers-CgfGlqy1.js";import"./auth-choice-C8gCFmQ5.js";import{n as configureCommandFromSectionsArg,o as CONFIGURE_WIZARD_SECTIONS}from"./configure-D9YZEK_D.js";import"./systemd-linger-CT-VHPB3.js";import"./onboard-custom-B4dt-Qii.js";import"./health-format-iE_KYEwP.js";import"./onboard-remote-DXc586gq.js";import"./onboard-skills-eVGLuT5L.js";function registerConfigureCommand(program){program.command(`configure`).description(`Interactive setup wizard for credentials, channels, gateway, and agent defaults`).addHelpText(`after`,()=>`\n${theme.muted(`Docs:`)} ${formatDocsLink(`/cli/configure`,`docs.builderforce.ai/cli/configure`)}\n`).option(`--section <section>`,`Configuration sections (repeatable). Options: ${CONFIGURE_WIZARD_SECTIONS.join(`, `)}`,(value,previous)=>[...previous,value],[]).action(async opts=>{await runCommandWithRuntime(defaultRuntime,async()=>{await configureCommandFromSectionsArg(opts.section,defaultRuntime)})})}export{registerConfigureCommand};
|
|
@@ -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-CuAFgjuQ.js";import"./src-DvWaTze9.js";import"./logger-wuOr7HKl.js";import"./session-key-CksCYipj.js";import"./builderforce-root-DY1qbWNX.js";import"./exec-COgsU9ql.js";import"./agent-scope-CufEmNj_.js";import"./env-file-DeS6x2OL.js";import"./src-C8c9naq-.js";import"./io-CsCa3_1Z.js";import"./manifest-registry-009gLJ4l.js";import"./config-DmxNxDRW.js";import"./model-discovery-RTHjxEvZ.js";import"./model-catalog-D8OQ7p7I.js";import"./frontmatter-CaY7feZm.js";import"./skills-D3MwwPOH.js";import"./plugin-skills-pSFUbhg_.js";import"./skills-status-CGlKz1D1.js";import"./refresh-C4vwneXT.js";import"./client-CGgp3zkQ.js";import"./call-O-iC_P5t.js";import"./message-channel-z5YRpR2d.js";import"./subagent-registry-
|
|
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-CuAFgjuQ.js";import"./src-DvWaTze9.js";import"./logger-wuOr7HKl.js";import"./session-key-CksCYipj.js";import"./builderforce-root-DY1qbWNX.js";import"./exec-COgsU9ql.js";import"./agent-scope-CufEmNj_.js";import"./env-file-DeS6x2OL.js";import"./src-C8c9naq-.js";import"./io-CsCa3_1Z.js";import"./manifest-registry-009gLJ4l.js";import"./config-DmxNxDRW.js";import"./model-discovery-RTHjxEvZ.js";import"./model-catalog-D8OQ7p7I.js";import"./frontmatter-CaY7feZm.js";import"./skills-D3MwwPOH.js";import"./plugin-skills-pSFUbhg_.js";import"./skills-status-CGlKz1D1.js";import"./refresh-C4vwneXT.js";import"./client-CGgp3zkQ.js";import"./call-O-iC_P5t.js";import"./message-channel-z5YRpR2d.js";import"./subagent-registry-m_x-JRkR.js";import"./sessions-CmJXMlLP.js";import"./project-context-store-BNXYrLJz.js";import"./tokens-CFKkpUIu.js";import"./plugins-1Mn6RiNf.js";import"./accounts-BkTLjSrD.js";import"./bindings-CKSDlQ1i.js";import"./send-CGcNbbV7.js";import"./send-DPRTlcZh.js";import"./with-timeout-CBXVw0An.js";import"./deliver--eLCRJc2.js";import"./accounts-Cx82nj4E.js";import"./send-DfHAMPcD.js";import"./image-ops-CotJhwRR.js";import"./redact-CgO7wehS.js";import"./errors-tAt19c1E.js";import"./embedded-helpers-BZGiFZlP.js";import"./sandbox-C-Owvt1-.js";import"./chrome-BfwLDcFc.js";import"./tailscale-DV-yOmYe.js";import"./auth-ChecwOXS.js";import"./server-context-BjYYSEVE.js";import"./routes-Dnfsevhw.js";import"./paths-BnOjueoX.js";import"./ssrf-DJXLYZ0d.js";import"./store-DHD2IEgd.js";import"./ports-DTku9NSx.js";import"./trash-C3zmJ_O7.js";import"./accounts-DcoaLXKI.js";import"./paths-ClsbsPQP.js";import"./tool-images-CCpqFtrL.js";import"./workspace-waBqRxiy.js";import"./reply-prefix-Cg7AqaK0.js";import"./sqlite-CIGM1WKg.js";import"./memory-cli-CiwWAhp5.js";import"./manager-Bjb9ptCz.js";import"./gemini-auth-KBXMhaRQ.js";import"./retry-B151Hej5.js";import"./common-BfwMxpLu.js";import"./runner-DwPaM8kz.js";import"./tool-display-Cs4hDP1f.js";import"./chunk-Dly7lM4r.js";import"./markdown-tables-B1Rx8hv6.js";import"./fetch-guard-DnXqPKae.js";import"./fetch-Cn_THzz8.js";import"./ir-CSdQJPqu.js";import"./render-DlHYsbvQ.js";import"./builderforcellm-syscheck-tquUDu_7.js";import"./session-utils-D2_j4c6U.js";import"./coding-tools.policy-BwdtwuXY.js";import"./pairing-store-BCsvhT6-.js";import"./fetch-DnWD6ydH.js";import"./exec-approvals-D7ZPAZpt.js";import"./nodes-screen-D6GHv_S0.js";import"./session-cost-usage-S0nkbPoW.js";import"./usage-format-5sp5AMSu.js";import"./provider-usage-DsI3qJRy.js";import"./send-BOSlm5fG.js";import"./outbound-attachment-BaTYE4qp.js";import"./delivery-queue-Cp3t4Upn.js";import"./project-context-BdK18hVI.js";import"./control-service-Ca0CBlhO.js";import"./stagger-CRe77dWL.js";import"./channel-selection-BLwXhb9t.js";import"./send-BOBan2eG.js";import"./resolve-route-DEIW5uKy.js";import"./channel-activity-DX36RadH.js";import"./tables-CojSfTth.js";import{t as formatDocsLink}from"./links-BKzP7VVP.js";import{n as runCommandWithRuntime}from"./cli-utils-C9pW69LF.js";import"./help-format-CfFf-w62.js";import"./progress-Cqb-jAjT.js";import"./replies-DATdLu15.js";import"./onboard-helpers-D2vxAtv8.js";import"./prompt-style-BMWmaqSC.js";import"./pairing-labels-BUXpRejW.js";import"./active-listener-Di9e1YAD.js";import"./mamba-state-engine-DJt_RpLC.js";import"./transformers-stream-Buj40qHl.js";import"./catalog-li4bSIE2.js";import"./note-DgDXuE0F.js";import"./clack-prompter-B52CP7eY.js";import"./helpers-DPPVplyk.js";import"./plugin-auto-enable-DT7HMdAA.js";import"./install-safe-path-ObPl6zIf.js";import"./npm-registry-spec-BV1VDmuN.js";import"./skill-scanner-C2gXLVti.js";import"./installs-C7X7CT9a.js";import"./onboard-channels-ZI4QC9WU.js";import"./daemon-runtime-CnNjpvfd.js";import"./runtime-guard-Bi8k55v9.js";import"./systemd-DdVd5Yet.js";import"./service-EKJG69M3.js";import"./widearea-dns-DvQozd9v.js";import"./bonjour-discovery-CViQz7cm.js";import"./health-CEz2-7et.js";import"./control-ui-assets-BxgWcomx.js";import"./skills-install-Bn6WUSea.js";import"./shared-DUsuqnhk.js";import"./onboard-auth.credentials-CV8n9m_T.js";import"./auth-token-yWeJoLJ8.js";import"./logging-ayt7F7vy.js";import"./provider-auth-helpers-CWUfg9zf.js";import"./auth-choice.apply-Dy4rVG6K.js";import"./openai-model-default-CzXGNcAh.js";import"./model-picker-Do5aHFkC.js";import"./auth-choice.apply.transformers-Be8599JD.js";import"./auth-choice-KcathmTY.js";import{n as configureCommandFromSectionsArg,o as CONFIGURE_WIZARD_SECTIONS}from"./configure-DPE2hDzY.js";import"./systemd-linger-CPKngdUf.js";import"./onboard-custom-D7VPWl41.js";import"./health-format-D4MaIjaG.js";import"./onboard-remote-ByDlhIU1.js";import"./onboard-skills-DOk3_-8w.js";function registerConfigureCommand(program){program.command(`configure`).description(`Interactive setup wizard for credentials, channels, gateway, and agent defaults`).addHelpText(`after`,()=>`\n${theme.muted(`Docs:`)} ${formatDocsLink(`/cli/configure`,`docs.builderforce.ai/cli/configure`)}\n`).option(`--section <section>`,`Configuration sections (repeatable). Options: ${CONFIGURE_WIZARD_SECTIONS.join(`, `)}`,(value,previous)=>[...previous,value],[]).action(async opts=>{await runCommandWithRuntime(defaultRuntime,async()=>{await configureCommandFromSectionsArg(opts.section,defaultRuntime)})})}export{registerConfigureCommand};
|
|
@@ -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-CuAFgjuQ.js";import{t as formatCliCommand}from"./command-format-DTMaGKs7.js";import"./src-DvWaTze9.js";import"./logger-wuOr7HKl.js";import"./session-key-CksCYipj.js";import"./builderforce-root-DY1qbWNX.js";import"./exec-COgsU9ql.js";import{k as resolveDefaultAgentWorkspaceDir}from"./agent-scope-CufEmNj_.js";import"./env-file-DeS6x2OL.js";import"./src-C8c9naq-.js";import{a as readConfigFileSnapshot,r as loadConfig}from"./io-CsCa3_1Z.js";import"./manifest-registry-009gLJ4l.js";import"./config-DmxNxDRW.js";import"./model-discovery-RTHjxEvZ.js";import"./model-catalog-D8OQ7p7I.js";import"./frontmatter-CaY7feZm.js";import"./skills-D3MwwPOH.js";import"./plugin-skills-pSFUbhg_.js";import"./skills-status-CGlKz1D1.js";import"./refresh-C4vwneXT.js";import"./client-CGgp3zkQ.js";import"./call-O-iC_P5t.js";import"./message-channel-z5YRpR2d.js";import"./subagent-registry-Cj5yC7B4.js";import"./sessions-CmJXMlLP.js";import"./project-context-store-BNXYrLJz.js";import"./tokens-CFKkpUIu.js";import"./plugins-1Mn6RiNf.js";import"./accounts-BkTLjSrD.js";import"./bindings-CKSDlQ1i.js";import"./send-CGcNbbV7.js";import"./send-DPRTlcZh.js";import"./with-timeout-CBXVw0An.js";import"./deliver--eLCRJc2.js";import"./accounts-Cx82nj4E.js";import"./send-DfHAMPcD.js";import"./image-ops-CotJhwRR.js";import"./redact-CgO7wehS.js";import"./errors-tAt19c1E.js";import"./embedded-helpers-BZGiFZlP.js";import"./sandbox-C-Owvt1-.js";import"./chrome-BfwLDcFc.js";import"./tailscale-DV-yOmYe.js";import"./auth-ChecwOXS.js";import"./server-context-BjYYSEVE.js";import"./routes-Dnfsevhw.js";import"./paths-BnOjueoX.js";import"./ssrf-DJXLYZ0d.js";import"./store-DHD2IEgd.js";import"./ports-DTku9NSx.js";import"./trash-C3zmJ_O7.js";import"./accounts-DcoaLXKI.js";import"./paths-ClsbsPQP.js";import"./tool-images-CCpqFtrL.js";import"./workspace-waBqRxiy.js";import"./reply-prefix-Cg7AqaK0.js";import"./sqlite-CIGM1WKg.js";import"./memory-cli-CiwWAhp5.js";import"./manager-Bjb9ptCz.js";import"./gemini-auth-KBXMhaRQ.js";import"./retry-B151Hej5.js";import"./common-BfwMxpLu.js";import"./runner-DwPaM8kz.js";import"./tool-display-Cs4hDP1f.js";import"./chunk-Dly7lM4r.js";import"./markdown-tables-B1Rx8hv6.js";import"./fetch-guard-DnXqPKae.js";import"./fetch-Cn_THzz8.js";import"./ir-CSdQJPqu.js";import"./render-DlHYsbvQ.js";import"./builderforcellm-syscheck-tquUDu_7.js";import"./session-utils-D2_j4c6U.js";import"./coding-tools.policy-BwdtwuXY.js";import"./pairing-store-BCsvhT6-.js";import"./fetch-DnWD6ydH.js";import"./exec-approvals-D7ZPAZpt.js";import"./nodes-screen-D6GHv_S0.js";import"./session-cost-usage-S0nkbPoW.js";import"./usage-format-5sp5AMSu.js";import"./provider-usage-DsI3qJRy.js";import"./send-BOSlm5fG.js";import"./outbound-attachment-BaTYE4qp.js";import"./delivery-queue-Cp3t4Upn.js";import"./project-context-BdK18hVI.js";import"./control-service-Ca0CBlhO.js";import"./stagger-CRe77dWL.js";import"./channel-selection-BLwXhb9t.js";import"./send-BOBan2eG.js";import"./resolve-route-DEIW5uKy.js";import"./channel-activity-DX36RadH.js";import"./tables-CojSfTth.js";import{t as formatDocsLink}from"./links-BKzP7VVP.js";import{n as runCommandWithRuntime}from"./cli-utils-C9pW69LF.js";import"./help-format-CfFf-w62.js";import"./progress-Cqb-jAjT.js";import"./replies-DATdLu15.js";import{d as openUrl,g as resolveControlUiLinks,i as detectBrowserOpenSupport,o as formatControlUiSshHint}from"./onboard-helpers-D2vxAtv8.js";import{n as stylePromptMessage,r as stylePromptTitle,t as stylePromptHint}from"./prompt-style-BMWmaqSC.js";import"./pairing-labels-BUXpRejW.js";import"./active-listener-Di9e1YAD.js";import"./mamba-state-engine-DJt_RpLC.js";import"./transformers-stream-Buj40qHl.js";import{t as copyToClipboard}from"./clipboard-BuWqKeWo.js";import"./catalog-li4bSIE2.js";import"./note-DgDXuE0F.js";import"./helpers-DPPVplyk.js";import"./plugin-auto-enable-DT7HMdAA.js";import"./channels-status-issues-NLYb8w9i.js";import"./register.subclis-D_fHb-Aj.js";import"./command-registry-Cjom5ab0.js";import"./program-context-Wpc-6CdI.js";import"./completion-cli-PTFpWp8Q.js";import"./daemon-runtime-CnNjpvfd.js";import"./runtime-guard-Bi8k55v9.js";import"./systemd-DdVd5Yet.js";import{t as resolveGatewayService}from"./service-EKJG69M3.js";import"./lifecycle-core-BsJbjf7b.js";import"./diagnostics-DamNPi4e.js";import{c as runDaemonStop}from"./daemon-cli-BHsiBvv7.js";import"./health-Cf1YoTRN.js";import"./control-ui-assets-BxgWcomx.js";import"./update-check-B0YqSZJr.js";import"./dm-policy-shared-DT6DrqEe.js";import"./session-dirs-eNN7E3kA.js";import"./logging-ayt7F7vy.js";import"./systemd-linger-CPKngdUf.js";import"./health-format-D4MaIjaG.js";import{n as doctorCommand,t as selectStyled}from"./prompt-select-styled-NxrGT7OR.js";import"./doctor-completion-ChhIrLd3.js";import path from"node:path";import fs from"node:fs";import fs$1 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$1.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$1.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}}const MAC_APP_PATH=`/Applications/Builderforce.app`,LEGACY_MAC_APP_PATH=`/Applications/BuilderForceAgents.app`;async function removeMacApp(runtime,dryRun){process.platform===`darwin`&&(await removePath(MAC_APP_PATH,runtime,{dryRun,label:MAC_APP_PATH}),fs.existsSync(LEGACY_MAC_APP_PATH)&&await removePath(LEGACY_MAC_APP_PATH,runtime,{dryRun,label:LEGACY_MAC_APP_PATH}))}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:MAC_APP_PATH}],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-CuAFgjuQ.js";import{t as formatCliCommand}from"./command-format-DTMaGKs7.js";import"./src-DvWaTze9.js";import"./logger-wuOr7HKl.js";import"./session-key-CksCYipj.js";import"./builderforce-root-DY1qbWNX.js";import"./exec-COgsU9ql.js";import{k as resolveDefaultAgentWorkspaceDir}from"./agent-scope-CufEmNj_.js";import"./env-file-DeS6x2OL.js";import"./src-C8c9naq-.js";import{a as readConfigFileSnapshot,r as loadConfig}from"./io-CsCa3_1Z.js";import"./manifest-registry-009gLJ4l.js";import"./config-DmxNxDRW.js";import"./model-discovery-RTHjxEvZ.js";import"./model-catalog-D8OQ7p7I.js";import"./frontmatter-CaY7feZm.js";import"./skills-D3MwwPOH.js";import"./plugin-skills-pSFUbhg_.js";import"./skills-status-CGlKz1D1.js";import"./refresh-C4vwneXT.js";import"./client-CGgp3zkQ.js";import"./call-O-iC_P5t.js";import"./message-channel-z5YRpR2d.js";import"./subagent-registry-m_x-JRkR.js";import"./sessions-CmJXMlLP.js";import"./project-context-store-BNXYrLJz.js";import"./tokens-CFKkpUIu.js";import"./plugins-1Mn6RiNf.js";import"./accounts-BkTLjSrD.js";import"./bindings-CKSDlQ1i.js";import"./send-CGcNbbV7.js";import"./send-DPRTlcZh.js";import"./with-timeout-CBXVw0An.js";import"./deliver--eLCRJc2.js";import"./accounts-Cx82nj4E.js";import"./send-DfHAMPcD.js";import"./image-ops-CotJhwRR.js";import"./redact-CgO7wehS.js";import"./errors-tAt19c1E.js";import"./embedded-helpers-BZGiFZlP.js";import"./sandbox-C-Owvt1-.js";import"./chrome-BfwLDcFc.js";import"./tailscale-DV-yOmYe.js";import"./auth-ChecwOXS.js";import"./server-context-BjYYSEVE.js";import"./routes-Dnfsevhw.js";import"./paths-BnOjueoX.js";import"./ssrf-DJXLYZ0d.js";import"./store-DHD2IEgd.js";import"./ports-DTku9NSx.js";import"./trash-C3zmJ_O7.js";import"./accounts-DcoaLXKI.js";import"./paths-ClsbsPQP.js";import"./tool-images-CCpqFtrL.js";import"./workspace-waBqRxiy.js";import"./reply-prefix-Cg7AqaK0.js";import"./sqlite-CIGM1WKg.js";import"./memory-cli-CiwWAhp5.js";import"./manager-Bjb9ptCz.js";import"./gemini-auth-KBXMhaRQ.js";import"./retry-B151Hej5.js";import"./common-BfwMxpLu.js";import"./runner-DwPaM8kz.js";import"./tool-display-Cs4hDP1f.js";import"./chunk-Dly7lM4r.js";import"./markdown-tables-B1Rx8hv6.js";import"./fetch-guard-DnXqPKae.js";import"./fetch-Cn_THzz8.js";import"./ir-CSdQJPqu.js";import"./render-DlHYsbvQ.js";import"./builderforcellm-syscheck-tquUDu_7.js";import"./session-utils-D2_j4c6U.js";import"./coding-tools.policy-BwdtwuXY.js";import"./pairing-store-BCsvhT6-.js";import"./fetch-DnWD6ydH.js";import"./exec-approvals-D7ZPAZpt.js";import"./nodes-screen-D6GHv_S0.js";import"./session-cost-usage-S0nkbPoW.js";import"./usage-format-5sp5AMSu.js";import"./provider-usage-DsI3qJRy.js";import"./send-BOSlm5fG.js";import"./outbound-attachment-BaTYE4qp.js";import"./delivery-queue-Cp3t4Upn.js";import"./project-context-BdK18hVI.js";import"./control-service-Ca0CBlhO.js";import"./stagger-CRe77dWL.js";import"./channel-selection-BLwXhb9t.js";import"./send-BOBan2eG.js";import"./resolve-route-DEIW5uKy.js";import"./channel-activity-DX36RadH.js";import"./tables-CojSfTth.js";import{t as formatDocsLink}from"./links-BKzP7VVP.js";import{n as runCommandWithRuntime}from"./cli-utils-C9pW69LF.js";import"./help-format-CfFf-w62.js";import"./progress-Cqb-jAjT.js";import"./replies-DATdLu15.js";import{d as openUrl,g as resolveControlUiLinks,i as detectBrowserOpenSupport,o as formatControlUiSshHint}from"./onboard-helpers-D2vxAtv8.js";import{n as stylePromptMessage,r as stylePromptTitle,t as stylePromptHint}from"./prompt-style-BMWmaqSC.js";import"./pairing-labels-BUXpRejW.js";import"./active-listener-Di9e1YAD.js";import"./mamba-state-engine-DJt_RpLC.js";import"./transformers-stream-Buj40qHl.js";import{t as copyToClipboard}from"./clipboard-BuWqKeWo.js";import"./catalog-li4bSIE2.js";import"./note-DgDXuE0F.js";import"./helpers-DPPVplyk.js";import"./plugin-auto-enable-DT7HMdAA.js";import"./channels-status-issues-NLYb8w9i.js";import"./register.subclis-AFsfDByV.js";import"./command-registry-BqhtXJa7.js";import"./program-context-Wpc-6CdI.js";import"./completion-cli-BFR0u1Uh.js";import"./daemon-runtime-CnNjpvfd.js";import"./runtime-guard-Bi8k55v9.js";import"./systemd-DdVd5Yet.js";import{t as resolveGatewayService}from"./service-EKJG69M3.js";import"./lifecycle-core-BsJbjf7b.js";import"./diagnostics-DamNPi4e.js";import{c as runDaemonStop}from"./daemon-cli-BHsiBvv7.js";import"./health-CEz2-7et.js";import"./control-ui-assets-BxgWcomx.js";import"./update-check-B0YqSZJr.js";import"./dm-policy-shared-DT6DrqEe.js";import"./session-dirs-Bkfs-7vN.js";import"./logging-ayt7F7vy.js";import"./systemd-linger-CPKngdUf.js";import"./health-format-D4MaIjaG.js";import{n as doctorCommand,t as selectStyled}from"./prompt-select-styled-BtjhlTEH.js";import"./doctor-completion-CkjrUmbI.js";import path from"node:path";import fs from"node:fs";import fs$1 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$1.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$1.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}}const MAC_APP_PATH=`/Applications/Builderforce.app`,LEGACY_MAC_APP_PATH=`/Applications/BuilderForceAgents.app`;async function removeMacApp(runtime,dryRun){process.platform===`darwin`&&(await removePath(MAC_APP_PATH,runtime,{dryRun,label:MAC_APP_PATH}),fs.existsSync(LEGACY_MAC_APP_PATH)&&await removePath(LEGACY_MAC_APP_PATH,runtime,{dryRun,label:LEGACY_MAC_APP_PATH}))}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:MAC_APP_PATH}],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 +1 @@
|
|
|
1
|
-
import{g as resolveStateDir,i as isNixMode,m as resolveOAuthDir,o as resolveConfigPath,u as resolveGatewayPort}from"./paths-5FcIFMsj.js";import{B as theme,S as shortenHomeInString,b as resolveUserPath,v as resolveHomeDir}from"./utils-DbaBVFaK.js";import"./embedded-helpers-2fP2Yq8h.js";import"./reply-D9wUWhMx.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{k as resolveDefaultAgentWorkspaceDir}from"./agent-scope-DPtjOxzp.js";import"./src-CA0fU67C.js";import"./model-selection-Doyvd4lU.js";import{t as formatCliCommand}from"./command-format-D806O2pt.js";import"./env-file-D1MDi-AM.js";import"./boolean-Cnh1KNl1.js";import"./env-BIdU5BAp.js";import"./src-BifagO7i.js";import{a as readConfigFileSnapshot,r as loadConfig}from"./io-BNtgT4VB.js";import"./manifest-registry-BJCfNV1a.js";import"./config-BD801bpx.js";import"./runner-C3k1sKdu.js";import"./model-catalog-BoiWqBTw.js";import"./sandbox-1jtP0nhr.js";import"./chrome-Bfprrnm1.js";import"./tailscale-DLkpGquM.js";import"./auth-lebUHrkd.js";import"./server-context-DKdrUePN.js";import"./frontmatter-3D1EdC1L.js";import"./skills-Ba4ftrB-.js";import"./plugin-skills-B11rggZh.js";import"./routes-CRrqIFJR.js";import"./redact-BHdfp2MZ.js";import"./errors-B1MIg3g-.js";import"./paths-cR8ct-Y3.js";import"./ssrf-p9k-iapc.js";import"./image-ops-C8IUQKjn.js";import"./store-CmHBQ-yX.js";import"./ports-DgmEDNOm.js";import"./trash-DD2Hc5oq.js";import"./sessions-BPr0-lkT.js";import"./message-channel-D_jXxXQj.js";import"./plugins-D5zP6ENo.js";import"./accounts-o35LU_iy.js";import"./accounts-rmXEiebi.js";import"./accounts-BLueHgKj.js";import"./bindings-DR59065T.js";import"./send-l9WWK31e.js";import"./send-CVgJk5kN.js";import"./paths-DJ6rztqJ.js";import"./tool-images-B7b_OiMz.js";import"./tool-display-ByOZtWvA.js";import"./fetch-guard-8mwt3-hm.js";import"./api-key-rotation-Yn3MpU4F.js";import"./fetch-BuOLY9KP.js";import"./sqlite-C39E12XS.js";import"./tokens-CCU3zO-D.js";import"./project-context-store-Dbbjk8CQ.js";import"./with-timeout-CPd4-suw.js";import"./deliver-BiGCWHvZ.js";import"./send-CRSlal5z.js";import"./workspace-D4LK4thI.js";import"./reply-prefix-zIMgi6K6.js";import"./memory-cli-D-Khe5Ij.js";import"./manager-DNIg84rj.js";import"./retry-DlVhg5qu.js";import"./client-xfoidwPI.js";import"./call-CJq3iGqu.js";import"./common-BTbIhLyt.js";import"./chunk-FCBlVOyo.js";import"./markdown-tables-P6uoUSFa.js";import"./ir-5BNoIXZm.js";import"./render-D1dVTEB1.js";import"./builderforcellm-syscheck-Cp4LMft_.js";import"./send-D_6wd5Y3.js";import"./outbound-attachment-C7wByQO5.js";import"./fetch-DnVtDecb.js";import"./delivery-queue-CXKynF1P.js";import"./channel-activity-CCNDbdD3.js";import"./tables-ERcoWFDp.js";import"./pairing-store-C8gtsUDG.js";import{t as formatDocsLink}from"./links-BgWWaaOT.js";import{n as runCommandWithRuntime}from"./cli-utils-LBYKdNFb.js";import"./help-format-Qfk2vDNX.js";import"./progress-BfOtdN6b.js";import"./resolve-route-D49haUnv.js";import"./replies-DAwcEPGb.js";import"./refresh-TiC_kLgE.js";import"./coding-tools.policy-COe2xa9K.js";import"./send-BIMaIwQV.js";import{d as openUrl,g as resolveControlUiLinks,i as detectBrowserOpenSupport,o as formatControlUiSshHint}from"./onboard-helpers-BmYUjl4j.js";import{n as stylePromptMessage,r as stylePromptTitle,t as stylePromptHint}from"./prompt-style-BpVK43GK.js";import"./pairing-labels-CD0lPAfY.js";import"./session-cost-usage-BjH7mxVj.js";import"./usage-format-DGf8ZWPH.js";import"./provider-usage-QGVVADJa.js";import"./active-listener-Dcg19lJG.js";import"./exec-approvals-BpVPDVtV.js";import"./nodes-screen-C3TDIi8d.js";import"./project-context-BLpMH93w.js";import"./control-service-DKBAemtq.js";import"./stagger-8EkqkqJv.js";import"./channel-selection-DyAvzlY8.js";import"./mamba-state-engine-BQuRdgMU.js";import"./transformers-stream-D7nRu4Qu.js";import"./runtime-guard-DhksRHci.js";import"./program-context-DP4Xq9zC.js";import"./catalog-rgiY__UQ.js";import"./skills-status-vWC0PU8J.js";import{t as copyToClipboard}from"./clipboard-CGHe68at.js";import"./note-B6NtFdXt.js";import"./helpers-DTDCy17p.js";import"./plugin-auto-enable-zKMSAekH.js";import"./channels-status-issues-BlOu0Ul_.js";import"./completion-cli-BsXDz7T2.js";import"./daemon-runtime-0CbmdgMr.js";import"./systemd-BG3_QT6W.js";import{t as resolveGatewayService}from"./service-D-NLDyK3.js";import"./lifecycle-core-lZTP9Ary.js";import"./diagnostics-DCjg0nBH.js";import{c as runDaemonStop}from"./daemon-cli-Dt1S7APn.js";import"./health-AlkF1nUa.js";import"./control-ui-assets-CWgH1Tda.js";import"./update-check-D6MvqVFE.js";import"./dm-policy-shared-CLiz10xA.js";import"./session-dirs-C-pVBwSV.js";import"./logging-DHa3jQN3.js";import"./systemd-linger-CT-VHPB3.js";import"./health-format-iE_KYEwP.js";import{n as doctorCommand,t as selectStyled}from"./prompt-select-styled-Csz9HlSx.js";import"./doctor-completion-BUZwWoWB.js";import fs from"node:fs";import path from"node:path";import fs$1 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$1.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$1.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}}const MAC_APP_PATH=`/Applications/Builderforce.app`,LEGACY_MAC_APP_PATH=`/Applications/BuilderForceAgents.app`;async function removeMacApp(runtime,dryRun){process.platform===`darwin`&&(await removePath(MAC_APP_PATH,runtime,{dryRun,label:MAC_APP_PATH}),fs.existsSync(LEGACY_MAC_APP_PATH)&&await removePath(LEGACY_MAC_APP_PATH,runtime,{dryRun,label:LEGACY_MAC_APP_PATH}))}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:MAC_APP_PATH}],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-5FcIFMsj.js";import{B as theme,S as shortenHomeInString,b as resolveUserPath,v as resolveHomeDir}from"./utils-DbaBVFaK.js";import"./embedded-helpers-2fP2Yq8h.js";import"./reply-BuUSdq2L.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{k as resolveDefaultAgentWorkspaceDir}from"./agent-scope-DPtjOxzp.js";import"./src-CA0fU67C.js";import"./model-selection-Doyvd4lU.js";import{t as formatCliCommand}from"./command-format-D806O2pt.js";import"./env-file-D1MDi-AM.js";import"./boolean-Cnh1KNl1.js";import"./env-BIdU5BAp.js";import"./src-BifagO7i.js";import{a as readConfigFileSnapshot,r as loadConfig}from"./io-BNtgT4VB.js";import"./manifest-registry-BJCfNV1a.js";import"./config-BD801bpx.js";import"./runner-C3k1sKdu.js";import"./model-catalog-BoiWqBTw.js";import"./sandbox-1jtP0nhr.js";import"./chrome-Bfprrnm1.js";import"./tailscale-DLkpGquM.js";import"./auth-lebUHrkd.js";import"./server-context-DKdrUePN.js";import"./frontmatter-3D1EdC1L.js";import"./skills-Ba4ftrB-.js";import"./plugin-skills-B11rggZh.js";import"./routes-CRrqIFJR.js";import"./redact-BHdfp2MZ.js";import"./errors-B1MIg3g-.js";import"./paths-cR8ct-Y3.js";import"./ssrf-p9k-iapc.js";import"./image-ops-C8IUQKjn.js";import"./store-CmHBQ-yX.js";import"./ports-DgmEDNOm.js";import"./trash-DD2Hc5oq.js";import"./sessions-BPr0-lkT.js";import"./message-channel-D_jXxXQj.js";import"./plugins-D5zP6ENo.js";import"./accounts-o35LU_iy.js";import"./accounts-rmXEiebi.js";import"./accounts-BLueHgKj.js";import"./bindings-DR59065T.js";import"./send-l9WWK31e.js";import"./send-CVgJk5kN.js";import"./paths-DJ6rztqJ.js";import"./tool-images-B7b_OiMz.js";import"./tool-display-ByOZtWvA.js";import"./fetch-guard-8mwt3-hm.js";import"./api-key-rotation-Yn3MpU4F.js";import"./fetch-BuOLY9KP.js";import"./sqlite-C39E12XS.js";import"./tokens-CCU3zO-D.js";import"./project-context-store-Dbbjk8CQ.js";import"./with-timeout-CPd4-suw.js";import"./deliver-BiGCWHvZ.js";import"./send-CRSlal5z.js";import"./workspace-D4LK4thI.js";import"./reply-prefix-zIMgi6K6.js";import"./memory-cli-D-Khe5Ij.js";import"./manager-DNIg84rj.js";import"./retry-DlVhg5qu.js";import"./client-xfoidwPI.js";import"./call-CJq3iGqu.js";import"./common-BTbIhLyt.js";import"./chunk-FCBlVOyo.js";import"./markdown-tables-P6uoUSFa.js";import"./ir-5BNoIXZm.js";import"./render-D1dVTEB1.js";import"./builderforcellm-syscheck-Cp4LMft_.js";import"./send-D_6wd5Y3.js";import"./outbound-attachment-C7wByQO5.js";import"./fetch-DnVtDecb.js";import"./delivery-queue-CXKynF1P.js";import"./channel-activity-CCNDbdD3.js";import"./tables-ERcoWFDp.js";import"./pairing-store-C8gtsUDG.js";import{t as formatDocsLink}from"./links-BgWWaaOT.js";import{n as runCommandWithRuntime}from"./cli-utils-LBYKdNFb.js";import"./help-format-Qfk2vDNX.js";import"./progress-BfOtdN6b.js";import"./resolve-route-D49haUnv.js";import"./replies-DAwcEPGb.js";import"./refresh-TiC_kLgE.js";import"./coding-tools.policy-COe2xa9K.js";import"./send-BIMaIwQV.js";import{d as openUrl,g as resolveControlUiLinks,i as detectBrowserOpenSupport,o as formatControlUiSshHint}from"./onboard-helpers-BmYUjl4j.js";import{n as stylePromptMessage,r as stylePromptTitle,t as stylePromptHint}from"./prompt-style-BpVK43GK.js";import"./pairing-labels-CD0lPAfY.js";import"./session-cost-usage-BjH7mxVj.js";import"./usage-format-DGf8ZWPH.js";import"./provider-usage-QGVVADJa.js";import"./active-listener-Dcg19lJG.js";import"./exec-approvals-BpVPDVtV.js";import"./nodes-screen-C3TDIi8d.js";import"./project-context-BLpMH93w.js";import"./control-service-DKBAemtq.js";import"./stagger-8EkqkqJv.js";import"./channel-selection-DyAvzlY8.js";import"./mamba-state-engine-BQuRdgMU.js";import"./transformers-stream-D7nRu4Qu.js";import"./runtime-guard-DhksRHci.js";import"./program-context-BCTE8zEF.js";import"./catalog-rgiY__UQ.js";import"./skills-status-vWC0PU8J.js";import{t as copyToClipboard}from"./clipboard-CGHe68at.js";import"./note-B6NtFdXt.js";import"./helpers-DTDCy17p.js";import"./plugin-auto-enable-zKMSAekH.js";import"./channels-status-issues-BlOu0Ul_.js";import"./completion-cli-Da3-oE7r.js";import"./daemon-runtime-0CbmdgMr.js";import"./systemd-BG3_QT6W.js";import{t as resolveGatewayService}from"./service-D-NLDyK3.js";import"./lifecycle-core-lZTP9Ary.js";import"./diagnostics-DCjg0nBH.js";import{c as runDaemonStop}from"./daemon-cli-Dt1S7APn.js";import"./health-CFVx21sO.js";import"./control-ui-assets-CWgH1Tda.js";import"./update-check-D6MvqVFE.js";import"./dm-policy-shared-CLiz10xA.js";import"./session-dirs-rYDCA_mQ.js";import"./logging-DHa3jQN3.js";import"./systemd-linger-CT-VHPB3.js";import"./health-format-iE_KYEwP.js";import{n as doctorCommand,t as selectStyled}from"./prompt-select-styled-CaNl41mG.js";import"./doctor-completion-Dh9ah5lH.js";import fs from"node:fs";import path from"node:path";import fs$1 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$1.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$1.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}}const MAC_APP_PATH=`/Applications/Builderforce.app`,LEGACY_MAC_APP_PATH=`/Applications/BuilderForceAgents.app`;async function removeMacApp(runtime,dryRun){process.platform===`darwin`&&(await removePath(MAC_APP_PATH,runtime,{dryRun,label:MAC_APP_PATH}),fs.existsSync(LEGACY_MAC_APP_PATH)&&await removePath(LEGACY_MAC_APP_PATH,runtime,{dryRun,label:LEGACY_MAC_APP_PATH}))}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:MAC_APP_PATH}],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-2fP2Yq8h.js";import{G as formatTargetDisplay,R as runMessageAction,ct as CHANNEL_TARGET_DESCRIPTION,q as CHANNEL_MESSAGE_ACTION_NAMES,st as CHANNEL_TARGETS_DESCRIPTION}from"./reply-D9wUWhMx.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"./src-CA0fU67C.js";import"./model-selection-Doyvd4lU.js";import"./env-file-D1MDi-AM.js";import"./boolean-Cnh1KNl1.js";import"./env-BIdU5BAp.js";import"./src-BifagO7i.js";import{r as loadConfig}from"./io-BNtgT4VB.js";import"./manifest-registry-BJCfNV1a.js";import"./config-BD801bpx.js";import"./runner-C3k1sKdu.js";import"./model-catalog-BoiWqBTw.js";import"./sandbox-1jtP0nhr.js";import"./chrome-Bfprrnm1.js";import"./tailscale-DLkpGquM.js";import"./auth-lebUHrkd.js";import"./server-context-DKdrUePN.js";import"./frontmatter-3D1EdC1L.js";import"./skills-Ba4ftrB-.js";import"./plugin-skills-B11rggZh.js";import"./routes-CRrqIFJR.js";import"./redact-BHdfp2MZ.js";import"./errors-B1MIg3g-.js";import"./paths-cR8ct-Y3.js";import"./ssrf-p9k-iapc.js";import"./image-ops-C8IUQKjn.js";import"./store-CmHBQ-yX.js";import"./ports-DgmEDNOm.js";import"./trash-DD2Hc5oq.js";import"./sessions-BPr0-lkT.js";import{h as GATEWAY_CLIENT_NAMES,m as GATEWAY_CLIENT_MODES}from"./message-channel-D_jXxXQj.js";import{t as getChannelPlugin}from"./plugins-D5zP6ENo.js";import"./accounts-o35LU_iy.js";import"./accounts-rmXEiebi.js";import"./accounts-BLueHgKj.js";import"./bindings-DR59065T.js";import"./send-l9WWK31e.js";import"./send-CVgJk5kN.js";import"./paths-DJ6rztqJ.js";import"./tool-images-B7b_OiMz.js";import"./tool-display-ByOZtWvA.js";import"./fetch-guard-8mwt3-hm.js";import"./api-key-rotation-Yn3MpU4F.js";import"./fetch-BuOLY9KP.js";import"./sqlite-C39E12XS.js";import"./tokens-CCU3zO-D.js";import"./project-context-store-Dbbjk8CQ.js";import"./with-timeout-CPd4-suw.js";import{T as runGlobalGatewayStopSafely}from"./deliver-BiGCWHvZ.js";import"./send-CRSlal5z.js";import"./workspace-D4LK4thI.js";import"./reply-prefix-zIMgi6K6.js";import"./memory-cli-D-Khe5Ij.js";import"./manager-DNIg84rj.js";import"./retry-DlVhg5qu.js";import"./client-xfoidwPI.js";import"./call-CJq3iGqu.js";import"./common-BTbIhLyt.js";import"./chunk-FCBlVOyo.js";import"./markdown-tables-P6uoUSFa.js";import"./ir-5BNoIXZm.js";import"./render-D1dVTEB1.js";import"./builderforcellm-syscheck-Cp4LMft_.js";import"./send-D_6wd5Y3.js";import"./outbound-attachment-C7wByQO5.js";import"./fetch-DnVtDecb.js";import"./delivery-queue-CXKynF1P.js";import"./channel-activity-CCNDbdD3.js";import"./tables-ERcoWFDp.js";import"./pairing-store-C8gtsUDG.js";import{t as formatDocsLink}from"./links-BgWWaaOT.js";import{n as runCommandWithRuntime}from"./cli-utils-LBYKdNFb.js";import{t as formatHelpExamples}from"./help-format-Qfk2vDNX.js";import{n as withProgress}from"./progress-BfOtdN6b.js";import"./resolve-route-D49haUnv.js";import"./replies-DAwcEPGb.js";import"./refresh-TiC_kLgE.js";import"./coding-tools.policy-COe2xa9K.js";import"./send-BIMaIwQV.js";import"./onboard-helpers-BmYUjl4j.js";import"./prompt-style-BpVK43GK.js";import"./pairing-labels-CD0lPAfY.js";import"./session-cost-usage-BjH7mxVj.js";import"./usage-format-DGf8ZWPH.js";import"./provider-usage-QGVVADJa.js";import"./active-listener-Dcg19lJG.js";import"./exec-approvals-BpVPDVtV.js";import"./nodes-screen-C3TDIi8d.js";import"./project-context-BLpMH93w.js";import"./control-service-DKBAemtq.js";import"./stagger-8EkqkqJv.js";import"./channel-selection-DyAvzlY8.js";import"./mamba-state-engine-BQuRdgMU.js";import"./transformers-stream-D7nRu4Qu.js";import{t as createDefaultDeps}from"./deps-CGiO_NDu.js";import{t as collectOption}from"./helpers-CESJCicC.js";import{t as ensurePluginRegistryLoaded}from"./plugin-registry-BEmyRfmb.js";import{t as renderTable}from"./table-BoCHYKoQ.js";import{t as createOutboundSendDeps}from"./outbound-send-deps-CmJnMKI7.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-2fP2Yq8h.js";import{G as formatTargetDisplay,R as runMessageAction,ct as CHANNEL_TARGET_DESCRIPTION,q as CHANNEL_MESSAGE_ACTION_NAMES,st as CHANNEL_TARGETS_DESCRIPTION}from"./reply-BuUSdq2L.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"./src-CA0fU67C.js";import"./model-selection-Doyvd4lU.js";import"./env-file-D1MDi-AM.js";import"./boolean-Cnh1KNl1.js";import"./env-BIdU5BAp.js";import"./src-BifagO7i.js";import{r as loadConfig}from"./io-BNtgT4VB.js";import"./manifest-registry-BJCfNV1a.js";import"./config-BD801bpx.js";import"./runner-C3k1sKdu.js";import"./model-catalog-BoiWqBTw.js";import"./sandbox-1jtP0nhr.js";import"./chrome-Bfprrnm1.js";import"./tailscale-DLkpGquM.js";import"./auth-lebUHrkd.js";import"./server-context-DKdrUePN.js";import"./frontmatter-3D1EdC1L.js";import"./skills-Ba4ftrB-.js";import"./plugin-skills-B11rggZh.js";import"./routes-CRrqIFJR.js";import"./redact-BHdfp2MZ.js";import"./errors-B1MIg3g-.js";import"./paths-cR8ct-Y3.js";import"./ssrf-p9k-iapc.js";import"./image-ops-C8IUQKjn.js";import"./store-CmHBQ-yX.js";import"./ports-DgmEDNOm.js";import"./trash-DD2Hc5oq.js";import"./sessions-BPr0-lkT.js";import{h as GATEWAY_CLIENT_NAMES,m as GATEWAY_CLIENT_MODES}from"./message-channel-D_jXxXQj.js";import{t as getChannelPlugin}from"./plugins-D5zP6ENo.js";import"./accounts-o35LU_iy.js";import"./accounts-rmXEiebi.js";import"./accounts-BLueHgKj.js";import"./bindings-DR59065T.js";import"./send-l9WWK31e.js";import"./send-CVgJk5kN.js";import"./paths-DJ6rztqJ.js";import"./tool-images-B7b_OiMz.js";import"./tool-display-ByOZtWvA.js";import"./fetch-guard-8mwt3-hm.js";import"./api-key-rotation-Yn3MpU4F.js";import"./fetch-BuOLY9KP.js";import"./sqlite-C39E12XS.js";import"./tokens-CCU3zO-D.js";import"./project-context-store-Dbbjk8CQ.js";import"./with-timeout-CPd4-suw.js";import{T as runGlobalGatewayStopSafely}from"./deliver-BiGCWHvZ.js";import"./send-CRSlal5z.js";import"./workspace-D4LK4thI.js";import"./reply-prefix-zIMgi6K6.js";import"./memory-cli-D-Khe5Ij.js";import"./manager-DNIg84rj.js";import"./retry-DlVhg5qu.js";import"./client-xfoidwPI.js";import"./call-CJq3iGqu.js";import"./common-BTbIhLyt.js";import"./chunk-FCBlVOyo.js";import"./markdown-tables-P6uoUSFa.js";import"./ir-5BNoIXZm.js";import"./render-D1dVTEB1.js";import"./builderforcellm-syscheck-Cp4LMft_.js";import"./send-D_6wd5Y3.js";import"./outbound-attachment-C7wByQO5.js";import"./fetch-DnVtDecb.js";import"./delivery-queue-CXKynF1P.js";import"./channel-activity-CCNDbdD3.js";import"./tables-ERcoWFDp.js";import"./pairing-store-C8gtsUDG.js";import{t as formatDocsLink}from"./links-BgWWaaOT.js";import{n as runCommandWithRuntime}from"./cli-utils-LBYKdNFb.js";import{t as formatHelpExamples}from"./help-format-Qfk2vDNX.js";import{n as withProgress}from"./progress-BfOtdN6b.js";import"./resolve-route-D49haUnv.js";import"./replies-DAwcEPGb.js";import"./refresh-TiC_kLgE.js";import"./coding-tools.policy-COe2xa9K.js";import"./send-BIMaIwQV.js";import"./onboard-helpers-BmYUjl4j.js";import"./prompt-style-BpVK43GK.js";import"./pairing-labels-CD0lPAfY.js";import"./session-cost-usage-BjH7mxVj.js";import"./usage-format-DGf8ZWPH.js";import"./provider-usage-QGVVADJa.js";import"./active-listener-Dcg19lJG.js";import"./exec-approvals-BpVPDVtV.js";import"./nodes-screen-C3TDIi8d.js";import"./project-context-BLpMH93w.js";import"./control-service-DKBAemtq.js";import"./stagger-8EkqkqJv.js";import"./channel-selection-DyAvzlY8.js";import"./mamba-state-engine-BQuRdgMU.js";import"./transformers-stream-D7nRu4Qu.js";import{t as createDefaultDeps}from"./deps-CrAVOWsA.js";import{t as collectOption}from"./helpers-CESJCicC.js";import{t as ensurePluginRegistryLoaded}from"./plugin-registry-DrEpL5ac.js";import{t as renderTable}from"./table-BoCHYKoQ.js";import{t as createOutboundSendDeps}from"./outbound-send-deps-CmJnMKI7.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
|
|