squidclaw 3.0.13 → 3.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{accounts-PhtBJ8mA.js → accounts-BjEXPlGc.js} +1 -1
- package/dist/{accounts-Xp5W2xrR.js → accounts-CyBVeR-N.js} +1 -1
- package/dist/{accounts-BFC1okn9.js → accounts-D095MOmG.js} +7 -7
- package/dist/{acp-cli-Dt95OPXW.js → acp-cli-Dd2joFFS.js} +8 -8
- package/dist/{agent-scope-tUxfsPYq.js → agent-scope-C1XMay0T.js} +17 -17
- package/dist/{agents.config-DNPisWCH.js → agents.config-CRKsD30n.js} +2 -2
- package/dist/{api-key-rotation-Y59kKrr0.js → api-key-rotation-BcKKu9kK.js} +1 -1
- package/dist/{audio-preflight-DeBM0nTy.js → audio-preflight-g9rsstMv.js} +34 -34
- package/dist/{audio-transcription-runner-B7oPsr3U.js → audio-transcription-runner-Bnl3Ubjo.js} +23 -23
- package/dist/{audit-Bq3iosCf.js → audit-B4s_5Gn1.js} +29 -29
- package/dist/{auth-HYiP0mxx.js → auth-DHSeaNcB.js} +1 -1
- package/dist/{auth-choice-Du_pIfBh.js → auth-choice-C-7c5Td_.js} +13 -13
- package/dist/{auth-choice-CX8TDXmp.js → auth-choice-D7LiN5Ju.js} +11 -11
- package/dist/{auth-choice.apply-helpers-DRfHu1d8.js → auth-choice.apply-helpers-CxO2Wbq-.js} +1 -1
- package/dist/{auth-token-BQRI3c6e.js → auth-token-BxYYHBlc.js} +1 -1
- package/dist/{bonjour-discovery-BenDpM0y.js → bonjour-discovery-mtNewKSx.js} +1 -1
- package/dist/{browser-cli-Et8PyJjA.js → browser-cli-I1fzIVmS.js} +12 -12
- package/dist/build-info.json +2 -2
- package/dist/{call-DbkLm3eP.js → call-DkR5OGhh.js} +10 -10
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/{channel-account-context-C_WQRa6U.js → channel-account-context-e4ysObLI.js} +5 -5
- package/dist/{channel-activity-7kixHIgY.js → channel-activity-CCjlTlcN.js} +1 -1
- package/dist/{channel-options-D0TjqxeO.js → channel-options-BL5mHe-R.js} +3 -3
- package/dist/{channel-selection-BwbXcgj2.js → channel-selection-D_20zq3H.js} +1 -1
- package/dist/{channel-web-lfZ3VOOl.js → channel-web-C7Iij0H0.js} +16 -16
- package/dist/{channels-cli-Hr4vekE6.js → channels-cli-BMiEn81Y.js} +92 -92
- package/dist/{channels-status-issues-DeoqSoo-.js → channels-status-issues-N9kzQrD8.js} +1 -1
- package/dist/{chrome-gIqO4t7T.js → chrome-BNfSmFAM.js} +4 -4
- package/dist/{clawbot-cli-C-jGxnTq.js → clawbot-cli-B6-68gsT.js} +11 -11
- package/dist/cli/daemon-cli.js +1 -1
- package/dist/{cli-BH62lCfL.js → cli-ByaubO_B.js} +72 -72
- package/dist/{client-CeaUCJtL.js → client-BURktNyH.js} +2 -2
- package/dist/{command-secret-targets-BF4WzaME.js → command-secret-targets-WwcPUFAf.js} +4 -4
- package/dist/{commands-CD6EMOiw.js → commands-CiY9HjRt.js} +1 -1
- package/dist/{commands-registry-DCUj1QOi.js → commands-registry-0bpX7A_Q.js} +3 -3
- package/dist/{completion-cli-BIY_jjYY.js → completion-cli-8PdK97J-.js} +12 -12
- package/dist/{config-cli-DvNViMXW.js → config-cli-ClomIMw7.js} +7 -7
- package/dist/{config-guard-DwgnWjmj.js → config-guard-rLrk7eSS.js} +16 -16
- package/dist/{config-validation-CcqZ--gE.js → config-validation-BQEaXMk7.js} +3 -3
- package/dist/{configure-B5Zuhebc.js → configure-CoXGul3l.js} +17 -17
- package/dist/{control-ui-assets-x69xyZH-.js → control-ui-assets-Bz7TCLpb.js} +1 -1
- package/dist/{cron-cli-Bv-X4msQ.js → cron-cli-C3iKBccc.js} +11 -11
- package/dist/{daemon-cli-B-8-rGND.js → daemon-cli-BVcrlw5o.js} +15 -15
- package/dist/{daemon-install-2y4HHhYl.js → daemon-install-CXDWHEEO.js} +4 -4
- package/dist/{daemon-install-helpers-Cdo6Pryw.js → daemon-install-helpers-a4pGEsbA.js} +11 -11
- package/dist/{deliver-CVl43oM1.js → deliver-B1sllFkh.js} +7 -7
- package/dist/deliver-runtime-CaV7seKv.js +61 -0
- package/dist/deps-send-discord.runtime-DbS5pxta.js +36 -0
- package/dist/deps-send-imessage.runtime-Ji753_F7.js +35 -0
- package/dist/deps-send-signal.runtime-DLJqvPLf.js +34 -0
- package/dist/deps-send-slack.runtime-DrFxeZ1I.js +32 -0
- package/dist/{deps-send-telegram.runtime-C9lz8bf0.js → deps-send-telegram.runtime-CF-Ylrvr.js} +16 -16
- package/dist/deps-send-whatsapp.runtime-BOE0Ke6v.js +118 -0
- package/dist/{devices-cli-BT8K0hdG.js → devices-cli-Dn_norz3.js} +8 -8
- package/dist/{diagnostic-5bqrhGEp.js → diagnostic-CNl71AzW.js} +1 -1
- package/dist/{diagnostics-C0CazfQM.js → diagnostics-DZ99A0EW.js} +5 -5
- package/dist/{directory-cli-BZcT9ie1.js → directory-cli-ZzwXkW89.js} +7 -7
- package/dist/{dns-cli-CPYaeASu.js → dns-cli-DipYQjtY.js} +5 -5
- package/dist/{dock-CVTqzMqE.js → dock-C7N1CmcP.js} +4 -4
- package/dist/{docs-cli-C50vGyDh.js → docs-cli-C-Izm9Tb.js} +4 -4
- package/dist/{doctor-completion-Emprau8v.js → doctor-completion-CGmYWy0n.js} +2 -2
- package/dist/{doctor-config-flow-DSA-JE3n.js → doctor-config-flow-DDWA3Z2D.js} +15 -15
- package/dist/{enable-CAYj5OhY.js → enable-RJyJVP_B.js} +1 -1
- package/dist/{exec-approvals-allowlist-BO4EEQUI.js → exec-approvals-allowlist-Bu_oaDJC.js} +1 -1
- package/dist/{exec-approvals-cli-DSOHdWJR.js → exec-approvals-cli-Csducy9L.js} +16 -16
- package/dist/{exec-safe-bin-runtime-policy-CSnpe1AT.js → exec-safe-bin-runtime-policy-DRQwt8kj.js} +2 -2
- package/dist/{fetch-guard-VcWeni3c.js → fetch-guard-DNykKlIv.js} +1 -1
- package/dist/{fs-safe-CjHYKGbt.js → fs-safe-CKHYu4Vz.js} +24 -24
- package/dist/{gateway-cli-B2fScwuY.js → gateway-cli-CUph5Eqo.js} +152 -152
- package/dist/{gateway-rpc-DpqZnhyz.js → gateway-rpc-DoKw40aG.js} +1 -1
- package/dist/{health-BZcB9SMe.js → health-Cia3g9r1.js} +11 -11
- package/dist/{hooks-cli-BylHgZ52.js → hooks-cli-LDbU3XMU.js} +80 -80
- package/dist/{hooks-status-DqGd74DG.js → hooks-status-Dd_iWcBZ.js} +1 -1
- package/dist/{image-CulZw1up.js → image-D2a7rcK1.js} +5 -5
- package/dist/{image-ops-BpsIdA2j.js → image-ops-BIWika4g.js} +10 -10
- package/dist/image-runtime-DTxVPe7Z.js +55 -0
- package/dist/index.js +82 -82
- package/dist/{inspect-D5T8Bbzl.js → inspect-C3PHuODr.js} +4 -4
- package/dist/{install-safe-path-BoN-MLvX.js → install-safe-path-iCmVuopp.js} +25 -25
- package/dist/{installs-CPHMcmNj.js → installs-CyjlehlR.js} +9 -9
- package/dist/{ipv4-Bwl9ruCP.js → ipv4-CWVOQw5T.js} +1 -1
- package/dist/{ir-xnftdkOo.js → ir-BPM7rQYq.js} +8 -8
- package/dist/{issue-format-8t_ncgFx.js → issue-format-sA05c-6t.js} +1 -1
- package/dist/{json-files-DIEpaxUj.js → json-files-D6M304Qd.js} +8 -8
- package/dist/{lifecycle-core-DKiBjZdv.js → lifecycle-core-DsfZ6965.js} +5 -5
- package/dist/{local-roots-BrxGyJnb.js → local-roots-CMxJ8L4w.js} +3 -3
- package/dist/{login-CxDYXbgx.js → login-BjtBaVVG.js} +3 -3
- package/dist/{login-qr-zf4B1lpU.js → login-qr-JfRlpd7I.js} +6 -6
- package/dist/{logs-cli-CJAe1_dv.js → logs-cli-gv2Ql7GE.js} +9 -9
- package/dist/{manager-DBgRFvYb.js → manager-XeZQ6ws7.js} +14 -14
- package/dist/{manager-runtime-Dl31cGh-.js → manager-runtime-BvGqzQIY.js} +9 -9
- package/dist/{manifest-registry-Cx3mB9zS.js → manifest-registry-BaUPjNKb.js} +1 -1
- package/dist/{memory-cli-Bhoc-n_1.js → memory-cli-BUJHSsW6.js} +12 -12
- package/dist/{model-DYzjrxpA.js → model-Jy6fO59G.js} +2 -2
- package/dist/{model-catalog-kpDOW8eY.js → model-catalog-BfoWgIDd.js} +3 -3
- package/dist/{model-picker-BZwK54QT.js → model-picker-CxmHVCE1.js} +4 -4
- package/dist/{model-selection-ZV3PuYVR.js → model-selection-QgM_TOjC.js} +16 -16
- package/dist/{models-cli-BIxlIOFr.js → models-cli-DlbNL6it.js} +81 -81
- package/dist/{models-config-BLdDYoxi.js → models-config-DOD5jluc.js} +6 -6
- package/dist/{node-cli-6uYJccbd.js → node-cli-uJ5lFzxj.js} +33 -33
- package/dist/{node-command-policy-CKTXVa3D.js → node-command-policy-CwVo8Z1X.js} +1 -1
- package/dist/{node-service-DGPVb5ri.js → node-service-xGYkt3vb.js} +1 -1
- package/dist/{nodes-cli-CXLRfAYx.js → nodes-cli-eauCMbSr.js} +16 -16
- package/dist/{nodes-screen-C-tuRhA1.js → nodes-screen-iR_FzGNs.js} +7 -7
- package/dist/{npm-pack-install-DgSn7djE.js → npm-pack-install-s-mP9K0z.js} +18 -18
- package/dist/{npm-resolution-gw3vFNTB.js → npm-resolution-Ck7yFIM2.js} +4 -4
- package/dist/{onboard-CCaYDSO2.js → onboard-aISMp4Kt.js} +6 -6
- package/dist/{onboard-channels-DQnP5d3Y.js → onboard-channels-CELkEQUS.js} +21 -21
- package/dist/{onboard-custom-CJohrPzT.js → onboard-custom-BmAzWYbD.js} +4 -4
- package/dist/{onboard-helpers-Bcs_1b81.js → onboard-helpers-DRk4Y5uA.js} +10 -10
- package/dist/{onboard-hooks-A23nqe_3.js → onboard-hooks-lk1sMnDf.js} +4 -4
- package/dist/{onboard-remote-Hf9sTDHl.js → onboard-remote-Bj9cR8kF.js} +4 -4
- package/dist/{onboard-skills-Cpc8o6sG.js → onboard-skills-eRpyQ1la.js} +4 -4
- package/dist/{onboarding-wx00blu5.js → onboarding-Bl4RDn6W.js} +14 -14
- package/dist/{onboarding.finalize-B8wqvggG.js → onboarding.finalize-Bm7_INHb.js} +85 -85
- package/dist/{onboarding.gateway-config-CvWq5i_X.js → onboarding.gateway-config-BPyk6gwr.js} +18 -18
- package/dist/{onboarding.secret-input-CIN4p8mg.js → onboarding.secret-input-DlDt-I2O.js} +1 -1
- package/dist/{openai-model-default-BYfJa19m.js → openai-model-default-DnYP1Em1.js} +2 -2
- package/dist/{outbound-B3RZI-ai.js → outbound-BQtnr_z2.js} +3 -3
- package/dist/{outbound-attachment-BATDqOuj.js → outbound-attachment-WnXMTJC4.js} +2 -2
- package/dist/{pairing-cli-FMIw0yL6.js → pairing-cli-BsU-YnVT.js} +8 -8
- package/dist/{pairing-labels-MH31IXn_.js → pairing-labels-BXfoinTP.js} +1 -1
- package/dist/{pairing-store-KII9MIZX.js → pairing-store-C1FvWpDK.js} +3 -3
- package/dist/{path-alias-guards-B7H6jIIw.js → path-alias-guards-CCRXJArp.js} +3 -3
- package/dist/{path-safety-3wUzDqI9.js → path-safety-BWiXz6D4.js} +1 -1
- package/dist/{paths-BguvT84s.js → paths-Bg6h1q3v.js} +9 -9
- package/dist/{pi-embedded-helpers-D8WkqLZt.js → pi-embedded-helpers-DctimJJI.js} +6 -6
- package/dist/{pi-model-discovery-Bfyzj3Lq.js → pi-model-discovery-D63dINOn.js} +1 -1
- package/dist/{pi-model-discovery-runtime-nh-zh_Bp.js → pi-model-discovery-runtime-CcXGQcru.js} +5 -5
- package/dist/{pi-tools.before-tool-call.runtime-D4V6gUzq.js → pi-tools.before-tool-call.runtime-BMb_b90y.js} +5 -5
- package/dist/{pi-tools.policy-DCE9mhtw.js → pi-tools.policy-CXvZtJB7.js} +5 -5
- package/dist/{plugin-auto-enable-BJw5Rcbx.js → plugin-auto-enable-DMABTEO-.js} +3 -3
- package/dist/{plugin-registry-V0H8DaZf.js → plugin-registry-BSlUIHKX.js} +3 -3
- package/dist/plugin-sdk/accounts-B6gye1Jd.js +46 -0
- package/dist/plugin-sdk/accounts-C-BT6Po7.js +288 -0
- package/dist/plugin-sdk/accounts-DQDXV8eB.js +35 -0
- package/dist/plugin-sdk/active-listener-DZCohPuZ.js +50 -0
- package/dist/plugin-sdk/api-key-rotation-CrX0fvDj.js +181 -0
- package/dist/plugin-sdk/audio-preflight-xnWAFqH-.js +69 -0
- package/dist/plugin-sdk/audio-transcription-runner-BDmtq7-q.js +2176 -0
- package/dist/plugin-sdk/audit-membership-runtime-B9b-zRwg.js +58 -0
- package/dist/plugin-sdk/channel-activity-JjLRpUa_.js +94 -0
- package/dist/plugin-sdk/channel-web-DNWsxhYh.js +2256 -0
- package/dist/plugin-sdk/chrome-B5PWOUbr.js +2415 -0
- package/dist/plugin-sdk/commands-registry-BKeyJUxK.js +1125 -0
- package/dist/plugin-sdk/config-FhBFLsNm.js +17911 -0
- package/dist/plugin-sdk/deliver-DEbTlzFy.js +1694 -0
- package/dist/plugin-sdk/deliver-runtime-CO2uP-r9.js +32 -0
- package/dist/plugin-sdk/deps-send-discord.runtime-DIPW0tR4.js +23 -0
- package/dist/plugin-sdk/deps-send-imessage.runtime-ByGjRa1H.js +22 -0
- package/dist/plugin-sdk/deps-send-signal.runtime-Ca1awu4L.js +21 -0
- package/dist/plugin-sdk/deps-send-slack.runtime-CRzWCVkC.js +19 -0
- package/dist/plugin-sdk/deps-send-telegram.runtime-BWyavKp9.js +24 -0
- package/dist/plugin-sdk/deps-send-whatsapp.runtime-cC_XvHV8.js +57 -0
- package/dist/plugin-sdk/diagnostic-Dv9S12vm.js +319 -0
- package/dist/plugin-sdk/errors-B8oJXuCF.js +54 -0
- package/dist/plugin-sdk/fetch-guard-W_A4uSz2.js +156 -0
- package/dist/plugin-sdk/fs-safe-Dqmpk-Fr.js +352 -0
- package/dist/plugin-sdk/image-BSFy8d1M.js +2310 -0
- package/dist/plugin-sdk/image-ops-DN17S88I.js +584 -0
- package/dist/plugin-sdk/image-runtime-5YO31sjU.js +25 -0
- package/dist/plugin-sdk/imessage.js +2 -2
- package/dist/plugin-sdk/index.js +50 -50
- package/dist/plugin-sdk/ir-JaPZ0yKH.js +1296 -0
- package/dist/plugin-sdk/local-roots-BTW3ifco.js +186 -0
- package/dist/plugin-sdk/logger-DDdrdbDu.js +1163 -0
- package/dist/plugin-sdk/login-BXGRny-S.js +57 -0
- package/dist/plugin-sdk/login-qr-DTs92ap8.js +320 -0
- package/dist/plugin-sdk/manager-DzFj9oHX.js +3917 -0
- package/dist/plugin-sdk/manager-runtime-DrpyZvO0.js +15 -0
- package/dist/plugin-sdk/mattermost.js +3 -3
- package/dist/plugin-sdk/outbound-CQ7uBBML.js +212 -0
- package/dist/plugin-sdk/outbound-attachment-dTE6EVdX.js +19 -0
- package/dist/plugin-sdk/path-alias-guards-gBhrAn14.js +43 -0
- package/dist/plugin-sdk/paths-C6W4VHoa.js +166 -0
- package/dist/plugin-sdk/pi-embedded-helpers-CfzQPXDC.js +9627 -0
- package/dist/plugin-sdk/pi-model-discovery-Bt6B0MAj.js +134 -0
- package/dist/plugin-sdk/pi-model-discovery-runtime-BcgXpTmL.js +8 -0
- package/dist/plugin-sdk/pi-tools.before-tool-call.runtime-DYJQxhuo.js +354 -0
- package/dist/plugin-sdk/plugins-6NxPd6TS.js +864 -0
- package/dist/plugin-sdk/proxy-fetch-ZPEvp58f.js +38 -0
- package/dist/plugin-sdk/pw-ai-BFK39pwE.js +1938 -0
- package/dist/plugin-sdk/qmd-manager-6bozlfFg.js +1448 -0
- package/dist/plugin-sdk/query-expansion-eeVz_aEm.js +1011 -0
- package/dist/plugin-sdk/redact-BoNEjbpF.js +319 -0
- package/dist/plugin-sdk/reply-DgcrQBKL.js +98828 -0
- package/dist/plugin-sdk/resolve-outbound-target-CbaJ-kc2.js +40 -0
- package/dist/plugin-sdk/run-with-concurrency-5DMu9szx.js +1994 -0
- package/dist/plugin-sdk/runtime-whatsapp-login.runtime-jkgyeVsN.js +10 -0
- package/dist/plugin-sdk/runtime-whatsapp-outbound.runtime-DdLJJ1YC.js +19 -0
- package/dist/plugin-sdk/send-BSoMbeqA.js +3135 -0
- package/dist/plugin-sdk/send-Byyfc20_.js +503 -0
- package/dist/plugin-sdk/send-CI-xWEs7.js +2587 -0
- package/dist/plugin-sdk/send-DzP9EJqK.js +540 -0
- package/dist/plugin-sdk/send-MlSZ82sA.js +414 -0
- package/dist/plugin-sdk/session-DFy97tfW.js +169 -0
- package/dist/plugin-sdk/signal.js +2 -2
- package/dist/plugin-sdk/skill-commands-yum46YuA.js +342 -0
- package/dist/plugin-sdk/skills-DUphJGKn.js +1428 -0
- package/dist/plugin-sdk/slash-commands.runtime-5UW5KLyR.js +13 -0
- package/dist/plugin-sdk/slash-dispatch.runtime-4oQ2P_qo.js +52 -0
- package/dist/plugin-sdk/slash-skill-commands.runtime-y_mOLyS7.js +16 -0
- package/dist/plugin-sdk/ssrf-B3XRWBsP.js +202 -0
- package/dist/plugin-sdk/store-DFvIhzWZ.js +81 -0
- package/dist/plugin-sdk/subagent-registry-runtime-DtKXhKtl.js +52 -0
- package/dist/plugin-sdk/tables-bDM_jlLP.js +55 -0
- package/dist/{target-errors-DlzVutaL.js → plugin-sdk/target-errors-BVBW25Y3.js} +4 -4
- package/dist/plugin-sdk/thinking-Bu-w5mW5.js +1206 -0
- package/dist/plugin-sdk/tokens-CTIYTLWu.js +52 -0
- package/dist/plugin-sdk/tool-images-D0G_giwP.js +274 -0
- package/dist/plugin-sdk/web-DSXk7XCb.js +56 -0
- package/dist/plugin-sdk/whatsapp-actions-BOyA0Uuj.js +80 -0
- package/dist/{plugins-Cl_3OCyK.js → plugins-H53_4Gxb.js} +2 -2
- package/dist/{plugins-cli-CN2fty5U.js → plugins-cli-CQkxWdnt.js} +82 -82
- package/dist/{ports-Bop51hz6.js → ports-CKXuQJST.js} +2 -2
- package/dist/{ports-6i8smH3e.js → ports-CXjhFS7T.js} +1 -1
- package/dist/{program-context-ehHvCw9L.js → program-context-tphS7xu7.js} +41 -41
- package/dist/{prompt-select-styled-CSMviLJY.js → prompt-select-styled-DL2p1pfi.js} +40 -40
- package/dist/{provider-auth-helpers-CgNWlsqs.js → provider-auth-helpers-BqWiy-r-.js} +5 -5
- package/dist/{proxy-env-CRD7fbqp.js → proxy-env-D1tz4Z6a.js} +1 -1
- package/dist/{push-apns-DoYzx3tH.js → push-apns-C-YdARdy.js} +5 -5
- package/dist/{pw-ai-yKJj32B4.js → pw-ai-SVeR5d2o.js} +18 -18
- package/dist/{qmd-manager-AYDUTXmc.js → qmd-manager-B-XXhWVw.js} +20 -20
- package/dist/{qr-cli-cikAHfYn.js → qr-cli-B4fjHvn1.js} +2 -2
- package/dist/{query-expansion-CV2Z4_mS.js → query-expansion-Bf60ekMj.js} +12 -12
- package/dist/{redact-snapshot-C9T1079O.js → redact-snapshot-DRqM8Vla.js} +1 -1
- package/dist/{register.agent-BlxoyQt0.js → register.agent-BdiM0qkl.js} +97 -97
- package/dist/register.configure-wANXDbzQ.js +164 -0
- package/dist/{register.maintenance-C-Yv2mHK.js → register.maintenance-CMAt3Nl8.js} +93 -93
- package/dist/{register.message-CUNXtFOj.js → register.message-CbxQ5lgi.js} +73 -73
- package/dist/{register.onboard-BKXm1mL7.js → register.onboard-CbiTdKQX.js} +18 -18
- package/dist/{register.setup-DaT9AIAz.js → register.setup-KhsHMx2v.js} +21 -21
- package/dist/{register.status-health-sessions-7yZmSvUL.js → register.status-health-sessions-Bw5YDa_s.js} +86 -86
- package/dist/{reply-CeUYZhWu.js → reply-BWXzPVSJ.js} +149 -149
- package/dist/{rpc-BDpuIniF.js → rpc-DlN_W_L1.js} +1 -1
- package/dist/{runtime-Dw7Yw4OJ.js → runtime-Ci7mtLvH.js} +3 -3
- package/dist/{runtime-config-collectors-jhc1wDBg.js → runtime-config-collectors-CKmGmTQ5.js} +1 -1
- package/dist/{runtime-whatsapp-login.runtime-f293Z_er.js → runtime-whatsapp-login.runtime-Bxqt5jiO.js} +7 -7
- package/dist/runtime-whatsapp-outbound.runtime-B-UsXwvb.js +32 -0
- package/dist/{sandbox-BgsD1lf7.js → sandbox-Cuk1IWYT.js} +18 -18
- package/dist/{sandbox-cli-BnvmhiN9.js → sandbox-cli-BxgFeoAD.js} +25 -25
- package/dist/{secrets-cli-D7-K7P82.js → secrets-cli-DODLX29x.js} +11 -11
- package/dist/{security-cli-BFJAgNYH.js → security-cli-Ch83VrLP.js} +42 -42
- package/dist/{send-BvlkshC1.js → send-BfVgGHK6.js} +6 -6
- package/dist/{send-tK0H9nwq.js → send-Bw8LNCit.js} +5 -5
- package/dist/{send-CDms2FQA.js → send-C9UJKBSM.js} +4 -4
- package/dist/{send-CPFNtAP8.js → send-DX_fR45p.js} +11 -11
- package/dist/{send-C3Aeswif.js → send-FTQaNJPj.js} +8 -8
- package/dist/{server-OfKJG6Bo.js → server-Q9nnn04D.js} +20 -20
- package/dist/{server-context-B-0KzcZE.js → server-context-CX28l04l.js} +12 -12
- package/dist/{server-lifecycle-D6VNKVvQ.js → server-lifecycle-yAUMTJhv.js} +2 -2
- package/dist/{server-middleware-7cXowO4W.js → server-middleware-DIc4WJOS.js} +1 -1
- package/dist/{server-node-events-DWQhNK-0.js → server-node-events-qU3NTncQ.js} +73 -73
- package/dist/{service-Dk-UMipf.js → service-D4y0_Q5Z.js} +15 -15
- package/dist/{session-Da18ilJ0.js → session-CZJ5Ux6-.js} +1 -1
- package/dist/{sessions-CmjcNTJ3.js → sessions-C5H_BZSr.js} +15 -15
- package/dist/{shared-BzY0v0tS.js → shared-CxdBWgym.js} +3 -3
- package/dist/{shared-BcB-feC8.js → shared-DwNtcoQg.js} +1 -1
- package/dist/{skill-commands-BEWkEml_.js → skill-commands-BSRPnzXp.js} +5 -5
- package/dist/{skill-scanner-Bb5SMbCz.js → skill-scanner-rdr9cQew.js} +6 -6
- package/dist/{skills-Rnr7zPen.js → skills-BnBOxX1c.js} +3 -3
- package/dist/{skills-cli-BowIIIzH.js → skills-cli-CUgeYV1y.js} +5 -5
- package/dist/{skills-install-BLNCKuex.js → skills-install-BE04CZ6e.js} +6 -6
- package/dist/{skills-status-BCU-5otB.js → skills-status-DQw98BkG.js} +1 -1
- package/dist/{slash-commands.runtime-BgVgQ-Eh.js → slash-commands.runtime-BPtL2Qev.js} +11 -11
- package/dist/slash-dispatch.runtime-Cf9dq1k6.js +113 -0
- package/dist/{slash-skill-commands.runtime-4dOiU6U0.js → slash-skill-commands.runtime-9BYoANpd.js} +15 -15
- package/dist/{squidclaw-root-BcB7vo9M.js → squidclaw-root-CnE19yKj.js} +8 -8
- package/dist/{status-COTRBaam.js → status-rb5Jz-VU.js} +26 -26
- package/dist/{status.update-BUql4yz-.js → status.update-BNODJGA9.js} +2 -2
- package/dist/{store-aa15VM42.js → store-PDMRmC5Z.js} +5 -5
- package/dist/subagent-registry-runtime-CTiA365B.js +113 -0
- package/dist/{system-cli-CgCUbH_M.js → system-cli-DJYyTO07.js} +9 -9
- package/dist/{system-run-command-Ny1SbbOD.js → system-run-command-BgnCyvrj.js} +1 -1
- package/dist/{systemd-zbKl2Q3E.js → systemd-fP8tz4aL.js} +9 -9
- package/dist/{systemd-hints-C9_7ouv7.js → systemd-hints-BG_t__ZD.js} +6 -6
- package/dist/{systemd-linger-BM6JyzAr.js → systemd-linger-DgK8uuKY.js} +1 -1
- package/dist/{tables-jZMI8hLl.js → tables-DUSFF9-W.js} +1 -1
- package/dist/{tailnet-gTCqUBfJ.js → tailnet-CLkKVwDq.js} +1 -1
- package/dist/target-errors-BxwxgIDk.js +195 -0
- package/dist/{tool-images-DTl_LHMa.js → tool-images-FhSCiY-o.js} +1 -1
- package/dist/{tui-kDK-MAOc.js → tui-BMOMT-ma.js} +6 -6
- package/dist/{tui-cli-Dxy6fKkU.js → tui-cli-kqZ_-2Mz.js} +32 -32
- package/dist/{update-ZUTn6Jsu.js → update-blK9j2ag.js} +3 -3
- package/dist/{update-cli-D_QEiKyz.js → update-cli-gLKrP8UQ.js} +102 -102
- package/dist/{update-runner-DOXPSA_-.js → update-runner-C2UrF4oZ.js} +16 -16
- package/dist/web-VmjeceHS.js +117 -0
- package/dist/{webhooks-cli-D1iehjkP.js → webhooks-cli-BEXPBILa.js} +6 -6
- package/dist/{whatsapp-actions-hN5bwjWU.js → whatsapp-actions-DhiV181U.js} +17 -17
- package/dist/{with-timeout-BjaANd4G.js → with-timeout-BCAfkt03.js} +3 -3
- package/dist/{workspace-BITWyKG4.js → workspace-B-k5DNiQ.js} +1 -1
- package/dist/{workspace-dirs-B7O9BAHp.js → workspace-dirs-B2dNahfe.js} +1 -1
- package/dist/{ws-Bx8lpC1N.js → ws-DKt5HoA5.js} +2 -2
- package/dist/{wsl-wYxPJ8EO.js → wsl-CgxzAzRe.js} +2 -2
- package/package.json +1 -1
- package/dist/deliver-runtime-uwleBPlq.js +0 -61
- package/dist/deps-send-discord.runtime-CuZGpA7H.js +0 -36
- package/dist/deps-send-imessage.runtime-ByVW2alP.js +0 -35
- package/dist/deps-send-signal.runtime-Dl4GaCbQ.js +0 -34
- package/dist/deps-send-slack.runtime-BEV10FHj.js +0 -32
- package/dist/deps-send-whatsapp.runtime-Di0SEPNK.js +0 -118
- package/dist/image-runtime-B5Q4J9w2.js +0 -55
- package/dist/register.configure-CGptmTVZ.js +0 -164
- package/dist/runtime-whatsapp-outbound.runtime-uDhEmWe1.js +0 -32
- package/dist/slash-dispatch.runtime-D83FVeU7.js +0 -113
- package/dist/subagent-registry-runtime-CrT5RSO9.js +0 -113
- package/dist/web-DtSq_aUB.js +0 -117
|
@@ -0,0 +1,864 @@
|
|
|
1
|
+
import { $ as normalizeAgentId, at as DEFAULT_ACCOUNT_ID, l as resolveDefaultAgentId, ot as normalizeAccountId, st as normalizeOptionalAccountId } from "./run-with-concurrency-5DMu9szx.js";
|
|
2
|
+
import { i as resolveWhatsAppAccount, v as resolveAccountEntry, y as createAccountListHelpers } from "./accounts-C-BT6Po7.js";
|
|
3
|
+
import { Ct as normalizeChatChannelId, Dt as requireActivePluginRegistry, Et as getActivePluginRegistryVersion, Ur as normalizeResolvedSecretInputString, ei as isTruthyEnvValue, vt as CHAT_CHANNEL_ORDER, xt as normalizeAnyChannelId } from "./config-FhBFLsNm.js";
|
|
4
|
+
import { S as normalizeE164, a as createSubsystemLogger } from "./logger-DDdrdbDu.js";
|
|
5
|
+
import fs from "node:fs";
|
|
6
|
+
import util from "node:util";
|
|
7
|
+
|
|
8
|
+
//#region src/channels/chat-type.ts
|
|
9
|
+
function normalizeChatType(raw) {
|
|
10
|
+
const value = raw?.trim().toLowerCase();
|
|
11
|
+
if (!value) return;
|
|
12
|
+
if (value === "direct" || value === "dm") return "direct";
|
|
13
|
+
if (value === "group") return "group";
|
|
14
|
+
if (value === "channel") return "channel";
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/channels/plugins/account-action-gate.ts
|
|
19
|
+
function createAccountActionGate(params) {
|
|
20
|
+
return (key, defaultValue = true) => {
|
|
21
|
+
const accountValue = params.accountActions?.[key];
|
|
22
|
+
if (accountValue !== void 0) return accountValue;
|
|
23
|
+
const baseValue = params.baseActions?.[key];
|
|
24
|
+
if (baseValue !== void 0) return baseValue;
|
|
25
|
+
return defaultValue;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/discord/token.ts
|
|
31
|
+
function normalizeDiscordToken(raw, path) {
|
|
32
|
+
const trimmed = normalizeResolvedSecretInputString({
|
|
33
|
+
value: raw,
|
|
34
|
+
path
|
|
35
|
+
});
|
|
36
|
+
if (!trimmed) return;
|
|
37
|
+
return trimmed.replace(/^Bot\s+/i, "");
|
|
38
|
+
}
|
|
39
|
+
function resolveDiscordToken(cfg, opts = {}) {
|
|
40
|
+
const accountId = normalizeAccountId(opts.accountId);
|
|
41
|
+
const discordCfg = cfg?.channels?.discord;
|
|
42
|
+
const resolveAccountCfg = (id) => {
|
|
43
|
+
const accounts = discordCfg?.accounts;
|
|
44
|
+
if (!accounts || typeof accounts !== "object" || Array.isArray(accounts)) return;
|
|
45
|
+
const direct = accounts[id];
|
|
46
|
+
if (direct) return direct;
|
|
47
|
+
const matchKey = Object.keys(accounts).find((key) => normalizeAccountId(key) === id);
|
|
48
|
+
return matchKey ? accounts[matchKey] : void 0;
|
|
49
|
+
};
|
|
50
|
+
const accountCfg = resolveAccountCfg(accountId);
|
|
51
|
+
const hasAccountToken = Boolean(accountCfg && Object.prototype.hasOwnProperty.call(accountCfg, "token"));
|
|
52
|
+
const accountToken = normalizeDiscordToken(accountCfg?.token ?? void 0, `channels.discord.accounts.${accountId}.token`);
|
|
53
|
+
if (accountToken) return {
|
|
54
|
+
token: accountToken,
|
|
55
|
+
source: "config"
|
|
56
|
+
};
|
|
57
|
+
if (hasAccountToken) return {
|
|
58
|
+
token: "",
|
|
59
|
+
source: "none"
|
|
60
|
+
};
|
|
61
|
+
const configToken = normalizeDiscordToken(discordCfg?.token ?? void 0, "channels.discord.token");
|
|
62
|
+
if (configToken) return {
|
|
63
|
+
token: configToken,
|
|
64
|
+
source: "config"
|
|
65
|
+
};
|
|
66
|
+
const envToken = accountId === DEFAULT_ACCOUNT_ID ? normalizeDiscordToken(opts.envToken ?? process.env.DISCORD_BOT_TOKEN, "DISCORD_BOT_TOKEN") : void 0;
|
|
67
|
+
if (envToken) return {
|
|
68
|
+
token: envToken,
|
|
69
|
+
source: "env"
|
|
70
|
+
};
|
|
71
|
+
return {
|
|
72
|
+
token: "",
|
|
73
|
+
source: "none"
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/discord/accounts.ts
|
|
79
|
+
const { listAccountIds: listAccountIds$1, resolveDefaultAccountId: resolveDefaultAccountId$1 } = createAccountListHelpers("discord");
|
|
80
|
+
const listDiscordAccountIds = listAccountIds$1;
|
|
81
|
+
const resolveDefaultDiscordAccountId = resolveDefaultAccountId$1;
|
|
82
|
+
function resolveAccountConfig$2(cfg, accountId) {
|
|
83
|
+
return resolveAccountEntry(cfg.channels?.discord?.accounts, accountId);
|
|
84
|
+
}
|
|
85
|
+
function mergeDiscordAccountConfig(cfg, accountId) {
|
|
86
|
+
const { accounts: _ignored, ...base } = cfg.channels?.discord ?? {};
|
|
87
|
+
const account = resolveAccountConfig$2(cfg, accountId) ?? {};
|
|
88
|
+
return {
|
|
89
|
+
...base,
|
|
90
|
+
...account
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function createDiscordActionGate(params) {
|
|
94
|
+
const accountId = normalizeAccountId(params.accountId);
|
|
95
|
+
return createAccountActionGate({
|
|
96
|
+
baseActions: params.cfg.channels?.discord?.actions,
|
|
97
|
+
accountActions: resolveAccountConfig$2(params.cfg, accountId)?.actions
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function resolveDiscordAccount(params) {
|
|
101
|
+
const accountId = normalizeAccountId(params.accountId);
|
|
102
|
+
const baseEnabled = params.cfg.channels?.discord?.enabled !== false;
|
|
103
|
+
const merged = mergeDiscordAccountConfig(params.cfg, accountId);
|
|
104
|
+
const accountEnabled = merged.enabled !== false;
|
|
105
|
+
const enabled = baseEnabled && accountEnabled;
|
|
106
|
+
const tokenResolution = resolveDiscordToken(params.cfg, { accountId });
|
|
107
|
+
return {
|
|
108
|
+
accountId,
|
|
109
|
+
enabled,
|
|
110
|
+
name: merged.name?.trim() || void 0,
|
|
111
|
+
token: tokenResolution.token,
|
|
112
|
+
tokenSource: tokenResolution.source,
|
|
113
|
+
config: merged
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function listEnabledDiscordAccounts(cfg) {
|
|
117
|
+
return listDiscordAccountIds(cfg).map((accountId) => resolveDiscordAccount({
|
|
118
|
+
cfg,
|
|
119
|
+
accountId
|
|
120
|
+
})).filter((account) => account.enabled);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
//#endregion
|
|
124
|
+
//#region src/whatsapp/normalize.ts
|
|
125
|
+
const WHATSAPP_USER_JID_RE = /^(\d+)(?::\d+)?@s\.whatsapp\.net$/i;
|
|
126
|
+
const WHATSAPP_LID_RE = /^(\d+)@lid$/i;
|
|
127
|
+
function stripWhatsAppTargetPrefixes(value) {
|
|
128
|
+
let candidate = value.trim();
|
|
129
|
+
for (;;) {
|
|
130
|
+
const before = candidate;
|
|
131
|
+
candidate = candidate.replace(/^whatsapp:/i, "").trim();
|
|
132
|
+
if (candidate === before) return candidate;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function isWhatsAppGroupJid(value) {
|
|
136
|
+
const candidate = stripWhatsAppTargetPrefixes(value);
|
|
137
|
+
if (!candidate.toLowerCase().endsWith("@g.us")) return false;
|
|
138
|
+
const localPart = candidate.slice(0, candidate.length - 5);
|
|
139
|
+
if (!localPart || localPart.includes("@")) return false;
|
|
140
|
+
return /^[0-9]+(-[0-9]+)*$/.test(localPart);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Check if value looks like a WhatsApp user target (e.g. "41796666864:0@s.whatsapp.net" or "123@lid").
|
|
144
|
+
*/
|
|
145
|
+
function isWhatsAppUserTarget(value) {
|
|
146
|
+
const candidate = stripWhatsAppTargetPrefixes(value);
|
|
147
|
+
return WHATSAPP_USER_JID_RE.test(candidate) || WHATSAPP_LID_RE.test(candidate);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Extract the phone number from a WhatsApp user JID.
|
|
151
|
+
* "41796666864:0@s.whatsapp.net" -> "41796666864"
|
|
152
|
+
* "123456@lid" -> "123456"
|
|
153
|
+
*/
|
|
154
|
+
function extractUserJidPhone(jid) {
|
|
155
|
+
const userMatch = jid.match(WHATSAPP_USER_JID_RE);
|
|
156
|
+
if (userMatch) return userMatch[1];
|
|
157
|
+
const lidMatch = jid.match(WHATSAPP_LID_RE);
|
|
158
|
+
if (lidMatch) return lidMatch[1];
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
function normalizeWhatsAppTarget(value) {
|
|
162
|
+
const candidate = stripWhatsAppTargetPrefixes(value);
|
|
163
|
+
if (!candidate) return null;
|
|
164
|
+
if (isWhatsAppGroupJid(candidate)) return `${candidate.slice(0, candidate.length - 5)}@g.us`;
|
|
165
|
+
if (isWhatsAppUserTarget(candidate)) {
|
|
166
|
+
const phone = extractUserJidPhone(candidate);
|
|
167
|
+
if (!phone) return null;
|
|
168
|
+
const normalized = normalizeE164(phone);
|
|
169
|
+
return normalized.length > 1 ? normalized : null;
|
|
170
|
+
}
|
|
171
|
+
if (candidate.includes("@")) return null;
|
|
172
|
+
const normalized = normalizeE164(candidate);
|
|
173
|
+
return normalized.length > 1 ? normalized : null;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
//#endregion
|
|
177
|
+
//#region src/slack/token.ts
|
|
178
|
+
function resolveSlackBotToken(raw, path = "channels.slack.botToken") {
|
|
179
|
+
return normalizeResolvedSecretInputString({
|
|
180
|
+
value: raw,
|
|
181
|
+
path
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
function resolveSlackAppToken(raw, path = "channels.slack.appToken") {
|
|
185
|
+
return normalizeResolvedSecretInputString({
|
|
186
|
+
value: raw,
|
|
187
|
+
path
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
function resolveSlackUserToken(raw, path = "channels.slack.userToken") {
|
|
191
|
+
return normalizeResolvedSecretInputString({
|
|
192
|
+
value: raw,
|
|
193
|
+
path
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
//#endregion
|
|
198
|
+
//#region src/slack/accounts.ts
|
|
199
|
+
const { listAccountIds, resolveDefaultAccountId } = createAccountListHelpers("slack");
|
|
200
|
+
const listSlackAccountIds = listAccountIds;
|
|
201
|
+
const resolveDefaultSlackAccountId = resolveDefaultAccountId;
|
|
202
|
+
function resolveAccountConfig$1(cfg, accountId) {
|
|
203
|
+
return resolveAccountEntry(cfg.channels?.slack?.accounts, accountId);
|
|
204
|
+
}
|
|
205
|
+
function mergeSlackAccountConfig(cfg, accountId) {
|
|
206
|
+
const { accounts: _ignored, ...base } = cfg.channels?.slack ?? {};
|
|
207
|
+
const account = resolveAccountConfig$1(cfg, accountId) ?? {};
|
|
208
|
+
return {
|
|
209
|
+
...base,
|
|
210
|
+
...account
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
function resolveSlackAccount(params) {
|
|
214
|
+
const accountId = normalizeAccountId(params.accountId);
|
|
215
|
+
const baseEnabled = params.cfg.channels?.slack?.enabled !== false;
|
|
216
|
+
const merged = mergeSlackAccountConfig(params.cfg, accountId);
|
|
217
|
+
const accountEnabled = merged.enabled !== false;
|
|
218
|
+
const enabled = baseEnabled && accountEnabled;
|
|
219
|
+
const allowEnv = accountId === DEFAULT_ACCOUNT_ID;
|
|
220
|
+
const envBot = allowEnv ? resolveSlackBotToken(process.env.SLACK_BOT_TOKEN) : void 0;
|
|
221
|
+
const envApp = allowEnv ? resolveSlackAppToken(process.env.SLACK_APP_TOKEN) : void 0;
|
|
222
|
+
const envUser = allowEnv ? resolveSlackUserToken(process.env.SLACK_USER_TOKEN) : void 0;
|
|
223
|
+
const configBot = resolveSlackBotToken(merged.botToken, `channels.slack.accounts.${accountId}.botToken`);
|
|
224
|
+
const configApp = resolveSlackAppToken(merged.appToken, `channels.slack.accounts.${accountId}.appToken`);
|
|
225
|
+
const configUser = resolveSlackUserToken(merged.userToken, `channels.slack.accounts.${accountId}.userToken`);
|
|
226
|
+
const botToken = configBot ?? envBot;
|
|
227
|
+
const appToken = configApp ?? envApp;
|
|
228
|
+
const userToken = configUser ?? envUser;
|
|
229
|
+
const botTokenSource = configBot ? "config" : envBot ? "env" : "none";
|
|
230
|
+
const appTokenSource = configApp ? "config" : envApp ? "env" : "none";
|
|
231
|
+
const userTokenSource = configUser ? "config" : envUser ? "env" : "none";
|
|
232
|
+
return {
|
|
233
|
+
accountId,
|
|
234
|
+
enabled,
|
|
235
|
+
name: merged.name?.trim() || void 0,
|
|
236
|
+
botToken,
|
|
237
|
+
appToken,
|
|
238
|
+
userToken,
|
|
239
|
+
botTokenSource,
|
|
240
|
+
appTokenSource,
|
|
241
|
+
userTokenSource,
|
|
242
|
+
config: merged,
|
|
243
|
+
groupPolicy: merged.groupPolicy,
|
|
244
|
+
textChunkLimit: merged.textChunkLimit,
|
|
245
|
+
mediaMaxMb: merged.mediaMaxMb,
|
|
246
|
+
reactionNotifications: merged.reactionNotifications,
|
|
247
|
+
reactionAllowlist: merged.reactionAllowlist,
|
|
248
|
+
replyToMode: merged.replyToMode,
|
|
249
|
+
replyToModeByChatType: merged.replyToModeByChatType,
|
|
250
|
+
actions: merged.actions,
|
|
251
|
+
slashCommand: merged.slashCommand,
|
|
252
|
+
dm: merged.dm,
|
|
253
|
+
channels: merged.channels
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function listEnabledSlackAccounts(cfg) {
|
|
257
|
+
return listSlackAccountIds(cfg).map((accountId) => resolveSlackAccount({
|
|
258
|
+
cfg,
|
|
259
|
+
accountId
|
|
260
|
+
})).filter((account) => account.enabled);
|
|
261
|
+
}
|
|
262
|
+
function resolveSlackReplyToMode(account, chatType) {
|
|
263
|
+
const normalized = normalizeChatType(chatType ?? void 0);
|
|
264
|
+
if (normalized && account.replyToModeByChatType?.[normalized] !== void 0) return account.replyToModeByChatType[normalized] ?? "off";
|
|
265
|
+
if (normalized === "direct" && account.dm?.replyToMode !== void 0) return account.dm.replyToMode;
|
|
266
|
+
return account.replyToMode ?? "off";
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
//#endregion
|
|
270
|
+
//#region src/plugin-sdk/account-resolution.ts
|
|
271
|
+
function resolveAccountWithDefaultFallback(params) {
|
|
272
|
+
const hasExplicitAccountId = Boolean(params.accountId?.trim());
|
|
273
|
+
const normalizedAccountId = params.normalizeAccountId(params.accountId);
|
|
274
|
+
const primary = params.resolvePrimary(normalizedAccountId);
|
|
275
|
+
if (hasExplicitAccountId || params.hasCredential(primary)) return primary;
|
|
276
|
+
const fallbackId = params.resolveDefaultAccountId();
|
|
277
|
+
if (fallbackId === normalizedAccountId) return primary;
|
|
278
|
+
const fallback = params.resolvePrimary(fallbackId);
|
|
279
|
+
if (!params.hasCredential(fallback)) return primary;
|
|
280
|
+
return fallback;
|
|
281
|
+
}
|
|
282
|
+
function listConfiguredAccountIds$1(params) {
|
|
283
|
+
if (!params.accounts) return [];
|
|
284
|
+
const ids = /* @__PURE__ */ new Set();
|
|
285
|
+
for (const key of Object.keys(params.accounts)) {
|
|
286
|
+
if (!key) continue;
|
|
287
|
+
ids.add(params.normalizeAccountId(key));
|
|
288
|
+
}
|
|
289
|
+
return [...ids];
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
//#endregion
|
|
293
|
+
//#region src/routing/bindings.ts
|
|
294
|
+
function normalizeBindingChannelId(raw) {
|
|
295
|
+
const normalized = normalizeChatChannelId(raw);
|
|
296
|
+
if (normalized) return normalized;
|
|
297
|
+
return (raw ?? "").trim().toLowerCase() || null;
|
|
298
|
+
}
|
|
299
|
+
function listBindings(cfg) {
|
|
300
|
+
return Array.isArray(cfg.bindings) ? cfg.bindings : [];
|
|
301
|
+
}
|
|
302
|
+
function resolveNormalizedBindingMatch(binding) {
|
|
303
|
+
if (!binding || typeof binding !== "object") return null;
|
|
304
|
+
const match = binding.match;
|
|
305
|
+
if (!match || typeof match !== "object") return null;
|
|
306
|
+
const channelId = normalizeBindingChannelId(match.channel);
|
|
307
|
+
if (!channelId) return null;
|
|
308
|
+
const accountId = typeof match.accountId === "string" ? match.accountId.trim() : "";
|
|
309
|
+
if (!accountId || accountId === "*") return null;
|
|
310
|
+
return {
|
|
311
|
+
agentId: normalizeAgentId(binding.agentId),
|
|
312
|
+
accountId: normalizeAccountId(accountId),
|
|
313
|
+
channelId
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
function listBoundAccountIds(cfg, channelId) {
|
|
317
|
+
const normalizedChannel = normalizeBindingChannelId(channelId);
|
|
318
|
+
if (!normalizedChannel) return [];
|
|
319
|
+
const ids = /* @__PURE__ */ new Set();
|
|
320
|
+
for (const binding of listBindings(cfg)) {
|
|
321
|
+
const resolved = resolveNormalizedBindingMatch(binding);
|
|
322
|
+
if (!resolved || resolved.channelId !== normalizedChannel) continue;
|
|
323
|
+
ids.add(resolved.accountId);
|
|
324
|
+
}
|
|
325
|
+
return Array.from(ids).toSorted((a, b) => a.localeCompare(b));
|
|
326
|
+
}
|
|
327
|
+
function resolveDefaultAgentBoundAccountId(cfg, channelId) {
|
|
328
|
+
const normalizedChannel = normalizeBindingChannelId(channelId);
|
|
329
|
+
if (!normalizedChannel) return null;
|
|
330
|
+
const defaultAgentId = normalizeAgentId(resolveDefaultAgentId(cfg));
|
|
331
|
+
for (const binding of listBindings(cfg)) {
|
|
332
|
+
const resolved = resolveNormalizedBindingMatch(binding);
|
|
333
|
+
if (!resolved || resolved.channelId !== normalizedChannel || resolved.agentId !== defaultAgentId) continue;
|
|
334
|
+
return resolved.accountId;
|
|
335
|
+
}
|
|
336
|
+
return null;
|
|
337
|
+
}
|
|
338
|
+
function buildChannelAccountBindings(cfg) {
|
|
339
|
+
const map = /* @__PURE__ */ new Map();
|
|
340
|
+
for (const binding of listBindings(cfg)) {
|
|
341
|
+
const resolved = resolveNormalizedBindingMatch(binding);
|
|
342
|
+
if (!resolved) continue;
|
|
343
|
+
const byAgent = map.get(resolved.channelId) ?? /* @__PURE__ */ new Map();
|
|
344
|
+
const list = byAgent.get(resolved.agentId) ?? [];
|
|
345
|
+
if (!list.includes(resolved.accountId)) list.push(resolved.accountId);
|
|
346
|
+
byAgent.set(resolved.agentId, list);
|
|
347
|
+
map.set(resolved.channelId, byAgent);
|
|
348
|
+
}
|
|
349
|
+
return map;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
//#endregion
|
|
353
|
+
//#region src/routing/default-account-warnings.ts
|
|
354
|
+
function formatChannelDefaultAccountPath(channelKey) {
|
|
355
|
+
return `channels.${channelKey}.defaultAccount`;
|
|
356
|
+
}
|
|
357
|
+
function formatChannelAccountsDefaultPath(channelKey) {
|
|
358
|
+
return `channels.${channelKey}.accounts.default`;
|
|
359
|
+
}
|
|
360
|
+
function formatSetExplicitDefaultInstruction(channelKey) {
|
|
361
|
+
return `Set ${formatChannelDefaultAccountPath(channelKey)} or add ${formatChannelAccountsDefaultPath(channelKey)}`;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
//#endregion
|
|
365
|
+
//#region src/telegram/token.ts
|
|
366
|
+
function resolveTelegramToken(cfg, opts = {}) {
|
|
367
|
+
const accountId = normalizeAccountId(opts.accountId);
|
|
368
|
+
const telegramCfg = cfg?.channels?.telegram;
|
|
369
|
+
const resolveAccountCfg = (id) => {
|
|
370
|
+
const accounts = telegramCfg?.accounts;
|
|
371
|
+
if (!accounts || typeof accounts !== "object" || Array.isArray(accounts)) return;
|
|
372
|
+
const direct = accounts[id];
|
|
373
|
+
if (direct) return direct;
|
|
374
|
+
const matchKey = Object.keys(accounts).find((key) => normalizeAccountId(key) === id);
|
|
375
|
+
return matchKey ? accounts[matchKey] : void 0;
|
|
376
|
+
};
|
|
377
|
+
const accountCfg = resolveAccountCfg(accountId !== DEFAULT_ACCOUNT_ID ? accountId : DEFAULT_ACCOUNT_ID);
|
|
378
|
+
const accountTokenFile = accountCfg?.tokenFile?.trim();
|
|
379
|
+
if (accountTokenFile) {
|
|
380
|
+
if (!fs.existsSync(accountTokenFile)) {
|
|
381
|
+
opts.logMissingFile?.(`channels.telegram.accounts.${accountId}.tokenFile not found: ${accountTokenFile}`);
|
|
382
|
+
return {
|
|
383
|
+
token: "",
|
|
384
|
+
source: "none"
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
try {
|
|
388
|
+
const token = fs.readFileSync(accountTokenFile, "utf-8").trim();
|
|
389
|
+
if (token) return {
|
|
390
|
+
token,
|
|
391
|
+
source: "tokenFile"
|
|
392
|
+
};
|
|
393
|
+
} catch (err) {
|
|
394
|
+
opts.logMissingFile?.(`channels.telegram.accounts.${accountId}.tokenFile read failed: ${String(err)}`);
|
|
395
|
+
return {
|
|
396
|
+
token: "",
|
|
397
|
+
source: "none"
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
return {
|
|
401
|
+
token: "",
|
|
402
|
+
source: "none"
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
const accountToken = normalizeResolvedSecretInputString({
|
|
406
|
+
value: accountCfg?.botToken,
|
|
407
|
+
path: `channels.telegram.accounts.${accountId}.botToken`
|
|
408
|
+
});
|
|
409
|
+
if (accountToken) return {
|
|
410
|
+
token: accountToken,
|
|
411
|
+
source: "config"
|
|
412
|
+
};
|
|
413
|
+
const allowEnv = accountId === DEFAULT_ACCOUNT_ID;
|
|
414
|
+
const tokenFile = telegramCfg?.tokenFile?.trim();
|
|
415
|
+
if (tokenFile) {
|
|
416
|
+
if (!fs.existsSync(tokenFile)) {
|
|
417
|
+
opts.logMissingFile?.(`channels.telegram.tokenFile not found: ${tokenFile}`);
|
|
418
|
+
return {
|
|
419
|
+
token: "",
|
|
420
|
+
source: "none"
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
try {
|
|
424
|
+
const token = fs.readFileSync(tokenFile, "utf-8").trim();
|
|
425
|
+
if (token) return {
|
|
426
|
+
token,
|
|
427
|
+
source: "tokenFile"
|
|
428
|
+
};
|
|
429
|
+
} catch (err) {
|
|
430
|
+
opts.logMissingFile?.(`channels.telegram.tokenFile read failed: ${String(err)}`);
|
|
431
|
+
return {
|
|
432
|
+
token: "",
|
|
433
|
+
source: "none"
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
const configToken = normalizeResolvedSecretInputString({
|
|
438
|
+
value: telegramCfg?.botToken,
|
|
439
|
+
path: "channels.telegram.botToken"
|
|
440
|
+
});
|
|
441
|
+
if (configToken) return {
|
|
442
|
+
token: configToken,
|
|
443
|
+
source: "config"
|
|
444
|
+
};
|
|
445
|
+
const envToken = allowEnv ? (opts.envToken ?? process.env.TELEGRAM_BOT_TOKEN)?.trim() : "";
|
|
446
|
+
if (envToken) return {
|
|
447
|
+
token: envToken,
|
|
448
|
+
source: "env"
|
|
449
|
+
};
|
|
450
|
+
return {
|
|
451
|
+
token: "",
|
|
452
|
+
source: "none"
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
//#endregion
|
|
457
|
+
//#region src/telegram/accounts.ts
|
|
458
|
+
const log = createSubsystemLogger("telegram/accounts");
|
|
459
|
+
function formatDebugArg(value) {
|
|
460
|
+
if (typeof value === "string") return value;
|
|
461
|
+
if (value instanceof Error) return value.stack ?? value.message;
|
|
462
|
+
return util.inspect(value, {
|
|
463
|
+
colors: false,
|
|
464
|
+
depth: null,
|
|
465
|
+
compact: true,
|
|
466
|
+
breakLength: Infinity
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
const debugAccounts = (...args) => {
|
|
470
|
+
if (isTruthyEnvValue(process.env.SQUIDCLAW_DEBUG_TELEGRAM_ACCOUNTS)) {
|
|
471
|
+
const parts = args.map((arg) => formatDebugArg(arg));
|
|
472
|
+
log.warn(parts.join(" ").trim());
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
function listConfiguredAccountIds(cfg) {
|
|
476
|
+
return listConfiguredAccountIds$1({
|
|
477
|
+
accounts: cfg.channels?.telegram?.accounts,
|
|
478
|
+
normalizeAccountId
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
function listTelegramAccountIds(cfg) {
|
|
482
|
+
const ids = Array.from(new Set([...listConfiguredAccountIds(cfg), ...listBoundAccountIds(cfg, "telegram")]));
|
|
483
|
+
debugAccounts("listTelegramAccountIds", ids);
|
|
484
|
+
if (ids.length === 0) return [DEFAULT_ACCOUNT_ID];
|
|
485
|
+
return ids.toSorted((a, b) => a.localeCompare(b));
|
|
486
|
+
}
|
|
487
|
+
let emittedMissingDefaultWarn = false;
|
|
488
|
+
function resolveDefaultTelegramAccountId(cfg) {
|
|
489
|
+
const boundDefault = resolveDefaultAgentBoundAccountId(cfg, "telegram");
|
|
490
|
+
if (boundDefault) return boundDefault;
|
|
491
|
+
const preferred = normalizeOptionalAccountId(cfg.channels?.telegram?.defaultAccount);
|
|
492
|
+
if (preferred && listTelegramAccountIds(cfg).some((accountId) => normalizeAccountId(accountId) === preferred)) return preferred;
|
|
493
|
+
const ids = listTelegramAccountIds(cfg);
|
|
494
|
+
if (ids.includes(DEFAULT_ACCOUNT_ID)) return DEFAULT_ACCOUNT_ID;
|
|
495
|
+
if (ids.length > 1 && !emittedMissingDefaultWarn) {
|
|
496
|
+
emittedMissingDefaultWarn = true;
|
|
497
|
+
log.warn(`channels.telegram: accounts.default is missing; falling back to "${ids[0]}". ${formatSetExplicitDefaultInstruction("telegram")} to avoid routing surprises in multi-account setups.`);
|
|
498
|
+
}
|
|
499
|
+
return ids[0] ?? DEFAULT_ACCOUNT_ID;
|
|
500
|
+
}
|
|
501
|
+
function resolveAccountConfig(cfg, accountId) {
|
|
502
|
+
const normalized = normalizeAccountId(accountId);
|
|
503
|
+
return resolveAccountEntry(cfg.channels?.telegram?.accounts, normalized);
|
|
504
|
+
}
|
|
505
|
+
function mergeTelegramAccountConfig(cfg, accountId) {
|
|
506
|
+
const { accounts: _ignored, defaultAccount: _ignoredDefaultAccount, groups: channelGroups, ...base } = cfg.channels?.telegram ?? {};
|
|
507
|
+
const account = resolveAccountConfig(cfg, accountId) ?? {};
|
|
508
|
+
const isMultiAccount = Object.keys(cfg.channels?.telegram?.accounts ?? {}).length > 1;
|
|
509
|
+
const groups = account.groups ?? (isMultiAccount ? void 0 : channelGroups);
|
|
510
|
+
return {
|
|
511
|
+
...base,
|
|
512
|
+
...account,
|
|
513
|
+
groups
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
function createTelegramActionGate(params) {
|
|
517
|
+
const accountId = normalizeAccountId(params.accountId);
|
|
518
|
+
return createAccountActionGate({
|
|
519
|
+
baseActions: params.cfg.channels?.telegram?.actions,
|
|
520
|
+
accountActions: resolveAccountConfig(params.cfg, accountId)?.actions
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
function resolveTelegramAccount(params) {
|
|
524
|
+
const baseEnabled = params.cfg.channels?.telegram?.enabled !== false;
|
|
525
|
+
const resolve = (accountId) => {
|
|
526
|
+
const merged = mergeTelegramAccountConfig(params.cfg, accountId);
|
|
527
|
+
const accountEnabled = merged.enabled !== false;
|
|
528
|
+
const enabled = baseEnabled && accountEnabled;
|
|
529
|
+
const tokenResolution = resolveTelegramToken(params.cfg, { accountId });
|
|
530
|
+
debugAccounts("resolve", {
|
|
531
|
+
accountId,
|
|
532
|
+
enabled,
|
|
533
|
+
tokenSource: tokenResolution.source
|
|
534
|
+
});
|
|
535
|
+
return {
|
|
536
|
+
accountId,
|
|
537
|
+
enabled,
|
|
538
|
+
name: merged.name?.trim() || void 0,
|
|
539
|
+
token: tokenResolution.token,
|
|
540
|
+
tokenSource: tokenResolution.source,
|
|
541
|
+
config: merged
|
|
542
|
+
};
|
|
543
|
+
};
|
|
544
|
+
return resolveAccountWithDefaultFallback({
|
|
545
|
+
accountId: params.accountId,
|
|
546
|
+
normalizeAccountId,
|
|
547
|
+
resolvePrimary: resolve,
|
|
548
|
+
hasCredential: (account) => account.tokenSource !== "none",
|
|
549
|
+
resolveDefaultAccountId: () => resolveDefaultTelegramAccountId(params.cfg)
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
function listEnabledTelegramAccounts(cfg) {
|
|
553
|
+
return listTelegramAccountIds(cfg).map((accountId) => resolveTelegramAccount({
|
|
554
|
+
cfg,
|
|
555
|
+
accountId
|
|
556
|
+
})).filter((account) => account.enabled);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
//#endregion
|
|
560
|
+
//#region src/channels/targets.ts
|
|
561
|
+
function normalizeTargetId(kind, id) {
|
|
562
|
+
return `${kind}:${id}`.toLowerCase();
|
|
563
|
+
}
|
|
564
|
+
function buildMessagingTarget(kind, id, raw) {
|
|
565
|
+
return {
|
|
566
|
+
kind,
|
|
567
|
+
id,
|
|
568
|
+
raw,
|
|
569
|
+
normalized: normalizeTargetId(kind, id)
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
function ensureTargetId(params) {
|
|
573
|
+
if (!params.pattern.test(params.candidate)) throw new Error(params.errorMessage);
|
|
574
|
+
return params.candidate;
|
|
575
|
+
}
|
|
576
|
+
function parseTargetMention(params) {
|
|
577
|
+
const match = params.raw.match(params.mentionPattern);
|
|
578
|
+
if (!match?.[1]) return;
|
|
579
|
+
return buildMessagingTarget(params.kind, match[1], params.raw);
|
|
580
|
+
}
|
|
581
|
+
function parseTargetPrefix(params) {
|
|
582
|
+
if (!params.raw.startsWith(params.prefix)) return;
|
|
583
|
+
const id = params.raw.slice(params.prefix.length).trim();
|
|
584
|
+
return id ? buildMessagingTarget(params.kind, id, params.raw) : void 0;
|
|
585
|
+
}
|
|
586
|
+
function parseTargetPrefixes(params) {
|
|
587
|
+
for (const entry of params.prefixes) {
|
|
588
|
+
const parsed = parseTargetPrefix({
|
|
589
|
+
raw: params.raw,
|
|
590
|
+
prefix: entry.prefix,
|
|
591
|
+
kind: entry.kind
|
|
592
|
+
});
|
|
593
|
+
if (parsed) return parsed;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
function parseAtUserTarget(params) {
|
|
597
|
+
if (!params.raw.startsWith("@")) return;
|
|
598
|
+
return buildMessagingTarget("user", ensureTargetId({
|
|
599
|
+
candidate: params.raw.slice(1).trim(),
|
|
600
|
+
pattern: params.pattern,
|
|
601
|
+
errorMessage: params.errorMessage
|
|
602
|
+
}), params.raw);
|
|
603
|
+
}
|
|
604
|
+
function parseMentionPrefixOrAtUserTarget(params) {
|
|
605
|
+
const mentionTarget = parseTargetMention({
|
|
606
|
+
raw: params.raw,
|
|
607
|
+
mentionPattern: params.mentionPattern,
|
|
608
|
+
kind: "user"
|
|
609
|
+
});
|
|
610
|
+
if (mentionTarget) return mentionTarget;
|
|
611
|
+
const prefixedTarget = parseTargetPrefixes({
|
|
612
|
+
raw: params.raw,
|
|
613
|
+
prefixes: params.prefixes
|
|
614
|
+
});
|
|
615
|
+
if (prefixedTarget) return prefixedTarget;
|
|
616
|
+
return parseAtUserTarget({
|
|
617
|
+
raw: params.raw,
|
|
618
|
+
pattern: params.atUserPattern,
|
|
619
|
+
errorMessage: params.atUserErrorMessage
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
function requireTargetKind(params) {
|
|
623
|
+
const kindLabel = params.kind;
|
|
624
|
+
if (!params.target) throw new Error(`${params.platform} ${kindLabel} id is required.`);
|
|
625
|
+
if (params.target.kind !== params.kind) throw new Error(`${params.platform} ${kindLabel} id is required (use ${kindLabel}:<id>).`);
|
|
626
|
+
return params.target.id;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
//#endregion
|
|
630
|
+
//#region src/slack/targets.ts
|
|
631
|
+
function parseSlackTarget(raw, options = {}) {
|
|
632
|
+
const trimmed = raw.trim();
|
|
633
|
+
if (!trimmed) return;
|
|
634
|
+
const userTarget = parseMentionPrefixOrAtUserTarget({
|
|
635
|
+
raw: trimmed,
|
|
636
|
+
mentionPattern: /^<@([A-Z0-9]+)>$/i,
|
|
637
|
+
prefixes: [
|
|
638
|
+
{
|
|
639
|
+
prefix: "user:",
|
|
640
|
+
kind: "user"
|
|
641
|
+
},
|
|
642
|
+
{
|
|
643
|
+
prefix: "channel:",
|
|
644
|
+
kind: "channel"
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
prefix: "slack:",
|
|
648
|
+
kind: "user"
|
|
649
|
+
}
|
|
650
|
+
],
|
|
651
|
+
atUserPattern: /^[A-Z0-9]+$/i,
|
|
652
|
+
atUserErrorMessage: "Slack DMs require a user id (use user:<id> or <@id>)"
|
|
653
|
+
});
|
|
654
|
+
if (userTarget) return userTarget;
|
|
655
|
+
if (trimmed.startsWith("#")) return buildMessagingTarget("channel", ensureTargetId({
|
|
656
|
+
candidate: trimmed.slice(1).trim(),
|
|
657
|
+
pattern: /^[A-Z0-9]+$/i,
|
|
658
|
+
errorMessage: "Slack channels require a channel id (use channel:<id>)"
|
|
659
|
+
}), trimmed);
|
|
660
|
+
if (options.defaultKind) return buildMessagingTarget(options.defaultKind, trimmed, trimmed);
|
|
661
|
+
return buildMessagingTarget("channel", trimmed, trimmed);
|
|
662
|
+
}
|
|
663
|
+
function resolveSlackChannelId(raw) {
|
|
664
|
+
return requireTargetKind({
|
|
665
|
+
platform: "Slack",
|
|
666
|
+
target: parseSlackTarget(raw, { defaultKind: "channel" }),
|
|
667
|
+
kind: "channel"
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
//#endregion
|
|
672
|
+
//#region src/channels/plugins/normalize/slack.ts
|
|
673
|
+
function normalizeSlackMessagingTarget(raw) {
|
|
674
|
+
return parseSlackTarget(raw, { defaultKind: "channel" })?.normalized;
|
|
675
|
+
}
|
|
676
|
+
function looksLikeSlackTargetId(raw) {
|
|
677
|
+
const trimmed = raw.trim();
|
|
678
|
+
if (!trimmed) return false;
|
|
679
|
+
if (/^<@([A-Z0-9]+)>$/i.test(trimmed)) return true;
|
|
680
|
+
if (/^(user|channel):/i.test(trimmed)) return true;
|
|
681
|
+
if (/^slack:/i.test(trimmed)) return true;
|
|
682
|
+
if (/^[@#]/.test(trimmed)) return true;
|
|
683
|
+
return /^[CUWGD][A-Z0-9]{8,}$/i.test(trimmed);
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
//#endregion
|
|
687
|
+
//#region src/channels/plugins/directory-config.ts
|
|
688
|
+
function addAllowFromAndDmsIds(ids, allowFrom, dms) {
|
|
689
|
+
for (const entry of allowFrom ?? []) {
|
|
690
|
+
const raw = String(entry).trim();
|
|
691
|
+
if (!raw || raw === "*") continue;
|
|
692
|
+
ids.add(raw);
|
|
693
|
+
}
|
|
694
|
+
addTrimmedEntries(ids, Object.keys(dms ?? {}));
|
|
695
|
+
}
|
|
696
|
+
function addTrimmedId(ids, value) {
|
|
697
|
+
const trimmed = String(value).trim();
|
|
698
|
+
if (trimmed) ids.add(trimmed);
|
|
699
|
+
}
|
|
700
|
+
function addTrimmedEntries(ids, values) {
|
|
701
|
+
for (const value of values) addTrimmedId(ids, value);
|
|
702
|
+
}
|
|
703
|
+
function normalizeTrimmedSet(ids, normalize) {
|
|
704
|
+
return Array.from(ids).map((raw) => raw.trim()).filter(Boolean).map((raw) => normalize(raw)).filter((id) => Boolean(id));
|
|
705
|
+
}
|
|
706
|
+
function resolveDirectoryQuery(query) {
|
|
707
|
+
return query?.trim().toLowerCase() || "";
|
|
708
|
+
}
|
|
709
|
+
function resolveDirectoryLimit(limit) {
|
|
710
|
+
return typeof limit === "number" && limit > 0 ? limit : void 0;
|
|
711
|
+
}
|
|
712
|
+
function applyDirectoryQueryAndLimit(ids, params) {
|
|
713
|
+
const q = resolveDirectoryQuery(params.query);
|
|
714
|
+
const limit = resolveDirectoryLimit(params.limit);
|
|
715
|
+
const filtered = ids.filter((id) => q ? id.toLowerCase().includes(q) : true);
|
|
716
|
+
return typeof limit === "number" ? filtered.slice(0, limit) : filtered;
|
|
717
|
+
}
|
|
718
|
+
function toDirectoryEntries(kind, ids) {
|
|
719
|
+
return ids.map((id) => ({
|
|
720
|
+
kind,
|
|
721
|
+
id
|
|
722
|
+
}));
|
|
723
|
+
}
|
|
724
|
+
async function listSlackDirectoryPeersFromConfig(params) {
|
|
725
|
+
const account = resolveSlackAccount({
|
|
726
|
+
cfg: params.cfg,
|
|
727
|
+
accountId: params.accountId
|
|
728
|
+
});
|
|
729
|
+
const ids = /* @__PURE__ */ new Set();
|
|
730
|
+
addAllowFromAndDmsIds(ids, account.config.allowFrom ?? account.dm?.allowFrom, account.config.dms);
|
|
731
|
+
for (const channel of Object.values(account.config.channels ?? {})) addTrimmedEntries(ids, channel.users ?? []);
|
|
732
|
+
return toDirectoryEntries("user", applyDirectoryQueryAndLimit(normalizeTrimmedSet(ids, (raw) => {
|
|
733
|
+
const normalizedUserId = (raw.match(/^<@([A-Z0-9]+)>$/i)?.[1] ?? raw).replace(/^(slack|user):/i, "").trim();
|
|
734
|
+
if (!normalizedUserId) return null;
|
|
735
|
+
const target = `user:${normalizedUserId}`;
|
|
736
|
+
return normalizeSlackMessagingTarget(target) ?? target.toLowerCase();
|
|
737
|
+
}).filter((id) => id.startsWith("user:")), params));
|
|
738
|
+
}
|
|
739
|
+
async function listSlackDirectoryGroupsFromConfig(params) {
|
|
740
|
+
const account = resolveSlackAccount({
|
|
741
|
+
cfg: params.cfg,
|
|
742
|
+
accountId: params.accountId
|
|
743
|
+
});
|
|
744
|
+
return toDirectoryEntries("group", applyDirectoryQueryAndLimit(Object.keys(account.config.channels ?? {}).map((raw) => raw.trim()).filter(Boolean).map((raw) => normalizeSlackMessagingTarget(raw) ?? raw.toLowerCase()).filter((id) => id.startsWith("channel:")), params));
|
|
745
|
+
}
|
|
746
|
+
async function listDiscordDirectoryPeersFromConfig(params) {
|
|
747
|
+
const account = resolveDiscordAccount({
|
|
748
|
+
cfg: params.cfg,
|
|
749
|
+
accountId: params.accountId
|
|
750
|
+
});
|
|
751
|
+
const ids = /* @__PURE__ */ new Set();
|
|
752
|
+
addAllowFromAndDmsIds(ids, account.config.allowFrom ?? account.config.dm?.allowFrom, account.config.dms);
|
|
753
|
+
for (const guild of Object.values(account.config.guilds ?? {})) {
|
|
754
|
+
addTrimmedEntries(ids, guild.users ?? []);
|
|
755
|
+
for (const channel of Object.values(guild.channels ?? {})) addTrimmedEntries(ids, channel.users ?? []);
|
|
756
|
+
}
|
|
757
|
+
return toDirectoryEntries("user", applyDirectoryQueryAndLimit(normalizeTrimmedSet(ids, (raw) => {
|
|
758
|
+
const cleaned = (raw.match(/^<@!?(\d+)>$/)?.[1] ?? raw).replace(/^(discord|user):/i, "").trim();
|
|
759
|
+
if (!/^\d+$/.test(cleaned)) return null;
|
|
760
|
+
return `user:${cleaned}`;
|
|
761
|
+
}), params));
|
|
762
|
+
}
|
|
763
|
+
async function listDiscordDirectoryGroupsFromConfig(params) {
|
|
764
|
+
const account = resolveDiscordAccount({
|
|
765
|
+
cfg: params.cfg,
|
|
766
|
+
accountId: params.accountId
|
|
767
|
+
});
|
|
768
|
+
const ids = /* @__PURE__ */ new Set();
|
|
769
|
+
for (const guild of Object.values(account.config.guilds ?? {})) addTrimmedEntries(ids, Object.keys(guild.channels ?? {}));
|
|
770
|
+
return toDirectoryEntries("group", applyDirectoryQueryAndLimit(normalizeTrimmedSet(ids, (raw) => {
|
|
771
|
+
const cleaned = (raw.match(/^<#(\d+)>$/)?.[1] ?? raw).replace(/^(discord|channel|group):/i, "").trim();
|
|
772
|
+
if (!/^\d+$/.test(cleaned)) return null;
|
|
773
|
+
return `channel:${cleaned}`;
|
|
774
|
+
}), params));
|
|
775
|
+
}
|
|
776
|
+
async function listTelegramDirectoryPeersFromConfig(params) {
|
|
777
|
+
const account = resolveTelegramAccount({
|
|
778
|
+
cfg: params.cfg,
|
|
779
|
+
accountId: params.accountId
|
|
780
|
+
});
|
|
781
|
+
const raw = [...(account.config.allowFrom ?? []).map((entry) => String(entry)), ...Object.keys(account.config.dms ?? {})];
|
|
782
|
+
return toDirectoryEntries("user", applyDirectoryQueryAndLimit(Array.from(new Set(raw.map((entry) => entry.trim()).filter(Boolean).map((entry) => entry.replace(/^(telegram|tg):/i, "")))).map((entry) => {
|
|
783
|
+
const trimmed = entry.trim();
|
|
784
|
+
if (!trimmed) return null;
|
|
785
|
+
if (/^-?\d+$/.test(trimmed)) return trimmed;
|
|
786
|
+
return trimmed.startsWith("@") ? trimmed : `@${trimmed}`;
|
|
787
|
+
}).filter((id) => Boolean(id)), params));
|
|
788
|
+
}
|
|
789
|
+
async function listTelegramDirectoryGroupsFromConfig(params) {
|
|
790
|
+
const account = resolveTelegramAccount({
|
|
791
|
+
cfg: params.cfg,
|
|
792
|
+
accountId: params.accountId
|
|
793
|
+
});
|
|
794
|
+
return toDirectoryEntries("group", applyDirectoryQueryAndLimit(Object.keys(account.config.groups ?? {}).map((id) => id.trim()).filter((id) => Boolean(id) && id !== "*"), params));
|
|
795
|
+
}
|
|
796
|
+
async function listWhatsAppDirectoryPeersFromConfig(params) {
|
|
797
|
+
return toDirectoryEntries("user", applyDirectoryQueryAndLimit((resolveWhatsAppAccount({
|
|
798
|
+
cfg: params.cfg,
|
|
799
|
+
accountId: params.accountId
|
|
800
|
+
}).allowFrom ?? []).map((entry) => String(entry).trim()).filter((entry) => Boolean(entry) && entry !== "*").map((entry) => normalizeWhatsAppTarget(entry) ?? "").filter(Boolean).filter((id) => !isWhatsAppGroupJid(id)), params));
|
|
801
|
+
}
|
|
802
|
+
async function listWhatsAppDirectoryGroupsFromConfig(params) {
|
|
803
|
+
const account = resolveWhatsAppAccount({
|
|
804
|
+
cfg: params.cfg,
|
|
805
|
+
accountId: params.accountId
|
|
806
|
+
});
|
|
807
|
+
return toDirectoryEntries("group", applyDirectoryQueryAndLimit(Object.keys(account.groups ?? {}).map((id) => id.trim()).filter((id) => Boolean(id) && id !== "*"), params));
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
//#endregion
|
|
811
|
+
//#region src/channels/plugins/index.ts
|
|
812
|
+
function dedupeChannels(channels) {
|
|
813
|
+
const seen = /* @__PURE__ */ new Set();
|
|
814
|
+
const resolved = [];
|
|
815
|
+
for (const plugin of channels) {
|
|
816
|
+
const id = String(plugin.id).trim();
|
|
817
|
+
if (!id || seen.has(id)) continue;
|
|
818
|
+
seen.add(id);
|
|
819
|
+
resolved.push(plugin);
|
|
820
|
+
}
|
|
821
|
+
return resolved;
|
|
822
|
+
}
|
|
823
|
+
let cachedChannelPlugins = {
|
|
824
|
+
registryVersion: -1,
|
|
825
|
+
sorted: [],
|
|
826
|
+
byId: /* @__PURE__ */ new Map()
|
|
827
|
+
};
|
|
828
|
+
function resolveCachedChannelPlugins() {
|
|
829
|
+
const registry = requireActivePluginRegistry();
|
|
830
|
+
const registryVersion = getActivePluginRegistryVersion();
|
|
831
|
+
const cached = cachedChannelPlugins;
|
|
832
|
+
if (cached.registryVersion === registryVersion) return cached;
|
|
833
|
+
const sorted = dedupeChannels(registry.channels.map((entry) => entry.plugin)).toSorted((a, b) => {
|
|
834
|
+
const indexA = CHAT_CHANNEL_ORDER.indexOf(a.id);
|
|
835
|
+
const indexB = CHAT_CHANNEL_ORDER.indexOf(b.id);
|
|
836
|
+
const orderA = a.meta.order ?? (indexA === -1 ? 999 : indexA);
|
|
837
|
+
const orderB = b.meta.order ?? (indexB === -1 ? 999 : indexB);
|
|
838
|
+
if (orderA !== orderB) return orderA - orderB;
|
|
839
|
+
return a.id.localeCompare(b.id);
|
|
840
|
+
});
|
|
841
|
+
const byId = /* @__PURE__ */ new Map();
|
|
842
|
+
for (const plugin of sorted) byId.set(plugin.id, plugin);
|
|
843
|
+
const next = {
|
|
844
|
+
registryVersion,
|
|
845
|
+
sorted,
|
|
846
|
+
byId
|
|
847
|
+
};
|
|
848
|
+
cachedChannelPlugins = next;
|
|
849
|
+
return next;
|
|
850
|
+
}
|
|
851
|
+
function listChannelPlugins() {
|
|
852
|
+
return resolveCachedChannelPlugins().sorted.slice();
|
|
853
|
+
}
|
|
854
|
+
function getChannelPlugin(id) {
|
|
855
|
+
const resolvedId = String(id).trim();
|
|
856
|
+
if (!resolvedId) return;
|
|
857
|
+
return resolveCachedChannelPlugins().byId.get(resolvedId);
|
|
858
|
+
}
|
|
859
|
+
function normalizeChannelId(raw) {
|
|
860
|
+
return normalizeAnyChannelId(raw);
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
//#endregion
|
|
864
|
+
export { listSlackAccountIds as A, listEnabledDiscordAccounts as B, resolveTelegramAccount as C, listConfiguredAccountIds$1 as D, listBindings as E, resolveSlackBotToken as F, resolveDiscordAccount as H, isWhatsAppGroupJid as I, normalizeWhatsAppTarget as L, resolveSlackAccount as M, resolveSlackReplyToMode as N, resolveAccountWithDefaultFallback as O, resolveSlackAppToken as P, createDiscordActionGate as R, resolveDefaultTelegramAccountId as S, buildChannelAccountBindings as T, normalizeDiscordToken as U, resolveDefaultDiscordAccountId as V, normalizeChatType as W, parseMentionPrefixOrAtUserTarget as _, listDiscordDirectoryPeersFromConfig as a, listEnabledTelegramAccounts as b, listTelegramDirectoryGroupsFromConfig as c, listWhatsAppDirectoryPeersFromConfig as d, looksLikeSlackTargetId as f, buildMessagingTarget as g, resolveSlackChannelId as h, listDiscordDirectoryGroupsFromConfig as i, resolveDefaultSlackAccountId as j, listEnabledSlackAccounts as k, listTelegramDirectoryPeersFromConfig as l, parseSlackTarget as m, listChannelPlugins as n, listSlackDirectoryGroupsFromConfig as o, normalizeSlackMessagingTarget as p, normalizeChannelId as r, listSlackDirectoryPeersFromConfig as s, getChannelPlugin as t, listWhatsAppDirectoryGroupsFromConfig as u, requireTargetKind as v, resolveTelegramToken as w, listTelegramAccountIds as x, createTelegramActionGate as y, listDiscordAccountIds as z };
|