remoteclaw 0.1.0-next.dbdff5b → 0.1.0-next.dc658d8
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/README.md +2 -2
- package/dist/accounts-Aqbb2_Fn.js +270 -0
- package/dist/accounts-Bo2bX8jP.js +272 -0
- package/dist/accounts-CjZ1n2KR.js +32 -0
- package/dist/accounts-D3fAPVzU.js +36 -0
- package/dist/accounts-DZmv4bXS.js +47 -0
- package/dist/accounts-DmB4SVPK.js +47 -0
- package/dist/accounts-DtkyfvwR.js +36 -0
- package/dist/ack-reactions-BqcZUQJ3.js +446 -0
- package/dist/ack-reactions-DXHaDBH-.js +446 -0
- package/dist/acp-cli-DVXhDMc6.js +1324 -0
- package/dist/acp-cli-QBL4_qcW.js +1319 -0
- package/dist/active-listener-CwxZ24bZ.js +37 -0
- package/dist/active-listener-v2sItamh.js +37 -0
- package/dist/agent-C5PZDKE1.js +687 -0
- package/dist/agent-helpers-BSGqeJr-.js +400 -0
- package/dist/agent-qCBPcUcF.js +688 -0
- package/dist/agent-scope-_ND_-bJy.js +116 -0
- package/dist/agents-Byc39Y4A.js +760 -0
- package/dist/agents.config-BgDBcY4h.js +116 -0
- package/dist/agents.config-D8gLHPWo.js +116 -0
- package/dist/ansi-DtaiOnt1.js +107 -0
- package/dist/audio-CQ8TfmVN.js +43 -0
- package/dist/audit-C0x7Cm6K.js +3150 -0
- package/dist/audit-CAY-uzWP.js +3150 -0
- package/dist/auth-DGqCLaQq.js +448 -0
- package/dist/auth-DLTRySEi.js +314 -0
- package/dist/auth-Drf91ntw.js +315 -0
- package/dist/auth-ku2khJyQ.js +448 -0
- package/dist/banner-CGI3XOm4.js +294 -0
- package/dist/binaries-BTvHIrCr.js +13 -0
- package/dist/bindings-Dr0bGRst.js +69 -0
- package/dist/bindings-DsWJQVKh.js +69 -0
- package/dist/bonjour-discovery-BElR62fH.js +378 -0
- package/dist/bonjour-discovery-C8XyVsjb.js +378 -0
- package/dist/boot/handler.js +17 -33
- package/dist/browser-cli-DxJew43l.js +1694 -0
- package/dist/browser-cli-p0nakrjO.js +1690 -0
- package/dist/build-info.json +3 -3
- package/dist/call-BrTmlOx3.js +518 -0
- package/dist/call-ChdUdwb4.js +517 -0
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/catalog-DTlcfTT9.js +185 -0
- package/dist/catalog-PixZqhZK.js +185 -0
- package/dist/channel-account-context-BO245Tcn.js +133 -0
- package/dist/channel-account-context-BgK0hm-I.js +133 -0
- package/dist/channel-activity-C-L6rDrQ.js +94 -0
- package/dist/channel-activity-DdgLBZ7M.js +94 -0
- package/dist/channel-activity-hL4KZrCz.js +292 -0
- package/dist/channel-options-C1Q9SUhv.js +33 -0
- package/dist/channel-options-zANFhRx_.js +32 -0
- package/dist/channel-selection-DW21dXB1.js +51 -0
- package/dist/channel-selection-wK_6S2Ku.js +51 -0
- package/dist/channel-web-DCSjrtlh.js +2136 -0
- package/dist/channel-web-JCgegBgG.js +2134 -0
- package/dist/channels-cli-D48ytzLq.js +1438 -0
- package/dist/channels-cli-hZbUcB3G.js +1434 -0
- package/dist/channels-status-issues-B6I2l7Sm.js +18 -0
- package/dist/channels-status-issues-DhDH2fWp.js +18 -0
- package/dist/chat-envelope-BIujl9Cj.js +248 -0
- package/dist/chrome-Dqtq7zCc.js +1733 -0
- package/dist/chrome-XeSY99Z_.js +1732 -0
- package/dist/chunk-CWD_zrz_.js +341 -0
- package/dist/chunk-LUabyS9k.js +341 -0
- package/dist/clack-prompter-fAgbvPW4.js +122 -0
- package/dist/clack-prompter-kf9qTN5p.js +121 -0
- package/dist/cli/daemon-cli.js +1 -1
- package/dist/cli-BTLaY8q4.js +133 -0
- package/dist/cli-CZV23GbW.js +129 -0
- package/dist/client-B9u3JdT_.js +2316 -0
- package/dist/client-DEEOhx0w.js +2316 -0
- package/dist/clipboard-B2nstLx7.js +31 -0
- package/dist/clipboard-C8QI9fes.js +31 -0
- package/dist/command-format-LFmgWzKJ.js +18 -0
- package/dist/command-logger/handler.js +1 -1
- package/dist/command-registry-BPXqH4ST.js +215 -0
- package/dist/commands-BAYwlS3d.js +41 -0
- package/dist/commands-D842kCjj.js +41 -0
- package/dist/commands-registry-Cg2GTT2J.js +892 -0
- package/dist/commands-registry-Yz-uV5oG.js +891 -0
- package/dist/common-B67cBSew.js +156 -0
- package/dist/common-DEoiTqOr.js +156 -0
- package/dist/completion-cli-D5J3fPka.js +452 -0
- package/dist/completion-cli-Dd1g-p7S.js +452 -0
- package/dist/config-CAa0rZSx.js +4225 -0
- package/dist/config-W0w-gi2j.js +4223 -0
- package/dist/config-cli-Ddz-yCdQ.js +247 -0
- package/dist/config-cli-shgSFYig.js +243 -0
- package/dist/config-guard-BI85dxHR.js +99 -0
- package/dist/config-guard-DQqnigKh.js +75 -0
- package/dist/config-validation-D-h4LHyA.js +18 -0
- package/dist/config-validation-Df_kroIQ.js +18 -0
- package/dist/configure-BnFwpZ3l.js +891 -0
- package/dist/configure-Cj4mlKSH.js +889 -0
- package/dist/constants-BAZuhSRm.js +75 -0
- package/dist/constants-BBVTjb1j.js +75 -0
- package/dist/control-auth-BrBr2xb8.js +397 -0
- package/dist/control-auth-CehjYKnL.js +397 -0
- package/dist/control-ui/assets/index-DdiU_ccM.css +1 -0
- package/dist/control-ui/assets/index-kVUYi64u.js +7723 -0
- package/dist/control-ui/assets/index-kVUYi64u.js.map +1 -0
- package/dist/control-ui/index.html +2 -2
- package/dist/control-ui-assets-D8F383Mo.js +186 -0
- package/dist/control-ui-assets-DYKtRIm0.js +186 -0
- package/dist/conversation-label-CDH4rKMG.js +36 -0
- package/dist/cron-cli-DVzDHzAX.js +494 -0
- package/dist/cron-cli-gkH2qKM4.js +498 -0
- package/dist/daemon-cli-BTdNO1vH.js +737 -0
- package/dist/daemon-cli-DNNqI2LD.js +735 -0
- package/dist/daemon-cli.js +1 -2
- package/dist/daemon-install-CaEHG92p.js +56 -0
- package/dist/daemon-install-DbpDSDfW.js +60 -0
- package/dist/daemon-install-helpers-DjE_WnlY.js +504 -0
- package/dist/daemon-install-helpers-DocTUxqQ.js +504 -0
- package/dist/deliver-CDcL8ok6.js +481 -0
- package/dist/deliver-CS8JsevV.js +481 -0
- package/dist/delivery-queue-CTaYZQ_8.js +244 -0
- package/dist/delivery-queue-DMZ7mH8P.js +244 -0
- package/dist/devices-cli-BBJ4His-.js +319 -0
- package/dist/devices-cli-DHSJSFW1.js +323 -0
- package/dist/diagnostics-BSvCaLNs.js +35 -0
- package/dist/diagnostics-mWFAsFeo.js +35 -0
- package/dist/directory-cli-C-oHD_XE.js +224 -0
- package/dist/directory-cli-Cw99VGvr.js +220 -0
- package/dist/dispatcher-C8d1NNLZ.js +174 -0
- package/dist/dispatcher-DY6Ga60j.js +173 -0
- package/dist/dm-policy-shared-CRQ-Wr5g.js +22 -0
- package/dist/dm-policy-shared-CXXf2ltd.js +22 -0
- package/dist/dns-cli-BOqx9qo1.js +199 -0
- package/dist/dns-cli-WfqSC3JU.js +203 -0
- package/dist/dock-Big-J2VN.js +929 -0
- package/dist/dock-Cj4PKiUh.js +928 -0
- package/dist/doctor-completion-B9RsNJKh.js +92 -0
- package/dist/doctor-completion-DhNvADTs.js +92 -0
- package/dist/doctor-config-flow-BUuADMDa.js +1935 -0
- package/dist/doctor-config-flow-yOUpQC2B.js +1934 -0
- package/dist/enable-DC9V0nTO.js +59 -0
- package/dist/enable-DzXMQJ-o.js +59 -0
- package/dist/entry.js +1 -1
- package/dist/env-B3zr72vQ.js +60 -0
- package/dist/env-vars-CD2_baIP.js +43 -0
- package/dist/env-vars-a7S70ba7.js +43 -0
- package/dist/errors-Cr_NbOb4.js +35 -0
- package/dist/exec-D_s-zAtY.js +164 -0
- package/dist/exec-Zz6eJ6YU.js +164 -0
- package/dist/extensionAPI.js +134 -6
- package/dist/fetch-D3F-AEFK.js +67 -0
- package/dist/fetch-DTR2MlOk.js +67 -0
- package/dist/file-lock-C_KRlR7M.js +107 -0
- package/dist/fs-safe-DZHpH7TI.js +98 -0
- package/dist/fs-safe-vm3JMUkq.js +88 -0
- package/dist/gateway-cli-CebjflhZ.js +24337 -0
- package/dist/gateway-cli-Y9U6rbPB.js +24333 -0
- package/dist/gateway-rpc-BCFkQPa2.js +28 -0
- package/dist/gateway-rpc-DOgYbsOG.js +28 -0
- package/dist/gmail-setup-utils-DMeA1UM1.js +423 -0
- package/dist/gmail-setup-utils-FHWSAur3.js +422 -0
- package/dist/health-CXWQZGNz.js +1414 -0
- package/dist/health-DCC6hoLO.js +1417 -0
- package/dist/heartbeat-visibility-Cv0ejWJ-.js +125 -0
- package/dist/heartbeat-visibility-Da3TDQp2.js +125 -0
- package/dist/helpers-D-r6yhnI.js +10 -0
- package/dist/hook-runner-global-C0DFQmQw.js +527 -0
- package/dist/hooks-cli-CB5rKhHe.js +1221 -0
- package/dist/hooks-cli-Dy7m9hzM.js +1225 -0
- package/dist/host-env-security-BGibnCbS.js +106 -0
- package/dist/host-env-security-axRnIi8d.js +106 -0
- package/dist/image-ops-B9ofmzSq.js +354 -0
- package/dist/image-ops-CMuvRsMY.js +354 -0
- package/dist/import-BH13F5mT.js +606 -0
- package/dist/import-D8HVcDqO.js +604 -0
- package/dist/inbound-context-BLy-G2Eq.js +68 -0
- package/dist/index.js +99 -97
- package/dist/inspect-nW8LAukU.js +286 -0
- package/dist/inspect-xy2EHy8G.js +286 -0
- package/dist/installs-CpfHmKY1.js +325 -0
- package/dist/installs-DebiMrGj.js +325 -0
- package/dist/ipv4-zc_Hfvbp.js +46 -0
- package/dist/ir-CaxTklDC.js +940 -0
- package/dist/lifecycle-core-Z5SScMlU.js +476 -0
- package/dist/lifecycle-core-pPwYSt7m.js +474 -0
- package/dist/loader-BVHaRcP7.js +22404 -0
- package/dist/loader-CxSGgugQ.js +22401 -0
- package/dist/local-roots-CrJ_Jv_G.js +314 -0
- package/dist/local-roots-n_Y4iYwb.js +313 -0
- package/dist/logger-B8yHnzPl.js +49 -0
- package/dist/logging-BiuZwq5D.js +1 -0
- package/dist/logging-JZEg5nDp.js +1 -0
- package/dist/login-C99fsB0N.js +61 -0
- package/dist/login-cLvGPjeO.js +62 -0
- package/dist/login-qr-CGqRFwgl.js +329 -0
- package/dist/login-qr-dnY5DC2C.js +325 -0
- package/dist/logs-cli-Bda7xY4N.js +236 -0
- package/dist/logs-cli-HzR-vnpD.js +240 -0
- package/dist/markdown-tables-58Hq__7K.js +29 -0
- package/dist/markdown-tables-GFEX0OR6.js +29 -0
- package/dist/media-CFsyXs3H.js +940 -0
- package/dist/media-D1lGkC1V.js +10452 -0
- package/dist/message-action-names-BgsKGLDS.js +2521 -0
- package/dist/message-action-names-DkZwEFhU.js +2521 -0
- package/dist/message-channel-FMNRI5Ax.js +91 -0
- package/dist/message-channel-tuc9CdEw.js +91 -0
- package/dist/net-BEFkF-nI.js +225 -0
- package/dist/net-CNsUGiSw.js +225 -0
- package/dist/node-cli-Bu-InsO9.js +1462 -0
- package/dist/node-cli-DE7Pm7Fr.js +1458 -0
- package/dist/node-service-CumFZc9L.js +67 -0
- package/dist/node-service-DY1gG06I.js +67 -0
- package/dist/nodes-cli-B5aAExN0.js +1350 -0
- package/dist/nodes-cli-eKRqlKuO.js +1346 -0
- package/dist/nodes-screen-B3Sij1uT.js +250 -0
- package/dist/note-CPFJCWJJ.js +92 -0
- package/dist/note-DHUJACHE.js +92 -0
- package/dist/npm-registry-spec-BgMtTHvq.js +786 -0
- package/dist/npm-registry-spec-Dz3z1Zpd.js +786 -0
- package/dist/npm-resolution-BXiQH99t.js +86 -0
- package/dist/npm-resolution-CqE0nhxJ.js +86 -0
- package/dist/onboard-DK2z3w1P.js +649 -0
- package/dist/onboard-auth-C_wHkop1.js +207 -0
- package/dist/onboard-auth-CkCBLvTg.js +211 -0
- package/dist/onboard-channels-C8_OLbPk.js +2547 -0
- package/dist/onboard-channels-w_tnOhVu.js +2548 -0
- package/dist/onboard-helpers-Q7M6vdzh.js +363 -0
- package/dist/onboard-helpers-SCO3k5Y8.js +364 -0
- package/dist/onboard-remote-Co2hv1AD.js +127 -0
- package/dist/onboard-remote-Dl3BFSg2.js +127 -0
- package/dist/onboard-rioH3DW6.js +647 -0
- package/dist/onboarding-CsXVuzFP.js +586 -0
- package/dist/onboarding-r5RCkc-Z.js +588 -0
- package/dist/onboarding.finalize-BY8uN1nD.js +402 -0
- package/dist/onboarding.finalize-C-kfj-aR.js +404 -0
- package/dist/onboarding.gateway-config-BL0Q7Wpg.js +201 -0
- package/dist/onboarding.gateway-config-D2QsXMYO.js +195 -0
- package/dist/outbound-CcaPcetn.js +220 -0
- package/dist/outbound-CeiW8z3a.js +221 -0
- package/dist/outbound-attachment-Bfm5-JYe.js +18 -0
- package/dist/outbound-attachment-CZ7zoYxB.js +18 -0
- package/dist/outbound-attachment-Cb6PYvAz.js +18 -0
- package/dist/pairing-cli-CgX79ujL.js +125 -0
- package/dist/pairing-cli-DvbbXFgC.js +129 -0
- package/dist/pairing-labels-3wDxaApH.js +9 -0
- package/dist/pairing-labels-DCbWnbWk.js +9 -0
- package/dist/pairing-store-CdY7iRS0.js +459 -0
- package/dist/pairing-store-DykkYpQ7.js +460 -0
- package/dist/path-env-Cqo5LZmw.js +89 -0
- package/dist/path-env-GTM4HXCN.js +89 -0
- package/dist/path-safety-CXKAVpMp.js +14 -0
- package/dist/path-safety-DGB91qBk.js +14 -0
- package/dist/plugin-auto-enable-C6FPGg_-.js +301 -0
- package/dist/plugin-auto-enable-L8eOc8iC.js +302 -0
- package/dist/plugin-registry-BTycBIix.js +33 -0
- package/dist/plugin-registry-CFty9Gym.js +33 -0
- package/dist/plugin-sdk/auth/env-injection.d.ts +8 -10
- package/dist/plugin-sdk/auth/index.d.ts +4 -2
- package/dist/plugin-sdk/auth/order.d.ts +8 -0
- package/dist/plugin-sdk/auth/profiles.d.ts +1 -0
- package/dist/plugin-sdk/auth/provider-auth.d.ts +0 -6
- package/dist/plugin-sdk/auth/types.d.ts +33 -1
- package/dist/plugin-sdk/auth/usage.d.ts +80 -0
- package/dist/plugin-sdk/auto-reply/reply/agent-runner-utils.d.ts +9 -29
- package/dist/plugin-sdk/auto-reply/reply/queue/types.d.ts +0 -2
- package/dist/plugin-sdk/auto-reply/status.d.ts +1 -3
- package/dist/plugin-sdk/channels/plugins/types.core.d.ts +1 -0
- package/dist/plugin-sdk/channels/voice-credentials.d.ts +26 -0
- package/dist/plugin-sdk/commands/onboard-types.d.ts +2 -1
- package/dist/plugin-sdk/config/sessions/types.d.ts +0 -2
- package/dist/plugin-sdk/config/types.remoteclaw.d.ts +2 -2
- package/dist/plugin-sdk/config/zod-schema.d.ts +1 -1
- package/dist/plugin-sdk/gateway/protocol/index.d.ts +1 -1
- package/dist/plugin-sdk/gateway/server/ws-types.d.ts +2 -0
- package/dist/plugin-sdk/index.js +486 -9
- package/dist/plugin-sdk/infra/agent-events.d.ts +1 -1
- package/dist/plugin-sdk/media-understanding/defaults.d.ts +1 -2
- package/dist/plugin-sdk/media-understanding/providers/deepgram/audio.d.ts +1 -4
- package/dist/plugin-sdk/media-understanding/providers/google/audio.d.ts +1 -3
- package/dist/plugin-sdk/media-understanding/providers/openai/audio.d.ts +1 -3
- package/dist/plugin-sdk/media-understanding/types.d.ts +3 -18
- package/dist/plugin-sdk/middleware/media-capability.d.ts +21 -0
- package/dist/plugin-sdk/middleware/runtimes/claude.d.ts +4 -0
- package/dist/plugin-sdk/middleware/runtimes/codex.d.ts +5 -0
- package/dist/plugin-sdk/middleware/runtimes/gemini.d.ts +4 -0
- package/dist/plugin-sdk/middleware/runtimes/opencode.d.ts +5 -0
- package/dist/plugin-sdk/middleware/types.d.ts +10 -2
- package/dist/plugin-sdk/plugin-sdk/index.d.ts +2 -0
- package/dist/plugin-sdk/stt/defaults.d.ts +2 -0
- package/dist/plugin-sdk/stt/preflight.d.ts +16 -0
- package/dist/plugin-sdk/stt/providers/deepgram/audio.d.ts +4 -0
- package/dist/plugin-sdk/stt/providers/deepgram/index.d.ts +2 -0
- package/dist/plugin-sdk/stt/providers/google/audio.d.ts +3 -0
- package/dist/plugin-sdk/stt/providers/google/index.d.ts +2 -0
- package/dist/plugin-sdk/stt/providers/groq/index.d.ts +2 -0
- package/dist/plugin-sdk/stt/providers/index.d.ts +4 -0
- package/dist/plugin-sdk/stt/providers/mistral/index.d.ts +2 -0
- package/dist/plugin-sdk/stt/providers/openai/audio.d.ts +3 -0
- package/dist/plugin-sdk/stt/providers/openai/index.d.ts +2 -0
- package/dist/plugin-sdk/stt/providers/shared.d.ts +1 -0
- package/dist/plugin-sdk/stt/stt.d.ts +27 -0
- package/dist/plugin-sdk/stt/types.d.ts +22 -0
- package/dist/plugin-sdk/tts/tts.d.ts +3 -3
- package/dist/plugins-7B167wIj.js +453 -0
- package/dist/plugins-BRHOfy1Z.js +455 -0
- package/dist/plugins-cli-CQGW40I-.js +797 -0
- package/dist/plugins-cli-D-ZfWRTw.js +801 -0
- package/dist/ports-BS8kQkd9.js +96 -0
- package/dist/ports-CAqyeQYZ.js +316 -0
- package/dist/ports-CTUgXF2d.js +96 -0
- package/dist/ports-DqfnVnCw.js +370 -0
- package/dist/preflight-CJqKHCYa.js +64 -0
- package/dist/preflight-TR92sc61.js +68 -0
- package/dist/program-_SGrjcuG.js +248 -0
- package/dist/program-context-B6yIPfYd.js +474 -0
- package/dist/progress-BOdRbOHD.js +124 -0
- package/dist/prompt-select-styled-BiBnOTh8.js +1669 -0
- package/dist/prompt-select-styled-DQacku67.js +1672 -0
- package/dist/provider-dispatcher-BjsUFEpi.js +659 -0
- package/dist/provider-dispatcher-BxNDRVIT.js +660 -0
- package/dist/push-apns-Cj0Ryn18.js +713 -0
- package/dist/push-apns-fFfYCqda.js +711 -0
- package/dist/pw-ai-CnN2sITD.js +1908 -0
- package/dist/pw-ai-fnX3cecw.js +1911 -0
- package/dist/qr-cli-CriPg41m.js +349 -0
- package/dist/qr-cli-DSURqD0D.js +353 -0
- package/dist/redact-snapshot-BecRL_h6.js +2016 -0
- package/dist/redact-snapshot-pTdzSrex.js +2016 -0
- package/dist/register.agent-Bpwvc5By.js +1018 -0
- package/dist/register.agent-DQFcnOVQ.js +290 -0
- package/dist/register.configure-C5CK8tgd.js +133 -0
- package/dist/register.configure-CEJ5Wrkl.js +128 -0
- package/dist/register.import-CPQqqdje.js +31 -0
- package/dist/register.import-D1UaH1QV.js +29 -0
- package/dist/register.maintenance-Bpz-NOhG.js +499 -0
- package/dist/register.maintenance-DDwlfAfw.js +501 -0
- package/dist/register.message-BoNswT8e.js +685 -0
- package/dist/register.message-pvz70g_-.js +689 -0
- package/dist/register.onboard-BvcVLNp3.js +93 -0
- package/dist/register.onboard-CZV7LvZI.js +97 -0
- package/dist/register.setup-Cgv2uSPG.js +117 -0
- package/dist/register.setup-yTqvTinY.js +113 -0
- package/dist/register.status-health-sessions-LK50hWDT.js +428 -0
- package/dist/register.status-health-sessions-kDGDihye.js +668 -0
- package/dist/register.subclis-DSr7AHAr.js +267 -0
- package/dist/replies-IpiCq1Ht.js +136 -0
- package/dist/replies-LSx_XhsP.js +136 -0
- package/dist/reply-B8It91bP.js +13652 -0
- package/dist/reply-CbgHVTv2.js +13649 -0
- package/dist/reply-directives-Cz7622Qx.js +182 -0
- package/dist/reply-directives-ssnaPNiU.js +182 -0
- package/dist/reply-payloads-CQMtrphw.js +527 -0
- package/dist/reply-prefix-CWcAZKhE.js +37 -0
- package/dist/reply-prefix-Drq7Pf3A.js +37 -0
- package/dist/resolve-route-B8uIc2H3.js +249 -0
- package/dist/resolve-route-C8ooNlI4.js +249 -0
- package/dist/response-prefix-template-D3ZcJP4E.js +134 -0
- package/dist/response-prefix-template-DPOggmPO.js +134 -0
- package/dist/retry-BMUvSHT-.js +77 -0
- package/dist/run-main-BP3UHEJa.js +306 -0
- package/dist/runner-CD3YycXx.js +2365 -0
- package/dist/runner-D74Wiza_.js +2365 -0
- package/dist/runtime-guard-CK80eucm.js +60 -0
- package/dist/runtime-status-BhW7hP_U.js +12 -0
- package/dist/runtime-status-hFVEC3wO.js +12 -0
- package/dist/secure-random-D2tEcday.js +44 -0
- package/dist/security-cli-05blEYyC.js +482 -0
- package/dist/security-cli-DYbt8duB.js +487 -0
- package/dist/send-7O3-bRtl.js +547 -0
- package/dist/send-9Huf62k3.js +2245 -0
- package/dist/send-B9mIJdUo.js +547 -0
- package/dist/send-BCmOXR0I.js +332 -0
- package/dist/send-Bj0RXr-a.js +492 -0
- package/dist/send-C8PAzF8N.js +374 -0
- package/dist/send-Ce_BDa8P.js +349 -0
- package/dist/send-ChvasRSh.js +1779 -0
- package/dist/send-D1wtSq0W.js +426 -0
- package/dist/send-D6B4ThQi.js +1178 -0
- package/dist/send-DK0iMztU.js +11 -0
- package/dist/send-DWf7BCPe.js +492 -0
- package/dist/send-Dd2_MykI.js +2245 -0
- package/dist/send-IJaUAa8H.js +1776 -0
- package/dist/send-vDj76us_.js +29 -0
- package/dist/send-vvZXksNU.js +349 -0
- package/dist/server-BrzR9JmX.js +206 -0
- package/dist/server-_h27-uP_.js +202 -0
- package/dist/server-lifecycle-CUdA6Far.js +2437 -0
- package/dist/server-lifecycle-DQZWL8iP.js +2437 -0
- package/dist/server-node-events-DSefRBGC.js +394 -0
- package/dist/server-node-events-jDiG1-M2.js +390 -0
- package/dist/service-9le8AnC-.js +670 -0
- package/dist/service-Drb0kx6I.js +670 -0
- package/dist/session-BIAOl5QR.js +170 -0
- package/dist/session-Wu00pCn_.js +170 -0
- package/dist/session-cost-usage-7plmOKbs.js +627 -0
- package/dist/session-cost-usage-CPFxBFUg.js +627 -0
- package/dist/session-dirs-CfIrIJxG.js +318 -0
- package/dist/session-dirs-DlPpWt5Q.js +318 -0
- package/dist/session-utils-Sd9w4vc1.js +622 -0
- package/dist/session-utils-iL47hYmZ.js +622 -0
- package/dist/sessions-6pKQ3gN3.js +247 -0
- package/dist/sessions-ZRmCDdj1.js +2569 -0
- package/dist/shell-env-DBS5su07.js +163 -0
- package/dist/shell-env-DYZq9PqC.js +163 -0
- package/dist/ssrf-DJW14Wkh.js +183 -0
- package/dist/status-BGM-EJGk.js +1983 -0
- package/dist/status-CGkrO9om.js +1979 -0
- package/dist/status.update-DlBReI5-.js +449 -0
- package/dist/status.update-v7fEQ7R9.js +449 -0
- package/dist/store-DCrrxHyS.js +2571 -0
- package/dist/store-DJruTRE0.js +53 -0
- package/dist/store-Ql6vAcsg.js +64 -0
- package/dist/subagent-registry-BGknZEUI.js +4856 -0
- package/dist/subagent-registry-CWeRBjfn.js +4854 -0
- package/dist/subsystem-PQ64_nsu.js +1136 -0
- package/dist/subsystem-SgROXN1v.js +1079 -0
- package/dist/system-cli-CmO-4Rju.js +77 -0
- package/dist/system-cli-VBsa18K6.js +73 -0
- package/dist/systemd-CqFpK30Y.js +547 -0
- package/dist/systemd-fK9AV5bP.js +547 -0
- package/dist/systemd-hints-D3rr0j14.js +278 -0
- package/dist/systemd-hints-DNOSRaqA.js +278 -0
- package/dist/systemd-linger-B907NVVy.js +75 -0
- package/dist/systemd-linger-wYksBbM7.js +75 -0
- package/dist/table-C-dba-5-.js +279 -0
- package/dist/tables-BkvsWHrd.js +55 -0
- package/dist/tables-CO_kxD0e.js +55 -0
- package/dist/tables-WZp8Vt9n.js +55 -0
- package/dist/tailnet-D0NV0tRJ.js +40 -0
- package/dist/tailscale-B__xvMjA.js +230 -0
- package/dist/tailscale-q_ZrxUCc.js +230 -0
- package/dist/targets-B4rMyQFJ.js +53 -0
- package/dist/targets-BjWhDMJM.js +650 -0
- package/dist/targets-BlEVuFSt.js +2474 -0
- package/dist/targets-C99szk_e.js +114 -0
- package/dist/targets-CHwGDIgO.js +650 -0
- package/dist/targets-CbbmgMRV.js +2473 -0
- package/dist/targets-mqj9GNg1.js +53 -0
- package/dist/targets-n59Dqqrd.js +220 -0
- package/dist/tool-display-CQTRHo3Z.js +785 -0
- package/dist/tool-images-BYY11Gw3.js +263 -0
- package/dist/tool-images-CnJ0R8Fo.js +263 -0
- package/dist/trash-C0mjnHuW.js +125 -0
- package/dist/trash-Cgwc9mLD.js +125 -0
- package/dist/tui-9cJnR1dN.js +3282 -0
- package/dist/tui-BR3egaFJ.js +3282 -0
- package/dist/tui-cli-BYpkhE6J.js +66 -0
- package/dist/tui-cli-DndeZyup.js +62 -0
- package/dist/update-BJVdkzk7.js +349 -0
- package/dist/update-DjI6KTA5.js +349 -0
- package/dist/update-cli-DR-zFdCm.js +1146 -0
- package/dist/update-cli-EuHV_AUf.js +1148 -0
- package/dist/usage-XL1nuDSi.js +5350 -0
- package/dist/version-3QUZW8EP.js +52 -0
- package/dist/version-CVMnqdzu.js +52 -0
- package/dist/voice-credentials-CXdoE4IF.js +45 -0
- package/dist/voice-credentials-Cu7htUQq.js +45 -0
- package/dist/web-6JMDbfAs.js +3087 -0
- package/dist/web-BfSXKISl.js +74 -0
- package/dist/web-Cngqu3vs.js +79 -0
- package/dist/webhooks-cli-0yQha2yj.js +334 -0
- package/dist/webhooks-cli-ula0bTX-.js +330 -0
- package/dist/whatsapp-actions-3NdzsNg1.js +130 -0
- package/dist/whatsapp-actions-y_1vjkYY.js +125 -0
- package/dist/workspace-BT3X-qCZ.js +449 -0
- package/dist/workspace-D5hHXubL.js +447 -0
- package/dist/zod-schema-CbqZAIYy.js +2696 -0
- package/dist/zod-schema-YGQJEcnj.js +2696 -0
- package/extensions/voice-call/index.ts +18 -1
- package/package.json +1 -2
- package/dist/accounts-A8jZK_v9.js +0 -272
- package/dist/accounts-BegPt5VR.js +0 -36
- package/dist/accounts-BfkQt03j.js +0 -32
- package/dist/accounts-BmiimLpP.js +0 -47
- package/dist/accounts-Bpk-loA6.js +0 -47
- package/dist/accounts-DAdUdbPk.js +0 -36
- package/dist/accounts-WYyfAiie.js +0 -270
- package/dist/ack-reactions-2U-g6JhT.js +0 -446
- package/dist/ack-reactions-D9o-ExBe.js +0 -446
- package/dist/acp-cli-F4vt2pow.js +0 -1323
- package/dist/acp-cli-w9cL4Ai1.js +0 -1317
- package/dist/active-listener--FT8ewxl.js +0 -37
- package/dist/active-listener-C1StcdIA.js +0 -37
- package/dist/agent-B7RPXHcc.js +0 -703
- package/dist/agent-helpers-KHUla1K7.js +0 -400
- package/dist/agent-qJBFKJLb.js +0 -704
- package/dist/agent-scope-BrDeaWWf.js +0 -116
- package/dist/agents-ByTeqUNx.js +0 -760
- package/dist/agents.config-CWAUoPzG.js +0 -116
- package/dist/agents.config-Ck45E_ce.js +0 -116
- package/dist/ansi-aRwLYlzD.js +0 -14
- package/dist/audio-B85HoT7E.js +0 -43
- package/dist/audio-preflight-B00cMNkB.js +0 -64
- package/dist/audio-preflight-c8dy4yc6.js +0 -69
- package/dist/audit-BKooX7Db.js +0 -3149
- package/dist/audit-BczhAQIL.js +0 -3149
- package/dist/auth-BaZdVHyR.js +0 -181
- package/dist/auth-Bq44qPUd.js +0 -448
- package/dist/auth-Dsj6dgDR.js +0 -180
- package/dist/auth-VItd2pwK.js +0 -448
- package/dist/banner-D1JVFhcZ.js +0 -294
- package/dist/binaries-DbgLoSWv.js +0 -13
- package/dist/bindings-6KojDoIi.js +0 -69
- package/dist/bindings-B6icMMUx.js +0 -69
- package/dist/bonjour-discovery-CQU4QbLK.js +0 -378
- package/dist/bonjour-discovery-D8aOnk3M.js +0 -378
- package/dist/browser-cli-BEbv591D.js +0 -1688
- package/dist/browser-cli-CozqR6kA.js +0 -1693
- package/dist/call--MNL1K_z.js +0 -2827
- package/dist/call-C-aaBVbn.js +0 -2826
- package/dist/catalog-BwV9z6xK.js +0 -185
- package/dist/catalog-CYLss4WS.js +0 -185
- package/dist/channel-account-context-CA2m93Kt.js +0 -550
- package/dist/channel-account-context-Las-t6RP.js +0 -550
- package/dist/channel-activity-BD603ehL.js +0 -94
- package/dist/channel-activity-BZtWpdKA.js +0 -292
- package/dist/channel-activity-CwiF_QMr.js +0 -94
- package/dist/channel-options-CemsyPrT.js +0 -32
- package/dist/channel-options-DqEUtYlo.js +0 -33
- package/dist/channel-selection-CHJ7TumC.js +0 -51
- package/dist/channel-selection-DR7eW8UG.js +0 -51
- package/dist/channel-web-BzBWMRCc.js +0 -2134
- package/dist/channel-web-C9G1MI3B.js +0 -2136
- package/dist/channels-cli-4h71ZHAk.js +0 -1422
- package/dist/channels-cli-D0eCYyIX.js +0 -1427
- package/dist/channels-status-issues-By77REbh.js +0 -18
- package/dist/channels-status-issues-DXyOO-KH.js +0 -18
- package/dist/chat-envelope-BEDutlnF.js +0 -248
- package/dist/chrome-BUn8Xn-B.js +0 -1733
- package/dist/chrome-CTVsKMmV.js +0 -1732
- package/dist/chunk-C1mQSjas.js +0 -341
- package/dist/chunk-D7VX4pmT.js +0 -341
- package/dist/clack-prompter-BX8SVxtP.js +0 -122
- package/dist/clack-prompter-D6HhVlZW.js +0 -121
- package/dist/cli-CN-rchhR.js +0 -126
- package/dist/cli-DqlVvy-X.js +0 -131
- package/dist/clipboard-Cbj3McM_.js +0 -31
- package/dist/clipboard-Ne8gaWea.js +0 -31
- package/dist/command-format-KkslAzwV.js +0 -18
- package/dist/command-registry-w5Cmnzwo.js +0 -215
- package/dist/commands-DChC3pIF.js +0 -41
- package/dist/commands-DFHMoQgH.js +0 -41
- package/dist/commands-registry-BN04GIlJ.js +0 -891
- package/dist/commands-registry-DbS9NHeX.js +0 -892
- package/dist/common-DHHHAcmR.js +0 -156
- package/dist/common-De-Lakuh.js +0 -156
- package/dist/completion-cli-DfYD2uZ5.js +0 -452
- package/dist/completion-cli-x7-_Ec6e.js +0 -452
- package/dist/config-BHFQOi60.js +0 -4224
- package/dist/config-FkoMu3at.js +0 -4222
- package/dist/config-cli-RLo3m9wM.js +0 -242
- package/dist/config-cli-nbVrO9DC.js +0 -247
- package/dist/config-guard-BSagBBKb.js +0 -98
- package/dist/config-guard-CVKuaEtm.js +0 -75
- package/dist/config-validation-C8R9jhxQ.js +0 -18
- package/dist/config-validation-DdBbo9D4.js +0 -18
- package/dist/configure-BOJHL4N5.js +0 -889
- package/dist/configure-DftgC8xF.js +0 -891
- package/dist/constants-BbAEYzFC.js +0 -70
- package/dist/constants-tLOgmZZ1.js +0 -70
- package/dist/control-auth-D5Ur1QJj.js +0 -397
- package/dist/control-auth-ee80zTNm.js +0 -397
- package/dist/control-ui/assets/index-CuY3pfh1.js +0 -7716
- package/dist/control-ui/assets/index-CuY3pfh1.js.map +0 -1
- package/dist/control-ui/assets/index-D_fjkN3g.css +0 -1
- package/dist/control-ui-assets-BlpSXjlT.js +0 -186
- package/dist/control-ui-assets-eJU2-yvs.js +0 -186
- package/dist/conversation-label-L0QTtKji.js +0 -36
- package/dist/cron-cli-3ZC2e7IT.js +0 -491
- package/dist/cron-cli-CF_7oYyt.js +0 -496
- package/dist/daemon-cli-DRrHcLEV.js +0 -1197
- package/dist/daemon-cli-DZcQevdm.js +0 -1199
- package/dist/daemon-install-BMEnzWwq.js +0 -60
- package/dist/daemon-install-BkUJbdPC.js +0 -55
- package/dist/daemon-install-helpers-B9kMxC1v.js +0 -462
- package/dist/daemon-install-helpers-DoYR5z4H.js +0 -462
- package/dist/deliver-9KNUeX06.js +0 -481
- package/dist/deliver-Bjd2noi_.js +0 -481
- package/dist/delivery-queue-B6TuHppj.js +0 -244
- package/dist/delivery-queue-BZc3AiGu.js +0 -244
- package/dist/devices-cli-BvNP7WLV.js +0 -322
- package/dist/devices-cli-NCgS0TLp.js +0 -317
- package/dist/diagnostics-CK2HGAFw.js +0 -46
- package/dist/diagnostics-G-C-IuxO.js +0 -46
- package/dist/directory-cli-BXbW67Fc.js +0 -218
- package/dist/directory-cli-G575nH29.js +0 -223
- package/dist/dm-policy-shared-1FdjwGtJ.js +0 -22
- package/dist/dm-policy-shared-CT3er5HI.js +0 -22
- package/dist/dns-cli-CyAEakum.js +0 -203
- package/dist/dns-cli-qtjQuSHV.js +0 -198
- package/dist/dock-D038fZZl.js +0 -929
- package/dist/dock-D5pZ3a44.js +0 -928
- package/dist/doctor-completion-CQaQhu0A.js +0 -92
- package/dist/doctor-completion-a1rp4pJI.js +0 -92
- package/dist/doctor-config-flow-D8qHlRun.js +0 -1934
- package/dist/doctor-config-flow-DMZBktaQ.js +0 -1935
- package/dist/enable-B5dIjgnm.js +0 -59
- package/dist/enable-FmiEY4ng.js +0 -59
- package/dist/env-DUb5GiQe.js +0 -60
- package/dist/env-vars-C8WMB8Ix.js +0 -93
- package/dist/env-vars-CLGbxdpL.js +0 -93
- package/dist/errors-DdLfwEVi.js +0 -35
- package/dist/exec-BhkXWg7V.js +0 -164
- package/dist/exec-ClUTXFZ9.js +0 -164
- package/dist/fetch-Db2Lavvz.js +0 -67
- package/dist/fetch-JBWLkOpL.js +0 -67
- package/dist/file-lock-Ks-RPU6W.js +0 -107
- package/dist/fs-safe-93aDW4mH.js +0 -98
- package/dist/fs-safe-ACrBwOF5.js +0 -88
- package/dist/gateway-cli-BMaohs2K.js +0 -23725
- package/dist/gateway-cli-CbrfDwfG.js +0 -23720
- package/dist/gateway-rpc-CcVmSx6b.js +0 -28
- package/dist/gateway-rpc-CofFUQ0T.js +0 -28
- package/dist/gmail-setup-utils-DNZEf6T0.js +0 -422
- package/dist/gmail-setup-utils-KPAKWwGy.js +0 -423
- package/dist/health-CAWcnUBC.js +0 -1414
- package/dist/health-CccR94s_.js +0 -1417
- package/dist/heartbeat-visibility-SFx9Mzy6.js +0 -125
- package/dist/heartbeat-visibility-jM8oWt13.js +0 -125
- package/dist/helpers-ryxLx-aM.js +0 -10
- package/dist/hook-runner-global-CEtCxWOR.js +0 -527
- package/dist/hooks-cli-CF6ZtHj0.js +0 -1218
- package/dist/hooks-cli-a2fv4Q8E.js +0 -1223
- package/dist/host-env-security-Bms2_EMV.js +0 -92
- package/dist/host-env-security-CbiODGvQ.js +0 -92
- package/dist/image-ops-DMl7j7f4.js +0 -354
- package/dist/image-ops-DpkTOzhI.js +0 -354
- package/dist/import-DIjlFm_Y.js +0 -493
- package/dist/import-DdQvVR-_.js +0 -495
- package/dist/inbound-context-oxIWzEgc.js +0 -68
- package/dist/inspect-C9d1V-lI.js +0 -559
- package/dist/inspect-rHjRqr3W.js +0 -559
- package/dist/installs-CCIGK4yG.js +0 -325
- package/dist/installs-CSE9Mf7u.js +0 -325
- package/dist/ipv4-DdcyK1aU.js +0 -46
- package/dist/ir-CnMQRFBu.js +0 -940
- package/dist/loader-CIqcnGWW.js +0 -22404
- package/dist/loader-DpbdALFG.js +0 -22401
- package/dist/local-roots-B0QcJDJI.js +0 -313
- package/dist/local-roots-BfXsZRkm.js +0 -314
- package/dist/logger-BtwpYD7c.js +0 -49
- package/dist/login-C3dIiZza.js +0 -62
- package/dist/login-b1cNFM1b.js +0 -61
- package/dist/login-qr-CoRpPOig.js +0 -323
- package/dist/login-qr-DK6tD3RV.js +0 -328
- package/dist/logs-cli-CSf3Ki3J.js +0 -234
- package/dist/logs-cli-Dkm-VdVC.js +0 -239
- package/dist/markdown-tables-ChBqQA_Q.js +0 -29
- package/dist/markdown-tables-xMuH3QnS.js +0 -29
- package/dist/media-Bj6ej9bO.js +0 -10452
- package/dist/media-DYopaoc0.js +0 -940
- package/dist/message-action-names-B3YDuSRp.js +0 -2521
- package/dist/message-action-names-DeBgJnuU.js +0 -2521
- package/dist/message-channel-D72Bc6Tb.js +0 -91
- package/dist/message-channel-DF4I2vOK.js +0 -91
- package/dist/net-COL170MG.js +0 -225
- package/dist/net-QZ8IHNXc.js +0 -225
- package/dist/node-cli-CW8jOcHO.js +0 -24
- package/dist/node-cli-bNJbha3z.js +0 -24
- package/dist/nodes-cli-B4akCR2q.js +0 -1349
- package/dist/nodes-cli-C01CZunU.js +0 -1344
- package/dist/nodes-screen-C_K1vcS5.js +0 -250
- package/dist/note-BVerR3D5.js +0 -92
- package/dist/note-Dk8-EaJg.js +0 -92
- package/dist/npm-registry-spec-Dma0KHft.js +0 -786
- package/dist/npm-registry-spec-vYkxZb6u.js +0 -786
- package/dist/npm-resolution-CjffqFnL.js +0 -86
- package/dist/npm-resolution-CoOzt9ZS.js +0 -86
- package/dist/onboard--9pqIzlu.js +0 -438
- package/dist/onboard-CiiSroNQ.js +0 -436
- package/dist/onboard-channels-BopwB1DX.js +0 -2547
- package/dist/onboard-channels-CDZY4vCd.js +0 -2548
- package/dist/onboard-helpers-BgnTF_Zn.js +0 -364
- package/dist/onboard-helpers-BqfX8PCg.js +0 -363
- package/dist/onboard-remote-MZghbFVH.js +0 -127
- package/dist/onboard-remote-qfzZsPPa.js +0 -127
- package/dist/onboarding-BiIPsx1w.js +0 -586
- package/dist/onboarding-D9OmSO-b.js +0 -588
- package/dist/onboarding.finalize-Dkl-Gj41.js +0 -402
- package/dist/onboarding.finalize-HK-hiV2X.js +0 -399
- package/dist/onboarding.gateway-config-CfgfR1yf.js +0 -199
- package/dist/onboarding.gateway-config-DuafC0ll.js +0 -192
- package/dist/outbound-B27xJC-P.js +0 -220
- package/dist/outbound-DqHFOa43.js +0 -221
- package/dist/outbound-attachment-CFL83u89.js +0 -18
- package/dist/outbound-attachment-CbNLn0lk.js +0 -18
- package/dist/outbound-attachment-DNCMF74c.js +0 -18
- package/dist/pairing-cli-BPR0APxq.js +0 -128
- package/dist/pairing-cli-e4dVnP2I.js +0 -123
- package/dist/pairing-labels-6f8FqSS5.js +0 -9
- package/dist/pairing-labels-CI5j-OUT.js +0 -9
- package/dist/pairing-store-DnTHRcnO.js +0 -459
- package/dist/pairing-store-ONzqxcNb.js +0 -460
- package/dist/path-env-D7VB7sOO.js +0 -89
- package/dist/path-env-DFiYvvI-.js +0 -89
- package/dist/path-safety-BshBsw4P.js +0 -14
- package/dist/path-safety-CZbhQciI.js +0 -14
- package/dist/plugin-auto-enable-Bil0x27j.js +0 -301
- package/dist/plugin-auto-enable-CtoCE-tv.js +0 -302
- package/dist/plugin-registry-B5afYZNk.js +0 -33
- package/dist/plugin-registry-C_VT7RsD.js +0 -33
- package/dist/plugin-sdk/auth/session-override.d.ts +0 -17
- package/dist/plugin-sdk/auto-reply/reply/directive-handling.auth.d.ts +0 -18
- package/dist/plugin-sdk/media-understanding/audio-preflight.d.ts +0 -16
- package/dist/plugin-sdk/utils/mask-api-key.d.ts +0 -1
- package/dist/plugins-B4waLB_f.js +0 -453
- package/dist/plugins-D6-JJ1il.js +0 -455
- package/dist/plugins-cli-BU9Uj73D.js +0 -794
- package/dist/plugins-cli-D5PrJSER.js +0 -799
- package/dist/ports-BcTKFlWl.js +0 -96
- package/dist/ports-DAc2AlZE.js +0 -316
- package/dist/ports-HiuYk3bt.js +0 -96
- package/dist/ports-dEePqmCq.js +0 -370
- package/dist/program-context-eHL_5_CR.js +0 -474
- package/dist/program-rXCEzUHX.js +0 -245
- package/dist/progress-DQ1drugY.js +0 -124
- package/dist/prompt-select-styled-CWx5UmZB.js +0 -1647
- package/dist/prompt-select-styled-HUujlzf4.js +0 -1650
- package/dist/provider-dispatcher-8eBbQVp7.js +0 -660
- package/dist/provider-dispatcher-K1KDQQnI.js +0 -659
- package/dist/push-apns-DQwR-i4_.js +0 -713
- package/dist/push-apns-Dj5RApCY.js +0 -711
- package/dist/pw-ai-5FzqfpKa.js +0 -1907
- package/dist/pw-ai-Cp84EV6S.js +0 -1911
- package/dist/qr-cli--W6hPq6S.js +0 -348
- package/dist/qr-cli-Cn05y7js.js +0 -353
- package/dist/redact-snapshot-B-2V56Yb.js +0 -2016
- package/dist/redact-snapshot-CD36XSYE.js +0 -2016
- package/dist/register.agent-6MquUrXf.js +0 -287
- package/dist/register.agent-CE_xjz6s.js +0 -1016
- package/dist/register.configure-BS6wPd5o.js +0 -125
- package/dist/register.configure-DQgJt5gY.js +0 -131
- package/dist/register.import-Cku0T-PA.js +0 -31
- package/dist/register.import-Dr8TiUVx.js +0 -28
- package/dist/register.maintenance-5URlfA0l.js +0 -495
- package/dist/register.maintenance-DGiLCUQ3.js +0 -498
- package/dist/register.message-CXH0zpQK.js +0 -682
- package/dist/register.message-DdvCIrR-.js +0 -687
- package/dist/register.onboard-BMljJXYv.js +0 -258
- package/dist/register.onboard-C90zZFxj.js +0 -263
- package/dist/register.setup-B6WcVtcJ.js +0 -115
- package/dist/register.setup-CvGeUhIw.js +0 -110
- package/dist/register.status-health-sessions-BcEnXnz5.js +0 -424
- package/dist/register.status-health-sessions-Cn9kJvdJ.js +0 -665
- package/dist/register.subclis-Cbtoe55c.js +0 -267
- package/dist/replies-DQ-YWLcF.js +0 -136
- package/dist/replies-DpjSDP2e.js +0 -136
- package/dist/reply-BxPVpdMm.js +0 -13671
- package/dist/reply-CjmuOY4K.js +0 -13674
- package/dist/reply-directives-CdMull8t.js +0 -182
- package/dist/reply-directives-o2w1lx5i.js +0 -182
- package/dist/reply-payloads-CHLov7YA.js +0 -527
- package/dist/reply-prefix-Bv8Mv9q8.js +0 -37
- package/dist/reply-prefix-Rk_UEaJa.js +0 -37
- package/dist/resolve-route-BPa6q23t.js +0 -249
- package/dist/resolve-route-CN9BEALz.js +0 -249
- package/dist/response-prefix-template-D-ptXREi.js +0 -134
- package/dist/response-prefix-template-Dckjdftg.js +0 -134
- package/dist/retry-bFj4k6Ii.js +0 -77
- package/dist/run-main-B_bvTMRI.js +0 -303
- package/dist/runner-Bits2W0X.js +0 -2289
- package/dist/runner-CqSt9dr-.js +0 -2289
- package/dist/runtime-Ds3E9SqF.js +0 -94
- package/dist/runtime-guard-CXt4yzo-.js +0 -60
- package/dist/secure-random-DSXV40IT.js +0 -44
- package/dist/security-cli-7x9AJLqg.js +0 -479
- package/dist/security-cli-W22WJcRa.js +0 -485
- package/dist/send-36Ku6JxB.js +0 -349
- package/dist/send-B5z--EGa.js +0 -492
- package/dist/send-BvD5UDBM.js +0 -1174
- package/dist/send-CDQq7w1Q.js +0 -547
- package/dist/send-CVGQ5HZA.js +0 -11
- package/dist/send-D5QJNeTd.js +0 -2245
- package/dist/send-DEk9nwHa.js +0 -1776
- package/dist/send-DF3PfdS2.js +0 -1779
- package/dist/send-DIIprYhc.js +0 -426
- package/dist/send-DNHjRlpD.js +0 -492
- package/dist/send-DSaRjcGp.js +0 -349
- package/dist/send-De-1GOmB.js +0 -374
- package/dist/send-E3nqpgnh.js +0 -29
- package/dist/send-HOC4QVqi.js +0 -332
- package/dist/send-LkDMrPbX.js +0 -2245
- package/dist/send-N_YdCqXV.js +0 -547
- package/dist/server-DJlVtv_D.js +0 -206
- package/dist/server-DWkrZoAZ.js +0 -201
- package/dist/server-lifecycle-Bz6HiCez.js +0 -2437
- package/dist/server-lifecycle-DttcJJev.js +0 -2437
- package/dist/server-node-events-BQRRpM3x.js +0 -395
- package/dist/server-node-events-DoKnP6rn.js +0 -390
- package/dist/service-BDt-zUvV.js +0 -670
- package/dist/service-Os7W1F2S.js +0 -670
- package/dist/session-B9KGKVrY.js +0 -170
- package/dist/session-DzAupDyj.js +0 -170
- package/dist/session-cost-usage-BYCI739a.js +0 -627
- package/dist/session-cost-usage-DGsPcuMj.js +0 -627
- package/dist/session-dirs-BIg5RHAh.js +0 -947
- package/dist/session-dirs-DwDxjK1p.js +0 -947
- package/dist/session-utils-Cyoz7ePG.js +0 -622
- package/dist/session-utils-J646Rawe.js +0 -622
- package/dist/sessions-C93FiFt0.js +0 -247
- package/dist/sessions-Dg_jzdRp.js +0 -2569
- package/dist/shell-env-CsV_IkJj.js +0 -163
- package/dist/shell-env-hZW9j-Uc.js +0 -163
- package/dist/ssrf-D6fl_7ww.js +0 -183
- package/dist/status-B87ofvEO.js +0 -2061
- package/dist/status-ByFKEe-R.js +0 -2065
- package/dist/status.update-DbO7izip.js +0 -79
- package/dist/status.update-wXyvcztI.js +0 -79
- package/dist/store-B-EPotpS.js +0 -2571
- package/dist/store-BYhcsOLr.js +0 -64
- package/dist/store-fA9MTRYo.js +0 -53
- package/dist/subagent-registry-B7U-NNlx.js +0 -4856
- package/dist/subagent-registry-Dz8VLumu.js +0 -4854
- package/dist/subsystem-BgxIzx7w.js +0 -1137
- package/dist/subsystem-rxNDBm7l.js +0 -1079
- package/dist/system-cli-BKF3WdON.js +0 -76
- package/dist/system-cli-DfALoXuf.js +0 -71
- package/dist/systemd-BlbIQ1PV.js +0 -547
- package/dist/systemd-DzXePo7r.js +0 -547
- package/dist/systemd-linger-mLbBF4pa.js +0 -75
- package/dist/systemd-linger-qlGGW2JB.js +0 -75
- package/dist/table-V_9n7CjP.js +0 -279
- package/dist/tables-BzDIS4xA.js +0 -55
- package/dist/tables-Cy3gObW7.js +0 -55
- package/dist/tables-DAuk-Y6F.js +0 -55
- package/dist/tailnet-Cy0Q27lj.js +0 -40
- package/dist/tailscale-CiWkh0vS.js +0 -230
- package/dist/tailscale-Driw3j8E.js +0 -230
- package/dist/targets-B5bB2qrA.js +0 -2406
- package/dist/targets-B7z3A0S5.js +0 -220
- package/dist/targets-CY-kWh8P.js +0 -2407
- package/dist/targets-CsrqF2M4.js +0 -650
- package/dist/targets-D3WkRcT8.js +0 -120
- package/dist/targets-DKriCISG.js +0 -53
- package/dist/targets-DTM2OPnS.js +0 -650
- package/dist/targets-DhhaK2xG.js +0 -53
- package/dist/tool-display-D6GD-41Y.js +0 -785
- package/dist/tool-images-D16vIWPg.js +0 -263
- package/dist/tool-images-IVIZ29ID.js +0 -263
- package/dist/trash--8b4GDyV.js +0 -125
- package/dist/trash-ivbG2QWV.js +0 -125
- package/dist/tui-BA89nOty.js +0 -3319
- package/dist/tui-BEv1xUD1.js +0 -3319
- package/dist/tui-cli-BYYcEkWB.js +0 -59
- package/dist/tui-cli-CPU9l8Ec.js +0 -64
- package/dist/update-BlxEwqv4.js +0 -349
- package/dist/update-DS4IPhg-.js +0 -349
- package/dist/update-cli-B2Oqn_A3.js +0 -1371
- package/dist/update-cli-DuF0za7-.js +0 -1374
- package/dist/usage-hcozOn9n.js +0 -5295
- package/dist/web-BsJ13RJc.js +0 -77
- package/dist/web-D50_3bVn.js +0 -3071
- package/dist/web-DBVQrgt8.js +0 -71
- package/dist/webhooks-cli-BTRletKZ.js +0 -329
- package/dist/webhooks-cli-CVQqrkWi.js +0 -334
- package/dist/whatsapp-actions-DdrjMPWq.js +0 -129
- package/dist/whatsapp-actions-DgOKaH0j.js +0 -123
- package/dist/workspace-D30hawqJ.js +0 -447
- package/dist/workspace-D4irp1m2.js +0 -449
- package/dist/zod-schema-B9RGngMW.js +0 -2696
- package/dist/zod-schema-D3hQ5SKe.js +0 -2696
- /package/dist/{account-lookup-DGscKBsr.js → account-lookup-C0ndrpt-.js} +0 -0
- /package/dist/{agent-helpers-CK3Obbsi.js → agent-helpers-eEHy5uX2.js} +0 -0
- /package/dist/{agent-scope-DxqtYjuJ.js → agent-scope-CJW7vnF8.js} +0 -0
- /package/dist/{api-BDff51CS.js → api-Cd_7aESj.js} +0 -0
- /package/dist/{api-qWSMsT8m.js → api-DJ_oWYus.js} +0 -0
- /package/dist/{argv-neJY_Hxm.js → argv-BY8EVMTP.js} +0 -0
- /package/dist/{audio-BbCUzndz.js → audio-BIvUsncf.js} +0 -0
- /package/dist/{brew-CMSQ5Fek.js → brew-CmTYeZk1.js} +0 -0
- /package/dist/{brew-ByYl36Mt.js → brew-V4lMBeE3.js} +0 -0
- /package/dist/{chat-envelope-vJJUdDE7.js → chat-envelope-CrM0X4sl.js} +0 -0
- /package/dist/{chat-type-BKe459rw.js → chat-type-CH3W-zKy.js} +0 -0
- /package/dist/{cleanup-utils-DNd0wdKZ.js → cleanup-utils-CNwlTKyR.js} +0 -0
- /package/dist/{cleanup-utils-S_P5Jebv.js → cleanup-utils-gNzIs9yk.js} +0 -0
- /package/dist/{cli-name-Yv30OygA.js → cli-name-3MdfbvIR.js} +0 -0
- /package/dist/{cli-utils-C5nQDfa6.js → cli-utils-5ZIfXAfM.js} +0 -0
- /package/dist/{cli-utils-KcEwAsuZ.js → cli-utils-BUOtyfnU.js} +0 -0
- /package/dist/{client-C7B0uFB0.js → client-D5m46AuY.js} +0 -0
- /package/dist/{client-Cd2HNUX0.js → client-DFyI5I0n.js} +0 -0
- /package/dist/{command-options-1bi44p_B.js → command-options-Cn2fc1Of.js} +0 -0
- /package/dist/{command-options-7y5Zrv4M.js → command-options-D2nN4AXX.js} +0 -0
- /package/dist/{config-eval-CJtk3Msr.js → config-eval-BCKpAS_K.js} +0 -0
- /package/dist/{config-eval-DQIwdWg7.js → config-eval-CU2G7a83.js} +0 -0
- /package/dist/{constants--3PuQVaS.js → constants-CRGAZ2ow.js} +0 -0
- /package/dist/{constants-DNWjlxZ5.js → constants-DoYLsBmv.js} +0 -0
- /package/dist/{credentials-BhnauW0K.js → credentials-DMAWNZdV.js} +0 -0
- /package/dist/{credentials-eZcqWNG_.js → credentials-Dmc3H-jd.js} +0 -0
- /package/dist/{daemon-runtime-99xh1fGv.js → daemon-runtime-CzFI2dPw.js} +0 -0
- /package/dist/{daemon-runtime-BOcdJaFy.js → daemon-runtime-aQhinwSL.js} +0 -0
- /package/dist/{dangerous-name-matching-YeatnYIA.js → dangerous-name-matching-BCaPvXy_.js} +0 -0
- /package/dist/{dangerous-name-matching-oVb1EqYT.js → dangerous-name-matching-BlTBBZns.js} +0 -0
- /package/dist/{dangerous-tools-BMt8-6jE.js → dangerous-tools-BRmbBvRf.js} +0 -0
- /package/dist/{dangerous-tools-CripTfYv.js → dangerous-tools-E1i3IoxZ.js} +0 -0
- /package/dist/{fetch-CCuD0LYV.js → fetch-DRVdxxEj.js} +0 -0
- /package/dist/{fetch-timeout-Db3da8yR.js → fetch-timeout-DBRRPNBi.js} +0 -0
- /package/dist/{file-identity-Bs9zZOi2.js → file-identity-BnGA6wyc.js} +0 -0
- /package/dist/{format-duration-Bo-Mxi3E.js → format-duration-B-Uv5nOi.js} +0 -0
- /package/dist/{format-duration-CfrJ5T8k.js → format-duration-D1M3Zxu6.js} +0 -0
- /package/dist/{format-relative-8cNYQsqb.js → format-relative-Cywx6ldk.js} +0 -0
- /package/dist/{format-relative-CZOlQ2pA.js → format-relative-DcQZUAYl.js} +0 -0
- /package/dist/{health-format-WMRp1BbP.js → health-format-CL2Xq92A.js} +0 -0
- /package/dist/{health-format-DOhfU1rY.js → health-format-CVgQD-z9.js} +0 -0
- /package/dist/{heartbeat-wake-BtRrOB-t.js → heartbeat-wake-DLxQm6-U.js} +0 -0
- /package/dist/{heartbeat-wake-eRINROYK.js → heartbeat-wake-DjsTDzF3.js} +0 -0
- /package/dist/{help-format-BEb0SPHF.js → help-format-CJQ7APRn.js} +0 -0
- /package/dist/{help-format-Ch0EWh7N.js → help-format-DM6-OBt-.js} +0 -0
- /package/dist/{helpers-BJtPtu_2.js → helpers-BER76F_2.js} +0 -0
- /package/dist/{helpers-B4NWktS8.js → helpers-CRrn7Err.js} +0 -0
- /package/dist/{helpers-Cj6f8SPZ.js → helpers-DSMIGYx2.js} +0 -0
- /package/dist/{inbound-path-policy-DYTLjca8.js → inbound-path-policy-BurOAu44.js} +0 -0
- /package/dist/{input-provenance-CPhdY-0F.js → input-provenance-BgfeDgck.js} +0 -0
- /package/dist/{input-provenance-DUNEQoFM.js → input-provenance-xUsSMOsz.js} +0 -0
- /package/dist/{ip-BcdPcLiP.js → ip-BUhsZdJu.js} +0 -0
- /package/dist/{ipv4-OHvujh00.js → ipv4-ysiNGssl.js} +0 -0
- /package/dist/{is-main-KcWqINzy.js → is-main-BmHYGRhd.js} +0 -0
- /package/dist/{json-file-BVvmrQG3.js → json-file-B5WEJJye.js} +0 -0
- /package/dist/{json-files-DSKEdz7x.js → json-files-BFGbyEzL.js} +0 -0
- /package/dist/{json-files-BiA_B-xm.js → json-files-CfhnuGaC.js} +0 -0
- /package/dist/{lanes-Brd-nf-Z.js → lanes-4FoQemog.js} +0 -0
- /package/dist/{lanes-COs3zODW.js → lanes-BhdzrAIa.js} +0 -0
- /package/dist/{links-gse8sWn-.js → links-CwTlzaPe.js} +0 -0
- /package/dist/{links-CIHbVNO_.js → links-D5vtq30Q.js} +0 -0
- /package/dist/{location-D1FM_C63.js → location-50gaJF5Z.js} +0 -0
- /package/dist/{location-LuzkqHGi.js → location-Qo8Ii1zo.js} +0 -0
- /package/dist/{logger-BMP_j_Lx.js → logger-IA_Dr_BT.js} +0 -0
- /package/dist/{logger-DXCDb7qu.js → logger-O6JX52kK.js} +0 -0
- /package/dist/{logger-DWbwXLjl.js → logger-nEdVxm5D.js} +0 -0
- /package/dist/{logging-CAgCb3n3.js → logging-Bs1VqVFL.js} +0 -0
- /package/dist/{logging-CLc3Umm0.js → logging-FctZEleJ.js} +0 -0
- /package/dist/{mime-D4bQLMJL.js → mime-AuIDUZPG.js} +0 -0
- /package/dist/{mutable-allowlist-detectors-NtI6s4TE.js → mutable-allowlist-detectors-CtKavajp.js} +0 -0
- /package/dist/{mutable-allowlist-detectors-nAmo9v5u.js → mutable-allowlist-detectors-TCG6mnbz.js} +0 -0
- /package/dist/{nodes-screen-CZCXHrWB.js → nodes-screen-DEvpoFmH.js} +0 -0
- /package/dist/{onboard-config-CcPV3Cqz.js → onboard-config-BxfgUqk6.js} +0 -0
- /package/dist/{onboard-config-DcTaxmuf.js → onboard-config-DNzlo8Cg.js} +0 -0
- /package/dist/{parse-log-line-BY9Vz72K.js → parse-log-line-CT0H1-oQ.js} +0 -0
- /package/dist/{parse-log-line-BrrE4onI.js → parse-log-line-pij_xhtE.js} +0 -0
- /package/dist/{parse-timeout-CDkco8kd.js → parse-timeout-CvODy9RC.js} +0 -0
- /package/dist/{parse-timeout-Dfyln-4M.js → parse-timeout-CxYHsZWc.js} +0 -0
- /package/dist/{path-guards-D9LU0y9L.js → path-guards-DOpzcMXz.js} +0 -0
- /package/dist/{path-guards-crZaTVvq.js → path-guards-DipYoPVw.js} +0 -0
- /package/dist/{plugins-allowlist-CD4oIJNk.js → plugins-allowlist-Bcqe9Gd8.js} +0 -0
- /package/dist/{plugins-allowlist-CUhk3GDh.js → plugins-allowlist-ptAp-oPY.js} +0 -0
- /package/dist/{polls-ChvH1OIW.js → polls-DQrR-qT3.js} +0 -0
- /package/dist/{polls-Dn1C2d1-.js → polls-ybwcqkWt.js} +0 -0
- /package/dist/{ports-lsof-BDQWExpn.js → ports-lsof-CDyv5GJd.js} +0 -0
- /package/dist/{process-scoped-map-CBWcUvTa.js → process-scoped-map-_zxf_kLz.js} +0 -0
- /package/dist/{program-context-DtsEOsdM.js → program-context-CG-t6Yp-.js} +0 -0
- /package/dist/{progress-BjGCAXH7.js → progress-DRLmcFiG.js} +0 -0
- /package/dist/{prompt-FIISMuNm.js → prompt-BRGfic91.js} +0 -0
- /package/dist/{prompt-edYTUtju.js → prompt-WEkXwIMT.js} +0 -0
- /package/dist/{prompt-style-DL64_X-p.js → prompt-style-B1740PBl.js} +0 -0
- /package/dist/{prompt-style-CYEpbwXH.js → prompt-style-B4Cq4PyQ.js} +0 -0
- /package/dist/{provider-utils-FaBmofiq.js → provider-utils-C9kBVF1f.js} +0 -0
- /package/dist/{proxy-DUTF0OYE.js → proxy-BMJL0Qog.js} +0 -0
- /package/dist/{proxy-Dv0sbx6A.js → proxy-BdjLhNln.js} +0 -0
- /package/dist/{pw-ai-state-DKhOTqDv.js → pw-ai-state-CwXeO5d0.js} +0 -0
- /package/dist/{pw-ai-state-kkp06zyZ.js → pw-ai-state-DaISdsXY.js} +0 -0
- /package/dist/{redact-BTeK8lMZ.js → redact-CqWx9rpK.js} +0 -0
- /package/dist/{redact-identifier-F6t5pklx.js → redact-identifier-BJOQDEj0.js} +0 -0
- /package/dist/{redact-identifier-VdOrq-IK.js → redact-identifier-DR54qsoT.js} +0 -0
- /package/dist/{remoteclaw-root-rJHOCwzo.js → remoteclaw-root-CgNyrbxc.js} +0 -0
- /package/dist/{remoteclaw-root-DF8m3X4C.js → remoteclaw-root-u8dAeHID.js} +0 -0
- /package/dist/{render-e7fENCYH.js → render-CDCvpfhh.js} +0 -0
- /package/dist/{render-qcqmrHse.js → render-CJl4GK1B.js} +0 -0
- /package/dist/{retry-BcZuGfnV.js → retry-B19gMxS7.js} +0 -0
- /package/dist/{retry-CwZiwLDN.js → retry-cXXk2j6_.js} +0 -0
- /package/dist/{runtime-guard-CdJVmJc0.js → runtime-guard-BS55uiSW.js} +0 -0
- /package/dist/{secret-equal-CDUVxXmp.js → secret-equal-CJzes24Z.js} +0 -0
- /package/dist/{secret-equal-d3sEnK98.js → secret-equal-CQAmGfGc.js} +0 -0
- /package/dist/{secure-random-CJtykx_p.js → secure-random-B3f7Ri2X.js} +0 -0
- /package/dist/{secure-random-y6N6Gted.js → secure-random-BkZFG9cd.js} +0 -0
- /package/dist/{session-key-C2n-VILA.js → session-key-CgKWfjoZ.js} +0 -0
- /package/dist/{stagger-CjkdqPuN.js → stagger-B2ORDHsP.js} +0 -0
- /package/dist/{status-BFmH9Uge.js → status-C6YNwimj.js} +0 -0
- /package/dist/{status-BIupzBh9.js → status-yrDGXYZM.js} +0 -0
- /package/dist/{store-BLGrRL_E.js → store-B5989JkX.js} +0 -0
- /package/dist/{strip-inbound-meta-BNXRYvmY.js → strip-inbound-meta-0cvL6itU.js} +0 -0
- /package/dist/{strip-inbound-meta-BtNFmc6V.js → strip-inbound-meta-DjKcSFaW.js} +0 -0
- /package/dist/{table-Au5EeKD6.js → table-ByMyHTh_.js} +0 -0
- /package/dist/{tailnet-BoTa0e2q.js → tailnet-CfZhpSnt.js} +0 -0
- /package/dist/{target-errors-B6YON-5k.js → target-errors-DJVRKFcU.js} +0 -0
- /package/dist/{target-errors-sPHoHj73.js → target-errors-GZXDqlUu.js} +0 -0
- /package/dist/{targets-BtGRUQMa.js → targets-B_d_1z3N.js} +0 -0
- /package/dist/{targets-Ds5eT_RZ.js → targets-D01MJGnh.js} +0 -0
- /package/dist/{targets-DDdPVd12.js → targets-DOJXjN1U.js} +0 -0
- /package/dist/{targets-DtvPW-B8.js → targets-WSwPflb6.js} +0 -0
- /package/dist/{text-format-CFm4X8Ze.js → text-format-DarxU3JH.js} +0 -0
- /package/dist/{text-format-KHU3KzvQ.js → text-format-mr5bZq0f.js} +0 -0
- /package/dist/{thinking-XA5P_zFw.js → thinking-BqJmU6Zp.js} +0 -0
- /package/dist/{tokens-BGw4xHhW.js → tokens-C8yGxAcR.js} +0 -0
- /package/dist/{tokens-7ZtWRjA3.js → tokens-DAFBx5qr.js} +0 -0
- /package/dist/{tool-display-AxpSXZVq.js → tool-display-C0hpLmkw.js} +0 -0
- /package/dist/{usage-BEjWlD9A.js → usage-BXi79Rq6.js} +0 -0
- /package/dist/{usage-o8O_TxA-.js → usage-C1lHaofV.js} +0 -0
- /package/dist/{usage-format-Cx3JveFn.js → usage-format-CD5jsZY1.js} +0 -0
- /package/dist/{usage-format-D-ZaYT_e.js → usage-format-CRVpDVj1.js} +0 -0
- /package/dist/{widearea-dns-fHQt5-Q3.js → widearea-dns-C-0P7TRi.js} +0 -0
- /package/dist/{widearea-dns-DUDYT3z2.js → widearea-dns-DFZMcfLf.js} +0 -0
- /package/dist/{workspace-9__vtmnA.js → workspace-BJCKO8Ns.js} +0 -0
- /package/dist/{workspace-DkGLVfOl.js → workspace-BisvA9oA.js} +0 -0
- /package/dist/{wsl-BLrG__iS.js → wsl-D28w2jQC.js} +0 -0
- /package/dist/{wsl-C2dudsWt.js → wsl-kFaeW76c.js} +0 -0
|
@@ -0,0 +1,2547 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-Cbj13DAv.js";
|
|
2
|
+
import { $ as pathExists, D as listChatChannels, H as CONFIG_DIR, Q as normalizeE164, T as formatChannelSelectionLine, o as createSubsystemLogger, w as formatChannelPrimerLine } from "./entry.js";
|
|
3
|
+
import { h as normalizeAccountId, m as DEFAULT_ACCOUNT_ID } from "./session-key-BF-9YzxC.js";
|
|
4
|
+
import { c as resolveDefaultAgentId, o as resolveAgentWorkspaceDir } from "./agent-scope-CJW7vnF8.js";
|
|
5
|
+
import { C as resolveDiscordAccount, S as resolveDefaultDiscordAccountId, b as listDiscordAccountIds, d as resolveTelegramAccount, h as resolveSlackAccount, l as listTelegramAccountIds, m as resolveDefaultSlackAccountId, n as listChannelPlugins, p as listSlackAccountIds, t as getChannelPlugin, u as resolveDefaultTelegramAccountId } from "./plugins-7B167wIj.js";
|
|
6
|
+
import { a as resolveWhatsAppAuthDir, n as listWhatsAppAccountIds, r as resolveDefaultWhatsAppAccountId } from "./accounts-Aqbb2_Fn.js";
|
|
7
|
+
import { n as resolveDefaultIMessageAccountId, r as resolveIMessageAccount, t as listIMessageAccountIds } from "./accounts-D3fAPVzU.js";
|
|
8
|
+
import { i as resolveSignalAccount, n as listSignalAccountIds, r as resolveDefaultSignalAccountId } from "./accounts-DZmv4bXS.js";
|
|
9
|
+
import { t as formatCliCommand } from "./command-format-LFmgWzKJ.js";
|
|
10
|
+
import { l as normalizeDiscordSlug } from "./targets-CHwGDIgO.js";
|
|
11
|
+
import { d as resolveDiscordChannelAllowlist, r as resolveSlackChannelAllowlist, t as loadRemoteClawPlugins } from "./loader-CxSGgugQ.js";
|
|
12
|
+
import { t as runCommandWithTimeout } from "./exec-D_s-zAtY.js";
|
|
13
|
+
import { at as resolveSlackUserAllowlist, ot as resolveDiscordUserAllowlist } from "./reply-CbgHVTv2.js";
|
|
14
|
+
import { t as loginWeb } from "./login-C99fsB0N.js";
|
|
15
|
+
import { t as resolveBrewExecutable } from "./brew-V4lMBeE3.js";
|
|
16
|
+
import { t as formatDocsLink } from "./links-CwTlzaPe.js";
|
|
17
|
+
import { r as listChannelPluginCatalogEntries } from "./catalog-DTlcfTT9.js";
|
|
18
|
+
import { t as resolveChannelDefaultAccountId } from "./helpers-CRrn7Err.js";
|
|
19
|
+
import { n as isChannelConfigured } from "./plugin-auto-enable-C6FPGg_-.js";
|
|
20
|
+
import { t as enablePluginInConfig } from "./enable-DzXMQJ-o.js";
|
|
21
|
+
import { p as extractArchive } from "./npm-registry-spec-BgMtTHvq.js";
|
|
22
|
+
import { n as recordPluginInstall, r as installPluginFromNpmSpec, t as buildNpmResolutionInstallFields } from "./installs-DebiMrGj.js";
|
|
23
|
+
import { a as normalizeIMessageHandle } from "./send-Bj0RXr-a.js";
|
|
24
|
+
import { n as detectBinary } from "./onboard-helpers-Q7M6vdzh.js";
|
|
25
|
+
import { t as createPluginLoaderLogger } from "./logger-O6JX52kK.js";
|
|
26
|
+
import { t as fetchTelegramChatId } from "./api-Cd_7aESj.js";
|
|
27
|
+
import os from "node:os";
|
|
28
|
+
import path from "node:path";
|
|
29
|
+
import fs, { createWriteStream } from "node:fs";
|
|
30
|
+
import fsp from "node:fs/promises";
|
|
31
|
+
import { request } from "node:https";
|
|
32
|
+
import { pipeline } from "node:stream/promises";
|
|
33
|
+
|
|
34
|
+
//#region src/commands/onboarding/plugin-install.ts
|
|
35
|
+
function hasGitWorkspace(workspaceDir) {
|
|
36
|
+
const candidates = /* @__PURE__ */ new Set();
|
|
37
|
+
candidates.add(path.join(process.cwd(), ".git"));
|
|
38
|
+
if (workspaceDir && workspaceDir !== process.cwd()) candidates.add(path.join(workspaceDir, ".git"));
|
|
39
|
+
for (const candidate of candidates) if (fs.existsSync(candidate)) return true;
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
function resolveLocalPath(entry, workspaceDir, allowLocal) {
|
|
43
|
+
if (!allowLocal) return null;
|
|
44
|
+
const raw = entry.install.localPath?.trim();
|
|
45
|
+
if (!raw) return null;
|
|
46
|
+
const candidates = /* @__PURE__ */ new Set();
|
|
47
|
+
candidates.add(path.resolve(process.cwd(), raw));
|
|
48
|
+
if (workspaceDir && workspaceDir !== process.cwd()) candidates.add(path.resolve(workspaceDir, raw));
|
|
49
|
+
for (const candidate of candidates) if (fs.existsSync(candidate)) return candidate;
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
function addPluginLoadPath(cfg, pluginPath) {
|
|
53
|
+
const existing = cfg.plugins?.load?.paths ?? [];
|
|
54
|
+
const merged = Array.from(new Set([...existing, pluginPath]));
|
|
55
|
+
return {
|
|
56
|
+
...cfg,
|
|
57
|
+
plugins: {
|
|
58
|
+
...cfg.plugins,
|
|
59
|
+
load: {
|
|
60
|
+
...cfg.plugins?.load,
|
|
61
|
+
paths: merged
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
async function promptInstallChoice(params) {
|
|
67
|
+
const { entry, localPath, prompter, defaultChoice } = params;
|
|
68
|
+
const localOptions = localPath ? [{
|
|
69
|
+
value: "local",
|
|
70
|
+
label: "Use local plugin path",
|
|
71
|
+
hint: localPath
|
|
72
|
+
}] : [];
|
|
73
|
+
const options = [
|
|
74
|
+
{
|
|
75
|
+
value: "npm",
|
|
76
|
+
label: `Download from npm (${entry.install.npmSpec})`
|
|
77
|
+
},
|
|
78
|
+
...localOptions,
|
|
79
|
+
{
|
|
80
|
+
value: "skip",
|
|
81
|
+
label: "Skip for now"
|
|
82
|
+
}
|
|
83
|
+
];
|
|
84
|
+
const initialValue = defaultChoice === "local" && !localPath ? "npm" : defaultChoice;
|
|
85
|
+
return await prompter.select({
|
|
86
|
+
message: `Install ${entry.meta.label} plugin?`,
|
|
87
|
+
options,
|
|
88
|
+
initialValue
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function resolveInstallDefaultChoice(params) {
|
|
92
|
+
const { cfg, entry, localPath } = params;
|
|
93
|
+
const updateChannel = cfg.update?.channel;
|
|
94
|
+
if (updateChannel === "next") return localPath ? "local" : "npm";
|
|
95
|
+
if (updateChannel === "stable" || updateChannel === "beta") return "npm";
|
|
96
|
+
const entryDefault = entry.install.defaultChoice;
|
|
97
|
+
if (entryDefault === "local") return localPath ? "local" : "npm";
|
|
98
|
+
if (entryDefault === "npm") return "npm";
|
|
99
|
+
return localPath ? "local" : "npm";
|
|
100
|
+
}
|
|
101
|
+
async function ensureOnboardingPluginInstalled(params) {
|
|
102
|
+
const { entry, prompter, runtime, workspaceDir } = params;
|
|
103
|
+
let next = params.cfg;
|
|
104
|
+
const localPath = resolveLocalPath(entry, workspaceDir, hasGitWorkspace(workspaceDir));
|
|
105
|
+
const choice = await promptInstallChoice({
|
|
106
|
+
entry,
|
|
107
|
+
localPath,
|
|
108
|
+
defaultChoice: resolveInstallDefaultChoice({
|
|
109
|
+
cfg: next,
|
|
110
|
+
entry,
|
|
111
|
+
localPath
|
|
112
|
+
}),
|
|
113
|
+
prompter
|
|
114
|
+
});
|
|
115
|
+
if (choice === "skip") return {
|
|
116
|
+
cfg: next,
|
|
117
|
+
installed: false
|
|
118
|
+
};
|
|
119
|
+
if (choice === "local" && localPath) {
|
|
120
|
+
next = addPluginLoadPath(next, localPath);
|
|
121
|
+
next = enablePluginInConfig(next, entry.id).config;
|
|
122
|
+
return {
|
|
123
|
+
cfg: next,
|
|
124
|
+
installed: true
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
const result = await installPluginFromNpmSpec({
|
|
128
|
+
spec: entry.install.npmSpec,
|
|
129
|
+
logger: {
|
|
130
|
+
info: (msg) => runtime.log?.(msg),
|
|
131
|
+
warn: (msg) => runtime.log?.(msg)
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
if (result.ok) {
|
|
135
|
+
next = enablePluginInConfig(next, result.pluginId).config;
|
|
136
|
+
next = recordPluginInstall(next, {
|
|
137
|
+
pluginId: result.pluginId,
|
|
138
|
+
source: "npm",
|
|
139
|
+
spec: entry.install.npmSpec,
|
|
140
|
+
installPath: result.targetDir,
|
|
141
|
+
version: result.version,
|
|
142
|
+
...buildNpmResolutionInstallFields(result.npmResolution)
|
|
143
|
+
});
|
|
144
|
+
return {
|
|
145
|
+
cfg: next,
|
|
146
|
+
installed: true
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
await prompter.note(`Failed to install ${entry.install.npmSpec}: ${result.error}`, "Plugin install");
|
|
150
|
+
if (localPath) {
|
|
151
|
+
if (await prompter.confirm({
|
|
152
|
+
message: `Use local plugin path instead? (${localPath})`,
|
|
153
|
+
initialValue: true
|
|
154
|
+
})) {
|
|
155
|
+
next = addPluginLoadPath(next, localPath);
|
|
156
|
+
next = enablePluginInConfig(next, entry.id).config;
|
|
157
|
+
return {
|
|
158
|
+
cfg: next,
|
|
159
|
+
installed: true
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
runtime.error?.(`Plugin install failed: ${result.error}`);
|
|
164
|
+
return {
|
|
165
|
+
cfg: next,
|
|
166
|
+
installed: false
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function reloadOnboardingPluginRegistry(params) {
|
|
170
|
+
const workspaceDir = params.workspaceDir ?? resolveAgentWorkspaceDir(params.cfg, resolveDefaultAgentId(params.cfg));
|
|
171
|
+
const log = createSubsystemLogger("plugins");
|
|
172
|
+
loadRemoteClawPlugins({
|
|
173
|
+
config: params.cfg,
|
|
174
|
+
workspaceDir,
|
|
175
|
+
cache: false,
|
|
176
|
+
logger: createPluginLoaderLogger(log)
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
//#endregion
|
|
181
|
+
//#region src/plugin-sdk/onboarding.ts
|
|
182
|
+
async function promptAccountId$1(params) {
|
|
183
|
+
const existingIds = params.listAccountIds(params.cfg);
|
|
184
|
+
const initial = params.currentId?.trim() || params.defaultAccountId || DEFAULT_ACCOUNT_ID;
|
|
185
|
+
const choice = await params.prompter.select({
|
|
186
|
+
message: `${params.label} account`,
|
|
187
|
+
options: [...existingIds.map((id) => ({
|
|
188
|
+
value: id,
|
|
189
|
+
label: id === DEFAULT_ACCOUNT_ID ? "default (primary)" : id
|
|
190
|
+
})), {
|
|
191
|
+
value: "__new__",
|
|
192
|
+
label: "Add a new account"
|
|
193
|
+
}],
|
|
194
|
+
initialValue: initial
|
|
195
|
+
});
|
|
196
|
+
if (choice !== "__new__") return normalizeAccountId(choice);
|
|
197
|
+
const entered = await params.prompter.text({
|
|
198
|
+
message: `New ${params.label} account id`,
|
|
199
|
+
validate: (value) => value?.trim() ? void 0 : "Required"
|
|
200
|
+
});
|
|
201
|
+
const normalized = normalizeAccountId(String(entered));
|
|
202
|
+
if (String(entered).trim() !== normalized) await params.prompter.note(`Normalized account id to "${normalized}".`, `${params.label} account`);
|
|
203
|
+
return normalized;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region src/channels/plugins/onboarding/helpers.ts
|
|
208
|
+
const promptAccountId = async (params) => {
|
|
209
|
+
return await promptAccountId$1(params);
|
|
210
|
+
};
|
|
211
|
+
function addWildcardAllowFrom(allowFrom) {
|
|
212
|
+
const next = (allowFrom ?? []).map((v) => String(v).trim()).filter(Boolean);
|
|
213
|
+
if (!next.includes("*")) next.push("*");
|
|
214
|
+
return next;
|
|
215
|
+
}
|
|
216
|
+
function mergeAllowFromEntries(current, additions) {
|
|
217
|
+
const merged = [...current ?? [], ...additions].map((v) => String(v).trim()).filter(Boolean);
|
|
218
|
+
return [...new Set(merged)];
|
|
219
|
+
}
|
|
220
|
+
function splitOnboardingEntries(raw) {
|
|
221
|
+
return raw.split(/[\n,;]+/g).map((entry) => entry.trim()).filter(Boolean);
|
|
222
|
+
}
|
|
223
|
+
function parseOnboardingEntriesWithParser(raw, parseEntry) {
|
|
224
|
+
const parts = splitOnboardingEntries(String(raw ?? ""));
|
|
225
|
+
const entries = [];
|
|
226
|
+
for (const part of parts) {
|
|
227
|
+
const parsed = parseEntry(part);
|
|
228
|
+
if ("error" in parsed) return {
|
|
229
|
+
entries: [],
|
|
230
|
+
error: parsed.error
|
|
231
|
+
};
|
|
232
|
+
entries.push(parsed.value);
|
|
233
|
+
}
|
|
234
|
+
return { entries: normalizeAllowFromEntries(entries) };
|
|
235
|
+
}
|
|
236
|
+
function parseOnboardingEntriesAllowingWildcard(raw, parseEntry) {
|
|
237
|
+
return parseOnboardingEntriesWithParser(raw, (entry) => {
|
|
238
|
+
if (entry === "*") return { value: "*" };
|
|
239
|
+
return parseEntry(entry);
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
function parseMentionOrPrefixedId(params) {
|
|
243
|
+
const trimmed = params.value.trim();
|
|
244
|
+
if (!trimmed) return null;
|
|
245
|
+
const mentionMatch = trimmed.match(params.mentionPattern);
|
|
246
|
+
if (mentionMatch?.[1]) return params.normalizeId ? params.normalizeId(mentionMatch[1]) : mentionMatch[1];
|
|
247
|
+
const stripped = params.prefixPattern ? trimmed.replace(params.prefixPattern, "") : trimmed;
|
|
248
|
+
if (!params.idPattern.test(stripped)) return null;
|
|
249
|
+
return params.normalizeId ? params.normalizeId(stripped) : stripped;
|
|
250
|
+
}
|
|
251
|
+
function normalizeAllowFromEntries(entries, normalizeEntry) {
|
|
252
|
+
const normalized = entries.map((entry) => String(entry).trim()).filter(Boolean).map((entry) => {
|
|
253
|
+
if (entry === "*") return "*";
|
|
254
|
+
if (!normalizeEntry) return entry;
|
|
255
|
+
const value = normalizeEntry(entry);
|
|
256
|
+
return typeof value === "string" ? value.trim() : "";
|
|
257
|
+
}).filter(Boolean);
|
|
258
|
+
return [...new Set(normalized)];
|
|
259
|
+
}
|
|
260
|
+
function resolveOnboardingAccountId(params) {
|
|
261
|
+
return params.accountId?.trim() ? normalizeAccountId(params.accountId) : params.defaultAccountId;
|
|
262
|
+
}
|
|
263
|
+
async function resolveAccountIdForConfigure(params) {
|
|
264
|
+
const override = params.accountOverride?.trim();
|
|
265
|
+
let accountId = override ? normalizeAccountId(override) : params.defaultAccountId;
|
|
266
|
+
if (params.shouldPromptAccountIds && !override) accountId = await promptAccountId({
|
|
267
|
+
cfg: params.cfg,
|
|
268
|
+
prompter: params.prompter,
|
|
269
|
+
label: params.label,
|
|
270
|
+
currentId: accountId,
|
|
271
|
+
listAccountIds: params.listAccountIds,
|
|
272
|
+
defaultAccountId: params.defaultAccountId
|
|
273
|
+
});
|
|
274
|
+
return accountId;
|
|
275
|
+
}
|
|
276
|
+
function setAccountAllowFromForChannel(params) {
|
|
277
|
+
const { cfg, channel, accountId, allowFrom } = params;
|
|
278
|
+
return patchConfigForScopedAccount({
|
|
279
|
+
cfg,
|
|
280
|
+
channel,
|
|
281
|
+
accountId,
|
|
282
|
+
patch: { allowFrom },
|
|
283
|
+
ensureEnabled: false
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
function setChannelDmPolicyWithAllowFrom(params) {
|
|
287
|
+
const { cfg, channel, dmPolicy } = params;
|
|
288
|
+
const allowFrom = dmPolicy === "open" ? addWildcardAllowFrom(cfg.channels?.[channel]?.allowFrom) : void 0;
|
|
289
|
+
return {
|
|
290
|
+
...cfg,
|
|
291
|
+
channels: {
|
|
292
|
+
...cfg.channels,
|
|
293
|
+
[channel]: {
|
|
294
|
+
...cfg.channels?.[channel],
|
|
295
|
+
dmPolicy,
|
|
296
|
+
...allowFrom ? { allowFrom } : {}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
function setLegacyChannelDmPolicyWithAllowFrom(params) {
|
|
302
|
+
const channelConfig = params.cfg.channels?.[params.channel] ?? {
|
|
303
|
+
allowFrom: void 0,
|
|
304
|
+
dm: void 0
|
|
305
|
+
};
|
|
306
|
+
const existingAllowFrom = channelConfig.allowFrom ?? channelConfig.dm?.allowFrom;
|
|
307
|
+
const allowFrom = params.dmPolicy === "open" ? addWildcardAllowFrom(existingAllowFrom) : void 0;
|
|
308
|
+
return patchLegacyDmChannelConfig({
|
|
309
|
+
cfg: params.cfg,
|
|
310
|
+
channel: params.channel,
|
|
311
|
+
patch: {
|
|
312
|
+
dmPolicy: params.dmPolicy,
|
|
313
|
+
...allowFrom ? { allowFrom } : {}
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
function setLegacyChannelAllowFrom(params) {
|
|
318
|
+
return patchLegacyDmChannelConfig({
|
|
319
|
+
cfg: params.cfg,
|
|
320
|
+
channel: params.channel,
|
|
321
|
+
patch: { allowFrom: params.allowFrom }
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
function setAccountGroupPolicyForChannel(params) {
|
|
325
|
+
return patchChannelConfigForAccount({
|
|
326
|
+
cfg: params.cfg,
|
|
327
|
+
channel: params.channel,
|
|
328
|
+
accountId: params.accountId,
|
|
329
|
+
patch: { groupPolicy: params.groupPolicy }
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
function patchLegacyDmChannelConfig(params) {
|
|
333
|
+
const { cfg, channel, patch } = params;
|
|
334
|
+
const channelConfig = cfg.channels?.[channel] ?? {};
|
|
335
|
+
const dmConfig = channelConfig.dm ?? {};
|
|
336
|
+
return {
|
|
337
|
+
...cfg,
|
|
338
|
+
channels: {
|
|
339
|
+
...cfg.channels,
|
|
340
|
+
[channel]: {
|
|
341
|
+
...channelConfig,
|
|
342
|
+
...patch,
|
|
343
|
+
dm: {
|
|
344
|
+
...dmConfig,
|
|
345
|
+
enabled: typeof dmConfig.enabled === "boolean" ? dmConfig.enabled : true
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
function setOnboardingChannelEnabled(cfg, channel, enabled) {
|
|
352
|
+
const channelConfig = cfg.channels?.[channel] ?? {};
|
|
353
|
+
return {
|
|
354
|
+
...cfg,
|
|
355
|
+
channels: {
|
|
356
|
+
...cfg.channels,
|
|
357
|
+
[channel]: {
|
|
358
|
+
...channelConfig,
|
|
359
|
+
enabled
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
function patchConfigForScopedAccount(params) {
|
|
365
|
+
const { cfg, channel, accountId, patch, ensureEnabled } = params;
|
|
366
|
+
const channelConfig = cfg.channels?.[channel] ?? {};
|
|
367
|
+
if (accountId === DEFAULT_ACCOUNT_ID) return {
|
|
368
|
+
...cfg,
|
|
369
|
+
channels: {
|
|
370
|
+
...cfg.channels,
|
|
371
|
+
[channel]: {
|
|
372
|
+
...channelConfig,
|
|
373
|
+
...ensureEnabled ? { enabled: true } : {},
|
|
374
|
+
...patch
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
const accounts = channelConfig.accounts ?? {};
|
|
379
|
+
const existingAccount = accounts[accountId] ?? {};
|
|
380
|
+
return {
|
|
381
|
+
...cfg,
|
|
382
|
+
channels: {
|
|
383
|
+
...cfg.channels,
|
|
384
|
+
[channel]: {
|
|
385
|
+
...channelConfig,
|
|
386
|
+
...ensureEnabled ? { enabled: true } : {},
|
|
387
|
+
accounts: {
|
|
388
|
+
...accounts,
|
|
389
|
+
[accountId]: {
|
|
390
|
+
...existingAccount,
|
|
391
|
+
...ensureEnabled ? { enabled: typeof existingAccount.enabled === "boolean" ? existingAccount.enabled : true } : {},
|
|
392
|
+
...patch
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
function patchChannelConfigForAccount(params) {
|
|
400
|
+
return patchConfigForScopedAccount({
|
|
401
|
+
...params,
|
|
402
|
+
ensureEnabled: true
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
function applySingleTokenPromptResult(params) {
|
|
406
|
+
let next = params.cfg;
|
|
407
|
+
if (params.tokenResult.useEnv) next = patchChannelConfigForAccount({
|
|
408
|
+
cfg: next,
|
|
409
|
+
channel: params.channel,
|
|
410
|
+
accountId: params.accountId,
|
|
411
|
+
patch: {}
|
|
412
|
+
});
|
|
413
|
+
if (params.tokenResult.token) next = patchChannelConfigForAccount({
|
|
414
|
+
cfg: next,
|
|
415
|
+
channel: params.channel,
|
|
416
|
+
accountId: params.accountId,
|
|
417
|
+
patch: { [params.tokenPatchKey]: params.tokenResult.token }
|
|
418
|
+
});
|
|
419
|
+
return next;
|
|
420
|
+
}
|
|
421
|
+
async function promptSingleChannelToken(params) {
|
|
422
|
+
const promptToken = async () => String(await params.prompter.text({
|
|
423
|
+
message: params.inputPrompt,
|
|
424
|
+
validate: (value) => value?.trim() ? void 0 : "Required"
|
|
425
|
+
})).trim();
|
|
426
|
+
if (params.canUseEnv) {
|
|
427
|
+
if (await params.prompter.confirm({
|
|
428
|
+
message: params.envPrompt,
|
|
429
|
+
initialValue: true
|
|
430
|
+
})) return {
|
|
431
|
+
useEnv: true,
|
|
432
|
+
token: null
|
|
433
|
+
};
|
|
434
|
+
return {
|
|
435
|
+
useEnv: false,
|
|
436
|
+
token: await promptToken()
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
if (params.hasConfigToken && params.accountConfigured) {
|
|
440
|
+
if (await params.prompter.confirm({
|
|
441
|
+
message: params.keepPrompt,
|
|
442
|
+
initialValue: true
|
|
443
|
+
})) return {
|
|
444
|
+
useEnv: false,
|
|
445
|
+
token: null
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
return {
|
|
449
|
+
useEnv: false,
|
|
450
|
+
token: await promptToken()
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
async function promptParsedAllowFromForScopedChannel(params) {
|
|
454
|
+
const accountId = resolveOnboardingAccountId({
|
|
455
|
+
accountId: params.accountId,
|
|
456
|
+
defaultAccountId: params.defaultAccountId
|
|
457
|
+
});
|
|
458
|
+
const existing = params.getExistingAllowFrom({
|
|
459
|
+
cfg: params.cfg,
|
|
460
|
+
accountId
|
|
461
|
+
});
|
|
462
|
+
await params.prompter.note(params.noteLines.join("\n"), params.noteTitle);
|
|
463
|
+
const entry = await params.prompter.text({
|
|
464
|
+
message: params.message,
|
|
465
|
+
placeholder: params.placeholder,
|
|
466
|
+
initialValue: existing[0] ? String(existing[0]) : void 0,
|
|
467
|
+
validate: (value) => {
|
|
468
|
+
const raw = String(value ?? "").trim();
|
|
469
|
+
if (!raw) return "Required";
|
|
470
|
+
return params.parseEntries(raw).error;
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
const unique = mergeAllowFromEntries(void 0, params.parseEntries(String(entry)).entries);
|
|
474
|
+
return setAccountAllowFromForChannel({
|
|
475
|
+
cfg: params.cfg,
|
|
476
|
+
channel: params.channel,
|
|
477
|
+
accountId,
|
|
478
|
+
allowFrom: unique
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
async function noteChannelLookupSummary(params) {
|
|
482
|
+
const lines = [];
|
|
483
|
+
for (const section of params.resolvedSections) {
|
|
484
|
+
if (section.values.length === 0) continue;
|
|
485
|
+
lines.push(`${section.title}: ${section.values.join(", ")}`);
|
|
486
|
+
}
|
|
487
|
+
if (params.unresolved && params.unresolved.length > 0) lines.push(`Unresolved (kept as typed): ${params.unresolved.join(", ")}`);
|
|
488
|
+
if (lines.length > 0) await params.prompter.note(lines.join("\n"), params.label);
|
|
489
|
+
}
|
|
490
|
+
async function noteChannelLookupFailure(params) {
|
|
491
|
+
await params.prompter.note(`Channel lookup failed; keeping entries as typed. ${String(params.error)}`, params.label);
|
|
492
|
+
}
|
|
493
|
+
async function promptResolvedAllowFrom(params) {
|
|
494
|
+
while (true) {
|
|
495
|
+
const entry = await params.prompter.text({
|
|
496
|
+
message: params.message,
|
|
497
|
+
placeholder: params.placeholder,
|
|
498
|
+
initialValue: params.existing[0] ? String(params.existing[0]) : void 0,
|
|
499
|
+
validate: (value) => String(value ?? "").trim() ? void 0 : "Required"
|
|
500
|
+
});
|
|
501
|
+
const parts = params.parseInputs(String(entry));
|
|
502
|
+
if (!params.token) {
|
|
503
|
+
const ids = parts.map(params.parseId).filter(Boolean);
|
|
504
|
+
if (ids.length !== parts.length) {
|
|
505
|
+
await params.prompter.note(params.invalidWithoutTokenNote, params.label);
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
508
|
+
return mergeAllowFromEntries(params.existing, ids);
|
|
509
|
+
}
|
|
510
|
+
const results = await params.resolveEntries({
|
|
511
|
+
token: params.token,
|
|
512
|
+
entries: parts
|
|
513
|
+
}).catch(() => null);
|
|
514
|
+
if (!results) {
|
|
515
|
+
await params.prompter.note("Failed to resolve usernames. Try again.", params.label);
|
|
516
|
+
continue;
|
|
517
|
+
}
|
|
518
|
+
const unresolved = results.filter((res) => !res.resolved || !res.id);
|
|
519
|
+
if (unresolved.length > 0) {
|
|
520
|
+
await params.prompter.note(`Could not resolve: ${unresolved.map((res) => res.input).join(", ")}`, params.label);
|
|
521
|
+
continue;
|
|
522
|
+
}
|
|
523
|
+
const ids = results.map((res) => res.id);
|
|
524
|
+
return mergeAllowFromEntries(params.existing, ids);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
async function promptLegacyChannelAllowFrom(params) {
|
|
528
|
+
await params.prompter.note(params.noteLines.join("\n"), params.noteTitle);
|
|
529
|
+
const unique = await promptResolvedAllowFrom({
|
|
530
|
+
prompter: params.prompter,
|
|
531
|
+
existing: params.existing,
|
|
532
|
+
token: params.token,
|
|
533
|
+
message: params.message,
|
|
534
|
+
placeholder: params.placeholder,
|
|
535
|
+
label: params.noteTitle,
|
|
536
|
+
parseInputs: splitOnboardingEntries,
|
|
537
|
+
parseId: params.parseId,
|
|
538
|
+
invalidWithoutTokenNote: params.invalidWithoutTokenNote,
|
|
539
|
+
resolveEntries: params.resolveEntries
|
|
540
|
+
});
|
|
541
|
+
return setLegacyChannelAllowFrom({
|
|
542
|
+
cfg: params.cfg,
|
|
543
|
+
channel: params.channel,
|
|
544
|
+
allowFrom: unique
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
//#endregion
|
|
549
|
+
//#region src/channels/plugins/onboarding/channel-access.ts
|
|
550
|
+
function parseAllowlistEntries(raw) {
|
|
551
|
+
return splitOnboardingEntries(String(raw ?? ""));
|
|
552
|
+
}
|
|
553
|
+
function formatAllowlistEntries(entries) {
|
|
554
|
+
return entries.map((entry) => entry.trim()).filter(Boolean).join(", ");
|
|
555
|
+
}
|
|
556
|
+
async function promptChannelAccessPolicy(params) {
|
|
557
|
+
const options = [{
|
|
558
|
+
value: "allowlist",
|
|
559
|
+
label: "Allowlist (recommended)"
|
|
560
|
+
}];
|
|
561
|
+
if (params.allowOpen !== false) options.push({
|
|
562
|
+
value: "open",
|
|
563
|
+
label: "Open (allow all channels)"
|
|
564
|
+
});
|
|
565
|
+
if (params.allowDisabled !== false) options.push({
|
|
566
|
+
value: "disabled",
|
|
567
|
+
label: "Disabled (block all channels)"
|
|
568
|
+
});
|
|
569
|
+
const initialValue = params.currentPolicy ?? "allowlist";
|
|
570
|
+
return await params.prompter.select({
|
|
571
|
+
message: `${params.label} access`,
|
|
572
|
+
options,
|
|
573
|
+
initialValue
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
async function promptChannelAllowlist(params) {
|
|
577
|
+
const initialValue = params.currentEntries && params.currentEntries.length > 0 ? formatAllowlistEntries(params.currentEntries) : void 0;
|
|
578
|
+
return parseAllowlistEntries(await params.prompter.text({
|
|
579
|
+
message: `${params.label} allowlist (comma-separated)`,
|
|
580
|
+
placeholder: params.placeholder,
|
|
581
|
+
initialValue
|
|
582
|
+
}));
|
|
583
|
+
}
|
|
584
|
+
async function promptChannelAccessConfig(params) {
|
|
585
|
+
const hasEntries = (params.currentEntries ?? []).length > 0;
|
|
586
|
+
const shouldPrompt = params.defaultPrompt ?? !hasEntries;
|
|
587
|
+
if (!await params.prompter.confirm({
|
|
588
|
+
message: params.updatePrompt ? `Update ${params.label} access?` : `Configure ${params.label} access?`,
|
|
589
|
+
initialValue: shouldPrompt
|
|
590
|
+
})) return null;
|
|
591
|
+
const policy = await promptChannelAccessPolicy({
|
|
592
|
+
prompter: params.prompter,
|
|
593
|
+
label: params.label,
|
|
594
|
+
currentPolicy: params.currentPolicy,
|
|
595
|
+
allowOpen: params.allowOpen,
|
|
596
|
+
allowDisabled: params.allowDisabled
|
|
597
|
+
});
|
|
598
|
+
if (policy !== "allowlist") return {
|
|
599
|
+
policy,
|
|
600
|
+
entries: []
|
|
601
|
+
};
|
|
602
|
+
return {
|
|
603
|
+
policy,
|
|
604
|
+
entries: await promptChannelAllowlist({
|
|
605
|
+
prompter: params.prompter,
|
|
606
|
+
label: params.label,
|
|
607
|
+
currentEntries: params.currentEntries,
|
|
608
|
+
placeholder: params.placeholder
|
|
609
|
+
})
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
//#endregion
|
|
614
|
+
//#region src/channels/plugins/onboarding/channel-access-configure.ts
|
|
615
|
+
async function configureChannelAccessWithAllowlist(params) {
|
|
616
|
+
let next = params.cfg;
|
|
617
|
+
const accessConfig = await promptChannelAccessConfig({
|
|
618
|
+
prompter: params.prompter,
|
|
619
|
+
label: params.label,
|
|
620
|
+
currentPolicy: params.currentPolicy,
|
|
621
|
+
currentEntries: params.currentEntries,
|
|
622
|
+
placeholder: params.placeholder,
|
|
623
|
+
updatePrompt: params.updatePrompt
|
|
624
|
+
});
|
|
625
|
+
if (!accessConfig) return next;
|
|
626
|
+
if (accessConfig.policy !== "allowlist") return params.setPolicy(next, accessConfig.policy);
|
|
627
|
+
const resolved = await params.resolveAllowlist({
|
|
628
|
+
cfg: next,
|
|
629
|
+
entries: accessConfig.entries
|
|
630
|
+
});
|
|
631
|
+
next = params.setPolicy(next, "allowlist");
|
|
632
|
+
return params.applyAllowlist({
|
|
633
|
+
cfg: next,
|
|
634
|
+
resolved
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
//#endregion
|
|
639
|
+
//#region src/channels/plugins/onboarding/discord.ts
|
|
640
|
+
const channel$5 = "discord";
|
|
641
|
+
async function noteDiscordTokenHelp(prompter) {
|
|
642
|
+
await prompter.note([
|
|
643
|
+
"1) Discord Developer Portal → Applications → New Application",
|
|
644
|
+
"2) Bot → Add Bot → Reset Token → copy token",
|
|
645
|
+
"3) OAuth2 → URL Generator → scope 'bot' → invite to your server",
|
|
646
|
+
"Tip: enable Message Content Intent if you need message text. (Bot → Privileged Gateway Intents → Message Content Intent)",
|
|
647
|
+
`Docs: ${formatDocsLink("/discord", "discord")}`
|
|
648
|
+
].join("\n"), "Discord bot token");
|
|
649
|
+
}
|
|
650
|
+
function setDiscordGuildChannelAllowlist(cfg, accountId, entries) {
|
|
651
|
+
const guilds = { ...accountId === DEFAULT_ACCOUNT_ID ? cfg.channels?.discord?.guilds ?? {} : cfg.channels?.discord?.accounts?.[accountId]?.guilds ?? {} };
|
|
652
|
+
for (const entry of entries) {
|
|
653
|
+
const guildKey = entry.guildKey || "*";
|
|
654
|
+
const existing = guilds[guildKey] ?? {};
|
|
655
|
+
if (entry.channelKey) {
|
|
656
|
+
const channels = { ...existing.channels };
|
|
657
|
+
channels[entry.channelKey] = { allow: true };
|
|
658
|
+
guilds[guildKey] = {
|
|
659
|
+
...existing,
|
|
660
|
+
channels
|
|
661
|
+
};
|
|
662
|
+
} else guilds[guildKey] = existing;
|
|
663
|
+
}
|
|
664
|
+
return patchChannelConfigForAccount({
|
|
665
|
+
cfg,
|
|
666
|
+
channel: "discord",
|
|
667
|
+
accountId,
|
|
668
|
+
patch: { guilds }
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
async function promptDiscordAllowFrom(params) {
|
|
672
|
+
const accountId = resolveOnboardingAccountId({
|
|
673
|
+
accountId: params.accountId,
|
|
674
|
+
defaultAccountId: resolveDefaultDiscordAccountId(params.cfg)
|
|
675
|
+
});
|
|
676
|
+
const token = resolveDiscordAccount({
|
|
677
|
+
cfg: params.cfg,
|
|
678
|
+
accountId
|
|
679
|
+
}).token;
|
|
680
|
+
const existing = params.cfg.channels?.discord?.allowFrom ?? params.cfg.channels?.discord?.dm?.allowFrom ?? [];
|
|
681
|
+
const parseId = (value) => parseMentionOrPrefixedId({
|
|
682
|
+
value,
|
|
683
|
+
mentionPattern: /^<@!?(\d+)>$/,
|
|
684
|
+
prefixPattern: /^(user:|discord:)/i,
|
|
685
|
+
idPattern: /^\d+$/
|
|
686
|
+
});
|
|
687
|
+
return promptLegacyChannelAllowFrom({
|
|
688
|
+
cfg: params.cfg,
|
|
689
|
+
channel: "discord",
|
|
690
|
+
prompter: params.prompter,
|
|
691
|
+
existing,
|
|
692
|
+
token,
|
|
693
|
+
noteTitle: "Discord allowlist",
|
|
694
|
+
noteLines: [
|
|
695
|
+
"Allowlist Discord DMs by username (we resolve to user ids).",
|
|
696
|
+
"Examples:",
|
|
697
|
+
"- 123456789012345678",
|
|
698
|
+
"- @alice",
|
|
699
|
+
"- alice#1234",
|
|
700
|
+
"Multiple entries: comma-separated.",
|
|
701
|
+
`Docs: ${formatDocsLink("/discord", "discord")}`
|
|
702
|
+
],
|
|
703
|
+
message: "Discord allowFrom (usernames or ids)",
|
|
704
|
+
placeholder: "@alice, 123456789012345678",
|
|
705
|
+
parseId,
|
|
706
|
+
invalidWithoutTokenNote: "Bot token missing; use numeric user ids (or mention form) only.",
|
|
707
|
+
resolveEntries: ({ token, entries }) => resolveDiscordUserAllowlist({
|
|
708
|
+
token,
|
|
709
|
+
entries
|
|
710
|
+
})
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
const dmPolicy$4 = {
|
|
714
|
+
label: "Discord",
|
|
715
|
+
channel: channel$5,
|
|
716
|
+
policyKey: "channels.discord.dmPolicy",
|
|
717
|
+
allowFromKey: "channels.discord.allowFrom",
|
|
718
|
+
getCurrent: (cfg) => cfg.channels?.discord?.dmPolicy ?? cfg.channels?.discord?.dm?.policy ?? "pairing",
|
|
719
|
+
setPolicy: (cfg, policy) => setLegacyChannelDmPolicyWithAllowFrom({
|
|
720
|
+
cfg,
|
|
721
|
+
channel: "discord",
|
|
722
|
+
dmPolicy: policy
|
|
723
|
+
}),
|
|
724
|
+
promptAllowFrom: promptDiscordAllowFrom
|
|
725
|
+
};
|
|
726
|
+
const discordOnboardingAdapter = {
|
|
727
|
+
channel: channel$5,
|
|
728
|
+
getStatus: async ({ cfg }) => {
|
|
729
|
+
const configured = listDiscordAccountIds(cfg).some((accountId) => Boolean(resolveDiscordAccount({
|
|
730
|
+
cfg,
|
|
731
|
+
accountId
|
|
732
|
+
}).token));
|
|
733
|
+
return {
|
|
734
|
+
channel: channel$5,
|
|
735
|
+
configured,
|
|
736
|
+
statusLines: [`Discord: ${configured ? "configured" : "needs token"}`],
|
|
737
|
+
selectionHint: configured ? "configured" : "needs token",
|
|
738
|
+
quickstartScore: configured ? 2 : 1
|
|
739
|
+
};
|
|
740
|
+
},
|
|
741
|
+
configure: async ({ cfg, prompter, accountOverrides, shouldPromptAccountIds }) => {
|
|
742
|
+
const defaultDiscordAccountId = resolveDefaultDiscordAccountId(cfg);
|
|
743
|
+
const discordAccountId = await resolveAccountIdForConfigure({
|
|
744
|
+
cfg,
|
|
745
|
+
prompter,
|
|
746
|
+
label: "Discord",
|
|
747
|
+
accountOverride: accountOverrides.discord,
|
|
748
|
+
shouldPromptAccountIds,
|
|
749
|
+
listAccountIds: listDiscordAccountIds,
|
|
750
|
+
defaultAccountId: defaultDiscordAccountId
|
|
751
|
+
});
|
|
752
|
+
let next = cfg;
|
|
753
|
+
const resolvedAccount = resolveDiscordAccount({
|
|
754
|
+
cfg: next,
|
|
755
|
+
accountId: discordAccountId
|
|
756
|
+
});
|
|
757
|
+
const accountConfigured = Boolean(resolvedAccount.token);
|
|
758
|
+
const canUseEnv = discordAccountId === DEFAULT_ACCOUNT_ID && !resolvedAccount.config.token && Boolean(process.env.DISCORD_BOT_TOKEN?.trim());
|
|
759
|
+
const hasConfigToken = Boolean(resolvedAccount.config.token);
|
|
760
|
+
if (!accountConfigured) await noteDiscordTokenHelp(prompter);
|
|
761
|
+
const tokenResult = await promptSingleChannelToken({
|
|
762
|
+
prompter,
|
|
763
|
+
accountConfigured,
|
|
764
|
+
canUseEnv,
|
|
765
|
+
hasConfigToken,
|
|
766
|
+
envPrompt: "DISCORD_BOT_TOKEN detected. Use env var?",
|
|
767
|
+
keepPrompt: "Discord token already configured. Keep it?",
|
|
768
|
+
inputPrompt: "Enter Discord bot token"
|
|
769
|
+
});
|
|
770
|
+
next = applySingleTokenPromptResult({
|
|
771
|
+
cfg: next,
|
|
772
|
+
channel: "discord",
|
|
773
|
+
accountId: discordAccountId,
|
|
774
|
+
tokenPatchKey: "token",
|
|
775
|
+
tokenResult
|
|
776
|
+
});
|
|
777
|
+
const currentEntries = Object.entries(resolvedAccount.config.guilds ?? {}).flatMap(([guildKey, value]) => {
|
|
778
|
+
const channels = value?.channels ?? {};
|
|
779
|
+
const channelKeys = Object.keys(channels);
|
|
780
|
+
if (channelKeys.length === 0) return [/^\d+$/.test(guildKey) ? `guild:${guildKey}` : guildKey];
|
|
781
|
+
return channelKeys.map((channelKey) => `${guildKey}/${channelKey}`);
|
|
782
|
+
});
|
|
783
|
+
next = await configureChannelAccessWithAllowlist({
|
|
784
|
+
cfg: next,
|
|
785
|
+
prompter,
|
|
786
|
+
label: "Discord channels",
|
|
787
|
+
currentPolicy: resolvedAccount.config.groupPolicy ?? "allowlist",
|
|
788
|
+
currentEntries,
|
|
789
|
+
placeholder: "My Server/#general, guildId/channelId, #support",
|
|
790
|
+
updatePrompt: Boolean(resolvedAccount.config.guilds),
|
|
791
|
+
setPolicy: (cfg, policy) => setAccountGroupPolicyForChannel({
|
|
792
|
+
cfg,
|
|
793
|
+
channel: "discord",
|
|
794
|
+
accountId: discordAccountId,
|
|
795
|
+
groupPolicy: policy
|
|
796
|
+
}),
|
|
797
|
+
resolveAllowlist: async ({ cfg, entries }) => {
|
|
798
|
+
const accountWithTokens = resolveDiscordAccount({
|
|
799
|
+
cfg,
|
|
800
|
+
accountId: discordAccountId
|
|
801
|
+
});
|
|
802
|
+
let resolved = entries.map((input) => ({
|
|
803
|
+
input,
|
|
804
|
+
resolved: false
|
|
805
|
+
}));
|
|
806
|
+
if (accountWithTokens.token && entries.length > 0) try {
|
|
807
|
+
resolved = await resolveDiscordChannelAllowlist({
|
|
808
|
+
token: accountWithTokens.token,
|
|
809
|
+
entries
|
|
810
|
+
});
|
|
811
|
+
const resolvedChannels = resolved.filter((entry) => entry.resolved && entry.channelId);
|
|
812
|
+
const resolvedGuilds = resolved.filter((entry) => entry.resolved && entry.guildId && !entry.channelId);
|
|
813
|
+
const unresolved = resolved.filter((entry) => !entry.resolved).map((entry) => entry.input);
|
|
814
|
+
await noteChannelLookupSummary({
|
|
815
|
+
prompter,
|
|
816
|
+
label: "Discord channels",
|
|
817
|
+
resolvedSections: [{
|
|
818
|
+
title: "Resolved channels",
|
|
819
|
+
values: resolvedChannels.map((entry) => entry.channelId).filter((value) => Boolean(value))
|
|
820
|
+
}, {
|
|
821
|
+
title: "Resolved guilds",
|
|
822
|
+
values: resolvedGuilds.map((entry) => entry.guildId).filter((value) => Boolean(value))
|
|
823
|
+
}],
|
|
824
|
+
unresolved
|
|
825
|
+
});
|
|
826
|
+
} catch (err) {
|
|
827
|
+
await noteChannelLookupFailure({
|
|
828
|
+
prompter,
|
|
829
|
+
label: "Discord channels",
|
|
830
|
+
error: err
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
return resolved;
|
|
834
|
+
},
|
|
835
|
+
applyAllowlist: ({ cfg, resolved }) => {
|
|
836
|
+
const allowlistEntries = [];
|
|
837
|
+
for (const entry of resolved) {
|
|
838
|
+
const guildKey = entry.guildId ?? (entry.guildName ? normalizeDiscordSlug(entry.guildName) : void 0) ?? "*";
|
|
839
|
+
const channelKey = entry.channelId ?? (entry.channelName ? normalizeDiscordSlug(entry.channelName) : void 0);
|
|
840
|
+
if (!channelKey && guildKey === "*") continue;
|
|
841
|
+
allowlistEntries.push({
|
|
842
|
+
guildKey,
|
|
843
|
+
...channelKey ? { channelKey } : {}
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
return setDiscordGuildChannelAllowlist(cfg, discordAccountId, allowlistEntries);
|
|
847
|
+
}
|
|
848
|
+
});
|
|
849
|
+
return {
|
|
850
|
+
cfg: next,
|
|
851
|
+
accountId: discordAccountId
|
|
852
|
+
};
|
|
853
|
+
},
|
|
854
|
+
dmPolicy: dmPolicy$4,
|
|
855
|
+
disable: (cfg) => setOnboardingChannelEnabled(cfg, channel$5, false)
|
|
856
|
+
};
|
|
857
|
+
|
|
858
|
+
//#endregion
|
|
859
|
+
//#region src/channels/plugins/onboarding/imessage.ts
|
|
860
|
+
const channel$4 = "imessage";
|
|
861
|
+
function parseIMessageAllowFromEntries(raw) {
|
|
862
|
+
return parseOnboardingEntriesAllowingWildcard(raw, (entry) => {
|
|
863
|
+
const lower = entry.toLowerCase();
|
|
864
|
+
if (lower.startsWith("chat_id:")) {
|
|
865
|
+
const id = entry.slice(8).trim();
|
|
866
|
+
if (!/^\d+$/.test(id)) return { error: `Invalid chat_id: ${entry}` };
|
|
867
|
+
return { value: entry };
|
|
868
|
+
}
|
|
869
|
+
if (lower.startsWith("chat_guid:")) {
|
|
870
|
+
if (!entry.slice(10).trim()) return { error: "Invalid chat_guid entry" };
|
|
871
|
+
return { value: entry };
|
|
872
|
+
}
|
|
873
|
+
if (lower.startsWith("chat_identifier:")) {
|
|
874
|
+
if (!entry.slice(16).trim()) return { error: "Invalid chat_identifier entry" };
|
|
875
|
+
return { value: entry };
|
|
876
|
+
}
|
|
877
|
+
if (!normalizeIMessageHandle(entry)) return { error: `Invalid handle: ${entry}` };
|
|
878
|
+
return { value: entry };
|
|
879
|
+
});
|
|
880
|
+
}
|
|
881
|
+
async function promptIMessageAllowFrom(params) {
|
|
882
|
+
return promptParsedAllowFromForScopedChannel({
|
|
883
|
+
cfg: params.cfg,
|
|
884
|
+
channel: "imessage",
|
|
885
|
+
accountId: params.accountId,
|
|
886
|
+
defaultAccountId: resolveDefaultIMessageAccountId(params.cfg),
|
|
887
|
+
prompter: params.prompter,
|
|
888
|
+
noteTitle: "iMessage allowlist",
|
|
889
|
+
noteLines: [
|
|
890
|
+
"Allowlist iMessage DMs by handle or chat target.",
|
|
891
|
+
"Examples:",
|
|
892
|
+
"- +15555550123",
|
|
893
|
+
"- user@example.com",
|
|
894
|
+
"- chat_id:123",
|
|
895
|
+
"- chat_guid:... or chat_identifier:...",
|
|
896
|
+
"Multiple entries: comma-separated.",
|
|
897
|
+
`Docs: ${formatDocsLink("/imessage", "imessage")}`
|
|
898
|
+
],
|
|
899
|
+
message: "iMessage allowFrom (handle or chat_id)",
|
|
900
|
+
placeholder: "+15555550123, user@example.com, chat_id:123",
|
|
901
|
+
parseEntries: parseIMessageAllowFromEntries,
|
|
902
|
+
getExistingAllowFrom: ({ cfg, accountId }) => {
|
|
903
|
+
return resolveIMessageAccount({
|
|
904
|
+
cfg,
|
|
905
|
+
accountId
|
|
906
|
+
}).config.allowFrom ?? [];
|
|
907
|
+
}
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
const dmPolicy$3 = {
|
|
911
|
+
label: "iMessage",
|
|
912
|
+
channel: channel$4,
|
|
913
|
+
policyKey: "channels.imessage.dmPolicy",
|
|
914
|
+
allowFromKey: "channels.imessage.allowFrom",
|
|
915
|
+
getCurrent: (cfg) => cfg.channels?.imessage?.dmPolicy ?? "pairing",
|
|
916
|
+
setPolicy: (cfg, policy) => setChannelDmPolicyWithAllowFrom({
|
|
917
|
+
cfg,
|
|
918
|
+
channel: "imessage",
|
|
919
|
+
dmPolicy: policy
|
|
920
|
+
}),
|
|
921
|
+
promptAllowFrom: promptIMessageAllowFrom
|
|
922
|
+
};
|
|
923
|
+
const imessageOnboardingAdapter = {
|
|
924
|
+
channel: channel$4,
|
|
925
|
+
getStatus: async ({ cfg }) => {
|
|
926
|
+
const configured = listIMessageAccountIds(cfg).some((accountId) => {
|
|
927
|
+
const account = resolveIMessageAccount({
|
|
928
|
+
cfg,
|
|
929
|
+
accountId
|
|
930
|
+
});
|
|
931
|
+
return Boolean(account.config.cliPath || account.config.dbPath || account.config.allowFrom || account.config.service || account.config.region);
|
|
932
|
+
});
|
|
933
|
+
const imessageCliPath = cfg.channels?.imessage?.cliPath ?? "imsg";
|
|
934
|
+
const imessageCliDetected = await detectBinary(imessageCliPath);
|
|
935
|
+
return {
|
|
936
|
+
channel: channel$4,
|
|
937
|
+
configured,
|
|
938
|
+
statusLines: [`iMessage: ${configured ? "configured" : "needs setup"}`, `imsg: ${imessageCliDetected ? "found" : "missing"} (${imessageCliPath})`],
|
|
939
|
+
selectionHint: imessageCliDetected ? "imsg found" : "imsg missing",
|
|
940
|
+
quickstartScore: imessageCliDetected ? 1 : 0
|
|
941
|
+
};
|
|
942
|
+
},
|
|
943
|
+
configure: async ({ cfg, prompter, accountOverrides, shouldPromptAccountIds }) => {
|
|
944
|
+
const defaultIMessageAccountId = resolveDefaultIMessageAccountId(cfg);
|
|
945
|
+
const imessageAccountId = await resolveAccountIdForConfigure({
|
|
946
|
+
cfg,
|
|
947
|
+
prompter,
|
|
948
|
+
label: "iMessage",
|
|
949
|
+
accountOverride: accountOverrides.imessage,
|
|
950
|
+
shouldPromptAccountIds,
|
|
951
|
+
listAccountIds: listIMessageAccountIds,
|
|
952
|
+
defaultAccountId: defaultIMessageAccountId
|
|
953
|
+
});
|
|
954
|
+
let next = cfg;
|
|
955
|
+
let resolvedCliPath = resolveIMessageAccount({
|
|
956
|
+
cfg: next,
|
|
957
|
+
accountId: imessageAccountId
|
|
958
|
+
}).config.cliPath ?? "imsg";
|
|
959
|
+
if (!await detectBinary(resolvedCliPath)) {
|
|
960
|
+
const entered = await prompter.text({
|
|
961
|
+
message: "imsg CLI path",
|
|
962
|
+
initialValue: resolvedCliPath,
|
|
963
|
+
validate: (value) => value?.trim() ? void 0 : "Required"
|
|
964
|
+
});
|
|
965
|
+
resolvedCliPath = String(entered).trim();
|
|
966
|
+
if (!resolvedCliPath) await prompter.note("imsg CLI path required to enable iMessage.", "iMessage");
|
|
967
|
+
}
|
|
968
|
+
if (resolvedCliPath) next = patchChannelConfigForAccount({
|
|
969
|
+
cfg: next,
|
|
970
|
+
channel: "imessage",
|
|
971
|
+
accountId: imessageAccountId,
|
|
972
|
+
patch: { cliPath: resolvedCliPath }
|
|
973
|
+
});
|
|
974
|
+
await prompter.note([
|
|
975
|
+
"This is still a work in progress.",
|
|
976
|
+
"Ensure RemoteClaw has Full Disk Access to Messages DB.",
|
|
977
|
+
"Grant Automation permission for Messages when prompted.",
|
|
978
|
+
"List chats with: imsg chats --limit 20",
|
|
979
|
+
`Docs: ${formatDocsLink("/imessage", "imessage")}`
|
|
980
|
+
].join("\n"), "iMessage next steps");
|
|
981
|
+
return {
|
|
982
|
+
cfg: next,
|
|
983
|
+
accountId: imessageAccountId
|
|
984
|
+
};
|
|
985
|
+
},
|
|
986
|
+
dmPolicy: dmPolicy$3,
|
|
987
|
+
disable: (cfg) => setOnboardingChannelEnabled(cfg, channel$4, false)
|
|
988
|
+
};
|
|
989
|
+
|
|
990
|
+
//#endregion
|
|
991
|
+
//#region src/commands/signal-install.ts
|
|
992
|
+
/** @internal Exported for testing. */
|
|
993
|
+
async function extractSignalCliArchive(archivePath, installRoot, timeoutMs) {
|
|
994
|
+
await extractArchive({
|
|
995
|
+
archivePath,
|
|
996
|
+
destDir: installRoot,
|
|
997
|
+
timeoutMs
|
|
998
|
+
});
|
|
999
|
+
}
|
|
1000
|
+
/** @internal Exported for testing. */
|
|
1001
|
+
function looksLikeArchive(name) {
|
|
1002
|
+
return name.endsWith(".tar.gz") || name.endsWith(".tgz") || name.endsWith(".zip");
|
|
1003
|
+
}
|
|
1004
|
+
/**
|
|
1005
|
+
* Pick a native release asset from the official GitHub releases.
|
|
1006
|
+
*
|
|
1007
|
+
* The official signal-cli releases only publish native (GraalVM) binaries for
|
|
1008
|
+
* x86-64 Linux. On architectures where no native asset is available this
|
|
1009
|
+
* returns `undefined` so the caller can fall back to a different install
|
|
1010
|
+
* strategy (e.g. Homebrew).
|
|
1011
|
+
*/
|
|
1012
|
+
/** @internal Exported for testing. */
|
|
1013
|
+
function pickAsset(assets, platform, arch) {
|
|
1014
|
+
const archives = assets.filter((asset) => Boolean(asset.name && asset.browser_download_url)).filter((a) => looksLikeArchive(a.name.toLowerCase()));
|
|
1015
|
+
const byName = (pattern) => archives.find((asset) => pattern.test(asset.name.toLowerCase()));
|
|
1016
|
+
if (platform === "linux") {
|
|
1017
|
+
if (arch === "x64") return byName(/linux-native/) || byName(/linux/) || archives[0];
|
|
1018
|
+
return;
|
|
1019
|
+
}
|
|
1020
|
+
if (platform === "darwin") return byName(/macos|osx|darwin/) || archives[0];
|
|
1021
|
+
if (platform === "win32") return byName(/windows|win/) || archives[0];
|
|
1022
|
+
return archives[0];
|
|
1023
|
+
}
|
|
1024
|
+
async function downloadToFile(url, dest, maxRedirects = 5) {
|
|
1025
|
+
await new Promise((resolve, reject) => {
|
|
1026
|
+
const req = request(url, (res) => {
|
|
1027
|
+
if (res.statusCode && res.statusCode >= 300 && res.statusCode < 400) {
|
|
1028
|
+
const location = res.headers.location;
|
|
1029
|
+
if (!location || maxRedirects <= 0) {
|
|
1030
|
+
reject(/* @__PURE__ */ new Error("Redirect loop or missing Location header"));
|
|
1031
|
+
return;
|
|
1032
|
+
}
|
|
1033
|
+
const redirectUrl = new URL(location, url).href;
|
|
1034
|
+
resolve(downloadToFile(redirectUrl, dest, maxRedirects - 1));
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1037
|
+
if (!res.statusCode || res.statusCode >= 400) {
|
|
1038
|
+
reject(/* @__PURE__ */ new Error(`HTTP ${res.statusCode ?? "?"} downloading file`));
|
|
1039
|
+
return;
|
|
1040
|
+
}
|
|
1041
|
+
pipeline(res, createWriteStream(dest)).then(resolve).catch(reject);
|
|
1042
|
+
});
|
|
1043
|
+
req.on("error", reject);
|
|
1044
|
+
req.end();
|
|
1045
|
+
});
|
|
1046
|
+
}
|
|
1047
|
+
async function findSignalCliBinary(root) {
|
|
1048
|
+
const candidates = [];
|
|
1049
|
+
const enqueue = async (dir, depth) => {
|
|
1050
|
+
if (depth > 3) return;
|
|
1051
|
+
const entries = await fsp.readdir(dir, { withFileTypes: true }).catch(() => []);
|
|
1052
|
+
for (const entry of entries) {
|
|
1053
|
+
const full = path.join(dir, entry.name);
|
|
1054
|
+
if (entry.isDirectory()) await enqueue(full, depth + 1);
|
|
1055
|
+
else if (entry.isFile() && entry.name === "signal-cli") candidates.push(full);
|
|
1056
|
+
}
|
|
1057
|
+
};
|
|
1058
|
+
await enqueue(root, 0);
|
|
1059
|
+
return candidates[0] ?? null;
|
|
1060
|
+
}
|
|
1061
|
+
async function resolveBrewSignalCliPath(brewExe) {
|
|
1062
|
+
try {
|
|
1063
|
+
const result = await runCommandWithTimeout([
|
|
1064
|
+
brewExe,
|
|
1065
|
+
"--prefix",
|
|
1066
|
+
"signal-cli"
|
|
1067
|
+
], { timeoutMs: 1e4 });
|
|
1068
|
+
if (result.code === 0 && result.stdout.trim()) {
|
|
1069
|
+
const prefix = result.stdout.trim();
|
|
1070
|
+
const candidate = path.join(prefix, "bin", "signal-cli");
|
|
1071
|
+
try {
|
|
1072
|
+
await fsp.access(candidate);
|
|
1073
|
+
return candidate;
|
|
1074
|
+
} catch {
|
|
1075
|
+
return findSignalCliBinary(prefix);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
} catch {}
|
|
1079
|
+
return null;
|
|
1080
|
+
}
|
|
1081
|
+
async function installSignalCliViaBrew(runtime) {
|
|
1082
|
+
const brewExe = resolveBrewExecutable();
|
|
1083
|
+
if (!brewExe) return {
|
|
1084
|
+
ok: false,
|
|
1085
|
+
error: `No native signal-cli build is available for ${process.arch}. Install Homebrew (https://brew.sh) and try again, or install signal-cli manually.`
|
|
1086
|
+
};
|
|
1087
|
+
runtime.log(`Installing signal-cli via Homebrew (${brewExe})…`);
|
|
1088
|
+
const result = await runCommandWithTimeout([
|
|
1089
|
+
brewExe,
|
|
1090
|
+
"install",
|
|
1091
|
+
"signal-cli"
|
|
1092
|
+
], { timeoutMs: 15 * 6e4 });
|
|
1093
|
+
if (result.code !== 0) return {
|
|
1094
|
+
ok: false,
|
|
1095
|
+
error: `brew install signal-cli failed (exit ${result.code}): ${result.stderr.trim().slice(0, 200)}`
|
|
1096
|
+
};
|
|
1097
|
+
const cliPath = await resolveBrewSignalCliPath(brewExe);
|
|
1098
|
+
if (!cliPath) return {
|
|
1099
|
+
ok: false,
|
|
1100
|
+
error: "brew install succeeded but signal-cli binary was not found."
|
|
1101
|
+
};
|
|
1102
|
+
let version;
|
|
1103
|
+
try {
|
|
1104
|
+
version = (await runCommandWithTimeout([cliPath, "--version"], { timeoutMs: 1e4 })).stdout.trim().replace(/^signal-cli\s+/, "") || void 0;
|
|
1105
|
+
} catch {}
|
|
1106
|
+
return {
|
|
1107
|
+
ok: true,
|
|
1108
|
+
cliPath,
|
|
1109
|
+
version
|
|
1110
|
+
};
|
|
1111
|
+
}
|
|
1112
|
+
async function installSignalCliFromRelease(runtime) {
|
|
1113
|
+
const response = await fetch("https://api.github.com/repos/AsamK/signal-cli/releases/latest", { headers: {
|
|
1114
|
+
"User-Agent": "remoteclaw",
|
|
1115
|
+
Accept: "application/vnd.github+json"
|
|
1116
|
+
} });
|
|
1117
|
+
if (!response.ok) return {
|
|
1118
|
+
ok: false,
|
|
1119
|
+
error: `Failed to fetch release info (${response.status})`
|
|
1120
|
+
};
|
|
1121
|
+
const payload = await response.json();
|
|
1122
|
+
const version = payload.tag_name?.replace(/^v/, "") ?? "unknown";
|
|
1123
|
+
const asset = pickAsset(payload.assets ?? [], process.platform, process.arch);
|
|
1124
|
+
if (!asset) return {
|
|
1125
|
+
ok: false,
|
|
1126
|
+
error: "No compatible release asset found for this platform."
|
|
1127
|
+
};
|
|
1128
|
+
const tmpDir = await fsp.mkdtemp(path.join(os.tmpdir(), "remoteclaw-signal-"));
|
|
1129
|
+
const archivePath = path.join(tmpDir, asset.name);
|
|
1130
|
+
runtime.log(`Downloading signal-cli ${version} (${asset.name})…`);
|
|
1131
|
+
await downloadToFile(asset.browser_download_url, archivePath);
|
|
1132
|
+
const installRoot = path.join(CONFIG_DIR, "tools", "signal-cli", version);
|
|
1133
|
+
await fsp.mkdir(installRoot, { recursive: true });
|
|
1134
|
+
if (!looksLikeArchive(asset.name.toLowerCase())) return {
|
|
1135
|
+
ok: false,
|
|
1136
|
+
error: `Unsupported archive type: ${asset.name}`
|
|
1137
|
+
};
|
|
1138
|
+
try {
|
|
1139
|
+
await extractSignalCliArchive(archivePath, installRoot, 6e4);
|
|
1140
|
+
} catch (err) {
|
|
1141
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
1142
|
+
return {
|
|
1143
|
+
ok: false,
|
|
1144
|
+
error: `Failed to extract ${asset.name}: ${message}`
|
|
1145
|
+
};
|
|
1146
|
+
}
|
|
1147
|
+
const cliPath = await findSignalCliBinary(installRoot);
|
|
1148
|
+
if (!cliPath) return {
|
|
1149
|
+
ok: false,
|
|
1150
|
+
error: `signal-cli binary not found after extracting ${asset.name}`
|
|
1151
|
+
};
|
|
1152
|
+
await fsp.chmod(cliPath, 493).catch(() => {});
|
|
1153
|
+
return {
|
|
1154
|
+
ok: true,
|
|
1155
|
+
cliPath,
|
|
1156
|
+
version
|
|
1157
|
+
};
|
|
1158
|
+
}
|
|
1159
|
+
async function installSignalCli(runtime) {
|
|
1160
|
+
if (process.platform === "win32") return {
|
|
1161
|
+
ok: false,
|
|
1162
|
+
error: "Signal CLI auto-install is not supported on Windows yet."
|
|
1163
|
+
};
|
|
1164
|
+
if (process.platform !== "linux" || process.arch === "x64") return installSignalCliFromRelease(runtime);
|
|
1165
|
+
return installSignalCliViaBrew(runtime);
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
//#endregion
|
|
1169
|
+
//#region src/channels/plugins/onboarding/signal.ts
|
|
1170
|
+
const channel$3 = "signal";
|
|
1171
|
+
const MIN_E164_DIGITS = 5;
|
|
1172
|
+
const MAX_E164_DIGITS = 15;
|
|
1173
|
+
const DIGITS_ONLY = /^\d+$/;
|
|
1174
|
+
const INVALID_SIGNAL_ACCOUNT_ERROR = "Invalid E.164 phone number (must start with + and country code, e.g. +15555550123)";
|
|
1175
|
+
function normalizeSignalAccountInput(value) {
|
|
1176
|
+
const trimmed = value?.trim();
|
|
1177
|
+
if (!trimmed) return null;
|
|
1178
|
+
const digits = normalizeE164(trimmed).slice(1);
|
|
1179
|
+
if (!DIGITS_ONLY.test(digits)) return null;
|
|
1180
|
+
if (digits.length < MIN_E164_DIGITS || digits.length > MAX_E164_DIGITS) return null;
|
|
1181
|
+
return `+${digits}`;
|
|
1182
|
+
}
|
|
1183
|
+
function isUuidLike(value) {
|
|
1184
|
+
return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
|
|
1185
|
+
}
|
|
1186
|
+
function parseSignalAllowFromEntries(raw) {
|
|
1187
|
+
return parseOnboardingEntriesAllowingWildcard(raw, (entry) => {
|
|
1188
|
+
if (entry.toLowerCase().startsWith("uuid:")) {
|
|
1189
|
+
const id = entry.slice(5).trim();
|
|
1190
|
+
if (!id) return { error: "Invalid uuid entry" };
|
|
1191
|
+
return { value: `uuid:${id}` };
|
|
1192
|
+
}
|
|
1193
|
+
if (isUuidLike(entry)) return { value: `uuid:${entry}` };
|
|
1194
|
+
const normalized = normalizeSignalAccountInput(entry);
|
|
1195
|
+
if (!normalized) return { error: `Invalid entry: ${entry}` };
|
|
1196
|
+
return { value: normalized };
|
|
1197
|
+
});
|
|
1198
|
+
}
|
|
1199
|
+
async function promptSignalAllowFrom(params) {
|
|
1200
|
+
return promptParsedAllowFromForScopedChannel({
|
|
1201
|
+
cfg: params.cfg,
|
|
1202
|
+
channel: "signal",
|
|
1203
|
+
accountId: params.accountId,
|
|
1204
|
+
defaultAccountId: resolveDefaultSignalAccountId(params.cfg),
|
|
1205
|
+
prompter: params.prompter,
|
|
1206
|
+
noteTitle: "Signal allowlist",
|
|
1207
|
+
noteLines: [
|
|
1208
|
+
"Allowlist Signal DMs by sender id.",
|
|
1209
|
+
"Examples:",
|
|
1210
|
+
"- +15555550123",
|
|
1211
|
+
"- uuid:123e4567-e89b-12d3-a456-426614174000",
|
|
1212
|
+
"Multiple entries: comma-separated.",
|
|
1213
|
+
`Docs: ${formatDocsLink("/signal", "signal")}`
|
|
1214
|
+
],
|
|
1215
|
+
message: "Signal allowFrom (E.164 or uuid)",
|
|
1216
|
+
placeholder: "+15555550123, uuid:123e4567-e89b-12d3-a456-426614174000",
|
|
1217
|
+
parseEntries: parseSignalAllowFromEntries,
|
|
1218
|
+
getExistingAllowFrom: ({ cfg, accountId }) => {
|
|
1219
|
+
return resolveSignalAccount({
|
|
1220
|
+
cfg,
|
|
1221
|
+
accountId
|
|
1222
|
+
}).config.allowFrom ?? [];
|
|
1223
|
+
}
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
const dmPolicy$2 = {
|
|
1227
|
+
label: "Signal",
|
|
1228
|
+
channel: channel$3,
|
|
1229
|
+
policyKey: "channels.signal.dmPolicy",
|
|
1230
|
+
allowFromKey: "channels.signal.allowFrom",
|
|
1231
|
+
getCurrent: (cfg) => cfg.channels?.signal?.dmPolicy ?? "pairing",
|
|
1232
|
+
setPolicy: (cfg, policy) => setChannelDmPolicyWithAllowFrom({
|
|
1233
|
+
cfg,
|
|
1234
|
+
channel: "signal",
|
|
1235
|
+
dmPolicy: policy
|
|
1236
|
+
}),
|
|
1237
|
+
promptAllowFrom: promptSignalAllowFrom
|
|
1238
|
+
};
|
|
1239
|
+
const signalOnboardingAdapter = {
|
|
1240
|
+
channel: channel$3,
|
|
1241
|
+
getStatus: async ({ cfg }) => {
|
|
1242
|
+
const configured = listSignalAccountIds(cfg).some((accountId) => resolveSignalAccount({
|
|
1243
|
+
cfg,
|
|
1244
|
+
accountId
|
|
1245
|
+
}).configured);
|
|
1246
|
+
const signalCliPath = cfg.channels?.signal?.cliPath ?? "signal-cli";
|
|
1247
|
+
const signalCliDetected = await detectBinary(signalCliPath);
|
|
1248
|
+
return {
|
|
1249
|
+
channel: channel$3,
|
|
1250
|
+
configured,
|
|
1251
|
+
statusLines: [`Signal: ${configured ? "configured" : "needs setup"}`, `signal-cli: ${signalCliDetected ? "found" : "missing"} (${signalCliPath})`],
|
|
1252
|
+
selectionHint: signalCliDetected ? "signal-cli found" : "signal-cli missing",
|
|
1253
|
+
quickstartScore: signalCliDetected ? 1 : 0
|
|
1254
|
+
};
|
|
1255
|
+
},
|
|
1256
|
+
configure: async ({ cfg, runtime, prompter, accountOverrides, shouldPromptAccountIds, options }) => {
|
|
1257
|
+
const defaultSignalAccountId = resolveDefaultSignalAccountId(cfg);
|
|
1258
|
+
const signalAccountId = await resolveAccountIdForConfigure({
|
|
1259
|
+
cfg,
|
|
1260
|
+
prompter,
|
|
1261
|
+
label: "Signal",
|
|
1262
|
+
accountOverride: accountOverrides.signal,
|
|
1263
|
+
shouldPromptAccountIds,
|
|
1264
|
+
listAccountIds: listSignalAccountIds,
|
|
1265
|
+
defaultAccountId: defaultSignalAccountId
|
|
1266
|
+
});
|
|
1267
|
+
let next = cfg;
|
|
1268
|
+
const accountConfig = resolveSignalAccount({
|
|
1269
|
+
cfg: next,
|
|
1270
|
+
accountId: signalAccountId
|
|
1271
|
+
}).config;
|
|
1272
|
+
let resolvedCliPath = accountConfig.cliPath ?? "signal-cli";
|
|
1273
|
+
let cliDetected = await detectBinary(resolvedCliPath);
|
|
1274
|
+
if (options?.allowSignalInstall) {
|
|
1275
|
+
if (await prompter.confirm({
|
|
1276
|
+
message: cliDetected ? "signal-cli detected. Reinstall/update now?" : "signal-cli not found. Install now?",
|
|
1277
|
+
initialValue: !cliDetected
|
|
1278
|
+
})) try {
|
|
1279
|
+
const result = await installSignalCli(runtime);
|
|
1280
|
+
if (result.ok && result.cliPath) {
|
|
1281
|
+
cliDetected = true;
|
|
1282
|
+
resolvedCliPath = result.cliPath;
|
|
1283
|
+
await prompter.note(`Installed signal-cli at ${result.cliPath}`, "Signal");
|
|
1284
|
+
} else if (!result.ok) await prompter.note(result.error ?? "signal-cli install failed.", "Signal");
|
|
1285
|
+
} catch (err) {
|
|
1286
|
+
await prompter.note(`signal-cli install failed: ${String(err)}`, "Signal");
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
if (!cliDetected) await prompter.note("signal-cli not found. Install it, then rerun this step or set channels.signal.cliPath.", "Signal");
|
|
1290
|
+
let account = accountConfig.account ?? "";
|
|
1291
|
+
if (account) {
|
|
1292
|
+
const normalizedExisting = normalizeSignalAccountInput(account);
|
|
1293
|
+
if (!normalizedExisting) {
|
|
1294
|
+
await prompter.note("Existing Signal account isn't a valid E.164 number. Please enter it again.", "Signal");
|
|
1295
|
+
account = "";
|
|
1296
|
+
} else {
|
|
1297
|
+
account = normalizedExisting;
|
|
1298
|
+
if (!await prompter.confirm({
|
|
1299
|
+
message: `Signal account set (${account}). Keep it?`,
|
|
1300
|
+
initialValue: true
|
|
1301
|
+
})) account = "";
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
if (!account) account = normalizeSignalAccountInput(String(await prompter.text({
|
|
1305
|
+
message: "Signal bot number (E.164)",
|
|
1306
|
+
validate: (value) => normalizeSignalAccountInput(String(value ?? "")) ? void 0 : INVALID_SIGNAL_ACCOUNT_ERROR
|
|
1307
|
+
}))) ?? "";
|
|
1308
|
+
if (account) next = patchChannelConfigForAccount({
|
|
1309
|
+
cfg: next,
|
|
1310
|
+
channel: "signal",
|
|
1311
|
+
accountId: signalAccountId,
|
|
1312
|
+
patch: {
|
|
1313
|
+
account,
|
|
1314
|
+
cliPath: resolvedCliPath ?? "signal-cli"
|
|
1315
|
+
}
|
|
1316
|
+
});
|
|
1317
|
+
await prompter.note([
|
|
1318
|
+
"Link device with: signal-cli link -n \"RemoteClaw\"",
|
|
1319
|
+
"Scan QR in Signal → Linked Devices",
|
|
1320
|
+
`Then run: ${formatCliCommand("remoteclaw gateway call channels.status --params '{\"probe\":true}'")}`,
|
|
1321
|
+
`Docs: ${formatDocsLink("/signal", "signal")}`
|
|
1322
|
+
].join("\n"), "Signal next steps");
|
|
1323
|
+
return {
|
|
1324
|
+
cfg: next,
|
|
1325
|
+
accountId: signalAccountId
|
|
1326
|
+
};
|
|
1327
|
+
},
|
|
1328
|
+
dmPolicy: dmPolicy$2,
|
|
1329
|
+
disable: (cfg) => setOnboardingChannelEnabled(cfg, channel$3, false)
|
|
1330
|
+
};
|
|
1331
|
+
|
|
1332
|
+
//#endregion
|
|
1333
|
+
//#region src/channels/plugins/onboarding/slack.ts
|
|
1334
|
+
const channel$2 = "slack";
|
|
1335
|
+
function buildSlackManifest(botName) {
|
|
1336
|
+
const safeName = botName.trim() || "RemoteClaw";
|
|
1337
|
+
const manifest = {
|
|
1338
|
+
display_information: {
|
|
1339
|
+
name: safeName,
|
|
1340
|
+
description: `${safeName} connector for RemoteClaw`
|
|
1341
|
+
},
|
|
1342
|
+
features: {
|
|
1343
|
+
bot_user: {
|
|
1344
|
+
display_name: safeName,
|
|
1345
|
+
always_online: false
|
|
1346
|
+
},
|
|
1347
|
+
app_home: {
|
|
1348
|
+
messages_tab_enabled: true,
|
|
1349
|
+
messages_tab_read_only_enabled: false
|
|
1350
|
+
},
|
|
1351
|
+
slash_commands: [{
|
|
1352
|
+
command: "/remoteclaw",
|
|
1353
|
+
description: "Send a message to RemoteClaw",
|
|
1354
|
+
should_escape: false
|
|
1355
|
+
}]
|
|
1356
|
+
},
|
|
1357
|
+
oauth_config: { scopes: { bot: [
|
|
1358
|
+
"chat:write",
|
|
1359
|
+
"channels:history",
|
|
1360
|
+
"channels:read",
|
|
1361
|
+
"groups:history",
|
|
1362
|
+
"im:history",
|
|
1363
|
+
"mpim:history",
|
|
1364
|
+
"users:read",
|
|
1365
|
+
"app_mentions:read",
|
|
1366
|
+
"reactions:read",
|
|
1367
|
+
"reactions:write",
|
|
1368
|
+
"pins:read",
|
|
1369
|
+
"pins:write",
|
|
1370
|
+
"emoji:read",
|
|
1371
|
+
"commands",
|
|
1372
|
+
"files:read",
|
|
1373
|
+
"files:write"
|
|
1374
|
+
] } },
|
|
1375
|
+
settings: {
|
|
1376
|
+
socket_mode_enabled: true,
|
|
1377
|
+
event_subscriptions: { bot_events: [
|
|
1378
|
+
"app_mention",
|
|
1379
|
+
"message.channels",
|
|
1380
|
+
"message.groups",
|
|
1381
|
+
"message.im",
|
|
1382
|
+
"message.mpim",
|
|
1383
|
+
"reaction_added",
|
|
1384
|
+
"reaction_removed",
|
|
1385
|
+
"member_joined_channel",
|
|
1386
|
+
"member_left_channel",
|
|
1387
|
+
"channel_rename",
|
|
1388
|
+
"pin_added",
|
|
1389
|
+
"pin_removed"
|
|
1390
|
+
] }
|
|
1391
|
+
}
|
|
1392
|
+
};
|
|
1393
|
+
return JSON.stringify(manifest, null, 2);
|
|
1394
|
+
}
|
|
1395
|
+
async function noteSlackTokenHelp(prompter, botName) {
|
|
1396
|
+
const manifest = buildSlackManifest(botName);
|
|
1397
|
+
await prompter.note([
|
|
1398
|
+
"1) Slack API → Create App → From scratch",
|
|
1399
|
+
"2) Add Socket Mode + enable it to get the app-level token (xapp-...)",
|
|
1400
|
+
"3) OAuth & Permissions → install app to workspace (xoxb- bot token)",
|
|
1401
|
+
"4) Enable Event Subscriptions (socket) for message events",
|
|
1402
|
+
"5) App Home → enable the Messages tab for DMs",
|
|
1403
|
+
"Tip: set SLACK_BOT_TOKEN + SLACK_APP_TOKEN in your env.",
|
|
1404
|
+
`Docs: ${formatDocsLink("/slack", "slack")}`,
|
|
1405
|
+
"",
|
|
1406
|
+
"Manifest (JSON):",
|
|
1407
|
+
manifest
|
|
1408
|
+
].join("\n"), "Slack socket mode tokens");
|
|
1409
|
+
}
|
|
1410
|
+
async function promptSlackTokens(prompter) {
|
|
1411
|
+
return {
|
|
1412
|
+
botToken: String(await prompter.text({
|
|
1413
|
+
message: "Enter Slack bot token (xoxb-...)",
|
|
1414
|
+
validate: (value) => value?.trim() ? void 0 : "Required"
|
|
1415
|
+
})).trim(),
|
|
1416
|
+
appToken: String(await prompter.text({
|
|
1417
|
+
message: "Enter Slack app token (xapp-...)",
|
|
1418
|
+
validate: (value) => value?.trim() ? void 0 : "Required"
|
|
1419
|
+
})).trim()
|
|
1420
|
+
};
|
|
1421
|
+
}
|
|
1422
|
+
function setSlackChannelAllowlist(cfg, accountId, channelKeys) {
|
|
1423
|
+
return patchChannelConfigForAccount({
|
|
1424
|
+
cfg,
|
|
1425
|
+
channel: "slack",
|
|
1426
|
+
accountId,
|
|
1427
|
+
patch: { channels: Object.fromEntries(channelKeys.map((key) => [key, { allow: true }])) }
|
|
1428
|
+
});
|
|
1429
|
+
}
|
|
1430
|
+
async function promptSlackAllowFrom(params) {
|
|
1431
|
+
const accountId = resolveOnboardingAccountId({
|
|
1432
|
+
accountId: params.accountId,
|
|
1433
|
+
defaultAccountId: resolveDefaultSlackAccountId(params.cfg)
|
|
1434
|
+
});
|
|
1435
|
+
const resolved = resolveSlackAccount({
|
|
1436
|
+
cfg: params.cfg,
|
|
1437
|
+
accountId
|
|
1438
|
+
});
|
|
1439
|
+
const token = resolved.config.userToken ?? resolved.config.botToken ?? "";
|
|
1440
|
+
const existing = params.cfg.channels?.slack?.allowFrom ?? params.cfg.channels?.slack?.dm?.allowFrom ?? [];
|
|
1441
|
+
const parseId = (value) => parseMentionOrPrefixedId({
|
|
1442
|
+
value,
|
|
1443
|
+
mentionPattern: /^<@([A-Z0-9]+)>$/i,
|
|
1444
|
+
prefixPattern: /^(slack:|user:)/i,
|
|
1445
|
+
idPattern: /^[A-Z][A-Z0-9]+$/i,
|
|
1446
|
+
normalizeId: (id) => id.toUpperCase()
|
|
1447
|
+
});
|
|
1448
|
+
return promptLegacyChannelAllowFrom({
|
|
1449
|
+
cfg: params.cfg,
|
|
1450
|
+
channel: "slack",
|
|
1451
|
+
prompter: params.prompter,
|
|
1452
|
+
existing,
|
|
1453
|
+
token,
|
|
1454
|
+
noteTitle: "Slack allowlist",
|
|
1455
|
+
noteLines: [
|
|
1456
|
+
"Allowlist Slack DMs by username (we resolve to user ids).",
|
|
1457
|
+
"Examples:",
|
|
1458
|
+
"- U12345678",
|
|
1459
|
+
"- @alice",
|
|
1460
|
+
"Multiple entries: comma-separated.",
|
|
1461
|
+
`Docs: ${formatDocsLink("/slack", "slack")}`
|
|
1462
|
+
],
|
|
1463
|
+
message: "Slack allowFrom (usernames or ids)",
|
|
1464
|
+
placeholder: "@alice, U12345678",
|
|
1465
|
+
parseId,
|
|
1466
|
+
invalidWithoutTokenNote: "Slack token missing; use user ids (or mention form) only.",
|
|
1467
|
+
resolveEntries: ({ token, entries }) => resolveSlackUserAllowlist({
|
|
1468
|
+
token,
|
|
1469
|
+
entries
|
|
1470
|
+
})
|
|
1471
|
+
});
|
|
1472
|
+
}
|
|
1473
|
+
const dmPolicy$1 = {
|
|
1474
|
+
label: "Slack",
|
|
1475
|
+
channel: channel$2,
|
|
1476
|
+
policyKey: "channels.slack.dmPolicy",
|
|
1477
|
+
allowFromKey: "channels.slack.allowFrom",
|
|
1478
|
+
getCurrent: (cfg) => cfg.channels?.slack?.dmPolicy ?? cfg.channels?.slack?.dm?.policy ?? "pairing",
|
|
1479
|
+
setPolicy: (cfg, policy) => setLegacyChannelDmPolicyWithAllowFrom({
|
|
1480
|
+
cfg,
|
|
1481
|
+
channel: "slack",
|
|
1482
|
+
dmPolicy: policy
|
|
1483
|
+
}),
|
|
1484
|
+
promptAllowFrom: promptSlackAllowFrom
|
|
1485
|
+
};
|
|
1486
|
+
const slackOnboardingAdapter = {
|
|
1487
|
+
channel: channel$2,
|
|
1488
|
+
getStatus: async ({ cfg }) => {
|
|
1489
|
+
const configured = listSlackAccountIds(cfg).some((accountId) => {
|
|
1490
|
+
const account = resolveSlackAccount({
|
|
1491
|
+
cfg,
|
|
1492
|
+
accountId
|
|
1493
|
+
});
|
|
1494
|
+
return Boolean(account.botToken && account.appToken);
|
|
1495
|
+
});
|
|
1496
|
+
return {
|
|
1497
|
+
channel: channel$2,
|
|
1498
|
+
configured,
|
|
1499
|
+
statusLines: [`Slack: ${configured ? "configured" : "needs tokens"}`],
|
|
1500
|
+
selectionHint: configured ? "configured" : "needs tokens",
|
|
1501
|
+
quickstartScore: configured ? 2 : 1
|
|
1502
|
+
};
|
|
1503
|
+
},
|
|
1504
|
+
configure: async ({ cfg, prompter, accountOverrides, shouldPromptAccountIds }) => {
|
|
1505
|
+
const defaultSlackAccountId = resolveDefaultSlackAccountId(cfg);
|
|
1506
|
+
const slackAccountId = await resolveAccountIdForConfigure({
|
|
1507
|
+
cfg,
|
|
1508
|
+
prompter,
|
|
1509
|
+
label: "Slack",
|
|
1510
|
+
accountOverride: accountOverrides.slack,
|
|
1511
|
+
shouldPromptAccountIds,
|
|
1512
|
+
listAccountIds: listSlackAccountIds,
|
|
1513
|
+
defaultAccountId: defaultSlackAccountId
|
|
1514
|
+
});
|
|
1515
|
+
let next = cfg;
|
|
1516
|
+
const resolvedAccount = resolveSlackAccount({
|
|
1517
|
+
cfg: next,
|
|
1518
|
+
accountId: slackAccountId
|
|
1519
|
+
});
|
|
1520
|
+
const accountConfigured = Boolean(resolvedAccount.botToken && resolvedAccount.appToken);
|
|
1521
|
+
const canUseEnv = slackAccountId === DEFAULT_ACCOUNT_ID && Boolean(process.env.SLACK_BOT_TOKEN?.trim()) && Boolean(process.env.SLACK_APP_TOKEN?.trim());
|
|
1522
|
+
const hasConfigTokens = Boolean(resolvedAccount.config.botToken && resolvedAccount.config.appToken);
|
|
1523
|
+
let botToken = null;
|
|
1524
|
+
let appToken = null;
|
|
1525
|
+
const slackBotName = String(await prompter.text({
|
|
1526
|
+
message: "Slack bot display name (used for manifest)",
|
|
1527
|
+
initialValue: "RemoteClaw"
|
|
1528
|
+
})).trim();
|
|
1529
|
+
if (!accountConfigured) await noteSlackTokenHelp(prompter, slackBotName);
|
|
1530
|
+
if (canUseEnv && (!resolvedAccount.config.botToken || !resolvedAccount.config.appToken)) if (await prompter.confirm({
|
|
1531
|
+
message: "SLACK_BOT_TOKEN + SLACK_APP_TOKEN detected. Use env vars?",
|
|
1532
|
+
initialValue: true
|
|
1533
|
+
})) next = patchChannelConfigForAccount({
|
|
1534
|
+
cfg: next,
|
|
1535
|
+
channel: "slack",
|
|
1536
|
+
accountId: slackAccountId,
|
|
1537
|
+
patch: {}
|
|
1538
|
+
});
|
|
1539
|
+
else ({botToken, appToken} = await promptSlackTokens(prompter));
|
|
1540
|
+
else if (hasConfigTokens) {
|
|
1541
|
+
if (!await prompter.confirm({
|
|
1542
|
+
message: "Slack tokens already configured. Keep them?",
|
|
1543
|
+
initialValue: true
|
|
1544
|
+
})) ({botToken, appToken} = await promptSlackTokens(prompter));
|
|
1545
|
+
} else ({botToken, appToken} = await promptSlackTokens(prompter));
|
|
1546
|
+
if (botToken && appToken) next = patchChannelConfigForAccount({
|
|
1547
|
+
cfg: next,
|
|
1548
|
+
channel: "slack",
|
|
1549
|
+
accountId: slackAccountId,
|
|
1550
|
+
patch: {
|
|
1551
|
+
botToken,
|
|
1552
|
+
appToken
|
|
1553
|
+
}
|
|
1554
|
+
});
|
|
1555
|
+
next = await configureChannelAccessWithAllowlist({
|
|
1556
|
+
cfg: next,
|
|
1557
|
+
prompter,
|
|
1558
|
+
label: "Slack channels",
|
|
1559
|
+
currentPolicy: resolvedAccount.config.groupPolicy ?? "allowlist",
|
|
1560
|
+
currentEntries: Object.entries(resolvedAccount.config.channels ?? {}).filter(([, value]) => value?.allow !== false && value?.enabled !== false).map(([key]) => key),
|
|
1561
|
+
placeholder: "#general, #private, C123",
|
|
1562
|
+
updatePrompt: Boolean(resolvedAccount.config.channels),
|
|
1563
|
+
setPolicy: (cfg, policy) => setAccountGroupPolicyForChannel({
|
|
1564
|
+
cfg,
|
|
1565
|
+
channel: "slack",
|
|
1566
|
+
accountId: slackAccountId,
|
|
1567
|
+
groupPolicy: policy
|
|
1568
|
+
}),
|
|
1569
|
+
resolveAllowlist: async ({ cfg, entries }) => {
|
|
1570
|
+
let keys = entries;
|
|
1571
|
+
const accountWithTokens = resolveSlackAccount({
|
|
1572
|
+
cfg,
|
|
1573
|
+
accountId: slackAccountId
|
|
1574
|
+
});
|
|
1575
|
+
if (accountWithTokens.botToken && entries.length > 0) try {
|
|
1576
|
+
const resolved = await resolveSlackChannelAllowlist({
|
|
1577
|
+
token: accountWithTokens.botToken,
|
|
1578
|
+
entries
|
|
1579
|
+
});
|
|
1580
|
+
const resolvedKeys = resolved.filter((entry) => entry.resolved && entry.id).map((entry) => entry.id);
|
|
1581
|
+
const unresolved = resolved.filter((entry) => !entry.resolved).map((entry) => entry.input);
|
|
1582
|
+
keys = [...resolvedKeys, ...unresolved.map((entry) => entry.trim()).filter(Boolean)];
|
|
1583
|
+
await noteChannelLookupSummary({
|
|
1584
|
+
prompter,
|
|
1585
|
+
label: "Slack channels",
|
|
1586
|
+
resolvedSections: [{
|
|
1587
|
+
title: "Resolved",
|
|
1588
|
+
values: resolvedKeys
|
|
1589
|
+
}],
|
|
1590
|
+
unresolved
|
|
1591
|
+
});
|
|
1592
|
+
} catch (err) {
|
|
1593
|
+
await noteChannelLookupFailure({
|
|
1594
|
+
prompter,
|
|
1595
|
+
label: "Slack channels",
|
|
1596
|
+
error: err
|
|
1597
|
+
});
|
|
1598
|
+
}
|
|
1599
|
+
return keys;
|
|
1600
|
+
},
|
|
1601
|
+
applyAllowlist: ({ cfg, resolved }) => {
|
|
1602
|
+
return setSlackChannelAllowlist(cfg, slackAccountId, resolved);
|
|
1603
|
+
}
|
|
1604
|
+
});
|
|
1605
|
+
return {
|
|
1606
|
+
cfg: next,
|
|
1607
|
+
accountId: slackAccountId
|
|
1608
|
+
};
|
|
1609
|
+
},
|
|
1610
|
+
dmPolicy: dmPolicy$1,
|
|
1611
|
+
disable: (cfg) => setOnboardingChannelEnabled(cfg, channel$2, false)
|
|
1612
|
+
};
|
|
1613
|
+
|
|
1614
|
+
//#endregion
|
|
1615
|
+
//#region src/channels/plugins/onboarding/telegram.ts
|
|
1616
|
+
const channel$1 = "telegram";
|
|
1617
|
+
async function noteTelegramTokenHelp(prompter) {
|
|
1618
|
+
await prompter.note([
|
|
1619
|
+
"1) Open Telegram and chat with @BotFather",
|
|
1620
|
+
"2) Run /newbot (or /mybots)",
|
|
1621
|
+
"3) Copy the token (looks like 123456:ABC...)",
|
|
1622
|
+
"Tip: you can also set TELEGRAM_BOT_TOKEN in your env.",
|
|
1623
|
+
`Docs: ${formatDocsLink("/telegram")}`,
|
|
1624
|
+
"Website: https://remoteclaw.org"
|
|
1625
|
+
].join("\n"), "Telegram bot token");
|
|
1626
|
+
}
|
|
1627
|
+
async function noteTelegramUserIdHelp(prompter) {
|
|
1628
|
+
await prompter.note([
|
|
1629
|
+
`1) DM your bot, then read from.id in \`${formatCliCommand("remoteclaw logs --follow")}\` (safest)`,
|
|
1630
|
+
"2) Or call https://api.telegram.org/bot<bot_token>/getUpdates and read message.from.id",
|
|
1631
|
+
"3) Third-party: DM @userinfobot or @getidsbot",
|
|
1632
|
+
`Docs: ${formatDocsLink("/telegram")}`,
|
|
1633
|
+
"Website: https://remoteclaw.org"
|
|
1634
|
+
].join("\n"), "Telegram user id");
|
|
1635
|
+
}
|
|
1636
|
+
function normalizeTelegramAllowFromInput(raw) {
|
|
1637
|
+
return raw.trim().replace(/^(telegram|tg):/i, "").trim();
|
|
1638
|
+
}
|
|
1639
|
+
function parseTelegramAllowFromId(raw) {
|
|
1640
|
+
const stripped = normalizeTelegramAllowFromInput(raw);
|
|
1641
|
+
return /^\d+$/.test(stripped) ? stripped : null;
|
|
1642
|
+
}
|
|
1643
|
+
async function promptTelegramAllowFrom(params) {
|
|
1644
|
+
const { cfg, prompter, accountId } = params;
|
|
1645
|
+
const resolved = resolveTelegramAccount({
|
|
1646
|
+
cfg,
|
|
1647
|
+
accountId
|
|
1648
|
+
});
|
|
1649
|
+
const existingAllowFrom = resolved.config.allowFrom ?? [];
|
|
1650
|
+
await noteTelegramUserIdHelp(prompter);
|
|
1651
|
+
const token = resolved.token;
|
|
1652
|
+
if (!token) await prompter.note("Telegram token missing; username lookup is unavailable.", "Telegram");
|
|
1653
|
+
return patchChannelConfigForAccount({
|
|
1654
|
+
cfg,
|
|
1655
|
+
channel: "telegram",
|
|
1656
|
+
accountId,
|
|
1657
|
+
patch: {
|
|
1658
|
+
dmPolicy: "allowlist",
|
|
1659
|
+
allowFrom: await promptResolvedAllowFrom({
|
|
1660
|
+
prompter,
|
|
1661
|
+
existing: existingAllowFrom,
|
|
1662
|
+
token,
|
|
1663
|
+
message: "Telegram allowFrom (numeric sender id; @username resolves to id)",
|
|
1664
|
+
placeholder: "@username",
|
|
1665
|
+
label: "Telegram allowlist",
|
|
1666
|
+
parseInputs: splitOnboardingEntries,
|
|
1667
|
+
parseId: parseTelegramAllowFromId,
|
|
1668
|
+
invalidWithoutTokenNote: "Telegram token missing; use numeric sender ids (usernames require a bot token).",
|
|
1669
|
+
resolveEntries: async ({ token: tokenValue, entries }) => {
|
|
1670
|
+
return await Promise.all(entries.map(async (entry) => {
|
|
1671
|
+
const numericId = parseTelegramAllowFromId(entry);
|
|
1672
|
+
if (numericId) return {
|
|
1673
|
+
input: entry,
|
|
1674
|
+
resolved: true,
|
|
1675
|
+
id: numericId
|
|
1676
|
+
};
|
|
1677
|
+
const stripped = normalizeTelegramAllowFromInput(entry);
|
|
1678
|
+
if (!stripped) return {
|
|
1679
|
+
input: entry,
|
|
1680
|
+
resolved: false,
|
|
1681
|
+
id: null
|
|
1682
|
+
};
|
|
1683
|
+
const id = await fetchTelegramChatId({
|
|
1684
|
+
token: tokenValue,
|
|
1685
|
+
chatId: stripped.startsWith("@") ? stripped : `@${stripped}`
|
|
1686
|
+
});
|
|
1687
|
+
return {
|
|
1688
|
+
input: entry,
|
|
1689
|
+
resolved: Boolean(id),
|
|
1690
|
+
id
|
|
1691
|
+
};
|
|
1692
|
+
}));
|
|
1693
|
+
}
|
|
1694
|
+
})
|
|
1695
|
+
}
|
|
1696
|
+
});
|
|
1697
|
+
}
|
|
1698
|
+
async function promptTelegramAllowFromForAccount(params) {
|
|
1699
|
+
const accountId = resolveOnboardingAccountId({
|
|
1700
|
+
accountId: params.accountId,
|
|
1701
|
+
defaultAccountId: resolveDefaultTelegramAccountId(params.cfg)
|
|
1702
|
+
});
|
|
1703
|
+
return promptTelegramAllowFrom({
|
|
1704
|
+
cfg: params.cfg,
|
|
1705
|
+
prompter: params.prompter,
|
|
1706
|
+
accountId
|
|
1707
|
+
});
|
|
1708
|
+
}
|
|
1709
|
+
const dmPolicy = {
|
|
1710
|
+
label: "Telegram",
|
|
1711
|
+
channel: channel$1,
|
|
1712
|
+
policyKey: "channels.telegram.dmPolicy",
|
|
1713
|
+
allowFromKey: "channels.telegram.allowFrom",
|
|
1714
|
+
getCurrent: (cfg) => cfg.channels?.telegram?.dmPolicy ?? "pairing",
|
|
1715
|
+
setPolicy: (cfg, policy) => setChannelDmPolicyWithAllowFrom({
|
|
1716
|
+
cfg,
|
|
1717
|
+
channel: "telegram",
|
|
1718
|
+
dmPolicy: policy
|
|
1719
|
+
}),
|
|
1720
|
+
promptAllowFrom: promptTelegramAllowFromForAccount
|
|
1721
|
+
};
|
|
1722
|
+
const telegramOnboardingAdapter = {
|
|
1723
|
+
channel: channel$1,
|
|
1724
|
+
getStatus: async ({ cfg }) => {
|
|
1725
|
+
const configured = listTelegramAccountIds(cfg).some((accountId) => Boolean(resolveTelegramAccount({
|
|
1726
|
+
cfg,
|
|
1727
|
+
accountId
|
|
1728
|
+
}).token));
|
|
1729
|
+
return {
|
|
1730
|
+
channel: channel$1,
|
|
1731
|
+
configured,
|
|
1732
|
+
statusLines: [`Telegram: ${configured ? "configured" : "needs token"}`],
|
|
1733
|
+
selectionHint: configured ? "recommended · configured" : "recommended · newcomer-friendly",
|
|
1734
|
+
quickstartScore: configured ? 1 : 10
|
|
1735
|
+
};
|
|
1736
|
+
},
|
|
1737
|
+
configure: async ({ cfg, prompter, accountOverrides, shouldPromptAccountIds, forceAllowFrom }) => {
|
|
1738
|
+
const defaultTelegramAccountId = resolveDefaultTelegramAccountId(cfg);
|
|
1739
|
+
const telegramAccountId = await resolveAccountIdForConfigure({
|
|
1740
|
+
cfg,
|
|
1741
|
+
prompter,
|
|
1742
|
+
label: "Telegram",
|
|
1743
|
+
accountOverride: accountOverrides.telegram,
|
|
1744
|
+
shouldPromptAccountIds,
|
|
1745
|
+
listAccountIds: listTelegramAccountIds,
|
|
1746
|
+
defaultAccountId: defaultTelegramAccountId
|
|
1747
|
+
});
|
|
1748
|
+
let next = cfg;
|
|
1749
|
+
const resolvedAccount = resolveTelegramAccount({
|
|
1750
|
+
cfg: next,
|
|
1751
|
+
accountId: telegramAccountId
|
|
1752
|
+
});
|
|
1753
|
+
const accountConfigured = Boolean(resolvedAccount.token);
|
|
1754
|
+
const canUseEnv = telegramAccountId === DEFAULT_ACCOUNT_ID && !resolvedAccount.config.botToken && Boolean(process.env.TELEGRAM_BOT_TOKEN?.trim());
|
|
1755
|
+
const hasConfigToken = Boolean(resolvedAccount.config.botToken || resolvedAccount.config.tokenFile);
|
|
1756
|
+
if (!accountConfigured) await noteTelegramTokenHelp(prompter);
|
|
1757
|
+
const tokenResult = await promptSingleChannelToken({
|
|
1758
|
+
prompter,
|
|
1759
|
+
accountConfigured,
|
|
1760
|
+
canUseEnv,
|
|
1761
|
+
hasConfigToken,
|
|
1762
|
+
envPrompt: "TELEGRAM_BOT_TOKEN detected. Use env var?",
|
|
1763
|
+
keepPrompt: "Telegram token already configured. Keep it?",
|
|
1764
|
+
inputPrompt: "Enter Telegram bot token"
|
|
1765
|
+
});
|
|
1766
|
+
next = applySingleTokenPromptResult({
|
|
1767
|
+
cfg: next,
|
|
1768
|
+
channel: "telegram",
|
|
1769
|
+
accountId: telegramAccountId,
|
|
1770
|
+
tokenPatchKey: "botToken",
|
|
1771
|
+
tokenResult
|
|
1772
|
+
});
|
|
1773
|
+
if (forceAllowFrom) next = await promptTelegramAllowFrom({
|
|
1774
|
+
cfg: next,
|
|
1775
|
+
prompter,
|
|
1776
|
+
accountId: telegramAccountId
|
|
1777
|
+
});
|
|
1778
|
+
return {
|
|
1779
|
+
cfg: next,
|
|
1780
|
+
accountId: telegramAccountId
|
|
1781
|
+
};
|
|
1782
|
+
},
|
|
1783
|
+
dmPolicy,
|
|
1784
|
+
disable: (cfg) => setOnboardingChannelEnabled(cfg, channel$1, false)
|
|
1785
|
+
};
|
|
1786
|
+
|
|
1787
|
+
//#endregion
|
|
1788
|
+
//#region src/config/merge-config.ts
|
|
1789
|
+
function mergeConfigSection(base, patch, options = {}) {
|
|
1790
|
+
const next = { ...base ?? void 0 };
|
|
1791
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
1792
|
+
if (value === void 0) {
|
|
1793
|
+
if (options.unsetOnUndefined?.includes(key)) delete next[key];
|
|
1794
|
+
continue;
|
|
1795
|
+
}
|
|
1796
|
+
next[key] = value;
|
|
1797
|
+
}
|
|
1798
|
+
return next;
|
|
1799
|
+
}
|
|
1800
|
+
function mergeWhatsAppConfig(cfg, patch, options) {
|
|
1801
|
+
return {
|
|
1802
|
+
...cfg,
|
|
1803
|
+
channels: {
|
|
1804
|
+
...cfg.channels,
|
|
1805
|
+
whatsapp: mergeConfigSection(cfg.channels?.whatsapp, patch, options)
|
|
1806
|
+
}
|
|
1807
|
+
};
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
//#endregion
|
|
1811
|
+
//#region src/channels/plugins/onboarding/whatsapp.ts
|
|
1812
|
+
const channel = "whatsapp";
|
|
1813
|
+
function setWhatsAppDmPolicy(cfg, dmPolicy) {
|
|
1814
|
+
return mergeWhatsAppConfig(cfg, { dmPolicy });
|
|
1815
|
+
}
|
|
1816
|
+
function setWhatsAppAllowFrom(cfg, allowFrom) {
|
|
1817
|
+
return mergeWhatsAppConfig(cfg, { allowFrom }, { unsetOnUndefined: ["allowFrom"] });
|
|
1818
|
+
}
|
|
1819
|
+
function setWhatsAppSelfChatMode(cfg, selfChatMode) {
|
|
1820
|
+
return mergeWhatsAppConfig(cfg, { selfChatMode });
|
|
1821
|
+
}
|
|
1822
|
+
async function detectWhatsAppLinked(cfg, accountId) {
|
|
1823
|
+
const { authDir } = resolveWhatsAppAuthDir({
|
|
1824
|
+
cfg,
|
|
1825
|
+
accountId
|
|
1826
|
+
});
|
|
1827
|
+
return await pathExists(path.join(authDir, "creds.json"));
|
|
1828
|
+
}
|
|
1829
|
+
async function promptWhatsAppOwnerAllowFrom(params) {
|
|
1830
|
+
const { prompter, existingAllowFrom } = params;
|
|
1831
|
+
await prompter.note("We need the sender/owner number so RemoteClaw can allowlist you.", "WhatsApp number");
|
|
1832
|
+
const entry = await prompter.text({
|
|
1833
|
+
message: "Your personal WhatsApp number (the phone you will message from)",
|
|
1834
|
+
placeholder: "+15555550123",
|
|
1835
|
+
initialValue: existingAllowFrom[0],
|
|
1836
|
+
validate: (value) => {
|
|
1837
|
+
const raw = String(value ?? "").trim();
|
|
1838
|
+
if (!raw) return "Required";
|
|
1839
|
+
if (!normalizeE164(raw)) return `Invalid number: ${raw}`;
|
|
1840
|
+
}
|
|
1841
|
+
});
|
|
1842
|
+
const normalized = normalizeE164(String(entry).trim());
|
|
1843
|
+
if (!normalized) throw new Error("Invalid WhatsApp owner number (expected E.164 after validation).");
|
|
1844
|
+
return {
|
|
1845
|
+
normalized,
|
|
1846
|
+
allowFrom: normalizeAllowFromEntries([...existingAllowFrom.filter((item) => item !== "*"), normalized], normalizeE164)
|
|
1847
|
+
};
|
|
1848
|
+
}
|
|
1849
|
+
async function applyWhatsAppOwnerAllowlist(params) {
|
|
1850
|
+
const { normalized, allowFrom } = await promptWhatsAppOwnerAllowFrom({
|
|
1851
|
+
prompter: params.prompter,
|
|
1852
|
+
existingAllowFrom: params.existingAllowFrom
|
|
1853
|
+
});
|
|
1854
|
+
let next = setWhatsAppSelfChatMode(params.cfg, true);
|
|
1855
|
+
next = setWhatsAppDmPolicy(next, "allowlist");
|
|
1856
|
+
next = setWhatsAppAllowFrom(next, allowFrom);
|
|
1857
|
+
await params.prompter.note([...params.messageLines, `- allowFrom includes ${normalized}`].join("\n"), params.title);
|
|
1858
|
+
return next;
|
|
1859
|
+
}
|
|
1860
|
+
function parseWhatsAppAllowFromEntries(raw) {
|
|
1861
|
+
const parts = splitOnboardingEntries(raw);
|
|
1862
|
+
if (parts.length === 0) return { entries: [] };
|
|
1863
|
+
const entries = [];
|
|
1864
|
+
for (const part of parts) {
|
|
1865
|
+
if (part === "*") {
|
|
1866
|
+
entries.push("*");
|
|
1867
|
+
continue;
|
|
1868
|
+
}
|
|
1869
|
+
const normalized = normalizeE164(part);
|
|
1870
|
+
if (!normalized) return {
|
|
1871
|
+
entries: [],
|
|
1872
|
+
invalidEntry: part
|
|
1873
|
+
};
|
|
1874
|
+
entries.push(normalized);
|
|
1875
|
+
}
|
|
1876
|
+
return { entries: normalizeAllowFromEntries(entries, normalizeE164) };
|
|
1877
|
+
}
|
|
1878
|
+
async function promptWhatsAppAllowFrom(cfg, _runtime, prompter, options) {
|
|
1879
|
+
const existingPolicy = cfg.channels?.whatsapp?.dmPolicy ?? "pairing";
|
|
1880
|
+
const existingAllowFrom = cfg.channels?.whatsapp?.allowFrom ?? [];
|
|
1881
|
+
const existingLabel = existingAllowFrom.length > 0 ? existingAllowFrom.join(", ") : "unset";
|
|
1882
|
+
if (options?.forceAllowlist) return await applyWhatsAppOwnerAllowlist({
|
|
1883
|
+
cfg,
|
|
1884
|
+
prompter,
|
|
1885
|
+
existingAllowFrom,
|
|
1886
|
+
title: "WhatsApp allowlist",
|
|
1887
|
+
messageLines: ["Allowlist mode enabled."]
|
|
1888
|
+
});
|
|
1889
|
+
await prompter.note([
|
|
1890
|
+
"WhatsApp direct chats are gated by `channels.whatsapp.dmPolicy` + `channels.whatsapp.allowFrom`.",
|
|
1891
|
+
"- pairing (default): unknown senders get a pairing code; owner approves",
|
|
1892
|
+
"- allowlist: unknown senders are blocked",
|
|
1893
|
+
"- open: public inbound DMs (requires allowFrom to include \"*\")",
|
|
1894
|
+
"- disabled: ignore WhatsApp DMs",
|
|
1895
|
+
"",
|
|
1896
|
+
`Current: dmPolicy=${existingPolicy}, allowFrom=${existingLabel}`,
|
|
1897
|
+
`Docs: ${formatDocsLink("/whatsapp", "whatsapp")}`
|
|
1898
|
+
].join("\n"), "WhatsApp DM access");
|
|
1899
|
+
if (await prompter.select({
|
|
1900
|
+
message: "WhatsApp phone setup",
|
|
1901
|
+
options: [{
|
|
1902
|
+
value: "personal",
|
|
1903
|
+
label: "This is my personal phone number"
|
|
1904
|
+
}, {
|
|
1905
|
+
value: "separate",
|
|
1906
|
+
label: "Separate phone just for RemoteClaw"
|
|
1907
|
+
}]
|
|
1908
|
+
}) === "personal") return await applyWhatsAppOwnerAllowlist({
|
|
1909
|
+
cfg,
|
|
1910
|
+
prompter,
|
|
1911
|
+
existingAllowFrom,
|
|
1912
|
+
title: "WhatsApp personal phone",
|
|
1913
|
+
messageLines: ["Personal phone mode enabled.", "- dmPolicy set to allowlist (pairing skipped)"]
|
|
1914
|
+
});
|
|
1915
|
+
const policy = await prompter.select({
|
|
1916
|
+
message: "WhatsApp DM policy",
|
|
1917
|
+
options: [
|
|
1918
|
+
{
|
|
1919
|
+
value: "pairing",
|
|
1920
|
+
label: "Pairing (recommended)"
|
|
1921
|
+
},
|
|
1922
|
+
{
|
|
1923
|
+
value: "allowlist",
|
|
1924
|
+
label: "Allowlist only (block unknown senders)"
|
|
1925
|
+
},
|
|
1926
|
+
{
|
|
1927
|
+
value: "open",
|
|
1928
|
+
label: "Open (public inbound DMs)"
|
|
1929
|
+
},
|
|
1930
|
+
{
|
|
1931
|
+
value: "disabled",
|
|
1932
|
+
label: "Disabled (ignore WhatsApp DMs)"
|
|
1933
|
+
}
|
|
1934
|
+
]
|
|
1935
|
+
});
|
|
1936
|
+
let next = setWhatsAppSelfChatMode(cfg, false);
|
|
1937
|
+
next = setWhatsAppDmPolicy(next, policy);
|
|
1938
|
+
if (policy === "open") {
|
|
1939
|
+
const allowFrom = normalizeAllowFromEntries(["*", ...existingAllowFrom], normalizeE164);
|
|
1940
|
+
next = setWhatsAppAllowFrom(next, allowFrom.length > 0 ? allowFrom : ["*"]);
|
|
1941
|
+
return next;
|
|
1942
|
+
}
|
|
1943
|
+
if (policy === "disabled") return next;
|
|
1944
|
+
const allowOptions = existingAllowFrom.length > 0 ? [
|
|
1945
|
+
{
|
|
1946
|
+
value: "keep",
|
|
1947
|
+
label: "Keep current allowFrom"
|
|
1948
|
+
},
|
|
1949
|
+
{
|
|
1950
|
+
value: "unset",
|
|
1951
|
+
label: "Unset allowFrom (use pairing approvals only)"
|
|
1952
|
+
},
|
|
1953
|
+
{
|
|
1954
|
+
value: "list",
|
|
1955
|
+
label: "Set allowFrom to specific numbers"
|
|
1956
|
+
}
|
|
1957
|
+
] : [{
|
|
1958
|
+
value: "unset",
|
|
1959
|
+
label: "Unset allowFrom (default)"
|
|
1960
|
+
}, {
|
|
1961
|
+
value: "list",
|
|
1962
|
+
label: "Set allowFrom to specific numbers"
|
|
1963
|
+
}];
|
|
1964
|
+
const mode = await prompter.select({
|
|
1965
|
+
message: "WhatsApp allowFrom (optional pre-allowlist)",
|
|
1966
|
+
options: allowOptions.map((opt) => ({
|
|
1967
|
+
value: opt.value,
|
|
1968
|
+
label: opt.label
|
|
1969
|
+
}))
|
|
1970
|
+
});
|
|
1971
|
+
if (mode === "keep") {} else if (mode === "unset") next = setWhatsAppAllowFrom(next, void 0);
|
|
1972
|
+
else {
|
|
1973
|
+
const allowRaw = await prompter.text({
|
|
1974
|
+
message: "Allowed sender numbers (comma-separated, E.164)",
|
|
1975
|
+
placeholder: "+15555550123, +447700900123",
|
|
1976
|
+
validate: (value) => {
|
|
1977
|
+
const raw = String(value ?? "").trim();
|
|
1978
|
+
if (!raw) return "Required";
|
|
1979
|
+
const parsed = parseWhatsAppAllowFromEntries(raw);
|
|
1980
|
+
if (parsed.entries.length === 0 && !parsed.invalidEntry) return "Required";
|
|
1981
|
+
if (parsed.invalidEntry) return `Invalid number: ${parsed.invalidEntry}`;
|
|
1982
|
+
}
|
|
1983
|
+
});
|
|
1984
|
+
const parsed = parseWhatsAppAllowFromEntries(String(allowRaw));
|
|
1985
|
+
next = setWhatsAppAllowFrom(next, parsed.entries);
|
|
1986
|
+
}
|
|
1987
|
+
return next;
|
|
1988
|
+
}
|
|
1989
|
+
const whatsappOnboardingAdapter = {
|
|
1990
|
+
channel,
|
|
1991
|
+
getStatus: async ({ cfg, accountOverrides }) => {
|
|
1992
|
+
const defaultAccountId = resolveDefaultWhatsAppAccountId(cfg);
|
|
1993
|
+
const accountId = resolveOnboardingAccountId({
|
|
1994
|
+
accountId: accountOverrides.whatsapp,
|
|
1995
|
+
defaultAccountId
|
|
1996
|
+
});
|
|
1997
|
+
const linked = await detectWhatsAppLinked(cfg, accountId);
|
|
1998
|
+
return {
|
|
1999
|
+
channel,
|
|
2000
|
+
configured: linked,
|
|
2001
|
+
statusLines: [`WhatsApp (${accountId === DEFAULT_ACCOUNT_ID ? "default" : accountId}): ${linked ? "linked" : "not linked"}`],
|
|
2002
|
+
selectionHint: linked ? "linked" : "not linked",
|
|
2003
|
+
quickstartScore: linked ? 5 : 4
|
|
2004
|
+
};
|
|
2005
|
+
},
|
|
2006
|
+
configure: async ({ cfg, runtime, prompter, options, accountOverrides, shouldPromptAccountIds, forceAllowFrom }) => {
|
|
2007
|
+
const accountId = await resolveAccountIdForConfigure({
|
|
2008
|
+
cfg,
|
|
2009
|
+
prompter,
|
|
2010
|
+
label: "WhatsApp",
|
|
2011
|
+
accountOverride: accountOverrides.whatsapp,
|
|
2012
|
+
shouldPromptAccountIds: Boolean(shouldPromptAccountIds || options?.promptWhatsAppAccountId),
|
|
2013
|
+
listAccountIds: listWhatsAppAccountIds,
|
|
2014
|
+
defaultAccountId: resolveDefaultWhatsAppAccountId(cfg)
|
|
2015
|
+
});
|
|
2016
|
+
let next = cfg;
|
|
2017
|
+
if (accountId !== DEFAULT_ACCOUNT_ID) next = {
|
|
2018
|
+
...next,
|
|
2019
|
+
channels: {
|
|
2020
|
+
...next.channels,
|
|
2021
|
+
whatsapp: {
|
|
2022
|
+
...next.channels?.whatsapp,
|
|
2023
|
+
accounts: {
|
|
2024
|
+
...next.channels?.whatsapp?.accounts,
|
|
2025
|
+
[accountId]: {
|
|
2026
|
+
...next.channels?.whatsapp?.accounts?.[accountId],
|
|
2027
|
+
enabled: next.channels?.whatsapp?.accounts?.[accountId]?.enabled ?? true
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
2032
|
+
};
|
|
2033
|
+
const linked = await detectWhatsAppLinked(next, accountId);
|
|
2034
|
+
const { authDir } = resolveWhatsAppAuthDir({
|
|
2035
|
+
cfg: next,
|
|
2036
|
+
accountId
|
|
2037
|
+
});
|
|
2038
|
+
if (!linked) await prompter.note([
|
|
2039
|
+
"Scan the QR with WhatsApp on your phone.",
|
|
2040
|
+
`Credentials are stored under ${authDir}/ for future runs.`,
|
|
2041
|
+
`Docs: ${formatDocsLink("/whatsapp", "whatsapp")}`
|
|
2042
|
+
].join("\n"), "WhatsApp linking");
|
|
2043
|
+
if (await prompter.confirm({
|
|
2044
|
+
message: linked ? "WhatsApp already linked. Re-link now?" : "Link WhatsApp now (QR)?",
|
|
2045
|
+
initialValue: !linked
|
|
2046
|
+
})) try {
|
|
2047
|
+
await loginWeb(false, void 0, runtime, accountId);
|
|
2048
|
+
} catch (err) {
|
|
2049
|
+
runtime.error(`WhatsApp login failed: ${String(err)}`);
|
|
2050
|
+
await prompter.note(`Docs: ${formatDocsLink("/whatsapp", "whatsapp")}`, "WhatsApp help");
|
|
2051
|
+
}
|
|
2052
|
+
else if (!linked) await prompter.note(`Run \`${formatCliCommand("remoteclaw channels login")}\` later to link WhatsApp.`, "WhatsApp");
|
|
2053
|
+
next = await promptWhatsAppAllowFrom(next, runtime, prompter, { forceAllowlist: forceAllowFrom });
|
|
2054
|
+
return {
|
|
2055
|
+
cfg: next,
|
|
2056
|
+
accountId
|
|
2057
|
+
};
|
|
2058
|
+
},
|
|
2059
|
+
onAccountRecorded: (accountId, options) => {
|
|
2060
|
+
options?.onWhatsAppAccountId?.(accountId);
|
|
2061
|
+
}
|
|
2062
|
+
};
|
|
2063
|
+
|
|
2064
|
+
//#endregion
|
|
2065
|
+
//#region src/commands/onboarding/registry.ts
|
|
2066
|
+
const BUILTIN_ONBOARDING_ADAPTERS = [
|
|
2067
|
+
telegramOnboardingAdapter,
|
|
2068
|
+
whatsappOnboardingAdapter,
|
|
2069
|
+
discordOnboardingAdapter,
|
|
2070
|
+
slackOnboardingAdapter,
|
|
2071
|
+
signalOnboardingAdapter,
|
|
2072
|
+
imessageOnboardingAdapter
|
|
2073
|
+
];
|
|
2074
|
+
const CHANNEL_ONBOARDING_ADAPTERS = () => {
|
|
2075
|
+
const fromRegistry = listChannelPlugins().map((plugin) => plugin.onboarding ? [plugin.id, plugin.onboarding] : null).filter((entry) => Boolean(entry));
|
|
2076
|
+
const fromBuiltins = BUILTIN_ONBOARDING_ADAPTERS.map((adapter) => [adapter.channel, adapter]);
|
|
2077
|
+
return new Map([...fromBuiltins, ...fromRegistry]);
|
|
2078
|
+
};
|
|
2079
|
+
function getChannelOnboardingAdapter(channel) {
|
|
2080
|
+
return CHANNEL_ONBOARDING_ADAPTERS().get(channel);
|
|
2081
|
+
}
|
|
2082
|
+
function listChannelOnboardingAdapters() {
|
|
2083
|
+
return Array.from(CHANNEL_ONBOARDING_ADAPTERS().values());
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
//#endregion
|
|
2087
|
+
//#region src/commands/onboard-channels.ts
|
|
2088
|
+
var onboard_channels_exports = /* @__PURE__ */ __exportAll({
|
|
2089
|
+
noteChannelStatus: () => noteChannelStatus,
|
|
2090
|
+
setupChannels: () => setupChannels
|
|
2091
|
+
});
|
|
2092
|
+
function formatAccountLabel(accountId) {
|
|
2093
|
+
return accountId === DEFAULT_ACCOUNT_ID ? "default (primary)" : accountId;
|
|
2094
|
+
}
|
|
2095
|
+
async function promptConfiguredAction(params) {
|
|
2096
|
+
const { prompter, label, supportsDisable, supportsDelete } = params;
|
|
2097
|
+
const updateOption = {
|
|
2098
|
+
value: "update",
|
|
2099
|
+
label: "Modify settings"
|
|
2100
|
+
};
|
|
2101
|
+
const disableOption = {
|
|
2102
|
+
value: "disable",
|
|
2103
|
+
label: "Disable (keeps config)"
|
|
2104
|
+
};
|
|
2105
|
+
const deleteOption = {
|
|
2106
|
+
value: "delete",
|
|
2107
|
+
label: "Delete config"
|
|
2108
|
+
};
|
|
2109
|
+
const skipOption = {
|
|
2110
|
+
value: "skip",
|
|
2111
|
+
label: "Skip (leave as-is)"
|
|
2112
|
+
};
|
|
2113
|
+
const options = [
|
|
2114
|
+
updateOption,
|
|
2115
|
+
...supportsDisable ? [disableOption] : [],
|
|
2116
|
+
...supportsDelete ? [deleteOption] : [],
|
|
2117
|
+
skipOption
|
|
2118
|
+
];
|
|
2119
|
+
return await prompter.select({
|
|
2120
|
+
message: `${label} already configured. What do you want to do?`,
|
|
2121
|
+
options,
|
|
2122
|
+
initialValue: "update"
|
|
2123
|
+
});
|
|
2124
|
+
}
|
|
2125
|
+
async function promptRemovalAccountId(params) {
|
|
2126
|
+
const { cfg, prompter, label, channel } = params;
|
|
2127
|
+
const plugin = getChannelPlugin(channel);
|
|
2128
|
+
if (!plugin) return DEFAULT_ACCOUNT_ID;
|
|
2129
|
+
const accountIds = plugin.config.listAccountIds(cfg).filter(Boolean);
|
|
2130
|
+
const defaultAccountId = resolveChannelDefaultAccountId({
|
|
2131
|
+
plugin,
|
|
2132
|
+
cfg,
|
|
2133
|
+
accountIds
|
|
2134
|
+
});
|
|
2135
|
+
if (accountIds.length <= 1) return defaultAccountId;
|
|
2136
|
+
return normalizeAccountId(await prompter.select({
|
|
2137
|
+
message: `${label} account`,
|
|
2138
|
+
options: accountIds.map((accountId) => ({
|
|
2139
|
+
value: accountId,
|
|
2140
|
+
label: formatAccountLabel(accountId)
|
|
2141
|
+
})),
|
|
2142
|
+
initialValue: defaultAccountId
|
|
2143
|
+
})) ?? defaultAccountId;
|
|
2144
|
+
}
|
|
2145
|
+
async function collectChannelStatus(params) {
|
|
2146
|
+
const installedPlugins = listChannelPlugins();
|
|
2147
|
+
const installedIds = new Set(installedPlugins.map((plugin) => plugin.id));
|
|
2148
|
+
const catalogEntries = listChannelPluginCatalogEntries({ workspaceDir: resolveAgentWorkspaceDir(params.cfg, resolveDefaultAgentId(params.cfg)) }).filter((entry) => !installedIds.has(entry.id));
|
|
2149
|
+
const statusEntries = await Promise.all(listChannelOnboardingAdapters().map((adapter) => adapter.getStatus({
|
|
2150
|
+
cfg: params.cfg,
|
|
2151
|
+
options: params.options,
|
|
2152
|
+
accountOverrides: params.accountOverrides
|
|
2153
|
+
})));
|
|
2154
|
+
const statusByChannel = new Map(statusEntries.map((entry) => [entry.channel, entry]));
|
|
2155
|
+
const fallbackStatuses = listChatChannels().filter((meta) => !statusByChannel.has(meta.id)).map((meta) => {
|
|
2156
|
+
const configured = isChannelConfigured(params.cfg, meta.id);
|
|
2157
|
+
const statusLabel = configured ? "configured (plugin disabled)" : "not configured";
|
|
2158
|
+
return {
|
|
2159
|
+
channel: meta.id,
|
|
2160
|
+
configured,
|
|
2161
|
+
statusLines: [`${meta.label}: ${statusLabel}`],
|
|
2162
|
+
selectionHint: configured ? "configured · plugin disabled" : "not configured",
|
|
2163
|
+
quickstartScore: 0
|
|
2164
|
+
};
|
|
2165
|
+
});
|
|
2166
|
+
const catalogStatuses = catalogEntries.map((entry) => ({
|
|
2167
|
+
channel: entry.id,
|
|
2168
|
+
configured: false,
|
|
2169
|
+
statusLines: [`${entry.meta.label}: install plugin to enable`],
|
|
2170
|
+
selectionHint: "plugin · install",
|
|
2171
|
+
quickstartScore: 0
|
|
2172
|
+
}));
|
|
2173
|
+
const combinedStatuses = [
|
|
2174
|
+
...statusEntries,
|
|
2175
|
+
...fallbackStatuses,
|
|
2176
|
+
...catalogStatuses
|
|
2177
|
+
];
|
|
2178
|
+
return {
|
|
2179
|
+
installedPlugins,
|
|
2180
|
+
catalogEntries,
|
|
2181
|
+
statusByChannel: new Map(combinedStatuses.map((entry) => [entry.channel, entry])),
|
|
2182
|
+
statusLines: combinedStatuses.flatMap((entry) => entry.statusLines)
|
|
2183
|
+
};
|
|
2184
|
+
}
|
|
2185
|
+
async function noteChannelStatus(params) {
|
|
2186
|
+
const { statusLines } = await collectChannelStatus({
|
|
2187
|
+
cfg: params.cfg,
|
|
2188
|
+
options: params.options,
|
|
2189
|
+
accountOverrides: params.accountOverrides ?? {}
|
|
2190
|
+
});
|
|
2191
|
+
if (statusLines.length > 0) await params.prompter.note(statusLines.join("\n"), "Channel status");
|
|
2192
|
+
}
|
|
2193
|
+
async function noteChannelPrimer(prompter, channels) {
|
|
2194
|
+
const channelLines = channels.map((channel) => formatChannelPrimerLine({
|
|
2195
|
+
id: channel.id,
|
|
2196
|
+
label: channel.label,
|
|
2197
|
+
selectionLabel: channel.label,
|
|
2198
|
+
docsPath: "/",
|
|
2199
|
+
blurb: channel.blurb
|
|
2200
|
+
}));
|
|
2201
|
+
await prompter.note([
|
|
2202
|
+
"DM security: default is pairing; unknown DMs get a pairing code.",
|
|
2203
|
+
`Approve with: ${formatCliCommand("remoteclaw pairing approve <channel> <code>")}`,
|
|
2204
|
+
"Public DMs require dmPolicy=\"open\" + allowFrom=[\"*\"].",
|
|
2205
|
+
"Multi-user DMs: run: " + formatCliCommand("remoteclaw config set session.dmScope \"per-channel-peer\"") + " (or \"per-account-channel-peer\" for multi-account channels) to isolate sessions.",
|
|
2206
|
+
`Docs: ${formatDocsLink("/channels/pairing", "channels/pairing")}`,
|
|
2207
|
+
"",
|
|
2208
|
+
...channelLines
|
|
2209
|
+
].join("\n"), "How channels work");
|
|
2210
|
+
}
|
|
2211
|
+
function resolveQuickstartDefault(statusByChannel) {
|
|
2212
|
+
let best = null;
|
|
2213
|
+
for (const [channel, status] of statusByChannel) {
|
|
2214
|
+
if (status.quickstartScore == null) continue;
|
|
2215
|
+
if (!best || status.quickstartScore > best.score) best = {
|
|
2216
|
+
channel,
|
|
2217
|
+
score: status.quickstartScore
|
|
2218
|
+
};
|
|
2219
|
+
}
|
|
2220
|
+
return best?.channel;
|
|
2221
|
+
}
|
|
2222
|
+
async function maybeConfigureDmPolicies(params) {
|
|
2223
|
+
const { selection, prompter, accountIdsByChannel } = params;
|
|
2224
|
+
const dmPolicies = selection.map((channel) => getChannelOnboardingAdapter(channel)?.dmPolicy).filter(Boolean);
|
|
2225
|
+
if (dmPolicies.length === 0) return params.cfg;
|
|
2226
|
+
if (!await prompter.confirm({
|
|
2227
|
+
message: "Configure DM access policies now? (default: pairing)",
|
|
2228
|
+
initialValue: false
|
|
2229
|
+
})) return params.cfg;
|
|
2230
|
+
let cfg = params.cfg;
|
|
2231
|
+
const selectPolicy = async (policy) => {
|
|
2232
|
+
await prompter.note([
|
|
2233
|
+
"Default: pairing (unknown DMs get a pairing code).",
|
|
2234
|
+
`Approve: ${formatCliCommand(`remoteclaw pairing approve ${policy.channel} <code>`)}`,
|
|
2235
|
+
`Allowlist DMs: ${policy.policyKey}="allowlist" + ${policy.allowFromKey} entries.`,
|
|
2236
|
+
`Public DMs: ${policy.policyKey}="open" + ${policy.allowFromKey} includes "*".`,
|
|
2237
|
+
"Multi-user DMs: run: " + formatCliCommand("remoteclaw config set session.dmScope \"per-channel-peer\"") + " (or \"per-account-channel-peer\" for multi-account channels) to isolate sessions.",
|
|
2238
|
+
`Docs: ${formatDocsLink("/channels/pairing", "channels/pairing")}`
|
|
2239
|
+
].join("\n"), `${policy.label} DM access`);
|
|
2240
|
+
return await prompter.select({
|
|
2241
|
+
message: `${policy.label} DM policy`,
|
|
2242
|
+
options: [
|
|
2243
|
+
{
|
|
2244
|
+
value: "pairing",
|
|
2245
|
+
label: "Pairing (recommended)"
|
|
2246
|
+
},
|
|
2247
|
+
{
|
|
2248
|
+
value: "allowlist",
|
|
2249
|
+
label: "Allowlist (specific users only)"
|
|
2250
|
+
},
|
|
2251
|
+
{
|
|
2252
|
+
value: "open",
|
|
2253
|
+
label: "Open (public inbound DMs)"
|
|
2254
|
+
},
|
|
2255
|
+
{
|
|
2256
|
+
value: "disabled",
|
|
2257
|
+
label: "Disabled (ignore DMs)"
|
|
2258
|
+
}
|
|
2259
|
+
]
|
|
2260
|
+
});
|
|
2261
|
+
};
|
|
2262
|
+
for (const policy of dmPolicies) {
|
|
2263
|
+
const current = policy.getCurrent(cfg);
|
|
2264
|
+
const nextPolicy = await selectPolicy(policy);
|
|
2265
|
+
if (nextPolicy !== current) cfg = policy.setPolicy(cfg, nextPolicy);
|
|
2266
|
+
if (nextPolicy === "allowlist" && policy.promptAllowFrom) cfg = await policy.promptAllowFrom({
|
|
2267
|
+
cfg,
|
|
2268
|
+
prompter,
|
|
2269
|
+
accountId: accountIdsByChannel?.get(policy.channel)
|
|
2270
|
+
});
|
|
2271
|
+
}
|
|
2272
|
+
return cfg;
|
|
2273
|
+
}
|
|
2274
|
+
async function setupChannels(cfg, runtime, prompter, options) {
|
|
2275
|
+
let next = cfg;
|
|
2276
|
+
const forceAllowFromChannels = new Set(options?.forceAllowFromChannels ?? []);
|
|
2277
|
+
const accountOverrides = { ...options?.accountIds };
|
|
2278
|
+
if (options?.whatsappAccountId?.trim()) accountOverrides.whatsapp = options.whatsappAccountId.trim();
|
|
2279
|
+
const { installedPlugins, catalogEntries, statusByChannel, statusLines } = await collectChannelStatus({
|
|
2280
|
+
cfg: next,
|
|
2281
|
+
options,
|
|
2282
|
+
accountOverrides
|
|
2283
|
+
});
|
|
2284
|
+
if (!options?.skipStatusNote && statusLines.length > 0) await prompter.note(statusLines.join("\n"), "Channel status");
|
|
2285
|
+
if (!(options?.skipConfirm ? true : await prompter.confirm({
|
|
2286
|
+
message: "Configure chat channels now?",
|
|
2287
|
+
initialValue: true
|
|
2288
|
+
}))) return cfg;
|
|
2289
|
+
const corePrimer = listChatChannels().map((meta) => ({
|
|
2290
|
+
id: meta.id,
|
|
2291
|
+
label: meta.label,
|
|
2292
|
+
blurb: meta.blurb
|
|
2293
|
+
}));
|
|
2294
|
+
const coreIds = new Set(corePrimer.map((entry) => entry.id));
|
|
2295
|
+
await noteChannelPrimer(prompter, [
|
|
2296
|
+
...corePrimer,
|
|
2297
|
+
...installedPlugins.filter((plugin) => !coreIds.has(plugin.id)).map((plugin) => ({
|
|
2298
|
+
id: plugin.id,
|
|
2299
|
+
label: plugin.meta.label,
|
|
2300
|
+
blurb: plugin.meta.blurb
|
|
2301
|
+
})),
|
|
2302
|
+
...catalogEntries.filter((entry) => !coreIds.has(entry.id)).map((entry) => ({
|
|
2303
|
+
id: entry.id,
|
|
2304
|
+
label: entry.meta.label,
|
|
2305
|
+
blurb: entry.meta.blurb
|
|
2306
|
+
}))
|
|
2307
|
+
]);
|
|
2308
|
+
const quickstartDefault = options?.initialSelection?.[0] ?? resolveQuickstartDefault(statusByChannel);
|
|
2309
|
+
const shouldPromptAccountIds = options?.promptAccountIds === true;
|
|
2310
|
+
const accountIdsByChannel = /* @__PURE__ */ new Map();
|
|
2311
|
+
const recordAccount = (channel, accountId) => {
|
|
2312
|
+
options?.onAccountId?.(channel, accountId);
|
|
2313
|
+
getChannelOnboardingAdapter(channel)?.onAccountRecorded?.(accountId, options);
|
|
2314
|
+
accountIdsByChannel.set(channel, accountId);
|
|
2315
|
+
};
|
|
2316
|
+
const selection = [];
|
|
2317
|
+
const addSelection = (channel) => {
|
|
2318
|
+
if (!selection.includes(channel)) selection.push(channel);
|
|
2319
|
+
};
|
|
2320
|
+
const resolveDisabledHint = (channel) => {
|
|
2321
|
+
const plugin = getChannelPlugin(channel);
|
|
2322
|
+
if (!plugin) {
|
|
2323
|
+
if (next.plugins?.entries?.[channel]?.enabled === false) return "plugin disabled";
|
|
2324
|
+
if (next.plugins?.enabled === false) return "plugins disabled";
|
|
2325
|
+
return;
|
|
2326
|
+
}
|
|
2327
|
+
const accountId = resolveChannelDefaultAccountId({
|
|
2328
|
+
plugin,
|
|
2329
|
+
cfg: next
|
|
2330
|
+
});
|
|
2331
|
+
const account = plugin.config.resolveAccount(next, accountId);
|
|
2332
|
+
let enabled;
|
|
2333
|
+
if (plugin.config.isEnabled) enabled = plugin.config.isEnabled(account, next);
|
|
2334
|
+
else if (typeof account?.enabled === "boolean") enabled = account.enabled;
|
|
2335
|
+
else if (typeof next.channels?.[channel]?.enabled === "boolean") enabled = next.channels[channel]?.enabled;
|
|
2336
|
+
return enabled === false ? "disabled" : void 0;
|
|
2337
|
+
};
|
|
2338
|
+
const buildSelectionOptions = (entries) => entries.map((entry) => {
|
|
2339
|
+
const status = statusByChannel.get(entry.id);
|
|
2340
|
+
const disabledHint = resolveDisabledHint(entry.id);
|
|
2341
|
+
const hint = [status?.selectionHint, disabledHint].filter(Boolean).join(" · ") || void 0;
|
|
2342
|
+
return {
|
|
2343
|
+
value: entry.meta.id,
|
|
2344
|
+
label: entry.meta.selectionLabel ?? entry.meta.label,
|
|
2345
|
+
...hint ? { hint } : {}
|
|
2346
|
+
};
|
|
2347
|
+
});
|
|
2348
|
+
const getChannelEntries = () => {
|
|
2349
|
+
const core = listChatChannels();
|
|
2350
|
+
const installed = listChannelPlugins();
|
|
2351
|
+
const installedIds = new Set(installed.map((plugin) => plugin.id));
|
|
2352
|
+
const catalog = listChannelPluginCatalogEntries({ workspaceDir: resolveAgentWorkspaceDir(next, resolveDefaultAgentId(next)) }).filter((entry) => !installedIds.has(entry.id));
|
|
2353
|
+
const metaById = /* @__PURE__ */ new Map();
|
|
2354
|
+
for (const meta of core) metaById.set(meta.id, meta);
|
|
2355
|
+
for (const plugin of installed) metaById.set(plugin.id, plugin.meta);
|
|
2356
|
+
for (const entry of catalog) if (!metaById.has(entry.id)) metaById.set(entry.id, entry.meta);
|
|
2357
|
+
return {
|
|
2358
|
+
entries: Array.from(metaById, ([id, meta]) => ({
|
|
2359
|
+
id,
|
|
2360
|
+
meta
|
|
2361
|
+
})),
|
|
2362
|
+
catalog,
|
|
2363
|
+
catalogById: new Map(catalog.map((entry) => [entry.id, entry]))
|
|
2364
|
+
};
|
|
2365
|
+
};
|
|
2366
|
+
const refreshStatus = async (channel) => {
|
|
2367
|
+
const adapter = getChannelOnboardingAdapter(channel);
|
|
2368
|
+
if (!adapter) return;
|
|
2369
|
+
const status = await adapter.getStatus({
|
|
2370
|
+
cfg: next,
|
|
2371
|
+
options,
|
|
2372
|
+
accountOverrides
|
|
2373
|
+
});
|
|
2374
|
+
statusByChannel.set(channel, status);
|
|
2375
|
+
};
|
|
2376
|
+
const ensureBundledPluginEnabled = async (channel) => {
|
|
2377
|
+
if (getChannelPlugin(channel)) return true;
|
|
2378
|
+
const result = enablePluginInConfig(next, channel);
|
|
2379
|
+
next = result.config;
|
|
2380
|
+
if (!result.enabled) {
|
|
2381
|
+
await prompter.note(`Cannot enable ${channel}: ${result.reason ?? "plugin disabled"}.`, "Channel setup");
|
|
2382
|
+
return false;
|
|
2383
|
+
}
|
|
2384
|
+
const workspaceDir = resolveAgentWorkspaceDir(next, resolveDefaultAgentId(next));
|
|
2385
|
+
reloadOnboardingPluginRegistry({
|
|
2386
|
+
cfg: next,
|
|
2387
|
+
runtime,
|
|
2388
|
+
workspaceDir
|
|
2389
|
+
});
|
|
2390
|
+
if (!getChannelPlugin(channel)) {
|
|
2391
|
+
if (getChannelOnboardingAdapter(channel)) {
|
|
2392
|
+
await prompter.note(`${channel} plugin not available (continuing with onboarding). If the channel still doesn't work after setup, run \`${formatCliCommand("remoteclaw plugins list")}\` and \`${formatCliCommand("remoteclaw plugins enable " + channel)}\`, then restart the gateway.`, "Channel setup");
|
|
2393
|
+
await refreshStatus(channel);
|
|
2394
|
+
return true;
|
|
2395
|
+
}
|
|
2396
|
+
await prompter.note(`${channel} plugin not available.`, "Channel setup");
|
|
2397
|
+
return false;
|
|
2398
|
+
}
|
|
2399
|
+
await refreshStatus(channel);
|
|
2400
|
+
return true;
|
|
2401
|
+
};
|
|
2402
|
+
const configureChannel = async (channel) => {
|
|
2403
|
+
const adapter = getChannelOnboardingAdapter(channel);
|
|
2404
|
+
if (!adapter) {
|
|
2405
|
+
await prompter.note(`${channel} does not support onboarding yet.`, "Channel setup");
|
|
2406
|
+
return;
|
|
2407
|
+
}
|
|
2408
|
+
const result = await adapter.configure({
|
|
2409
|
+
cfg: next,
|
|
2410
|
+
runtime,
|
|
2411
|
+
prompter,
|
|
2412
|
+
options,
|
|
2413
|
+
accountOverrides,
|
|
2414
|
+
shouldPromptAccountIds,
|
|
2415
|
+
forceAllowFrom: forceAllowFromChannels.has(channel)
|
|
2416
|
+
});
|
|
2417
|
+
next = result.cfg;
|
|
2418
|
+
if (result.accountId) recordAccount(channel, result.accountId);
|
|
2419
|
+
addSelection(channel);
|
|
2420
|
+
await refreshStatus(channel);
|
|
2421
|
+
};
|
|
2422
|
+
const handleConfiguredChannel = async (channel, label) => {
|
|
2423
|
+
const plugin = getChannelPlugin(channel);
|
|
2424
|
+
const adapter = getChannelOnboardingAdapter(channel);
|
|
2425
|
+
const supportsDisable = Boolean(options?.allowDisable && (plugin?.config.setAccountEnabled || adapter?.disable));
|
|
2426
|
+
const supportsDelete = Boolean(options?.allowDisable && plugin?.config.deleteAccount);
|
|
2427
|
+
const action = await promptConfiguredAction({
|
|
2428
|
+
prompter,
|
|
2429
|
+
label,
|
|
2430
|
+
supportsDisable,
|
|
2431
|
+
supportsDelete
|
|
2432
|
+
});
|
|
2433
|
+
if (action === "skip") return;
|
|
2434
|
+
if (action === "update") {
|
|
2435
|
+
await configureChannel(channel);
|
|
2436
|
+
return;
|
|
2437
|
+
}
|
|
2438
|
+
if (!options?.allowDisable) return;
|
|
2439
|
+
if (action === "delete" && !supportsDelete) {
|
|
2440
|
+
await prompter.note(`${label} does not support deleting config entries.`, "Remove channel");
|
|
2441
|
+
return;
|
|
2442
|
+
}
|
|
2443
|
+
const resolvedAccountId = normalizeAccountId((action === "delete" ? Boolean(plugin?.config.deleteAccount) : Boolean(plugin?.config.setAccountEnabled)) ? await promptRemovalAccountId({
|
|
2444
|
+
cfg: next,
|
|
2445
|
+
prompter,
|
|
2446
|
+
label,
|
|
2447
|
+
channel
|
|
2448
|
+
}) : DEFAULT_ACCOUNT_ID) ?? (plugin ? resolveChannelDefaultAccountId({
|
|
2449
|
+
plugin,
|
|
2450
|
+
cfg: next
|
|
2451
|
+
}) : DEFAULT_ACCOUNT_ID);
|
|
2452
|
+
const accountLabel = formatAccountLabel(resolvedAccountId);
|
|
2453
|
+
if (action === "delete") {
|
|
2454
|
+
if (!await prompter.confirm({
|
|
2455
|
+
message: `Delete ${label} account "${accountLabel}"?`,
|
|
2456
|
+
initialValue: false
|
|
2457
|
+
})) return;
|
|
2458
|
+
if (plugin?.config.deleteAccount) next = plugin.config.deleteAccount({
|
|
2459
|
+
cfg: next,
|
|
2460
|
+
accountId: resolvedAccountId
|
|
2461
|
+
});
|
|
2462
|
+
await refreshStatus(channel);
|
|
2463
|
+
return;
|
|
2464
|
+
}
|
|
2465
|
+
if (plugin?.config.setAccountEnabled) next = plugin.config.setAccountEnabled({
|
|
2466
|
+
cfg: next,
|
|
2467
|
+
accountId: resolvedAccountId,
|
|
2468
|
+
enabled: false
|
|
2469
|
+
});
|
|
2470
|
+
else if (adapter?.disable) next = adapter.disable(next);
|
|
2471
|
+
await refreshStatus(channel);
|
|
2472
|
+
};
|
|
2473
|
+
const handleChannelChoice = async (channel) => {
|
|
2474
|
+
const { catalogById } = getChannelEntries();
|
|
2475
|
+
const catalogEntry = catalogById.get(channel);
|
|
2476
|
+
if (catalogEntry) {
|
|
2477
|
+
const workspaceDir = resolveAgentWorkspaceDir(next, resolveDefaultAgentId(next));
|
|
2478
|
+
const result = await ensureOnboardingPluginInstalled({
|
|
2479
|
+
cfg: next,
|
|
2480
|
+
entry: catalogEntry,
|
|
2481
|
+
prompter,
|
|
2482
|
+
runtime,
|
|
2483
|
+
workspaceDir
|
|
2484
|
+
});
|
|
2485
|
+
next = result.cfg;
|
|
2486
|
+
if (!result.installed) return;
|
|
2487
|
+
reloadOnboardingPluginRegistry({
|
|
2488
|
+
cfg: next,
|
|
2489
|
+
runtime,
|
|
2490
|
+
workspaceDir
|
|
2491
|
+
});
|
|
2492
|
+
await refreshStatus(channel);
|
|
2493
|
+
} else if (!await ensureBundledPluginEnabled(channel)) return;
|
|
2494
|
+
const label = getChannelPlugin(channel)?.meta.label ?? catalogEntry?.meta.label ?? channel;
|
|
2495
|
+
if (statusByChannel.get(channel)?.configured ?? false) {
|
|
2496
|
+
await handleConfiguredChannel(channel, label);
|
|
2497
|
+
return;
|
|
2498
|
+
}
|
|
2499
|
+
await configureChannel(channel);
|
|
2500
|
+
};
|
|
2501
|
+
if (options?.quickstartDefaults) {
|
|
2502
|
+
const { entries } = getChannelEntries();
|
|
2503
|
+
const choice = await prompter.select({
|
|
2504
|
+
message: "Select channel (QuickStart)",
|
|
2505
|
+
options: [...buildSelectionOptions(entries), {
|
|
2506
|
+
value: "__skip__",
|
|
2507
|
+
label: "Skip for now",
|
|
2508
|
+
hint: `You can add channels later via \`${formatCliCommand("remoteclaw channels add")}\``
|
|
2509
|
+
}],
|
|
2510
|
+
initialValue: quickstartDefault
|
|
2511
|
+
});
|
|
2512
|
+
if (choice !== "__skip__") await handleChannelChoice(choice);
|
|
2513
|
+
} else {
|
|
2514
|
+
const doneValue = "__done__";
|
|
2515
|
+
const initialValue = options?.initialSelection?.[0] ?? quickstartDefault;
|
|
2516
|
+
while (true) {
|
|
2517
|
+
const { entries } = getChannelEntries();
|
|
2518
|
+
const choice = await prompter.select({
|
|
2519
|
+
message: "Select a channel",
|
|
2520
|
+
options: [...buildSelectionOptions(entries), {
|
|
2521
|
+
value: doneValue,
|
|
2522
|
+
label: "Finished",
|
|
2523
|
+
hint: selection.length > 0 ? "Done" : "Skip for now"
|
|
2524
|
+
}],
|
|
2525
|
+
initialValue
|
|
2526
|
+
});
|
|
2527
|
+
if (choice === doneValue) break;
|
|
2528
|
+
await handleChannelChoice(choice);
|
|
2529
|
+
}
|
|
2530
|
+
}
|
|
2531
|
+
options?.onSelection?.(selection);
|
|
2532
|
+
const selectionNotes = /* @__PURE__ */ new Map();
|
|
2533
|
+
const { entries: selectionEntries } = getChannelEntries();
|
|
2534
|
+
for (const entry of selectionEntries) selectionNotes.set(entry.id, formatChannelSelectionLine(entry.meta, formatDocsLink));
|
|
2535
|
+
const selectedLines = selection.map((channel) => selectionNotes.get(channel)).filter((line) => Boolean(line));
|
|
2536
|
+
if (selectedLines.length > 0) await prompter.note(selectedLines.join("\n"), "Selected channels");
|
|
2537
|
+
if (!options?.skipDmPolicyPrompt) next = await maybeConfigureDmPolicies({
|
|
2538
|
+
cfg: next,
|
|
2539
|
+
selection,
|
|
2540
|
+
prompter,
|
|
2541
|
+
accountIdsByChannel
|
|
2542
|
+
});
|
|
2543
|
+
return next;
|
|
2544
|
+
}
|
|
2545
|
+
|
|
2546
|
+
//#endregion
|
|
2547
|
+
export { reloadOnboardingPluginRegistry as a, ensureOnboardingPluginInstalled as i, onboard_channels_exports as n, setupChannels as r, noteChannelStatus as t };
|