@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
package/dist/extensionAPI.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { a as resolveOAuthDir, i as resolveGatewayPort, n as resolveConfigPath, s as resolveStateDir, t as STATE_DIR } from "./paths-
|
|
2
|
-
import { A as normalizeAccountId$3, D as buildAgentMainSessionKey, E as DEFAULT_MAIN_KEY, F as sanitizeAgentId, I as isAcpSessionKey, L as isSubagentSessionKey, M as normalizeMainKey, N as resolveAgentIdFromSessionKey, O as buildAgentPeerSessionKey, P as resolveThreadSessionKeys, R as parseAgentSessionKey, S as resolveOpenClawPackageRoot, T as DEFAULT_AGENT_ID, b as filterBootstrapFilesForSession, c as resolveDefaultAgentId, f as DEFAULT_AGENT_WORKSPACE_DIR, i as resolveAgentModelFallbacksOverride, j as normalizeAgentId, k as buildGroupHistoryKey, 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, w as DEFAULT_ACCOUNT_ID$1, x as loadWorkspaceBootstrapFiles, y as ensureAgentWorkspace, z as resolveThreadParentSessionKey } from "./agent-scope-
|
|
3
|
-
import { A as normalizeE164, B as danger, C as CONFIG_DIR, D as formatTerminalLink, E as ensureDir$3, F as shortenHomePath, G as success, H as logVerbose, I as sleep, J as isRich, K as warn, L as sliceUtf16Safe, M as resolveJidToE164, N as resolveUserPath, O as isSelfChatMode, P as shortenHomeInString, Q as normalizeLogLevel, R as toWhatsappJid, S as setActivePluginRegistry, U as setVerbose, V as info, W as shouldLogVerbose, X as getChildLogger, Y as theme, _ as normalizeAnyChannelId, a as logDebug, b as getActivePluginRegistry, c as logWarn, d as clearActiveProgressLine, f as registerActiveProgressLine, h as CHAT_CHANNEL_ORDER, i as spawnWithFallback, k as jidToE164, l as createSubsystemLogger, n as runExec, o as logError, p as unregisterActiveProgressLine, q as colorize, r as formatSpawnError, s as logInfo, t as runCommandWithTimeout, u as defaultRuntime, v as normalizeChannelId, w as clampInt, x as requireActivePluginRegistry, z as truncateUtf16Safe } from "./exec-
|
|
4
|
-
import {
|
|
5
|
-
import { a as saveJsonFile, i as loadJsonFile } from "./github-copilot-token-
|
|
6
|
-
import { n as resolveCliName, t as formatCliCommand } from "./command-format-
|
|
7
|
-
import { A as
|
|
8
|
-
import { $ as
|
|
9
|
-
import { A as getWebAuthAgeMs, C as getConfigValueAtPath, D as resolveAgentMaxConcurrent, E as unsetConfigValueAtPath, M as logoutWeb, O as VERSION, P as readWebSelfId, R as webAuthExists, S as unsetConfigOverride, T as setConfigValueAtPath, _ as resolveEnableState, a as validateConfigObjectWithPlugins, b as resetConfigOverrides, c as resolveTelegramCustomCommands, d as validateJsonSchemaValue, f as loadPluginManifestRegistry, g as normalizePluginsConfig, i as writeConfigFile, j as logWebSelfId, k as resolveWhatsAppAccount, l as isSafeExecutableValue, n as readConfigFileSnapshot, o as TELEGRAM_COMMAND_NAME_PATTERN, p as discoverOpenClawPlugins, r as resolveConfigSnapshotHash, s as normalizeTelegramCommandName, t as loadConfig, u as parseDurationMs, v as resolveMemorySlotDecision, w as parseConfigPath, x as setConfigOverride, y as getConfigOverrides } from "./config-
|
|
10
|
-
import {
|
|
11
|
-
import { C as DEFAULT_AI_SNAPSHOT_MAX_CHARS, _ as rawDataToString, b as formatUncaughtError, h as ensureChromeExtensionRelayServer, v as extractErrorCode, y as formatErrorMessage$1 } from "./chrome-
|
|
12
|
-
import { a as resolveStorePath, i as resolveSessionTranscriptsDirForAgent, n as resolveSessionFilePath, r as resolveSessionTranscriptPath } from "./paths-
|
|
13
|
-
import { t as emitSessionTranscriptUpdate } from "./transcript-events-
|
|
14
|
-
import { _ as
|
|
15
|
-
import { i as resolveMemorySearchConfig, n as resolveRetryConfig, r as retryAsync } from "./manager-
|
|
16
|
-
import { c as listMemoryFiles, l as normalizeExtraMemoryPaths } from "./sqlite-
|
|
17
|
-
import { t as redactSensitiveText } from "./redact-
|
|
18
|
-
import { a as
|
|
1
|
+
import { a as resolveOAuthDir, i as resolveGatewayPort, n as resolveConfigPath, s as resolveStateDir, t as STATE_DIR } from "./paths-B1kfl4h5.js";
|
|
2
|
+
import { A as normalizeAccountId$3, D as buildAgentMainSessionKey, E as DEFAULT_MAIN_KEY, F as sanitizeAgentId, I as isAcpSessionKey, L as isSubagentSessionKey, M as normalizeMainKey, N as resolveAgentIdFromSessionKey, O as buildAgentPeerSessionKey, P as resolveThreadSessionKeys, R as parseAgentSessionKey, S as resolveOpenClawPackageRoot, T as DEFAULT_AGENT_ID, b as filterBootstrapFilesForSession, c as resolveDefaultAgentId, f as DEFAULT_AGENT_WORKSPACE_DIR, i as resolveAgentModelFallbacksOverride, j as normalizeAgentId, k as buildGroupHistoryKey, 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, w as DEFAULT_ACCOUNT_ID$1, x as loadWorkspaceBootstrapFiles, y as ensureAgentWorkspace, z as resolveThreadParentSessionKey } from "./agent-scope-Csu2B6AM.js";
|
|
3
|
+
import { A as normalizeE164, B as danger, C as CONFIG_DIR, D as formatTerminalLink, E as ensureDir$3, F as shortenHomePath, G as success, H as logVerbose, I as sleep, J as isRich, K as warn, L as sliceUtf16Safe, M as resolveJidToE164, N as resolveUserPath, O as isSelfChatMode, P as shortenHomeInString, Q as normalizeLogLevel, R as toWhatsappJid, S as setActivePluginRegistry, U as setVerbose, V as info, W as shouldLogVerbose, X as getChildLogger, Y as theme, _ as normalizeAnyChannelId, a as logDebug, b as getActivePluginRegistry, c as logWarn, d as clearActiveProgressLine, f as registerActiveProgressLine, h as CHAT_CHANNEL_ORDER, i as spawnWithFallback, k as jidToE164, l as createSubsystemLogger, n as runExec, o as logError, p as unregisterActiveProgressLine, q as colorize, r as formatSpawnError, s as logInfo, t as runCommandWithTimeout, u as defaultRuntime, v as normalizeChannelId, w as clampInt, x as requireActivePluginRegistry, z as truncateUtf16Safe } from "./exec-BMnoMcZW.js";
|
|
4
|
+
import { B as resolveOpenClawAgentDir, C as getShellPathFromLoginShell, F as resolveApiKeyForProfile, H as DEFAULT_CONTEXT_TOKENS, I as listProfilesForProvider, L as markAuthProfileGood, M as isProfileInCooldown, N as markAuthProfileFailure, O as isTruthyEnvValue, P as markAuthProfileUsed, R as ensureAuthProfileStore, S as resolveModelAuthMode, T as resolveShellEnvFallbackTimeoutMs, U as DEFAULT_MODEL, V as resolveAuthProfileDisplayLabel, W as DEFAULT_PROVIDER, _ as getApiKeyForModel, a as modelKey, b as resolveApiKeyForProvider, c as resolveConfiguredModelRef, d as resolveThinkingDefault, f as normalizeGoogleModelId, i as isCliProvider, j as resolveAuthProfileOrder, k as parseBooleanValue$1, l as resolveDefaultModelForAgent, n as buildConfiguredAllowlistKeys, o as normalizeProviderId, r as buildModelAliasIndex, t as buildAllowedModelSet, u as resolveModelRefFromString, v as getCustomProviderApiKey, x as resolveEnvApiKey, y as requireApiKey, z as resolveAuthStorePathForDisplay } from "./model-selection-mzTqrNoj.js";
|
|
5
|
+
import { a as saveJsonFile, i as loadJsonFile } from "./github-copilot-token-B3SA95yo.js";
|
|
6
|
+
import { n as resolveCliName, t as formatCliCommand } from "./command-format-CFzL448l.js";
|
|
7
|
+
import { A as MediaFetchError, B as resolveTextChunkLimit, C as resolveFetch, D as markdownToIRWithMeta, E as markdownToIR, F as chunkMarkdownText, G as SILENT_REPLY_TOKEN, H as isSafeFenceBreak, I as chunkMarkdownTextWithMode, K as isSilentReplyText, L as chunkText, M as fetchWithSsrFGuard, N as resolveMarkdownTableMode, O as loadWebMedia, P as chunkByNewline, R as chunkTextWithMode, S as parseInlineDirectives$1, T as chunkMarkdownIR, U as parseFenceSpans, V as findFenceSpanAt, W as HEARTBEAT_TOKEN, _ as buildTargetResolverSignature, a as applyReplyThreading, b as parseReplyDirectives, c as shouldSuppressMessagingToolReplies, d as sendMessageSignal, f as sendReadReceiptSignal, g as streamSignalEvents, h as signalRpcRequest, i as applyReplyTagsToPayload, j as fetchRemoteMedia, k as loadWebMediaRaw, l as createReplyToModeFilterForChannel, m as signalCheck, o as filterMessagingToolDuplicates, p as sendTypingSignal, r as normalizeReplyPayloadsForDelivery, s as isRenderablePayload, t as deliverOutboundPayloads, u as resolveReplyToMode, v as normalizeChannelTargetInput, w as wrapFetchWithAbortSignal, x as splitMediaFromOutput, y as normalizeTargetForProvider, z as resolveChunkMode } from "./deliver-CZPhTA7x.js";
|
|
8
|
+
import { $ as updateSessionStoreEntry, $t as normalizeToolName, A as isCloudCodeAssistFormatError, An as listChannelPlugins, B as parseImageSizeError, Bn as resolveSlackAppToken, Bt as buildWorkspaceSkillCommandSpecs, C as BILLING_ERROR_USER_MESSAGE, Cn as kindFromMime, Ct as resolveGroupSessionKey, D as getApiErrorPayloadFingerprint, Dn as listEnabledSignalAccounts, Dt as resolveProfile, E as formatRawAssistantErrorForUi, En as mediaKindFromMime, Et as resolveBrowserConfig, F as isLikelyContextOverflowError, Fn as listTelegramAccountIds, Ft as SsrFBlockedError, G as appendAssistantMessageToSessionTranscript, Gn as normalizeDiscordToken, Gt as applySkillEnvOverrides, H as ensureSandboxWorkspaceForSession, Hn as normalizeChatType, Ht as loadWorkspaceSkillEntries, I as isRateLimitAssistantError, In as resolveTelegramAccount, J as readSessionUpdatedAt, Jt as applyOwnerOnlyToolPolicy, Kt as applySkillEnvOverridesFromSnapshot, L as isRawApiErrorPayload, Ln as resolveTelegramToken, M as isContextOverflowError, Mn as isWhatsAppGroupJid, Mt as resizeToJpeg, N as isFailoverAssistantError, Nn as normalizeWhatsAppTarget, Nt as getMediaDir, O as isAuthAssistantError, On as resolveSignalAccount, P as isFailoverErrorMessage, Pn as listEnabledTelegramAccounts, Pt as saveMediaBuffer, Q as updateSessionStore, Qt as expandToolGroups, R as isTimeoutErrorMessage, Rn as listBindings, S as isGoogleModelApi, Sn as isGifMedia, St as resolveConversationLabel, T as formatAssistantErrorText, Tt as registerBrowserRoutes, U as resolveSandboxContext, Un as listEnabledDiscordAccounts, Ut as resolveSkillsPromptForRun, V as sanitizeUserFacingText, Vn as resolveSlackBotToken, Vt as buildWorkspaceSkillSnapshot, W as resolveSandboxRuntimeStatus, Wn as resolveDiscordAccount, Wt as resolvePluginSkillDirs, X as saveSessionStore, Xt as collectExplicitAllowlist, Y as recordSessionMetaFromInbound, Yt as buildPluginToolGroups, Z as updateLastRoute, Zt as expandPolicyWithPluginGroups, _ as sanitizeSessionMessagesImages, _n as detectMime, _t as listChannelDocks, a as formatXHighModelHint, an as sanitizeGoogleTurnOrdering, at as normalizeDeliveryContext, b as downgradeOpenAIReasoningBlocks, bn as imageMimeFromFormat, bt as resolveChannelGroupToolsPolicy, c as normalizeReasoningLevel, cn as isInternalMessageChannel, ct as evaluateSessionFreshness, d as normalizeVerboseLevel, dn as normalizeMessageChannel, dt as resolveSessionResetType, en as resolveToolProfilePolicy, et as isCacheEnabled, f as resolveResponseUsageMode, fn as resolveGatewayMessageChannel, ft as resolveThreadFlag, g as normalizeTextForComparison, gn as GATEWAY_CLIENT_NAMES, gt as getChannelDock, h as isMessagingToolDuplicateNormalized, hn as GATEWAY_CLIENT_MODES, ht as deriveSessionMetaPatch, i as formatThinkingLevels, in as resolveBootstrapMaxChars, it as mergeDeliveryContext, j as isCompactionFailureError, jn as normalizeChannelId$1, k as isBillingAssistantError, kn as getChannelPlugin, kt as getImageMetadata, l as normalizeThinkLevel, ln as isMarkdownCapableMessageChannel, lt as resolveChannelResetConfig, mn as GATEWAY_CLIENT_IDS, mt as resolveMainSessionKey, n as validateGeminiTurns, nn as buildBootstrapContextFiles, nt as deliveryContextFromSession, o as listThinkingLevels, on as INTERNAL_MESSAGE_CHANNEL, ot as normalizeSessionDeliveryFields, p as supportsXHighThinking, pn as resolveMessageChannel, pt as DEFAULT_RESET_TRIGGERS, q as loadSessionStore, qt as resolveSandboxConfigForAgent, r as pickFallbackThinkingLevel, rn as ensureSessionHeader, rt as deliveryContextKey, s as normalizeElevatedLevel, sn as isDeliverableMessageChannel, st as resolveSessionKey$1, t as validateAnthropicTurns, tn as stripPluginOnlyAllowlist, tt as resolveCacheTtlMs$1, u as normalizeUsageDisplay, un as listDeliverableMessageChannels, ut as resolveSessionResetPolicy, v as sanitizeImageBlocks, vn as extensionForMime, vt as resolveChannelGroupPolicy, w as classifyFailoverReason, wn as MAX_IMAGE_BYTES, wt as createBrowserRouteContext, x as isAntigravityClaude, xn as isAudioFileName, xt as resolveIMessageAccount, y as sanitizeToolResultImages, yn as getFileExtension, yt as resolveChannelGroupRequireMention, z as parseImageDimensionError, zn as resolveSlackAccount } from "./pi-embedded-helpers-BxqZh6U7.js";
|
|
9
|
+
import { A as getWebAuthAgeMs, C as getConfigValueAtPath, D as resolveAgentMaxConcurrent, E as unsetConfigValueAtPath, M as logoutWeb, O as VERSION, P as readWebSelfId, R as webAuthExists, S as unsetConfigOverride, T as setConfigValueAtPath, _ as resolveEnableState, a as validateConfigObjectWithPlugins, b as resetConfigOverrides, c as resolveTelegramCustomCommands, d as validateJsonSchemaValue, f as loadPluginManifestRegistry, g as normalizePluginsConfig, i as writeConfigFile, j as logWebSelfId, k as resolveWhatsAppAccount, l as isSafeExecutableValue, n as readConfigFileSnapshot, o as TELEGRAM_COMMAND_NAME_PATTERN, p as discoverOpenClawPlugins, r as resolveConfigSnapshotHash, s as normalizeTelegramCommandName, t as loadConfig, u as parseDurationMs, v as resolveMemorySlotDecision, w as parseConfigPath, x as setConfigOverride, y as getConfigOverrides } from "./config-CG73z4h6.js";
|
|
10
|
+
import { n as discoverModels, t as discoverAuthStorage } from "./pi-model-discovery-EhM2JAQo.js";
|
|
11
|
+
import { C as DEFAULT_AI_SNAPSHOT_MAX_CHARS, _ as rawDataToString, b as formatUncaughtError, h as ensureChromeExtensionRelayServer, v as extractErrorCode, y as formatErrorMessage$1 } from "./chrome-B3IuUad-.js";
|
|
12
|
+
import { a as resolveStorePath, i as resolveSessionTranscriptsDirForAgent, n as resolveSessionFilePath, r as resolveSessionTranscriptPath } from "./paths-B4kigINg.js";
|
|
13
|
+
import { t as emitSessionTranscriptUpdate } from "./transcript-events-JLH5W4He.js";
|
|
14
|
+
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 resolveToolDisplay, y as ensureOpenClawModelsJson } from "./image-CgBndiQy.js";
|
|
15
|
+
import { i as resolveMemorySearchConfig, n as resolveRetryConfig, r as retryAsync } from "./manager-C4ILl-d3.js";
|
|
16
|
+
import { c as listMemoryFiles, l as normalizeExtraMemoryPaths } from "./sqlite-Dnmf3LS7.js";
|
|
17
|
+
import { t as redactSensitiveText } from "./redact-BIMJ3ntQ.js";
|
|
18
|
+
import { a as formatError$1, i as createWaSocket, n as startWebLoginWithQr, o as getStatusCode$1, r as waitForWebLogin, s as waitForWaConnection } from "./login-qr-CcOWO_dR.js";
|
|
19
19
|
import { createRequire } from "node:module";
|
|
20
20
|
import * as os$1 from "node:os";
|
|
21
21
|
import os, { homedir, tmpdir } from "node:os";
|
|
@@ -85,7 +85,26 @@ function resolveMessagePrefix(cfg, agentId, opts) {
|
|
|
85
85
|
if (opts?.hasAllowFrom === true) return "";
|
|
86
86
|
return resolveIdentityNamePrefix(cfg, agentId) ?? opts?.fallback ?? "[openclaw]";
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
/** Helper to extract a channel config value by dynamic key. */
|
|
89
|
+
function getChannelConfig(cfg, channel) {
|
|
90
|
+
const value = cfg.channels?.[channel];
|
|
91
|
+
return typeof value === "object" && value !== null ? value : void 0;
|
|
92
|
+
}
|
|
93
|
+
function resolveResponsePrefix(cfg, agentId, opts) {
|
|
94
|
+
if (opts?.channel && opts?.accountId) {
|
|
95
|
+
const accountPrefix = (getChannelConfig(cfg, opts.channel)?.accounts)?.[opts.accountId]?.responsePrefix;
|
|
96
|
+
if (accountPrefix !== void 0) {
|
|
97
|
+
if (accountPrefix === "auto") return resolveIdentityNamePrefix(cfg, agentId);
|
|
98
|
+
return accountPrefix;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (opts?.channel) {
|
|
102
|
+
const channelPrefix = getChannelConfig(cfg, opts.channel)?.responsePrefix;
|
|
103
|
+
if (channelPrefix !== void 0) {
|
|
104
|
+
if (channelPrefix === "auto") return resolveIdentityNamePrefix(cfg, agentId);
|
|
105
|
+
return channelPrefix;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
89
108
|
const configured = cfg.messages?.responsePrefix;
|
|
90
109
|
if (configured !== void 0) {
|
|
91
110
|
if (configured === "auto") return resolveIdentityNamePrefix(cfg, agentId);
|
|
@@ -98,7 +117,10 @@ function resolveEffectiveMessagesConfig(cfg, agentId, opts) {
|
|
|
98
117
|
hasAllowFrom: opts?.hasAllowFrom,
|
|
99
118
|
fallback: opts?.fallbackMessagePrefix
|
|
100
119
|
}),
|
|
101
|
-
responsePrefix: resolveResponsePrefix(cfg, agentId
|
|
120
|
+
responsePrefix: resolveResponsePrefix(cfg, agentId, {
|
|
121
|
+
channel: opts?.channel,
|
|
122
|
+
accountId: opts?.accountId
|
|
123
|
+
})
|
|
102
124
|
};
|
|
103
125
|
}
|
|
104
126
|
function resolveHumanDelayConfig(cfg, agentId) {
|
|
@@ -942,6 +964,40 @@ function normalizeModelCompat(model) {
|
|
|
942
964
|
|
|
943
965
|
//#endregion
|
|
944
966
|
//#region src/agents/pi-embedded-runner/model.ts
|
|
967
|
+
const OPENAI_CODEX_GPT_53_MODEL_ID = "gpt-5.3-codex";
|
|
968
|
+
const OPENAI_CODEX_TEMPLATE_MODEL_IDS = ["gpt-5.2-codex"];
|
|
969
|
+
function resolveOpenAICodexGpt53FallbackModel(provider, modelId, modelRegistry) {
|
|
970
|
+
const normalizedProvider = normalizeProviderId(provider);
|
|
971
|
+
const trimmedModelId = modelId.trim();
|
|
972
|
+
if (normalizedProvider !== "openai-codex") return;
|
|
973
|
+
if (trimmedModelId.toLowerCase() !== OPENAI_CODEX_GPT_53_MODEL_ID) return;
|
|
974
|
+
for (const templateId of OPENAI_CODEX_TEMPLATE_MODEL_IDS) {
|
|
975
|
+
const template = modelRegistry.find(normalizedProvider, templateId);
|
|
976
|
+
if (!template) continue;
|
|
977
|
+
return normalizeModelCompat({
|
|
978
|
+
...template,
|
|
979
|
+
id: trimmedModelId,
|
|
980
|
+
name: trimmedModelId
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
return normalizeModelCompat({
|
|
984
|
+
id: trimmedModelId,
|
|
985
|
+
name: trimmedModelId,
|
|
986
|
+
api: "openai-codex-responses",
|
|
987
|
+
provider: normalizedProvider,
|
|
988
|
+
baseUrl: "https://chatgpt.com/backend-api",
|
|
989
|
+
reasoning: true,
|
|
990
|
+
input: ["text", "image"],
|
|
991
|
+
cost: {
|
|
992
|
+
input: 0,
|
|
993
|
+
output: 0,
|
|
994
|
+
cacheRead: 0,
|
|
995
|
+
cacheWrite: 0
|
|
996
|
+
},
|
|
997
|
+
contextWindow: DEFAULT_CONTEXT_TOKENS,
|
|
998
|
+
maxTokens: DEFAULT_CONTEXT_TOKENS
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
945
1001
|
function buildInlineProviderModels(providers) {
|
|
946
1002
|
return Object.entries(providers).flatMap(([providerId, entry]) => {
|
|
947
1003
|
const trimmed = providerId.trim();
|
|
@@ -984,6 +1040,12 @@ function resolveModel$4(provider, modelId, agentDir, cfg) {
|
|
|
984
1040
|
authStorage,
|
|
985
1041
|
modelRegistry
|
|
986
1042
|
};
|
|
1043
|
+
const codexForwardCompat = resolveOpenAICodexGpt53FallbackModel(provider, modelId, modelRegistry);
|
|
1044
|
+
if (codexForwardCompat) return {
|
|
1045
|
+
model: codexForwardCompat,
|
|
1046
|
+
authStorage,
|
|
1047
|
+
modelRegistry
|
|
1048
|
+
};
|
|
987
1049
|
const providerCfg = providers[provider];
|
|
988
1050
|
if (providerCfg || modelId.startsWith("mock-")) return {
|
|
989
1051
|
model: normalizeModelCompat({
|
|
@@ -3379,7 +3441,7 @@ async function getMemorySearchManager(params) {
|
|
|
3379
3441
|
const cached = QMD_MANAGER_CACHE.get(cacheKey);
|
|
3380
3442
|
if (cached) return { manager: cached };
|
|
3381
3443
|
try {
|
|
3382
|
-
const { QmdMemoryManager } = await import("./qmd-manager-
|
|
3444
|
+
const { QmdMemoryManager } = await import("./qmd-manager-CF52nuBg.js");
|
|
3383
3445
|
const primary = await QmdMemoryManager.create({
|
|
3384
3446
|
cfg: params.cfg,
|
|
3385
3447
|
agentId: params.agentId,
|
|
@@ -3389,7 +3451,7 @@ async function getMemorySearchManager(params) {
|
|
|
3389
3451
|
const wrapper = new FallbackMemoryManager({
|
|
3390
3452
|
primary,
|
|
3391
3453
|
fallbackFactory: async () => {
|
|
3392
|
-
const { MemoryIndexManager } = await import("./manager-
|
|
3454
|
+
const { MemoryIndexManager } = await import("./manager-C4ILl-d3.js").then((n) => n.t);
|
|
3393
3455
|
return await MemoryIndexManager.get(params);
|
|
3394
3456
|
}
|
|
3395
3457
|
}, () => QMD_MANAGER_CACHE.delete(cacheKey));
|
|
@@ -3402,7 +3464,7 @@ async function getMemorySearchManager(params) {
|
|
|
3402
3464
|
}
|
|
3403
3465
|
}
|
|
3404
3466
|
try {
|
|
3405
|
-
const { MemoryIndexManager } = await import("./manager-
|
|
3467
|
+
const { MemoryIndexManager } = await import("./manager-C4ILl-d3.js").then((n) => n.t);
|
|
3406
3468
|
return { manager: await MemoryIndexManager.get(params) };
|
|
3407
3469
|
} catch (err) {
|
|
3408
3470
|
return {
|
|
@@ -6817,6 +6879,13 @@ const SessionsCompactParamsSchema = Type.Object({
|
|
|
6817
6879
|
key: NonEmptyString,
|
|
6818
6880
|
maxLines: Type.Optional(Type.Integer({ minimum: 1 }))
|
|
6819
6881
|
}, { additionalProperties: false });
|
|
6882
|
+
const SessionsUsageParamsSchema = Type.Object({
|
|
6883
|
+
key: Type.Optional(NonEmptyString),
|
|
6884
|
+
startDate: Type.Optional(Type.String({ pattern: "^\\d{4}-\\d{2}-\\d{2}$" })),
|
|
6885
|
+
endDate: Type.Optional(Type.String({ pattern: "^\\d{4}-\\d{2}-\\d{2}$" })),
|
|
6886
|
+
limit: Type.Optional(Type.Integer({ minimum: 1 })),
|
|
6887
|
+
includeContextWeight: Type.Optional(Type.Boolean())
|
|
6888
|
+
}, { additionalProperties: false });
|
|
6820
6889
|
|
|
6821
6890
|
//#endregion
|
|
6822
6891
|
//#region src/gateway/protocol/schema/wizard.ts
|
|
@@ -6934,6 +7003,7 @@ const validateSessionsPatchParams = ajv.compile(SessionsPatchParamsSchema);
|
|
|
6934
7003
|
const validateSessionsResetParams = ajv.compile(SessionsResetParamsSchema);
|
|
6935
7004
|
const validateSessionsDeleteParams = ajv.compile(SessionsDeleteParamsSchema);
|
|
6936
7005
|
const validateSessionsCompactParams = ajv.compile(SessionsCompactParamsSchema);
|
|
7006
|
+
const validateSessionsUsageParams = ajv.compile(SessionsUsageParamsSchema);
|
|
6937
7007
|
const validateConfigGetParams = ajv.compile(ConfigGetParamsSchema);
|
|
6938
7008
|
const validateConfigSetParams = ajv.compile(ConfigSetParamsSchema);
|
|
6939
7009
|
const validateConfigApplyParams = ajv.compile(ConfigApplyParamsSchema);
|
|
@@ -7246,6 +7316,22 @@ var GatewayClient = class {
|
|
|
7246
7316
|
|
|
7247
7317
|
//#endregion
|
|
7248
7318
|
//#region src/gateway/call.ts
|
|
7319
|
+
function resolveExplicitGatewayAuth(opts) {
|
|
7320
|
+
return {
|
|
7321
|
+
token: typeof opts?.token === "string" && opts.token.trim().length > 0 ? opts.token.trim() : void 0,
|
|
7322
|
+
password: typeof opts?.password === "string" && opts.password.trim().length > 0 ? opts.password.trim() : void 0
|
|
7323
|
+
};
|
|
7324
|
+
}
|
|
7325
|
+
function ensureExplicitGatewayAuth(params) {
|
|
7326
|
+
if (!params.urlOverride) return;
|
|
7327
|
+
if (params.auth.token || params.auth.password) return;
|
|
7328
|
+
const message = [
|
|
7329
|
+
"gateway url override requires explicit credentials",
|
|
7330
|
+
params.errorHint,
|
|
7331
|
+
params.configPath ? `Config: ${params.configPath}` : void 0
|
|
7332
|
+
].filter(Boolean).join("\n");
|
|
7333
|
+
throw new Error(message);
|
|
7334
|
+
}
|
|
7249
7335
|
function buildGatewayConnectionDetails(options = {}) {
|
|
7250
7336
|
const config = options.config ?? loadConfig();
|
|
7251
7337
|
const configPath = options.configPath ?? resolveConfigPath(process.env, resolveStateDir(process.env));
|
|
@@ -7285,6 +7371,16 @@ async function callGateway(opts) {
|
|
|
7285
7371
|
const isRemoteMode = config.gateway?.mode === "remote";
|
|
7286
7372
|
const remote = isRemoteMode ? config.gateway?.remote : void 0;
|
|
7287
7373
|
const urlOverride = typeof opts.url === "string" && opts.url.trim().length > 0 ? opts.url.trim() : void 0;
|
|
7374
|
+
const explicitAuth = resolveExplicitGatewayAuth({
|
|
7375
|
+
token: opts.token,
|
|
7376
|
+
password: opts.password
|
|
7377
|
+
});
|
|
7378
|
+
ensureExplicitGatewayAuth({
|
|
7379
|
+
urlOverride,
|
|
7380
|
+
auth: explicitAuth,
|
|
7381
|
+
errorHint: "Fix: pass --token or --password (or gatewayToken in tools).",
|
|
7382
|
+
configPath: opts.configPath ?? resolveConfigPath(process.env, resolveStateDir(process.env))
|
|
7383
|
+
});
|
|
7288
7384
|
const remoteUrl = typeof remote?.url === "string" && remote.url.trim().length > 0 ? remote.url.trim() : void 0;
|
|
7289
7385
|
if (isRemoteMode && !urlOverride && !remoteUrl) {
|
|
7290
7386
|
const configPath = opts.configPath ?? resolveConfigPath(process.env, resolveStateDir(process.env));
|
|
@@ -7305,8 +7401,8 @@ async function callGateway(opts) {
|
|
|
7305
7401
|
const tlsRuntime = config.gateway?.tls?.enabled === true && !urlOverride && !remoteUrl && url.startsWith("wss://") ? await loadGatewayTlsRuntime(config.gateway?.tls) : void 0;
|
|
7306
7402
|
const remoteTlsFingerprint = isRemoteMode && !urlOverride && remoteUrl && typeof remote?.tlsFingerprint === "string" ? remote.tlsFingerprint.trim() : void 0;
|
|
7307
7403
|
const tlsFingerprint = (typeof opts.tlsFingerprint === "string" ? opts.tlsFingerprint.trim() : void 0) || remoteTlsFingerprint || (tlsRuntime?.enabled ? tlsRuntime.fingerprintSha256 : void 0);
|
|
7308
|
-
const token =
|
|
7309
|
-
const password =
|
|
7404
|
+
const token = explicitAuth.token || (!urlOverride ? isRemoteMode ? typeof remote?.token === "string" && remote.token.trim().length > 0 ? remote.token.trim() : void 0 : process.env.OPENCLAW_GATEWAY_TOKEN?.trim() || process.env.CLAWDBOT_GATEWAY_TOKEN?.trim() || (typeof authToken === "string" && authToken.trim().length > 0 ? authToken.trim() : void 0) : void 0);
|
|
7405
|
+
const password = explicitAuth.password || (!urlOverride ? process.env.OPENCLAW_GATEWAY_PASSWORD?.trim() || process.env.CLAWDBOT_GATEWAY_PASSWORD?.trim() || (isRemoteMode ? typeof remote?.password === "string" && remote.password.trim().length > 0 ? remote.password.trim() : void 0 : typeof authPassword === "string" && authPassword.trim().length > 0 ? authPassword.trim() : void 0) : void 0);
|
|
7310
7406
|
const formatCloseError = (code, reason) => {
|
|
7311
7407
|
const reasonText = reason?.trim() || "no close reason";
|
|
7312
7408
|
const hint = code === 1006 ? "abnormal closure (no close frame)" : code === 1e3 ? "normal closure" : "";
|
|
@@ -8806,12 +8902,12 @@ function resolveResponsePrefixTemplate(template, context) {
|
|
|
8806
8902
|
*
|
|
8807
8903
|
* Strips:
|
|
8808
8904
|
* - Provider prefix (e.g., "openai/" from "openai/gpt-5.2")
|
|
8809
|
-
* - Date suffixes (e.g., "-
|
|
8905
|
+
* - Date suffixes (e.g., "-20260205" from "claude-opus-4-6-20260205")
|
|
8810
8906
|
* - Common version suffixes (e.g., "-latest")
|
|
8811
8907
|
*
|
|
8812
8908
|
* @example
|
|
8813
8909
|
* extractShortModelName("openai-codex/gpt-5.2") // "gpt-5.2"
|
|
8814
|
-
* extractShortModelName("claude-opus-4-
|
|
8910
|
+
* extractShortModelName("claude-opus-4-6-20260205") // "claude-opus-4-6"
|
|
8815
8911
|
* extractShortModelName("gpt-5.2-latest") // "gpt-5.2"
|
|
8816
8912
|
*/
|
|
8817
8913
|
function extractShortModelName(fullModel) {
|
|
@@ -8881,10 +8977,14 @@ function normalizeReplyPayload(payload, opts = {}) {
|
|
|
8881
8977
|
*/
|
|
8882
8978
|
async function routeReply(params) {
|
|
8883
8979
|
const { payload, channel, to, accountId, threadId, cfg, abortSignal } = params;
|
|
8980
|
+
const normalizedChannel = normalizeMessageChannel(channel);
|
|
8884
8981
|
const normalized = normalizeReplyPayload(payload, { responsePrefix: params.sessionKey ? resolveEffectiveMessagesConfig(cfg, resolveSessionAgentId({
|
|
8885
8982
|
sessionKey: params.sessionKey,
|
|
8886
8983
|
config: cfg
|
|
8887
|
-
})
|
|
8984
|
+
}), {
|
|
8985
|
+
channel: normalizedChannel,
|
|
8986
|
+
accountId
|
|
8987
|
+
}).responsePrefix : cfg.messages?.responsePrefix === "auto" ? void 0 : cfg.messages?.responsePrefix });
|
|
8888
8988
|
if (!normalized) return { ok: true };
|
|
8889
8989
|
let text = normalized.text ?? "";
|
|
8890
8990
|
let mediaUrls = (normalized.mediaUrls?.filter(Boolean) ?? []).length ? normalized.mediaUrls?.filter(Boolean) : normalized.mediaUrl ? [normalized.mediaUrl] : [];
|
|
@@ -8906,7 +9006,7 @@ async function routeReply(params) {
|
|
|
8906
9006
|
const resolvedReplyToId = replyToId ?? (channelId === "slack" && threadId != null && threadId !== "" ? String(threadId) : void 0);
|
|
8907
9007
|
const resolvedThreadId = channelId === "slack" ? null : threadId ?? null;
|
|
8908
9008
|
try {
|
|
8909
|
-
const { deliverOutboundPayloads } = await import("./deliver-
|
|
9009
|
+
const { deliverOutboundPayloads } = await import("./deliver-CZPhTA7x.js").then((n) => n.n);
|
|
8910
9010
|
return {
|
|
8911
9011
|
ok: true,
|
|
8912
9012
|
messageId: (await deliverOutboundPayloads({
|
|
@@ -10096,6 +10196,32 @@ function normalizeAllowFromEntry(params) {
|
|
|
10096
10196
|
allowFrom: [params.value]
|
|
10097
10197
|
}).filter((entry) => entry.trim().length > 0);
|
|
10098
10198
|
}
|
|
10199
|
+
function resolveOwnerAllowFromList(params) {
|
|
10200
|
+
const raw = params.allowFrom ?? params.cfg.commands?.ownerAllowFrom;
|
|
10201
|
+
if (!Array.isArray(raw) || raw.length === 0) return [];
|
|
10202
|
+
const filtered = [];
|
|
10203
|
+
for (const entry of raw) {
|
|
10204
|
+
const trimmed = String(entry ?? "").trim();
|
|
10205
|
+
if (!trimmed) continue;
|
|
10206
|
+
const separatorIndex = trimmed.indexOf(":");
|
|
10207
|
+
if (separatorIndex > 0) {
|
|
10208
|
+
const channel = normalizeAnyChannelId(trimmed.slice(0, separatorIndex));
|
|
10209
|
+
if (channel) {
|
|
10210
|
+
if (params.providerId && channel !== params.providerId) continue;
|
|
10211
|
+
const remainder = trimmed.slice(separatorIndex + 1).trim();
|
|
10212
|
+
if (remainder) filtered.push(remainder);
|
|
10213
|
+
continue;
|
|
10214
|
+
}
|
|
10215
|
+
}
|
|
10216
|
+
filtered.push(trimmed);
|
|
10217
|
+
}
|
|
10218
|
+
return formatAllowFromList({
|
|
10219
|
+
dock: params.dock,
|
|
10220
|
+
cfg: params.cfg,
|
|
10221
|
+
accountId: params.accountId,
|
|
10222
|
+
allowFrom: filtered
|
|
10223
|
+
});
|
|
10224
|
+
}
|
|
10099
10225
|
function resolveSenderCandidates(params) {
|
|
10100
10226
|
const { dock, cfg, accountId } = params;
|
|
10101
10227
|
const candidates = [];
|
|
@@ -10140,18 +10266,35 @@ function resolveCommandAuthorization(params) {
|
|
|
10140
10266
|
accountId: ctx.AccountId,
|
|
10141
10267
|
allowFrom: Array.isArray(allowFromRaw) ? allowFromRaw : []
|
|
10142
10268
|
});
|
|
10269
|
+
const configOwnerAllowFromList = resolveOwnerAllowFromList({
|
|
10270
|
+
dock,
|
|
10271
|
+
cfg,
|
|
10272
|
+
accountId: ctx.AccountId,
|
|
10273
|
+
providerId,
|
|
10274
|
+
allowFrom: cfg.commands?.ownerAllowFrom
|
|
10275
|
+
});
|
|
10276
|
+
const contextOwnerAllowFromList = resolveOwnerAllowFromList({
|
|
10277
|
+
dock,
|
|
10278
|
+
cfg,
|
|
10279
|
+
accountId: ctx.AccountId,
|
|
10280
|
+
providerId,
|
|
10281
|
+
allowFrom: ctx.OwnerAllowFrom
|
|
10282
|
+
});
|
|
10143
10283
|
const allowAll = allowFromList.length === 0 || allowFromList.some((entry) => entry.trim() === "*");
|
|
10144
|
-
const
|
|
10145
|
-
if (!allowAll &&
|
|
10284
|
+
const ownerCandidatesForCommands = allowAll ? [] : allowFromList.filter((entry) => entry !== "*");
|
|
10285
|
+
if (!allowAll && ownerCandidatesForCommands.length === 0 && to) {
|
|
10146
10286
|
const normalizedTo = normalizeAllowFromEntry({
|
|
10147
10287
|
dock,
|
|
10148
10288
|
cfg,
|
|
10149
10289
|
accountId: ctx.AccountId,
|
|
10150
10290
|
value: to
|
|
10151
10291
|
});
|
|
10152
|
-
if (normalizedTo.length > 0)
|
|
10292
|
+
if (normalizedTo.length > 0) ownerCandidatesForCommands.push(...normalizedTo);
|
|
10153
10293
|
}
|
|
10154
|
-
const
|
|
10294
|
+
const ownerAllowAll = configOwnerAllowFromList.some((entry) => entry.trim() === "*");
|
|
10295
|
+
const explicitOwners = configOwnerAllowFromList.filter((entry) => entry !== "*");
|
|
10296
|
+
const explicitOverrides = contextOwnerAllowFromList.filter((entry) => entry !== "*");
|
|
10297
|
+
const ownerList = Array.from(new Set(explicitOwners.length > 0 ? explicitOwners : ownerAllowAll ? [] : explicitOverrides.length > 0 ? explicitOverrides : ownerCandidatesForCommands));
|
|
10155
10298
|
const senderCandidates = resolveSenderCandidates({
|
|
10156
10299
|
dock,
|
|
10157
10300
|
providerId,
|
|
@@ -10162,13 +10305,18 @@ function resolveCommandAuthorization(params) {
|
|
|
10162
10305
|
from
|
|
10163
10306
|
});
|
|
10164
10307
|
const matchedSender = ownerList.length ? senderCandidates.find((candidate) => ownerList.includes(candidate)) : void 0;
|
|
10308
|
+
const matchedCommandOwner = ownerCandidatesForCommands.length ? senderCandidates.find((candidate) => ownerCandidatesForCommands.includes(candidate)) : void 0;
|
|
10165
10309
|
const senderId = matchedSender ?? senderCandidates[0];
|
|
10166
|
-
const
|
|
10310
|
+
const enforceOwner = Boolean(dock?.commands?.enforceOwnerForCommands);
|
|
10311
|
+
const senderIsOwner = Boolean(matchedSender);
|
|
10312
|
+
const ownerAllowlistConfigured = ownerAllowAll || explicitOwners.length > 0;
|
|
10313
|
+
const isOwnerForCommands = !(enforceOwner || ownerAllowlistConfigured) ? true : ownerAllowAll ? true : ownerAllowlistConfigured ? senderIsOwner : allowAll || ownerCandidatesForCommands.length === 0 || Boolean(matchedCommandOwner);
|
|
10167
10314
|
return {
|
|
10168
10315
|
providerId,
|
|
10169
10316
|
ownerList,
|
|
10170
10317
|
senderId: senderId || void 0,
|
|
10171
|
-
|
|
10318
|
+
senderIsOwner,
|
|
10319
|
+
isAuthorizedSender: commandAuthorized && isOwnerForCommands,
|
|
10172
10320
|
from: from || void 0,
|
|
10173
10321
|
to: to || void 0
|
|
10174
10322
|
};
|
|
@@ -12245,7 +12393,7 @@ function formatAudioTranscripts(outputs) {
|
|
|
12245
12393
|
//#region src/agents/model-catalog.ts
|
|
12246
12394
|
let modelCatalogPromise = null;
|
|
12247
12395
|
let hasLoggedModelCatalogError = false;
|
|
12248
|
-
const defaultImportPiSdk = () => import("./pi-model-discovery-
|
|
12396
|
+
const defaultImportPiSdk = () => import("./pi-model-discovery-EhM2JAQo.js").then((n) => n.r);
|
|
12249
12397
|
let importPiSdk = defaultImportPiSdk;
|
|
12250
12398
|
async function loadModelCatalog(params) {
|
|
12251
12399
|
if (params?.useCache === false) modelCatalogPromise = null;
|
|
@@ -12339,7 +12487,7 @@ const AUTO_IMAGE_KEY_PROVIDERS = [
|
|
|
12339
12487
|
const AUTO_VIDEO_KEY_PROVIDERS = ["google"];
|
|
12340
12488
|
const DEFAULT_IMAGE_MODELS = {
|
|
12341
12489
|
openai: "gpt-5-mini",
|
|
12342
|
-
anthropic: "claude-opus-4-
|
|
12490
|
+
anthropic: "claude-opus-4-6",
|
|
12343
12491
|
google: "gemini-3-flash-preview",
|
|
12344
12492
|
minimax: "MiniMax-VL-01"
|
|
12345
12493
|
};
|
|
@@ -14320,7 +14468,7 @@ async function resolveSessionAuthProfileOverride(params) {
|
|
|
14320
14468
|
const MODEL_CACHE = /* @__PURE__ */ new Map();
|
|
14321
14469
|
(async () => {
|
|
14322
14470
|
try {
|
|
14323
|
-
const { discoverAuthStorage, discoverModels } = await import("./pi-model-discovery-
|
|
14471
|
+
const { discoverAuthStorage, discoverModels } = await import("./pi-model-discovery-EhM2JAQo.js").then((n) => n.r);
|
|
14324
14472
|
await ensureOpenClawModelsJson(loadConfig());
|
|
14325
14473
|
const agentDir = resolveOpenClawAgentDir();
|
|
14326
14474
|
const models = discoverModels(discoverAuthStorage(agentDir), agentDir).getAll();
|
|
@@ -14534,7 +14682,7 @@ async function createModelSelectionState(params) {
|
|
|
14534
14682
|
}
|
|
14535
14683
|
}
|
|
14536
14684
|
if (sessionEntry && sessionStore && sessionKey && sessionEntry.authProfileOverride) {
|
|
14537
|
-
const { ensureAuthProfileStore } = await import("./
|
|
14685
|
+
const { ensureAuthProfileStore } = await import("./model-selection-mzTqrNoj.js").then((n) => n.A);
|
|
14538
14686
|
const profile = ensureAuthProfileStore(void 0, { allowKeychainPrompt: false }).profiles[sessionEntry.authProfileOverride];
|
|
14539
14687
|
const providerKey = normalizeProviderId(provider);
|
|
14540
14688
|
if (!profile || normalizeProviderId(profile.provider) !== providerKey) await clearSessionAuthProfileOverride({
|
|
@@ -15794,6 +15942,7 @@ function buildCommandContext(params) {
|
|
|
15794
15942
|
channel,
|
|
15795
15943
|
channelId: auth.providerId,
|
|
15796
15944
|
ownerList: auth.ownerList,
|
|
15945
|
+
senderIsOwner: auth.senderIsOwner,
|
|
15797
15946
|
isAuthorizedSender: auth.isAuthorizedSender,
|
|
15798
15947
|
senderId: auth.senderId,
|
|
15799
15948
|
abortKey,
|
|
@@ -16049,6 +16198,26 @@ function resolveDiscordUserAllowed(params) {
|
|
|
16049
16198
|
tag: params.userTag
|
|
16050
16199
|
});
|
|
16051
16200
|
}
|
|
16201
|
+
function resolveDiscordOwnerAllowFrom(params) {
|
|
16202
|
+
const rawAllowList = params.channelConfig?.users ?? params.guildInfo?.users;
|
|
16203
|
+
if (!Array.isArray(rawAllowList) || rawAllowList.length === 0) return;
|
|
16204
|
+
const allowList = normalizeDiscordAllowList(rawAllowList, [
|
|
16205
|
+
"discord:",
|
|
16206
|
+
"user:",
|
|
16207
|
+
"pk:"
|
|
16208
|
+
]);
|
|
16209
|
+
if (!allowList) return;
|
|
16210
|
+
const match = resolveDiscordAllowListMatch({
|
|
16211
|
+
allowList,
|
|
16212
|
+
candidate: {
|
|
16213
|
+
id: params.sender.id,
|
|
16214
|
+
name: params.sender.name,
|
|
16215
|
+
tag: params.sender.tag
|
|
16216
|
+
}
|
|
16217
|
+
});
|
|
16218
|
+
if (!match.allowed || !match.matchKey || match.matchKey === "*") return;
|
|
16219
|
+
return [match.matchKey];
|
|
16220
|
+
}
|
|
16052
16221
|
function resolveDiscordGuildEntry(params) {
|
|
16053
16222
|
const guild = params.guild;
|
|
16054
16223
|
const entries = params.guildEntries;
|
|
@@ -16093,6 +16262,7 @@ function resolveDiscordChannelConfigEntry(entry) {
|
|
|
16093
16262
|
enabled: entry.enabled,
|
|
16094
16263
|
users: entry.users,
|
|
16095
16264
|
systemPrompt: entry.systemPrompt,
|
|
16265
|
+
includeThreadStarter: entry.includeThreadStarter,
|
|
16096
16266
|
autoThread: entry.autoThread
|
|
16097
16267
|
};
|
|
16098
16268
|
}
|
|
@@ -17682,6 +17852,23 @@ function ensureDir$1(filePath) {
|
|
|
17682
17852
|
const dir = path.dirname(filePath);
|
|
17683
17853
|
fs.mkdirSync(dir, { recursive: true });
|
|
17684
17854
|
}
|
|
17855
|
+
function coerceAllowlistEntries(allowlist) {
|
|
17856
|
+
if (!Array.isArray(allowlist) || allowlist.length === 0) return Array.isArray(allowlist) ? allowlist : void 0;
|
|
17857
|
+
let changed = false;
|
|
17858
|
+
const result = [];
|
|
17859
|
+
for (const item of allowlist) if (typeof item === "string") {
|
|
17860
|
+
const trimmed = item.trim();
|
|
17861
|
+
if (trimmed) {
|
|
17862
|
+
result.push({ pattern: trimmed });
|
|
17863
|
+
changed = true;
|
|
17864
|
+
} else changed = true;
|
|
17865
|
+
} else if (item && typeof item === "object" && !Array.isArray(item)) {
|
|
17866
|
+
const pattern = item.pattern;
|
|
17867
|
+
if (typeof pattern === "string" && pattern.trim().length > 0) result.push(item);
|
|
17868
|
+
else changed = true;
|
|
17869
|
+
} else changed = true;
|
|
17870
|
+
return changed ? result.length > 0 ? result : void 0 : allowlist;
|
|
17871
|
+
}
|
|
17685
17872
|
function ensureAllowlistIds(allowlist) {
|
|
17686
17873
|
if (!Array.isArray(allowlist) || allowlist.length === 0) return allowlist;
|
|
17687
17874
|
let changed = false;
|
|
@@ -17706,7 +17893,7 @@ function normalizeExecApprovals(file) {
|
|
|
17706
17893
|
delete agents.default;
|
|
17707
17894
|
}
|
|
17708
17895
|
for (const [key, agent] of Object.entries(agents)) {
|
|
17709
|
-
const allowlist = ensureAllowlistIds(agent.allowlist);
|
|
17896
|
+
const allowlist = ensureAllowlistIds(coerceAllowlistEntries(agent.allowlist));
|
|
17710
17897
|
if (allowlist !== agent.allowlist) agents[key] = {
|
|
17711
17898
|
...agent,
|
|
17712
17899
|
allowlist
|
|
@@ -18658,6 +18845,8 @@ function buildNodeShellCommand(command, platform) {
|
|
|
18658
18845
|
//#endregion
|
|
18659
18846
|
//#region src/agents/sandbox-paths.ts
|
|
18660
18847
|
const UNICODE_SPACES$1 = /[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g;
|
|
18848
|
+
const HTTP_URL_RE = /^https?:\/\//i;
|
|
18849
|
+
const DATA_URL_RE = /^data:/i;
|
|
18661
18850
|
function normalizeUnicodeSpaces$1(str) {
|
|
18662
18851
|
return str.replace(UNICODE_SPACES$1, " ");
|
|
18663
18852
|
}
|
|
@@ -18691,6 +18880,26 @@ async function assertSandboxPath(params) {
|
|
|
18691
18880
|
await assertNoSymlink(resolved.relative, path.resolve(params.root));
|
|
18692
18881
|
return resolved;
|
|
18693
18882
|
}
|
|
18883
|
+
function assertMediaNotDataUrl(media) {
|
|
18884
|
+
const raw = media.trim();
|
|
18885
|
+
if (DATA_URL_RE.test(raw)) throw new Error("data: URLs are not supported for media. Use buffer instead.");
|
|
18886
|
+
}
|
|
18887
|
+
async function resolveSandboxedMediaSource(params) {
|
|
18888
|
+
const raw = params.media.trim();
|
|
18889
|
+
if (!raw) return raw;
|
|
18890
|
+
if (HTTP_URL_RE.test(raw)) return raw;
|
|
18891
|
+
let candidate = raw;
|
|
18892
|
+
if (/^file:\/\//i.test(candidate)) try {
|
|
18893
|
+
candidate = fileURLToPath(candidate);
|
|
18894
|
+
} catch {
|
|
18895
|
+
throw new Error(`Invalid file:// URL for sandboxed media: ${raw}`);
|
|
18896
|
+
}
|
|
18897
|
+
return (await assertSandboxPath({
|
|
18898
|
+
filePath: candidate,
|
|
18899
|
+
cwd: params.sandboxRoot,
|
|
18900
|
+
root: params.sandboxRoot
|
|
18901
|
+
})).resolved;
|
|
18902
|
+
}
|
|
18694
18903
|
async function assertNoSymlink(relative, root) {
|
|
18695
18904
|
if (!relative) return;
|
|
18696
18905
|
const parts = relative.split(path.sep).filter(Boolean);
|
|
@@ -21892,6 +22101,7 @@ const handleCompactCommand = async (params) => {
|
|
|
21892
22101
|
defaultLevel: "off"
|
|
21893
22102
|
},
|
|
21894
22103
|
customInstructions,
|
|
22104
|
+
senderIsOwner: params.command.senderIsOwner,
|
|
21895
22105
|
ownerNumbers: params.command.ownerList.length > 0 ? params.command.ownerList : void 0
|
|
21896
22106
|
});
|
|
21897
22107
|
const compactLabel = result.ok ? result.compacted ? result.result?.tokensBefore != null && result.result?.tokensAfter != null ? `Compacted (${formatTokenCount(result.result.tokensBefore)} → ${formatTokenCount(result.result.tokensAfter)})` : result.result?.tokensBefore ? `Compacted (${formatTokenCount(result.result.tokensBefore)} before)` : "Compacted" : "Compaction skipped" : "Compaction failed";
|
|
@@ -22858,6 +23068,7 @@ async function resolveContextReport(params) {
|
|
|
22858
23068
|
groupChannel: params.sessionEntry?.groupChannel ?? void 0,
|
|
22859
23069
|
groupSpace: params.sessionEntry?.space ?? void 0,
|
|
22860
23070
|
spawnedBy: params.sessionEntry?.spawnedBy ?? void 0,
|
|
23071
|
+
senderIsOwner: params.command.senderIsOwner,
|
|
22861
23072
|
modelProvider: params.provider,
|
|
22862
23073
|
modelId: params.model
|
|
22863
23074
|
});
|
|
@@ -23875,7 +24086,7 @@ const WINDOW_MINUTE_KEYS = [
|
|
|
23875
24086
|
"durationMinutes",
|
|
23876
24087
|
"minutes"
|
|
23877
24088
|
];
|
|
23878
|
-
function isRecord$
|
|
24089
|
+
function isRecord$4(value) {
|
|
23879
24090
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
23880
24091
|
}
|
|
23881
24092
|
function pickNumber(record, keys) {
|
|
@@ -23931,7 +24142,7 @@ function collectUsageCandidates(root) {
|
|
|
23931
24142
|
if (!next) break;
|
|
23932
24143
|
scanned += 1;
|
|
23933
24144
|
const { value, depth } = next;
|
|
23934
|
-
if (isRecord$
|
|
24145
|
+
if (isRecord$4(value)) {
|
|
23935
24146
|
if (seen.has(value)) continue;
|
|
23936
24147
|
seen.add(value);
|
|
23937
24148
|
const score = scoreUsageRecord(value);
|
|
@@ -23941,7 +24152,7 @@ function collectUsageCandidates(root) {
|
|
|
23941
24152
|
depth
|
|
23942
24153
|
});
|
|
23943
24154
|
if (depth < MAX_SCAN_DEPTH) {
|
|
23944
|
-
for (const nested of Object.values(value)) if (isRecord$
|
|
24155
|
+
for (const nested of Object.values(value)) if (isRecord$4(nested) || Array.isArray(nested)) queue.push({
|
|
23945
24156
|
value: nested,
|
|
23946
24157
|
depth: depth + 1
|
|
23947
24158
|
});
|
|
@@ -23949,7 +24160,7 @@ function collectUsageCandidates(root) {
|
|
|
23949
24160
|
continue;
|
|
23950
24161
|
}
|
|
23951
24162
|
if (Array.isArray(value) && depth < MAX_SCAN_DEPTH) {
|
|
23952
|
-
for (const nested of value) if (isRecord$
|
|
24163
|
+
for (const nested of value) if (isRecord$4(nested) || Array.isArray(nested)) queue.push({
|
|
23953
24164
|
value: nested,
|
|
23954
24165
|
depth: depth + 1
|
|
23955
24166
|
});
|
|
@@ -23999,20 +24210,20 @@ async function fetchMinimaxUsage(apiKey, timeoutMs, fetchFn) {
|
|
|
23999
24210
|
error: `HTTP ${res.status}`
|
|
24000
24211
|
};
|
|
24001
24212
|
const data = await res.json().catch(() => null);
|
|
24002
|
-
if (!isRecord$
|
|
24213
|
+
if (!isRecord$4(data)) return {
|
|
24003
24214
|
provider: "minimax",
|
|
24004
24215
|
displayName: PROVIDER_LABELS.minimax,
|
|
24005
24216
|
windows: [],
|
|
24006
24217
|
error: "Invalid JSON"
|
|
24007
24218
|
};
|
|
24008
|
-
const baseResp = isRecord$
|
|
24219
|
+
const baseResp = isRecord$4(data.base_resp) ? data.base_resp : void 0;
|
|
24009
24220
|
if (baseResp && typeof baseResp.status_code === "number" && baseResp.status_code !== 0) return {
|
|
24010
24221
|
provider: "minimax",
|
|
24011
24222
|
displayName: PROVIDER_LABELS.minimax,
|
|
24012
24223
|
windows: [],
|
|
24013
24224
|
error: baseResp.status_msg?.trim() || "API error"
|
|
24014
24225
|
};
|
|
24015
|
-
const payload = isRecord$
|
|
24226
|
+
const payload = isRecord$4(data.data) ? data.data : data;
|
|
24016
24227
|
const candidates = collectUsageCandidates(payload);
|
|
24017
24228
|
let usageRecord = payload;
|
|
24018
24229
|
let usedPercent = null;
|
|
@@ -24667,6 +24878,56 @@ function scheduleGatewaySigusr1Restart(opts) {
|
|
|
24667
24878
|
};
|
|
24668
24879
|
}
|
|
24669
24880
|
|
|
24881
|
+
//#endregion
|
|
24882
|
+
//#region src/utils/transcript-tools.ts
|
|
24883
|
+
const TOOL_CALL_TYPES$1 = new Set([
|
|
24884
|
+
"tool_use",
|
|
24885
|
+
"toolcall",
|
|
24886
|
+
"tool_call"
|
|
24887
|
+
]);
|
|
24888
|
+
const TOOL_RESULT_TYPES = new Set(["tool_result", "tool_result_error"]);
|
|
24889
|
+
const normalizeType = (value) => {
|
|
24890
|
+
if (typeof value !== "string") return "";
|
|
24891
|
+
return value.trim().toLowerCase();
|
|
24892
|
+
};
|
|
24893
|
+
const extractToolCallNames = (message) => {
|
|
24894
|
+
const names = /* @__PURE__ */ new Set();
|
|
24895
|
+
const toolNameRaw = message.toolName ?? message.tool_name;
|
|
24896
|
+
if (typeof toolNameRaw === "string" && toolNameRaw.trim()) names.add(toolNameRaw.trim());
|
|
24897
|
+
const content = message.content;
|
|
24898
|
+
if (!Array.isArray(content)) return Array.from(names);
|
|
24899
|
+
for (const entry of content) {
|
|
24900
|
+
if (!entry || typeof entry !== "object") continue;
|
|
24901
|
+
const block = entry;
|
|
24902
|
+
const type = normalizeType(block.type);
|
|
24903
|
+
if (!TOOL_CALL_TYPES$1.has(type)) continue;
|
|
24904
|
+
const name = block.name;
|
|
24905
|
+
if (typeof name === "string" && name.trim()) names.add(name.trim());
|
|
24906
|
+
}
|
|
24907
|
+
return Array.from(names);
|
|
24908
|
+
};
|
|
24909
|
+
const countToolResults = (message) => {
|
|
24910
|
+
const content = message.content;
|
|
24911
|
+
if (!Array.isArray(content)) return {
|
|
24912
|
+
total: 0,
|
|
24913
|
+
errors: 0
|
|
24914
|
+
};
|
|
24915
|
+
let total = 0;
|
|
24916
|
+
let errors = 0;
|
|
24917
|
+
for (const entry of content) {
|
|
24918
|
+
if (!entry || typeof entry !== "object") continue;
|
|
24919
|
+
const block = entry;
|
|
24920
|
+
const type = normalizeType(block.type);
|
|
24921
|
+
if (!TOOL_RESULT_TYPES.has(type)) continue;
|
|
24922
|
+
total += 1;
|
|
24923
|
+
if (block.is_error === true) errors += 1;
|
|
24924
|
+
}
|
|
24925
|
+
return {
|
|
24926
|
+
total,
|
|
24927
|
+
errors
|
|
24928
|
+
};
|
|
24929
|
+
};
|
|
24930
|
+
|
|
24670
24931
|
//#endregion
|
|
24671
24932
|
//#region src/infra/session-cost-usage.ts
|
|
24672
24933
|
const emptyTotals = () => ({
|
|
@@ -24676,6 +24937,10 @@ const emptyTotals = () => ({
|
|
|
24676
24937
|
cacheWrite: 0,
|
|
24677
24938
|
totalTokens: 0,
|
|
24678
24939
|
totalCost: 0,
|
|
24940
|
+
inputCost: 0,
|
|
24941
|
+
outputCost: 0,
|
|
24942
|
+
cacheReadCost: 0,
|
|
24943
|
+
cacheWriteCost: 0,
|
|
24679
24944
|
missingCostEntries: 0
|
|
24680
24945
|
});
|
|
24681
24946
|
const toFiniteNumber = (value) => {
|
|
@@ -24683,13 +24948,19 @@ const toFiniteNumber = (value) => {
|
|
|
24683
24948
|
if (!Number.isFinite(value)) return;
|
|
24684
24949
|
return value;
|
|
24685
24950
|
};
|
|
24686
|
-
const
|
|
24951
|
+
const extractCostBreakdown = (usageRaw) => {
|
|
24687
24952
|
if (!usageRaw || typeof usageRaw !== "object") return;
|
|
24688
24953
|
const cost = usageRaw.cost;
|
|
24689
|
-
|
|
24690
|
-
|
|
24691
|
-
if (total < 0) return;
|
|
24692
|
-
return
|
|
24954
|
+
if (!cost) return;
|
|
24955
|
+
const total = toFiniteNumber(cost.total);
|
|
24956
|
+
if (total === void 0 || total < 0) return;
|
|
24957
|
+
return {
|
|
24958
|
+
total,
|
|
24959
|
+
input: toFiniteNumber(cost.input),
|
|
24960
|
+
output: toFiniteNumber(cost.output),
|
|
24961
|
+
cacheRead: toFiniteNumber(cost.cacheRead),
|
|
24962
|
+
cacheWrite: toFiniteNumber(cost.cacheWrite)
|
|
24963
|
+
};
|
|
24693
24964
|
};
|
|
24694
24965
|
const parseTimestamp = (entry) => {
|
|
24695
24966
|
const raw = entry.timestamp;
|
|
@@ -24704,23 +24975,49 @@ const parseTimestamp = (entry) => {
|
|
|
24704
24975
|
if (!Number.isNaN(parsed.valueOf())) return parsed;
|
|
24705
24976
|
}
|
|
24706
24977
|
};
|
|
24707
|
-
const
|
|
24978
|
+
const parseTranscriptEntry = (entry) => {
|
|
24708
24979
|
const message = entry.message;
|
|
24709
|
-
if (message
|
|
24710
|
-
const
|
|
24711
|
-
const
|
|
24712
|
-
if (!
|
|
24713
|
-
const
|
|
24714
|
-
const
|
|
24980
|
+
if (!message || typeof message !== "object") return null;
|
|
24981
|
+
const roleRaw = message.role;
|
|
24982
|
+
const role = roleRaw === "user" || roleRaw === "assistant" ? roleRaw : void 0;
|
|
24983
|
+
if (!role) return null;
|
|
24984
|
+
const usageRaw = message.usage ?? entry.usage;
|
|
24985
|
+
const usage = usageRaw ? normalizeUsage(usageRaw) ?? void 0 : void 0;
|
|
24986
|
+
const provider = (typeof message.provider === "string" ? message.provider : void 0) ?? (typeof entry.provider === "string" ? entry.provider : void 0);
|
|
24987
|
+
const model = (typeof message.model === "string" ? message.model : void 0) ?? (typeof entry.model === "string" ? entry.model : void 0);
|
|
24988
|
+
const costBreakdown = extractCostBreakdown(usageRaw);
|
|
24989
|
+
const stopReason = typeof message.stopReason === "string" ? message.stopReason : void 0;
|
|
24990
|
+
const durationMs = toFiniteNumber(message.durationMs ?? entry.durationMs);
|
|
24715
24991
|
return {
|
|
24992
|
+
message,
|
|
24993
|
+
role,
|
|
24994
|
+
timestamp: parseTimestamp(entry),
|
|
24995
|
+
durationMs,
|
|
24716
24996
|
usage,
|
|
24717
|
-
costTotal:
|
|
24997
|
+
costTotal: costBreakdown?.total,
|
|
24998
|
+
costBreakdown,
|
|
24718
24999
|
provider,
|
|
24719
25000
|
model,
|
|
24720
|
-
|
|
25001
|
+
stopReason,
|
|
25002
|
+
toolNames: extractToolCallNames(message),
|
|
25003
|
+
toolResultCounts: countToolResults(message)
|
|
24721
25004
|
};
|
|
24722
25005
|
};
|
|
24723
25006
|
const formatDayKey = (date) => date.toLocaleDateString("en-CA", { timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone });
|
|
25007
|
+
const computeLatencyStats = (values) => {
|
|
25008
|
+
if (!values.length) return;
|
|
25009
|
+
const sorted = values.toSorted((a, b) => a - b);
|
|
25010
|
+
const total = sorted.reduce((sum, v) => sum + v, 0);
|
|
25011
|
+
const count = sorted.length;
|
|
25012
|
+
const p95Index = Math.max(0, Math.ceil(count * .95) - 1);
|
|
25013
|
+
return {
|
|
25014
|
+
count,
|
|
25015
|
+
avgMs: total / count,
|
|
25016
|
+
p95Ms: sorted[p95Index] ?? sorted[count - 1],
|
|
25017
|
+
minMs: sorted[0],
|
|
25018
|
+
maxMs: sorted[count - 1]
|
|
25019
|
+
};
|
|
25020
|
+
};
|
|
24724
25021
|
const applyUsageTotals = (totals, usage) => {
|
|
24725
25022
|
totals.input += usage.input ?? 0;
|
|
24726
25023
|
totals.output += usage.output ?? 0;
|
|
@@ -24729,6 +25026,14 @@ const applyUsageTotals = (totals, usage) => {
|
|
|
24729
25026
|
const totalTokens = usage.total ?? (usage.input ?? 0) + (usage.output ?? 0) + (usage.cacheRead ?? 0) + (usage.cacheWrite ?? 0);
|
|
24730
25027
|
totals.totalTokens += totalTokens;
|
|
24731
25028
|
};
|
|
25029
|
+
const applyCostBreakdown = (totals, costBreakdown) => {
|
|
25030
|
+
if (costBreakdown === void 0 || costBreakdown.total === void 0) return;
|
|
25031
|
+
totals.totalCost += costBreakdown.total;
|
|
25032
|
+
totals.inputCost += costBreakdown.input ?? 0;
|
|
25033
|
+
totals.outputCost += costBreakdown.output ?? 0;
|
|
25034
|
+
totals.cacheReadCost += costBreakdown.cacheRead ?? 0;
|
|
25035
|
+
totals.cacheWriteCost += costBreakdown.cacheWrite ?? 0;
|
|
25036
|
+
};
|
|
24732
25037
|
const applyCostTotal = (totals, costTotal) => {
|
|
24733
25038
|
if (costTotal === void 0) {
|
|
24734
25039
|
totals.missingCostEntries += 1;
|
|
@@ -24736,7 +25041,7 @@ const applyCostTotal = (totals, costTotal) => {
|
|
|
24736
25041
|
}
|
|
24737
25042
|
totals.totalCost += costTotal;
|
|
24738
25043
|
};
|
|
24739
|
-
async function
|
|
25044
|
+
async function scanTranscriptFile(params) {
|
|
24740
25045
|
const fileStream = fs.createReadStream(params.filePath, { encoding: "utf-8" });
|
|
24741
25046
|
const rl = readline.createInterface({
|
|
24742
25047
|
input: fileStream,
|
|
@@ -24746,9 +25051,9 @@ async function scanUsageFile(params) {
|
|
|
24746
25051
|
const trimmed = line.trim();
|
|
24747
25052
|
if (!trimmed) continue;
|
|
24748
25053
|
try {
|
|
24749
|
-
const entry =
|
|
25054
|
+
const entry = parseTranscriptEntry(JSON.parse(trimmed));
|
|
24750
25055
|
if (!entry) continue;
|
|
24751
|
-
if (entry.costTotal === void 0) {
|
|
25056
|
+
if (entry.usage && entry.costTotal === void 0) {
|
|
24752
25057
|
const cost = resolveModelCostConfig({
|
|
24753
25058
|
provider: entry.provider,
|
|
24754
25059
|
model: entry.model,
|
|
@@ -24763,12 +25068,37 @@ async function scanUsageFile(params) {
|
|
|
24763
25068
|
} catch {}
|
|
24764
25069
|
}
|
|
24765
25070
|
}
|
|
25071
|
+
async function scanUsageFile(params) {
|
|
25072
|
+
await scanTranscriptFile({
|
|
25073
|
+
filePath: params.filePath,
|
|
25074
|
+
config: params.config,
|
|
25075
|
+
onEntry: (entry) => {
|
|
25076
|
+
if (!entry.usage) return;
|
|
25077
|
+
params.onEntry({
|
|
25078
|
+
usage: entry.usage,
|
|
25079
|
+
costTotal: entry.costTotal,
|
|
25080
|
+
costBreakdown: entry.costBreakdown,
|
|
25081
|
+
provider: entry.provider,
|
|
25082
|
+
model: entry.model,
|
|
25083
|
+
timestamp: entry.timestamp
|
|
25084
|
+
});
|
|
25085
|
+
}
|
|
25086
|
+
});
|
|
25087
|
+
}
|
|
24766
25088
|
async function loadCostUsageSummary(params) {
|
|
24767
|
-
const days = Math.max(1, Math.floor(params?.days ?? 30));
|
|
24768
25089
|
const now = /* @__PURE__ */ new Date();
|
|
24769
|
-
|
|
24770
|
-
|
|
24771
|
-
|
|
25090
|
+
let sinceTime;
|
|
25091
|
+
let untilTime;
|
|
25092
|
+
if (params?.startMs !== void 0 && params?.endMs !== void 0) {
|
|
25093
|
+
sinceTime = params.startMs;
|
|
25094
|
+
untilTime = params.endMs;
|
|
25095
|
+
} else {
|
|
25096
|
+
const days = Math.max(1, Math.floor(params?.days ?? 30));
|
|
25097
|
+
const since = new Date(now);
|
|
25098
|
+
since.setDate(since.getDate() - (days - 1));
|
|
25099
|
+
sinceTime = since.getTime();
|
|
25100
|
+
untilTime = now.getTime();
|
|
25101
|
+
}
|
|
24772
25102
|
const dailyMap = /* @__PURE__ */ new Map();
|
|
24773
25103
|
const totals = emptyTotals();
|
|
24774
25104
|
const sessionsDir = resolveSessionTranscriptsDirForAgent(params?.agentId);
|
|
@@ -24785,17 +25115,20 @@ async function loadCostUsageSummary(params) {
|
|
|
24785
25115
|
config: params?.config,
|
|
24786
25116
|
onEntry: (entry) => {
|
|
24787
25117
|
const ts = entry.timestamp?.getTime();
|
|
24788
|
-
if (!ts || ts < sinceTime) return;
|
|
25118
|
+
if (!ts || ts < sinceTime || ts > untilTime) return;
|
|
24789
25119
|
const dayKey = formatDayKey(entry.timestamp ?? now);
|
|
24790
25120
|
const bucket = dailyMap.get(dayKey) ?? emptyTotals();
|
|
24791
25121
|
applyUsageTotals(bucket, entry.usage);
|
|
24792
|
-
|
|
25122
|
+
if (entry.costBreakdown?.total !== void 0) applyCostBreakdown(bucket, entry.costBreakdown);
|
|
25123
|
+
else applyCostTotal(bucket, entry.costTotal);
|
|
24793
25124
|
dailyMap.set(dayKey, bucket);
|
|
24794
25125
|
applyUsageTotals(totals, entry.usage);
|
|
24795
|
-
|
|
25126
|
+
if (entry.costBreakdown?.total !== void 0) applyCostBreakdown(totals, entry.costBreakdown);
|
|
25127
|
+
else applyCostTotal(totals, entry.costTotal);
|
|
24796
25128
|
}
|
|
24797
25129
|
});
|
|
24798
25130
|
const daily = Array.from(dailyMap.entries()).map(([date, bucket]) => Object.assign({ date }, bucket)).toSorted((a, b) => a.date.localeCompare(b.date));
|
|
25131
|
+
const days = Math.ceil((untilTime - sinceTime) / (1440 * 60 * 1e3)) + 1;
|
|
24799
25132
|
return {
|
|
24800
25133
|
updatedAt: Date.now(),
|
|
24801
25134
|
days,
|
|
@@ -24807,21 +25140,183 @@ async function loadSessionCostSummary(params) {
|
|
|
24807
25140
|
const sessionFile = params.sessionFile ?? (params.sessionId ? resolveSessionFilePath(params.sessionId, params.sessionEntry) : void 0);
|
|
24808
25141
|
if (!sessionFile || !fs.existsSync(sessionFile)) return null;
|
|
24809
25142
|
const totals = emptyTotals();
|
|
25143
|
+
let firstActivity;
|
|
24810
25144
|
let lastActivity;
|
|
24811
|
-
|
|
25145
|
+
const activityDatesSet = /* @__PURE__ */ new Set();
|
|
25146
|
+
const dailyMap = /* @__PURE__ */ new Map();
|
|
25147
|
+
const dailyMessageMap = /* @__PURE__ */ new Map();
|
|
25148
|
+
const dailyLatencyMap = /* @__PURE__ */ new Map();
|
|
25149
|
+
const dailyModelUsageMap = /* @__PURE__ */ new Map();
|
|
25150
|
+
const messageCounts = {
|
|
25151
|
+
total: 0,
|
|
25152
|
+
user: 0,
|
|
25153
|
+
assistant: 0,
|
|
25154
|
+
toolCalls: 0,
|
|
25155
|
+
toolResults: 0,
|
|
25156
|
+
errors: 0
|
|
25157
|
+
};
|
|
25158
|
+
const toolUsageMap = /* @__PURE__ */ new Map();
|
|
25159
|
+
const modelUsageMap = /* @__PURE__ */ new Map();
|
|
25160
|
+
const errorStopReasons = new Set([
|
|
25161
|
+
"error",
|
|
25162
|
+
"aborted",
|
|
25163
|
+
"timeout"
|
|
25164
|
+
]);
|
|
25165
|
+
const latencyValues = [];
|
|
25166
|
+
let lastUserTimestamp;
|
|
25167
|
+
const MAX_LATENCY_MS = 720 * 60 * 1e3;
|
|
25168
|
+
await scanTranscriptFile({
|
|
24812
25169
|
filePath: sessionFile,
|
|
24813
25170
|
config: params.config,
|
|
24814
25171
|
onEntry: (entry) => {
|
|
24815
|
-
applyUsageTotals(totals, entry.usage);
|
|
24816
|
-
applyCostTotal(totals, entry.costTotal);
|
|
24817
25172
|
const ts = entry.timestamp?.getTime();
|
|
24818
|
-
if (
|
|
25173
|
+
if (params.startMs !== void 0 && ts !== void 0 && ts < params.startMs) return;
|
|
25174
|
+
if (params.endMs !== void 0 && ts !== void 0 && ts > params.endMs) return;
|
|
25175
|
+
if (ts !== void 0) {
|
|
25176
|
+
if (!firstActivity || ts < firstActivity) firstActivity = ts;
|
|
25177
|
+
if (!lastActivity || ts > lastActivity) lastActivity = ts;
|
|
25178
|
+
}
|
|
25179
|
+
if (entry.role === "user") {
|
|
25180
|
+
messageCounts.user += 1;
|
|
25181
|
+
messageCounts.total += 1;
|
|
25182
|
+
if (entry.timestamp) lastUserTimestamp = entry.timestamp.getTime();
|
|
25183
|
+
}
|
|
25184
|
+
if (entry.role === "assistant") {
|
|
25185
|
+
messageCounts.assistant += 1;
|
|
25186
|
+
messageCounts.total += 1;
|
|
25187
|
+
const ts = entry.timestamp?.getTime();
|
|
25188
|
+
if (ts !== void 0) {
|
|
25189
|
+
const latencyMs = entry.durationMs ?? (lastUserTimestamp !== void 0 ? Math.max(0, ts - lastUserTimestamp) : void 0);
|
|
25190
|
+
if (latencyMs !== void 0 && Number.isFinite(latencyMs) && latencyMs <= MAX_LATENCY_MS) {
|
|
25191
|
+
latencyValues.push(latencyMs);
|
|
25192
|
+
const dayKey = formatDayKey(entry.timestamp ?? new Date(ts));
|
|
25193
|
+
const dailyLatencies = dailyLatencyMap.get(dayKey) ?? [];
|
|
25194
|
+
dailyLatencies.push(latencyMs);
|
|
25195
|
+
dailyLatencyMap.set(dayKey, dailyLatencies);
|
|
25196
|
+
}
|
|
25197
|
+
}
|
|
25198
|
+
}
|
|
25199
|
+
if (entry.toolNames.length > 0) {
|
|
25200
|
+
messageCounts.toolCalls += entry.toolNames.length;
|
|
25201
|
+
for (const name of entry.toolNames) toolUsageMap.set(name, (toolUsageMap.get(name) ?? 0) + 1);
|
|
25202
|
+
}
|
|
25203
|
+
if (entry.toolResultCounts.total > 0) {
|
|
25204
|
+
messageCounts.toolResults += entry.toolResultCounts.total;
|
|
25205
|
+
messageCounts.errors += entry.toolResultCounts.errors;
|
|
25206
|
+
}
|
|
25207
|
+
if (entry.stopReason && errorStopReasons.has(entry.stopReason)) messageCounts.errors += 1;
|
|
25208
|
+
if (entry.timestamp) {
|
|
25209
|
+
const dayKey = formatDayKey(entry.timestamp);
|
|
25210
|
+
activityDatesSet.add(dayKey);
|
|
25211
|
+
const daily = dailyMessageMap.get(dayKey) ?? {
|
|
25212
|
+
date: dayKey,
|
|
25213
|
+
total: 0,
|
|
25214
|
+
user: 0,
|
|
25215
|
+
assistant: 0,
|
|
25216
|
+
toolCalls: 0,
|
|
25217
|
+
toolResults: 0,
|
|
25218
|
+
errors: 0
|
|
25219
|
+
};
|
|
25220
|
+
daily.total += entry.role === "user" || entry.role === "assistant" ? 1 : 0;
|
|
25221
|
+
if (entry.role === "user") daily.user += 1;
|
|
25222
|
+
else if (entry.role === "assistant") daily.assistant += 1;
|
|
25223
|
+
daily.toolCalls += entry.toolNames.length;
|
|
25224
|
+
daily.toolResults += entry.toolResultCounts.total;
|
|
25225
|
+
daily.errors += entry.toolResultCounts.errors;
|
|
25226
|
+
if (entry.stopReason && errorStopReasons.has(entry.stopReason)) daily.errors += 1;
|
|
25227
|
+
dailyMessageMap.set(dayKey, daily);
|
|
25228
|
+
}
|
|
25229
|
+
if (!entry.usage) return;
|
|
25230
|
+
applyUsageTotals(totals, entry.usage);
|
|
25231
|
+
if (entry.costBreakdown?.total !== void 0) applyCostBreakdown(totals, entry.costBreakdown);
|
|
25232
|
+
else applyCostTotal(totals, entry.costTotal);
|
|
25233
|
+
if (entry.timestamp) {
|
|
25234
|
+
const dayKey = formatDayKey(entry.timestamp);
|
|
25235
|
+
const entryTokens = (entry.usage.input ?? 0) + (entry.usage.output ?? 0) + (entry.usage.cacheRead ?? 0) + (entry.usage.cacheWrite ?? 0);
|
|
25236
|
+
const entryCost = entry.costBreakdown?.total ?? (entry.costBreakdown ? (entry.costBreakdown.input ?? 0) + (entry.costBreakdown.output ?? 0) + (entry.costBreakdown.cacheRead ?? 0) + (entry.costBreakdown.cacheWrite ?? 0) : entry.costTotal ?? 0);
|
|
25237
|
+
const existing = dailyMap.get(dayKey) ?? {
|
|
25238
|
+
tokens: 0,
|
|
25239
|
+
cost: 0
|
|
25240
|
+
};
|
|
25241
|
+
dailyMap.set(dayKey, {
|
|
25242
|
+
tokens: existing.tokens + entryTokens,
|
|
25243
|
+
cost: existing.cost + entryCost
|
|
25244
|
+
});
|
|
25245
|
+
if (entry.provider || entry.model) {
|
|
25246
|
+
const modelKey = `${dayKey}::${entry.provider ?? "unknown"}::${entry.model ?? "unknown"}`;
|
|
25247
|
+
const dailyModel = dailyModelUsageMap.get(modelKey) ?? {
|
|
25248
|
+
date: dayKey,
|
|
25249
|
+
provider: entry.provider,
|
|
25250
|
+
model: entry.model,
|
|
25251
|
+
tokens: 0,
|
|
25252
|
+
cost: 0,
|
|
25253
|
+
count: 0
|
|
25254
|
+
};
|
|
25255
|
+
dailyModel.tokens += entryTokens;
|
|
25256
|
+
dailyModel.cost += entryCost;
|
|
25257
|
+
dailyModel.count += 1;
|
|
25258
|
+
dailyModelUsageMap.set(modelKey, dailyModel);
|
|
25259
|
+
}
|
|
25260
|
+
}
|
|
25261
|
+
if (entry.provider || entry.model) {
|
|
25262
|
+
const key = `${entry.provider ?? "unknown"}::${entry.model ?? "unknown"}`;
|
|
25263
|
+
const existing = modelUsageMap.get(key) ?? {
|
|
25264
|
+
provider: entry.provider,
|
|
25265
|
+
model: entry.model,
|
|
25266
|
+
count: 0,
|
|
25267
|
+
totals: emptyTotals()
|
|
25268
|
+
};
|
|
25269
|
+
existing.count += 1;
|
|
25270
|
+
applyUsageTotals(existing.totals, entry.usage);
|
|
25271
|
+
if (entry.costBreakdown?.total !== void 0) applyCostBreakdown(existing.totals, entry.costBreakdown);
|
|
25272
|
+
else applyCostTotal(existing.totals, entry.costTotal);
|
|
25273
|
+
modelUsageMap.set(key, existing);
|
|
25274
|
+
}
|
|
24819
25275
|
}
|
|
24820
25276
|
});
|
|
25277
|
+
const dailyBreakdown = Array.from(dailyMap.entries()).map(([date, data]) => ({
|
|
25278
|
+
date,
|
|
25279
|
+
tokens: data.tokens,
|
|
25280
|
+
cost: data.cost
|
|
25281
|
+
})).toSorted((a, b) => a.date.localeCompare(b.date));
|
|
25282
|
+
const dailyMessageCounts = Array.from(dailyMessageMap.values()).toSorted((a, b) => a.date.localeCompare(b.date));
|
|
25283
|
+
const dailyLatency = Array.from(dailyLatencyMap.entries()).map(([date, values]) => {
|
|
25284
|
+
const stats = computeLatencyStats(values);
|
|
25285
|
+
if (!stats) return null;
|
|
25286
|
+
return {
|
|
25287
|
+
date,
|
|
25288
|
+
...stats
|
|
25289
|
+
};
|
|
25290
|
+
}).filter((entry) => Boolean(entry)).toSorted((a, b) => a.date.localeCompare(b.date));
|
|
25291
|
+
const dailyModelUsage = Array.from(dailyModelUsageMap.values()).toSorted((a, b) => a.date.localeCompare(b.date) || b.cost - a.cost);
|
|
25292
|
+
const toolUsage = toolUsageMap.size ? {
|
|
25293
|
+
totalCalls: Array.from(toolUsageMap.values()).reduce((sum, count) => sum + count, 0),
|
|
25294
|
+
uniqueTools: toolUsageMap.size,
|
|
25295
|
+
tools: Array.from(toolUsageMap.entries()).map(([name, count]) => ({
|
|
25296
|
+
name,
|
|
25297
|
+
count
|
|
25298
|
+
})).toSorted((a, b) => b.count - a.count)
|
|
25299
|
+
} : void 0;
|
|
25300
|
+
const modelUsage = modelUsageMap.size ? Array.from(modelUsageMap.values()).toSorted((a, b) => {
|
|
25301
|
+
const costDiff = b.totals.totalCost - a.totals.totalCost;
|
|
25302
|
+
if (costDiff !== 0) return costDiff;
|
|
25303
|
+
return b.totals.totalTokens - a.totals.totalTokens;
|
|
25304
|
+
}) : void 0;
|
|
24821
25305
|
return {
|
|
24822
25306
|
sessionId: params.sessionId,
|
|
24823
25307
|
sessionFile,
|
|
25308
|
+
firstActivity,
|
|
24824
25309
|
lastActivity,
|
|
25310
|
+
durationMs: firstActivity !== void 0 && lastActivity !== void 0 ? Math.max(0, lastActivity - firstActivity) : void 0,
|
|
25311
|
+
activityDates: Array.from(activityDatesSet).toSorted(),
|
|
25312
|
+
dailyBreakdown,
|
|
25313
|
+
dailyMessageCounts,
|
|
25314
|
+
dailyLatency: dailyLatency.length ? dailyLatency : void 0,
|
|
25315
|
+
dailyModelUsage: dailyModelUsage.length ? dailyModelUsage : void 0,
|
|
25316
|
+
messageCounts,
|
|
25317
|
+
toolUsage,
|
|
25318
|
+
modelUsage,
|
|
25319
|
+
latency: computeLatencyStats(latencyValues),
|
|
24825
25320
|
...totals
|
|
24826
25321
|
};
|
|
24827
25322
|
}
|
|
@@ -27832,7 +28327,7 @@ function migrateLegacyCronPayload(payload) {
|
|
|
27832
28327
|
//#endregion
|
|
27833
28328
|
//#region src/cron/normalize.ts
|
|
27834
28329
|
const DEFAULT_OPTIONS = { applyDefaults: false };
|
|
27835
|
-
function isRecord$
|
|
28330
|
+
function isRecord$3(value) {
|
|
27836
28331
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
27837
28332
|
}
|
|
27838
28333
|
function coerceSchedule(schedule) {
|
|
@@ -27898,12 +28393,12 @@ function stripLegacyDeliveryFields(payload) {
|
|
|
27898
28393
|
if ("bestEffortDeliver" in payload) delete payload.bestEffortDeliver;
|
|
27899
28394
|
}
|
|
27900
28395
|
function unwrapJob(raw) {
|
|
27901
|
-
if (isRecord$
|
|
27902
|
-
if (isRecord$
|
|
28396
|
+
if (isRecord$3(raw.data)) return raw.data;
|
|
28397
|
+
if (isRecord$3(raw.job)) return raw.job;
|
|
27903
28398
|
return raw;
|
|
27904
28399
|
}
|
|
27905
28400
|
function normalizeCronJobInput(raw, options = DEFAULT_OPTIONS) {
|
|
27906
|
-
if (!isRecord$
|
|
28401
|
+
if (!isRecord$3(raw)) return null;
|
|
27907
28402
|
const base = unwrapJob(raw);
|
|
27908
28403
|
const next = { ...base };
|
|
27909
28404
|
if ("agentId" in base) {
|
|
@@ -27924,20 +28419,20 @@ function normalizeCronJobInput(raw, options = DEFAULT_OPTIONS) {
|
|
|
27924
28419
|
if (trimmed === "false") next.enabled = false;
|
|
27925
28420
|
}
|
|
27926
28421
|
}
|
|
27927
|
-
if (isRecord$
|
|
27928
|
-
if (isRecord$
|
|
27929
|
-
if (isRecord$
|
|
27930
|
-
if (isRecord$
|
|
28422
|
+
if (isRecord$3(base.schedule)) next.schedule = coerceSchedule(base.schedule);
|
|
28423
|
+
if (isRecord$3(base.payload)) next.payload = coercePayload(base.payload);
|
|
28424
|
+
if (isRecord$3(base.delivery)) next.delivery = coerceDelivery(base.delivery);
|
|
28425
|
+
if (isRecord$3(base.isolation)) delete next.isolation;
|
|
27931
28426
|
if (options.applyDefaults) {
|
|
27932
28427
|
if (!next.wakeMode) next.wakeMode = "next-heartbeat";
|
|
27933
28428
|
if (typeof next.enabled !== "boolean") next.enabled = true;
|
|
27934
|
-
if (!next.sessionTarget && isRecord$
|
|
28429
|
+
if (!next.sessionTarget && isRecord$3(next.payload)) {
|
|
27935
28430
|
const kind = typeof next.payload.kind === "string" ? next.payload.kind : "";
|
|
27936
28431
|
if (kind === "systemEvent") next.sessionTarget = "main";
|
|
27937
28432
|
if (kind === "agentTurn") next.sessionTarget = "isolated";
|
|
27938
28433
|
}
|
|
27939
|
-
if ("schedule" in next && isRecord$
|
|
27940
|
-
const payload = isRecord$
|
|
28434
|
+
if ("schedule" in next && isRecord$3(next.schedule) && next.schedule.kind === "at" && !("deleteAfterRun" in next)) next.deleteAfterRun = true;
|
|
28435
|
+
const payload = isRecord$3(next.payload) ? next.payload : null;
|
|
27941
28436
|
const payloadKind = payload && typeof payload.kind === "string" ? payload.kind : "";
|
|
27942
28437
|
const sessionTarget = typeof next.sessionTarget === "string" ? next.sessionTarget : "";
|
|
27943
28438
|
const isIsolatedAgentTurn = sessionTarget === "isolated" || sessionTarget === "" && payloadKind === "agentTurn";
|
|
@@ -28065,6 +28560,37 @@ async function buildReminderContextLines(params) {
|
|
|
28065
28560
|
return [];
|
|
28066
28561
|
}
|
|
28067
28562
|
}
|
|
28563
|
+
function isRecord$2(value) {
|
|
28564
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
28565
|
+
}
|
|
28566
|
+
function stripThreadSuffixFromSessionKey(sessionKey) {
|
|
28567
|
+
const idx = sessionKey.toLowerCase().lastIndexOf(":thread:");
|
|
28568
|
+
if (idx <= 0) return sessionKey;
|
|
28569
|
+
const parent = sessionKey.slice(0, idx).trim();
|
|
28570
|
+
return parent ? parent : sessionKey;
|
|
28571
|
+
}
|
|
28572
|
+
function inferDeliveryFromSessionKey(agentSessionKey) {
|
|
28573
|
+
const rawSessionKey = agentSessionKey?.trim();
|
|
28574
|
+
if (!rawSessionKey) return null;
|
|
28575
|
+
const parsed = parseAgentSessionKey(stripThreadSuffixFromSessionKey(rawSessionKey));
|
|
28576
|
+
if (!parsed || !parsed.rest) return null;
|
|
28577
|
+
const parts = parsed.rest.split(":").filter(Boolean);
|
|
28578
|
+
if (parts.length === 0) return null;
|
|
28579
|
+
const head = parts[0]?.trim().toLowerCase();
|
|
28580
|
+
if (!head || head === "main" || head === "subagent" || head === "acp") return null;
|
|
28581
|
+
const markerIndex = parts.findIndex((part) => part === "dm" || part === "group" || part === "channel");
|
|
28582
|
+
if (markerIndex === -1) return null;
|
|
28583
|
+
const peerId = parts.slice(markerIndex + 1).join(":").trim();
|
|
28584
|
+
if (!peerId) return null;
|
|
28585
|
+
let channel;
|
|
28586
|
+
if (markerIndex >= 1) channel = parts[0]?.trim().toLowerCase();
|
|
28587
|
+
const delivery = {
|
|
28588
|
+
mode: "announce",
|
|
28589
|
+
to: peerId
|
|
28590
|
+
};
|
|
28591
|
+
if (channel) delivery.channel = channel;
|
|
28592
|
+
return delivery;
|
|
28593
|
+
}
|
|
28068
28594
|
function createCronTool(opts) {
|
|
28069
28595
|
return {
|
|
28070
28596
|
label: "Cron",
|
|
@@ -28145,6 +28671,19 @@ Use jobId as the canonical identifier; id is accepted for compatibility. Use con
|
|
|
28145
28671
|
}) : void 0;
|
|
28146
28672
|
if (agentId) job.agentId = agentId;
|
|
28147
28673
|
}
|
|
28674
|
+
if (opts?.agentSessionKey && job && typeof job === "object" && "payload" in job && job.payload?.kind === "agentTurn") {
|
|
28675
|
+
const deliveryValue = job.delivery;
|
|
28676
|
+
const delivery = isRecord$2(deliveryValue) ? deliveryValue : void 0;
|
|
28677
|
+
const mode = (typeof delivery?.mode === "string" ? delivery.mode : "").trim().toLowerCase();
|
|
28678
|
+
const hasTarget = typeof delivery?.channel === "string" && delivery.channel.trim() || typeof delivery?.to === "string" && delivery.to.trim();
|
|
28679
|
+
if ((deliveryValue == null || delivery) && mode !== "none" && !hasTarget) {
|
|
28680
|
+
const inferred = inferDeliveryFromSessionKey(opts.agentSessionKey);
|
|
28681
|
+
if (inferred) job.delivery = {
|
|
28682
|
+
...delivery,
|
|
28683
|
+
...inferred
|
|
28684
|
+
};
|
|
28685
|
+
}
|
|
28686
|
+
}
|
|
28148
28687
|
const contextMessages = typeof params.contextMessages === "number" && Number.isFinite(params.contextMessages) ? params.contextMessages : 0;
|
|
28149
28688
|
if (job && typeof job === "object" && "payload" in job && job.payload?.kind === "systemEvent") {
|
|
28150
28689
|
const payload = job.payload;
|
|
@@ -28511,26 +29050,15 @@ function isAbortError$1(err) {
|
|
|
28511
29050
|
function shouldRethrowAbort(err) {
|
|
28512
29051
|
return isAbortError$1(err) && !isTimeoutError(err);
|
|
28513
29052
|
}
|
|
28514
|
-
function buildAllowedModelKeys(cfg, defaultProvider) {
|
|
28515
|
-
const rawAllowlist = (() => {
|
|
28516
|
-
const modelMap = cfg?.agents?.defaults?.models ?? {};
|
|
28517
|
-
return Object.keys(modelMap);
|
|
28518
|
-
})();
|
|
28519
|
-
if (rawAllowlist.length === 0) return null;
|
|
28520
|
-
const keys = /* @__PURE__ */ new Set();
|
|
28521
|
-
for (const raw of rawAllowlist) {
|
|
28522
|
-
const parsed = parseModelRef(String(raw ?? ""), defaultProvider);
|
|
28523
|
-
if (!parsed) continue;
|
|
28524
|
-
keys.add(modelKey(parsed.provider, parsed.model));
|
|
28525
|
-
}
|
|
28526
|
-
return keys.size > 0 ? keys : null;
|
|
28527
|
-
}
|
|
28528
29053
|
function resolveImageFallbackCandidates(params) {
|
|
28529
29054
|
const aliasIndex = buildModelAliasIndex({
|
|
28530
29055
|
cfg: params.cfg ?? {},
|
|
28531
29056
|
defaultProvider: params.defaultProvider
|
|
28532
29057
|
});
|
|
28533
|
-
const allowlist =
|
|
29058
|
+
const allowlist = buildConfiguredAllowlistKeys({
|
|
29059
|
+
cfg: params.cfg,
|
|
29060
|
+
defaultProvider: params.defaultProvider
|
|
29061
|
+
});
|
|
28534
29062
|
const seen = /* @__PURE__ */ new Set();
|
|
28535
29063
|
const candidates = [];
|
|
28536
29064
|
const addCandidate = (candidate, enforceAllowlist) => {
|
|
@@ -28578,7 +29106,10 @@ function resolveFallbackCandidates(params) {
|
|
|
28578
29106
|
cfg: params.cfg ?? {},
|
|
28579
29107
|
defaultProvider
|
|
28580
29108
|
});
|
|
28581
|
-
const allowlist =
|
|
29109
|
+
const allowlist = buildConfiguredAllowlistKeys({
|
|
29110
|
+
cfg: params.cfg,
|
|
29111
|
+
defaultProvider
|
|
29112
|
+
});
|
|
28582
29113
|
const seen = /* @__PURE__ */ new Set();
|
|
28583
29114
|
const candidates = [];
|
|
28584
29115
|
const addCandidate = (candidate, enforceAllowlist) => {
|
|
@@ -28723,6 +29254,8 @@ async function runWithImageModelFallback(params) {
|
|
|
28723
29254
|
//#endregion
|
|
28724
29255
|
//#region src/agents/tools/image-tool.ts
|
|
28725
29256
|
const DEFAULT_PROMPT = "Describe the image.";
|
|
29257
|
+
const ANTHROPIC_IMAGE_PRIMARY = "anthropic/claude-opus-4-6";
|
|
29258
|
+
const ANTHROPIC_IMAGE_FALLBACK = "anthropic/claude-opus-4-5";
|
|
28726
29259
|
function resolveDefaultModelRef(cfg) {
|
|
28727
29260
|
if (cfg) {
|
|
28728
29261
|
const resolved = resolveConfiguredModelRef({
|
|
@@ -28783,10 +29316,10 @@ function resolveImageModelConfigForTool(params) {
|
|
|
28783
29316
|
if (primary.provider === "minimax" && providerOk) preferred = "minimax/MiniMax-VL-01";
|
|
28784
29317
|
else if (providerOk && providerVisionFromConfig) preferred = providerVisionFromConfig;
|
|
28785
29318
|
else if (primary.provider === "openai" && openaiOk) preferred = "openai/gpt-5-mini";
|
|
28786
|
-
else if (primary.provider === "anthropic" && anthropicOk) preferred =
|
|
29319
|
+
else if (primary.provider === "anthropic" && anthropicOk) preferred = ANTHROPIC_IMAGE_PRIMARY;
|
|
28787
29320
|
if (preferred?.trim()) {
|
|
28788
29321
|
if (openaiOk) addFallback("openai/gpt-5-mini");
|
|
28789
|
-
if (anthropicOk) addFallback(
|
|
29322
|
+
if (anthropicOk) addFallback(ANTHROPIC_IMAGE_FALLBACK);
|
|
28790
29323
|
const pruned = fallbacks.filter((ref) => ref !== preferred);
|
|
28791
29324
|
return {
|
|
28792
29325
|
primary: preferred,
|
|
@@ -28794,13 +29327,16 @@ function resolveImageModelConfigForTool(params) {
|
|
|
28794
29327
|
};
|
|
28795
29328
|
}
|
|
28796
29329
|
if (openaiOk) {
|
|
28797
|
-
if (anthropicOk) addFallback(
|
|
29330
|
+
if (anthropicOk) addFallback(ANTHROPIC_IMAGE_FALLBACK);
|
|
28798
29331
|
return {
|
|
28799
29332
|
primary: "openai/gpt-5-mini",
|
|
28800
29333
|
...fallbacks.length ? { fallbacks } : {}
|
|
28801
29334
|
};
|
|
28802
29335
|
}
|
|
28803
|
-
if (anthropicOk) return {
|
|
29336
|
+
if (anthropicOk) return {
|
|
29337
|
+
primary: ANTHROPIC_IMAGE_PRIMARY,
|
|
29338
|
+
fallbacks: [ANTHROPIC_IMAGE_FALLBACK]
|
|
29339
|
+
};
|
|
28804
29340
|
return null;
|
|
28805
29341
|
}
|
|
28806
29342
|
function pickMaxBytes(cfg, maxBytesMb) {
|
|
@@ -30634,6 +31170,20 @@ function buildTelegramGroupPeerId(chatId, messageThreadId) {
|
|
|
30634
31170
|
function buildTelegramGroupFrom(chatId, messageThreadId) {
|
|
30635
31171
|
return `telegram:group:${buildTelegramGroupPeerId(chatId, messageThreadId)}`;
|
|
30636
31172
|
}
|
|
31173
|
+
/**
|
|
31174
|
+
* Build parentPeer for forum topic binding inheritance.
|
|
31175
|
+
* When a message comes from a forum topic, the peer ID includes the topic suffix
|
|
31176
|
+
* (e.g., `-1001234567890:topic:99`). To allow bindings configured for the base
|
|
31177
|
+
* group ID to match, we provide the parent group as `parentPeer` so the routing
|
|
31178
|
+
* layer can fall back to it when the exact peer doesn't match.
|
|
31179
|
+
*/
|
|
31180
|
+
function buildTelegramParentPeer(params) {
|
|
31181
|
+
if (!params.isGroup || params.resolvedThreadId == null) return;
|
|
31182
|
+
return {
|
|
31183
|
+
kind: "group",
|
|
31184
|
+
id: String(params.chatId)
|
|
31185
|
+
};
|
|
31186
|
+
}
|
|
30637
31187
|
function buildSenderName(msg) {
|
|
30638
31188
|
return [msg.from?.first_name, msg.from?.last_name].filter(Boolean).join(" ").trim() || msg.from?.username || void 0;
|
|
30639
31189
|
}
|
|
@@ -31643,6 +32193,24 @@ function resolveSlackAutoThreadId(params) {
|
|
|
31643
32193
|
if (context.replyToMode === "first" && context.hasRepliedRef?.value) return;
|
|
31644
32194
|
return context.currentThreadTs;
|
|
31645
32195
|
}
|
|
32196
|
+
/**
|
|
32197
|
+
* Auto-inject Telegram forum topic thread ID when the message tool targets
|
|
32198
|
+
* the same chat the session originated from. Mirrors the Slack auto-threading
|
|
32199
|
+
* pattern so media, buttons, and other tool-sent messages land in the correct
|
|
32200
|
+
* topic instead of the General Topic.
|
|
32201
|
+
*
|
|
32202
|
+
* Unlike Slack, we do not gate on `replyToMode` here: Telegram forum topics
|
|
32203
|
+
* are persistent sub-channels (not ephemeral reply threads), so auto-injection
|
|
32204
|
+
* should always apply when the target chat matches.
|
|
32205
|
+
*/
|
|
32206
|
+
function resolveTelegramAutoThreadId(params) {
|
|
32207
|
+
const context = params.toolContext;
|
|
32208
|
+
if (!context?.currentThreadTs || !context.currentChannelId) return;
|
|
32209
|
+
const parsedTo = parseTelegramTarget(params.to);
|
|
32210
|
+
const parsedChannel = parseTelegramTarget(context.currentChannelId);
|
|
32211
|
+
if (parsedTo.chatId.toLowerCase() !== parsedChannel.chatId.toLowerCase()) return;
|
|
32212
|
+
return context.currentThreadTs;
|
|
32213
|
+
}
|
|
31646
32214
|
function resolveAttachmentMaxBytes(params) {
|
|
31647
32215
|
const fallback = params.cfg.agents?.defaults?.mediaMaxMb;
|
|
31648
32216
|
if (params.channel !== "bluebubbles") return typeof fallback === "number" ? fallback * 1024 * 1024 : void 0;
|
|
@@ -31691,6 +32259,42 @@ function normalizeBase64Payload(params) {
|
|
|
31691
32259
|
contentType: params.contentType ?? mime
|
|
31692
32260
|
};
|
|
31693
32261
|
}
|
|
32262
|
+
async function normalizeSandboxMediaParams(params) {
|
|
32263
|
+
const sandboxRoot = params.sandboxRoot?.trim();
|
|
32264
|
+
for (const key of [
|
|
32265
|
+
"media",
|
|
32266
|
+
"path",
|
|
32267
|
+
"filePath"
|
|
32268
|
+
]) {
|
|
32269
|
+
const raw = readStringParam(params.args, key, { trim: false });
|
|
32270
|
+
if (!raw) continue;
|
|
32271
|
+
assertMediaNotDataUrl(raw);
|
|
32272
|
+
if (!sandboxRoot) continue;
|
|
32273
|
+
const normalized = await resolveSandboxedMediaSource({
|
|
32274
|
+
media: raw,
|
|
32275
|
+
sandboxRoot
|
|
32276
|
+
});
|
|
32277
|
+
if (normalized !== raw) params.args[key] = normalized;
|
|
32278
|
+
}
|
|
32279
|
+
}
|
|
32280
|
+
async function normalizeSandboxMediaList(params) {
|
|
32281
|
+
const sandboxRoot = params.sandboxRoot?.trim();
|
|
32282
|
+
const normalized = [];
|
|
32283
|
+
const seen = /* @__PURE__ */ new Set();
|
|
32284
|
+
for (const value of params.values) {
|
|
32285
|
+
const raw = value?.trim();
|
|
32286
|
+
if (!raw) continue;
|
|
32287
|
+
assertMediaNotDataUrl(raw);
|
|
32288
|
+
const resolved = sandboxRoot ? await resolveSandboxedMediaSource({
|
|
32289
|
+
media: raw,
|
|
32290
|
+
sandboxRoot
|
|
32291
|
+
}) : raw;
|
|
32292
|
+
if (seen.has(resolved)) continue;
|
|
32293
|
+
seen.add(resolved);
|
|
32294
|
+
normalized.push(resolved);
|
|
32295
|
+
}
|
|
32296
|
+
return normalized;
|
|
32297
|
+
}
|
|
31694
32298
|
async function hydrateSetGroupIconParams(params) {
|
|
31695
32299
|
if (params.action !== "setGroupIcon") return;
|
|
31696
32300
|
const mediaHint = readStringParam(params.args, "media", { trim: false });
|
|
@@ -31911,6 +32515,7 @@ async function handleSendAction(ctx) {
|
|
|
31911
32515
|
required: !mediaHint && !hasCard,
|
|
31912
32516
|
allowEmpty: true
|
|
31913
32517
|
}) ?? "";
|
|
32518
|
+
if (message.includes("\\n")) message = message.replaceAll("\\n", "\n");
|
|
31914
32519
|
const parsed = parseReplyDirectives(message);
|
|
31915
32520
|
const mergedMediaUrls = [];
|
|
31916
32521
|
const seenMedia = /* @__PURE__ */ new Set();
|
|
@@ -31924,6 +32529,12 @@ async function handleSendAction(ctx) {
|
|
|
31924
32529
|
pushMedia(mediaHint);
|
|
31925
32530
|
for (const url of parsed.mediaUrls ?? []) pushMedia(url);
|
|
31926
32531
|
pushMedia(parsed.mediaUrl);
|
|
32532
|
+
const normalizedMediaUrls = await normalizeSandboxMediaList({
|
|
32533
|
+
values: mergedMediaUrls,
|
|
32534
|
+
sandboxRoot: input.sandboxRoot
|
|
32535
|
+
});
|
|
32536
|
+
mergedMediaUrls.length = 0;
|
|
32537
|
+
mergedMediaUrls.push(...normalizedMediaUrls);
|
|
31927
32538
|
message = parsed.text;
|
|
31928
32539
|
params.message = message;
|
|
31929
32540
|
if (!params.replyTo && parsed.replyToId) params.replyTo = parsed.replyToId;
|
|
@@ -31948,6 +32559,12 @@ async function handleSendAction(ctx) {
|
|
|
31948
32559
|
to,
|
|
31949
32560
|
toolContext: input.toolContext
|
|
31950
32561
|
}) : void 0;
|
|
32562
|
+
const telegramAutoThreadId = channel === "telegram" && !threadId ? resolveTelegramAutoThreadId({
|
|
32563
|
+
to,
|
|
32564
|
+
toolContext: input.toolContext
|
|
32565
|
+
}) : void 0;
|
|
32566
|
+
const resolvedThreadId = threadId ?? slackAutoThreadId ?? telegramAutoThreadId;
|
|
32567
|
+
if (resolvedThreadId && !params.threadId) params.threadId = resolvedThreadId;
|
|
31951
32568
|
const outboundRoute = agentId && !dryRun ? await resolveOutboundSessionRoute({
|
|
31952
32569
|
cfg,
|
|
31953
32570
|
channel,
|
|
@@ -31956,7 +32573,7 @@ async function handleSendAction(ctx) {
|
|
|
31956
32573
|
target: to,
|
|
31957
32574
|
resolvedTarget,
|
|
31958
32575
|
replyToId,
|
|
31959
|
-
threadId:
|
|
32576
|
+
threadId: resolvedThreadId
|
|
31960
32577
|
}) : null;
|
|
31961
32578
|
if (outboundRoute && agentId && !dryRun) await ensureOutboundSessionEntry({
|
|
31962
32579
|
cfg,
|
|
@@ -32139,6 +32756,10 @@ async function runMessageAction(input) {
|
|
|
32139
32756
|
const accountId = readStringParam(params, "accountId") ?? input.defaultAccountId;
|
|
32140
32757
|
if (accountId) params.accountId = accountId;
|
|
32141
32758
|
const dryRun = Boolean(input.dryRun ?? readBooleanParam(params, "dryRun"));
|
|
32759
|
+
await normalizeSandboxMediaParams({
|
|
32760
|
+
args: params,
|
|
32761
|
+
sandboxRoot: input.sandboxRoot
|
|
32762
|
+
});
|
|
32142
32763
|
await hydrateSendAttachmentParams({
|
|
32143
32764
|
cfg,
|
|
32144
32765
|
channel,
|
|
@@ -32232,7 +32853,7 @@ function buildSendSchema(options) {
|
|
|
32232
32853
|
message: Type.Optional(Type.String()),
|
|
32233
32854
|
effectId: Type.Optional(Type.String({ description: "Message effect name/id for sendWithEffect (e.g., invisible ink)." })),
|
|
32234
32855
|
effect: Type.Optional(Type.String({ description: "Alias for effectId (e.g., invisible-ink, balloons)." })),
|
|
32235
|
-
media: Type.Optional(Type.String()),
|
|
32856
|
+
media: Type.Optional(Type.String({ description: "Media URL or local path. data: URLs are not supported here, use buffer." })),
|
|
32236
32857
|
filename: Type.Optional(Type.String()),
|
|
32237
32858
|
buffer: Type.Optional(Type.String({ description: "Base64 payload for attachments (optionally a data: URL)." })),
|
|
32238
32859
|
contentType: Type.Optional(Type.String()),
|
|
@@ -32462,15 +33083,6 @@ function createMessageTool(options) {
|
|
|
32462
33083
|
if (options?.requireExplicitTarget === true && actionNeedsExplicitTarget(action)) {
|
|
32463
33084
|
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).");
|
|
32464
33085
|
}
|
|
32465
|
-
const sandboxRoot = options?.sandboxRoot;
|
|
32466
|
-
if (sandboxRoot) for (const key of ["filePath", "path"]) {
|
|
32467
|
-
const raw = readStringParam(params, key, { trim: false });
|
|
32468
|
-
if (raw) await assertSandboxPath({
|
|
32469
|
-
filePath: raw,
|
|
32470
|
-
cwd: sandboxRoot,
|
|
32471
|
-
root: sandboxRoot
|
|
32472
|
-
});
|
|
32473
|
-
}
|
|
32474
33086
|
const accountId = readStringParam(params, "accountId") ?? agentAccountId;
|
|
32475
33087
|
if (accountId) params.accountId = accountId;
|
|
32476
33088
|
const gateway = {
|
|
@@ -32500,6 +33112,7 @@ function createMessageTool(options) {
|
|
|
32500
33112
|
sessionKey: options.agentSessionKey,
|
|
32501
33113
|
config: cfg
|
|
32502
33114
|
}) : void 0,
|
|
33115
|
+
sandboxRoot: options?.sandboxRoot,
|
|
32503
33116
|
abortSignal: signal
|
|
32504
33117
|
});
|
|
32505
33118
|
const toolResult = getToolResult(result);
|
|
@@ -32892,6 +33505,30 @@ function createNodesTool(options) {
|
|
|
32892
33505
|
|
|
32893
33506
|
//#endregion
|
|
32894
33507
|
//#region src/gateway/session-utils.fs.ts
|
|
33508
|
+
function jsonUtf8Bytes$1(value) {
|
|
33509
|
+
try {
|
|
33510
|
+
return Buffer.byteLength(JSON.stringify(value), "utf8");
|
|
33511
|
+
} catch {
|
|
33512
|
+
return Buffer.byteLength(String(value), "utf8");
|
|
33513
|
+
}
|
|
33514
|
+
}
|
|
33515
|
+
function capArrayByJsonBytes(items, maxBytes) {
|
|
33516
|
+
if (items.length === 0) return {
|
|
33517
|
+
items,
|
|
33518
|
+
bytes: 2
|
|
33519
|
+
};
|
|
33520
|
+
const parts = items.map((item) => jsonUtf8Bytes$1(item));
|
|
33521
|
+
let bytes = 2 + parts.reduce((a, b) => a + b, 0) + (items.length - 1);
|
|
33522
|
+
let start = 0;
|
|
33523
|
+
while (bytes > maxBytes && start < items.length - 1) {
|
|
33524
|
+
bytes -= parts[start] + 1;
|
|
33525
|
+
start += 1;
|
|
33526
|
+
}
|
|
33527
|
+
return {
|
|
33528
|
+
items: start > 0 ? items.slice(start) : items,
|
|
33529
|
+
bytes
|
|
33530
|
+
};
|
|
33531
|
+
}
|
|
32895
33532
|
const PREVIEW_READ_SIZES = [
|
|
32896
33533
|
64 * 1024,
|
|
32897
33534
|
256 * 1024,
|
|
@@ -33287,6 +33924,131 @@ const SessionsHistoryToolSchema = Type.Object({
|
|
|
33287
33924
|
limit: Type.Optional(Type.Number({ minimum: 1 })),
|
|
33288
33925
|
includeTools: Type.Optional(Type.Boolean())
|
|
33289
33926
|
});
|
|
33927
|
+
const SESSIONS_HISTORY_MAX_BYTES = 80 * 1024;
|
|
33928
|
+
const SESSIONS_HISTORY_TEXT_MAX_CHARS = 4e3;
|
|
33929
|
+
function truncateHistoryText(text) {
|
|
33930
|
+
if (text.length <= SESSIONS_HISTORY_TEXT_MAX_CHARS) return {
|
|
33931
|
+
text,
|
|
33932
|
+
truncated: false
|
|
33933
|
+
};
|
|
33934
|
+
return {
|
|
33935
|
+
text: `${truncateUtf16Safe(text, SESSIONS_HISTORY_TEXT_MAX_CHARS)}\n…(truncated)…`,
|
|
33936
|
+
truncated: true
|
|
33937
|
+
};
|
|
33938
|
+
}
|
|
33939
|
+
function sanitizeHistoryContentBlock(block) {
|
|
33940
|
+
if (!block || typeof block !== "object") return {
|
|
33941
|
+
block,
|
|
33942
|
+
truncated: false
|
|
33943
|
+
};
|
|
33944
|
+
const entry = { ...block };
|
|
33945
|
+
let truncated = false;
|
|
33946
|
+
const type = typeof entry.type === "string" ? entry.type : "";
|
|
33947
|
+
if (typeof entry.text === "string") {
|
|
33948
|
+
const res = truncateHistoryText(entry.text);
|
|
33949
|
+
entry.text = res.text;
|
|
33950
|
+
truncated ||= res.truncated;
|
|
33951
|
+
}
|
|
33952
|
+
if (type === "thinking") {
|
|
33953
|
+
if (typeof entry.thinking === "string") {
|
|
33954
|
+
const res = truncateHistoryText(entry.thinking);
|
|
33955
|
+
entry.thinking = res.text;
|
|
33956
|
+
truncated ||= res.truncated;
|
|
33957
|
+
}
|
|
33958
|
+
if ("thinkingSignature" in entry) {
|
|
33959
|
+
delete entry.thinkingSignature;
|
|
33960
|
+
truncated = true;
|
|
33961
|
+
}
|
|
33962
|
+
}
|
|
33963
|
+
if (typeof entry.partialJson === "string") {
|
|
33964
|
+
const res = truncateHistoryText(entry.partialJson);
|
|
33965
|
+
entry.partialJson = res.text;
|
|
33966
|
+
truncated ||= res.truncated;
|
|
33967
|
+
}
|
|
33968
|
+
if (type === "image") {
|
|
33969
|
+
const data = typeof entry.data === "string" ? entry.data : void 0;
|
|
33970
|
+
const bytes = data ? data.length : void 0;
|
|
33971
|
+
if ("data" in entry) {
|
|
33972
|
+
delete entry.data;
|
|
33973
|
+
truncated = true;
|
|
33974
|
+
}
|
|
33975
|
+
entry.omitted = true;
|
|
33976
|
+
if (bytes !== void 0) entry.bytes = bytes;
|
|
33977
|
+
}
|
|
33978
|
+
return {
|
|
33979
|
+
block: entry,
|
|
33980
|
+
truncated
|
|
33981
|
+
};
|
|
33982
|
+
}
|
|
33983
|
+
function sanitizeHistoryMessage(message) {
|
|
33984
|
+
if (!message || typeof message !== "object") return {
|
|
33985
|
+
message,
|
|
33986
|
+
truncated: false
|
|
33987
|
+
};
|
|
33988
|
+
const entry = { ...message };
|
|
33989
|
+
let truncated = false;
|
|
33990
|
+
if ("details" in entry) {
|
|
33991
|
+
delete entry.details;
|
|
33992
|
+
truncated = true;
|
|
33993
|
+
}
|
|
33994
|
+
if ("usage" in entry) {
|
|
33995
|
+
delete entry.usage;
|
|
33996
|
+
truncated = true;
|
|
33997
|
+
}
|
|
33998
|
+
if ("cost" in entry) {
|
|
33999
|
+
delete entry.cost;
|
|
34000
|
+
truncated = true;
|
|
34001
|
+
}
|
|
34002
|
+
if (typeof entry.content === "string") {
|
|
34003
|
+
const res = truncateHistoryText(entry.content);
|
|
34004
|
+
entry.content = res.text;
|
|
34005
|
+
truncated ||= res.truncated;
|
|
34006
|
+
} else if (Array.isArray(entry.content)) {
|
|
34007
|
+
const updated = entry.content.map((block) => sanitizeHistoryContentBlock(block));
|
|
34008
|
+
entry.content = updated.map((item) => item.block);
|
|
34009
|
+
truncated ||= updated.some((item) => item.truncated);
|
|
34010
|
+
}
|
|
34011
|
+
if (typeof entry.text === "string") {
|
|
34012
|
+
const res = truncateHistoryText(entry.text);
|
|
34013
|
+
entry.text = res.text;
|
|
34014
|
+
truncated ||= res.truncated;
|
|
34015
|
+
}
|
|
34016
|
+
return {
|
|
34017
|
+
message: entry,
|
|
34018
|
+
truncated
|
|
34019
|
+
};
|
|
34020
|
+
}
|
|
34021
|
+
function jsonUtf8Bytes(value) {
|
|
34022
|
+
try {
|
|
34023
|
+
return Buffer.byteLength(JSON.stringify(value), "utf8");
|
|
34024
|
+
} catch {
|
|
34025
|
+
return Buffer.byteLength(String(value), "utf8");
|
|
34026
|
+
}
|
|
34027
|
+
}
|
|
34028
|
+
function enforceSessionsHistoryHardCap(params) {
|
|
34029
|
+
if (params.bytes <= params.maxBytes) return {
|
|
34030
|
+
items: params.items,
|
|
34031
|
+
bytes: params.bytes,
|
|
34032
|
+
hardCapped: false
|
|
34033
|
+
};
|
|
34034
|
+
const last = params.items.at(-1);
|
|
34035
|
+
const lastOnly = last ? [last] : [];
|
|
34036
|
+
const lastBytes = jsonUtf8Bytes(lastOnly);
|
|
34037
|
+
if (lastBytes <= params.maxBytes) return {
|
|
34038
|
+
items: lastOnly,
|
|
34039
|
+
bytes: lastBytes,
|
|
34040
|
+
hardCapped: true
|
|
34041
|
+
};
|
|
34042
|
+
const placeholder = [{
|
|
34043
|
+
role: "assistant",
|
|
34044
|
+
content: "[sessions_history omitted: message too large]"
|
|
34045
|
+
}];
|
|
34046
|
+
return {
|
|
34047
|
+
items: placeholder,
|
|
34048
|
+
bytes: jsonUtf8Bytes(placeholder),
|
|
34049
|
+
hardCapped: true
|
|
34050
|
+
};
|
|
34051
|
+
}
|
|
33290
34052
|
function resolveSandboxSessionToolsVisibility$1(cfg) {
|
|
33291
34053
|
return cfg.agents?.defaults?.sandbox?.sessionToolsVisibility ?? "spawned";
|
|
33292
34054
|
}
|
|
@@ -33370,9 +34132,23 @@ function createSessionsHistoryTool(opts) {
|
|
|
33370
34132
|
}
|
|
33371
34133
|
});
|
|
33372
34134
|
const rawMessages = Array.isArray(result?.messages) ? result.messages : [];
|
|
34135
|
+
const selectedMessages = includeTools ? rawMessages : stripToolMessages(rawMessages);
|
|
34136
|
+
const sanitizedMessages = selectedMessages.map((message) => sanitizeHistoryMessage(message));
|
|
34137
|
+
const contentTruncated = sanitizedMessages.some((entry) => entry.truncated);
|
|
34138
|
+
const cappedMessages = capArrayByJsonBytes(sanitizedMessages.map((entry) => entry.message), SESSIONS_HISTORY_MAX_BYTES);
|
|
34139
|
+
const droppedMessages = cappedMessages.items.length < selectedMessages.length;
|
|
34140
|
+
const hardened = enforceSessionsHistoryHardCap({
|
|
34141
|
+
items: cappedMessages.items,
|
|
34142
|
+
bytes: cappedMessages.bytes,
|
|
34143
|
+
maxBytes: SESSIONS_HISTORY_MAX_BYTES
|
|
34144
|
+
});
|
|
33373
34145
|
return jsonResult({
|
|
33374
34146
|
sessionKey: displayKey,
|
|
33375
|
-
messages:
|
|
34147
|
+
messages: hardened.items,
|
|
34148
|
+
truncated: droppedMessages || contentTruncated || hardened.hardCapped,
|
|
34149
|
+
droppedMessages: droppedMessages || hardened.hardCapped,
|
|
34150
|
+
contentTruncated,
|
|
34151
|
+
bytes: hardened.bytes
|
|
33376
34152
|
});
|
|
33377
34153
|
}
|
|
33378
34154
|
};
|
|
@@ -34179,6 +34955,9 @@ function createSessionsSpawnTool(opts) {
|
|
|
34179
34955
|
message: task,
|
|
34180
34956
|
sessionKey: childSessionKey,
|
|
34181
34957
|
channel: requesterOrigin?.channel,
|
|
34958
|
+
to: requesterOrigin?.to ?? void 0,
|
|
34959
|
+
accountId: requesterOrigin?.accountId ?? void 0,
|
|
34960
|
+
threadId: requesterOrigin?.threadId != null ? String(requesterOrigin.threadId) : void 0,
|
|
34182
34961
|
idempotencyKey: childIdem,
|
|
34183
34962
|
deliver: false,
|
|
34184
34963
|
lane: AGENT_LANE_SUBAGENT,
|
|
@@ -35700,8 +36479,10 @@ const DEFAULT_CLAUDE_BACKEND = {
|
|
|
35700
36479
|
modelArg: "--model",
|
|
35701
36480
|
modelAliases: {
|
|
35702
36481
|
opus: "opus",
|
|
36482
|
+
"opus-4.6": "opus",
|
|
35703
36483
|
"opus-4.5": "opus",
|
|
35704
36484
|
"opus-4": "opus",
|
|
36485
|
+
"claude-opus-4-6": "opus",
|
|
35705
36486
|
"claude-opus-4-5": "opus",
|
|
35706
36487
|
"claude-opus-4": "opus",
|
|
35707
36488
|
sonnet: "sonnet",
|
|
@@ -38194,6 +38975,7 @@ async function runPreparedReply(params) {
|
|
|
38194
38975
|
senderName: sessionCtx.SenderName?.trim() || void 0,
|
|
38195
38976
|
senderUsername: sessionCtx.SenderUsername?.trim() || void 0,
|
|
38196
38977
|
senderE164: sessionCtx.SenderE164?.trim() || void 0,
|
|
38978
|
+
senderIsOwner: command.senderIsOwner,
|
|
38197
38979
|
sessionFile,
|
|
38198
38980
|
workspaceDir,
|
|
38199
38981
|
config: cfg,
|
|
@@ -38566,11 +39348,13 @@ async function initSessionState(params) {
|
|
|
38566
39348
|
if (threadLabel) sessionEntry.displayName = threadLabel;
|
|
38567
39349
|
const parentSessionKey = ctx.ParentSessionKey?.trim();
|
|
38568
39350
|
if (isNewSession && parentSessionKey && parentSessionKey !== sessionKey && sessionStore[parentSessionKey]) {
|
|
39351
|
+
console.warn(`[session-init] forking from parent session: parentKey=${parentSessionKey} → sessionKey=${sessionKey} parentTokens=${sessionStore[parentSessionKey].totalTokens ?? "?"}`);
|
|
38569
39352
|
const forked = forkSessionFromParent({ parentEntry: sessionStore[parentSessionKey] });
|
|
38570
39353
|
if (forked) {
|
|
38571
39354
|
sessionId = forked.sessionId;
|
|
38572
39355
|
sessionEntry.sessionId = forked.sessionId;
|
|
38573
39356
|
sessionEntry.sessionFile = forked.sessionFile;
|
|
39357
|
+
console.warn(`[session-init] forked session created: file=${forked.sessionFile}`);
|
|
38574
39358
|
}
|
|
38575
39359
|
}
|
|
38576
39360
|
if (!sessionEntry.sessionFile) sessionEntry.sessionFile = resolveSessionTranscriptPath(sessionEntry.sessionId, agentId, ctx.MessageThreadId);
|
|
@@ -38578,6 +39362,10 @@ async function initSessionState(params) {
|
|
|
38578
39362
|
sessionEntry.compactionCount = 0;
|
|
38579
39363
|
sessionEntry.memoryFlushCompactionCount = void 0;
|
|
38580
39364
|
sessionEntry.memoryFlushAt = void 0;
|
|
39365
|
+
sessionEntry.totalTokens = void 0;
|
|
39366
|
+
sessionEntry.inputTokens = void 0;
|
|
39367
|
+
sessionEntry.outputTokens = void 0;
|
|
39368
|
+
sessionEntry.contextTokens = void 0;
|
|
38581
39369
|
}
|
|
38582
39370
|
sessionStore[sessionKey] = {
|
|
38583
39371
|
...sessionStore[sessionKey],
|
|
@@ -39325,9 +40113,10 @@ async function dispatchReplyFromConfig(params) {
|
|
|
39325
40113
|
}
|
|
39326
40114
|
let accumulatedBlockText = "";
|
|
39327
40115
|
let blockCount = 0;
|
|
40116
|
+
const shouldSendToolSummaries = ctx.ChatType !== "group" && ctx.CommandSource !== "native";
|
|
39328
40117
|
const replyResult = await (params.replyResolver ?? getReplyFromConfig)(ctx, {
|
|
39329
40118
|
...params.replyOptions,
|
|
39330
|
-
onToolResult:
|
|
40119
|
+
onToolResult: shouldSendToolSummaries ? (payload) => {
|
|
39331
40120
|
const run = async () => {
|
|
39332
40121
|
const ttsPayload = await maybeApplyTtsToPayload({
|
|
39333
40122
|
payload,
|
|
@@ -43131,7 +43920,7 @@ async function describeStickerImage(params) {
|
|
|
43131
43920
|
const selectCatalogModel = (provider) => {
|
|
43132
43921
|
const entries = catalog.filter((entry) => entry.provider.toLowerCase() === provider.toLowerCase() && modelSupportsVision(entry));
|
|
43133
43922
|
if (entries.length === 0) return;
|
|
43134
|
-
const defaultId = provider === "openai" ? "gpt-5-mini" : provider === "anthropic" ? "claude-opus-4-
|
|
43923
|
+
const defaultId = provider === "openai" ? "gpt-5-mini" : provider === "anthropic" ? "claude-opus-4-6" : provider === "google" ? "gemini-3-flash-preview" : "MiniMax-VL-01";
|
|
43135
43924
|
return entries.find((entry) => entry.id === defaultId) ?? entries[0];
|
|
43136
43925
|
};
|
|
43137
43926
|
let resolved = null;
|
|
@@ -43160,7 +43949,7 @@ async function describeStickerImage(params) {
|
|
|
43160
43949
|
logVerbose(`telegram: describing sticker with ${provider}/${model}`);
|
|
43161
43950
|
try {
|
|
43162
43951
|
const buffer = await fs$1.readFile(imagePath);
|
|
43163
|
-
const { describeImageWithModel } = await import("./image-
|
|
43952
|
+
const { describeImageWithModel } = await import("./image-CgBndiQy.js").then((n) => n.n);
|
|
43164
43953
|
return (await describeImageWithModel({
|
|
43165
43954
|
buffer,
|
|
43166
43955
|
fileName: "sticker.webp",
|
|
@@ -43517,7 +44306,7 @@ function createWhatsAppLoginTool() {
|
|
|
43517
44306
|
force: Type.Optional(Type.Boolean())
|
|
43518
44307
|
}),
|
|
43519
44308
|
execute: async (_toolCallId, args) => {
|
|
43520
|
-
const { startWebLoginWithQr, waitForWebLogin } = await import("./login-qr-
|
|
44309
|
+
const { startWebLoginWithQr, waitForWebLogin } = await import("./login-qr-CcOWO_dR.js").then((n) => n.t);
|
|
43521
44310
|
if ((args?.action ?? "start") === "wait") {
|
|
43522
44311
|
const result = await waitForWebLogin({ timeoutMs: typeof args.timeoutMs === "number" ? args.timeoutMs : void 0 });
|
|
43523
44312
|
return {
|
|
@@ -44966,11 +45755,22 @@ function createReplyPrefixContext(params) {
|
|
|
44966
45755
|
};
|
|
44967
45756
|
return {
|
|
44968
45757
|
prefixContext,
|
|
44969
|
-
responsePrefix: resolveEffectiveMessagesConfig(cfg, agentId
|
|
45758
|
+
responsePrefix: resolveEffectiveMessagesConfig(cfg, agentId, {
|
|
45759
|
+
channel: params.channel,
|
|
45760
|
+
accountId: params.accountId
|
|
45761
|
+
}).responsePrefix,
|
|
44970
45762
|
responsePrefixContextProvider: () => prefixContext,
|
|
44971
45763
|
onModelSelected
|
|
44972
45764
|
};
|
|
44973
45765
|
}
|
|
45766
|
+
function createReplyPrefixOptions(params) {
|
|
45767
|
+
const { responsePrefix, responsePrefixContextProvider, onModelSelected } = createReplyPrefixContext(params);
|
|
45768
|
+
return {
|
|
45769
|
+
responsePrefix,
|
|
45770
|
+
responsePrefixContextProvider,
|
|
45771
|
+
onModelSelected
|
|
45772
|
+
};
|
|
45773
|
+
}
|
|
44974
45774
|
|
|
44975
45775
|
//#endregion
|
|
44976
45776
|
//#region src/web/auto-reply/deliver-reply.ts
|
|
@@ -45279,12 +46079,14 @@ async function processMessage(params) {
|
|
|
45279
46079
|
msg: params.msg
|
|
45280
46080
|
}) : void 0;
|
|
45281
46081
|
const configuredResponsePrefix = params.cfg.messages?.responsePrefix;
|
|
45282
|
-
const
|
|
46082
|
+
const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
|
|
45283
46083
|
cfg: params.cfg,
|
|
45284
|
-
agentId: params.route.agentId
|
|
46084
|
+
agentId: params.route.agentId,
|
|
46085
|
+
channel: "whatsapp",
|
|
46086
|
+
accountId: params.route.accountId
|
|
45285
46087
|
});
|
|
45286
46088
|
const isSelfChat = params.msg.chatType !== "group" && Boolean(params.msg.selfE164) && normalizeE164(params.msg.from) === normalizeE164(params.msg.selfE164 ?? "");
|
|
45287
|
-
const responsePrefix =
|
|
46089
|
+
const responsePrefix = prefixOptions.responsePrefix ?? (configuredResponsePrefix === void 0 && isSelfChat ? resolveIdentityNamePrefix(params.cfg, params.route.agentId) ?? "[openclaw]" : void 0);
|
|
45288
46090
|
const ctxPayload = finalizeInboundContext({
|
|
45289
46091
|
Body: combinedBody,
|
|
45290
46092
|
RawBody: params.msg.body,
|
|
@@ -45347,8 +46149,8 @@ async function processMessage(params) {
|
|
|
45347
46149
|
cfg: params.cfg,
|
|
45348
46150
|
replyResolver: params.replyResolver,
|
|
45349
46151
|
dispatcherOptions: {
|
|
46152
|
+
...prefixOptions,
|
|
45350
46153
|
responsePrefix,
|
|
45351
|
-
responsePrefixContextProvider: prefixContext.responsePrefixContextProvider,
|
|
45352
46154
|
onHeartbeatStrip: () => {
|
|
45353
46155
|
if (!didLogHeartbeatStrip) {
|
|
45354
46156
|
didLogHeartbeatStrip = true;
|
|
@@ -45396,7 +46198,7 @@ async function processMessage(params) {
|
|
|
45396
46198
|
},
|
|
45397
46199
|
replyOptions: {
|
|
45398
46200
|
disableBlockStreaming: typeof params.cfg.channels?.whatsapp?.blockStreaming === "boolean" ? !params.cfg.channels.whatsapp.blockStreaming : void 0,
|
|
45399
|
-
onModelSelected
|
|
46201
|
+
onModelSelected
|
|
45400
46202
|
}
|
|
45401
46203
|
});
|
|
45402
46204
|
if (!queuedFinal) {
|
|
@@ -47758,6 +48560,15 @@ async function processDiscordMessage(ctx) {
|
|
|
47758
48560
|
const senderTag = sender.tag;
|
|
47759
48561
|
const systemPromptParts = [channelConfig?.systemPrompt?.trim() || null].filter((entry) => Boolean(entry));
|
|
47760
48562
|
const groupSystemPrompt = systemPromptParts.length > 0 ? systemPromptParts.join("\n\n") : void 0;
|
|
48563
|
+
const ownerAllowFrom = resolveDiscordOwnerAllowFrom({
|
|
48564
|
+
channelConfig,
|
|
48565
|
+
guildInfo,
|
|
48566
|
+
sender: {
|
|
48567
|
+
id: sender.id,
|
|
48568
|
+
name: sender.name,
|
|
48569
|
+
tag: sender.tag
|
|
48570
|
+
}
|
|
48571
|
+
});
|
|
47761
48572
|
const storePath = resolveStorePath(cfg.session?.store, { agentId: route.agentId });
|
|
47762
48573
|
const envelopeOptions = resolveEnvelopeFormatOptions(cfg);
|
|
47763
48574
|
const previousTimestamp = readSessionUpdatedAt({
|
|
@@ -47796,20 +48607,22 @@ async function processDiscordMessage(ctx) {
|
|
|
47796
48607
|
let threadLabel;
|
|
47797
48608
|
let parentSessionKey;
|
|
47798
48609
|
if (threadChannel) {
|
|
47799
|
-
|
|
47800
|
-
|
|
47801
|
-
|
|
47802
|
-
|
|
47803
|
-
|
|
47804
|
-
|
|
47805
|
-
|
|
47806
|
-
|
|
47807
|
-
|
|
47808
|
-
|
|
47809
|
-
|
|
47810
|
-
|
|
47811
|
-
|
|
47812
|
-
|
|
48610
|
+
if (channelConfig?.includeThreadStarter !== false) {
|
|
48611
|
+
const starter = await resolveDiscordThreadStarter({
|
|
48612
|
+
channel: threadChannel,
|
|
48613
|
+
client,
|
|
48614
|
+
parentId: threadParentId,
|
|
48615
|
+
parentType: threadParentType,
|
|
48616
|
+
resolveTimestampMs
|
|
48617
|
+
});
|
|
48618
|
+
if (starter?.text) threadStarterBody = formatThreadStarterEnvelope({
|
|
48619
|
+
channel: "Discord",
|
|
48620
|
+
author: starter.author,
|
|
48621
|
+
timestamp: starter.timestamp,
|
|
48622
|
+
body: starter.text,
|
|
48623
|
+
envelope: envelopeOptions
|
|
48624
|
+
});
|
|
48625
|
+
}
|
|
47813
48626
|
const parentName = threadParentName ?? "parent";
|
|
47814
48627
|
threadLabel = threadName ? `Discord thread #${normalizeDiscordSlug(parentName)} › ${threadName}` : `Discord thread #${normalizeDiscordSlug(parentName)}`;
|
|
47815
48628
|
if (threadParentId) parentSessionKey = buildAgentSessionKey({
|
|
@@ -47869,6 +48682,7 @@ async function processDiscordMessage(ctx) {
|
|
|
47869
48682
|
UntrustedContext: untrustedChannelMetadata ? [untrustedChannelMetadata] : void 0,
|
|
47870
48683
|
GroupSystemPrompt: isGuildMessage ? groupSystemPrompt : void 0,
|
|
47871
48684
|
GroupSpace: isGuildMessage ? (guildInfo?.id ?? guildSlug) || void 0 : void 0,
|
|
48685
|
+
OwnerAllowFrom: ownerAllowFrom,
|
|
47872
48686
|
Provider: "discord",
|
|
47873
48687
|
Surface: "discord",
|
|
47874
48688
|
WasMentioned: effectiveWasMentioned,
|
|
@@ -47902,9 +48716,11 @@ async function processDiscordMessage(ctx) {
|
|
|
47902
48716
|
logVerbose(`discord inbound: channel=${message.channelId} deliver=${deliverTarget} from=${ctxPayload.From} preview="${preview}"`);
|
|
47903
48717
|
}
|
|
47904
48718
|
const typingChannelId = deliverTarget.startsWith("channel:") ? deliverTarget.slice(8) : message.channelId;
|
|
47905
|
-
const
|
|
48719
|
+
const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
|
|
47906
48720
|
cfg,
|
|
47907
|
-
agentId: route.agentId
|
|
48721
|
+
agentId: route.agentId,
|
|
48722
|
+
channel: "discord",
|
|
48723
|
+
accountId: route.accountId
|
|
47908
48724
|
});
|
|
47909
48725
|
const tableMode = resolveMarkdownTableMode({
|
|
47910
48726
|
cfg,
|
|
@@ -47912,8 +48728,7 @@ async function processDiscordMessage(ctx) {
|
|
|
47912
48728
|
accountId
|
|
47913
48729
|
});
|
|
47914
48730
|
const { dispatcher, replyOptions, markDispatchIdle } = createReplyDispatcherWithTyping({
|
|
47915
|
-
|
|
47916
|
-
responsePrefixContextProvider: prefixContext.responsePrefixContextProvider,
|
|
48731
|
+
...prefixOptions,
|
|
47917
48732
|
humanDelay: resolveHumanDelayConfig(cfg, route.agentId),
|
|
47918
48733
|
deliver: async (payload) => {
|
|
47919
48734
|
const replyToId = replyReference.use();
|
|
@@ -47958,9 +48773,7 @@ async function processDiscordMessage(ctx) {
|
|
|
47958
48773
|
...replyOptions,
|
|
47959
48774
|
skillFilter: channelConfig?.skills,
|
|
47960
48775
|
disableBlockStreaming: typeof discordConfig?.blockStreaming === "boolean" ? !discordConfig.blockStreaming : void 0,
|
|
47961
|
-
onModelSelected
|
|
47962
|
-
prefixContext.onModelSelected(ctx);
|
|
47963
|
-
}
|
|
48776
|
+
onModelSelected
|
|
47964
48777
|
}
|
|
47965
48778
|
});
|
|
47966
48779
|
markDispatchIdle();
|
|
@@ -48585,6 +49398,15 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
48585
49398
|
} : void 0
|
|
48586
49399
|
});
|
|
48587
49400
|
const conversationLabel = isDirectMessage ? user.globalName ?? user.username : channelId;
|
|
49401
|
+
const ownerAllowFrom = resolveDiscordOwnerAllowFrom({
|
|
49402
|
+
channelConfig,
|
|
49403
|
+
guildInfo,
|
|
49404
|
+
sender: {
|
|
49405
|
+
id: sender.id,
|
|
49406
|
+
name: sender.name,
|
|
49407
|
+
tag: sender.tag
|
|
49408
|
+
}
|
|
49409
|
+
});
|
|
48588
49410
|
const ctxPayload = finalizeInboundContext({
|
|
48589
49411
|
Body: prompt,
|
|
48590
49412
|
RawBody: prompt,
|
|
@@ -48610,6 +49432,7 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
48610
49432
|
});
|
|
48611
49433
|
return untrustedChannelMetadata ? [untrustedChannelMetadata] : void 0;
|
|
48612
49434
|
})() : void 0,
|
|
49435
|
+
OwnerAllowFrom: ownerAllowFrom,
|
|
48613
49436
|
SenderName: user.globalName ?? user.username,
|
|
48614
49437
|
SenderId: user.id,
|
|
48615
49438
|
SenderUsername: user.username,
|
|
@@ -48622,12 +49445,18 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
48622
49445
|
CommandAuthorized: commandAuthorized,
|
|
48623
49446
|
CommandSource: "native"
|
|
48624
49447
|
});
|
|
49448
|
+
const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
|
|
49449
|
+
cfg,
|
|
49450
|
+
agentId: route.agentId,
|
|
49451
|
+
channel: "discord",
|
|
49452
|
+
accountId: route.accountId
|
|
49453
|
+
});
|
|
48625
49454
|
let didReply = false;
|
|
48626
49455
|
await dispatchReplyWithDispatcher({
|
|
48627
49456
|
ctx: ctxPayload,
|
|
48628
49457
|
cfg,
|
|
48629
49458
|
dispatcherOptions: {
|
|
48630
|
-
|
|
49459
|
+
...prefixOptions,
|
|
48631
49460
|
humanDelay: resolveHumanDelayConfig(cfg, route.agentId),
|
|
48632
49461
|
deliver: async (payload) => {
|
|
48633
49462
|
try {
|
|
@@ -48654,7 +49483,8 @@ async function dispatchDiscordCommandInteraction(params) {
|
|
|
48654
49483
|
},
|
|
48655
49484
|
replyOptions: {
|
|
48656
49485
|
skillFilter: channelConfig?.skills,
|
|
48657
|
-
disableBlockStreaming: typeof discordConfig?.blockStreaming === "boolean" ? !discordConfig.blockStreaming : void 0
|
|
49486
|
+
disableBlockStreaming: typeof discordConfig?.blockStreaming === "boolean" ? !discordConfig.blockStreaming : void 0,
|
|
49487
|
+
onModelSelected
|
|
48658
49488
|
}
|
|
48659
49489
|
});
|
|
48660
49490
|
}
|
|
@@ -50810,16 +51640,17 @@ async function monitorIMessageProvider(opts = {}) {
|
|
|
50810
51640
|
const preview = truncateUtf16Safe(body, 200).replace(/\n/g, "\\n");
|
|
50811
51641
|
logVerbose(`imessage inbound: chatId=${chatId ?? "unknown"} from=${ctxPayload.From} len=${body.length} preview="${preview}"`);
|
|
50812
51642
|
}
|
|
50813
|
-
const
|
|
51643
|
+
const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
|
|
50814
51644
|
cfg,
|
|
50815
|
-
agentId: route.agentId
|
|
51645
|
+
agentId: route.agentId,
|
|
51646
|
+
channel: "imessage",
|
|
51647
|
+
accountId: route.accountId
|
|
50816
51648
|
});
|
|
50817
51649
|
const { queuedFinal } = await dispatchInboundMessage({
|
|
50818
51650
|
ctx: ctxPayload,
|
|
50819
51651
|
cfg,
|
|
50820
51652
|
dispatcher: createReplyDispatcher({
|
|
50821
|
-
|
|
50822
|
-
responsePrefixContextProvider: prefixContext.responsePrefixContextProvider,
|
|
51653
|
+
...prefixOptions,
|
|
50823
51654
|
humanDelay: resolveHumanDelayConfig(cfg, route.agentId),
|
|
50824
51655
|
deliver: async (payload) => {
|
|
50825
51656
|
await deliverReplies$3({
|
|
@@ -50839,7 +51670,7 @@ async function monitorIMessageProvider(opts = {}) {
|
|
|
50839
51670
|
}),
|
|
50840
51671
|
replyOptions: {
|
|
50841
51672
|
disableBlockStreaming: typeof accountInfo.config.blockStreaming === "boolean" ? !accountInfo.config.blockStreaming : void 0,
|
|
50842
|
-
onModelSelected
|
|
51673
|
+
onModelSelected
|
|
50843
51674
|
}
|
|
50844
51675
|
});
|
|
50845
51676
|
if (!queuedFinal) {
|
|
@@ -52641,11 +53472,17 @@ async function monitorLineProvider(opts) {
|
|
|
52641
53472
|
try {
|
|
52642
53473
|
const textLimit = 5e3;
|
|
52643
53474
|
let replyTokenUsed = false;
|
|
53475
|
+
const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
|
|
53476
|
+
cfg: config,
|
|
53477
|
+
agentId: route.agentId,
|
|
53478
|
+
channel: "line",
|
|
53479
|
+
accountId: route.accountId
|
|
53480
|
+
});
|
|
52644
53481
|
const { queuedFinal } = await dispatchReplyWithBufferedBlockDispatcher({
|
|
52645
53482
|
ctx: ctxPayload,
|
|
52646
53483
|
cfg: config,
|
|
52647
53484
|
dispatcherOptions: {
|
|
52648
|
-
|
|
53485
|
+
...prefixOptions,
|
|
52649
53486
|
deliver: async (payload, _info) => {
|
|
52650
53487
|
const lineData = payload.channelData?.line ?? {};
|
|
52651
53488
|
if (ctx.userId && !ctx.isGroup) showLoadingAnimation(ctx.userId, { accountId: ctx.accountId }).catch(() => {});
|
|
@@ -52687,7 +53524,7 @@ async function monitorLineProvider(opts) {
|
|
|
52687
53524
|
runtime.error?.(danger(`line ${info.kind} reply failed: ${String(err)}`));
|
|
52688
53525
|
}
|
|
52689
53526
|
},
|
|
52690
|
-
replyOptions: {}
|
|
53527
|
+
replyOptions: { onModelSelected }
|
|
52691
53528
|
});
|
|
52692
53529
|
if (!queuedFinal) logVerbose(`line: no response generated for message from ${ctxPayload.From}`);
|
|
52693
53530
|
} catch (err) {
|
|
@@ -52982,9 +53819,11 @@ function createSignalEventHandler(deps) {
|
|
|
52982
53819
|
const preview = body.slice(0, 200).replace(/\\n/g, "\\\\n");
|
|
52983
53820
|
logVerbose(`signal inbound: from=${ctxPayload.From} len=${body.length} preview="${preview}"`);
|
|
52984
53821
|
}
|
|
52985
|
-
const
|
|
53822
|
+
const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
|
|
52986
53823
|
cfg: deps.cfg,
|
|
52987
|
-
agentId: route.agentId
|
|
53824
|
+
agentId: route.agentId,
|
|
53825
|
+
channel: "signal",
|
|
53826
|
+
accountId: route.accountId
|
|
52988
53827
|
});
|
|
52989
53828
|
const typingCallbacks = createTypingCallbacks({
|
|
52990
53829
|
start: async () => {
|
|
@@ -53005,8 +53844,7 @@ function createSignalEventHandler(deps) {
|
|
|
53005
53844
|
}
|
|
53006
53845
|
});
|
|
53007
53846
|
const { dispatcher, replyOptions, markDispatchIdle } = createReplyDispatcherWithTyping({
|
|
53008
|
-
|
|
53009
|
-
responsePrefixContextProvider: prefixContext.responsePrefixContextProvider,
|
|
53847
|
+
...prefixOptions,
|
|
53010
53848
|
humanDelay: resolveHumanDelayConfig(deps.cfg, route.agentId),
|
|
53011
53849
|
deliver: async (payload) => {
|
|
53012
53850
|
await deps.deliverReplies({
|
|
@@ -53032,9 +53870,7 @@ function createSignalEventHandler(deps) {
|
|
|
53032
53870
|
replyOptions: {
|
|
53033
53871
|
...replyOptions,
|
|
53034
53872
|
disableBlockStreaming: typeof deps.blockStreaming === "boolean" ? !deps.blockStreaming : void 0,
|
|
53035
|
-
onModelSelected
|
|
53036
|
-
prefixContext.onModelSelected(ctx);
|
|
53037
|
-
}
|
|
53873
|
+
onModelSelected
|
|
53038
53874
|
}
|
|
53039
53875
|
});
|
|
53040
53876
|
markDispatchIdle();
|
|
@@ -54727,13 +55563,14 @@ async function dispatchPreparedSlackMessage(prepared) {
|
|
|
54727
55563
|
});
|
|
54728
55564
|
}
|
|
54729
55565
|
});
|
|
54730
|
-
const
|
|
55566
|
+
const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
|
|
54731
55567
|
cfg,
|
|
54732
|
-
agentId: route.agentId
|
|
55568
|
+
agentId: route.agentId,
|
|
55569
|
+
channel: "slack",
|
|
55570
|
+
accountId: route.accountId
|
|
54733
55571
|
});
|
|
54734
55572
|
const { dispatcher, replyOptions, markDispatchIdle } = createReplyDispatcherWithTyping({
|
|
54735
|
-
|
|
54736
|
-
responsePrefixContextProvider: prefixContext.responsePrefixContextProvider,
|
|
55573
|
+
...prefixOptions,
|
|
54737
55574
|
humanDelay: resolveHumanDelayConfig(cfg, route.agentId),
|
|
54738
55575
|
deliver: async (payload) => {
|
|
54739
55576
|
const replyThreadTs = replyPlan.nextThreadTs();
|
|
@@ -54764,9 +55601,7 @@ async function dispatchPreparedSlackMessage(prepared) {
|
|
|
54764
55601
|
skillFilter: prepared.channelConfig?.skills,
|
|
54765
55602
|
hasRepliedRef,
|
|
54766
55603
|
disableBlockStreaming: typeof account.config.blockStreaming === "boolean" ? !account.config.blockStreaming : void 0,
|
|
54767
|
-
onModelSelected
|
|
54768
|
-
prefixContext.onModelSelected(ctx);
|
|
54769
|
-
}
|
|
55604
|
+
onModelSelected
|
|
54770
55605
|
}
|
|
54771
55606
|
});
|
|
54772
55607
|
markDispatchIdle();
|
|
@@ -55760,42 +56595,49 @@ function registerSlackMonitorSlashCommands(params) {
|
|
|
55760
56595
|
}) : void 0;
|
|
55761
56596
|
const systemPromptParts = [channelConfig?.systemPrompt?.trim() || null].filter((entry) => Boolean(entry));
|
|
55762
56597
|
const groupSystemPrompt = systemPromptParts.length > 0 ? systemPromptParts.join("\n\n") : void 0;
|
|
55763
|
-
const
|
|
55764
|
-
|
|
55765
|
-
|
|
55766
|
-
|
|
55767
|
-
|
|
55768
|
-
|
|
55769
|
-
|
|
55770
|
-
|
|
56598
|
+
const ctxPayload = finalizeInboundContext({
|
|
56599
|
+
Body: prompt,
|
|
56600
|
+
RawBody: prompt,
|
|
56601
|
+
CommandBody: prompt,
|
|
56602
|
+
CommandArgs: commandArgs,
|
|
56603
|
+
From: isDirectMessage ? `slack:${command.user_id}` : isRoom ? `slack:channel:${command.channel_id}` : `slack:group:${command.channel_id}`,
|
|
56604
|
+
To: `slash:${command.user_id}`,
|
|
56605
|
+
ChatType: isDirectMessage ? "direct" : "channel",
|
|
56606
|
+
ConversationLabel: resolveConversationLabel({
|
|
55771
56607
|
ChatType: isDirectMessage ? "direct" : "channel",
|
|
55772
|
-
ConversationLabel: resolveConversationLabel({
|
|
55773
|
-
ChatType: isDirectMessage ? "direct" : "channel",
|
|
55774
|
-
SenderName: senderName,
|
|
55775
|
-
GroupSubject: isRoomish ? roomLabel : void 0,
|
|
55776
|
-
From: isDirectMessage ? `slack:${command.user_id}` : isRoom ? `slack:channel:${command.channel_id}` : `slack:group:${command.channel_id}`
|
|
55777
|
-
}) ?? (isDirectMessage ? senderName : roomLabel),
|
|
55778
|
-
GroupSubject: isRoomish ? roomLabel : void 0,
|
|
55779
|
-
GroupSystemPrompt: isRoomish ? groupSystemPrompt : void 0,
|
|
55780
|
-
UntrustedContext: untrustedChannelMetadata ? [untrustedChannelMetadata] : void 0,
|
|
55781
56608
|
SenderName: senderName,
|
|
55782
|
-
|
|
55783
|
-
|
|
55784
|
-
|
|
55785
|
-
|
|
55786
|
-
|
|
55787
|
-
|
|
55788
|
-
|
|
55789
|
-
|
|
55790
|
-
|
|
55791
|
-
|
|
55792
|
-
|
|
55793
|
-
|
|
55794
|
-
|
|
55795
|
-
}),
|
|
56609
|
+
GroupSubject: isRoomish ? roomLabel : void 0,
|
|
56610
|
+
From: isDirectMessage ? `slack:${command.user_id}` : isRoom ? `slack:channel:${command.channel_id}` : `slack:group:${command.channel_id}`
|
|
56611
|
+
}) ?? (isDirectMessage ? senderName : roomLabel),
|
|
56612
|
+
GroupSubject: isRoomish ? roomLabel : void 0,
|
|
56613
|
+
GroupSystemPrompt: isRoomish ? groupSystemPrompt : void 0,
|
|
56614
|
+
UntrustedContext: untrustedChannelMetadata ? [untrustedChannelMetadata] : void 0,
|
|
56615
|
+
SenderName: senderName,
|
|
56616
|
+
SenderId: command.user_id,
|
|
56617
|
+
Provider: "slack",
|
|
56618
|
+
Surface: "slack",
|
|
56619
|
+
WasMentioned: true,
|
|
56620
|
+
MessageSid: command.trigger_id,
|
|
56621
|
+
Timestamp: Date.now(),
|
|
56622
|
+
SessionKey: `agent:${route.agentId}:${slashCommand.sessionPrefix}:${command.user_id}`.toLowerCase(),
|
|
56623
|
+
CommandTargetSessionKey: route.sessionKey,
|
|
56624
|
+
AccountId: route.accountId,
|
|
56625
|
+
CommandSource: "native",
|
|
56626
|
+
CommandAuthorized: commandAuthorized,
|
|
56627
|
+
OriginatingChannel: "slack",
|
|
56628
|
+
OriginatingTo: `user:${command.user_id}`
|
|
56629
|
+
});
|
|
56630
|
+
const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
|
|
56631
|
+
cfg,
|
|
56632
|
+
agentId: route.agentId,
|
|
56633
|
+
channel: "slack",
|
|
56634
|
+
accountId: route.accountId
|
|
56635
|
+
});
|
|
56636
|
+
const { counts } = await dispatchReplyWithDispatcher({
|
|
56637
|
+
ctx: ctxPayload,
|
|
55796
56638
|
cfg,
|
|
55797
56639
|
dispatcherOptions: {
|
|
55798
|
-
|
|
56640
|
+
...prefixOptions,
|
|
55799
56641
|
deliver: async (payload) => {
|
|
55800
56642
|
await deliverSlackSlashReplies({
|
|
55801
56643
|
replies: [payload],
|
|
@@ -55814,7 +56656,10 @@ function registerSlackMonitorSlashCommands(params) {
|
|
|
55814
56656
|
runtime.error?.(danger(`slack slash ${info.kind} reply failed: ${String(err)}`));
|
|
55815
56657
|
}
|
|
55816
56658
|
},
|
|
55817
|
-
replyOptions: {
|
|
56659
|
+
replyOptions: {
|
|
56660
|
+
skillFilter: channelConfig?.skills,
|
|
56661
|
+
onModelSelected
|
|
56662
|
+
}
|
|
55818
56663
|
});
|
|
55819
56664
|
if (counts.final + counts.tool + counts.block === 0) await deliverSlackSlashReplies({
|
|
55820
56665
|
replies: [],
|
|
@@ -56899,6 +57744,11 @@ const registerTelegramHandlers = ({ cfg, accountId, bot, opts, runtime, mediaMax
|
|
|
56899
57744
|
messageThreadId: params.messageThreadId
|
|
56900
57745
|
});
|
|
56901
57746
|
const peerId = params.isGroup ? buildTelegramGroupPeerId(params.chatId, resolvedThreadId) : String(params.chatId);
|
|
57747
|
+
const parentPeer = buildTelegramParentPeer({
|
|
57748
|
+
isGroup: params.isGroup,
|
|
57749
|
+
resolvedThreadId,
|
|
57750
|
+
chatId: params.chatId
|
|
57751
|
+
});
|
|
56902
57752
|
const route = resolveAgentRoute({
|
|
56903
57753
|
cfg,
|
|
56904
57754
|
channel: "telegram",
|
|
@@ -56906,7 +57756,8 @@ const registerTelegramHandlers = ({ cfg, accountId, bot, opts, runtime, mediaMax
|
|
|
56906
57756
|
peer: {
|
|
56907
57757
|
kind: params.isGroup ? "group" : "dm",
|
|
56908
57758
|
id: peerId
|
|
56909
|
-
}
|
|
57759
|
+
},
|
|
57760
|
+
parentPeer
|
|
56910
57761
|
});
|
|
56911
57762
|
const baseSessionKey = route.sessionKey;
|
|
56912
57763
|
const dmThreadId = !params.isGroup ? params.messageThreadId : void 0;
|
|
@@ -57047,7 +57898,7 @@ const registerTelegramHandlers = ({ cfg, accountId, bot, opts, runtime, mediaMax
|
|
|
57047
57898
|
}
|
|
57048
57899
|
}
|
|
57049
57900
|
const defaultGroupPolicy = cfg.channels?.defaults?.groupPolicy;
|
|
57050
|
-
const groupPolicy = telegramCfg.groupPolicy
|
|
57901
|
+
const groupPolicy = firstDefined(topicConfig?.groupPolicy, groupConfig?.groupPolicy, telegramCfg.groupPolicy, defaultGroupPolicy, "open");
|
|
57051
57902
|
if (groupPolicy === "disabled") {
|
|
57052
57903
|
logVerbose(`Blocked telegram group message (groupPolicy: disabled)`);
|
|
57053
57904
|
return;
|
|
@@ -57298,7 +58149,7 @@ const registerTelegramHandlers = ({ cfg, accountId, bot, opts, runtime, mediaMax
|
|
|
57298
58149
|
}
|
|
57299
58150
|
}
|
|
57300
58151
|
const defaultGroupPolicy = cfg.channels?.defaults?.groupPolicy;
|
|
57301
|
-
const groupPolicy = telegramCfg.groupPolicy
|
|
58152
|
+
const groupPolicy = firstDefined(topicConfig?.groupPolicy, groupConfig?.groupPolicy, telegramCfg.groupPolicy, defaultGroupPolicy, "open");
|
|
57302
58153
|
if (groupPolicy === "disabled") {
|
|
57303
58154
|
logVerbose(`Blocked telegram group message (groupPolicy: disabled)`);
|
|
57304
58155
|
return;
|
|
@@ -57497,6 +58348,11 @@ const buildTelegramMessageContext = async ({ primaryCtx, allMedia, storeAllowFro
|
|
|
57497
58348
|
const replyThreadId = threadSpec.id;
|
|
57498
58349
|
const { groupConfig, topicConfig } = resolveTelegramGroupConfig(chatId, resolvedThreadId);
|
|
57499
58350
|
const peerId = isGroup ? buildTelegramGroupPeerId(chatId, resolvedThreadId) : String(chatId);
|
|
58351
|
+
const parentPeer = buildTelegramParentPeer({
|
|
58352
|
+
isGroup,
|
|
58353
|
+
resolvedThreadId,
|
|
58354
|
+
chatId
|
|
58355
|
+
});
|
|
57500
58356
|
const route = resolveAgentRoute({
|
|
57501
58357
|
cfg,
|
|
57502
58358
|
channel: "telegram",
|
|
@@ -57504,7 +58360,8 @@ const buildTelegramMessageContext = async ({ primaryCtx, allMedia, storeAllowFro
|
|
|
57504
58360
|
peer: {
|
|
57505
58361
|
kind: isGroup ? "group" : "dm",
|
|
57506
58362
|
id: peerId
|
|
57507
|
-
}
|
|
58363
|
+
},
|
|
58364
|
+
parentPeer
|
|
57508
58365
|
});
|
|
57509
58366
|
const baseSessionKey = route.sessionKey;
|
|
57510
58367
|
const dmThreadId = threadSpec.scope === "dm" ? threadSpec.id : void 0;
|
|
@@ -57850,7 +58707,8 @@ const buildTelegramMessageContext = async ({ primaryCtx, allMedia, storeAllowFro
|
|
|
57850
58707
|
sessionKey: route.mainSessionKey,
|
|
57851
58708
|
channel: "telegram",
|
|
57852
58709
|
to: String(chatId),
|
|
57853
|
-
accountId: route.accountId
|
|
58710
|
+
accountId: route.accountId,
|
|
58711
|
+
threadId: dmThreadId != null ? String(dmThreadId) : void 0
|
|
57854
58712
|
} : void 0,
|
|
57855
58713
|
onRecordError: (err) => {
|
|
57856
58714
|
logVerbose(`telegram: failed updating session meta: ${String(err)}`);
|
|
@@ -58291,9 +59149,11 @@ const dispatchTelegramMessage = async ({ context, bot, cfg, runtime, replyToMode
|
|
|
58291
59149
|
await draftStream.flush();
|
|
58292
59150
|
};
|
|
58293
59151
|
const disableBlockStreaming = Boolean(draftStream) || (typeof telegramCfg.blockStreaming === "boolean" ? !telegramCfg.blockStreaming : void 0);
|
|
58294
|
-
const
|
|
59152
|
+
const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
|
|
58295
59153
|
cfg,
|
|
58296
|
-
agentId: route.agentId
|
|
59154
|
+
agentId: route.agentId,
|
|
59155
|
+
channel: "telegram",
|
|
59156
|
+
accountId: route.accountId
|
|
58297
59157
|
});
|
|
58298
59158
|
const tableMode = resolveMarkdownTableMode({
|
|
58299
59159
|
cfg,
|
|
@@ -58302,7 +59162,7 @@ const dispatchTelegramMessage = async ({ context, bot, cfg, runtime, replyToMode
|
|
|
58302
59162
|
});
|
|
58303
59163
|
const chunkMode = resolveChunkMode(cfg, "telegram", route.accountId);
|
|
58304
59164
|
const sticker = ctxPayload.Sticker;
|
|
58305
|
-
if (sticker?.fileUniqueId && ctxPayload.MediaPath) {
|
|
59165
|
+
if (sticker?.fileId && sticker.fileUniqueId && ctxPayload.MediaPath) {
|
|
58306
59166
|
const agentDir = resolveAgentDir(cfg, route.agentId);
|
|
58307
59167
|
const stickerSupportsVision = await resolveStickerVisionSupport(cfg, route.agentId);
|
|
58308
59168
|
let description = sticker.cachedDescription ?? null;
|
|
@@ -58326,16 +59186,18 @@ const dispatchTelegramMessage = async ({ context, bot, cfg, runtime, replyToMode
|
|
|
58326
59186
|
ctxPayload.MediaUrls = void 0;
|
|
58327
59187
|
ctxPayload.MediaTypes = void 0;
|
|
58328
59188
|
}
|
|
58329
|
-
|
|
58330
|
-
|
|
58331
|
-
|
|
58332
|
-
|
|
58333
|
-
|
|
58334
|
-
|
|
58335
|
-
|
|
58336
|
-
|
|
58337
|
-
|
|
58338
|
-
|
|
59189
|
+
if (sticker.fileId) {
|
|
59190
|
+
cacheSticker({
|
|
59191
|
+
fileId: sticker.fileId,
|
|
59192
|
+
fileUniqueId: sticker.fileUniqueId,
|
|
59193
|
+
emoji: sticker.emoji,
|
|
59194
|
+
setName: sticker.setName,
|
|
59195
|
+
description,
|
|
59196
|
+
cachedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
59197
|
+
receivedFrom: ctxPayload.From
|
|
59198
|
+
});
|
|
59199
|
+
logVerbose(`telegram: cached sticker description for ${sticker.fileUniqueId}`);
|
|
59200
|
+
} else logVerbose(`telegram: skipped sticker cache (missing fileId)`);
|
|
58339
59201
|
}
|
|
58340
59202
|
}
|
|
58341
59203
|
const replyQuoteText = ctxPayload.ReplyToIsQuote && ctxPayload.ReplyToBody ? ctxPayload.ReplyToBody.trim() || void 0 : void 0;
|
|
@@ -58347,8 +59209,7 @@ const dispatchTelegramMessage = async ({ context, bot, cfg, runtime, replyToMode
|
|
|
58347
59209
|
ctx: ctxPayload,
|
|
58348
59210
|
cfg,
|
|
58349
59211
|
dispatcherOptions: {
|
|
58350
|
-
|
|
58351
|
-
responsePrefixContextProvider: prefixContext.responsePrefixContextProvider,
|
|
59212
|
+
...prefixOptions,
|
|
58352
59213
|
deliver: async (payload, info) => {
|
|
58353
59214
|
if (info.kind === "final") {
|
|
58354
59215
|
await flushDraft();
|
|
@@ -58392,9 +59253,7 @@ const dispatchTelegramMessage = async ({ context, bot, cfg, runtime, replyToMode
|
|
|
58392
59253
|
skillFilter,
|
|
58393
59254
|
disableBlockStreaming,
|
|
58394
59255
|
onPartialReply: draftStream ? (payload) => updateDraftFromPartial(payload.text) : void 0,
|
|
58395
|
-
onModelSelected
|
|
58396
|
-
prefixContext.onModelSelected(ctx);
|
|
58397
|
-
}
|
|
59256
|
+
onModelSelected
|
|
58398
59257
|
}
|
|
58399
59258
|
});
|
|
58400
59259
|
draftStream?.stop();
|
|
@@ -58729,6 +59588,11 @@ const registerTelegramNativeCommands = ({ bot, cfg, runtime, accountId, telegram
|
|
|
58729
59588
|
});
|
|
58730
59589
|
return;
|
|
58731
59590
|
}
|
|
59591
|
+
const parentPeer = buildTelegramParentPeer({
|
|
59592
|
+
isGroup,
|
|
59593
|
+
resolvedThreadId,
|
|
59594
|
+
chatId
|
|
59595
|
+
});
|
|
58732
59596
|
const route = resolveAgentRoute({
|
|
58733
59597
|
cfg,
|
|
58734
59598
|
channel: "telegram",
|
|
@@ -58736,7 +59600,8 @@ const registerTelegramNativeCommands = ({ bot, cfg, runtime, accountId, telegram
|
|
|
58736
59600
|
peer: {
|
|
58737
59601
|
kind: isGroup ? "group" : "dm",
|
|
58738
59602
|
id: isGroup ? buildTelegramGroupPeerId(chatId, resolvedThreadId) : String(chatId)
|
|
58739
|
-
}
|
|
59603
|
+
},
|
|
59604
|
+
parentPeer
|
|
58740
59605
|
});
|
|
58741
59606
|
const baseSessionKey = route.sessionKey;
|
|
58742
59607
|
const dmThreadId = threadSpec.scope === "dm" ? threadSpec.id : void 0;
|
|
@@ -58787,11 +59652,17 @@ const registerTelegramNativeCommands = ({ bot, cfg, runtime, accountId, telegram
|
|
|
58787
59652
|
delivered: false,
|
|
58788
59653
|
skippedNonSilent: 0
|
|
58789
59654
|
};
|
|
59655
|
+
const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
|
|
59656
|
+
cfg,
|
|
59657
|
+
agentId: route.agentId,
|
|
59658
|
+
channel: "telegram",
|
|
59659
|
+
accountId: route.accountId
|
|
59660
|
+
});
|
|
58790
59661
|
await dispatchReplyWithBufferedBlockDispatcher({
|
|
58791
59662
|
ctx: ctxPayload,
|
|
58792
59663
|
cfg,
|
|
58793
59664
|
dispatcherOptions: {
|
|
58794
|
-
|
|
59665
|
+
...prefixOptions,
|
|
58795
59666
|
deliver: async (payload, _info) => {
|
|
58796
59667
|
if ((await deliverReplies({
|
|
58797
59668
|
replies: [payload],
|
|
@@ -58816,7 +59687,8 @@ const registerTelegramNativeCommands = ({ bot, cfg, runtime, accountId, telegram
|
|
|
58816
59687
|
},
|
|
58817
59688
|
replyOptions: {
|
|
58818
59689
|
skillFilter,
|
|
58819
|
-
disableBlockStreaming
|
|
59690
|
+
disableBlockStreaming,
|
|
59691
|
+
onModelSelected
|
|
58820
59692
|
}
|
|
58821
59693
|
});
|
|
58822
59694
|
if (!deliveryState.delivered && deliveryState.skippedNonSilent > 0) await deliverReplies({
|
|
@@ -58921,7 +59793,7 @@ function getTelegramSequentialKey(ctx) {
|
|
|
58921
59793
|
}
|
|
58922
59794
|
const isGroup = msg?.chat?.type === "group" || msg?.chat?.type === "supergroup";
|
|
58923
59795
|
const messageThreadId = msg?.message_thread_id;
|
|
58924
|
-
const isForum =
|
|
59796
|
+
const isForum = msg?.chat?.is_forum;
|
|
58925
59797
|
const threadId = isGroup ? resolveTelegramForumThreadId({
|
|
58926
59798
|
isForum,
|
|
58927
59799
|
messageThreadId
|
|
@@ -58956,10 +59828,6 @@ function createTelegramBot(opts) {
|
|
|
58956
59828
|
bot.catch((err) => {
|
|
58957
59829
|
runtime.error?.(danger(`telegram bot error: ${formatUncaughtError(err)}`));
|
|
58958
59830
|
});
|
|
58959
|
-
bot.catch((err) => {
|
|
58960
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
58961
|
-
runtime.error?.(danger(`telegram bot error: ${message}`));
|
|
58962
|
-
});
|
|
58963
59831
|
const recentUpdates = createTelegramUpdateDedupe();
|
|
58964
59832
|
let lastUpdateId = typeof opts.updateOffset?.lastUpdateId === "number" ? opts.updateOffset.lastUpdateId : null;
|
|
58965
59833
|
const recordUpdateId = (ctx) => {
|
|
@@ -58989,9 +59857,8 @@ function createTelegramBot(opts) {
|
|
|
58989
59857
|
if (typeof value === "string" && value.length > MAX_RAW_UPDATE_STRING) return `${value.slice(0, MAX_RAW_UPDATE_STRING)}...`;
|
|
58990
59858
|
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)`];
|
|
58991
59859
|
if (value && typeof value === "object") {
|
|
58992
|
-
|
|
58993
|
-
|
|
58994
|
-
seen.add(obj);
|
|
59860
|
+
if (seen.has(value)) return "[Circular]";
|
|
59861
|
+
seen.add(value);
|
|
58995
59862
|
}
|
|
58996
59863
|
return value;
|
|
58997
59864
|
});
|
|
@@ -59035,9 +59902,8 @@ function createTelegramBot(opts) {
|
|
|
59035
59902
|
const streamMode = resolveTelegramStreamMode(telegramCfg);
|
|
59036
59903
|
let botHasTopicsEnabled;
|
|
59037
59904
|
const resolveBotTopicsEnabled = async (ctx) => {
|
|
59038
|
-
|
|
59039
|
-
|
|
59040
|
-
botHasTopicsEnabled = fromCtx.has_topics_enabled;
|
|
59905
|
+
if (typeof ctx?.me?.has_topics_enabled === "boolean") {
|
|
59906
|
+
botHasTopicsEnabled = ctx.me.has_topics_enabled;
|
|
59041
59907
|
return botHasTopicsEnabled;
|
|
59042
59908
|
}
|
|
59043
59909
|
if (typeof botHasTopicsEnabled === "boolean") return botHasTopicsEnabled;
|
|
@@ -59159,27 +60025,28 @@ function createTelegramBot(opts) {
|
|
|
59159
60025
|
else if (!senderName && senderUsername) senderLabel = senderUsername;
|
|
59160
60026
|
if (!senderLabel && user?.id) senderLabel = `id:${user.id}`;
|
|
59161
60027
|
senderLabel = senderLabel || "unknown";
|
|
59162
|
-
const messageThreadId = reaction.message_thread_id;
|
|
59163
|
-
const resolvedThreadId = resolveTelegramForumThreadId({
|
|
59164
|
-
isForum: reaction.chat.is_forum === true,
|
|
59165
|
-
messageThreadId
|
|
59166
|
-
});
|
|
59167
60028
|
const isGroup = reaction.chat.type === "group" || reaction.chat.type === "supergroup";
|
|
60029
|
+
const isForum = reaction.chat.is_forum === true;
|
|
60030
|
+
const resolvedThreadId = isForum ? resolveTelegramForumThreadId({
|
|
60031
|
+
isForum,
|
|
60032
|
+
messageThreadId: void 0
|
|
60033
|
+
}) : void 0;
|
|
59168
60034
|
const peerId = isGroup ? buildTelegramGroupPeerId(chatId, resolvedThreadId) : String(chatId);
|
|
59169
|
-
const
|
|
60035
|
+
const parentPeer = buildTelegramParentPeer({
|
|
60036
|
+
isGroup,
|
|
60037
|
+
resolvedThreadId,
|
|
60038
|
+
chatId
|
|
60039
|
+
});
|
|
60040
|
+
const sessionKey = resolveAgentRoute({
|
|
59170
60041
|
cfg,
|
|
59171
60042
|
channel: "telegram",
|
|
59172
60043
|
accountId: account.accountId,
|
|
59173
60044
|
peer: {
|
|
59174
60045
|
kind: isGroup ? "group" : "dm",
|
|
59175
60046
|
id: peerId
|
|
59176
|
-
}
|
|
60047
|
+
},
|
|
60048
|
+
parentPeer
|
|
59177
60049
|
}).sessionKey;
|
|
59178
|
-
const dmThreadId = !isGroup ? messageThreadId : void 0;
|
|
59179
|
-
const sessionKey = (dmThreadId != null ? resolveThreadSessionKeys({
|
|
59180
|
-
baseSessionKey,
|
|
59181
|
-
threadId: String(dmThreadId)
|
|
59182
|
-
}) : null)?.sessionKey ?? baseSessionKey;
|
|
59183
60050
|
for (const r of addedReactions) {
|
|
59184
60051
|
const emoji = r.emoji;
|
|
59185
60052
|
const text = `Telegram reaction added: ${emoji} by ${senderLabel} on msg ${messageId}`;
|
|
@@ -61528,7 +62395,7 @@ function createOpenClawCodingTools(options) {
|
|
|
61528
62395
|
cwd: sandboxRoot ?? workspaceRoot,
|
|
61529
62396
|
sandboxRoot: sandboxRoot && allowWorkspaceWrites ? sandboxRoot : void 0
|
|
61530
62397
|
});
|
|
61531
|
-
const
|
|
62398
|
+
const toolsByAuthorization = applyOwnerOnlyToolPolicy([
|
|
61532
62399
|
...base,
|
|
61533
62400
|
...sandboxRoot ? allowWorkspaceWrites ? [createSandboxedEditTool(sandboxRoot), createSandboxedWriteTool(sandboxRoot)] : [] : [],
|
|
61534
62401
|
...applyPatchTool ? [applyPatchTool] : [],
|
|
@@ -61571,10 +62438,10 @@ function createOpenClawCodingTools(options) {
|
|
|
61571
62438
|
disableMessageTool: options?.disableMessageTool,
|
|
61572
62439
|
requesterAgentIdOverride: agentId
|
|
61573
62440
|
})
|
|
61574
|
-
];
|
|
61575
|
-
const coreToolNames = new Set(
|
|
62441
|
+
], options?.senderIsOwner === true);
|
|
62442
|
+
const coreToolNames = new Set(toolsByAuthorization.filter((tool) => !getPluginToolMeta(tool)).map((tool) => normalizeToolName(tool.name)).filter(Boolean));
|
|
61576
62443
|
const pluginGroups = buildPluginToolGroups({
|
|
61577
|
-
tools,
|
|
62444
|
+
tools: toolsByAuthorization,
|
|
61578
62445
|
toolMeta: (tool) => getPluginToolMeta(tool)
|
|
61579
62446
|
});
|
|
61580
62447
|
const resolvePolicy = (policy, label) => {
|
|
@@ -61591,7 +62458,7 @@ function createOpenClawCodingTools(options) {
|
|
|
61591
62458
|
const groupPolicyExpanded = resolvePolicy(groupPolicy, "group tools.allow");
|
|
61592
62459
|
const sandboxPolicyExpanded = expandPolicyWithPluginGroups(sandbox?.tools, pluginGroups);
|
|
61593
62460
|
const subagentPolicyExpanded = expandPolicyWithPluginGroups(subagentPolicy, pluginGroups);
|
|
61594
|
-
const toolsFiltered = profilePolicyExpanded ? filterToolsByPolicy(
|
|
62461
|
+
const toolsFiltered = profilePolicyExpanded ? filterToolsByPolicy(toolsByAuthorization, profilePolicyExpanded) : toolsByAuthorization;
|
|
61595
62462
|
const providerProfileFiltered = providerProfileExpanded ? filterToolsByPolicy(toolsFiltered, providerProfileExpanded) : toolsFiltered;
|
|
61596
62463
|
const globalFiltered = globalPolicyExpanded ? filterToolsByPolicy(providerProfileFiltered, globalPolicyExpanded) : providerProfileFiltered;
|
|
61597
62464
|
const globalProviderFiltered = globalProviderExpanded ? filterToolsByPolicy(globalFiltered, globalProviderExpanded) : globalFiltered;
|
|
@@ -61832,7 +62699,13 @@ function repairToolUseResultPairing(messages) {
|
|
|
61832
62699
|
}
|
|
61833
62700
|
continue;
|
|
61834
62701
|
}
|
|
61835
|
-
const
|
|
62702
|
+
const assistant = msg;
|
|
62703
|
+
const stopReason = assistant.stopReason;
|
|
62704
|
+
if (stopReason === "error" || stopReason === "aborted") {
|
|
62705
|
+
out.push(msg);
|
|
62706
|
+
continue;
|
|
62707
|
+
}
|
|
62708
|
+
const toolCalls = extractToolCallsFromAssistant(assistant);
|
|
61836
62709
|
if (toolCalls.length === 0) {
|
|
61837
62710
|
out.push(msg);
|
|
61838
62711
|
continue;
|
|
@@ -63041,7 +63914,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
63041
63914
|
if (!apiKeyInfo.apiKey) {
|
|
63042
63915
|
if (apiKeyInfo.mode !== "aws-sdk") throw new Error(`No API key resolved for provider "${model.provider}" (auth mode: ${apiKeyInfo.mode}).`);
|
|
63043
63916
|
} else if (model.provider === "github-copilot") {
|
|
63044
|
-
const { resolveCopilotApiToken } = await import("./github-copilot-token-
|
|
63917
|
+
const { resolveCopilotApiToken } = await import("./github-copilot-token-B3SA95yo.js").then((n) => n.n);
|
|
63045
63918
|
const copilotToken = await resolveCopilotApiToken({ githubToken: apiKeyInfo.apiKey });
|
|
63046
63919
|
authStorage.setRuntimeApiKey(model.provider, copilotToken.token);
|
|
63047
63920
|
} else authStorage.setRuntimeApiKey(model.provider, apiKeyInfo.apiKey);
|
|
@@ -63110,6 +63983,7 @@ async function compactEmbeddedPiSessionDirect(params) {
|
|
|
63110
63983
|
groupChannel: params.groupChannel,
|
|
63111
63984
|
groupSpace: params.groupSpace,
|
|
63112
63985
|
spawnedBy: params.spawnedBy,
|
|
63986
|
+
senderIsOwner: params.senderIsOwner,
|
|
63113
63987
|
agentDir,
|
|
63114
63988
|
workspaceDir: effectiveWorkspace,
|
|
63115
63989
|
config: params.config,
|
|
@@ -64162,6 +65036,7 @@ function handleMessageUpdate(ctx, evt) {
|
|
|
64162
65036
|
mediaUrls: hasMedia ? mediaUrls : void 0
|
|
64163
65037
|
}
|
|
64164
65038
|
});
|
|
65039
|
+
ctx.state.emittedAssistantUpdate = true;
|
|
64165
65040
|
if (ctx.params.onPartialReply && ctx.state.shouldEmitPartialReplies) ctx.params.onPartialReply({
|
|
64166
65041
|
text: cleanedText,
|
|
64167
65042
|
mediaUrls: hasMedia ? mediaUrls : void 0
|
|
@@ -64205,6 +65080,41 @@ function handleMessageEnd(ctx, evt) {
|
|
|
64205
65080
|
});
|
|
64206
65081
|
const rawThinking = ctx.state.includeReasoning || ctx.state.streamReasoning ? extractAssistantThinking(assistantMessage) || extractThinkingFromTaggedText(rawText) : "";
|
|
64207
65082
|
const formattedReasoning = rawThinking ? formatReasoningMessage(rawThinking) : "";
|
|
65083
|
+
const trimmedText = text.trim();
|
|
65084
|
+
const parsedText = trimmedText ? parseReplyDirectives(stripTrailingDirective(trimmedText)) : null;
|
|
65085
|
+
let cleanedText = parsedText?.text ?? "";
|
|
65086
|
+
let mediaUrls = parsedText?.mediaUrls;
|
|
65087
|
+
let hasMedia = Boolean(mediaUrls && mediaUrls.length > 0);
|
|
65088
|
+
if (!cleanedText && !hasMedia) {
|
|
65089
|
+
const rawTrimmed = rawText.trim();
|
|
65090
|
+
const rawCandidate = rawTrimmed.replace(/<\s*\/?\s*final\s*>/gi, "").trim() || rawTrimmed;
|
|
65091
|
+
if (rawCandidate) {
|
|
65092
|
+
const parsedFallback = parseReplyDirectives(stripTrailingDirective(rawCandidate));
|
|
65093
|
+
cleanedText = parsedFallback.text ?? rawCandidate;
|
|
65094
|
+
mediaUrls = parsedFallback.mediaUrls;
|
|
65095
|
+
hasMedia = Boolean(mediaUrls && mediaUrls.length > 0);
|
|
65096
|
+
}
|
|
65097
|
+
}
|
|
65098
|
+
if (!ctx.state.emittedAssistantUpdate && (cleanedText || hasMedia)) {
|
|
65099
|
+
emitAgentEvent({
|
|
65100
|
+
runId: ctx.params.runId,
|
|
65101
|
+
stream: "assistant",
|
|
65102
|
+
data: {
|
|
65103
|
+
text: cleanedText,
|
|
65104
|
+
delta: cleanedText,
|
|
65105
|
+
mediaUrls: hasMedia ? mediaUrls : void 0
|
|
65106
|
+
}
|
|
65107
|
+
});
|
|
65108
|
+
ctx.params.onAgentEvent?.({
|
|
65109
|
+
stream: "assistant",
|
|
65110
|
+
data: {
|
|
65111
|
+
text: cleanedText,
|
|
65112
|
+
delta: cleanedText,
|
|
65113
|
+
mediaUrls: hasMedia ? mediaUrls : void 0
|
|
65114
|
+
}
|
|
65115
|
+
});
|
|
65116
|
+
ctx.state.emittedAssistantUpdate = true;
|
|
65117
|
+
}
|
|
64208
65118
|
const addedDuringMessage = ctx.state.assistantTexts.length > ctx.state.assistantTextBaseline;
|
|
64209
65119
|
const chunkerHasBuffered = ctx.blockChunker?.hasBuffered() ?? false;
|
|
64210
65120
|
ctx.finalizeAssistantTexts({
|
|
@@ -64657,6 +65567,7 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
64657
65567
|
},
|
|
64658
65568
|
lastStreamedAssistant: void 0,
|
|
64659
65569
|
lastStreamedAssistantCleaned: void 0,
|
|
65570
|
+
emittedAssistantUpdate: false,
|
|
64660
65571
|
lastStreamedReasoning: void 0,
|
|
64661
65572
|
lastBlockReplyText: void 0,
|
|
64662
65573
|
assistantMessageIndex: 0,
|
|
@@ -64701,6 +65612,7 @@ function subscribeEmbeddedPiSession(params) {
|
|
|
64701
65612
|
state.partialBlockState.inlineCode = createInlineCodeState();
|
|
64702
65613
|
state.lastStreamedAssistant = void 0;
|
|
64703
65614
|
state.lastStreamedAssistantCleaned = void 0;
|
|
65615
|
+
state.emittedAssistantUpdate = false;
|
|
64704
65616
|
state.lastBlockReplyText = void 0;
|
|
64705
65617
|
state.lastStreamedReasoning = void 0;
|
|
64706
65618
|
state.lastReasoningSent = void 0;
|
|
@@ -65517,6 +66429,7 @@ async function runEmbeddedAttempt(params) {
|
|
|
65517
66429
|
senderName: params.senderName,
|
|
65518
66430
|
senderUsername: params.senderUsername,
|
|
65519
66431
|
senderE164: params.senderE164,
|
|
66432
|
+
senderIsOwner: params.senderIsOwner,
|
|
65520
66433
|
sessionKey: params.sessionKey ?? params.sessionId,
|
|
65521
66434
|
agentDir,
|
|
65522
66435
|
workspaceDir: effectiveWorkspace,
|
|
@@ -66224,7 +67137,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
66224
67137
|
return;
|
|
66225
67138
|
}
|
|
66226
67139
|
if (model.provider === "github-copilot") {
|
|
66227
|
-
const { resolveCopilotApiToken } = await import("./github-copilot-token-
|
|
67140
|
+
const { resolveCopilotApiToken } = await import("./github-copilot-token-B3SA95yo.js").then((n) => n.n);
|
|
66228
67141
|
const copilotToken = await resolveCopilotApiToken({ githubToken: apiKeyInfo.apiKey });
|
|
66229
67142
|
authStorage.setRuntimeApiKey(model.provider, copilotToken.token);
|
|
66230
67143
|
} else authStorage.setRuntimeApiKey(model.provider, apiKeyInfo.apiKey);
|
|
@@ -66274,7 +67187,8 @@ async function runEmbeddedPiAgent(params) {
|
|
|
66274
67187
|
error: err
|
|
66275
67188
|
});
|
|
66276
67189
|
}
|
|
66277
|
-
|
|
67190
|
+
const MAX_OVERFLOW_COMPACTION_ATTEMPTS = 3;
|
|
67191
|
+
let overflowCompactionAttempts = 0;
|
|
66278
67192
|
try {
|
|
66279
67193
|
while (true) {
|
|
66280
67194
|
attemptedThinking.add(thinkLevel);
|
|
@@ -66292,6 +67206,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
66292
67206
|
groupChannel: params.groupChannel,
|
|
66293
67207
|
groupSpace: params.groupSpace,
|
|
66294
67208
|
spawnedBy: params.spawnedBy,
|
|
67209
|
+
senderIsOwner: params.senderIsOwner,
|
|
66295
67210
|
currentChannelId: params.currentChannelId,
|
|
66296
67211
|
currentThreadTs: params.currentThreadTs,
|
|
66297
67212
|
replyToMode: params.replyToMode,
|
|
@@ -66338,10 +67253,12 @@ async function runEmbeddedPiAgent(params) {
|
|
|
66338
67253
|
if (promptError && !aborted) {
|
|
66339
67254
|
const errorText = describeUnknownError(promptError);
|
|
66340
67255
|
if (isContextOverflowError(errorText)) {
|
|
67256
|
+
const msgCount = attempt.messagesSnapshot?.length ?? 0;
|
|
67257
|
+
log$2.warn(`[context-overflow-diag] sessionKey=${params.sessionKey ?? params.sessionId} provider=${provider}/${modelId} messages=${msgCount} sessionFile=${params.sessionFile} compactionAttempts=${overflowCompactionAttempts} error=${errorText.slice(0, 200)}`);
|
|
66341
67258
|
const isCompactionFailure = isCompactionFailureError(errorText);
|
|
66342
|
-
if (!isCompactionFailure &&
|
|
66343
|
-
|
|
66344
|
-
|
|
67259
|
+
if (!isCompactionFailure && overflowCompactionAttempts < MAX_OVERFLOW_COMPACTION_ATTEMPTS) {
|
|
67260
|
+
overflowCompactionAttempts++;
|
|
67261
|
+
log$2.warn(`context overflow detected (attempt ${overflowCompactionAttempts}/${MAX_OVERFLOW_COMPACTION_ATTEMPTS}); attempting auto-compaction for ${provider}/${modelId}`);
|
|
66345
67262
|
const compactResult = await compactEmbeddedPiSessionDirect({
|
|
66346
67263
|
sessionId: params.sessionId,
|
|
66347
67264
|
sessionKey: params.sessionKey,
|
|
@@ -66354,6 +67271,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
66354
67271
|
agentDir,
|
|
66355
67272
|
config: params.config,
|
|
66356
67273
|
skillsSnapshot: params.skillsSnapshot,
|
|
67274
|
+
senderIsOwner: params.senderIsOwner,
|
|
66357
67275
|
provider,
|
|
66358
67276
|
model: modelId,
|
|
66359
67277
|
thinkLevel,
|
|
@@ -66470,6 +67388,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
66470
67388
|
}
|
|
66471
67389
|
const authFailure = isAuthAssistantError(lastAssistant);
|
|
66472
67390
|
const rateLimitFailure = isRateLimitAssistantError(lastAssistant);
|
|
67391
|
+
const billingFailure = isBillingAssistantError(lastAssistant);
|
|
66473
67392
|
const failoverFailure = isFailoverAssistantError(lastAssistant);
|
|
66474
67393
|
const assistantFailoverReason = classifyFailoverReason(lastAssistant?.errorMessage ?? "");
|
|
66475
67394
|
const cloudCodeAssistFormatError = attempt.cloudCodeAssistFormatError;
|
|
@@ -66499,7 +67418,7 @@ async function runEmbeddedPiAgent(params) {
|
|
|
66499
67418
|
const message = (lastAssistant ? formatAssistantErrorText(lastAssistant, {
|
|
66500
67419
|
cfg: params.config,
|
|
66501
67420
|
sessionKey: params.sessionKey ?? params.sessionId
|
|
66502
|
-
}) : void 0) || lastAssistant?.errorMessage?.trim() || (timedOut ? "LLM request timed out." : rateLimitFailure ? "LLM request rate limited." : authFailure ? "LLM request unauthorized." : "LLM request failed.");
|
|
67421
|
+
}) : 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.");
|
|
66503
67422
|
const status = resolveFailoverStatus(assistantFailoverReason ?? "unknown") ?? (isTimeoutErrorMessage(message) ? 408 : void 0);
|
|
66504
67423
|
throw new FailoverError(message, {
|
|
66505
67424
|
reason: assistantFailoverReason ?? "unknown",
|