@gguf/claw 2026.2.4 → 2026.2.5
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/CHANGELOG.md +50 -1
- package/LICENSE +1 -1
- package/README.md +50 -43
- package/dist/{accounts-BlHoTziG.js → accounts-BgZmhIm6.js} +4 -4
- package/dist/{accounts-B5QZU96b.js → accounts-Dto4p9zB.js} +2 -2
- package/dist/{acp-cli-DU_cVWbN.js → acp-cli-BOKabdeW.js} +15 -15
- package/dist/{acp-cli-O8LcQigE.js → acp-cli-BwcHtBDk.js} +19 -19
- package/dist/{agent-BBI-UGkN.js → agent-DztWhVCH.js} +20 -13
- package/dist/{agent-DuQt3QDO.js → agent-_H-0rbHV.js} +21 -14
- package/dist/{agent-scope-jm0ZdXwM.js → agent-scope-C9VjJXEK.js} +5 -180
- package/dist/{agent-scope-CrgUOY3f.js → agent-scope-CMs5Y7l-.js} +6 -181
- package/dist/{agent-scope-COnICB_7.js → agent-scope-Csu2B6AM.js} +2 -2
- package/dist/{audit-D-OqdjQu.js → audit-BWbjQmyv.js} +182 -15
- package/dist/{audit-CWGOX7Eh.js → audit-ZY6Dk5Ec.js} +183 -16
- package/dist/{auth-viF_w60n.js → auth-CbhB03Rz.js} +2 -2
- package/dist/{auth-DK3l201_.js → auth-DksjO6WG.js} +2 -2
- package/dist/{auth-health-DcKoxhDo.js → auth-health-C4bElkgf.js} +1 -1
- package/dist/{auth-health-Ba9GTScq.js → auth-health-Ctf-_JFE.js} +1 -1
- package/dist/{auth-profiles-CfFGCDJa.js → auth-profiles-CYBuGiBb.js} +38 -13
- package/dist/build-info.json +2 -2
- package/dist/{call-CfqL-4Nc.js → call-90HgQQ8o.js} +34 -8
- package/dist/{call-CPBhMXxo.js → call-BTbA5OB4.js} +35 -9
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/canvas-host/a2ui/a2ui.bundle.js +29 -44
- package/dist/{channel-options-eRR8_a8h.js → channel-options-DrUmtdd9.js} +3 -3
- package/dist/{channel-options-BCSvD6JM.js → channel-options-uftAnT5P.js} +7 -7
- package/dist/{channel-selection-BAwiO0li.js → channel-selection-CJWYmCLf.js} +2 -2
- package/dist/{channel-selection-BCn8_qun.js → channel-selection-PZuuCvrp.js} +2 -2
- package/dist/{channel-summary-BkqO8zZ9.js → channel-summary-D9nzC5WB.js} +8 -42
- package/dist/{channel-summary-C8GoEKgH.js → channel-summary-DUiKDBLv.js} +9 -43
- package/dist/{channels-cli-CBGINubh.js → channels-cli-PAlqhOZ7.js} +56 -54
- package/dist/{channels-cli-yQo-Rzw6.js → channels-cli-PPk5wwuy.js} +59 -57
- package/dist/{channels-status-issues-C9vMMPG0.js → channels-status-issues-CJ8PJgDc.js} +1 -1
- package/dist/{channels-status-issues-DRXQXvhY.js → channels-status-issues-CrS1r5sr.js} +1 -1
- package/dist/{chrome-DlqPCh1y.js → chrome-B3IuUad-.js} +2 -2
- package/dist/{chrome-D2LUApAY.js → chrome-BNSd7Bie.js} +5 -5
- package/dist/{clack-prompter-OmDa1Hm1.js → clack-prompter-CEKDd_Vg.js} +5 -5
- package/dist/{clack-prompter-BJuVh97L.js → clack-prompter-DuBVnTKy.js} +4 -4
- package/dist/cli/daemon-cli.js +1 -1
- package/dist/cli-DBAccB3n.js +86 -0
- package/dist/cli-DD5dW58-.js +89 -0
- package/dist/{client-zqMhLTAX.js → client-BYVbRnuQ.js} +13 -5
- package/dist/{client-cU7Xg1MO.js → client-CxbkcEZ7.js} +12 -4
- package/dist/{command-options-51bBgSJL.js → command-options-DUUINcz0.js} +3 -3
- package/dist/{commands-DMKDOFmC.js → commands-DAC7XMAT.js} +5 -4
- package/dist/completion-cli-BPIeQDFy.js +773 -0
- package/dist/{completion-cli-BoF86Oeq.js → completion-cli-BbhA_JbG.js} +62 -15
- package/dist/{config-qgIz1lbh.js → config-CAuZ-EkU.js} +93 -31
- package/dist/{config-CGsoho7J.js → config-CG73z4h6.js} +61 -28
- package/dist/{config-DCT1RAo6.js → config-CKLedg5Y.js} +92 -30
- package/dist/{config-guard-CJuPkD5Y.js → config-guard-a5ynrKd-.js} +181 -57
- package/dist/{configure-C1_0rFdQ.js → configure-B47GYdlB.js} +33 -23
- package/dist/{configure-D0OAmW2s.js → configure-ChnTy7Jz.js} +31 -21
- package/dist/{control-service-BW5sW2U1.js → control-service-CS61Road.js} +13 -6
- package/dist/{control-service-Ds9ompnU.js → control-service-D2E9NKqQ.js} +12 -5
- package/dist/control-ui/assets/{index-RwcW4Xl0.css → index-BoXosYY6.css} +1 -1
- package/dist/control-ui/assets/index-Dm6g1E26.js +7553 -0
- package/dist/control-ui/assets/index-Dm6g1E26.js.map +1 -0
- package/dist/control-ui/index.html +2 -2
- package/dist/{cron-cli-Bn_e3WGb.js → cron-cli-CssI71-c.js} +20 -19
- package/dist/{cron-cli-BVARiNrv.js → cron-cli-Ys53MyTg.js} +24 -23
- package/dist/{daemon-cli-fHXAapHL.js → daemon-cli-B6aLZ8OE.js} +28 -23
- package/dist/{daemon-cli-yy_MAYxv.js → daemon-cli-CMKd_D6h.js} +26 -21
- package/dist/{daemon-runtime-vNkYv9tq.js → daemon-runtime-BCn_QIHK.js} +64 -7
- package/dist/{daemon-runtime-ELWW7q0C.js → daemon-runtime-DMd0mgTK.js} +64 -7
- package/dist/{deliver-Bsvrattg.js → deliver-C3bnXkg5.js} +12 -10
- package/dist/{deliver-Dl8TEyHM.js → deliver-CZPhTA7x.js} +7 -5
- package/dist/{deliver-eE21zdeQ.js → deliver-Cau4HL7W.js} +11 -9
- package/dist/{deps-BrcOX0ht.js → deps-BG1LonF6.js} +2 -2
- package/dist/{deps-wXkiMwLZ.js → deps-ytXmI88x.js} +2 -2
- package/dist/{devices-cli-BjlwgE6B.js → devices-cli-Cm0ENrXH.js} +16 -16
- package/dist/{devices-cli-BVc_Ic5O.js → devices-cli-D_rnGkqO.js} +12 -12
- package/dist/{directory-cli-cc9ivzEM.js → directory-cli-CGLolzJC.js} +15 -15
- package/dist/{directory-cli-CULRQACb.js → directory-cli-CTtv_AB7.js} +19 -19
- package/dist/{dispatcher-BNB5aCZ6.js → dispatcher-6oI-H42S.js} +1 -1
- package/dist/{dns-cli-BwDdBlsK.js → dns-cli-BRkJGLqK.js} +15 -15
- package/dist/{dns-cli-B79COhmu.js → dns-cli-CoeI4817.js} +11 -11
- package/dist/{docs-cli-BM55jf4Y.js → docs-cli-BH9bMx3a.js} +7 -7
- package/dist/{docs-cli-t7IEzxr8.js → docs-cli-Bh1Coji2.js} +10 -10
- package/dist/{doctor-CT9JPoCt.js → doctor-CwSrWRCp.js} +43 -38
- package/dist/{doctor-OmfNRlMS.js → doctor-JnMryC_M.js} +40 -35
- package/dist/entry.js +12 -8
- package/dist/{env-DOcCob95.js → env-0_mKbEWW.js} +2 -2
- package/dist/{errors-DdT2Dtkb.js → errors-CZ9opC6L.js} +4 -4
- package/dist/{exec-B7WKla_0.js → exec-BMnoMcZW.js} +1 -1
- package/dist/{exec-CTo4hK94.js → exec-HEWTMJ7j.js} +1 -1
- package/dist/{exec-approvals-WdYFyy5N.js → exec-approvals-BCEFzcbC.js} +19 -2
- package/dist/{exec-approvals-CK-Umdr3.js → exec-approvals-DZixgolZ.js} +19 -2
- package/dist/{exec-approvals-cli-DD_z4fL9.js → exec-approvals-cli-D7aVv5hN.js} +19 -19
- package/dist/{exec-approvals-cli-BK2toX2b.js → exec-approvals-cli-DzLp5G7t.js} +23 -23
- package/dist/extensionAPI.js +1186 -267
- package/dist/{gateway-cli-BCC0T5iY.js → gateway-cli-DHP5DRUH.js} +910 -199
- package/dist/{gateway-cli-BTlr6Uwl.js → gateway-cli-ape0pnBU.js} +912 -202
- package/dist/{gateway-rpc-CMAcradB.js → gateway-rpc-C8rNIC0P.js} +3 -3
- package/dist/{gateway-rpc-SvVB4Fmv.js → gateway-rpc-CWnTaSEY.js} +3 -3
- package/dist/{github-copilot-auth-BHLcQ1sN.js → github-copilot-auth-B_lK1g__.js} +173 -87
- package/dist/{github-copilot-auth-BoRchp_Q.js → github-copilot-auth-C8Uf0Q03.js} +174 -88
- package/dist/{github-copilot-token-BEtihsn6.js → github-copilot-token-B3SA95yo.js} +8 -2
- package/dist/{github-copilot-token-rP-6QdKv.js → github-copilot-token-SLWintYd.js} +7 -1
- package/dist/{github-copilot-token-VZsS4013.js → github-copilot-token-pGSmVaW-.js} +8 -2
- package/dist/{gmail-setup-utils-4czdWNCN.js → gmail-setup-utils-Bi6W14MK.js} +3 -3
- package/dist/{gmail-setup-utils-B1CTmT2V.js → gmail-setup-utils-QpN7TEXS.js} +4 -4
- package/dist/{health-format-B4_A88V3.js → health-format-B3eStY5r.js} +215 -21
- package/dist/{health-format-Ct8J0fwc.js → health-format-ND2rUbQO.js} +213 -19
- package/dist/{help-format-CGcnDM3D.js → help-format-Bozi4K9H.js} +1 -1
- package/dist/{helpers-DfgBr1D5.js → helpers-BIc7L8EF.js} +1 -1
- package/dist/{helpers-Cw9kFCkw.js → helpers-D66_XoIz.js} +1 -1
- package/dist/{hooks-cli-NmkXLKmj.js → hooks-cli-BMu_-4Ru.js} +49 -49
- package/dist/{hooks-cli-B-28F__A.js → hooks-cli-CmeQxEOM.js} +45 -45
- package/dist/{hooks-status-I3Y60zVN.js → hooks-status-CKmUPU-M.js} +3 -3
- package/dist/{hooks-status-XV9oQICf.js → hooks-status-DepPyfBb.js} +4 -4
- package/dist/{image-ClOB6QDJ.js → image-Ca_PtqY7.js} +8 -6
- package/dist/{image-BYmtfVH8.js → image-CgBndiQy.js} +9 -7
- package/dist/{image-CXg7Z0WD.js → image-nRwqkmtf.js} +8 -6
- package/dist/index.js +231 -105
- package/dist/{installs-C5cjVarj.js → installs-BhEjOqPy.js} +43 -6
- package/dist/{installs-W4Pc1LJz.js → installs-DsJkyWfL.js} +43 -6
- package/dist/{links-C9fyAH-V.js → links-B5pRdmo1.js} +1 -1
- package/dist/{links-jGisPfXW.js → links-D0uzJbi6.js} +1 -1
- package/dist/{loader-BYWxo-_j.js → loader-_Pj-TZS2.js} +920 -491
- package/dist/{logging-BnUUuH3y.js → logging-Cc7m6PTv.js} +1 -1
- package/dist/{logging-CLCWl7Iu.js → logging-TXWhN8jG.js} +2 -2
- package/dist/{login-qr-C2H_iQJU.js → login-qr-BIlr0vwe.js} +12 -7
- package/dist/{login-qr-7WOtj6zE.js → login-qr-CcOWO_dR.js} +9 -4
- package/dist/{login-qr-sEcxw1_U.js → login-qr-Cmsf7BGt.js} +11 -6
- package/dist/{logs-cli-C5v4fEDj.js → logs-cli-5L3NxTsc.js} +19 -19
- package/dist/{logs-cli-nVwK5g60.js → logs-cli-DtiFFkZL.js} +15 -15
- package/dist/{manager-rDmdE7O9.js → manager-BXiIQku7.js} +9 -7
- package/dist/{manager-JSP5pLyv.js → manager-C4ILl-d3.js} +10 -8
- package/dist/{manager-BArueSTR.js → manager-LpytrxUw.js} +12 -10
- package/dist/{manifest-registry-tuAcHxrV.js → manifest-registry-C69Z-I4v.js} +1 -1
- package/dist/{manifest-registry-BFpLJJDB.js → manifest-registry-DHaa1SJb.js} +1 -1
- package/dist/{message-channel-CAFcg7mw.js → message-channel-BlgPSDAh.js} +6 -1
- package/dist/{message-channel-CQGWXVL4.js → message-channel-Bpfe5l5f.js} +7 -2
- package/dist/{model-selection-Cp1maz7B.js → model-selection-DMUrNhQP.js} +41 -16
- package/dist/{model-selection-Cs1y6OBv.js → model-selection-mzTqrNoj.js} +38 -14
- package/dist/{models-cli-n9a8pESx.js → models-cli-DHzyyLvp.js} +49 -49
- package/dist/{models-cli-DGnLcr4X.js → models-cli-EhrWjNLH.js} +53 -53
- package/dist/{net-DaJz_a4n.js → net-C8YRVt16.js} +1 -1
- package/dist/{net-DeiCIMU6.js → net-CWMMy37F.js} +1 -1
- package/dist/{node-cli-rtEq-YyU.js → node-cli-2oYmIWJt.js} +30 -30
- package/dist/{node-cli-AOO0HsM1.js → node-cli-DH7Ykym5.js} +26 -26
- package/dist/{node-service-CjtBRyjp.js → node-service-BAYHx0E7.js} +2 -2
- package/dist/{node-service-BW_LhY5w.js → node-service-Lc1LlnFH.js} +2 -2
- package/dist/{nodes-cli-Coxj5hDA.js → nodes-cli-Bc5K-0Lt.js} +22 -22
- package/dist/{nodes-cli-ChBsNXzz.js → nodes-cli-hT8yYD7S.js} +18 -18
- package/dist/{nodes-screen-Ln98EX_f.js → nodes-screen-DGlNPbk4.js} +2 -2
- package/dist/{nodes-screen-DOhGEibx.js → nodes-screen-DT5HvhJV.js} +2 -2
- package/dist/{note-BFpD-42H.js → note-B5HnoeZX.js} +2 -2
- package/dist/{note-CBiVaqG7.js → note-Ci08TSbV.js} +1 -1
- package/dist/{onboard-channels-CF7lTDNu.js → onboard-channels-D-ZQTy5V.js} +9 -8
- package/dist/{onboard-channels-CJCy7TTQ.js → onboard-channels-DKT27PdN.js} +10 -9
- package/dist/{onboard-skills-DdFGj9pt.js → onboard-skills-YobctE-R.js} +259 -194
- package/dist/{onboard-skills-fL84FI8F.js → onboard-skills-s8J5xbUr.js} +259 -194
- package/dist/{onboarding-DcN1avQK.js → onboarding-BP4-5uzE.js} +96 -60
- package/dist/{pairing-cli-DbP9KqPL.js → pairing-cli-C8KHRjaU.js} +15 -15
- package/dist/{pairing-cli-B7RQFp4r.js → pairing-cli-i7wiTmYC.js} +19 -19
- package/dist/{pairing-labels-DK2aLSd2.js → pairing-labels-BbydDT7w.js} +1 -1
- package/dist/{pairing-labels-C6I3dD-m.js → pairing-labels-CtqLxbG6.js} +1 -1
- package/dist/{pairing-store-BnMngoWQ.js → pairing-store-DFq7WtOv.js} +2 -2
- package/dist/{pairing-store-DMex6WWe.js → pairing-store-DTfv_FGA.js} +1 -1
- package/dist/{path-env-CuGC6r1F.js → path-env-DP3DsVge.js} +2 -2
- package/dist/{path-env-CUhrC5DA.js → path-env-h3xp5PqO.js} +1 -1
- package/dist/{paths-xPuk88Yf.js → paths-B4kigINg.js} +2 -2
- package/dist/{paths-50eo6DV6.js → paths-Bb0nwPeu.js} +2 -2
- package/dist/{paths-RvF0P6tQ.js → paths-CTg8F3AE.js} +1 -1
- package/dist/{pi-embedded-helpers-DJgCXZEz.js → pi-embedded-helpers-BB4uACeq.js} +175 -170
- package/dist/{pi-embedded-helpers-DiK8Qn1l.js → pi-embedded-helpers-BxqZh6U7.js} +43 -19
- package/dist/{pi-embedded-helpers-CC00lEFI.js → pi-embedded-helpers-DF8SAHU-.js} +175 -170
- package/dist/{pi-model-discovery-DjGamP_B.js → pi-model-discovery-CV2V1HHz.js} +8 -1
- package/dist/{pi-model-discovery-CnK2Dol8.js → pi-model-discovery-DzEIEgHL.js} +8 -1
- package/dist/{pi-model-discovery-CsRo-xMp.js → pi-model-discovery-EhM2JAQo.js} +8 -1
- package/dist/{pi-tools.policy-DleRi9eC.js → pi-tools.policy-BQ8N5y8a.js} +5 -4
- package/dist/{plugin-auto-enable-JQ63k0Ce.js → plugin-auto-enable-Ci7TBlH2.js} +5 -5
- package/dist/{plugin-auto-enable-CIVp3SAp.js → plugin-auto-enable-DyW8lHTT.js} +4 -4
- package/dist/plugin-sdk/index.d.ts +228 -283
- package/dist/plugin-sdk/index.js +22528 -69091
- package/dist/plugin-sdk/pi-model-discovery-Dw3A6oXH.js +37 -0
- package/dist/{plugins-TrKFfrLt.js → plugins-BUPpq5aS.js} +3 -2
- package/dist/{plugins-D1CxUobm.js → plugins-BYIWo0Cp.js} +5 -4
- package/dist/{plugins-cli-17wYux52.js → plugins-cli-CGfxctIx.js} +50 -49
- package/dist/{plugins-cli-VyQWn_LW.js → plugins-cli-Dr_R2-FY.js} +46 -45
- package/dist/{ports-B27T1uRn.js → ports-0V-Mu4ch.js} +2 -2
- package/dist/{program-BA9_uWfO.js → program-oR55MCAT.js} +84 -81
- package/dist/{progress-uNDQDtGB.js → progress-xpLtQsNY.js} +1 -1
- package/dist/{prompt-style-gfROyHgB.js → prompt-style-vzh0MGHs.js} +1 -1
- package/dist/{pw-ai-BC4dLE7k.js → pw-ai-B7Fvw8DW.js} +4 -4
- package/dist/{pw-ai-DlTBXZjY.js → pw-ai-DYpQO6HI.js} +6 -6
- package/dist/{pw-ai-BEqPnalN.js → pw-ai-tNPuRNn3.js} +4 -4
- package/dist/{qmd-manager-8xWxIGbO.js → qmd-manager-BKkFEEN_.js} +9 -8
- package/dist/{plugin-sdk/qmd-manager-DvkA01DP.js → qmd-manager-CF52nuBg.js} +6 -6
- package/dist/{qmd-manager-BSCOmXYZ.js → qmd-manager-Dub8jfbo.js} +7 -6
- package/dist/{register.subclis-CWWz9WdX.js → register.subclis-BpIR6Iqi.js} +36 -30
- package/dist/{reply-CoztdrN_.js → reply-B8pOiUNN.js} +935 -506
- package/dist/rolldown-runtime-Cbj13DAv.js +20 -0
- package/dist/{routes-yI5QIzeL.js → routes-BSfXf8a5.js} +5 -5
- package/dist/{routes-Ds-tIZFJ.js → routes-DchZU3EK.js} +6 -6
- package/dist/{rpc-HF82_iLh.js → rpc-DqI3QH59.js} +3 -3
- package/dist/{rpc-HdKLb6jx.js → rpc-Vo2ACfn-.js} +3 -3
- package/dist/{run-main-B3krVvc1.js → run-main-DrVUUPHV.js} +84 -84
- package/dist/{sandbox-BXUfp_qv.js → sandbox-CV8VwPij.js} +36 -16
- package/dist/{sandbox-Cnq9TXEn.js → sandbox-DuqLKN5J.js} +34 -14
- package/dist/{sandbox-cli-C7j1V6tb.js → sandbox-cli-C0_Hrk7i.js} +25 -24
- package/dist/{sandbox-cli-CnS9JJlO.js → sandbox-cli-Ces6i3n2.js} +21 -20
- package/dist/{security-cli-Clg7RQT3.js → security-cli-CybLT9XS.js} +32 -30
- package/dist/{security-cli-BGd4NO4l.js → security-cli-T7yrd3lb.js} +28 -26
- package/dist/{server-context-D2cv-pIA.js → server-context-vChIAqjH.js} +6 -6
- package/dist/{server-context-CM_E6wD5.js → server-context-yKyxyxOJ.js} +5 -5
- package/dist/{server-node-events-IMwI538C.js → server-node-events-BR2vHqf6.js} +44 -43
- package/dist/{server-node-events-C5EqDe_U.js → server-node-events-D39FA0NG.js} +48 -47
- package/dist/{service-CAxAjHNB.js → service-BZesBIaG.js} +3 -3
- package/dist/{service-BoDHq_LN.js → service-_JwSmGSn.js} +2 -2
- package/dist/{service-audit-Bf33pqEM.js → service-audit-C-IA4omi.js} +6 -6
- package/dist/{service-audit-DBSAGhm8.js → service-audit-DDX1kO3k.js} +6 -6
- package/dist/session-cost-usage-BTXosU1k.js +692 -0
- package/dist/session-cost-usage-CBP4Hv9D.js +692 -0
- package/dist/session-key-CZkcvAtx.js +177 -0
- package/dist/session-key-Dm2EOhrH.js +177 -0
- package/dist/{shared-ChNOqAzp.js → shared-BmtNKsPq.js} +4 -4
- package/dist/{shared-D42-KbPa.js → shared-C1XLEyB0.js} +3 -3
- package/dist/{shared-xZjRQa6y.js → shared-C8_5pNbb.js} +4 -4
- package/dist/{shared-DBGw227P.js → shared-fnGLWyZ6.js} +3 -3
- package/dist/skill-scanner-BoGjHXUZ.js +255 -0
- package/dist/skill-scanner-Bp1D9gra.js +255 -0
- package/dist/{skills-DtwGIkTI.js → skills-CmU0Q92f.js} +3 -3
- package/dist/{skills-C4b1FA1e.js → skills-D5JDj3TR.js} +5 -5
- package/dist/{skills-cli-BPkuJAz9.js → skills-cli-C1yJvIkL.js} +16 -16
- package/dist/{skills-cli-b0ZmGlmh.js → skills-cli-DBC5zFat.js} +12 -12
- package/dist/{skills-status-CSCMqNZP.js → skills-status-CEvVUD3U.js} +3 -3
- package/dist/{skills-status-CWkBweWW.js → skills-status-DtXrj3fy.js} +2 -2
- package/dist/{status-BIWeu5mN.js → status-BRXuHUsK.js} +94 -58
- package/dist/{status-CcM6W8r4.js → status-BTGXSvZ1.js} +3 -3
- package/dist/{status-PjegR5Cv.js → status-DBZ5Z7ng.js} +4 -4
- package/dist/{subsystem-46MXi6Ip.js → subsystem-CAq3uyo7.js} +1 -1
- package/dist/{system-cli-B4FEIE5d.js → system-cli-Dqnt-b0D.js} +13 -13
- package/dist/{system-cli-BL_QZ1VP.js → system-cli-SJLtqI47.js} +17 -17
- package/dist/{systemd-DAgZTW06.js → systemd-8sIc6isV.js} +2 -2
- package/dist/{systemd-CNYEkRek.js → systemd-B-3NdMmA.js} +3 -3
- package/dist/{systemd-hints-CcgK8AJE.js → systemd-hints-DO88c_nD.js} +1 -1
- package/dist/{systemd-hints-okqOoOug.js → systemd-hints-Wim4Bq6j.js} +1 -1
- package/dist/{systemd-linger-CTe0ZDxD.js → systemd-linger-N-cIaegf.js} +8 -3
- package/dist/{systemd-linger-Cbkoh9qw.js → systemd-linger-SsSOsJST.js} +8 -3
- package/dist/{table-f0EgX-YI.js → table-CJSx0YID.js} +1 -1
- package/dist/{table-DuNe7Qes.js → table-CLtGjVsx.js} +2 -2
- package/dist/{tailscale-BUcKO8Rr.js → tailscale-9MusRvOi.js} +1 -1
- package/dist/{tailscale-Cvk3mQDZ.js → tailscale-BVGD9gSD.js} +2 -2
- package/dist/{tool-display-rIUh61kT.js → tool-display-BxZG0o1b.js} +2 -2
- package/dist/{tool-display-BMYWrp0L.js → tool-display-DmgKs6-V.js} +2 -2
- package/dist/{tui-cV-R-JXi.js → tui-DPorsF4z.js} +203 -75
- package/dist/{tui-DBmFYQTk.js → tui-XH6_v0qC.js} +204 -74
- package/dist/{tui-cli-B_CKOjZ1.js → tui-cli-DRSIBDgZ.js} +30 -29
- package/dist/{tui-cli-CVdJ28TX.js → tui-cli-DV_JAtnq.js} +26 -25
- package/dist/{update-BDyA5Iqy.js → update-DNAVcIQ7.js} +3 -3
- package/dist/{update-BIB5jGcv.js → update-DzMcwy1G.js} +3 -3
- package/dist/{update-cli-p49uMWby.js → update-cli-OAcZiYuA.js} +112 -27
- package/dist/{update-cli-C5vwquH_.js → update-cli-tQcy8mkI.js} +109 -23
- package/dist/{update-runner-8XFxQglY.js → update-runner-2i8_mIG5.js} +254 -17
- package/dist/{update-runner-s8Rs8ex3.js → update-runner-BDdk_K2S.js} +254 -17
- package/dist/usage-format-DvowRSs-.js +36 -0
- package/dist/usage-format-E3bMcUMV.js +36 -0
- package/dist/{utils-Dg0Xbl6w.js → utils-CKSrBNwq.js} +2 -2
- package/dist/{webhooks-cli-DkQGQ2ae.js → webhooks-cli-BztQHEco.js} +11 -11
- package/dist/{webhooks-cli-kRN8qR7B.js → webhooks-cli-ZAn97osC.js} +15 -15
- package/dist/{widearea-dns-BIhjVRG1.js → widearea-dns-CsSylzXH.js} +2 -2
- package/dist/{widearea-dns-D4yoSNNw.js → widearea-dns-D9Al4QRv.js} +2 -2
- package/dist/{ws-log-DQ6nkLys.js → ws-log-B7UNLFLC.js} +3 -3
- package/dist/{ws-log-C4IerKk4.js → ws-log-DJIXahf0.js} +2 -2
- package/dist/{wsl-DASmek7h.js → wsl-ATjkMwMA.js} +1 -1
- package/docs/.i18n/glossary.zh-CN.json +20 -0
- package/docs/assets/macos-onboarding/01-macos-warning.jpeg +0 -0
- package/docs/assets/macos-onboarding/02-local-networks.jpeg +0 -0
- package/docs/assets/macos-onboarding/03-security-notice.png +0 -0
- package/docs/assets/macos-onboarding/04-choose-gateway.png +0 -0
- package/docs/assets/macos-onboarding/05-permissions.png +0 -0
- package/docs/bedrock.md +3 -3
- package/docs/channels/discord.md +2 -1
- package/docs/channels/feishu.md +72 -2
- package/docs/channels/telegram.md +19 -0
- package/docs/cli/devices.md +3 -0
- package/docs/cli/gateway.md +3 -0
- package/docs/cli/index.md +2 -0
- package/docs/cli/onboard.md +16 -2
- package/docs/concepts/features.md +53 -0
- package/docs/concepts/memory.md +1 -1
- package/docs/concepts/messages.md +1 -1
- package/docs/concepts/model-providers.md +11 -11
- package/docs/concepts/models.md +1 -1
- package/docs/concepts/multi-agent.md +2 -2
- package/docs/concepts/session.md +19 -3
- package/docs/docs.json +331 -182
- package/docs/gateway/cli-backends.md +7 -5
- package/docs/gateway/configuration-examples.md +4 -4
- package/docs/gateway/configuration.md +34 -16
- package/docs/gateway/heartbeat.md +61 -1
- package/docs/gateway/local-models.md +3 -3
- package/docs/gateway/network-model.md +17 -0
- package/docs/gateway/remote.md +3 -1
- package/docs/gateway/security/index.md +1 -1
- package/docs/help/faq.md +25 -26
- package/docs/help/submitting-a-pr.md +214 -0
- package/docs/help/submitting-an-issue.md +165 -0
- package/docs/index.md +127 -193
- package/docs/install/docker.md +2 -2
- package/docs/{platforms → install}/exe-dev.md +4 -3
- package/docs/{platforms → install}/fly.md +1 -1
- package/docs/install/index.md +4 -2
- package/docs/nodes/media-understanding.md +2 -2
- package/docs/platforms/digitalocean.md +2 -2
- package/docs/platforms/index.md +4 -4
- package/docs/platforms/linux.md +1 -1
- package/docs/platforms/mac/release.md +7 -7
- package/docs/platforms/oracle.md +1 -1
- package/docs/platforms/raspberry-pi.md +1 -1
- package/docs/providers/anthropic.md +3 -3
- package/docs/providers/index.md +1 -1
- package/docs/providers/minimax.md +3 -3
- package/docs/providers/models.md +1 -1
- package/docs/providers/ollama.md +60 -6
- package/docs/providers/openai.md +2 -2
- package/docs/providers/opencode.md +1 -1
- package/docs/providers/vercel-ai-gateway.md +1 -1
- package/docs/reference/credits.md +27 -0
- package/docs/reference/wizard.md +268 -0
- package/docs/start/bootstrapping.md +41 -0
- package/docs/start/docs-directory.md +64 -0
- package/docs/start/getting-started.md +109 -197
- package/docs/start/hubs.md +12 -0
- package/docs/start/onboarding.md +51 -81
- package/docs/start/openclaw.md +3 -20
- package/docs/start/quickstart.md +22 -0
- package/docs/start/setup.md +14 -1
- package/docs/start/wizard-cli-automation.md +141 -0
- package/docs/start/wizard-cli-reference.md +244 -0
- package/docs/start/wizard.md +48 -289
- package/docs/style.css +3 -0
- package/docs/testing.md +9 -9
- package/docs/token-use.md +2 -2
- package/docs/tools/index.md +3 -0
- package/docs/tools/llm-task.md +1 -1
- package/docs/tools/thinking.md +1 -0
- package/docs/tui.md +3 -0
- package/docs/vps.md +6 -6
- package/docs/web/control-ui.md +2 -0
- package/docs/web/dashboard.md +7 -7
- package/docs/zh-CN/channels/feishu.md +119 -3
- package/docs/zh-CN/concepts/features.md +59 -0
- package/docs/zh-CN/gateway/network-model.md +23 -0
- package/docs/zh-CN/gateway/remote.md +1 -1
- package/docs/zh-CN/help/faq.md +5 -5
- package/docs/zh-CN/index.md +124 -202
- package/docs/zh-CN/install/docker.md +1 -1
- package/docs/zh-CN/platforms/digitalocean.md +2 -2
- package/docs/zh-CN/platforms/index.md +4 -4
- package/docs/zh-CN/platforms/linux.md +1 -1
- package/docs/zh-CN/platforms/oracle.md +1 -1
- package/docs/zh-CN/platforms/raspberry-pi.md +1 -1
- package/docs/zh-CN/providers/ollama.md +1 -1
- package/docs/zh-CN/reference/credits.md +34 -0
- package/docs/zh-CN/start/docs-directory.md +70 -0
- package/docs/zh-CN/start/getting-started.md +1 -1
- package/docs/zh-CN/start/hubs.md +39 -30
- package/docs/zh-CN/start/quickstart.md +88 -0
- package/docs/zh-CN/vps.md +4 -4
- package/extensions/bluebubbles/package.json +1 -1
- package/extensions/bluebubbles/src/monitor.ts +9 -0
- package/extensions/copilot-proxy/index.ts +1 -0
- package/extensions/copilot-proxy/package.json +1 -1
- package/extensions/diagnostics-otel/package.json +1 -1
- package/extensions/discord/package.json +1 -1
- package/extensions/feishu/index.ts +49 -1
- package/extensions/feishu/openclaw.plugin.json +1 -0
- package/extensions/feishu/package.json +9 -5
- package/extensions/feishu/skills/feishu-doc/SKILL.md +105 -0
- package/extensions/feishu/skills/feishu-doc/references/block-types.md +103 -0
- package/extensions/feishu/skills/feishu-drive/SKILL.md +97 -0
- package/extensions/feishu/skills/feishu-perm/SKILL.md +119 -0
- package/extensions/feishu/skills/feishu-wiki/SKILL.md +111 -0
- package/extensions/feishu/src/accounts.ts +144 -0
- package/extensions/feishu/src/bitable.ts +459 -0
- package/extensions/feishu/src/bot.ts +871 -0
- package/extensions/feishu/src/channel.ts +267 -202
- package/extensions/feishu/src/client.ts +118 -0
- package/extensions/feishu/src/config-schema.ts +152 -26
- package/extensions/feishu/src/directory.ts +177 -0
- package/extensions/feishu/src/doc-schema.ts +47 -0
- package/extensions/feishu/src/docx.ts +521 -0
- package/extensions/feishu/src/drive-schema.ts +46 -0
- package/extensions/feishu/src/drive.ts +227 -0
- package/extensions/feishu/src/media.ts +527 -0
- package/extensions/feishu/src/mention.ts +126 -0
- package/extensions/feishu/src/monitor.ts +190 -0
- package/extensions/feishu/src/onboarding.ts +278 -200
- package/extensions/feishu/src/outbound.ts +40 -0
- package/extensions/feishu/src/perm-schema.ts +52 -0
- package/extensions/feishu/src/perm.ts +173 -0
- package/extensions/feishu/src/policy.ts +104 -0
- package/extensions/feishu/src/probe.ts +44 -0
- package/extensions/feishu/src/reactions.ts +160 -0
- package/extensions/feishu/src/reply-dispatcher.ts +184 -0
- package/extensions/feishu/src/runtime.ts +14 -0
- package/extensions/feishu/src/send.ts +358 -0
- package/extensions/feishu/src/targets.ts +78 -0
- package/extensions/feishu/src/tools-config.ts +21 -0
- package/extensions/feishu/src/types.ts +75 -0
- package/extensions/feishu/src/typing.ts +80 -0
- package/extensions/feishu/src/wiki-schema.ts +55 -0
- package/extensions/feishu/src/wiki.ts +232 -0
- package/extensions/google-antigravity-auth/package.json +1 -1
- package/extensions/google-gemini-cli-auth/package.json +1 -1
- package/extensions/googlechat/package.json +1 -1
- package/extensions/googlechat/src/monitor.ts +12 -1
- package/extensions/imessage/package.json +1 -1
- package/extensions/line/package.json +1 -1
- package/extensions/llm-task/package.json +1 -1
- package/extensions/lobster/package.json +1 -1
- package/extensions/matrix/CHANGELOG.md +6 -0
- package/extensions/matrix/package.json +1 -1
- package/extensions/matrix/src/config-schema.ts +1 -0
- package/extensions/matrix/src/matrix/monitor/handler.ts +9 -5
- package/extensions/matrix/src/types.ts +2 -0
- package/extensions/mattermost/package.json +1 -1
- package/extensions/mattermost/src/channel.test.ts +24 -0
- package/extensions/mattermost/src/config-schema.ts +1 -0
- package/extensions/mattermost/src/mattermost/monitor.ts +9 -5
- package/extensions/mattermost/src/types.ts +2 -0
- package/extensions/memory-core/package.json +1 -1
- package/extensions/memory-lancedb/node_modules/.bin/openai +2 -2
- package/extensions/memory-lancedb/node_modules/.bin/openai.CMD +2 -2
- package/extensions/memory-lancedb/node_modules/.bin/openai.ps1 +2 -2
- package/extensions/memory-lancedb/package.json +2 -2
- package/extensions/minimax-portal-auth/package.json +1 -1
- package/extensions/msteams/CHANGELOG.md +6 -0
- package/extensions/msteams/package.json +1 -1
- package/extensions/msteams/src/monitor-handler/message-handler.ts +1 -0
- package/extensions/msteams/src/reply-dispatcher.ts +7 -5
- package/extensions/nextcloud-talk/package.json +1 -1
- package/extensions/nextcloud-talk/src/config-schema.ts +1 -0
- package/extensions/nextcloud-talk/src/inbound.ts +10 -0
- package/extensions/nextcloud-talk/src/send.ts +7 -2
- package/extensions/nextcloud-talk/src/types.ts +2 -0
- package/extensions/nostr/CHANGELOG.md +6 -0
- package/extensions/nostr/package.json +1 -1
- package/extensions/open-prose/package.json +1 -1
- package/extensions/signal/package.json +1 -1
- package/extensions/slack/package.json +1 -1
- package/extensions/telegram/package.json +1 -1
- package/extensions/tlon/package.json +1 -1
- package/extensions/tlon/src/config-schema.ts +2 -0
- package/extensions/tlon/src/monitor/index.ts +41 -14
- package/extensions/tlon/src/monitor/utils.ts +1 -0
- package/extensions/twitch/CHANGELOG.md +6 -0
- package/extensions/twitch/package.json +1 -1
- package/extensions/twitch/src/config-schema.ts +2 -0
- package/extensions/twitch/src/monitor.ts +11 -0
- package/extensions/twitch/src/types.ts +2 -0
- package/extensions/voice-call/CHANGELOG.md +6 -0
- package/extensions/voice-call/package.json +1 -1
- package/extensions/voice-call/src/manager.test.ts +30 -0
- package/extensions/whatsapp/package.json +1 -1
- package/extensions/zalo/CHANGELOG.md +6 -0
- package/extensions/zalo/package.json +1 -1
- package/extensions/zalo/src/config-schema.ts +1 -0
- package/extensions/zalo/src/monitor.ts +11 -0
- package/extensions/zalo/src/types.ts +2 -0
- package/extensions/zalouser/CHANGELOG.md +6 -0
- package/extensions/zalouser/package.json +1 -1
- package/extensions/zalouser/src/config-schema.ts +1 -0
- package/extensions/zalouser/src/monitor.ts +12 -1
- package/extensions/zalouser/src/types.ts +2 -0
- package/package.json +14 -14
- package/dist/auth-profiles-3t9aTwDR.js +0 -11
- package/dist/auth-profiles-BYvLI-zr.js +0 -7
- package/dist/auth-profiles-DswR7tzt.js +0 -7
- package/dist/cli-BxIwNzhi.js +0 -89
- package/dist/cli-wFmvNjpg.js +0 -86
- package/dist/command-format-SkzzRqR1.js +0 -52
- package/dist/completion-cli-vxe-jqwC.js +0 -390
- package/dist/config-BwVg6hhl.js +0 -13
- package/dist/config-jKcyRiMo.js +0 -10
- package/dist/configure-DaecSBSI.js +0 -60
- package/dist/configure-t-7r9i4H.js +0 -64
- package/dist/control-service-Dag9b-dU.js +0 -16
- package/dist/control-service-DsUyuevF.js +0 -12
- package/dist/control-ui/assets/index-ryaCcbyp.js +0 -4584
- package/dist/control-ui/assets/index-ryaCcbyp.js.map +0 -1
- package/dist/daemon-cli-CUkUiGoK.js +0 -53
- package/dist/daemon-cli-D6FF4tmP.js +0 -49
- package/dist/deliver-BGnJ4-vz.js +0 -12
- package/dist/deliver-CXpx7BNb.js +0 -25
- package/dist/deliver-Ds2yqOA3.js +0 -21
- package/dist/doctor-BwqqPqMX.js +0 -58
- package/dist/doctor-DGrfzoKj.js +0 -62
- package/dist/github-copilot-token-B0CUgVkW.js +0 -4
- package/dist/github-copilot-token-B_uWT0Yi.js +0 -4
- package/dist/github-copilot-token-CXUZ9Lrb.js +0 -3
- package/dist/image-CgTMdnmz.js +0 -28
- package/dist/image-D1O-ebQc.js +0 -14
- package/dist/image-njq9Rf6U.js +0 -24
- package/dist/login-qr-BfbIJ1wP.js +0 -12
- package/dist/login-qr-CGWNrSQq.js +0 -9
- package/dist/login-qr-CUV9HZCg.js +0 -16
- package/dist/manager-DKpTd5pc.js +0 -10
- package/dist/manager-Dr_eVHpN.js +0 -10
- package/dist/manager-DtFcs1NT.js +0 -14
- package/dist/pi-model-discovery-BOramrmp.js +0 -3
- package/dist/pi-model-discovery-Bj98Srfa.js +0 -3
- package/dist/pi-model-discovery-DHPwfwKu.js +0 -3
- package/dist/plugin-sdk/agent-scope-qNPdmst1.js +0 -606
- package/dist/plugin-sdk/auth-profiles-D0LhX8iB.js +0 -7
- package/dist/plugin-sdk/chrome-DMuEXuKT.js +0 -1953
- package/dist/plugin-sdk/config-D5CsedNn.js +0 -5623
- package/dist/plugin-sdk/deliver-DOlMKwJ9.js +0 -12
- package/dist/plugin-sdk/deliver-Dl2ednkv.js +0 -2555
- package/dist/plugin-sdk/exec-CjyVHUuE.js +0 -1107
- package/dist/plugin-sdk/github-copilot-token-BoPqI-5_.js +0 -97
- package/dist/plugin-sdk/github-copilot-token-YEH9Bwov.js +0 -4
- package/dist/plugin-sdk/image-B_t0xXCb.js +0 -1419
- package/dist/plugin-sdk/image-DYTdodiR.js +0 -14
- package/dist/plugin-sdk/login-qr-B7ec28AI.js +0 -9
- package/dist/plugin-sdk/login-qr-BVBRxQRt.js +0 -470
- package/dist/plugin-sdk/manager-B-EITu1a.js +0 -10
- package/dist/plugin-sdk/manager-WCGzgWdf.js +0 -2868
- package/dist/plugin-sdk/model-selection-Bo7pocNu.js +0 -2667
- package/dist/plugin-sdk/paths-BFxmmTT5.js +0 -164
- package/dist/plugin-sdk/paths-Bkjq_KcG.js +0 -40
- package/dist/plugin-sdk/pi-embedded-helpers-fm5_Eokw.js +0 -8755
- package/dist/plugin-sdk/pi-model-discovery-CLgDNnGq.js +0 -13
- package/dist/plugin-sdk/pi-model-discovery-P2-pVRmz.js +0 -3
- package/dist/plugin-sdk/pw-ai-BN7Cwl9J.js +0 -1649
- package/dist/qmd-manager-CzArLjr6.js +0 -615
- package/dist/redact-BR0IM00e.js +0 -94
- package/dist/register.subclis-Bo-xmQ-W.js +0 -342
- package/dist/register.subclis-BuT7ZpPf.js +0 -3
- package/dist/restart-sentinel-CdcBcziq.js +0 -65
- package/dist/restart-sentinel-DywisDen.js +0 -65
- package/dist/runtime-guard-BG6JybtL.js +0 -60
- package/dist/runtime-guard-DvBpNsbR.js +0 -60
- package/dist/sqlite-Dz6S6ijV.js +0 -215
- package/dist/status.update-2ZdxeIeT.js +0 -79
- package/dist/status.update-ChwCPLBt.js +0 -79
- package/dist/systemd-linger-BZb1Uwsd.js +0 -7
- package/dist/systemd-linger-DemNCT5l.js +0 -9
- package/dist/transcript-events-fUhPZcB5.js +0 -17
- package/docs/_config.yml +0 -53
- package/docs/_layouts/default.html +0 -145
- package/docs/assets/docs-chat-widget.js +0 -667
- package/docs/assets/markdown.css +0 -179
- package/docs/assets/terminal.css +0 -473
- package/docs/assets/theme.js +0 -55
- package/extensions/feishu/README.md +0 -47
- /package/dist/{archive-BrH5WBhI.js → archive-D0z3LZDK.js} +0 -0
- /package/dist/{archive-mFgwsll-.js → archive-Dy3Ezb-5.js} +0 -0
- /package/dist/{boolean-CE7i9tBR.js → boolean-BgXe2hyu.js} +0 -0
- /package/dist/{brew-0HRgjHZw.js → brew-CAcErcKz.js} +0 -0
- /package/dist/{brew-Qdppmdlx.js → brew-CcZV0dSS.js} +0 -0
- /package/dist/{cli-utils-CukoNm8O.js → cli-utils-BkRQdAoC.js} +0 -0
- /package/dist/{cli-utils-DFbPmfWB.js → cli-utils-ByANh4Sp.js} +0 -0
- /package/dist/{plugin-sdk/command-format-CFzL448l.js → command-format-CFzL448l.js} +0 -0
- /package/dist/{command-format-BQK1OIvH.js → command-format-ChfKqObn.js} +0 -0
- /package/dist/{command-format-3xiXujG0.js → command-format-ayFsmwwz.js} +0 -0
- /package/dist/{constants-3er_81qc.js → constants-D1op9uGI.js} +0 -0
- /package/dist/{constants-CLUi6T-M.js → constants-HPrOsATF.js} +0 -0
- /package/dist/{exec-BIMFe4XS.js → exec-B8JKbXKW.js} +0 -0
- /package/dist/{format-BnjMmWWT.js → format-B7OjpGnt.js} +0 -0
- /package/dist/{format-hyFOmVZc.js → format-CS7EI0xF.js} +0 -0
- /package/dist/{help-format-af1XWYxC.js → help-format-CfZ94KRN.js} +0 -0
- /package/dist/{helpers-HZ-6iA1e.js → helpers-5yebzF4C.js} +0 -0
- /package/dist/{helpers-uGhPZ_kK.js → helpers-EKm3X92T.js} +0 -0
- /package/dist/{is-main-DD0MG3N8.js → is-main-B6kCyqsv.js} +0 -0
- /package/dist/{is-main-DrJg4t1R.js → is-main-qJ675wPV.js} +0 -0
- /package/dist/{logging-BdnOSVPD.js → logging-BWRYHvLp.js} +0 -0
- /package/dist/{logging-fywhKCmE.js → logging-CfEk_PnX.js} +0 -0
- /package/dist/{openclaw-root-Dean7Fp2.js → openclaw-root-9ILYSmJ9.js} +0 -0
- /package/dist/{openclaw-root-CJKDUIBP.js → openclaw-root-Cvotktkd.js} +0 -0
- /package/dist/{parse-BB0Cqon8.js → parse-BZz5lHzQ.js} +0 -0
- /package/dist/{parse-DLFPuO7w.js → parse-gTOGQPH6.js} +0 -0
- /package/dist/{parse-log-line-B3U8Kflp.js → parse-log-line-C6szvNBZ.js} +0 -0
- /package/dist/{parse-log-line-BmyeB3J2.js → parse-log-line-CARp5QyJ.js} +0 -0
- /package/dist/{parse-timeout-BIB19Upi.js → parse-timeout-CbVKLZ4B.js} +0 -0
- /package/dist/{parse-timeout-CmBmmqZZ.js → parse-timeout-Du-wHHNi.js} +0 -0
- /package/dist/{paths-VslOJiD2.js → paths-B1kfl4h5.js} +0 -0
- /package/dist/{paths-BDd7_JUB.js → paths-scjhy7N2.js} +0 -0
- /package/dist/{progress-Dn3kWpaL.js → progress-Da1ehW-x.js} +0 -0
- /package/dist/{prompt-style-D5D7b3cX.js → prompt-style-Dc0C5HC9.js} +0 -0
- /package/dist/{prompts-CIDznuZR.js → prompts-CXLLIBwP.js} +0 -0
- /package/dist/{prompts-CSlE5VZB.js → prompts-FbZThK8w.js} +0 -0
- /package/dist/{redact-BKh-zp-c.js → redact-B8YiFlwn.js} +0 -0
- /package/dist/{plugin-sdk/redact-wH73ib3-.js → redact-BIMJ3ntQ.js} +0 -0
- /package/dist/{redact-CDPAzwi8.js → redact-DJCFY628.js} +0 -0
- /package/dist/{plugin-sdk/sqlite-CqVsQPIl.js → sqlite-BKl1HJFe.js} +0 -0
- /package/dist/{sqlite-C59YNxdL.js → sqlite-Dnmf3LS7.js} +0 -0
- /package/dist/{sqlite-B_L84oiu.js → sqlite-DqUEZnjO.js} +0 -0
- /package/dist/{status-DkW6wMxZ.js → status-CRIEi8Mc.js} +0 -0
- /package/dist/{status-IDW1pkc0.js → status-tCu4RWZH.js} +0 -0
- /package/dist/{tailnet-BijMqkqa.js → tailnet-Byp3obcc.js} +0 -0
- /package/dist/{tailnet-Bk5cGmwE.js → tailnet-DLDGNuH2.js} +0 -0
- /package/dist/{plugin-sdk/transcript-events-DOI14YeV.js → transcript-events-CZ8CG4ht.js} +0 -0
- /package/dist/{transcript-events-Cj85Mq0h.js → transcript-events-ChU6IQwp.js} +0 -0
- /package/dist/{transcript-events-DW_H__a1.js → transcript-events-JLH5W4He.js} +0 -0
- /package/dist/{utils-PmTbZoD1.js → utils-DX85MiPR.js} +0 -0
- /package/dist/{ws-Cxo2p9fH.js → ws-CEcdsnN9.js} +0 -0
- /package/dist/{ws-DlSkA_BG.js → ws-D091yo4M.js} +0 -0
- /package/docs/{platforms → install}/gcp.md +0 -0
- /package/docs/{platforms → install}/hetzner.md +0 -0
- /package/docs/{platforms → install}/macos-vm.md +0 -0
- /package/docs/{northflank.mdx → install/northflank.mdx} +0 -0
- /package/docs/{railway.mdx → install/railway.mdx} +0 -0
- /package/docs/{render.mdx → install/render.mdx} +0 -0
- /package/docs/zh-CN/{platforms → install}/exe-dev.md +0 -0
- /package/docs/zh-CN/{platforms → install}/fly.md +0 -0
- /package/docs/zh-CN/{platforms → install}/gcp.md +0 -0
- /package/docs/zh-CN/{platforms → install}/hetzner.md +0 -0
- /package/docs/zh-CN/{platforms → install}/macos-vm.md +0 -0
- /package/docs/zh-CN/{northflank.mdx → install/northflank.mdx} +0 -0
- /package/docs/zh-CN/{railway.mdx → install/railway.mdx} +0 -0
- /package/docs/zh-CN/{render.mdx → install/render.mdx} +0 -0
|
@@ -1,52 +1,54 @@
|
|
|
1
1
|
import { A as getChildLogger, C as setVerbose, D as colorize, E as warn, F as CONFIG_PATH, L as STATE_DIR, O as isRich, P as normalizeLogLevel, Q as CHAT_CHANNEL_ORDER, T as success, X as resolveStateDir, a as parseBooleanValue$1, at as normalizeChannelId, ct as requireActivePluginRegistry, it as normalizeAnyChannelId, k as theme, lt as setActivePluginRegistry, n as isTruthyEnvValue, o as createSubsystemLogger, p as defaultRuntime, v as danger, w as shouldLogVerbose, x as logVerbose, y as info } from "./entry.js";
|
|
2
|
-
import {
|
|
3
|
-
import { t as formatCliCommand } from "./command-format-
|
|
4
|
-
import {
|
|
5
|
-
import { _ as sleep, b as truncateUtf16Safe, c as isSelfChatMode, g as shortenHomePath, h as shortenHomeInString, l as jidToE164, m as resolveUserPath, n as clampInt, p as resolveJidToE164, t as CONFIG_DIR, u as normalizeE164, v as sliceUtf16Safe, y as toWhatsappJid } from "./utils-
|
|
6
|
-
import { a as logDebug, c as logWarn, i as spawnWithFallback, n as runExec, o as logError, r as formatSpawnError, s as logInfo, t as runCommandWithTimeout } from "./exec-
|
|
7
|
-
import { t as resolveOpenClawPackageRoot } from "./openclaw-root-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { c as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { r as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { t as
|
|
20
|
-
import {
|
|
21
|
-
import { a as
|
|
22
|
-
import { n as
|
|
23
|
-
import { r as
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import { A as
|
|
31
|
-
import { A as
|
|
32
|
-
import { C as
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import { a as
|
|
37
|
-
import { a as
|
|
38
|
-
import { n as
|
|
39
|
-
import { n as
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import { d as resolveGatewaySystemdServiceName, l as resolveGatewayLaunchAgentLabel } from "./constants-
|
|
43
|
-
import { n as resolveMessageChannelSelection, t as listConfiguredMessageChannels } from "./channel-selection-
|
|
44
|
-
import { t as parseTimeoutMs } from "./parse-timeout-
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import { a as
|
|
48
|
-
import { i as
|
|
49
|
-
import {
|
|
2
|
+
import { $ as getApiKeyForModel, B as normalizeGoogleModelId, C as buildAllowedModelSet, D as isCliProvider, I as resolveModelRefFromString, L as resolveThinkingDefault, N as resolveConfiguredModelRef, O as modelKey, P as resolveDefaultModelForAgent, S as resolveOpenClawAgentDir, T as buildModelAliasIndex, _ as ensureAuthProfileStore, _t as DEFAULT_PROVIDER, a as markAuthProfileUsed, at as resolveModelAuthMode, et as getCustomProviderApiKey, gt as DEFAULT_MODEL, ht as DEFAULT_CONTEXT_TOKENS, i as markAuthProfileFailure, it as resolveEnvApiKey, k as normalizeProviderId, lt as resolveShellEnvFallbackTimeoutMs, m as markAuthProfileGood, n as resolveAuthProfileOrder, nt as resolveApiKeyForProvider, p as listProfilesForProvider, r as isProfileInCooldown, s as resolveApiKeyForProfile, st as getShellPathFromLoginShell, tt as requireApiKey, vt as resolveAuthProfileDisplayLabel, w as buildConfiguredAllowlistKeys, x as resolveAuthStorePathForDisplay } from "./auth-profiles-CYBuGiBb.js";
|
|
3
|
+
import { t as formatCliCommand } from "./command-format-ayFsmwwz.js";
|
|
4
|
+
import { _ as parseAgentSessionKey, a as buildAgentPeerSessionKey, c as normalizeAgentId, d as resolveThreadSessionKeys, f as sanitizeAgentId, g as isSubagentSessionKey, h as isAcpSessionKey, i as buildAgentMainSessionKey, l as normalizeMainKey, n as DEFAULT_AGENT_ID, o as buildGroupHistoryKey, r as DEFAULT_MAIN_KEY, s as normalizeAccountId$3, t as DEFAULT_ACCOUNT_ID$1, u as resolveAgentIdFromSessionKey, v as resolveThreadParentSessionKey } from "./session-key-CZkcvAtx.js";
|
|
5
|
+
import { _ as sleep, b as truncateUtf16Safe, c as isSelfChatMode, g as shortenHomePath, h as shortenHomeInString, l as jidToE164, m as resolveUserPath, n as clampInt, p as resolveJidToE164, t as CONFIG_DIR, u as normalizeE164, v as sliceUtf16Safe, y as toWhatsappJid } from "./utils-DX85MiPR.js";
|
|
6
|
+
import { a as logDebug, c as logWarn, i as spawnWithFallback, n as runExec, o as logError, r as formatSpawnError, s as logInfo, t as runCommandWithTimeout } from "./exec-B8JKbXKW.js";
|
|
7
|
+
import { t as resolveOpenClawPackageRoot } from "./openclaw-root-9ILYSmJ9.js";
|
|
8
|
+
import { C as loadWorkspaceBootstrapFiles, S as filterBootstrapFilesForSession, c as resolveDefaultAgentId, f as DEFAULT_AGENT_WORKSPACE_DIR, i as resolveAgentModelFallbacksOverride, l as resolveSessionAgentId, n as resolveAgentConfig, o as resolveAgentSkillsFilter, p as DEFAULT_BOOTSTRAP_FILENAME, r as resolveAgentDir, s as resolveAgentWorkspaceDir, t as listAgentIds, u as resolveSessionAgentIds, x as ensureAgentWorkspace } from "./agent-scope-C9VjJXEK.js";
|
|
9
|
+
import { a as saveJsonFile, i as loadJsonFile } from "./github-copilot-token-SLWintYd.js";
|
|
10
|
+
import { n as discoverModels, t as discoverAuthStorage } from "./pi-model-discovery-DzEIEgHL.js";
|
|
11
|
+
import { C as setConfigValueAtPath, S as parseConfigPath, _ as getConfigOverrides, b as unsetConfigOverride, c as writeConfigFile, d as TELEGRAM_COMMAND_NAME_PATTERN, f as normalizeTelegramCommandName, g as validateJsonSchemaValue, h as parseDurationMs, i as loadConfig, j as VERSION, k as resolveAgentMaxConcurrent, l as validateConfigObjectWithPlugins, m as isSafeExecutableValue, o as readConfigFileSnapshot, p as resolveTelegramCustomCommands, s as resolveConfigSnapshotHash, v as resetConfigOverrides, w as unsetConfigValueAtPath, x as getConfigValueAtPath, y as setConfigOverride } from "./config-CKLedg5Y.js";
|
|
12
|
+
import { c as resolveEnableState, l as resolveMemorySlotDecision, n as discoverOpenClawPlugins, s as normalizePluginsConfig, t as loadPluginManifestRegistry } from "./manifest-registry-C69Z-I4v.js";
|
|
13
|
+
import { a as resolveBrowserConfig } from "./server-context-yKyxyxOJ.js";
|
|
14
|
+
import { E as DEFAULT_AI_SNAPSHOT_MAX_CHARS, n as formatErrorMessage, r as formatUncaughtError, t as extractErrorCode } from "./errors-CZ9opC6L.js";
|
|
15
|
+
import { n as createBrowserControlContext, r as startBrowserControlServiceFromConfig } from "./control-service-D2E9NKqQ.js";
|
|
16
|
+
import { t as pickPrimaryTailnetIPv4 } from "./tailnet-Byp3obcc.js";
|
|
17
|
+
import { Et as SESSION_LABEL_MAX_LENGTH, t as GatewayClient } from "./client-CxbkcEZ7.js";
|
|
18
|
+
import { i as randomIdempotencyKey, n as callGateway } from "./call-90HgQQ8o.js";
|
|
19
|
+
import { a as isInternalMessageChannel, c as listDeliverableMessageChannels, d as resolveMessageChannel, h as GATEWAY_CLIENT_NAMES, l as normalizeMessageChannel, m as GATEWAY_CLIENT_MODES, n as isDeliverableMessageChannel, o as isMarkdownCapableMessageChannel, p as GATEWAY_CLIENT_IDS, t as INTERNAL_MESSAGE_CHANNEL, u as resolveGatewayMessageChannel } from "./message-channel-BlgPSDAh.js";
|
|
20
|
+
import { t as formatDocsLink } from "./links-D0uzJbi6.js";
|
|
21
|
+
import { _ as normalizeChatType, a as normalizeWhatsAppTarget, b as normalizeDiscordToken, c as resolveTelegramAccount, d as listBindings, g as resolveSlackBotToken, h as resolveSlackAppToken, i as isWhatsAppGroupJid, l as resolveTelegramToken, n as listChannelPlugins, o as listEnabledTelegramAccounts, p as resolveSlackAccount, r as normalizeChannelId$1, s as listTelegramAccountIds, t as getChannelPlugin, v as listEnabledDiscordAccounts, y as resolveDiscordAccount } from "./plugins-BUPpq5aS.js";
|
|
22
|
+
import { a as logoutWeb, d as webAuthExists, i as logWebSelfId, n as resolveWhatsAppAccount, r as getWebAuthAgeMs, s as readWebSelfId } from "./accounts-Dto4p9zB.js";
|
|
23
|
+
import { n as withProgress, r as withProgressTotals } from "./progress-Da1ehW-x.js";
|
|
24
|
+
import { r as stylePromptTitle } from "./prompt-style-Dc0C5HC9.js";
|
|
25
|
+
import { i as resolveMemorySearchConfig, n as resolveRetryConfig, r as retryAsync } from "./manager-BXiIQku7.js";
|
|
26
|
+
import { a as resolveSessionTranscriptsDirForAgent, n as resolveSessionFilePath, o as resolveStorePath, r as resolveSessionTranscriptPath } from "./paths-CTg8F3AE.js";
|
|
27
|
+
import { t as emitSessionTranscriptUpdate } from "./transcript-events-CZ8CG4ht.js";
|
|
28
|
+
import { c as listMemoryFiles, l as normalizeExtraMemoryPaths } from "./sqlite-DqUEZnjO.js";
|
|
29
|
+
import { C as mediaKindFromMime, _ as imageMimeFromFormat, b as kindFromMime, g as getFileExtension, h as extensionForMime, i as SsrFBlockedError, m as detectMime, n as getMediaDir, p as resizeToJpeg, r as saveMediaBuffer, u as getImageMetadata, v as isAudioFileName, x as MAX_IMAGE_BYTES, y as isGifMedia } from "./routes-BSfXf8a5.js";
|
|
30
|
+
import { A as buildBootstrapContextFiles, B as normalizeThinkLevel, C as isLikelyContextOverflowError, D as parseImageDimensionError, E as isTimeoutErrorMessage, F as formatXHighModelHint, G as sanitizeImageBlocks, H as normalizeVerboseLevel, K as sanitizeToolResultImages, M as resolveBootstrapMaxChars, N as sanitizeGoogleTurnOrdering, O as parseImageSizeError, P as formatThinkingLevels, R as normalizeElevatedLevel, S as isFailoverErrorMessage, T as isRawApiErrorPayload, U as resolveResponseUsageMode, V as normalizeUsageDisplay, W as supportsXHighThinking, _ as isBillingAssistantError, a as isMessagingToolDuplicateNormalized, b as isContextOverflowError, c as downgradeOpenAIReasoningBlocks, d as BILLING_ERROR_USER_MESSAGE, f as classifyFailoverReason, g as isAuthAssistantError, h as getApiErrorPayloadFingerprint, j as ensureSessionHeader, k as sanitizeUserFacingText, l as isAntigravityClaude, m as formatRawAssistantErrorForUi, n as validateGeminiTurns, o as normalizeTextForComparison, p as formatAssistantErrorText, r as pickFallbackThinkingLevel, s as sanitizeSessionMessagesImages, t as validateAnthropicTurns, u as isGoogleModelApi, v as isCloudCodeAssistFormatError, w as isRateLimitAssistantError, x as isFailoverAssistantError, y as isCompactionFailureError, z as normalizeReasoningLevel } from "./pi-embedded-helpers-DF8SAHU-.js";
|
|
31
|
+
import { A as isSilentReplyText, B as chunkByNewline, C as normalizeChannelTargetInput, D as parseInlineDirectives$1, E as splitMediaFromOutput, F as loadWebMediaRaw, G as resolveChunkMode, H as chunkMarkdownTextWithMode, I as MediaFetchError, J as isSafeFenceBreak, K as resolveTextChunkLimit, L as fetchRemoteMedia, M as markdownToIR, N as markdownToIRWithMeta, O as HEARTBEAT_TOKEN, P as loadWebMedia, R as fetchWithSsrFGuard, S as buildTargetResolverSignature, T as parseReplyDirectives, U as chunkText, V as chunkMarkdownText, W as chunkTextWithMode, Y as parseFenceSpans, _ as signalCheck, b as resolveFetch, c as applyReplyThreading, d as shouldSuppressMessagingToolReplies, f as createReplyToModeFilterForChannel, g as sendTypingSignal, h as sendReadReceiptSignal, j as chunkMarkdownIR, k as SILENT_REPLY_TOKEN, l as filterMessagingToolDuplicates, m as sendMessageSignal, o as normalizeReplyPayloadsForDelivery, p as resolveReplyToMode, q as findFenceSpanAt, s as applyReplyTagsToPayload, t as deliverOutboundPayloads, u as isRenderablePayload, v as signalRpcRequest, w as normalizeTargetForProvider, x as wrapFetchWithAbortSignal, y as streamSignalEvents, z as resolveMarkdownTableMode } from "./deliver-Cau4HL7W.js";
|
|
32
|
+
import { $ as stripPluginOnlyAllowlist, A as resolveSessionResetType, B as resolveConversationLabel, C as normalizeDeliveryContext, D as evaluateSessionFreshness, E as resolveSessionKey$1, H as resolveGroupSessionKey, I as resolveMainSessionKey, J as collectExplicitAllowlist, K as applyOwnerOnlyToolPolicy, M as DEFAULT_RESET_TRIGGERS, N as canonicalizeMainSessionAlias, O as resolveChannelResetConfig, Q as resolveToolProfilePolicy, R as deriveSessionMetaPatch, S as mergeDeliveryContext, U as resolveSandboxConfigForAgent, V as buildGroupDisplayName, Y as expandPolicyWithPluginGroups, Z as normalizeToolName, _ as updateSessionStoreEntry, a as ensureSandboxWorkspaceForSession, at as resolveChannelGroupPolicy, b as deliveryContextFromSession, c as resolveSandboxRuntimeStatus, ct as listEnabledSignalAccounts, d as loadSessionStore, f as readSessionUpdatedAt, g as updateSessionStore, h as updateLastRoute, it as listChannelDocks, j as resolveThreadFlag, k as resolveSessionResetPolicy, l as appendAssistantMessageToSessionTranscript, lt as resolveSignalAccount, o as resolveSandboxContext, ot as resolveChannelGroupRequireMention, p as recordSessionMetaFromInbound, q as buildPluginToolGroups, rt as getChannelDock, ut as resolveIMessageAccount, v as isCacheEnabled, w as normalizeSessionDeliveryFields, x as deliveryContextKey, y as resolveCacheTtlMs$1 } from "./sandbox-DuqLKN5J.js";
|
|
33
|
+
import { C as shouldHandleTextCommands, S as serializeCommandArgs, _ as listNativeCommandSpecsForConfig, b as resolveCommandArgChoices, f as buildCommandTextFromArgs, g as listNativeCommandSpecs, h as listChatCommandsForConfig, m as listChatCommands, o as extractTextFromMessage, p as findCommandByNativeName, t as buildChannelSummary, v as normalizeCommandBody, x as resolveCommandArgMenu, y as parseCommandArgs } from "./channel-summary-D9nzC5WB.js";
|
|
34
|
+
import { i as getMachineDisplayName, r as createBrowserRouteDispatcher, t as isWSL } from "./wsl-ATjkMwMA.js";
|
|
35
|
+
import { a as resolveSkillsPromptForRun, i as loadWorkspaceSkillEntries, l as applySkillEnvOverrides, n as buildWorkspaceSkillCommandSpecs, r as buildWorkspaceSkillSnapshot, s as resolvePluginSkillDirs, u as applySkillEnvOverridesFromSnapshot } from "./skills-CmU0Q92f.js";
|
|
36
|
+
import { _ as stripThinkingTagsFromText, a as decodeDataUrl, c as extractAssistantText$1, d as extractThinkingFromTaggedText, f as formatReasoningMessage, g as stripMinimaxToolCallXml, h as stripDowngradedToolCallText, i as coerceImageModelConfig, l as extractAssistantThinking, m as promoteThinkingTagsToBlocks, o as resolveProviderVisionModelFromConfig, p as inferToolMetaFromArgs, r as coerceImageAssistantText, s as minimaxUnderstandImage, t as describeImageWithModel, u as extractThinkingFromTaggedStream, v as ensureOpenClawModelsJson } from "./image-nRwqkmtf.js";
|
|
37
|
+
import { a as evaluateShellAllowlist, d as requiresExecApproval, f as resolveExecApprovals, h as resolveSafeBins, o as maxAsk, p as resolveExecApprovalsFromFile, s as minSecurity, t as addAllowlistEntry, u as recordAllowlistUse } from "./exec-approvals-BCEFzcbC.js";
|
|
38
|
+
import { a as canvasSnapshotTempPath, c as parseCameraClipPayload, d as buildNodeShellCommand, i as parseEnvPairs, l as parseCameraSnapPayload, n as screenRecordTempPath, o as parseCanvasSnapshotPayload, r as writeScreenRecordToFile, s as cameraTempPath, t as parseScreenRecordPayload, u as writeBase64ToFile } from "./nodes-screen-DGlNPbk4.js";
|
|
39
|
+
import { n as redactSensitiveText } from "./redact-B8YiFlwn.js";
|
|
40
|
+
import { n as resolveToolDisplay } from "./tool-display-DmgKs6-V.js";
|
|
41
|
+
import { t as parseAbsoluteTimeMs } from "./parse-gTOGQPH6.js";
|
|
42
|
+
import { d as resolveGatewaySystemdServiceName, l as resolveGatewayLaunchAgentLabel } from "./constants-D1op9uGI.js";
|
|
43
|
+
import { n as resolveMessageChannelSelection, t as listConfiguredMessageChannels } from "./channel-selection-PZuuCvrp.js";
|
|
44
|
+
import { t as parseTimeoutMs } from "./parse-timeout-CbVKLZ4B.js";
|
|
45
|
+
import { c as derivePromptTokens, l as hasNonzeroUsage, n as loadCostUsageSummary, o as extractToolCallNames, r as loadSessionCostSummary, s as hasToolCall, u as normalizeUsage } from "./session-cost-usage-BTXosU1k.js";
|
|
46
|
+
import { i as resolveModelCostConfig, n as formatTokenCount$2, r as formatUsd$1, t as estimateUsageCost } from "./usage-format-E3bMcUMV.js";
|
|
47
|
+
import { a as isToolAllowedByPolicies, c as resolveSubagentToolPolicy, i as filterToolsByPolicy, n as resolveNativeCommandsEnabled, o as resolveEffectiveToolPolicy, r as resolveNativeSkillsEnabled, s as resolveGroupToolPolicy, t as isNativeCommandsExplicitlyDisabled } from "./commands-DAC7XMAT.js";
|
|
48
|
+
import { a as removeChannelAllowFromStoreEntry, c as listPairingChannels, i as readChannelAllowFromStore, o as upsertChannelPairingRequest, t as addChannelAllowFromStoreEntry } from "./pairing-store-DTfv_FGA.js";
|
|
49
|
+
import { a as formatError$1, i as createWaSocket, n as startWebLoginWithQr, o as getStatusCode$1, r as waitForWebLogin, s as waitForWaConnection } from "./login-qr-Cmsf7BGt.js";
|
|
50
|
+
import { i as withManager, t as formatErrorMessage$1 } from "./cli-utils-ByANh4Sp.js";
|
|
51
|
+
import { t as resolvePairingIdLabel } from "./pairing-labels-BbydDT7w.js";
|
|
50
52
|
import { createRequire } from "node:module";
|
|
51
53
|
import { execSync, spawn, spawnSync } from "node:child_process";
|
|
52
54
|
import path from "node:path";
|
|
@@ -62,7 +64,7 @@ import { CURRENT_SESSION_VERSION, SessionManager, SettingsManager, codingTools,
|
|
|
62
64
|
import { createServer } from "node:http";
|
|
63
65
|
import { Buffer as Buffer$1 } from "node:buffer";
|
|
64
66
|
import * as net$1 from "node:net";
|
|
65
|
-
import
|
|
67
|
+
import { createInterface } from "node:readline";
|
|
66
68
|
import { Type } from "@sinclair/typebox";
|
|
67
69
|
import { cancel, isCancel } from "@clack/prompts";
|
|
68
70
|
import { createJiti } from "jiti";
|
|
@@ -1098,7 +1100,26 @@ function resolveMessagePrefix(cfg, agentId, opts) {
|
|
|
1098
1100
|
if (opts?.hasAllowFrom === true) return "";
|
|
1099
1101
|
return resolveIdentityNamePrefix(cfg, agentId) ?? opts?.fallback ?? "[openclaw]";
|
|
1100
1102
|
}
|
|
1101
|
-
|
|
1103
|
+
/** Helper to extract a channel config value by dynamic key. */
|
|
1104
|
+
function getChannelConfig(cfg, channel) {
|
|
1105
|
+
const value = cfg.channels?.[channel];
|
|
1106
|
+
return typeof value === "object" && value !== null ? value : void 0;
|
|
1107
|
+
}
|
|
1108
|
+
function resolveResponsePrefix(cfg, agentId, opts) {
|
|
1109
|
+
if (opts?.channel && opts?.accountId) {
|
|
1110
|
+
const accountPrefix = (getChannelConfig(cfg, opts.channel)?.accounts)?.[opts.accountId]?.responsePrefix;
|
|
1111
|
+
if (accountPrefix !== void 0) {
|
|
1112
|
+
if (accountPrefix === "auto") return resolveIdentityNamePrefix(cfg, agentId);
|
|
1113
|
+
return accountPrefix;
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
if (opts?.channel) {
|
|
1117
|
+
const channelPrefix = getChannelConfig(cfg, opts.channel)?.responsePrefix;
|
|
1118
|
+
if (channelPrefix !== void 0) {
|
|
1119
|
+
if (channelPrefix === "auto") return resolveIdentityNamePrefix(cfg, agentId);
|
|
1120
|
+
return channelPrefix;
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1102
1123
|
const configured = cfg.messages?.responsePrefix;
|
|
1103
1124
|
if (configured !== void 0) {
|
|
1104
1125
|
if (configured === "auto") return resolveIdentityNamePrefix(cfg, agentId);
|
|
@@ -1111,7 +1132,10 @@ function resolveEffectiveMessagesConfig(cfg, agentId, opts) {
|
|
|
1111
1132
|
hasAllowFrom: opts?.hasAllowFrom,
|
|
1112
1133
|
fallback: opts?.fallbackMessagePrefix
|
|
1113
1134
|
}),
|
|
1114
|
-
responsePrefix: resolveResponsePrefix(cfg, agentId
|
|
1135
|
+
responsePrefix: resolveResponsePrefix(cfg, agentId, {
|
|
1136
|
+
channel: opts?.channel,
|
|
1137
|
+
accountId: opts?.accountId
|
|
1138
|
+
})
|
|
1115
1139
|
};
|
|
1116
1140
|
}
|
|
1117
1141
|
function resolveHumanDelayConfig(cfg, agentId) {
|
|
@@ -1352,7 +1376,7 @@ async function getMemorySearchManager(params) {
|
|
|
1352
1376
|
const cached = QMD_MANAGER_CACHE.get(cacheKey);
|
|
1353
1377
|
if (cached) return { manager: cached };
|
|
1354
1378
|
try {
|
|
1355
|
-
const { QmdMemoryManager } = await import("./qmd-manager-
|
|
1379
|
+
const { QmdMemoryManager } = await import("./qmd-manager-Dub8jfbo.js");
|
|
1356
1380
|
const primary = await QmdMemoryManager.create({
|
|
1357
1381
|
cfg: params.cfg,
|
|
1358
1382
|
agentId: params.agentId,
|
|
@@ -1362,7 +1386,7 @@ async function getMemorySearchManager(params) {
|
|
|
1362
1386
|
const wrapper = new FallbackMemoryManager({
|
|
1363
1387
|
primary,
|
|
1364
1388
|
fallbackFactory: async () => {
|
|
1365
|
-
const { MemoryIndexManager } = await import("./manager-
|
|
1389
|
+
const { MemoryIndexManager } = await import("./manager-BXiIQku7.js").then((n) => n.t);
|
|
1366
1390
|
return await MemoryIndexManager.get(params);
|
|
1367
1391
|
}
|
|
1368
1392
|
}, () => QMD_MANAGER_CACHE.delete(cacheKey));
|
|
@@ -1375,7 +1399,7 @@ async function getMemorySearchManager(params) {
|
|
|
1375
1399
|
}
|
|
1376
1400
|
}
|
|
1377
1401
|
try {
|
|
1378
|
-
const { MemoryIndexManager } = await import("./manager-
|
|
1402
|
+
const { MemoryIndexManager } = await import("./manager-BXiIQku7.js").then((n) => n.t);
|
|
1379
1403
|
return { manager: await MemoryIndexManager.get(params) };
|
|
1380
1404
|
} catch (err) {
|
|
1381
1405
|
return {
|
|
@@ -3469,6 +3493,40 @@ function normalizeModelCompat(model) {
|
|
|
3469
3493
|
|
|
3470
3494
|
//#endregion
|
|
3471
3495
|
//#region src/agents/pi-embedded-runner/model.ts
|
|
3496
|
+
const OPENAI_CODEX_GPT_53_MODEL_ID = "gpt-5.3-codex";
|
|
3497
|
+
const OPENAI_CODEX_TEMPLATE_MODEL_IDS = ["gpt-5.2-codex"];
|
|
3498
|
+
function resolveOpenAICodexGpt53FallbackModel(provider, modelId, modelRegistry) {
|
|
3499
|
+
const normalizedProvider = normalizeProviderId(provider);
|
|
3500
|
+
const trimmedModelId = modelId.trim();
|
|
3501
|
+
if (normalizedProvider !== "openai-codex") return;
|
|
3502
|
+
if (trimmedModelId.toLowerCase() !== OPENAI_CODEX_GPT_53_MODEL_ID) return;
|
|
3503
|
+
for (const templateId of OPENAI_CODEX_TEMPLATE_MODEL_IDS) {
|
|
3504
|
+
const template = modelRegistry.find(normalizedProvider, templateId);
|
|
3505
|
+
if (!template) continue;
|
|
3506
|
+
return normalizeModelCompat({
|
|
3507
|
+
...template,
|
|
3508
|
+
id: trimmedModelId,
|
|
3509
|
+
name: trimmedModelId
|
|
3510
|
+
});
|
|
3511
|
+
}
|
|
3512
|
+
return normalizeModelCompat({
|
|
3513
|
+
id: trimmedModelId,
|
|
3514
|
+
name: trimmedModelId,
|
|
3515
|
+
api: "openai-codex-responses",
|
|
3516
|
+
provider: normalizedProvider,
|
|
3517
|
+
baseUrl: "https://chatgpt.com/backend-api",
|
|
3518
|
+
reasoning: true,
|
|
3519
|
+
input: ["text", "image"],
|
|
3520
|
+
cost: {
|
|
3521
|
+
input: 0,
|
|
3522
|
+
output: 0,
|
|
3523
|
+
cacheRead: 0,
|
|
3524
|
+
cacheWrite: 0
|
|
3525
|
+
},
|
|
3526
|
+
contextWindow: DEFAULT_CONTEXT_TOKENS,
|
|
3527
|
+
maxTokens: DEFAULT_CONTEXT_TOKENS
|
|
3528
|
+
});
|
|
3529
|
+
}
|
|
3472
3530
|
function buildInlineProviderModels(providers) {
|
|
3473
3531
|
return Object.entries(providers).flatMap(([providerId, entry]) => {
|
|
3474
3532
|
const trimmed = providerId.trim();
|
|
@@ -3511,6 +3569,12 @@ function resolveModel$4(provider, modelId, agentDir, cfg) {
|
|
|
3511
3569
|
authStorage,
|
|
3512
3570
|
modelRegistry
|
|
3513
3571
|
};
|
|
3572
|
+
const codexForwardCompat = resolveOpenAICodexGpt53FallbackModel(provider, modelId, modelRegistry);
|
|
3573
|
+
if (codexForwardCompat) return {
|
|
3574
|
+
model: codexForwardCompat,
|
|
3575
|
+
authStorage,
|
|
3576
|
+
modelRegistry
|
|
3577
|
+
};
|
|
3514
3578
|
const providerCfg = providers[provider];
|
|
3515
3579
|
if (providerCfg || modelId.startsWith("mock-")) return {
|
|
3516
3580
|
model: normalizeModelCompat({
|
|
@@ -4963,6 +5027,8 @@ function normalizePunctuation(value) {
|
|
|
4963
5027
|
//#endregion
|
|
4964
5028
|
//#region src/agents/sandbox-paths.ts
|
|
4965
5029
|
const UNICODE_SPACES$1 = /[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g;
|
|
5030
|
+
const HTTP_URL_RE = /^https?:\/\//i;
|
|
5031
|
+
const DATA_URL_RE = /^data:/i;
|
|
4966
5032
|
function normalizeUnicodeSpaces$1(str) {
|
|
4967
5033
|
return str.replace(UNICODE_SPACES$1, " ");
|
|
4968
5034
|
}
|
|
@@ -4996,6 +5062,26 @@ async function assertSandboxPath(params) {
|
|
|
4996
5062
|
await assertNoSymlink(resolved.relative, path.resolve(params.root));
|
|
4997
5063
|
return resolved;
|
|
4998
5064
|
}
|
|
5065
|
+
function assertMediaNotDataUrl(media) {
|
|
5066
|
+
const raw = media.trim();
|
|
5067
|
+
if (DATA_URL_RE.test(raw)) throw new Error("data: URLs are not supported for media. Use buffer instead.");
|
|
5068
|
+
}
|
|
5069
|
+
async function resolveSandboxedMediaSource(params) {
|
|
5070
|
+
const raw = params.media.trim();
|
|
5071
|
+
if (!raw) return raw;
|
|
5072
|
+
if (HTTP_URL_RE.test(raw)) return raw;
|
|
5073
|
+
let candidate = raw;
|
|
5074
|
+
if (/^file:\/\//i.test(candidate)) try {
|
|
5075
|
+
candidate = fileURLToPath(candidate);
|
|
5076
|
+
} catch {
|
|
5077
|
+
throw new Error(`Invalid file:// URL for sandboxed media: ${raw}`);
|
|
5078
|
+
}
|
|
5079
|
+
return (await assertSandboxPath({
|
|
5080
|
+
filePath: candidate,
|
|
5081
|
+
cwd: params.sandboxRoot,
|
|
5082
|
+
root: params.sandboxRoot
|
|
5083
|
+
})).resolved;
|
|
5084
|
+
}
|
|
4999
5085
|
async function assertNoSymlink(relative, root) {
|
|
5000
5086
|
if (!relative) return;
|
|
5001
5087
|
const parts = relative.split(path.sep).filter(Boolean);
|
|
@@ -9094,7 +9180,7 @@ function migrateLegacyCronPayload(payload) {
|
|
|
9094
9180
|
//#endregion
|
|
9095
9181
|
//#region src/cron/normalize.ts
|
|
9096
9182
|
const DEFAULT_OPTIONS = { applyDefaults: false };
|
|
9097
|
-
function isRecord$
|
|
9183
|
+
function isRecord$4(value) {
|
|
9098
9184
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9099
9185
|
}
|
|
9100
9186
|
function coerceSchedule(schedule) {
|
|
@@ -9160,12 +9246,12 @@ function stripLegacyDeliveryFields(payload) {
|
|
|
9160
9246
|
if ("bestEffortDeliver" in payload) delete payload.bestEffortDeliver;
|
|
9161
9247
|
}
|
|
9162
9248
|
function unwrapJob(raw) {
|
|
9163
|
-
if (isRecord$
|
|
9164
|
-
if (isRecord$
|
|
9249
|
+
if (isRecord$4(raw.data)) return raw.data;
|
|
9250
|
+
if (isRecord$4(raw.job)) return raw.job;
|
|
9165
9251
|
return raw;
|
|
9166
9252
|
}
|
|
9167
9253
|
function normalizeCronJobInput(raw, options = DEFAULT_OPTIONS) {
|
|
9168
|
-
if (!isRecord$
|
|
9254
|
+
if (!isRecord$4(raw)) return null;
|
|
9169
9255
|
const base = unwrapJob(raw);
|
|
9170
9256
|
const next = { ...base };
|
|
9171
9257
|
if ("agentId" in base) {
|
|
@@ -9186,20 +9272,20 @@ function normalizeCronJobInput(raw, options = DEFAULT_OPTIONS) {
|
|
|
9186
9272
|
if (trimmed === "false") next.enabled = false;
|
|
9187
9273
|
}
|
|
9188
9274
|
}
|
|
9189
|
-
if (isRecord$
|
|
9190
|
-
if (isRecord$
|
|
9191
|
-
if (isRecord$
|
|
9192
|
-
if (isRecord$
|
|
9275
|
+
if (isRecord$4(base.schedule)) next.schedule = coerceSchedule(base.schedule);
|
|
9276
|
+
if (isRecord$4(base.payload)) next.payload = coercePayload(base.payload);
|
|
9277
|
+
if (isRecord$4(base.delivery)) next.delivery = coerceDelivery(base.delivery);
|
|
9278
|
+
if (isRecord$4(base.isolation)) delete next.isolation;
|
|
9193
9279
|
if (options.applyDefaults) {
|
|
9194
9280
|
if (!next.wakeMode) next.wakeMode = "next-heartbeat";
|
|
9195
9281
|
if (typeof next.enabled !== "boolean") next.enabled = true;
|
|
9196
|
-
if (!next.sessionTarget && isRecord$
|
|
9282
|
+
if (!next.sessionTarget && isRecord$4(next.payload)) {
|
|
9197
9283
|
const kind = typeof next.payload.kind === "string" ? next.payload.kind : "";
|
|
9198
9284
|
if (kind === "systemEvent") next.sessionTarget = "main";
|
|
9199
9285
|
if (kind === "agentTurn") next.sessionTarget = "isolated";
|
|
9200
9286
|
}
|
|
9201
|
-
if ("schedule" in next && isRecord$
|
|
9202
|
-
const payload = isRecord$
|
|
9287
|
+
if ("schedule" in next && isRecord$4(next.schedule) && next.schedule.kind === "at" && !("deleteAfterRun" in next)) next.deleteAfterRun = true;
|
|
9288
|
+
const payload = isRecord$4(next.payload) ? next.payload : null;
|
|
9203
9289
|
const payloadKind = payload && typeof payload.kind === "string" ? payload.kind : "";
|
|
9204
9290
|
const sessionTarget = typeof next.sessionTarget === "string" ? next.sessionTarget : "";
|
|
9205
9291
|
const isIsolatedAgentTurn = sessionTarget === "isolated" || sessionTarget === "" && payloadKind === "agentTurn";
|
|
@@ -9327,6 +9413,37 @@ async function buildReminderContextLines(params) {
|
|
|
9327
9413
|
return [];
|
|
9328
9414
|
}
|
|
9329
9415
|
}
|
|
9416
|
+
function isRecord$3(value) {
|
|
9417
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9418
|
+
}
|
|
9419
|
+
function stripThreadSuffixFromSessionKey(sessionKey) {
|
|
9420
|
+
const idx = sessionKey.toLowerCase().lastIndexOf(":thread:");
|
|
9421
|
+
if (idx <= 0) return sessionKey;
|
|
9422
|
+
const parent = sessionKey.slice(0, idx).trim();
|
|
9423
|
+
return parent ? parent : sessionKey;
|
|
9424
|
+
}
|
|
9425
|
+
function inferDeliveryFromSessionKey(agentSessionKey) {
|
|
9426
|
+
const rawSessionKey = agentSessionKey?.trim();
|
|
9427
|
+
if (!rawSessionKey) return null;
|
|
9428
|
+
const parsed = parseAgentSessionKey(stripThreadSuffixFromSessionKey(rawSessionKey));
|
|
9429
|
+
if (!parsed || !parsed.rest) return null;
|
|
9430
|
+
const parts = parsed.rest.split(":").filter(Boolean);
|
|
9431
|
+
if (parts.length === 0) return null;
|
|
9432
|
+
const head = parts[0]?.trim().toLowerCase();
|
|
9433
|
+
if (!head || head === "main" || head === "subagent" || head === "acp") return null;
|
|
9434
|
+
const markerIndex = parts.findIndex((part) => part === "dm" || part === "group" || part === "channel");
|
|
9435
|
+
if (markerIndex === -1) return null;
|
|
9436
|
+
const peerId = parts.slice(markerIndex + 1).join(":").trim();
|
|
9437
|
+
if (!peerId) return null;
|
|
9438
|
+
let channel;
|
|
9439
|
+
if (markerIndex >= 1) channel = parts[0]?.trim().toLowerCase();
|
|
9440
|
+
const delivery = {
|
|
9441
|
+
mode: "announce",
|
|
9442
|
+
to: peerId
|
|
9443
|
+
};
|
|
9444
|
+
if (channel) delivery.channel = channel;
|
|
9445
|
+
return delivery;
|
|
9446
|
+
}
|
|
9330
9447
|
function createCronTool(opts) {
|
|
9331
9448
|
return {
|
|
9332
9449
|
label: "Cron",
|
|
@@ -9407,6 +9524,19 @@ Use jobId as the canonical identifier; id is accepted for compatibility. Use con
|
|
|
9407
9524
|
}) : void 0;
|
|
9408
9525
|
if (agentId) job.agentId = agentId;
|
|
9409
9526
|
}
|
|
9527
|
+
if (opts?.agentSessionKey && job && typeof job === "object" && "payload" in job && job.payload?.kind === "agentTurn") {
|
|
9528
|
+
const deliveryValue = job.delivery;
|
|
9529
|
+
const delivery = isRecord$3(deliveryValue) ? deliveryValue : void 0;
|
|
9530
|
+
const mode = (typeof delivery?.mode === "string" ? delivery.mode : "").trim().toLowerCase();
|
|
9531
|
+
const hasTarget = typeof delivery?.channel === "string" && delivery.channel.trim() || typeof delivery?.to === "string" && delivery.to.trim();
|
|
9532
|
+
if ((deliveryValue == null || delivery) && mode !== "none" && !hasTarget) {
|
|
9533
|
+
const inferred = inferDeliveryFromSessionKey(opts.agentSessionKey);
|
|
9534
|
+
if (inferred) job.delivery = {
|
|
9535
|
+
...delivery,
|
|
9536
|
+
...inferred
|
|
9537
|
+
};
|
|
9538
|
+
}
|
|
9539
|
+
}
|
|
9410
9540
|
const contextMessages = typeof params.contextMessages === "number" && Number.isFinite(params.contextMessages) ? params.contextMessages : 0;
|
|
9411
9541
|
if (job && typeof job === "object" && "payload" in job && job.payload?.kind === "systemEvent") {
|
|
9412
9542
|
const payload = job.payload;
|
|
@@ -9458,6 +9588,65 @@ Use jobId as the canonical identifier; id is accepted for compatibility. Use con
|
|
|
9458
9588
|
};
|
|
9459
9589
|
}
|
|
9460
9590
|
|
|
9591
|
+
//#endregion
|
|
9592
|
+
//#region src/infra/restart-sentinel.ts
|
|
9593
|
+
const SENTINEL_FILENAME = "restart-sentinel.json";
|
|
9594
|
+
function formatDoctorNonInteractiveHint(env = process.env) {
|
|
9595
|
+
return `Run: ${formatCliCommand("openclaw doctor --non-interactive", env)}`;
|
|
9596
|
+
}
|
|
9597
|
+
function resolveRestartSentinelPath(env = process.env) {
|
|
9598
|
+
return path.join(resolveStateDir(env), SENTINEL_FILENAME);
|
|
9599
|
+
}
|
|
9600
|
+
async function writeRestartSentinel(payload, env = process.env) {
|
|
9601
|
+
const filePath = resolveRestartSentinelPath(env);
|
|
9602
|
+
await fs$1.mkdir(path.dirname(filePath), { recursive: true });
|
|
9603
|
+
const data = {
|
|
9604
|
+
version: 1,
|
|
9605
|
+
payload
|
|
9606
|
+
};
|
|
9607
|
+
await fs$1.writeFile(filePath, `${JSON.stringify(data, null, 2)}\n`, "utf-8");
|
|
9608
|
+
return filePath;
|
|
9609
|
+
}
|
|
9610
|
+
async function readRestartSentinel(env = process.env) {
|
|
9611
|
+
const filePath = resolveRestartSentinelPath(env);
|
|
9612
|
+
try {
|
|
9613
|
+
const raw = await fs$1.readFile(filePath, "utf-8");
|
|
9614
|
+
let parsed;
|
|
9615
|
+
try {
|
|
9616
|
+
parsed = JSON.parse(raw);
|
|
9617
|
+
} catch {
|
|
9618
|
+
await fs$1.unlink(filePath).catch(() => {});
|
|
9619
|
+
return null;
|
|
9620
|
+
}
|
|
9621
|
+
if (!parsed || parsed.version !== 1 || !parsed.payload) {
|
|
9622
|
+
await fs$1.unlink(filePath).catch(() => {});
|
|
9623
|
+
return null;
|
|
9624
|
+
}
|
|
9625
|
+
return parsed;
|
|
9626
|
+
} catch {
|
|
9627
|
+
return null;
|
|
9628
|
+
}
|
|
9629
|
+
}
|
|
9630
|
+
async function consumeRestartSentinel(env = process.env) {
|
|
9631
|
+
const filePath = resolveRestartSentinelPath(env);
|
|
9632
|
+
const parsed = await readRestartSentinel(env);
|
|
9633
|
+
if (!parsed) return null;
|
|
9634
|
+
await fs$1.unlink(filePath).catch(() => {});
|
|
9635
|
+
return parsed;
|
|
9636
|
+
}
|
|
9637
|
+
function formatRestartSentinelMessage(payload) {
|
|
9638
|
+
return `GatewayRestart:\n${JSON.stringify(payload, null, 2)}`;
|
|
9639
|
+
}
|
|
9640
|
+
function summarizeRestartSentinel(payload) {
|
|
9641
|
+
return `Gateway restart ${payload.kind} ${payload.status}${payload.stats?.mode ? ` (${payload.stats.mode})` : ""}`.trim();
|
|
9642
|
+
}
|
|
9643
|
+
function trimLogTail(input, maxChars = 8e3) {
|
|
9644
|
+
if (!input) return null;
|
|
9645
|
+
const text = input.trimEnd();
|
|
9646
|
+
if (text.length <= maxChars) return text;
|
|
9647
|
+
return `…${text.slice(text.length - maxChars)}`;
|
|
9648
|
+
}
|
|
9649
|
+
|
|
9461
9650
|
//#endregion
|
|
9462
9651
|
//#region src/infra/restart.ts
|
|
9463
9652
|
const SPAWN_TIMEOUT_MS = 2e3;
|
|
@@ -9906,26 +10095,15 @@ function isAbortError$3(err) {
|
|
|
9906
10095
|
function shouldRethrowAbort(err) {
|
|
9907
10096
|
return isAbortError$3(err) && !isTimeoutError(err);
|
|
9908
10097
|
}
|
|
9909
|
-
function buildAllowedModelKeys(cfg, defaultProvider) {
|
|
9910
|
-
const rawAllowlist = (() => {
|
|
9911
|
-
const modelMap = cfg?.agents?.defaults?.models ?? {};
|
|
9912
|
-
return Object.keys(modelMap);
|
|
9913
|
-
})();
|
|
9914
|
-
if (rawAllowlist.length === 0) return null;
|
|
9915
|
-
const keys = /* @__PURE__ */ new Set();
|
|
9916
|
-
for (const raw of rawAllowlist) {
|
|
9917
|
-
const parsed = parseModelRef(String(raw ?? ""), defaultProvider);
|
|
9918
|
-
if (!parsed) continue;
|
|
9919
|
-
keys.add(modelKey(parsed.provider, parsed.model));
|
|
9920
|
-
}
|
|
9921
|
-
return keys.size > 0 ? keys : null;
|
|
9922
|
-
}
|
|
9923
10098
|
function resolveImageFallbackCandidates(params) {
|
|
9924
10099
|
const aliasIndex = buildModelAliasIndex({
|
|
9925
10100
|
cfg: params.cfg ?? {},
|
|
9926
10101
|
defaultProvider: params.defaultProvider
|
|
9927
10102
|
});
|
|
9928
|
-
const allowlist =
|
|
10103
|
+
const allowlist = buildConfiguredAllowlistKeys({
|
|
10104
|
+
cfg: params.cfg,
|
|
10105
|
+
defaultProvider: params.defaultProvider
|
|
10106
|
+
});
|
|
9929
10107
|
const seen = /* @__PURE__ */ new Set();
|
|
9930
10108
|
const candidates = [];
|
|
9931
10109
|
const addCandidate = (candidate, enforceAllowlist) => {
|
|
@@ -9973,7 +10151,10 @@ function resolveFallbackCandidates(params) {
|
|
|
9973
10151
|
cfg: params.cfg ?? {},
|
|
9974
10152
|
defaultProvider
|
|
9975
10153
|
});
|
|
9976
|
-
const allowlist =
|
|
10154
|
+
const allowlist = buildConfiguredAllowlistKeys({
|
|
10155
|
+
cfg: params.cfg,
|
|
10156
|
+
defaultProvider
|
|
10157
|
+
});
|
|
9977
10158
|
const seen = /* @__PURE__ */ new Set();
|
|
9978
10159
|
const candidates = [];
|
|
9979
10160
|
const addCandidate = (candidate, enforceAllowlist) => {
|
|
@@ -10118,6 +10299,8 @@ async function runWithImageModelFallback(params) {
|
|
|
10118
10299
|
//#endregion
|
|
10119
10300
|
//#region src/agents/tools/image-tool.ts
|
|
10120
10301
|
const DEFAULT_PROMPT$1 = "Describe the image.";
|
|
10302
|
+
const ANTHROPIC_IMAGE_PRIMARY = "anthropic/claude-opus-4-6";
|
|
10303
|
+
const ANTHROPIC_IMAGE_FALLBACK = "anthropic/claude-opus-4-5";
|
|
10121
10304
|
function resolveDefaultModelRef(cfg) {
|
|
10122
10305
|
if (cfg) {
|
|
10123
10306
|
const resolved = resolveConfiguredModelRef({
|
|
@@ -10178,10 +10361,10 @@ function resolveImageModelConfigForTool(params) {
|
|
|
10178
10361
|
if (primary.provider === "minimax" && providerOk) preferred = "minimax/MiniMax-VL-01";
|
|
10179
10362
|
else if (providerOk && providerVisionFromConfig) preferred = providerVisionFromConfig;
|
|
10180
10363
|
else if (primary.provider === "openai" && openaiOk) preferred = "openai/gpt-5-mini";
|
|
10181
|
-
else if (primary.provider === "anthropic" && anthropicOk) preferred =
|
|
10364
|
+
else if (primary.provider === "anthropic" && anthropicOk) preferred = ANTHROPIC_IMAGE_PRIMARY;
|
|
10182
10365
|
if (preferred?.trim()) {
|
|
10183
10366
|
if (openaiOk) addFallback("openai/gpt-5-mini");
|
|
10184
|
-
if (anthropicOk) addFallback(
|
|
10367
|
+
if (anthropicOk) addFallback(ANTHROPIC_IMAGE_FALLBACK);
|
|
10185
10368
|
const pruned = fallbacks.filter((ref) => ref !== preferred);
|
|
10186
10369
|
return {
|
|
10187
10370
|
primary: preferred,
|
|
@@ -10189,13 +10372,16 @@ function resolveImageModelConfigForTool(params) {
|
|
|
10189
10372
|
};
|
|
10190
10373
|
}
|
|
10191
10374
|
if (openaiOk) {
|
|
10192
|
-
if (anthropicOk) addFallback(
|
|
10375
|
+
if (anthropicOk) addFallback(ANTHROPIC_IMAGE_FALLBACK);
|
|
10193
10376
|
return {
|
|
10194
10377
|
primary: "openai/gpt-5-mini",
|
|
10195
10378
|
...fallbacks.length ? { fallbacks } : {}
|
|
10196
10379
|
};
|
|
10197
10380
|
}
|
|
10198
|
-
if (anthropicOk) return {
|
|
10381
|
+
if (anthropicOk) return {
|
|
10382
|
+
primary: ANTHROPIC_IMAGE_PRIMARY,
|
|
10383
|
+
fallbacks: [ANTHROPIC_IMAGE_FALLBACK]
|
|
10384
|
+
};
|
|
10199
10385
|
return null;
|
|
10200
10386
|
}
|
|
10201
10387
|
function pickMaxBytes(cfg, maxBytesMb) {
|
|
@@ -11086,10 +11272,27 @@ function resolveHeartbeatDeliveryTarget(params) {
|
|
|
11086
11272
|
explicitTo: heartbeat?.to,
|
|
11087
11273
|
mode: "heartbeat"
|
|
11088
11274
|
});
|
|
11275
|
+
const heartbeatAccountId = heartbeat?.accountId?.trim();
|
|
11276
|
+
let effectiveAccountId = heartbeatAccountId || resolvedTarget.accountId;
|
|
11277
|
+
if (heartbeatAccountId && resolvedTarget.channel) {
|
|
11278
|
+
const listAccountIds = getChannelPlugin(resolvedTarget.channel)?.config.listAccountIds;
|
|
11279
|
+
const accountIds = listAccountIds ? listAccountIds(cfg) : [];
|
|
11280
|
+
if (accountIds.length > 0) {
|
|
11281
|
+
const normalizedAccountId = normalizeAccountId$3(heartbeatAccountId);
|
|
11282
|
+
if (!new Set(accountIds.map((accountId) => normalizeAccountId$3(accountId))).has(normalizedAccountId)) return {
|
|
11283
|
+
channel: "none",
|
|
11284
|
+
reason: "unknown-account",
|
|
11285
|
+
accountId: normalizedAccountId,
|
|
11286
|
+
lastChannel: resolvedTarget.lastChannel,
|
|
11287
|
+
lastAccountId: resolvedTarget.lastAccountId
|
|
11288
|
+
};
|
|
11289
|
+
effectiveAccountId = normalizedAccountId;
|
|
11290
|
+
}
|
|
11291
|
+
}
|
|
11089
11292
|
if (!resolvedTarget.channel || !resolvedTarget.to) return {
|
|
11090
11293
|
channel: "none",
|
|
11091
11294
|
reason: "no-target",
|
|
11092
|
-
accountId:
|
|
11295
|
+
accountId: effectiveAccountId,
|
|
11093
11296
|
lastChannel: resolvedTarget.lastChannel,
|
|
11094
11297
|
lastAccountId: resolvedTarget.lastAccountId
|
|
11095
11298
|
};
|
|
@@ -11097,13 +11300,13 @@ function resolveHeartbeatDeliveryTarget(params) {
|
|
|
11097
11300
|
channel: resolvedTarget.channel,
|
|
11098
11301
|
to: resolvedTarget.to,
|
|
11099
11302
|
cfg,
|
|
11100
|
-
accountId:
|
|
11303
|
+
accountId: effectiveAccountId,
|
|
11101
11304
|
mode: "heartbeat"
|
|
11102
11305
|
});
|
|
11103
11306
|
if (!resolved.ok) return {
|
|
11104
11307
|
channel: "none",
|
|
11105
11308
|
reason: "no-target",
|
|
11106
|
-
accountId:
|
|
11309
|
+
accountId: effectiveAccountId,
|
|
11107
11310
|
lastChannel: resolvedTarget.lastChannel,
|
|
11108
11311
|
lastAccountId: resolvedTarget.lastAccountId
|
|
11109
11312
|
};
|
|
@@ -11113,7 +11316,7 @@ function resolveHeartbeatDeliveryTarget(params) {
|
|
|
11113
11316
|
channel: resolvedTarget.channel,
|
|
11114
11317
|
to: resolvedTarget.to,
|
|
11115
11318
|
cfg,
|
|
11116
|
-
accountId:
|
|
11319
|
+
accountId: effectiveAccountId,
|
|
11117
11320
|
mode: "explicit"
|
|
11118
11321
|
});
|
|
11119
11322
|
if (explicit.ok && explicit.to !== resolved.to) reason = "allowFrom-fallback";
|
|
@@ -11122,7 +11325,7 @@ function resolveHeartbeatDeliveryTarget(params) {
|
|
|
11122
11325
|
channel: resolvedTarget.channel,
|
|
11123
11326
|
to: resolved.to,
|
|
11124
11327
|
reason,
|
|
11125
|
-
accountId:
|
|
11328
|
+
accountId: effectiveAccountId,
|
|
11126
11329
|
lastChannel: resolvedTarget.lastChannel,
|
|
11127
11330
|
lastAccountId: resolvedTarget.lastAccountId
|
|
11128
11331
|
};
|
|
@@ -11147,9 +11350,10 @@ function resolveHeartbeatSenderId(params) {
|
|
|
11147
11350
|
}
|
|
11148
11351
|
function resolveHeartbeatSenderContext(params) {
|
|
11149
11352
|
const provider = params.delivery.channel !== "none" ? params.delivery.channel : params.delivery.lastChannel;
|
|
11353
|
+
const accountId = params.delivery.accountId ?? (provider === params.delivery.lastChannel ? params.delivery.lastAccountId : void 0);
|
|
11150
11354
|
const allowFrom = provider ? getChannelPlugin(provider)?.config.resolveAllowFrom?.({
|
|
11151
11355
|
cfg: params.cfg,
|
|
11152
|
-
accountId
|
|
11356
|
+
accountId
|
|
11153
11357
|
}) ?? [] : [];
|
|
11154
11358
|
return {
|
|
11155
11359
|
sender: resolveHeartbeatSenderId({
|
|
@@ -11599,6 +11803,26 @@ function resolveDiscordUserAllowed(params) {
|
|
|
11599
11803
|
tag: params.userTag
|
|
11600
11804
|
});
|
|
11601
11805
|
}
|
|
11806
|
+
function resolveDiscordOwnerAllowFrom(params) {
|
|
11807
|
+
const rawAllowList = params.channelConfig?.users ?? params.guildInfo?.users;
|
|
11808
|
+
if (!Array.isArray(rawAllowList) || rawAllowList.length === 0) return;
|
|
11809
|
+
const allowList = normalizeDiscordAllowList(rawAllowList, [
|
|
11810
|
+
"discord:",
|
|
11811
|
+
"user:",
|
|
11812
|
+
"pk:"
|
|
11813
|
+
]);
|
|
11814
|
+
if (!allowList) return;
|
|
11815
|
+
const match = resolveDiscordAllowListMatch({
|
|
11816
|
+
allowList,
|
|
11817
|
+
candidate: {
|
|
11818
|
+
id: params.sender.id,
|
|
11819
|
+
name: params.sender.name,
|
|
11820
|
+
tag: params.sender.tag
|
|
11821
|
+
}
|
|
11822
|
+
});
|
|
11823
|
+
if (!match.allowed || !match.matchKey || match.matchKey === "*") return;
|
|
11824
|
+
return [match.matchKey];
|
|
11825
|
+
}
|
|
11602
11826
|
function resolveDiscordGuildEntry(params) {
|
|
11603
11827
|
const guild = params.guild;
|
|
11604
11828
|
const entries = params.guildEntries;
|
|
@@ -11643,6 +11867,7 @@ function resolveDiscordChannelConfigEntry(entry) {
|
|
|
11643
11867
|
enabled: entry.enabled,
|
|
11644
11868
|
users: entry.users,
|
|
11645
11869
|
systemPrompt: entry.systemPrompt,
|
|
11870
|
+
includeThreadStarter: entry.includeThreadStarter,
|
|
11646
11871
|
autoThread: entry.autoThread
|
|
11647
11872
|
};
|
|
11648
11873
|
}
|
|
@@ -12418,6 +12643,20 @@ function buildTelegramGroupPeerId(chatId, messageThreadId) {
|
|
|
12418
12643
|
function buildTelegramGroupFrom(chatId, messageThreadId) {
|
|
12419
12644
|
return `telegram:group:${buildTelegramGroupPeerId(chatId, messageThreadId)}`;
|
|
12420
12645
|
}
|
|
12646
|
+
/**
|
|
12647
|
+
* Build parentPeer for forum topic binding inheritance.
|
|
12648
|
+
* When a message comes from a forum topic, the peer ID includes the topic suffix
|
|
12649
|
+
* (e.g., `-1001234567890:topic:99`). To allow bindings configured for the base
|
|
12650
|
+
* group ID to match, we provide the parent group as `parentPeer` so the routing
|
|
12651
|
+
* layer can fall back to it when the exact peer doesn't match.
|
|
12652
|
+
*/
|
|
12653
|
+
function buildTelegramParentPeer(params) {
|
|
12654
|
+
if (!params.isGroup || params.resolvedThreadId == null) return;
|
|
12655
|
+
return {
|
|
12656
|
+
kind: "group",
|
|
12657
|
+
id: String(params.chatId)
|
|
12658
|
+
};
|
|
12659
|
+
}
|
|
12421
12660
|
function buildSenderName(msg) {
|
|
12422
12661
|
return [msg.from?.first_name, msg.from?.last_name].filter(Boolean).join(" ").trim() || msg.from?.username || void 0;
|
|
12423
12662
|
}
|
|
@@ -13427,6 +13666,24 @@ function resolveSlackAutoThreadId(params) {
|
|
|
13427
13666
|
if (context.replyToMode === "first" && context.hasRepliedRef?.value) return;
|
|
13428
13667
|
return context.currentThreadTs;
|
|
13429
13668
|
}
|
|
13669
|
+
/**
|
|
13670
|
+
* Auto-inject Telegram forum topic thread ID when the message tool targets
|
|
13671
|
+
* the same chat the session originated from. Mirrors the Slack auto-threading
|
|
13672
|
+
* pattern so media, buttons, and other tool-sent messages land in the correct
|
|
13673
|
+
* topic instead of the General Topic.
|
|
13674
|
+
*
|
|
13675
|
+
* Unlike Slack, we do not gate on `replyToMode` here: Telegram forum topics
|
|
13676
|
+
* are persistent sub-channels (not ephemeral reply threads), so auto-injection
|
|
13677
|
+
* should always apply when the target chat matches.
|
|
13678
|
+
*/
|
|
13679
|
+
function resolveTelegramAutoThreadId(params) {
|
|
13680
|
+
const context = params.toolContext;
|
|
13681
|
+
if (!context?.currentThreadTs || !context.currentChannelId) return;
|
|
13682
|
+
const parsedTo = parseTelegramTarget(params.to);
|
|
13683
|
+
const parsedChannel = parseTelegramTarget(context.currentChannelId);
|
|
13684
|
+
if (parsedTo.chatId.toLowerCase() !== parsedChannel.chatId.toLowerCase()) return;
|
|
13685
|
+
return context.currentThreadTs;
|
|
13686
|
+
}
|
|
13430
13687
|
function resolveAttachmentMaxBytes(params) {
|
|
13431
13688
|
const fallback = params.cfg.agents?.defaults?.mediaMaxMb;
|
|
13432
13689
|
if (params.channel !== "bluebubbles") return typeof fallback === "number" ? fallback * 1024 * 1024 : void 0;
|
|
@@ -13475,6 +13732,42 @@ function normalizeBase64Payload(params) {
|
|
|
13475
13732
|
contentType: params.contentType ?? mime
|
|
13476
13733
|
};
|
|
13477
13734
|
}
|
|
13735
|
+
async function normalizeSandboxMediaParams(params) {
|
|
13736
|
+
const sandboxRoot = params.sandboxRoot?.trim();
|
|
13737
|
+
for (const key of [
|
|
13738
|
+
"media",
|
|
13739
|
+
"path",
|
|
13740
|
+
"filePath"
|
|
13741
|
+
]) {
|
|
13742
|
+
const raw = readStringParam(params.args, key, { trim: false });
|
|
13743
|
+
if (!raw) continue;
|
|
13744
|
+
assertMediaNotDataUrl(raw);
|
|
13745
|
+
if (!sandboxRoot) continue;
|
|
13746
|
+
const normalized = await resolveSandboxedMediaSource({
|
|
13747
|
+
media: raw,
|
|
13748
|
+
sandboxRoot
|
|
13749
|
+
});
|
|
13750
|
+
if (normalized !== raw) params.args[key] = normalized;
|
|
13751
|
+
}
|
|
13752
|
+
}
|
|
13753
|
+
async function normalizeSandboxMediaList(params) {
|
|
13754
|
+
const sandboxRoot = params.sandboxRoot?.trim();
|
|
13755
|
+
const normalized = [];
|
|
13756
|
+
const seen = /* @__PURE__ */ new Set();
|
|
13757
|
+
for (const value of params.values) {
|
|
13758
|
+
const raw = value?.trim();
|
|
13759
|
+
if (!raw) continue;
|
|
13760
|
+
assertMediaNotDataUrl(raw);
|
|
13761
|
+
const resolved = sandboxRoot ? await resolveSandboxedMediaSource({
|
|
13762
|
+
media: raw,
|
|
13763
|
+
sandboxRoot
|
|
13764
|
+
}) : raw;
|
|
13765
|
+
if (seen.has(resolved)) continue;
|
|
13766
|
+
seen.add(resolved);
|
|
13767
|
+
normalized.push(resolved);
|
|
13768
|
+
}
|
|
13769
|
+
return normalized;
|
|
13770
|
+
}
|
|
13478
13771
|
async function hydrateSetGroupIconParams(params) {
|
|
13479
13772
|
if (params.action !== "setGroupIcon") return;
|
|
13480
13773
|
const mediaHint = readStringParam(params.args, "media", { trim: false });
|
|
@@ -13695,6 +13988,7 @@ async function handleSendAction(ctx) {
|
|
|
13695
13988
|
required: !mediaHint && !hasCard,
|
|
13696
13989
|
allowEmpty: true
|
|
13697
13990
|
}) ?? "";
|
|
13991
|
+
if (message.includes("\\n")) message = message.replaceAll("\\n", "\n");
|
|
13698
13992
|
const parsed = parseReplyDirectives(message);
|
|
13699
13993
|
const mergedMediaUrls = [];
|
|
13700
13994
|
const seenMedia = /* @__PURE__ */ new Set();
|
|
@@ -13708,6 +14002,12 @@ async function handleSendAction(ctx) {
|
|
|
13708
14002
|
pushMedia(mediaHint);
|
|
13709
14003
|
for (const url of parsed.mediaUrls ?? []) pushMedia(url);
|
|
13710
14004
|
pushMedia(parsed.mediaUrl);
|
|
14005
|
+
const normalizedMediaUrls = await normalizeSandboxMediaList({
|
|
14006
|
+
values: mergedMediaUrls,
|
|
14007
|
+
sandboxRoot: input.sandboxRoot
|
|
14008
|
+
});
|
|
14009
|
+
mergedMediaUrls.length = 0;
|
|
14010
|
+
mergedMediaUrls.push(...normalizedMediaUrls);
|
|
13711
14011
|
message = parsed.text;
|
|
13712
14012
|
params.message = message;
|
|
13713
14013
|
if (!params.replyTo && parsed.replyToId) params.replyTo = parsed.replyToId;
|
|
@@ -13732,6 +14032,12 @@ async function handleSendAction(ctx) {
|
|
|
13732
14032
|
to,
|
|
13733
14033
|
toolContext: input.toolContext
|
|
13734
14034
|
}) : void 0;
|
|
14035
|
+
const telegramAutoThreadId = channel === "telegram" && !threadId ? resolveTelegramAutoThreadId({
|
|
14036
|
+
to,
|
|
14037
|
+
toolContext: input.toolContext
|
|
14038
|
+
}) : void 0;
|
|
14039
|
+
const resolvedThreadId = threadId ?? slackAutoThreadId ?? telegramAutoThreadId;
|
|
14040
|
+
if (resolvedThreadId && !params.threadId) params.threadId = resolvedThreadId;
|
|
13735
14041
|
const outboundRoute = agentId && !dryRun ? await resolveOutboundSessionRoute({
|
|
13736
14042
|
cfg,
|
|
13737
14043
|
channel,
|
|
@@ -13740,7 +14046,7 @@ async function handleSendAction(ctx) {
|
|
|
13740
14046
|
target: to,
|
|
13741
14047
|
resolvedTarget,
|
|
13742
14048
|
replyToId,
|
|
13743
|
-
threadId:
|
|
14049
|
+
threadId: resolvedThreadId
|
|
13744
14050
|
}) : null;
|
|
13745
14051
|
if (outboundRoute && agentId && !dryRun) await ensureOutboundSessionEntry({
|
|
13746
14052
|
cfg,
|
|
@@ -13923,6 +14229,10 @@ async function runMessageAction(input) {
|
|
|
13923
14229
|
const accountId = readStringParam(params, "accountId") ?? input.defaultAccountId;
|
|
13924
14230
|
if (accountId) params.accountId = accountId;
|
|
13925
14231
|
const dryRun = Boolean(input.dryRun ?? readBooleanParam(params, "dryRun"));
|
|
14232
|
+
await normalizeSandboxMediaParams({
|
|
14233
|
+
args: params,
|
|
14234
|
+
sandboxRoot: input.sandboxRoot
|
|
14235
|
+
});
|
|
13926
14236
|
await hydrateSendAttachmentParams({
|
|
13927
14237
|
cfg,
|
|
13928
14238
|
channel,
|
|
@@ -14016,7 +14326,7 @@ function buildSendSchema(options) {
|
|
|
14016
14326
|
message: Type.Optional(Type.String()),
|
|
14017
14327
|
effectId: Type.Optional(Type.String({ description: "Message effect name/id for sendWithEffect (e.g., invisible ink)." })),
|
|
14018
14328
|
effect: Type.Optional(Type.String({ description: "Alias for effectId (e.g., invisible-ink, balloons)." })),
|
|
14019
|
-
media: Type.Optional(Type.String()),
|
|
14329
|
+
media: Type.Optional(Type.String({ description: "Media URL or local path. data: URLs are not supported here, use buffer." })),
|
|
14020
14330
|
filename: Type.Optional(Type.String()),
|
|
14021
14331
|
buffer: Type.Optional(Type.String({ description: "Base64 payload for attachments (optionally a data: URL)." })),
|
|
14022
14332
|
contentType: Type.Optional(Type.String()),
|
|
@@ -14246,15 +14556,6 @@ function createMessageTool(options) {
|
|
|
14246
14556
|
if (options?.requireExplicitTarget === true && actionNeedsExplicitTarget(action)) {
|
|
14247
14557
|
if (!(typeof params.target === "string" && params.target.trim().length > 0 || typeof params.to === "string" && params.to.trim().length > 0 || typeof params.channelId === "string" && params.channelId.trim().length > 0 || Array.isArray(params.targets) && params.targets.some((value) => typeof value === "string" && value.trim().length > 0))) throw new Error("Explicit message target required for this run. Provide target/targets (and channel when needed).");
|
|
14248
14558
|
}
|
|
14249
|
-
const sandboxRoot = options?.sandboxRoot;
|
|
14250
|
-
if (sandboxRoot) for (const key of ["filePath", "path"]) {
|
|
14251
|
-
const raw = readStringParam(params, key, { trim: false });
|
|
14252
|
-
if (raw) await assertSandboxPath({
|
|
14253
|
-
filePath: raw,
|
|
14254
|
-
cwd: sandboxRoot,
|
|
14255
|
-
root: sandboxRoot
|
|
14256
|
-
});
|
|
14257
|
-
}
|
|
14258
14559
|
const accountId = readStringParam(params, "accountId") ?? agentAccountId;
|
|
14259
14560
|
if (accountId) params.accountId = accountId;
|
|
14260
14561
|
const gateway = {
|
|
@@ -14284,6 +14585,7 @@ function createMessageTool(options) {
|
|
|
14284
14585
|
sessionKey: options.agentSessionKey,
|
|
14285
14586
|
config: cfg
|
|
14286
14587
|
}) : void 0,
|
|
14588
|
+
sandboxRoot: options?.sandboxRoot,
|
|
14287
14589
|
abortSignal: signal
|
|
14288
14590
|
});
|
|
14289
14591
|
const toolResult = getToolResult(result);
|
|
@@ -16026,12 +16328,12 @@ function resolveResponsePrefixTemplate(template, context) {
|
|
|
16026
16328
|
*
|
|
16027
16329
|
* Strips:
|
|
16028
16330
|
* - Provider prefix (e.g., "openai/" from "openai/gpt-5.2")
|
|
16029
|
-
* - Date suffixes (e.g., "-
|
|
16331
|
+
* - Date suffixes (e.g., "-20260205" from "claude-opus-4-6-20260205")
|
|
16030
16332
|
* - Common version suffixes (e.g., "-latest")
|
|
16031
16333
|
*
|
|
16032
16334
|
* @example
|
|
16033
16335
|
* extractShortModelName("openai-codex/gpt-5.2") // "gpt-5.2"
|
|
16034
|
-
* extractShortModelName("claude-opus-4-
|
|
16336
|
+
* extractShortModelName("claude-opus-4-6-20260205") // "claude-opus-4-6"
|
|
16035
16337
|
* extractShortModelName("gpt-5.2-latest") // "gpt-5.2"
|
|
16036
16338
|
*/
|
|
16037
16339
|
function extractShortModelName(fullModel) {
|
|
@@ -16101,10 +16403,14 @@ function normalizeReplyPayload(payload, opts = {}) {
|
|
|
16101
16403
|
*/
|
|
16102
16404
|
async function routeReply(params) {
|
|
16103
16405
|
const { payload, channel, to, accountId, threadId, cfg, abortSignal } = params;
|
|
16406
|
+
const normalizedChannel = normalizeMessageChannel(channel);
|
|
16104
16407
|
const normalized = normalizeReplyPayload(payload, { responsePrefix: params.sessionKey ? resolveEffectiveMessagesConfig(cfg, resolveSessionAgentId({
|
|
16105
16408
|
sessionKey: params.sessionKey,
|
|
16106
16409
|
config: cfg
|
|
16107
|
-
})
|
|
16410
|
+
}), {
|
|
16411
|
+
channel: normalizedChannel,
|
|
16412
|
+
accountId
|
|
16413
|
+
}).responsePrefix : cfg.messages?.responsePrefix === "auto" ? void 0 : cfg.messages?.responsePrefix });
|
|
16108
16414
|
if (!normalized) return { ok: true };
|
|
16109
16415
|
let text = normalized.text ?? "";
|
|
16110
16416
|
let mediaUrls = (normalized.mediaUrls?.filter(Boolean) ?? []).length ? normalized.mediaUrls?.filter(Boolean) : normalized.mediaUrl ? [normalized.mediaUrl] : [];
|
|
@@ -16126,7 +16432,7 @@ async function routeReply(params) {
|
|
|
16126
16432
|
const resolvedReplyToId = replyToId ?? (channelId === "slack" && threadId != null && threadId !== "" ? String(threadId) : void 0);
|
|
16127
16433
|
const resolvedThreadId = channelId === "slack" ? null : threadId ?? null;
|
|
16128
16434
|
try {
|
|
16129
|
-
const { deliverOutboundPayloads } = await import("./deliver-
|
|
16435
|
+
const { deliverOutboundPayloads } = await import("./deliver-Cau4HL7W.js").then((n) => n.n);
|
|
16130
16436
|
return {
|
|
16131
16437
|
ok: true,
|
|
16132
16438
|
messageId: (await deliverOutboundPayloads({
|
|
@@ -16331,7 +16637,7 @@ function resolveQueueSettings(params) {
|
|
|
16331
16637
|
const MODEL_CACHE = /* @__PURE__ */ new Map();
|
|
16332
16638
|
(async () => {
|
|
16333
16639
|
try {
|
|
16334
|
-
const { discoverAuthStorage, discoverModels } = await import("./pi-model-discovery-
|
|
16640
|
+
const { discoverAuthStorage, discoverModels } = await import("./pi-model-discovery-DzEIEgHL.js").then((n) => n.r);
|
|
16335
16641
|
await ensureOpenClawModelsJson(loadConfig());
|
|
16336
16642
|
const agentDir = resolveOpenClawAgentDir();
|
|
16337
16643
|
const models = discoverModels(discoverAuthStorage(agentDir), agentDir).getAll();
|
|
@@ -16346,48 +16652,6 @@ function lookupContextTokens(modelId) {
|
|
|
16346
16652
|
return MODEL_CACHE.get(modelId);
|
|
16347
16653
|
}
|
|
16348
16654
|
|
|
16349
|
-
//#endregion
|
|
16350
|
-
//#region src/agents/usage.ts
|
|
16351
|
-
const asFiniteNumber = (value) => {
|
|
16352
|
-
if (typeof value !== "number") return;
|
|
16353
|
-
if (!Number.isFinite(value)) return;
|
|
16354
|
-
return value;
|
|
16355
|
-
};
|
|
16356
|
-
function hasNonzeroUsage(usage) {
|
|
16357
|
-
if (!usage) return false;
|
|
16358
|
-
return [
|
|
16359
|
-
usage.input,
|
|
16360
|
-
usage.output,
|
|
16361
|
-
usage.cacheRead,
|
|
16362
|
-
usage.cacheWrite,
|
|
16363
|
-
usage.total
|
|
16364
|
-
].some((v) => typeof v === "number" && Number.isFinite(v) && v > 0);
|
|
16365
|
-
}
|
|
16366
|
-
function normalizeUsage(raw) {
|
|
16367
|
-
if (!raw) return;
|
|
16368
|
-
const input = asFiniteNumber(raw.input ?? raw.inputTokens ?? raw.input_tokens ?? raw.promptTokens ?? raw.prompt_tokens);
|
|
16369
|
-
const output = asFiniteNumber(raw.output ?? raw.outputTokens ?? raw.output_tokens ?? raw.completionTokens ?? raw.completion_tokens);
|
|
16370
|
-
const cacheRead = asFiniteNumber(raw.cacheRead ?? raw.cache_read ?? raw.cache_read_input_tokens);
|
|
16371
|
-
const cacheWrite = asFiniteNumber(raw.cacheWrite ?? raw.cache_write ?? raw.cache_creation_input_tokens);
|
|
16372
|
-
const total = asFiniteNumber(raw.total ?? raw.totalTokens ?? raw.total_tokens);
|
|
16373
|
-
if (input === void 0 && output === void 0 && cacheRead === void 0 && cacheWrite === void 0 && total === void 0) return;
|
|
16374
|
-
return {
|
|
16375
|
-
input,
|
|
16376
|
-
output,
|
|
16377
|
-
cacheRead,
|
|
16378
|
-
cacheWrite,
|
|
16379
|
-
total
|
|
16380
|
-
};
|
|
16381
|
-
}
|
|
16382
|
-
function derivePromptTokens(usage) {
|
|
16383
|
-
if (!usage) return;
|
|
16384
|
-
const input = usage.input ?? 0;
|
|
16385
|
-
const cacheRead = usage.cacheRead ?? 0;
|
|
16386
|
-
const cacheWrite = usage.cacheWrite ?? 0;
|
|
16387
|
-
const sum = input + cacheRead + cacheWrite;
|
|
16388
|
-
return sum > 0 ? sum : void 0;
|
|
16389
|
-
}
|
|
16390
|
-
|
|
16391
16655
|
//#endregion
|
|
16392
16656
|
//#region src/infra/git-commit.ts
|
|
16393
16657
|
const formatCommit = (value) => {
|
|
@@ -16962,7 +17226,7 @@ function archiveFileOnDisk(filePath, reason) {
|
|
|
16962
17226
|
fs.renameSync(filePath, archived);
|
|
16963
17227
|
return archived;
|
|
16964
17228
|
}
|
|
16965
|
-
function jsonUtf8Bytes(value) {
|
|
17229
|
+
function jsonUtf8Bytes$1(value) {
|
|
16966
17230
|
try {
|
|
16967
17231
|
return Buffer.byteLength(JSON.stringify(value), "utf8");
|
|
16968
17232
|
} catch {
|
|
@@ -16974,7 +17238,7 @@ function capArrayByJsonBytes(items, maxBytes) {
|
|
|
16974
17238
|
items,
|
|
16975
17239
|
bytes: 2
|
|
16976
17240
|
};
|
|
16977
|
-
const parts = items.map((item) => jsonUtf8Bytes(item));
|
|
17241
|
+
const parts = items.map((item) => jsonUtf8Bytes$1(item));
|
|
16978
17242
|
let bytes = 2 + parts.reduce((a, b) => a + b, 0) + (items.length - 1);
|
|
16979
17243
|
let start = 0;
|
|
16980
17244
|
while (bytes > maxBytes && start < items.length - 1) {
|
|
@@ -17091,22 +17355,10 @@ function extractPreviewText(message) {
|
|
|
17091
17355
|
return null;
|
|
17092
17356
|
}
|
|
17093
17357
|
function isToolCall(message) {
|
|
17094
|
-
|
|
17095
|
-
if (!Array.isArray(message.content)) return false;
|
|
17096
|
-
return message.content.some((entry) => {
|
|
17097
|
-
if (entry?.name) return true;
|
|
17098
|
-
const raw = typeof entry?.type === "string" ? entry.type.toLowerCase() : "";
|
|
17099
|
-
return raw === "toolcall" || raw === "tool_call";
|
|
17100
|
-
});
|
|
17358
|
+
return hasToolCall(message);
|
|
17101
17359
|
}
|
|
17102
17360
|
function extractToolNames(message) {
|
|
17103
|
-
|
|
17104
|
-
if (Array.isArray(message.content)) {
|
|
17105
|
-
for (const entry of message.content) if (typeof entry?.name === "string" && entry.name.trim()) names.push(entry.name.trim());
|
|
17106
|
-
}
|
|
17107
|
-
const toolName = typeof message.toolName === "string" ? message.toolName : message.tool_name;
|
|
17108
|
-
if (typeof toolName === "string" && toolName.trim()) names.push(toolName.trim());
|
|
17109
|
-
return names;
|
|
17361
|
+
return extractToolCallNames(message);
|
|
17110
17362
|
}
|
|
17111
17363
|
function extractMediaSummary(message) {
|
|
17112
17364
|
if (!Array.isArray(message.content)) return null;
|
|
@@ -17486,8 +17738,11 @@ function getSessionDefaults(cfg) {
|
|
|
17486
17738
|
contextTokens: contextTokens ?? null
|
|
17487
17739
|
};
|
|
17488
17740
|
}
|
|
17489
|
-
function resolveSessionModelRef(cfg, entry) {
|
|
17490
|
-
const resolved =
|
|
17741
|
+
function resolveSessionModelRef(cfg, entry, agentId) {
|
|
17742
|
+
const resolved = agentId ? resolveDefaultModelForAgent({
|
|
17743
|
+
cfg,
|
|
17744
|
+
agentId
|
|
17745
|
+
}) : resolveConfiguredModelRef({
|
|
17491
17746
|
cfg,
|
|
17492
17747
|
defaultProvider: DEFAULT_PROVIDER,
|
|
17493
17748
|
defaultModel: DEFAULT_MODEL
|
|
@@ -17555,6 +17810,9 @@ function listSessionsFromStore(params) {
|
|
|
17555
17810
|
key
|
|
17556
17811
|
}) : void 0) ?? entry?.label ?? originLabel;
|
|
17557
17812
|
const deliveryFields = normalizeSessionDeliveryFields(entry);
|
|
17813
|
+
const resolvedModel = resolveSessionModelRef(cfg, entry, normalizeAgentId(parseAgentSessionKey(key)?.agentId ?? resolveDefaultAgentId(cfg)));
|
|
17814
|
+
const modelProvider = resolvedModel.provider ?? DEFAULT_PROVIDER;
|
|
17815
|
+
const model = resolvedModel.model ?? DEFAULT_MODEL;
|
|
17558
17816
|
return {
|
|
17559
17817
|
key,
|
|
17560
17818
|
entry,
|
|
@@ -17580,8 +17838,8 @@ function listSessionsFromStore(params) {
|
|
|
17580
17838
|
outputTokens: entry?.outputTokens,
|
|
17581
17839
|
totalTokens: total,
|
|
17582
17840
|
responseUsage: entry?.responseUsage,
|
|
17583
|
-
modelProvider
|
|
17584
|
-
model
|
|
17841
|
+
modelProvider,
|
|
17842
|
+
model,
|
|
17585
17843
|
contextTokens: entry?.contextTokens,
|
|
17586
17844
|
deliveryContext: deliveryFields.deliveryContext,
|
|
17587
17845
|
lastChannel: deliveryFields.lastChannel ?? entry?.lastChannel,
|
|
@@ -18806,7 +19064,7 @@ function applyModelOverrideToSessionEntry(params) {
|
|
|
18806
19064
|
//#region src/agents/model-catalog.ts
|
|
18807
19065
|
let modelCatalogPromise = null;
|
|
18808
19066
|
let hasLoggedModelCatalogError = false;
|
|
18809
|
-
const defaultImportPiSdk = () => import("./pi-model-discovery-
|
|
19067
|
+
const defaultImportPiSdk = () => import("./pi-model-discovery-DzEIEgHL.js").then((n) => n.r);
|
|
18810
19068
|
let importPiSdk = defaultImportPiSdk;
|
|
18811
19069
|
async function loadModelCatalog(params) {
|
|
18812
19070
|
if (params?.useCache === false) modelCatalogPromise = null;
|
|
@@ -19166,6 +19424,131 @@ const SessionsHistoryToolSchema = Type.Object({
|
|
|
19166
19424
|
limit: Type.Optional(Type.Number({ minimum: 1 })),
|
|
19167
19425
|
includeTools: Type.Optional(Type.Boolean())
|
|
19168
19426
|
});
|
|
19427
|
+
const SESSIONS_HISTORY_MAX_BYTES = 80 * 1024;
|
|
19428
|
+
const SESSIONS_HISTORY_TEXT_MAX_CHARS = 4e3;
|
|
19429
|
+
function truncateHistoryText(text) {
|
|
19430
|
+
if (text.length <= SESSIONS_HISTORY_TEXT_MAX_CHARS) return {
|
|
19431
|
+
text,
|
|
19432
|
+
truncated: false
|
|
19433
|
+
};
|
|
19434
|
+
return {
|
|
19435
|
+
text: `${truncateUtf16Safe(text, SESSIONS_HISTORY_TEXT_MAX_CHARS)}\n…(truncated)…`,
|
|
19436
|
+
truncated: true
|
|
19437
|
+
};
|
|
19438
|
+
}
|
|
19439
|
+
function sanitizeHistoryContentBlock(block) {
|
|
19440
|
+
if (!block || typeof block !== "object") return {
|
|
19441
|
+
block,
|
|
19442
|
+
truncated: false
|
|
19443
|
+
};
|
|
19444
|
+
const entry = { ...block };
|
|
19445
|
+
let truncated = false;
|
|
19446
|
+
const type = typeof entry.type === "string" ? entry.type : "";
|
|
19447
|
+
if (typeof entry.text === "string") {
|
|
19448
|
+
const res = truncateHistoryText(entry.text);
|
|
19449
|
+
entry.text = res.text;
|
|
19450
|
+
truncated ||= res.truncated;
|
|
19451
|
+
}
|
|
19452
|
+
if (type === "thinking") {
|
|
19453
|
+
if (typeof entry.thinking === "string") {
|
|
19454
|
+
const res = truncateHistoryText(entry.thinking);
|
|
19455
|
+
entry.thinking = res.text;
|
|
19456
|
+
truncated ||= res.truncated;
|
|
19457
|
+
}
|
|
19458
|
+
if ("thinkingSignature" in entry) {
|
|
19459
|
+
delete entry.thinkingSignature;
|
|
19460
|
+
truncated = true;
|
|
19461
|
+
}
|
|
19462
|
+
}
|
|
19463
|
+
if (typeof entry.partialJson === "string") {
|
|
19464
|
+
const res = truncateHistoryText(entry.partialJson);
|
|
19465
|
+
entry.partialJson = res.text;
|
|
19466
|
+
truncated ||= res.truncated;
|
|
19467
|
+
}
|
|
19468
|
+
if (type === "image") {
|
|
19469
|
+
const data = typeof entry.data === "string" ? entry.data : void 0;
|
|
19470
|
+
const bytes = data ? data.length : void 0;
|
|
19471
|
+
if ("data" in entry) {
|
|
19472
|
+
delete entry.data;
|
|
19473
|
+
truncated = true;
|
|
19474
|
+
}
|
|
19475
|
+
entry.omitted = true;
|
|
19476
|
+
if (bytes !== void 0) entry.bytes = bytes;
|
|
19477
|
+
}
|
|
19478
|
+
return {
|
|
19479
|
+
block: entry,
|
|
19480
|
+
truncated
|
|
19481
|
+
};
|
|
19482
|
+
}
|
|
19483
|
+
function sanitizeHistoryMessage(message) {
|
|
19484
|
+
if (!message || typeof message !== "object") return {
|
|
19485
|
+
message,
|
|
19486
|
+
truncated: false
|
|
19487
|
+
};
|
|
19488
|
+
const entry = { ...message };
|
|
19489
|
+
let truncated = false;
|
|
19490
|
+
if ("details" in entry) {
|
|
19491
|
+
delete entry.details;
|
|
19492
|
+
truncated = true;
|
|
19493
|
+
}
|
|
19494
|
+
if ("usage" in entry) {
|
|
19495
|
+
delete entry.usage;
|
|
19496
|
+
truncated = true;
|
|
19497
|
+
}
|
|
19498
|
+
if ("cost" in entry) {
|
|
19499
|
+
delete entry.cost;
|
|
19500
|
+
truncated = true;
|
|
19501
|
+
}
|
|
19502
|
+
if (typeof entry.content === "string") {
|
|
19503
|
+
const res = truncateHistoryText(entry.content);
|
|
19504
|
+
entry.content = res.text;
|
|
19505
|
+
truncated ||= res.truncated;
|
|
19506
|
+
} else if (Array.isArray(entry.content)) {
|
|
19507
|
+
const updated = entry.content.map((block) => sanitizeHistoryContentBlock(block));
|
|
19508
|
+
entry.content = updated.map((item) => item.block);
|
|
19509
|
+
truncated ||= updated.some((item) => item.truncated);
|
|
19510
|
+
}
|
|
19511
|
+
if (typeof entry.text === "string") {
|
|
19512
|
+
const res = truncateHistoryText(entry.text);
|
|
19513
|
+
entry.text = res.text;
|
|
19514
|
+
truncated ||= res.truncated;
|
|
19515
|
+
}
|
|
19516
|
+
return {
|
|
19517
|
+
message: entry,
|
|
19518
|
+
truncated
|
|
19519
|
+
};
|
|
19520
|
+
}
|
|
19521
|
+
function jsonUtf8Bytes(value) {
|
|
19522
|
+
try {
|
|
19523
|
+
return Buffer.byteLength(JSON.stringify(value), "utf8");
|
|
19524
|
+
} catch {
|
|
19525
|
+
return Buffer.byteLength(String(value), "utf8");
|
|
19526
|
+
}
|
|
19527
|
+
}
|
|
19528
|
+
function enforceSessionsHistoryHardCap(params) {
|
|
19529
|
+
if (params.bytes <= params.maxBytes) return {
|
|
19530
|
+
items: params.items,
|
|
19531
|
+
bytes: params.bytes,
|
|
19532
|
+
hardCapped: false
|
|
19533
|
+
};
|
|
19534
|
+
const last = params.items.at(-1);
|
|
19535
|
+
const lastOnly = last ? [last] : [];
|
|
19536
|
+
const lastBytes = jsonUtf8Bytes(lastOnly);
|
|
19537
|
+
if (lastBytes <= params.maxBytes) return {
|
|
19538
|
+
items: lastOnly,
|
|
19539
|
+
bytes: lastBytes,
|
|
19540
|
+
hardCapped: true
|
|
19541
|
+
};
|
|
19542
|
+
const placeholder = [{
|
|
19543
|
+
role: "assistant",
|
|
19544
|
+
content: "[sessions_history omitted: message too large]"
|
|
19545
|
+
}];
|
|
19546
|
+
return {
|
|
19547
|
+
items: placeholder,
|
|
19548
|
+
bytes: jsonUtf8Bytes(placeholder),
|
|
19549
|
+
hardCapped: true
|
|
19550
|
+
};
|
|
19551
|
+
}
|
|
19169
19552
|
function resolveSandboxSessionToolsVisibility$1(cfg) {
|
|
19170
19553
|
return cfg.agents?.defaults?.sandbox?.sessionToolsVisibility ?? "spawned";
|
|
19171
19554
|
}
|
|
@@ -19249,9 +19632,23 @@ function createSessionsHistoryTool(opts) {
|
|
|
19249
19632
|
}
|
|
19250
19633
|
});
|
|
19251
19634
|
const rawMessages = Array.isArray(result?.messages) ? result.messages : [];
|
|
19635
|
+
const selectedMessages = includeTools ? rawMessages : stripToolMessages(rawMessages);
|
|
19636
|
+
const sanitizedMessages = selectedMessages.map((message) => sanitizeHistoryMessage(message));
|
|
19637
|
+
const contentTruncated = sanitizedMessages.some((entry) => entry.truncated);
|
|
19638
|
+
const cappedMessages = capArrayByJsonBytes(sanitizedMessages.map((entry) => entry.message), SESSIONS_HISTORY_MAX_BYTES);
|
|
19639
|
+
const droppedMessages = cappedMessages.items.length < selectedMessages.length;
|
|
19640
|
+
const hardened = enforceSessionsHistoryHardCap({
|
|
19641
|
+
items: cappedMessages.items,
|
|
19642
|
+
bytes: cappedMessages.bytes,
|
|
19643
|
+
maxBytes: SESSIONS_HISTORY_MAX_BYTES
|
|
19644
|
+
});
|
|
19252
19645
|
return jsonResult({
|
|
19253
19646
|
sessionKey: displayKey,
|
|
19254
|
-
messages:
|
|
19647
|
+
messages: hardened.items,
|
|
19648
|
+
truncated: droppedMessages || contentTruncated || hardened.hardCapped,
|
|
19649
|
+
droppedMessages: droppedMessages || hardened.hardCapped,
|
|
19650
|
+
contentTruncated,
|
|
19651
|
+
bytes: hardened.bytes
|
|
19255
19652
|
});
|
|
19256
19653
|
}
|
|
19257
19654
|
};
|
|
@@ -20920,6 +21317,9 @@ function createSessionsSpawnTool(opts) {
|
|
|
20920
21317
|
message: task,
|
|
20921
21318
|
sessionKey: childSessionKey,
|
|
20922
21319
|
channel: requesterOrigin?.channel,
|
|
21320
|
+
to: requesterOrigin?.to ?? void 0,
|
|
21321
|
+
accountId: requesterOrigin?.accountId ?? void 0,
|
|
21322
|
+
threadId: requesterOrigin?.threadId != null ? String(requesterOrigin.threadId) : void 0,
|
|
20923
21323
|
idempotencyKey: childIdem,
|
|
20924
21324
|
deliver: false,
|
|
20925
21325
|
lane: AGENT_LANE_SUBAGENT,
|
|
@@ -22961,7 +23361,7 @@ function createOpenClawCodingTools(options) {
|
|
|
22961
23361
|
cwd: sandboxRoot ?? workspaceRoot,
|
|
22962
23362
|
sandboxRoot: sandboxRoot && allowWorkspaceWrites ? sandboxRoot : void 0
|
|
22963
23363
|
});
|
|
22964
|
-
const
|
|
23364
|
+
const toolsByAuthorization = applyOwnerOnlyToolPolicy([
|
|
22965
23365
|
...base,
|
|
22966
23366
|
...sandboxRoot ? allowWorkspaceWrites ? [createSandboxedEditTool(sandboxRoot), createSandboxedWriteTool(sandboxRoot)] : [] : [],
|
|
22967
23367
|
...applyPatchTool ? [applyPatchTool] : [],
|
|
@@ -23004,10 +23404,10 @@ function createOpenClawCodingTools(options) {
|
|
|
23004
23404
|
disableMessageTool: options?.disableMessageTool,
|
|
23005
23405
|
requesterAgentIdOverride: agentId
|
|
23006
23406
|
})
|
|
23007
|
-
];
|
|
23008
|
-
const coreToolNames = new Set(
|
|
23407
|
+
], options?.senderIsOwner === true);
|
|
23408
|
+
const coreToolNames = new Set(toolsByAuthorization.filter((tool) => !getPluginToolMeta(tool)).map((tool) => normalizeToolName(tool.name)).filter(Boolean));
|
|
23009
23409
|
const pluginGroups = buildPluginToolGroups({
|
|
23010
|
-
tools,
|
|
23410
|
+
tools: toolsByAuthorization,
|
|
23011
23411
|
toolMeta: (tool) => getPluginToolMeta(tool)
|
|
23012
23412
|
});
|
|
23013
23413
|
const resolvePolicy = (policy, label) => {
|
|
@@ -23024,7 +23424,7 @@ function createOpenClawCodingTools(options) {
|
|
|
23024
23424
|
const groupPolicyExpanded = resolvePolicy(groupPolicy, "group tools.allow");
|
|
23025
23425
|
const sandboxPolicyExpanded = expandPolicyWithPluginGroups(sandbox?.tools, pluginGroups);
|
|
23026
23426
|
const subagentPolicyExpanded = expandPolicyWithPluginGroups(subagentPolicy, pluginGroups);
|
|
23027
|
-
const toolsFiltered = profilePolicyExpanded ? filterToolsByPolicy(
|
|
23427
|
+
const toolsFiltered = profilePolicyExpanded ? filterToolsByPolicy(toolsByAuthorization, profilePolicyExpanded) : toolsByAuthorization;
|
|
23028
23428
|
const providerProfileFiltered = providerProfileExpanded ? filterToolsByPolicy(toolsFiltered, providerProfileExpanded) : toolsFiltered;
|
|
23029
23429
|
const globalFiltered = globalPolicyExpanded ? filterToolsByPolicy(providerProfileFiltered, globalPolicyExpanded) : providerProfileFiltered;
|
|
23030
23430
|
const globalProviderFiltered = globalProviderExpanded ? filterToolsByPolicy(globalFiltered, globalProviderExpanded) : globalFiltered;
|
|
@@ -23265,7 +23665,13 @@ function repairToolUseResultPairing(messages) {
|
|
|
23265
23665
|
}
|
|
23266
23666
|
continue;
|
|
23267
23667
|
}
|
|
23268
|
-
const
|
|
23668
|
+
const assistant = msg;
|
|
23669
|
+
const stopReason = assistant.stopReason;
|
|
23670
|
+
if (stopReason === "error" || stopReason === "aborted") {
|
|
23671
|
+
out.push(msg);
|
|
23672
|
+
continue;
|
|
23673
|
+
}
|
|
23674
|
+
const toolCalls = extractToolCallsFromAssistant(assistant);
|
|
23269
23675
|
if (toolCalls.length === 0) {
|
|
23270
23676
|
out.push(msg);
|
|
23271
23677
|
continue;
|
|
@@ -24989,7 +25395,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
24989
25395
|
if (!apiKeyInfo.apiKey) {
|
|
24990
25396
|
if (apiKeyInfo.mode !== "aws-sdk") throw new Error(`No API key resolved for provider "${model.provider}" (auth mode: ${apiKeyInfo.mode}).`);
|
|
24991
25397
|
} else if (model.provider === "github-copilot") {
|
|
24992
|
-
const { resolveCopilotApiToken } = await import("./github-copilot-token-
|
|
25398
|
+
const { resolveCopilotApiToken } = await import("./github-copilot-token-SLWintYd.js").then((n) => n.n);
|
|
24993
25399
|
const copilotToken = await resolveCopilotApiToken({ githubToken: apiKeyInfo.apiKey });
|
|
24994
25400
|
authStorage.setRuntimeApiKey(model.provider, copilotToken.token);
|
|
24995
25401
|
} else authStorage.setRuntimeApiKey(model.provider, apiKeyInfo.apiKey);
|
|
@@ -25058,6 +25464,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
25058
25464
|
groupChannel: params.groupChannel,
|
|
25059
25465
|
groupSpace: params.groupSpace,
|
|
25060
25466
|
spawnedBy: params.spawnedBy,
|
|
25467
|
+
senderIsOwner: params.senderIsOwner,
|
|
25061
25468
|
agentDir,
|
|
25062
25469
|
workspaceDir: effectiveWorkspace,
|
|
25063
25470
|
config: params.config,
|
|
@@ -26315,6 +26722,7 @@ function handleMessageUpdate(ctx, evt) {
|
|
|
26315
26722
|
mediaUrls: hasMedia ? mediaUrls : void 0
|
|
26316
26723
|
}
|
|
26317
26724
|
});
|
|
26725
|
+
ctx.state.emittedAssistantUpdate = true;
|
|
26318
26726
|
if (ctx.params.onPartialReply && ctx.state.shouldEmitPartialReplies) ctx.params.onPartialReply({
|
|
26319
26727
|
text: cleanedText,
|
|
26320
26728
|
mediaUrls: hasMedia ? mediaUrls : void 0
|
|
@@ -26358,6 +26766,41 @@ function handleMessageEnd(ctx, evt) {
|
|
|
26358
26766
|
});
|
|
26359
26767
|
const rawThinking = ctx.state.includeReasoning || ctx.state.streamReasoning ? extractAssistantThinking(assistantMessage) || extractThinkingFromTaggedText(rawText) : "";
|
|
26360
26768
|
const formattedReasoning = rawThinking ? formatReasoningMessage(rawThinking) : "";
|
|
26769
|
+
const trimmedText = text.trim();
|
|
26770
|
+
const parsedText = trimmedText ? parseReplyDirectives(stripTrailingDirective(trimmedText)) : null;
|
|
26771
|
+
let cleanedText = parsedText?.text ?? "";
|
|
26772
|
+
let mediaUrls = parsedText?.mediaUrls;
|
|
26773
|
+
let hasMedia = Boolean(mediaUrls && mediaUrls.length > 0);
|
|
26774
|
+
if (!cleanedText && !hasMedia) {
|
|
26775
|
+
const rawTrimmed = rawText.trim();
|
|
26776
|
+
const rawCandidate = rawTrimmed.replace(/<\s*\/?\s*final\s*>/gi, "").trim() || rawTrimmed;
|
|
26777
|
+
if (rawCandidate) {
|
|
26778
|
+
const parsedFallback = parseReplyDirectives(stripTrailingDirective(rawCandidate));
|
|
26779
|
+
cleanedText = parsedFallback.text ?? rawCandidate;
|
|
26780
|
+
mediaUrls = parsedFallback.mediaUrls;
|
|
26781
|
+
hasMedia = Boolean(mediaUrls && mediaUrls.length > 0);
|
|
26782
|
+
}
|
|
26783
|
+
}
|
|
26784
|
+
if (!ctx.state.emittedAssistantUpdate && (cleanedText || hasMedia)) {
|
|
26785
|
+
emitAgentEvent({
|
|
26786
|
+
runId: ctx.params.runId,
|
|
26787
|
+
stream: "assistant",
|
|
26788
|
+
data: {
|
|
26789
|
+
text: cleanedText,
|
|
26790
|
+
delta: cleanedText,
|
|
26791
|
+
mediaUrls: hasMedia ? mediaUrls : void 0
|
|
26792
|
+
}
|
|
26793
|
+
});
|
|
26794
|
+
ctx.params.onAgentEvent?.({
|
|
26795
|
+
stream: "assistant",
|
|
26796
|
+
data: {
|
|
26797
|
+
text: cleanedText,
|
|
26798
|
+
delta: cleanedText,
|
|
26799
|
+
mediaUrls: hasMedia ? mediaUrls : void 0
|
|
26800
|
+
}
|
|
26801
|
+
});
|
|
26802
|
+
ctx.state.emittedAssistantUpdate = true;
|
|
26803
|
+
}
|
|
26361
26804
|
const addedDuringMessage = ctx.state.assistantTexts.length > ctx.state.assistantTextBaseline;
|
|
26362
26805
|
const chunkerHasBuffered = ctx.blockChunker?.hasBuffered() ?? false;
|
|
26363
26806
|
ctx.finalizeAssistantTexts({
|
|
@@ -26810,6 +27253,7 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
26810
27253
|
},
|
|
26811
27254
|
lastStreamedAssistant: void 0,
|
|
26812
27255
|
lastStreamedAssistantCleaned: void 0,
|
|
27256
|
+
emittedAssistantUpdate: false,
|
|
26813
27257
|
lastStreamedReasoning: void 0,
|
|
26814
27258
|
lastBlockReplyText: void 0,
|
|
26815
27259
|
assistantMessageIndex: 0,
|
|
@@ -26854,6 +27298,7 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
26854
27298
|
state.partialBlockState.inlineCode = createInlineCodeState();
|
|
26855
27299
|
state.lastStreamedAssistant = void 0;
|
|
26856
27300
|
state.lastStreamedAssistantCleaned = void 0;
|
|
27301
|
+
state.emittedAssistantUpdate = false;
|
|
26857
27302
|
state.lastBlockReplyText = void 0;
|
|
26858
27303
|
state.lastStreamedReasoning = void 0;
|
|
26859
27304
|
state.lastReasoningSent = void 0;
|
|
@@ -27799,6 +28244,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
27799
28244
|
senderName: params.senderName,
|
|
27800
28245
|
senderUsername: params.senderUsername,
|
|
27801
28246
|
senderE164: params.senderE164,
|
|
28247
|
+
senderIsOwner: params.senderIsOwner,
|
|
27802
28248
|
sessionKey: params.sessionKey ?? params.sessionId,
|
|
27803
28249
|
agentDir,
|
|
27804
28250
|
workspaceDir: effectiveWorkspace,
|
|
@@ -28506,7 +28952,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
28506
28952
|
return;
|
|
28507
28953
|
}
|
|
28508
28954
|
if (model.provider === "github-copilot") {
|
|
28509
|
-
const { resolveCopilotApiToken } = await import("./github-copilot-token-
|
|
28955
|
+
const { resolveCopilotApiToken } = await import("./github-copilot-token-SLWintYd.js").then((n) => n.n);
|
|
28510
28956
|
const copilotToken = await resolveCopilotApiToken({ githubToken: apiKeyInfo.apiKey });
|
|
28511
28957
|
authStorage.setRuntimeApiKey(model.provider, copilotToken.token);
|
|
28512
28958
|
} else authStorage.setRuntimeApiKey(model.provider, apiKeyInfo.apiKey);
|
|
@@ -28556,7 +29002,8 @@ async function runEmbeddedPiAgent(params) {
|
|
|
28556
29002
|
error: err
|
|
28557
29003
|
});
|
|
28558
29004
|
}
|
|
28559
|
-
|
|
29005
|
+
const MAX_OVERFLOW_COMPACTION_ATTEMPTS = 3;
|
|
29006
|
+
let overflowCompactionAttempts = 0;
|
|
28560
29007
|
try {
|
|
28561
29008
|
while (true) {
|
|
28562
29009
|
attemptedThinking.add(thinkLevel);
|
|
@@ -28574,6 +29021,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
28574
29021
|
groupChannel: params.groupChannel,
|
|
28575
29022
|
groupSpace: params.groupSpace,
|
|
28576
29023
|
spawnedBy: params.spawnedBy,
|
|
29024
|
+
senderIsOwner: params.senderIsOwner,
|
|
28577
29025
|
currentChannelId: params.currentChannelId,
|
|
28578
29026
|
currentThreadTs: params.currentThreadTs,
|
|
28579
29027
|
replyToMode: params.replyToMode,
|
|
@@ -28620,10 +29068,12 @@ async function runEmbeddedPiAgent(params) {
|
|
|
28620
29068
|
if (promptError && !aborted) {
|
|
28621
29069
|
const errorText = describeUnknownError(promptError);
|
|
28622
29070
|
if (isContextOverflowError(errorText)) {
|
|
29071
|
+
const msgCount = attempt.messagesSnapshot?.length ?? 0;
|
|
29072
|
+
log$6.warn(`[context-overflow-diag] sessionKey=${params.sessionKey ?? params.sessionId} provider=${provider}/${modelId} messages=${msgCount} sessionFile=${params.sessionFile} compactionAttempts=${overflowCompactionAttempts} error=${errorText.slice(0, 200)}`);
|
|
28623
29073
|
const isCompactionFailure = isCompactionFailureError(errorText);
|
|
28624
|
-
if (!isCompactionFailure &&
|
|
28625
|
-
|
|
28626
|
-
|
|
29074
|
+
if (!isCompactionFailure && overflowCompactionAttempts < MAX_OVERFLOW_COMPACTION_ATTEMPTS) {
|
|
29075
|
+
overflowCompactionAttempts++;
|
|
29076
|
+
log$6.warn(`context overflow detected (attempt ${overflowCompactionAttempts}/${MAX_OVERFLOW_COMPACTION_ATTEMPTS}); attempting auto-compaction for ${provider}/${modelId}`);
|
|
28627
29077
|
const compactResult = await compactEmbeddedPiSessionDirect({
|
|
28628
29078
|
sessionId: params.sessionId,
|
|
28629
29079
|
sessionKey: params.sessionKey,
|
|
@@ -28636,6 +29086,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
28636
29086
|
agentDir,
|
|
28637
29087
|
config: params.config,
|
|
28638
29088
|
skillsSnapshot: params.skillsSnapshot,
|
|
29089
|
+
senderIsOwner: params.senderIsOwner,
|
|
28639
29090
|
provider,
|
|
28640
29091
|
model: modelId,
|
|
28641
29092
|
thinkLevel,
|
|
@@ -28752,6 +29203,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
28752
29203
|
}
|
|
28753
29204
|
const authFailure = isAuthAssistantError(lastAssistant);
|
|
28754
29205
|
const rateLimitFailure = isRateLimitAssistantError(lastAssistant);
|
|
29206
|
+
const billingFailure = isBillingAssistantError(lastAssistant);
|
|
28755
29207
|
const failoverFailure = isFailoverAssistantError(lastAssistant);
|
|
28756
29208
|
const assistantFailoverReason = classifyFailoverReason(lastAssistant?.errorMessage ?? "");
|
|
28757
29209
|
const cloudCodeAssistFormatError = attempt.cloudCodeAssistFormatError;
|
|
@@ -28781,7 +29233,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
28781
29233
|
const message = (lastAssistant ? formatAssistantErrorText(lastAssistant, {
|
|
28782
29234
|
cfg: params.config,
|
|
28783
29235
|
sessionKey: params.sessionKey ?? params.sessionId
|
|
28784
|
-
}) : void 0) || lastAssistant?.errorMessage?.trim() || (timedOut ? "LLM request timed out." : rateLimitFailure ? "LLM request rate limited." : authFailure ? "LLM request unauthorized." : "LLM request failed.");
|
|
29236
|
+
}) : void 0) || lastAssistant?.errorMessage?.trim() || (timedOut ? "LLM request timed out." : rateLimitFailure ? "LLM request rate limited." : billingFailure ? BILLING_ERROR_USER_MESSAGE : authFailure ? "LLM request unauthorized." : "LLM request failed.");
|
|
28785
29237
|
const status = resolveFailoverStatus(assistantFailoverReason ?? "unknown") ?? (isTimeoutErrorMessage(message) ? 408 : void 0);
|
|
28786
29238
|
throw new FailoverError(message, {
|
|
28787
29239
|
reason: assistantFailoverReason ?? "unknown",
|
|
@@ -28889,6 +29341,32 @@ function normalizeAllowFromEntry(params) {
|
|
|
28889
29341
|
allowFrom: [params.value]
|
|
28890
29342
|
}).filter((entry) => entry.trim().length > 0);
|
|
28891
29343
|
}
|
|
29344
|
+
function resolveOwnerAllowFromList(params) {
|
|
29345
|
+
const raw = params.allowFrom ?? params.cfg.commands?.ownerAllowFrom;
|
|
29346
|
+
if (!Array.isArray(raw) || raw.length === 0) return [];
|
|
29347
|
+
const filtered = [];
|
|
29348
|
+
for (const entry of raw) {
|
|
29349
|
+
const trimmed = String(entry ?? "").trim();
|
|
29350
|
+
if (!trimmed) continue;
|
|
29351
|
+
const separatorIndex = trimmed.indexOf(":");
|
|
29352
|
+
if (separatorIndex > 0) {
|
|
29353
|
+
const channel = normalizeAnyChannelId(trimmed.slice(0, separatorIndex));
|
|
29354
|
+
if (channel) {
|
|
29355
|
+
if (params.providerId && channel !== params.providerId) continue;
|
|
29356
|
+
const remainder = trimmed.slice(separatorIndex + 1).trim();
|
|
29357
|
+
if (remainder) filtered.push(remainder);
|
|
29358
|
+
continue;
|
|
29359
|
+
}
|
|
29360
|
+
}
|
|
29361
|
+
filtered.push(trimmed);
|
|
29362
|
+
}
|
|
29363
|
+
return formatAllowFromList({
|
|
29364
|
+
dock: params.dock,
|
|
29365
|
+
cfg: params.cfg,
|
|
29366
|
+
accountId: params.accountId,
|
|
29367
|
+
allowFrom: filtered
|
|
29368
|
+
});
|
|
29369
|
+
}
|
|
28892
29370
|
function resolveSenderCandidates(params) {
|
|
28893
29371
|
const { dock, cfg, accountId } = params;
|
|
28894
29372
|
const candidates = [];
|
|
@@ -28933,18 +29411,35 @@ function resolveCommandAuthorization(params) {
|
|
|
28933
29411
|
accountId: ctx.AccountId,
|
|
28934
29412
|
allowFrom: Array.isArray(allowFromRaw) ? allowFromRaw : []
|
|
28935
29413
|
});
|
|
29414
|
+
const configOwnerAllowFromList = resolveOwnerAllowFromList({
|
|
29415
|
+
dock,
|
|
29416
|
+
cfg,
|
|
29417
|
+
accountId: ctx.AccountId,
|
|
29418
|
+
providerId,
|
|
29419
|
+
allowFrom: cfg.commands?.ownerAllowFrom
|
|
29420
|
+
});
|
|
29421
|
+
const contextOwnerAllowFromList = resolveOwnerAllowFromList({
|
|
29422
|
+
dock,
|
|
29423
|
+
cfg,
|
|
29424
|
+
accountId: ctx.AccountId,
|
|
29425
|
+
providerId,
|
|
29426
|
+
allowFrom: ctx.OwnerAllowFrom
|
|
29427
|
+
});
|
|
28936
29428
|
const allowAll = allowFromList.length === 0 || allowFromList.some((entry) => entry.trim() === "*");
|
|
28937
|
-
const
|
|
28938
|
-
if (!allowAll &&
|
|
29429
|
+
const ownerCandidatesForCommands = allowAll ? [] : allowFromList.filter((entry) => entry !== "*");
|
|
29430
|
+
if (!allowAll && ownerCandidatesForCommands.length === 0 && to) {
|
|
28939
29431
|
const normalizedTo = normalizeAllowFromEntry({
|
|
28940
29432
|
dock,
|
|
28941
29433
|
cfg,
|
|
28942
29434
|
accountId: ctx.AccountId,
|
|
28943
29435
|
value: to
|
|
28944
29436
|
});
|
|
28945
|
-
if (normalizedTo.length > 0)
|
|
29437
|
+
if (normalizedTo.length > 0) ownerCandidatesForCommands.push(...normalizedTo);
|
|
28946
29438
|
}
|
|
28947
|
-
const
|
|
29439
|
+
const ownerAllowAll = configOwnerAllowFromList.some((entry) => entry.trim() === "*");
|
|
29440
|
+
const explicitOwners = configOwnerAllowFromList.filter((entry) => entry !== "*");
|
|
29441
|
+
const explicitOverrides = contextOwnerAllowFromList.filter((entry) => entry !== "*");
|
|
29442
|
+
const ownerList = Array.from(new Set(explicitOwners.length > 0 ? explicitOwners : ownerAllowAll ? [] : explicitOverrides.length > 0 ? explicitOverrides : ownerCandidatesForCommands));
|
|
28948
29443
|
const senderCandidates = resolveSenderCandidates({
|
|
28949
29444
|
dock,
|
|
28950
29445
|
providerId,
|
|
@@ -28955,13 +29450,18 @@ function resolveCommandAuthorization(params) {
|
|
|
28955
29450
|
from
|
|
28956
29451
|
});
|
|
28957
29452
|
const matchedSender = ownerList.length ? senderCandidates.find((candidate) => ownerList.includes(candidate)) : void 0;
|
|
29453
|
+
const matchedCommandOwner = ownerCandidatesForCommands.length ? senderCandidates.find((candidate) => ownerCandidatesForCommands.includes(candidate)) : void 0;
|
|
28958
29454
|
const senderId = matchedSender ?? senderCandidates[0];
|
|
28959
|
-
const
|
|
29455
|
+
const enforceOwner = Boolean(dock?.commands?.enforceOwnerForCommands);
|
|
29456
|
+
const senderIsOwner = Boolean(matchedSender);
|
|
29457
|
+
const ownerAllowlistConfigured = ownerAllowAll || explicitOwners.length > 0;
|
|
29458
|
+
const isOwnerForCommands = !(enforceOwner || ownerAllowlistConfigured) ? true : ownerAllowAll ? true : ownerAllowlistConfigured ? senderIsOwner : allowAll || ownerCandidatesForCommands.length === 0 || Boolean(matchedCommandOwner);
|
|
28960
29459
|
return {
|
|
28961
29460
|
providerId,
|
|
28962
29461
|
ownerList,
|
|
28963
29462
|
senderId: senderId || void 0,
|
|
28964
|
-
|
|
29463
|
+
senderIsOwner,
|
|
29464
|
+
isAuthorizedSender: commandAuthorized && isOwnerForCommands,
|
|
28965
29465
|
from: from || void 0,
|
|
28966
29466
|
to: to || void 0
|
|
28967
29467
|
};
|
|
@@ -31097,7 +31597,7 @@ const AUTO_IMAGE_KEY_PROVIDERS = [
|
|
|
31097
31597
|
const AUTO_VIDEO_KEY_PROVIDERS = ["google"];
|
|
31098
31598
|
const DEFAULT_IMAGE_MODELS = {
|
|
31099
31599
|
openai: "gpt-5-mini",
|
|
31100
|
-
anthropic: "claude-opus-4-
|
|
31600
|
+
anthropic: "claude-opus-4-6",
|
|
31101
31601
|
google: "gemini-3-flash-preview",
|
|
31102
31602
|
minimax: "MiniMax-VL-01"
|
|
31103
31603
|
};
|
|
@@ -33190,7 +33690,7 @@ async function createModelSelectionState(params) {
|
|
|
33190
33690
|
}
|
|
33191
33691
|
}
|
|
33192
33692
|
if (sessionEntry && sessionStore && sessionKey && sessionEntry.authProfileOverride) {
|
|
33193
|
-
const { ensureAuthProfileStore } = await import("./auth-profiles-
|
|
33693
|
+
const { ensureAuthProfileStore } = await import("./auth-profiles-CYBuGiBb.js").then((n) => n.t);
|
|
33194
33694
|
const profile = ensureAuthProfileStore(void 0, { allowKeychainPrompt: false }).profiles[sessionEntry.authProfileOverride];
|
|
33195
33695
|
const providerKey = normalizeProviderId(provider);
|
|
33196
33696
|
if (!profile || normalizeProviderId(profile.provider) !== providerKey) await clearSessionAuthProfileOverride({
|
|
@@ -34847,6 +35347,7 @@ function buildCommandContext(params) {
|
|
|
34847
35347
|
channel,
|
|
34848
35348
|
channelId: auth.providerId,
|
|
34849
35349
|
ownerList: auth.ownerList,
|
|
35350
|
+
senderIsOwner: auth.senderIsOwner,
|
|
34850
35351
|
isAuthorizedSender: auth.isAuthorizedSender,
|
|
34851
35352
|
senderId: auth.senderId,
|
|
34852
35353
|
abortKey,
|
|
@@ -36300,6 +36801,7 @@ const handleCompactCommand = async (params) => {
|
|
|
36300
36801
|
defaultLevel: "off"
|
|
36301
36802
|
},
|
|
36302
36803
|
customInstructions,
|
|
36804
|
+
senderIsOwner: params.command.senderIsOwner,
|
|
36303
36805
|
ownerNumbers: params.command.ownerList.length > 0 ? params.command.ownerList : void 0
|
|
36304
36806
|
});
|
|
36305
36807
|
const compactLabel = result.ok ? result.compacted ? result.result?.tokensBefore != null && result.result?.tokensAfter != null ? `Compacted (${formatTokenCount$1(result.result.tokensBefore)} → ${formatTokenCount$1(result.result.tokensAfter)})` : result.result?.tokensBefore ? `Compacted (${formatTokenCount$1(result.result.tokensBefore)} before)` : "Compacted" : "Compaction skipped" : "Compaction failed";
|
|
@@ -36704,6 +37206,7 @@ async function resolveContextReport(params) {
|
|
|
36704
37206
|
groupChannel: params.sessionEntry?.groupChannel ?? void 0,
|
|
36705
37207
|
groupSpace: params.sessionEntry?.space ?? void 0,
|
|
36706
37208
|
spawnedBy: params.sessionEntry?.spawnedBy ?? void 0,
|
|
37209
|
+
senderIsOwner: params.command.senderIsOwner,
|
|
36707
37210
|
modelProvider: params.provider,
|
|
36708
37211
|
modelId: params.model
|
|
36709
37212
|
});
|
|
@@ -37246,165 +37749,6 @@ const handlePluginCommand = async (params, allowTextCommands) => {
|
|
|
37246
37749
|
};
|
|
37247
37750
|
};
|
|
37248
37751
|
|
|
37249
|
-
//#endregion
|
|
37250
|
-
//#region src/infra/session-cost-usage.ts
|
|
37251
|
-
const emptyTotals = () => ({
|
|
37252
|
-
input: 0,
|
|
37253
|
-
output: 0,
|
|
37254
|
-
cacheRead: 0,
|
|
37255
|
-
cacheWrite: 0,
|
|
37256
|
-
totalTokens: 0,
|
|
37257
|
-
totalCost: 0,
|
|
37258
|
-
missingCostEntries: 0
|
|
37259
|
-
});
|
|
37260
|
-
const toFiniteNumber = (value) => {
|
|
37261
|
-
if (typeof value !== "number") return;
|
|
37262
|
-
if (!Number.isFinite(value)) return;
|
|
37263
|
-
return value;
|
|
37264
|
-
};
|
|
37265
|
-
const extractCostTotal = (usageRaw) => {
|
|
37266
|
-
if (!usageRaw || typeof usageRaw !== "object") return;
|
|
37267
|
-
const cost = usageRaw.cost;
|
|
37268
|
-
const total = toFiniteNumber(cost?.total);
|
|
37269
|
-
if (total === void 0) return;
|
|
37270
|
-
if (total < 0) return;
|
|
37271
|
-
return total;
|
|
37272
|
-
};
|
|
37273
|
-
const parseTimestamp = (entry) => {
|
|
37274
|
-
const raw = entry.timestamp;
|
|
37275
|
-
if (typeof raw === "string") {
|
|
37276
|
-
const parsed = new Date(raw);
|
|
37277
|
-
if (!Number.isNaN(parsed.valueOf())) return parsed;
|
|
37278
|
-
}
|
|
37279
|
-
const message = entry.message;
|
|
37280
|
-
const messageTimestamp = toFiniteNumber(message?.timestamp);
|
|
37281
|
-
if (messageTimestamp !== void 0) {
|
|
37282
|
-
const parsed = new Date(messageTimestamp);
|
|
37283
|
-
if (!Number.isNaN(parsed.valueOf())) return parsed;
|
|
37284
|
-
}
|
|
37285
|
-
};
|
|
37286
|
-
const parseUsageEntry = (entry) => {
|
|
37287
|
-
const message = entry.message;
|
|
37288
|
-
if (message?.role !== "assistant") return null;
|
|
37289
|
-
const usageRaw = message?.usage ?? entry.usage;
|
|
37290
|
-
const usage = normalizeUsage(usageRaw);
|
|
37291
|
-
if (!usage) return null;
|
|
37292
|
-
const provider = (typeof message?.provider === "string" ? message?.provider : void 0) ?? (typeof entry.provider === "string" ? entry.provider : void 0);
|
|
37293
|
-
const model = (typeof message?.model === "string" ? message?.model : void 0) ?? (typeof entry.model === "string" ? entry.model : void 0);
|
|
37294
|
-
return {
|
|
37295
|
-
usage,
|
|
37296
|
-
costTotal: extractCostTotal(usageRaw),
|
|
37297
|
-
provider,
|
|
37298
|
-
model,
|
|
37299
|
-
timestamp: parseTimestamp(entry)
|
|
37300
|
-
};
|
|
37301
|
-
};
|
|
37302
|
-
const formatDayKey = (date) => date.toLocaleDateString("en-CA", { timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone });
|
|
37303
|
-
const applyUsageTotals = (totals, usage) => {
|
|
37304
|
-
totals.input += usage.input ?? 0;
|
|
37305
|
-
totals.output += usage.output ?? 0;
|
|
37306
|
-
totals.cacheRead += usage.cacheRead ?? 0;
|
|
37307
|
-
totals.cacheWrite += usage.cacheWrite ?? 0;
|
|
37308
|
-
const totalTokens = usage.total ?? (usage.input ?? 0) + (usage.output ?? 0) + (usage.cacheRead ?? 0) + (usage.cacheWrite ?? 0);
|
|
37309
|
-
totals.totalTokens += totalTokens;
|
|
37310
|
-
};
|
|
37311
|
-
const applyCostTotal = (totals, costTotal) => {
|
|
37312
|
-
if (costTotal === void 0) {
|
|
37313
|
-
totals.missingCostEntries += 1;
|
|
37314
|
-
return;
|
|
37315
|
-
}
|
|
37316
|
-
totals.totalCost += costTotal;
|
|
37317
|
-
};
|
|
37318
|
-
async function scanUsageFile(params) {
|
|
37319
|
-
const fileStream = fs.createReadStream(params.filePath, { encoding: "utf-8" });
|
|
37320
|
-
const rl = readline.createInterface({
|
|
37321
|
-
input: fileStream,
|
|
37322
|
-
crlfDelay: Infinity
|
|
37323
|
-
});
|
|
37324
|
-
for await (const line of rl) {
|
|
37325
|
-
const trimmed = line.trim();
|
|
37326
|
-
if (!trimmed) continue;
|
|
37327
|
-
try {
|
|
37328
|
-
const entry = parseUsageEntry(JSON.parse(trimmed));
|
|
37329
|
-
if (!entry) continue;
|
|
37330
|
-
if (entry.costTotal === void 0) {
|
|
37331
|
-
const cost = resolveModelCostConfig({
|
|
37332
|
-
provider: entry.provider,
|
|
37333
|
-
model: entry.model,
|
|
37334
|
-
config: params.config
|
|
37335
|
-
});
|
|
37336
|
-
entry.costTotal = estimateUsageCost({
|
|
37337
|
-
usage: entry.usage,
|
|
37338
|
-
cost
|
|
37339
|
-
});
|
|
37340
|
-
}
|
|
37341
|
-
params.onEntry(entry);
|
|
37342
|
-
} catch {}
|
|
37343
|
-
}
|
|
37344
|
-
}
|
|
37345
|
-
async function loadCostUsageSummary(params) {
|
|
37346
|
-
const days = Math.max(1, Math.floor(params?.days ?? 30));
|
|
37347
|
-
const now = /* @__PURE__ */ new Date();
|
|
37348
|
-
const since = new Date(now);
|
|
37349
|
-
since.setDate(since.getDate() - (days - 1));
|
|
37350
|
-
const sinceTime = since.getTime();
|
|
37351
|
-
const dailyMap = /* @__PURE__ */ new Map();
|
|
37352
|
-
const totals = emptyTotals();
|
|
37353
|
-
const sessionsDir = resolveSessionTranscriptsDirForAgent(params?.agentId);
|
|
37354
|
-
const entries = await fs.promises.readdir(sessionsDir, { withFileTypes: true }).catch(() => []);
|
|
37355
|
-
const files = (await Promise.all(entries.filter((entry) => entry.isFile() && entry.name.endsWith(".jsonl")).map(async (entry) => {
|
|
37356
|
-
const filePath = path.join(sessionsDir, entry.name);
|
|
37357
|
-
const stats = await fs.promises.stat(filePath).catch(() => null);
|
|
37358
|
-
if (!stats) return null;
|
|
37359
|
-
if (stats.mtimeMs < sinceTime) return null;
|
|
37360
|
-
return filePath;
|
|
37361
|
-
}))).filter((filePath) => Boolean(filePath));
|
|
37362
|
-
for (const filePath of files) await scanUsageFile({
|
|
37363
|
-
filePath,
|
|
37364
|
-
config: params?.config,
|
|
37365
|
-
onEntry: (entry) => {
|
|
37366
|
-
const ts = entry.timestamp?.getTime();
|
|
37367
|
-
if (!ts || ts < sinceTime) return;
|
|
37368
|
-
const dayKey = formatDayKey(entry.timestamp ?? now);
|
|
37369
|
-
const bucket = dailyMap.get(dayKey) ?? emptyTotals();
|
|
37370
|
-
applyUsageTotals(bucket, entry.usage);
|
|
37371
|
-
applyCostTotal(bucket, entry.costTotal);
|
|
37372
|
-
dailyMap.set(dayKey, bucket);
|
|
37373
|
-
applyUsageTotals(totals, entry.usage);
|
|
37374
|
-
applyCostTotal(totals, entry.costTotal);
|
|
37375
|
-
}
|
|
37376
|
-
});
|
|
37377
|
-
const daily = Array.from(dailyMap.entries()).map(([date, bucket]) => Object.assign({ date }, bucket)).toSorted((a, b) => a.date.localeCompare(b.date));
|
|
37378
|
-
return {
|
|
37379
|
-
updatedAt: Date.now(),
|
|
37380
|
-
days,
|
|
37381
|
-
daily,
|
|
37382
|
-
totals
|
|
37383
|
-
};
|
|
37384
|
-
}
|
|
37385
|
-
async function loadSessionCostSummary(params) {
|
|
37386
|
-
const sessionFile = params.sessionFile ?? (params.sessionId ? resolveSessionFilePath(params.sessionId, params.sessionEntry) : void 0);
|
|
37387
|
-
if (!sessionFile || !fs.existsSync(sessionFile)) return null;
|
|
37388
|
-
const totals = emptyTotals();
|
|
37389
|
-
let lastActivity;
|
|
37390
|
-
await scanUsageFile({
|
|
37391
|
-
filePath: sessionFile,
|
|
37392
|
-
config: params.config,
|
|
37393
|
-
onEntry: (entry) => {
|
|
37394
|
-
applyUsageTotals(totals, entry.usage);
|
|
37395
|
-
applyCostTotal(totals, entry.costTotal);
|
|
37396
|
-
const ts = entry.timestamp?.getTime();
|
|
37397
|
-
if (ts && (!lastActivity || ts > lastActivity)) lastActivity = ts;
|
|
37398
|
-
}
|
|
37399
|
-
});
|
|
37400
|
-
return {
|
|
37401
|
-
sessionId: params.sessionId,
|
|
37402
|
-
sessionFile,
|
|
37403
|
-
lastActivity,
|
|
37404
|
-
...totals
|
|
37405
|
-
};
|
|
37406
|
-
}
|
|
37407
|
-
|
|
37408
37752
|
//#endregion
|
|
37409
37753
|
//#region src/auto-reply/send-policy.ts
|
|
37410
37754
|
function normalizeSendPolicyOverride(raw) {
|
|
@@ -39335,8 +39679,10 @@ const DEFAULT_CLAUDE_BACKEND = {
|
|
|
39335
39679
|
modelArg: "--model",
|
|
39336
39680
|
modelAliases: {
|
|
39337
39681
|
opus: "opus",
|
|
39682
|
+
"opus-4.6": "opus",
|
|
39338
39683
|
"opus-4.5": "opus",
|
|
39339
39684
|
"opus-4": "opus",
|
|
39685
|
+
"claude-opus-4-6": "opus",
|
|
39340
39686
|
"claude-opus-4-5": "opus",
|
|
39341
39687
|
"claude-opus-4": "opus",
|
|
39342
39688
|
sonnet: "sonnet",
|
|
@@ -41829,6 +42175,7 @@ async function runPreparedReply(params) {
|
|
|
41829
42175
|
senderName: sessionCtx.SenderName?.trim() || void 0,
|
|
41830
42176
|
senderUsername: sessionCtx.SenderUsername?.trim() || void 0,
|
|
41831
42177
|
senderE164: sessionCtx.SenderE164?.trim() || void 0,
|
|
42178
|
+
senderIsOwner: command.senderIsOwner,
|
|
41832
42179
|
sessionFile,
|
|
41833
42180
|
workspaceDir,
|
|
41834
42181
|
config: cfg,
|
|
@@ -42201,11 +42548,13 @@ async function initSessionState(params) {
|
|
|
42201
42548
|
if (threadLabel) sessionEntry.displayName = threadLabel;
|
|
42202
42549
|
const parentSessionKey = ctx.ParentSessionKey?.trim();
|
|
42203
42550
|
if (isNewSession && parentSessionKey && parentSessionKey !== sessionKey && sessionStore[parentSessionKey]) {
|
|
42551
|
+
console.warn(`[session-init] forking from parent session: parentKey=${parentSessionKey} → sessionKey=${sessionKey} parentTokens=${sessionStore[parentSessionKey].totalTokens ?? "?"}`);
|
|
42204
42552
|
const forked = forkSessionFromParent({ parentEntry: sessionStore[parentSessionKey] });
|
|
42205
42553
|
if (forked) {
|
|
42206
42554
|
sessionId = forked.sessionId;
|
|
42207
42555
|
sessionEntry.sessionId = forked.sessionId;
|
|
42208
42556
|
sessionEntry.sessionFile = forked.sessionFile;
|
|
42557
|
+
console.warn(`[session-init] forked session created: file=${forked.sessionFile}`);
|
|
42209
42558
|
}
|
|
42210
42559
|
}
|
|
42211
42560
|
if (!sessionEntry.sessionFile) sessionEntry.sessionFile = resolveSessionTranscriptPath(sessionEntry.sessionId, agentId, ctx.MessageThreadId);
|
|
@@ -42213,6 +42562,10 @@ async function initSessionState(params) {
|
|
|
42213
42562
|
sessionEntry.compactionCount = 0;
|
|
42214
42563
|
sessionEntry.memoryFlushCompactionCount = void 0;
|
|
42215
42564
|
sessionEntry.memoryFlushAt = void 0;
|
|
42565
|
+
sessionEntry.totalTokens = void 0;
|
|
42566
|
+
sessionEntry.inputTokens = void 0;
|
|
42567
|
+
sessionEntry.outputTokens = void 0;
|
|
42568
|
+
sessionEntry.contextTokens = void 0;
|
|
42216
42569
|
}
|
|
42217
42570
|
sessionStore[sessionKey] = {
|
|
42218
42571
|
...sessionStore[sessionKey],
|
|
@@ -42960,9 +43313,10 @@ async function dispatchReplyFromConfig(params) {
|
|
|
42960
43313
|
}
|
|
42961
43314
|
let accumulatedBlockText = "";
|
|
42962
43315
|
let blockCount = 0;
|
|
43316
|
+
const shouldSendToolSummaries = ctx.ChatType !== "group" && ctx.CommandSource !== "native";
|
|
42963
43317
|
const replyResult = await (params.replyResolver ?? getReplyFromConfig)(ctx, {
|
|
42964
43318
|
...params.replyOptions,
|
|
42965
|
-
onToolResult:
|
|
43319
|
+
onToolResult: shouldSendToolSummaries ? (payload) => {
|
|
42966
43320
|
const run = async () => {
|
|
42967
43321
|
const ttsPayload = await maybeApplyTtsToPayload({
|
|
42968
43322
|
payload,
|
|
@@ -46766,7 +47120,7 @@ async function describeStickerImage(params) {
|
|
|
46766
47120
|
const selectCatalogModel = (provider) => {
|
|
46767
47121
|
const entries = catalog.filter((entry) => entry.provider.toLowerCase() === provider.toLowerCase() && modelSupportsVision(entry));
|
|
46768
47122
|
if (entries.length === 0) return;
|
|
46769
|
-
const defaultId = provider === "openai" ? "gpt-5-mini" : provider === "anthropic" ? "claude-opus-4-
|
|
47123
|
+
const defaultId = provider === "openai" ? "gpt-5-mini" : provider === "anthropic" ? "claude-opus-4-6" : provider === "google" ? "gemini-3-flash-preview" : "MiniMax-VL-01";
|
|
46770
47124
|
return entries.find((entry) => entry.id === defaultId) ?? entries[0];
|
|
46771
47125
|
};
|
|
46772
47126
|
let resolved = null;
|
|
@@ -46795,7 +47149,7 @@ async function describeStickerImage(params) {
|
|
|
46795
47149
|
logVerbose(`telegram: describing sticker with ${provider}/${model}`);
|
|
46796
47150
|
try {
|
|
46797
47151
|
const buffer = await fs$1.readFile(imagePath);
|
|
46798
|
-
const { describeImageWithModel } = await import("./image-
|
|
47152
|
+
const { describeImageWithModel } = await import("./image-nRwqkmtf.js").then((n) => n.n);
|
|
46799
47153
|
return (await describeImageWithModel({
|
|
46800
47154
|
buffer,
|
|
46801
47155
|
fileName: "sticker.webp",
|
|
@@ -47152,7 +47506,7 @@ function createWhatsAppLoginTool() {
|
|
|
47152
47506
|
force: Type.Optional(Type.Boolean())
|
|
47153
47507
|
}),
|
|
47154
47508
|
execute: async (_toolCallId, args) => {
|
|
47155
|
-
const { startWebLoginWithQr, waitForWebLogin } = await import("./login-qr-
|
|
47509
|
+
const { startWebLoginWithQr, waitForWebLogin } = await import("./login-qr-Cmsf7BGt.js").then((n) => n.t);
|
|
47156
47510
|
if ((args?.action ?? "start") === "wait") {
|
|
47157
47511
|
const result = await waitForWebLogin({ timeoutMs: typeof args.timeoutMs === "number" ? args.timeoutMs : void 0 });
|
|
47158
47512
|
return {
|
|
@@ -48655,11 +49009,22 @@ function createReplyPrefixContext(params) {
|
|
|
48655
49009
|
};
|
|
48656
49010
|
return {
|
|
48657
49011
|
prefixContext,
|
|
48658
|
-
responsePrefix: resolveEffectiveMessagesConfig(cfg, agentId
|
|
49012
|
+
responsePrefix: resolveEffectiveMessagesConfig(cfg, agentId, {
|
|
49013
|
+
channel: params.channel,
|
|
49014
|
+
accountId: params.accountId
|
|
49015
|
+
}).responsePrefix,
|
|
48659
49016
|
responsePrefixContextProvider: () => prefixContext,
|
|
48660
49017
|
onModelSelected
|
|
48661
49018
|
};
|
|
48662
49019
|
}
|
|
49020
|
+
function createReplyPrefixOptions(params) {
|
|
49021
|
+
const { responsePrefix, responsePrefixContextProvider, onModelSelected } = createReplyPrefixContext(params);
|
|
49022
|
+
return {
|
|
49023
|
+
responsePrefix,
|
|
49024
|
+
responsePrefixContextProvider,
|
|
49025
|
+
onModelSelected
|
|
49026
|
+
};
|
|
49027
|
+
}
|
|
48663
49028
|
|
|
48664
49029
|
//#endregion
|
|
48665
49030
|
//#region src/web/auto-reply/deliver-reply.ts
|
|
@@ -48968,12 +49333,14 @@ async function processMessage(params) {
|
|
|
48968
49333
|
msg: params.msg
|
|
48969
49334
|
}) : void 0;
|
|
48970
49335
|
const configuredResponsePrefix = params.cfg.messages?.responsePrefix;
|
|
48971
|
-
const
|
|
49336
|
+
const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
|
|
48972
49337
|
cfg: params.cfg,
|
|
48973
|
-
agentId: params.route.agentId
|
|
49338
|
+
agentId: params.route.agentId,
|
|
49339
|
+
channel: "whatsapp",
|
|
49340
|
+
accountId: params.route.accountId
|
|
48974
49341
|
});
|
|
48975
49342
|
const isSelfChat = params.msg.chatType !== "group" && Boolean(params.msg.selfE164) && normalizeE164(params.msg.from) === normalizeE164(params.msg.selfE164 ?? "");
|
|
48976
|
-
const responsePrefix =
|
|
49343
|
+
const responsePrefix = prefixOptions.responsePrefix ?? (configuredResponsePrefix === void 0 && isSelfChat ? resolveIdentityNamePrefix(params.cfg, params.route.agentId) ?? "[openclaw]" : void 0);
|
|
48977
49344
|
const ctxPayload = finalizeInboundContext({
|
|
48978
49345
|
Body: combinedBody,
|
|
48979
49346
|
RawBody: params.msg.body,
|
|
@@ -49036,8 +49403,8 @@ async function processMessage(params) {
|
|
|
49036
49403
|
cfg: params.cfg,
|
|
49037
49404
|
replyResolver: params.replyResolver,
|
|
49038
49405
|
dispatcherOptions: {
|
|
49406
|
+
...prefixOptions,
|
|
49039
49407
|
responsePrefix,
|
|
49040
|
-
responsePrefixContextProvider: prefixContext.responsePrefixContextProvider,
|
|
49041
49408
|
onHeartbeatStrip: () => {
|
|
49042
49409
|
if (!didLogHeartbeatStrip) {
|
|
49043
49410
|
didLogHeartbeatStrip = true;
|
|
@@ -49085,7 +49452,7 @@ async function processMessage(params) {
|
|
|
49085
49452
|
},
|
|
49086
49453
|
replyOptions: {
|
|
49087
49454
|
disableBlockStreaming: typeof params.cfg.channels?.whatsapp?.blockStreaming === "boolean" ? !params.cfg.channels.whatsapp.blockStreaming : void 0,
|
|
49088
|
-
onModelSelected
|
|
49455
|
+
onModelSelected
|
|
49089
49456
|
}
|
|
49090
49457
|
});
|
|
49091
49458
|
if (!queuedFinal) {
|
|
@@ -51285,6 +51652,15 @@ async function processDiscordMessage(ctx) {
|
|
|
51285
51652
|
const senderTag = sender.tag;
|
|
51286
51653
|
const systemPromptParts = [channelConfig?.systemPrompt?.trim() || null].filter((entry) => Boolean(entry));
|
|
51287
51654
|
const groupSystemPrompt = systemPromptParts.length > 0 ? systemPromptParts.join("\n\n") : void 0;
|
|
51655
|
+
const ownerAllowFrom = resolveDiscordOwnerAllowFrom({
|
|
51656
|
+
channelConfig,
|
|
51657
|
+
guildInfo,
|
|
51658
|
+
sender: {
|
|
51659
|
+
id: sender.id,
|
|
51660
|
+
name: sender.name,
|
|
51661
|
+
tag: sender.tag
|
|
51662
|
+
}
|
|
51663
|
+
});
|
|
51288
51664
|
const storePath = resolveStorePath(cfg.session?.store, { agentId: route.agentId });
|
|
51289
51665
|
const envelopeOptions = resolveEnvelopeFormatOptions(cfg);
|
|
51290
51666
|
const previousTimestamp = readSessionUpdatedAt({
|
|
@@ -51323,20 +51699,22 @@ async function processDiscordMessage(ctx) {
|
|
|
51323
51699
|
let threadLabel;
|
|
51324
51700
|
let parentSessionKey;
|
|
51325
51701
|
if (threadChannel) {
|
|
51326
|
-
|
|
51327
|
-
|
|
51328
|
-
|
|
51329
|
-
|
|
51330
|
-
|
|
51331
|
-
|
|
51332
|
-
|
|
51333
|
-
|
|
51334
|
-
|
|
51335
|
-
|
|
51336
|
-
|
|
51337
|
-
|
|
51338
|
-
|
|
51339
|
-
|
|
51702
|
+
if (channelConfig?.includeThreadStarter !== false) {
|
|
51703
|
+
const starter = await resolveDiscordThreadStarter({
|
|
51704
|
+
channel: threadChannel,
|
|
51705
|
+
client,
|
|
51706
|
+
parentId: threadParentId,
|
|
51707
|
+
parentType: threadParentType,
|
|
51708
|
+
resolveTimestampMs
|
|
51709
|
+
});
|
|
51710
|
+
if (starter?.text) threadStarterBody = formatThreadStarterEnvelope({
|
|
51711
|
+
channel: "Discord",
|
|
51712
|
+
author: starter.author,
|
|
51713
|
+
timestamp: starter.timestamp,
|
|
51714
|
+
body: starter.text,
|
|
51715
|
+
envelope: envelopeOptions
|
|
51716
|
+
});
|
|
51717
|
+
}
|
|
51340
51718
|
const parentName = threadParentName ?? "parent";
|
|
51341
51719
|
threadLabel = threadName ? `Discord thread #${normalizeDiscordSlug(parentName)} › ${threadName}` : `Discord thread #${normalizeDiscordSlug(parentName)}`;
|
|
51342
51720
|
if (threadParentId) parentSessionKey = buildAgentSessionKey({
|
|
@@ -51396,6 +51774,7 @@ async function processDiscordMessage(ctx) {
|
|
|
51396
51774
|
UntrustedContext: untrustedChannelMetadata ? [untrustedChannelMetadata] : void 0,
|
|
51397
51775
|
GroupSystemPrompt: isGuildMessage ? groupSystemPrompt : void 0,
|
|
51398
51776
|
GroupSpace: isGuildMessage ? (guildInfo?.id ?? guildSlug) || void 0 : void 0,
|
|
51777
|
+
OwnerAllowFrom: ownerAllowFrom,
|
|
51399
51778
|
Provider: "discord",
|
|
51400
51779
|
Surface: "discord",
|
|
51401
51780
|
WasMentioned: effectiveWasMentioned,
|
|
@@ -51429,9 +51808,11 @@ async function processDiscordMessage(ctx) {
|
|
|
51429
51808
|
logVerbose(`discord inbound: channel=${message.channelId} deliver=${deliverTarget} from=${ctxPayload.From} preview="${preview}"`);
|
|
51430
51809
|
}
|
|
51431
51810
|
const typingChannelId = deliverTarget.startsWith("channel:") ? deliverTarget.slice(8) : message.channelId;
|
|
51432
|
-
const
|
|
51811
|
+
const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
|
|
51433
51812
|
cfg,
|
|
51434
|
-
agentId: route.agentId
|
|
51813
|
+
agentId: route.agentId,
|
|
51814
|
+
channel: "discord",
|
|
51815
|
+
accountId: route.accountId
|
|
51435
51816
|
});
|
|
51436
51817
|
const tableMode = resolveMarkdownTableMode({
|
|
51437
51818
|
cfg,
|
|
@@ -51439,8 +51820,7 @@ async function processDiscordMessage(ctx) {
|
|
|
51439
51820
|
accountId
|
|
51440
51821
|
});
|
|
51441
51822
|
const { dispatcher, replyOptions, markDispatchIdle } = createReplyDispatcherWithTyping({
|
|
51442
|
-
|
|
51443
|
-
responsePrefixContextProvider: prefixContext.responsePrefixContextProvider,
|
|
51823
|
+
...prefixOptions,
|
|
51444
51824
|
humanDelay: resolveHumanDelayConfig(cfg, route.agentId),
|
|
51445
51825
|
deliver: async (payload) => {
|
|
51446
51826
|
const replyToId = replyReference.use();
|
|
@@ -51485,9 +51865,7 @@ async function processDiscordMessage(ctx) {
|
|
|
51485
51865
|
...replyOptions,
|
|
51486
51866
|
skillFilter: channelConfig?.skills,
|
|
51487
51867
|
disableBlockStreaming: typeof discordConfig?.blockStreaming === "boolean" ? !discordConfig.blockStreaming : void 0,
|
|
51488
|
-
onModelSelected
|
|
51489
|
-
prefixContext.onModelSelected(ctx);
|
|
51490
|
-
}
|
|
51868
|
+
onModelSelected
|
|
51491
51869
|
}
|
|
51492
51870
|
});
|
|
51493
51871
|
markDispatchIdle();
|
|
@@ -52112,6 +52490,15 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
52112
52490
|
} : void 0
|
|
52113
52491
|
});
|
|
52114
52492
|
const conversationLabel = isDirectMessage ? user.globalName ?? user.username : channelId;
|
|
52493
|
+
const ownerAllowFrom = resolveDiscordOwnerAllowFrom({
|
|
52494
|
+
channelConfig,
|
|
52495
|
+
guildInfo,
|
|
52496
|
+
sender: {
|
|
52497
|
+
id: sender.id,
|
|
52498
|
+
name: sender.name,
|
|
52499
|
+
tag: sender.tag
|
|
52500
|
+
}
|
|
52501
|
+
});
|
|
52115
52502
|
const ctxPayload = finalizeInboundContext({
|
|
52116
52503
|
Body: prompt,
|
|
52117
52504
|
RawBody: prompt,
|
|
@@ -52137,6 +52524,7 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
52137
52524
|
});
|
|
52138
52525
|
return untrustedChannelMetadata ? [untrustedChannelMetadata] : void 0;
|
|
52139
52526
|
})() : void 0,
|
|
52527
|
+
OwnerAllowFrom: ownerAllowFrom,
|
|
52140
52528
|
SenderName: user.globalName ?? user.username,
|
|
52141
52529
|
SenderId: user.id,
|
|
52142
52530
|
SenderUsername: user.username,
|
|
@@ -52149,12 +52537,18 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
52149
52537
|
CommandAuthorized: commandAuthorized,
|
|
52150
52538
|
CommandSource: "native"
|
|
52151
52539
|
});
|
|
52540
|
+
const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
|
|
52541
|
+
cfg,
|
|
52542
|
+
agentId: route.agentId,
|
|
52543
|
+
channel: "discord",
|
|
52544
|
+
accountId: route.accountId
|
|
52545
|
+
});
|
|
52152
52546
|
let didReply = false;
|
|
52153
52547
|
await dispatchReplyWithDispatcher({
|
|
52154
52548
|
ctx: ctxPayload,
|
|
52155
52549
|
cfg,
|
|
52156
52550
|
dispatcherOptions: {
|
|
52157
|
-
|
|
52551
|
+
...prefixOptions,
|
|
52158
52552
|
humanDelay: resolveHumanDelayConfig(cfg, route.agentId),
|
|
52159
52553
|
deliver: async (payload) => {
|
|
52160
52554
|
try {
|
|
@@ -52181,7 +52575,8 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
52181
52575
|
},
|
|
52182
52576
|
replyOptions: {
|
|
52183
52577
|
skillFilter: channelConfig?.skills,
|
|
52184
|
-
disableBlockStreaming: typeof discordConfig?.blockStreaming === "boolean" ? !discordConfig.blockStreaming : void 0
|
|
52578
|
+
disableBlockStreaming: typeof discordConfig?.blockStreaming === "boolean" ? !discordConfig.blockStreaming : void 0,
|
|
52579
|
+
onModelSelected
|
|
52185
52580
|
}
|
|
52186
52581
|
});
|
|
52187
52582
|
}
|
|
@@ -53818,15 +54213,12 @@ function formatControlUiSshHint(params) {
|
|
|
53818
54213
|
const basePath = normalizeControlUiBasePath(params.basePath);
|
|
53819
54214
|
const uiPath = basePath ? `${basePath}/` : "/";
|
|
53820
54215
|
const localUrl = `http://localhost:${params.port}${uiPath}`;
|
|
53821
|
-
const tokenParam = params.token ? `?token=${encodeURIComponent(params.token)}` : "";
|
|
53822
|
-
const authedUrl = params.token ? `${localUrl}${tokenParam}` : void 0;
|
|
53823
54216
|
const sshTarget = resolveSshTargetHint();
|
|
53824
54217
|
return [
|
|
53825
54218
|
"No GUI detected. Open from your computer:",
|
|
53826
54219
|
`ssh -N -L ${params.port}:127.0.0.1:${params.port} ${sshTarget}`,
|
|
53827
54220
|
"Then open:",
|
|
53828
54221
|
localUrl,
|
|
53829
|
-
authedUrl,
|
|
53830
54222
|
"Docs:",
|
|
53831
54223
|
"https://docs.openclaw.ai/gateway/remote",
|
|
53832
54224
|
"https://docs.openclaw.ai/web/control-ui"
|
|
@@ -54628,16 +55020,17 @@ async function monitorIMessageProvider(opts = {}) {
|
|
|
54628
55020
|
const preview = truncateUtf16Safe(body, 200).replace(/\n/g, "\\n");
|
|
54629
55021
|
logVerbose(`imessage inbound: chatId=${chatId ?? "unknown"} from=${ctxPayload.From} len=${body.length} preview="${preview}"`);
|
|
54630
55022
|
}
|
|
54631
|
-
const
|
|
55023
|
+
const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
|
|
54632
55024
|
cfg,
|
|
54633
|
-
agentId: route.agentId
|
|
55025
|
+
agentId: route.agentId,
|
|
55026
|
+
channel: "imessage",
|
|
55027
|
+
accountId: route.accountId
|
|
54634
55028
|
});
|
|
54635
55029
|
const { queuedFinal } = await dispatchInboundMessage({
|
|
54636
55030
|
ctx: ctxPayload,
|
|
54637
55031
|
cfg,
|
|
54638
55032
|
dispatcher: createReplyDispatcher({
|
|
54639
|
-
|
|
54640
|
-
responsePrefixContextProvider: prefixContext.responsePrefixContextProvider,
|
|
55033
|
+
...prefixOptions,
|
|
54641
55034
|
humanDelay: resolveHumanDelayConfig(cfg, route.agentId),
|
|
54642
55035
|
deliver: async (payload) => {
|
|
54643
55036
|
await deliverReplies$3({
|
|
@@ -54657,7 +55050,7 @@ async function monitorIMessageProvider(opts = {}) {
|
|
|
54657
55050
|
}),
|
|
54658
55051
|
replyOptions: {
|
|
54659
55052
|
disableBlockStreaming: typeof accountInfo.config.blockStreaming === "boolean" ? !accountInfo.config.blockStreaming : void 0,
|
|
54660
|
-
onModelSelected
|
|
55053
|
+
onModelSelected
|
|
54661
55054
|
}
|
|
54662
55055
|
});
|
|
54663
55056
|
if (!queuedFinal) {
|
|
@@ -56453,11 +56846,17 @@ async function monitorLineProvider(opts) {
|
|
|
56453
56846
|
try {
|
|
56454
56847
|
const textLimit = 5e3;
|
|
56455
56848
|
let replyTokenUsed = false;
|
|
56849
|
+
const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
|
|
56850
|
+
cfg: config,
|
|
56851
|
+
agentId: route.agentId,
|
|
56852
|
+
channel: "line",
|
|
56853
|
+
accountId: route.accountId
|
|
56854
|
+
});
|
|
56456
56855
|
const { queuedFinal } = await dispatchReplyWithBufferedBlockDispatcher({
|
|
56457
56856
|
ctx: ctxPayload,
|
|
56458
56857
|
cfg: config,
|
|
56459
56858
|
dispatcherOptions: {
|
|
56460
|
-
|
|
56859
|
+
...prefixOptions,
|
|
56461
56860
|
deliver: async (payload, _info) => {
|
|
56462
56861
|
const lineData = payload.channelData?.line ?? {};
|
|
56463
56862
|
if (ctx.userId && !ctx.isGroup) showLoadingAnimation(ctx.userId, { accountId: ctx.accountId }).catch(() => {});
|
|
@@ -56499,7 +56898,7 @@ async function monitorLineProvider(opts) {
|
|
|
56499
56898
|
runtime.error?.(danger(`line ${info.kind} reply failed: ${String(err)}`));
|
|
56500
56899
|
}
|
|
56501
56900
|
},
|
|
56502
|
-
replyOptions: {}
|
|
56901
|
+
replyOptions: { onModelSelected }
|
|
56503
56902
|
});
|
|
56504
56903
|
if (!queuedFinal) logVerbose(`line: no response generated for message from ${ctxPayload.From}`);
|
|
56505
56904
|
} catch (err) {
|
|
@@ -56794,9 +57193,11 @@ function createSignalEventHandler(deps) {
|
|
|
56794
57193
|
const preview = body.slice(0, 200).replace(/\\n/g, "\\\\n");
|
|
56795
57194
|
logVerbose(`signal inbound: from=${ctxPayload.From} len=${body.length} preview="${preview}"`);
|
|
56796
57195
|
}
|
|
56797
|
-
const
|
|
57196
|
+
const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
|
|
56798
57197
|
cfg: deps.cfg,
|
|
56799
|
-
agentId: route.agentId
|
|
57198
|
+
agentId: route.agentId,
|
|
57199
|
+
channel: "signal",
|
|
57200
|
+
accountId: route.accountId
|
|
56800
57201
|
});
|
|
56801
57202
|
const typingCallbacks = createTypingCallbacks({
|
|
56802
57203
|
start: async () => {
|
|
@@ -56817,8 +57218,7 @@ function createSignalEventHandler(deps) {
|
|
|
56817
57218
|
}
|
|
56818
57219
|
});
|
|
56819
57220
|
const { dispatcher, replyOptions, markDispatchIdle } = createReplyDispatcherWithTyping({
|
|
56820
|
-
|
|
56821
|
-
responsePrefixContextProvider: prefixContext.responsePrefixContextProvider,
|
|
57221
|
+
...prefixOptions,
|
|
56822
57222
|
humanDelay: resolveHumanDelayConfig(deps.cfg, route.agentId),
|
|
56823
57223
|
deliver: async (payload) => {
|
|
56824
57224
|
await deps.deliverReplies({
|
|
@@ -56844,9 +57244,7 @@ function createSignalEventHandler(deps) {
|
|
|
56844
57244
|
replyOptions: {
|
|
56845
57245
|
...replyOptions,
|
|
56846
57246
|
disableBlockStreaming: typeof deps.blockStreaming === "boolean" ? !deps.blockStreaming : void 0,
|
|
56847
|
-
onModelSelected
|
|
56848
|
-
prefixContext.onModelSelected(ctx);
|
|
56849
|
-
}
|
|
57247
|
+
onModelSelected
|
|
56850
57248
|
}
|
|
56851
57249
|
});
|
|
56852
57250
|
markDispatchIdle();
|
|
@@ -58546,13 +58944,14 @@ async function dispatchPreparedSlackMessage(prepared) {
|
|
|
58546
58944
|
});
|
|
58547
58945
|
}
|
|
58548
58946
|
});
|
|
58549
|
-
const
|
|
58947
|
+
const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
|
|
58550
58948
|
cfg,
|
|
58551
|
-
agentId: route.agentId
|
|
58949
|
+
agentId: route.agentId,
|
|
58950
|
+
channel: "slack",
|
|
58951
|
+
accountId: route.accountId
|
|
58552
58952
|
});
|
|
58553
58953
|
const { dispatcher, replyOptions, markDispatchIdle } = createReplyDispatcherWithTyping({
|
|
58554
|
-
|
|
58555
|
-
responsePrefixContextProvider: prefixContext.responsePrefixContextProvider,
|
|
58954
|
+
...prefixOptions,
|
|
58556
58955
|
humanDelay: resolveHumanDelayConfig(cfg, route.agentId),
|
|
58557
58956
|
deliver: async (payload) => {
|
|
58558
58957
|
const replyThreadTs = replyPlan.nextThreadTs();
|
|
@@ -58583,9 +58982,7 @@ async function dispatchPreparedSlackMessage(prepared) {
|
|
|
58583
58982
|
skillFilter: prepared.channelConfig?.skills,
|
|
58584
58983
|
hasRepliedRef,
|
|
58585
58984
|
disableBlockStreaming: typeof account.config.blockStreaming === "boolean" ? !account.config.blockStreaming : void 0,
|
|
58586
|
-
onModelSelected
|
|
58587
|
-
prefixContext.onModelSelected(ctx);
|
|
58588
|
-
}
|
|
58985
|
+
onModelSelected
|
|
58589
58986
|
}
|
|
58590
58987
|
});
|
|
58591
58988
|
markDispatchIdle();
|
|
@@ -59579,42 +59976,49 @@ function registerSlackMonitorSlashCommands(params) {
|
|
|
59579
59976
|
}) : void 0;
|
|
59580
59977
|
const systemPromptParts = [channelConfig?.systemPrompt?.trim() || null].filter((entry) => Boolean(entry));
|
|
59581
59978
|
const groupSystemPrompt = systemPromptParts.length > 0 ? systemPromptParts.join("\n\n") : void 0;
|
|
59582
|
-
const
|
|
59583
|
-
|
|
59584
|
-
|
|
59585
|
-
|
|
59586
|
-
|
|
59587
|
-
|
|
59588
|
-
|
|
59589
|
-
|
|
59979
|
+
const ctxPayload = finalizeInboundContext({
|
|
59980
|
+
Body: prompt,
|
|
59981
|
+
RawBody: prompt,
|
|
59982
|
+
CommandBody: prompt,
|
|
59983
|
+
CommandArgs: commandArgs,
|
|
59984
|
+
From: isDirectMessage ? `slack:${command.user_id}` : isRoom ? `slack:channel:${command.channel_id}` : `slack:group:${command.channel_id}`,
|
|
59985
|
+
To: `slash:${command.user_id}`,
|
|
59986
|
+
ChatType: isDirectMessage ? "direct" : "channel",
|
|
59987
|
+
ConversationLabel: resolveConversationLabel({
|
|
59590
59988
|
ChatType: isDirectMessage ? "direct" : "channel",
|
|
59591
|
-
ConversationLabel: resolveConversationLabel({
|
|
59592
|
-
ChatType: isDirectMessage ? "direct" : "channel",
|
|
59593
|
-
SenderName: senderName,
|
|
59594
|
-
GroupSubject: isRoomish ? roomLabel : void 0,
|
|
59595
|
-
From: isDirectMessage ? `slack:${command.user_id}` : isRoom ? `slack:channel:${command.channel_id}` : `slack:group:${command.channel_id}`
|
|
59596
|
-
}) ?? (isDirectMessage ? senderName : roomLabel),
|
|
59597
|
-
GroupSubject: isRoomish ? roomLabel : void 0,
|
|
59598
|
-
GroupSystemPrompt: isRoomish ? groupSystemPrompt : void 0,
|
|
59599
|
-
UntrustedContext: untrustedChannelMetadata ? [untrustedChannelMetadata] : void 0,
|
|
59600
59989
|
SenderName: senderName,
|
|
59601
|
-
|
|
59602
|
-
|
|
59603
|
-
|
|
59604
|
-
|
|
59605
|
-
|
|
59606
|
-
|
|
59607
|
-
|
|
59608
|
-
|
|
59609
|
-
|
|
59610
|
-
|
|
59611
|
-
|
|
59612
|
-
|
|
59613
|
-
|
|
59614
|
-
}),
|
|
59990
|
+
GroupSubject: isRoomish ? roomLabel : void 0,
|
|
59991
|
+
From: isDirectMessage ? `slack:${command.user_id}` : isRoom ? `slack:channel:${command.channel_id}` : `slack:group:${command.channel_id}`
|
|
59992
|
+
}) ?? (isDirectMessage ? senderName : roomLabel),
|
|
59993
|
+
GroupSubject: isRoomish ? roomLabel : void 0,
|
|
59994
|
+
GroupSystemPrompt: isRoomish ? groupSystemPrompt : void 0,
|
|
59995
|
+
UntrustedContext: untrustedChannelMetadata ? [untrustedChannelMetadata] : void 0,
|
|
59996
|
+
SenderName: senderName,
|
|
59997
|
+
SenderId: command.user_id,
|
|
59998
|
+
Provider: "slack",
|
|
59999
|
+
Surface: "slack",
|
|
60000
|
+
WasMentioned: true,
|
|
60001
|
+
MessageSid: command.trigger_id,
|
|
60002
|
+
Timestamp: Date.now(),
|
|
60003
|
+
SessionKey: `agent:${route.agentId}:${slashCommand.sessionPrefix}:${command.user_id}`.toLowerCase(),
|
|
60004
|
+
CommandTargetSessionKey: route.sessionKey,
|
|
60005
|
+
AccountId: route.accountId,
|
|
60006
|
+
CommandSource: "native",
|
|
60007
|
+
CommandAuthorized: commandAuthorized,
|
|
60008
|
+
OriginatingChannel: "slack",
|
|
60009
|
+
OriginatingTo: `user:${command.user_id}`
|
|
60010
|
+
});
|
|
60011
|
+
const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
|
|
60012
|
+
cfg,
|
|
60013
|
+
agentId: route.agentId,
|
|
60014
|
+
channel: "slack",
|
|
60015
|
+
accountId: route.accountId
|
|
60016
|
+
});
|
|
60017
|
+
const { counts } = await dispatchReplyWithDispatcher({
|
|
60018
|
+
ctx: ctxPayload,
|
|
59615
60019
|
cfg,
|
|
59616
60020
|
dispatcherOptions: {
|
|
59617
|
-
|
|
60021
|
+
...prefixOptions,
|
|
59618
60022
|
deliver: async (payload) => {
|
|
59619
60023
|
await deliverSlackSlashReplies({
|
|
59620
60024
|
replies: [payload],
|
|
@@ -59633,7 +60037,10 @@ function registerSlackMonitorSlashCommands(params) {
|
|
|
59633
60037
|
runtime.error?.(danger(`slack slash ${info.kind} reply failed: ${String(err)}`));
|
|
59634
60038
|
}
|
|
59635
60039
|
},
|
|
59636
|
-
replyOptions: {
|
|
60040
|
+
replyOptions: {
|
|
60041
|
+
skillFilter: channelConfig?.skills,
|
|
60042
|
+
onModelSelected
|
|
60043
|
+
}
|
|
59637
60044
|
});
|
|
59638
60045
|
if (counts.final + counts.tool + counts.block === 0) await deliverSlackSlashReplies({
|
|
59639
60046
|
replies: [],
|
|
@@ -60718,6 +61125,11 @@ const registerTelegramHandlers = ({ cfg, accountId, bot, opts, runtime, mediaMax
|
|
|
60718
61125
|
messageThreadId: params.messageThreadId
|
|
60719
61126
|
});
|
|
60720
61127
|
const peerId = params.isGroup ? buildTelegramGroupPeerId(params.chatId, resolvedThreadId) : String(params.chatId);
|
|
61128
|
+
const parentPeer = buildTelegramParentPeer({
|
|
61129
|
+
isGroup: params.isGroup,
|
|
61130
|
+
resolvedThreadId,
|
|
61131
|
+
chatId: params.chatId
|
|
61132
|
+
});
|
|
60721
61133
|
const route = resolveAgentRoute({
|
|
60722
61134
|
cfg,
|
|
60723
61135
|
channel: "telegram",
|
|
@@ -60725,7 +61137,8 @@ const registerTelegramHandlers = ({ cfg, accountId, bot, opts, runtime, mediaMax
|
|
|
60725
61137
|
peer: {
|
|
60726
61138
|
kind: params.isGroup ? "group" : "dm",
|
|
60727
61139
|
id: peerId
|
|
60728
|
-
}
|
|
61140
|
+
},
|
|
61141
|
+
parentPeer
|
|
60729
61142
|
});
|
|
60730
61143
|
const baseSessionKey = route.sessionKey;
|
|
60731
61144
|
const dmThreadId = !params.isGroup ? params.messageThreadId : void 0;
|
|
@@ -60866,7 +61279,7 @@ const registerTelegramHandlers = ({ cfg, accountId, bot, opts, runtime, mediaMax
|
|
|
60866
61279
|
}
|
|
60867
61280
|
}
|
|
60868
61281
|
const defaultGroupPolicy = cfg.channels?.defaults?.groupPolicy;
|
|
60869
|
-
const groupPolicy = telegramCfg.groupPolicy
|
|
61282
|
+
const groupPolicy = firstDefined(topicConfig?.groupPolicy, groupConfig?.groupPolicy, telegramCfg.groupPolicy, defaultGroupPolicy, "open");
|
|
60870
61283
|
if (groupPolicy === "disabled") {
|
|
60871
61284
|
logVerbose(`Blocked telegram group message (groupPolicy: disabled)`);
|
|
60872
61285
|
return;
|
|
@@ -61117,7 +61530,7 @@ const registerTelegramHandlers = ({ cfg, accountId, bot, opts, runtime, mediaMax
|
|
|
61117
61530
|
}
|
|
61118
61531
|
}
|
|
61119
61532
|
const defaultGroupPolicy = cfg.channels?.defaults?.groupPolicy;
|
|
61120
|
-
const groupPolicy = telegramCfg.groupPolicy
|
|
61533
|
+
const groupPolicy = firstDefined(topicConfig?.groupPolicy, groupConfig?.groupPolicy, telegramCfg.groupPolicy, defaultGroupPolicy, "open");
|
|
61121
61534
|
if (groupPolicy === "disabled") {
|
|
61122
61535
|
logVerbose(`Blocked telegram group message (groupPolicy: disabled)`);
|
|
61123
61536
|
return;
|
|
@@ -61316,6 +61729,11 @@ const buildTelegramMessageContext = async ({ primaryCtx, allMedia, storeAllowFro
|
|
|
61316
61729
|
const replyThreadId = threadSpec.id;
|
|
61317
61730
|
const { groupConfig, topicConfig } = resolveTelegramGroupConfig(chatId, resolvedThreadId);
|
|
61318
61731
|
const peerId = isGroup ? buildTelegramGroupPeerId(chatId, resolvedThreadId) : String(chatId);
|
|
61732
|
+
const parentPeer = buildTelegramParentPeer({
|
|
61733
|
+
isGroup,
|
|
61734
|
+
resolvedThreadId,
|
|
61735
|
+
chatId
|
|
61736
|
+
});
|
|
61319
61737
|
const route = resolveAgentRoute({
|
|
61320
61738
|
cfg,
|
|
61321
61739
|
channel: "telegram",
|
|
@@ -61323,7 +61741,8 @@ const buildTelegramMessageContext = async ({ primaryCtx, allMedia, storeAllowFro
|
|
|
61323
61741
|
peer: {
|
|
61324
61742
|
kind: isGroup ? "group" : "dm",
|
|
61325
61743
|
id: peerId
|
|
61326
|
-
}
|
|
61744
|
+
},
|
|
61745
|
+
parentPeer
|
|
61327
61746
|
});
|
|
61328
61747
|
const baseSessionKey = route.sessionKey;
|
|
61329
61748
|
const dmThreadId = threadSpec.scope === "dm" ? threadSpec.id : void 0;
|
|
@@ -61669,7 +62088,8 @@ const buildTelegramMessageContext = async ({ primaryCtx, allMedia, storeAllowFro
|
|
|
61669
62088
|
sessionKey: route.mainSessionKey,
|
|
61670
62089
|
channel: "telegram",
|
|
61671
62090
|
to: String(chatId),
|
|
61672
|
-
accountId: route.accountId
|
|
62091
|
+
accountId: route.accountId,
|
|
62092
|
+
threadId: dmThreadId != null ? String(dmThreadId) : void 0
|
|
61673
62093
|
} : void 0,
|
|
61674
62094
|
onRecordError: (err) => {
|
|
61675
62095
|
logVerbose(`telegram: failed updating session meta: ${String(err)}`);
|
|
@@ -61905,9 +62325,11 @@ const dispatchTelegramMessage = async ({ context, bot, cfg, runtime, replyToMode
|
|
|
61905
62325
|
await draftStream.flush();
|
|
61906
62326
|
};
|
|
61907
62327
|
const disableBlockStreaming = Boolean(draftStream) || (typeof telegramCfg.blockStreaming === "boolean" ? !telegramCfg.blockStreaming : void 0);
|
|
61908
|
-
const
|
|
62328
|
+
const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
|
|
61909
62329
|
cfg,
|
|
61910
|
-
agentId: route.agentId
|
|
62330
|
+
agentId: route.agentId,
|
|
62331
|
+
channel: "telegram",
|
|
62332
|
+
accountId: route.accountId
|
|
61911
62333
|
});
|
|
61912
62334
|
const tableMode = resolveMarkdownTableMode({
|
|
61913
62335
|
cfg,
|
|
@@ -61916,7 +62338,7 @@ const dispatchTelegramMessage = async ({ context, bot, cfg, runtime, replyToMode
|
|
|
61916
62338
|
});
|
|
61917
62339
|
const chunkMode = resolveChunkMode(cfg, "telegram", route.accountId);
|
|
61918
62340
|
const sticker = ctxPayload.Sticker;
|
|
61919
|
-
if (sticker?.fileUniqueId && ctxPayload.MediaPath) {
|
|
62341
|
+
if (sticker?.fileId && sticker.fileUniqueId && ctxPayload.MediaPath) {
|
|
61920
62342
|
const agentDir = resolveAgentDir(cfg, route.agentId);
|
|
61921
62343
|
const stickerSupportsVision = await resolveStickerVisionSupport(cfg, route.agentId);
|
|
61922
62344
|
let description = sticker.cachedDescription ?? null;
|
|
@@ -61940,16 +62362,18 @@ const dispatchTelegramMessage = async ({ context, bot, cfg, runtime, replyToMode
|
|
|
61940
62362
|
ctxPayload.MediaUrls = void 0;
|
|
61941
62363
|
ctxPayload.MediaTypes = void 0;
|
|
61942
62364
|
}
|
|
61943
|
-
|
|
61944
|
-
|
|
61945
|
-
|
|
61946
|
-
|
|
61947
|
-
|
|
61948
|
-
|
|
61949
|
-
|
|
61950
|
-
|
|
61951
|
-
|
|
61952
|
-
|
|
62365
|
+
if (sticker.fileId) {
|
|
62366
|
+
cacheSticker({
|
|
62367
|
+
fileId: sticker.fileId,
|
|
62368
|
+
fileUniqueId: sticker.fileUniqueId,
|
|
62369
|
+
emoji: sticker.emoji,
|
|
62370
|
+
setName: sticker.setName,
|
|
62371
|
+
description,
|
|
62372
|
+
cachedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
62373
|
+
receivedFrom: ctxPayload.From
|
|
62374
|
+
});
|
|
62375
|
+
logVerbose(`telegram: cached sticker description for ${sticker.fileUniqueId}`);
|
|
62376
|
+
} else logVerbose(`telegram: skipped sticker cache (missing fileId)`);
|
|
61953
62377
|
}
|
|
61954
62378
|
}
|
|
61955
62379
|
const replyQuoteText = ctxPayload.ReplyToIsQuote && ctxPayload.ReplyToBody ? ctxPayload.ReplyToBody.trim() || void 0 : void 0;
|
|
@@ -61961,8 +62385,7 @@ const dispatchTelegramMessage = async ({ context, bot, cfg, runtime, replyToMode
|
|
|
61961
62385
|
ctx: ctxPayload,
|
|
61962
62386
|
cfg,
|
|
61963
62387
|
dispatcherOptions: {
|
|
61964
|
-
|
|
61965
|
-
responsePrefixContextProvider: prefixContext.responsePrefixContextProvider,
|
|
62388
|
+
...prefixOptions,
|
|
61966
62389
|
deliver: async (payload, info) => {
|
|
61967
62390
|
if (info.kind === "final") {
|
|
61968
62391
|
await flushDraft();
|
|
@@ -62006,9 +62429,7 @@ const dispatchTelegramMessage = async ({ context, bot, cfg, runtime, replyToMode
|
|
|
62006
62429
|
skillFilter,
|
|
62007
62430
|
disableBlockStreaming,
|
|
62008
62431
|
onPartialReply: draftStream ? (payload) => updateDraftFromPartial(payload.text) : void 0,
|
|
62009
|
-
onModelSelected
|
|
62010
|
-
prefixContext.onModelSelected(ctx);
|
|
62011
|
-
}
|
|
62432
|
+
onModelSelected
|
|
62012
62433
|
}
|
|
62013
62434
|
});
|
|
62014
62435
|
draftStream?.stop();
|
|
@@ -62343,6 +62764,11 @@ const registerTelegramNativeCommands = ({ bot, cfg, runtime, accountId, telegram
|
|
|
62343
62764
|
});
|
|
62344
62765
|
return;
|
|
62345
62766
|
}
|
|
62767
|
+
const parentPeer = buildTelegramParentPeer({
|
|
62768
|
+
isGroup,
|
|
62769
|
+
resolvedThreadId,
|
|
62770
|
+
chatId
|
|
62771
|
+
});
|
|
62346
62772
|
const route = resolveAgentRoute({
|
|
62347
62773
|
cfg,
|
|
62348
62774
|
channel: "telegram",
|
|
@@ -62350,7 +62776,8 @@ const registerTelegramNativeCommands = ({ bot, cfg, runtime, accountId, telegram
|
|
|
62350
62776
|
peer: {
|
|
62351
62777
|
kind: isGroup ? "group" : "dm",
|
|
62352
62778
|
id: isGroup ? buildTelegramGroupPeerId(chatId, resolvedThreadId) : String(chatId)
|
|
62353
|
-
}
|
|
62779
|
+
},
|
|
62780
|
+
parentPeer
|
|
62354
62781
|
});
|
|
62355
62782
|
const baseSessionKey = route.sessionKey;
|
|
62356
62783
|
const dmThreadId = threadSpec.scope === "dm" ? threadSpec.id : void 0;
|
|
@@ -62401,11 +62828,17 @@ const registerTelegramNativeCommands = ({ bot, cfg, runtime, accountId, telegram
|
|
|
62401
62828
|
delivered: false,
|
|
62402
62829
|
skippedNonSilent: 0
|
|
62403
62830
|
};
|
|
62831
|
+
const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
|
|
62832
|
+
cfg,
|
|
62833
|
+
agentId: route.agentId,
|
|
62834
|
+
channel: "telegram",
|
|
62835
|
+
accountId: route.accountId
|
|
62836
|
+
});
|
|
62404
62837
|
await dispatchReplyWithBufferedBlockDispatcher({
|
|
62405
62838
|
ctx: ctxPayload,
|
|
62406
62839
|
cfg,
|
|
62407
62840
|
dispatcherOptions: {
|
|
62408
|
-
|
|
62841
|
+
...prefixOptions,
|
|
62409
62842
|
deliver: async (payload, _info) => {
|
|
62410
62843
|
if ((await deliverReplies({
|
|
62411
62844
|
replies: [payload],
|
|
@@ -62430,7 +62863,8 @@ const registerTelegramNativeCommands = ({ bot, cfg, runtime, accountId, telegram
|
|
|
62430
62863
|
},
|
|
62431
62864
|
replyOptions: {
|
|
62432
62865
|
skillFilter,
|
|
62433
|
-
disableBlockStreaming
|
|
62866
|
+
disableBlockStreaming,
|
|
62867
|
+
onModelSelected
|
|
62434
62868
|
}
|
|
62435
62869
|
});
|
|
62436
62870
|
if (!deliveryState.delivered && deliveryState.skippedNonSilent > 0) await deliverReplies({
|
|
@@ -62535,7 +62969,7 @@ function getTelegramSequentialKey(ctx) {
|
|
|
62535
62969
|
}
|
|
62536
62970
|
const isGroup = msg?.chat?.type === "group" || msg?.chat?.type === "supergroup";
|
|
62537
62971
|
const messageThreadId = msg?.message_thread_id;
|
|
62538
|
-
const isForum =
|
|
62972
|
+
const isForum = msg?.chat?.is_forum;
|
|
62539
62973
|
const threadId = isGroup ? resolveTelegramForumThreadId({
|
|
62540
62974
|
isForum,
|
|
62541
62975
|
messageThreadId
|
|
@@ -62570,10 +63004,6 @@ function createTelegramBot(opts) {
|
|
|
62570
63004
|
bot.catch((err) => {
|
|
62571
63005
|
runtime.error?.(danger(`telegram bot error: ${formatUncaughtError(err)}`));
|
|
62572
63006
|
});
|
|
62573
|
-
bot.catch((err) => {
|
|
62574
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
62575
|
-
runtime.error?.(danger(`telegram bot error: ${message}`));
|
|
62576
|
-
});
|
|
62577
63007
|
const recentUpdates = createTelegramUpdateDedupe();
|
|
62578
63008
|
let lastUpdateId = typeof opts.updateOffset?.lastUpdateId === "number" ? opts.updateOffset.lastUpdateId : null;
|
|
62579
63009
|
const recordUpdateId = (ctx) => {
|
|
@@ -62603,9 +63033,8 @@ function createTelegramBot(opts) {
|
|
|
62603
63033
|
if (typeof value === "string" && value.length > MAX_RAW_UPDATE_STRING) return `${value.slice(0, MAX_RAW_UPDATE_STRING)}...`;
|
|
62604
63034
|
if (Array.isArray(value) && value.length > MAX_RAW_UPDATE_ARRAY) return [...value.slice(0, MAX_RAW_UPDATE_ARRAY), `...(${value.length - MAX_RAW_UPDATE_ARRAY} more)`];
|
|
62605
63035
|
if (value && typeof value === "object") {
|
|
62606
|
-
|
|
62607
|
-
|
|
62608
|
-
seen.add(obj);
|
|
63036
|
+
if (seen.has(value)) return "[Circular]";
|
|
63037
|
+
seen.add(value);
|
|
62609
63038
|
}
|
|
62610
63039
|
return value;
|
|
62611
63040
|
});
|
|
@@ -62649,9 +63078,8 @@ function createTelegramBot(opts) {
|
|
|
62649
63078
|
const streamMode = resolveTelegramStreamMode(telegramCfg);
|
|
62650
63079
|
let botHasTopicsEnabled;
|
|
62651
63080
|
const resolveBotTopicsEnabled = async (ctx) => {
|
|
62652
|
-
|
|
62653
|
-
|
|
62654
|
-
botHasTopicsEnabled = fromCtx.has_topics_enabled;
|
|
63081
|
+
if (typeof ctx?.me?.has_topics_enabled === "boolean") {
|
|
63082
|
+
botHasTopicsEnabled = ctx.me.has_topics_enabled;
|
|
62655
63083
|
return botHasTopicsEnabled;
|
|
62656
63084
|
}
|
|
62657
63085
|
if (typeof botHasTopicsEnabled === "boolean") return botHasTopicsEnabled;
|
|
@@ -62773,27 +63201,28 @@ function createTelegramBot(opts) {
|
|
|
62773
63201
|
else if (!senderName && senderUsername) senderLabel = senderUsername;
|
|
62774
63202
|
if (!senderLabel && user?.id) senderLabel = `id:${user.id}`;
|
|
62775
63203
|
senderLabel = senderLabel || "unknown";
|
|
62776
|
-
const messageThreadId = reaction.message_thread_id;
|
|
62777
|
-
const resolvedThreadId = resolveTelegramForumThreadId({
|
|
62778
|
-
isForum: reaction.chat.is_forum === true,
|
|
62779
|
-
messageThreadId
|
|
62780
|
-
});
|
|
62781
63204
|
const isGroup = reaction.chat.type === "group" || reaction.chat.type === "supergroup";
|
|
63205
|
+
const isForum = reaction.chat.is_forum === true;
|
|
63206
|
+
const resolvedThreadId = isForum ? resolveTelegramForumThreadId({
|
|
63207
|
+
isForum,
|
|
63208
|
+
messageThreadId: void 0
|
|
63209
|
+
}) : void 0;
|
|
62782
63210
|
const peerId = isGroup ? buildTelegramGroupPeerId(chatId, resolvedThreadId) : String(chatId);
|
|
62783
|
-
const
|
|
63211
|
+
const parentPeer = buildTelegramParentPeer({
|
|
63212
|
+
isGroup,
|
|
63213
|
+
resolvedThreadId,
|
|
63214
|
+
chatId
|
|
63215
|
+
});
|
|
63216
|
+
const sessionKey = resolveAgentRoute({
|
|
62784
63217
|
cfg,
|
|
62785
63218
|
channel: "telegram",
|
|
62786
63219
|
accountId: account.accountId,
|
|
62787
63220
|
peer: {
|
|
62788
63221
|
kind: isGroup ? "group" : "dm",
|
|
62789
63222
|
id: peerId
|
|
62790
|
-
}
|
|
63223
|
+
},
|
|
63224
|
+
parentPeer
|
|
62791
63225
|
}).sessionKey;
|
|
62792
|
-
const dmThreadId = !isGroup ? messageThreadId : void 0;
|
|
62793
|
-
const sessionKey = (dmThreadId != null ? resolveThreadSessionKeys({
|
|
62794
|
-
baseSessionKey,
|
|
62795
|
-
threadId: String(dmThreadId)
|
|
62796
|
-
}) : null)?.sessionKey ?? baseSessionKey;
|
|
62797
63226
|
for (const r of addedReactions) {
|
|
62798
63227
|
const emoji = r.emoji;
|
|
62799
63228
|
const text = `Telegram reaction added: ${emoji} by ${senderLabel} on msg ${messageId}`;
|
|
@@ -63687,4 +64116,4 @@ function loadOpenClawPlugins(options = {}) {
|
|
|
63687
64116
|
}
|
|
63688
64117
|
|
|
63689
64118
|
//#endregion
|
|
63690
|
-
export { approveNodePairing as $,
|
|
64119
|
+
export { approveNodePairing as $, isTtsEnabled as $n, listSessionsFromStore as $t, resolveHeartbeatVisibility as A, scheduleGatewaySigusr1Restart as An, clearInternalHooks as Ar, installUnhandledRejectionHandler as At, createReplyDispatcher as B, normalizeCronJobPatch as Bn, emitAgentEvent as Bt, buildControlUiAvatarUrl as C, resetDirectoryCache as Cn, resolveUserTimeFormat as Cr, normalizeMimeList as Ct, runMemoryStatus as D, authorizeGatewaySigusr1Restart as Dn, getMemorySearchManager as Dr, runEmbeddedPiAgent as Dt, registerMemoryCli as E, describeFailoverError as En, createSlackWebClient as Er, stopSubagentsForRequester as Et, sendMessageTelegram as F, readRestartSentinel as Fn, getHookType as Ft, normalizeSendPolicy as G, isSystemEventContextChanged as Gn, AGENT_LANE_NESTED as Gt, getCliSessionId as H, CHANNEL_TARGETS_DESCRIPTION as Hn, onAgentEvent as Ht, sendMessageDiscord as I, summarizeRestartSentinel as In, isExternalHookSession as It, primeRemoteSkillsCache as J, setHeartbeatWakeHandler as Jn, loadProviderUsageSummary as Jt, resolveSendPolicy as K, peekSystemEvents as Kn, loadModelCatalog as Kt, getChannelActivity as L, trimLogTail as Ln, initSubagentRegistry as Lt, getLastHeartbeatEvent as M, consumeRestartSentinel as Mn, registerInternalHook as Mr, createOpenClawTools as Mt, onHeartbeatEvent as N, formatDoctorNonInteractiveHint as Nn, triggerInternalHook as Nr, buildSafeExternalPrompt as Nt, createReplyPrefixOptions as O, consumeGatewaySigusr1RestartAuthorization as On, resolveAgentIdentity as Or, abortEmbeddedPiRun as Ot, resolveIndicatorType as P, formatRestartSentinelMessage as Pn, detectSuspiciousPatterns as Pt, setSkillsRemoteRegistry as Q, getTtsProvider as Qn, listAgentsForGateway as Qt, fetchChannelPermissionsDiscord as R, writeRestartSentinel as Rn, resolveAgentTimeoutMs as Rt, CONTROL_UI_AVATAR_PREFIX as S, formatTargetDisplay as Sn, formatUserTime as Sr, extractImageContentFromSource as St, resolveAssistantAvatarUrl as T, runWithModelFallback as Tn, sendMessageSlack as Tr, isAbortTrigger as Tt, setCliSessionId as U, CHANNEL_TARGET_DESCRIPTION as Un, registerAgentRunContext as Ut, getReplyFromConfig as V, migrateLegacyCronPayload as Vn, getAgentRunContext as Vt, runCliAgent as W, enqueueSystemEvent as Wn, resolveAnnounceTargetFromKey as Wt, refreshRemoteBinsForConnectedNodes as X, OPENAI_TTS_MODELS as Xn, formatUsageWindowSummary as Xt, recordRemoteNodeInfo as Y, getPluginToolMeta as Yn, formatUsageReportLines as Yt, refreshRemoteNodeBins as Z, OPENAI_TTS_VOICES as Zn, resolveUsageProviderId as Zt, randomToken as _, parseDiscordTarget as _n, isHeartbeatContentEffectivelyEmpty as _r, DEFAULT_INPUT_PDF_MAX_PAGES as _t, applyWizardMetadata as a, capArrayByJsonBytes as an, resolveTtsProviderOrder as ar, verifyNodeToken as at, summarizeExistingConfig as b, resolveOutboundTarget as bn, sendMessageWhatsApp as br, DEFAULT_INPUT_TIMEOUT_MS as bt, ensureWorkspaceAndSessions as c, resolveSessionTranscriptCandidates as cn, textToSpeech as cr, clearSessionAuthProfileOverride as ct, handleReset as d, lookupContextTokens as dn, CommandLane as dr, DEFAULT_INPUT_FILE_MAX_BYTES as dt, loadCombinedSessionStoreForGateway as en, isTtsProviderConfigured as er, listNodePairing as et, moveToTrash as f, clearSessionQueues as fn, startDiagnosticHeartbeat as fr, DEFAULT_INPUT_FILE_MAX_CHARS as ft, probeGatewayReachable as g, resolveOutboundSessionRoute as gn, DEFAULT_HEARTBEAT_EVERY as gr, DEFAULT_INPUT_MAX_REDIRECTS as gt, printWizardHeader as h, ensureOutboundSessionEntry as hn, DEFAULT_HEARTBEAT_ACK_MAX_CHARS as hr, DEFAULT_INPUT_IMAGE_MIMES as ht, DEFAULT_WORKSPACE as i, archiveFileOnDisk as in, resolveTtsPrefsPath as ir, updatePairedNodeMetadata as it, emitHeartbeatEvent as j, setGatewaySigusr1RestartPolicy as jn, createInternalHookEvent as jr, registerUnhandledRejectionHandler as jt, buildHistoryContextFromEntries as k, isGatewaySigusr1RestartExternallyAllowed as kn, resolveEffectiveMessagesConfig as kr, waitForEmbeddedPiRunEnd as kt, formatControlUiSshHint as l, stripEnvelopeFromMessages as ln, getQueueSize as lr, applyVerboseOverride as lt, openUrl as m, runMessageAction as mn, isDiagnosticsEnabled as mr, DEFAULT_INPUT_IMAGE_MAX_BYTES as mt, handleSlackHttpRequest as n, resolveGatewaySessionStoreTarget as nn, resolveTtsAutoMode as nr, renamePairedNode as nt, detectBinary as o, readSessionMessages as on, setTtsEnabled as or, getSkillsSnapshotVersion as ot, normalizeGatewayTokenInput as p, normalizeGroupActivation as pn, stopDiagnosticHeartbeat as pr, DEFAULT_INPUT_FILE_MIMES as pt, getRemoteSkillEligibility as q, requestHeartbeatNow as qn, applyModelOverrideToSessionEntry as qt, sendMessageIMessage as r, resolveSessionModelRef as rn, resolveTtsConfig as rr, requestNodePairing as rt, detectBrowserOpenSupport as s, readSessionPreviewItemsFromTranscript as sn, setTtsProvider as sr, registerSkillsChangeListener as st, loadOpenClawPlugins as t, loadSessionEntry as tn, resolveTtsApiKey as tr, rejectNodePairing as tt, guardCancel as u, resolveCommitHash as un, setCommandLaneConcurrency as ur, parseVerboseOverride as ut, resolveControlUiLinks as v, resolveHeartbeatDeliveryTarget as vn, resolveHeartbeatPrompt as vr, DEFAULT_INPUT_PDF_MAX_PIXELS as vt, normalizeControlUiBasePath as w, CHANNEL_MESSAGE_ACTION_NAMES as wn, resolveUserTimezone as wr, formatZonedTimestamp as wt, waitForGatewayReachable as x, resolveSessionDeliveryTarget as xn, normalizePollInput as xr, extractFileContentFromSource as xt, resolveNodeManagerOptions as y, resolveHeartbeatSenderContext as yn, stripHeartbeatToken as yr, DEFAULT_INPUT_PDF_MIN_TEXT_CHARS as yt, dispatchInboundMessage as z, normalizeCronJobCreate as zn, clearAgentRunContext as zt };
|