@gguf/claw 2026.2.9 → 2026.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +159 -0
- package/LICENSE +1 -1
- package/dist/{accounts-MyAvfCVH.js → accounts-54zZMYCo.js} +5 -2
- package/dist/{accounts-DbzMEfKN.js → accounts-Bvh0DFxS.js} +5 -2
- package/dist/{acp-cli-MZ3h1E1n.js → acp-cli-BslcOPdx.js} +146 -25
- package/dist/{acp-cli-DKJRTfwB.js → acp-cli-D6rk5cOh.js} +145 -24
- package/dist/{agent-whSJT2Lk.js → agent-C0yL70cy.js} +26 -20
- package/dist/{agent-c1QNeDmV.js → agent-DjZxytiC.js} +26 -20
- package/dist/{agent-scope-D3me2AZa.js → agent-scope-Bkr9fZtl.js} +31 -14
- package/dist/{agent-scope-Dp8sREli.js → agent-scope-DASgjz2_.js} +199 -14
- package/dist/{agent-scope-DnyDZ5RH.js → agent-scope-GYIs5dyU.js} +30 -13
- package/dist/{agent-scope-Dpav7C-i.js → agent-scope-okUOVjE5.js} +32 -11
- package/dist/audio-preflight-B0kLz-Ma.js +60 -0
- package/dist/audio-preflight-BCs_J33s.js +60 -0
- package/dist/audio-preflight-CTl2RCyF.js +71 -0
- package/dist/audio-preflight-MhF6YlAY.js +74 -0
- package/dist/{audit-BFYy1qSw.js → audit-BYfhZ7LA.js} +454 -31
- package/dist/{audit-Dn2cBl2x.js → audit-CfPZ_5Id.js} +452 -29
- package/dist/auth-9nTeB2Je.js +602 -0
- package/dist/auth-CLhyWwAU.js +593 -0
- package/dist/{auth-health-Cx5exPMV.js → auth-health-CWiLyzSr.js} +1 -1
- package/dist/{auth-health-DjT4fUpw.js → auth-health-qD4RND47.js} +1 -1
- package/dist/{auth-profiles-FJ3VY25a.js → auth-profiles-Cp9MtUdM.js} +353 -33
- package/dist/build-info.json +2 -2
- package/dist/bundled/boot-md/handler.js +33 -25
- package/dist/bundled/session-memory/handler.js +33 -22
- package/dist/{call-CD2IZCHT.js → call-CjEdFGAf.js} +7 -7
- package/dist/{call-CM25qgxz.js → call-DAfkvtVq.js} +6 -6
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/canvas-host/a2ui/a2ui.bundle.js +7 -1
- package/dist/{channel-options-CremuJyh.js → channel-options-B8dPzlyO.js} +4 -4
- package/dist/{channel-options-D-JnJ4Ft.js → channel-options-Bq5IC5Tv.js} +12 -7
- package/dist/{channel-selection-DAHCVAX4.js → channel-selection-BaW1xXEa.js} +2 -2
- package/dist/{channel-selection-DPV9hvY8.js → channel-selection-dR0jCgTn.js} +2 -2
- package/dist/{channels-cli-6deHFr9t.js → channels-cli-hPo28hWS.js} +61 -56
- package/dist/{channels-cli-D3tKmhlt.js → channels-cli-zi3rO0jq.js} +62 -57
- package/dist/{channels-status-issues-BN1ICfdy.js → channels-status-issues-kb-M2Fi0.js} +1 -1
- package/dist/{channels-status-issues-DFhI_u0p.js → channels-status-issues-ketdwZun.js} +1 -1
- package/dist/{chrome-B2UjqY-9.js → chrome--Fe8F5Kf.js} +24 -12
- package/dist/{chrome-COabMr6f.js → chrome-BWeMtFGf.js} +24 -12
- package/dist/{chrome-CQd_MVOA.js → chrome-Bx24uq7B.js} +27 -15
- package/dist/{chrome-CxRJz4ZD.js → chrome-n_3rtK2c.js} +22 -11
- package/dist/{clack-prompter-BkNZ4Xdw.js → clack-prompter-B-tJmODa.js} +5 -5
- package/dist/{clack-prompter-DuBVnTKy.js → clack-prompter-DpuKn_Uy.js} +5 -5
- package/dist/cli/daemon-cli.js +8 -1
- package/dist/cli-9lwO6Ttx.js +94 -0
- package/dist/cli-CNNdyxPO.js +91 -0
- package/dist/{client-DMloFP_O.js → client-BhZjzrH2.js} +73 -9
- package/dist/{client-C0gQ7hrj.js → client-DyAxKXKY.js} +73 -9
- package/dist/{command-format-ayFsmwwz.js → command-format-Bxe0mWee.js} +1 -1
- package/dist/{command-options-BQdH6qnK.js → command-options-BDV7Xgs-.js} +9 -4
- package/dist/{commands-BWHYcc83.js → commands-gOiRcfoU.js} +4 -4
- package/dist/{tui-formatters-BDP_71Xt.js → commands-registry-6NUFrejL.js} +6 -114
- package/dist/{tui-formatters-CIx4sCQO.js → commands-registry-DGgkLQ7A.js} +6 -114
- package/dist/{completion-cli-DEJia0V1.js → completion-cli-B1kHKJZX.js} +30 -30
- package/dist/{completion-cli-D_0fx2O6.js → completion-cli-Drks7xRK.js} +3 -3
- package/dist/{config-CQt4vGxI.js → config-7NCznPmF.js} +336 -97
- package/dist/{config-fCnPoWjU.js → config-B8v0zg48.js} +295 -99
- package/dist/{config-Bj2eDa02.js → config-CeWMHOiQ.js} +295 -99
- package/dist/{config-ethqi73X.js → config-D8pgDSNo.js} +358 -99
- package/dist/{config-guard-BJuqQvng.js → config-guard-RbHxYc9j.js} +212 -63
- package/dist/{configure-skrLiSwW.js → configure-DLp2Xz7L.js} +59 -40
- package/dist/{configure-C-pYuYg_.js → configure-Su1S0gi-.js} +58 -39
- package/dist/control-auth-BlWU-jBl.js +54 -0
- package/dist/control-auth-C8rIqEdA.js +54 -0
- package/dist/{control-service-BDgF-FZ0.js → control-service-BNDthc1N.js} +11 -5
- package/dist/{control-service-Djd_WI3_.js → control-service-COF59GQe.js} +10 -4
- package/dist/control-ui/assets/{index-CnB9IO4a.js → index-BECn2L1T.js} +369 -368
- package/dist/control-ui/assets/index-BECn2L1T.js.map +1 -0
- package/dist/control-ui/assets/index-DRPcd1Z4.css +1 -0
- package/dist/control-ui/index.html +2 -2
- package/dist/{cron-cli-CB6CufAb.js → cron-cli-CSy4-JGS.js} +20 -20
- package/dist/{cron-cli-Db6fardJ.js → cron-cli-Db3uCDIT.js} +21 -21
- package/dist/{daemon-cli-Xe22v7lZ.js → daemon-cli-BLbzcTuD.js} +61 -22
- package/dist/{daemon-cli-BlHK0ly2.js → daemon-cli-DR0D35MO.js} +60 -21
- package/dist/{daemon-runtime-CMqH8BUE.js → daemon-runtime-ZWXvLDxx.js} +3 -3
- package/dist/{daemon-runtime-DwQFvDXZ.js → daemon-runtime-pVcZ2KDE.js} +3 -3
- package/dist/{deliver-CD7-BhYD.js → deliver-BHNoC9Yk.js} +396 -290
- package/dist/{deliver-BdGjIcTC.js → deliver-C_5eGQrX.js} +392 -286
- package/dist/{deliver-nTKaXF--.js → deliver-DPHZlWgr.js} +392 -287
- package/dist/{deliver-CDMGxRoW.js → deliver-geVWJ52I.js} +394 -288
- package/dist/{deps-BDQ_K8zf.js → deps-CP0dcOgD.js} +2 -2
- package/dist/{deps-D60FbgTP.js → deps-DW5r2IEk.js} +2 -2
- package/dist/{devices-cli-N559801X.js → devices-cli-BViqX5pl.js} +15 -15
- package/dist/{devices-cli-IxmPLIk8.js → devices-cli-DpYaY-iM.js} +14 -14
- package/dist/{directory-cli-Caq-OYk8.js → directory-cli-BWD1DdKf.js} +16 -16
- package/dist/{directory-cli-ClrdmQL-.js → directory-cli-BcvZfkfo.js} +17 -17
- package/dist/{dispatcher-BfXtm4Dl.js → dispatcher-4Qn951N3.js} +5 -3
- package/dist/{dns-cli-DgVO0Pkw.js → dns-cli-_Ych2tu9.js} +12 -12
- package/dist/{dns-cli-BTNZkWHs.js → dns-cli-gQCxUXgU.js} +13 -13
- package/dist/{docs-cli-9Xan7C6D.js → docs-cli-Bseiau7J.js} +7 -7
- package/dist/{docs-cli-DZULc91f.js → docs-cli-DzBTlWQE.js} +8 -8
- package/dist/{doctor-D39rZvNH.js → doctor-BNkYYahD.js} +37 -36
- package/dist/{doctor-Dq1YeYdH.js → doctor-DzIgdPx1.js} +37 -36
- package/dist/entry.js +77 -21
- package/dist/{env-B5YXooWp.js → env-BUuSkE19.js} +1 -1
- package/dist/{exec-DFOtZbI0.js → exec-BPQSKwGa.js} +5 -3
- package/dist/{exec-B8JKbXKW.js → exec-DqZFMawz.js} +5 -3
- package/dist/{exec-Bas1hoSJ.js → exec-EKUaAU91.js} +57 -18
- package/dist/{exec-CiH_vkWn.js → exec-_PSUrMP8.js} +528 -19
- package/dist/{exec-approvals-DGPTjO0N.js → exec-approvals-Bqk-tIxY.js} +134 -51
- package/dist/{exec-approvals-C9InMoAB.js → exec-approvals-C67V-ljH.js} +134 -51
- package/dist/{exec-approvals-cli-EASbqFd-.js → exec-approvals-cli-D6vfSqQu.js} +22 -22
- package/dist/{exec-approvals-cli-DPHItoxG.js → exec-approvals-cli-DAdoki_R.js} +21 -21
- package/dist/extensionAPI.js +8518 -9140
- package/dist/fetch-Bz1WxfzV.js +285 -0
- package/dist/fetch-D2O8s8I1.js +285 -0
- package/dist/fetch-Dm-nCwa_.js +285 -0
- package/dist/fetch-wuOZDzdT.js +285 -0
- package/dist/{gateway-cli-BFqUIif8.js → gateway-cli-C-k7JPlr.js} +1868 -1072
- package/dist/{gateway-cli-v4kSPsLE.js → gateway-cli-DIIJ9Z0Y.js} +1870 -1074
- package/dist/{gateway-rpc-D6LrkcSA.js → gateway-rpc-D6jLh81b.js} +3 -3
- package/dist/{gateway-rpc-dHFK02Kk.js → gateway-rpc-aqysUyf5.js} +3 -3
- package/dist/{github-copilot-auth-CQIWc0hC.js → github-copilot-auth-BUqfX7hG.js} +316 -52
- package/dist/{github-copilot-auth-D2jfnapd.js → github-copilot-auth-By-nyRb6.js} +316 -52
- package/dist/{github-copilot-token-SLWintYd.js → github-copilot-token-C9W4SY9o.js} +7 -4
- package/dist/{github-copilot-token-BW-SEg7E.js → github-copilot-token-CiF5Iyi2.js} +6 -3
- package/dist/{github-copilot-token-C9IJh2Pn.js → github-copilot-token-DatTe1w-.js} +6 -3
- package/dist/{github-copilot-token-wCk9Fg_E.js → github-copilot-token-c9Igt3ZH.js} +6 -3
- package/dist/{gmail-setup-utils-CVNgLkXL.js → gmail-setup-utils-HvKMdooP.js} +4 -4
- package/dist/{gmail-setup-utils-CAM1vbUS.js → gmail-setup-utils-c-iF00aL.js} +3 -3
- package/dist/{health-format-C77hrjEQ.js → health-format-BORnJOeS.js} +106 -44
- package/dist/{health-format-DDYtlkB9.js → health-format-Nd0jcoqM.js} +105 -43
- package/dist/{help-format-CUnac_bT.js → help-format-Cd5PLwXe.js} +1 -1
- package/dist/{help-format-aiW76js8.js → help-format-DYBEvMOX.js} +1 -1
- package/dist/{hooks-cli-DsflBRxX.js → hooks-cli-3KdsbdRi.js} +53 -47
- package/dist/{hooks-cli-C7kctMuZ.js → hooks-cli-BThja6wK.js} +53 -47
- package/dist/{hooks-status-DRAVHSPg.js → hooks-status-BbIz0zmm.js} +6 -5
- package/dist/{hooks-status-lHWrY64E.js → hooks-status-DPJORMB6.js} +6 -5
- package/dist/{image--gbzucyh.js → image-BaJKrmCs.js} +12 -8
- package/dist/{image-ORs4LLwg.js → image-D-5pUELC.js} +13 -9
- package/dist/{image-DMnjYGdA.js → image-TvL5YI_W.js} +13 -9
- package/dist/{image-BVNytEIn.js → image-bodq5cUH.js} +13 -9
- package/dist/index.js +261 -109
- package/dist/{installs-CXGV291R.js → installs-BrOMqREO.js} +7 -6
- package/dist/{installs-89zeUsVn.js → installs-z69au9Te.js} +7 -6
- package/dist/{links-Dg90NTyF.js → links-AVB88xxH.js} +1 -1
- package/dist/{links-7M-j83As.js → links-DpxpaKe1.js} +1 -1
- package/dist/llm-slug-generator.js +18 -19
- package/dist/{loader-BnzQyT31.js → loader-CS-5lMQa.js} +3694 -4531
- package/dist/{logging-DuK6YXuK.js → logging-B3KnAryz.js} +2 -2
- package/dist/{logging-CNq0UUgf.js → logging-DEPo2hji.js} +1 -1
- package/dist/{login-qr-CJ__cE3-.js → login-qr--28WL1TN.js} +11 -5
- package/dist/{login-qr-BVeOFfNW.js → login-qr-4o2aC2UE.js} +9 -4
- package/dist/{login-qr-BJChByHH.js → login-qr-BUdeu1Sl.js} +8 -2
- package/dist/{login-qr-KUOtNJaQ.js → login-qr-BsYM2E1y.js} +12 -6
- package/dist/{logs-cli-Cm7AiarR.js → logs-cli-DDMD5w5_.js} +38 -22
- package/dist/{logs-cli-BWmtAsjp.js → logs-cli-DvPoVKCN.js} +38 -22
- package/dist/{manager-C-jXr9ks.js → manager-CXo1uqmO.js} +102 -86
- package/dist/{manager-CMFBuvVd.js → manager-ChW0jk7T.js} +101 -85
- package/dist/{manager-D2Ndphg3.js → manager-DUOe7ud6.js} +100 -85
- package/dist/{manager-BsdlwsL5.js → manager-PoxUqdN_.js} +98 -82
- package/dist/{manifest-registry-D5SiA3xq.js → manifest-registry-CVsqjgX0.js} +40 -2
- package/dist/{manifest-registry-DyMRD3rY.js → manifest-registry-jeAPx6AW.js} +40 -2
- package/dist/{message-channel-CHRYQtAM.js → message-channel-CTtrEkmW.js} +1 -1
- package/dist/{message-channel-BlgPSDAh.js → message-channel-DWcu72r7.js} +1 -1
- package/dist/{model-auth-BqjMkNFs.js → model-auth-BvODRbV0.js} +362 -35
- package/dist/{model-selection-DbsbOAoh.js → model-selection-B53OvWCf.js} +353 -33
- package/dist/{model-selection-DlV6wnTr.js → model-selection-vC82fEiP.js} +331 -30
- package/dist/{models-cli-DIFBrK4W.js → models-cli-DqsKsOgd.js} +66 -55
- package/dist/{models-cli-0XhQQbMW.js → models-cli-NV0bnh8l.js} +66 -55
- package/dist/{node-cli-BMUfVCSq.js → node-cli-C7YleuBk.js} +54 -44
- package/dist/{node-cli-DY4lzhDA.js → node-cli-CxwoHnZ6.js} +54 -44
- package/dist/{node-service-DQ-tiSie.js → node-service-C7f_uvx9.js} +2 -2
- package/dist/{node-service-u8g85nD3.js → node-service-De_WkxJe.js} +2 -2
- package/dist/{nodes-cli-BX6oWnLC.js → nodes-cli-BxrMVI9V.js} +25 -23
- package/dist/{nodes-cli-CVHzcQo2.js → nodes-cli-Clb0ocwB.js} +24 -22
- package/dist/{nodes-screen-DGlNPbk4.js → nodes-screen-CVL9363A.js} +48 -6
- package/dist/{nodes-screen-lykd2cny.js → nodes-screen-DsHJIN2I.js} +47 -5
- package/dist/{note-Ci08TSbV.js → note-Duiadw1g.js} +1 -1
- package/dist/{note-DVO1KLaW.js → note-uC6iDp4y.js} +2 -2
- package/dist/{onboard-channels-DTkFFbzS.js → onboard-channels-C5Iaafwb.js} +10 -10
- package/dist/{onboard-channels-CtDnwaF5.js → onboard-channels-C5uL3i8d.js} +11 -11
- package/dist/{onboard-skills-BnAcpzfX.js → onboard-skills-BFxdI1Y1.js} +1143 -112
- package/dist/{onboard-skills-DuoDzEmI.js → onboard-skills-DUG8Y0se.js} +1142 -111
- package/dist/{onboarding-DvhiiHh0.js → onboarding-ClzElK4D.js} +56 -48
- package/dist/{openclaw-root-93W6UrUK.js → openclaw-root-BKsZvO6K.js} +6 -2
- package/dist/{openclaw-root-9ILYSmJ9.js → openclaw-root-CEnmuBUN.js} +6 -2
- package/dist/{pairing-cli-BKJHBxwT.js → pairing-cli-BWWFZF7Q.js} +16 -16
- package/dist/{pairing-cli-DJHjPBwu.js → pairing-cli-BrFLxnug.js} +16 -16
- package/dist/{pairing-labels-xImhiJax.js → pairing-labels-C8KULWNH.js} +1 -1
- package/dist/{pairing-labels-CHxlh3tT.js → pairing-labels-Dt2vXyI7.js} +1 -1
- package/dist/{pairing-store-CO6umWFP.js → pairing-store-Dz-ArTQS.js} +3 -3
- package/dist/{pairing-store-BpPUNzmB.js → pairing-store-gQdv7Ruh.js} +2 -2
- package/dist/{path-env-Nq83EHH9.js → path-env-BRKerjt1.js} +2 -2
- package/dist/{path-env-CXWUFfFv.js → path-env-OJAyUeWW.js} +1 -1
- package/dist/paths-BZK4Ct0I.js +81 -0
- package/dist/paths-DWYi0R_2.js +78 -0
- package/dist/{paths-Bkhd_qY8.js → paths-DdKf4lHp.js} +35 -5
- package/dist/paths-SFzVNGbc.js +78 -0
- package/dist/pi-auth-json-D7hGObyW.js +12 -0
- package/dist/pi-auth-json-DgvHjfJy.js +8 -0
- package/dist/pi-auth-json-la6lnAzY.js +79 -0
- package/dist/pi-auth-json-p3vsMR7W.js +79 -0
- package/dist/{pi-embedded-C1qKCgDT.js → pi-embedded-De6SeAPs.js} +9518 -9968
- package/dist/{pi-embedded-helpers-DtPn5RC8.js → pi-embedded-helpers-BrUBxrE2.js} +70 -10
- package/dist/{pi-embedded-helpers-DhEkdWB1.js → pi-embedded-helpers-D0mqOwwq.js} +821 -128
- package/dist/{pi-embedded-helpers-7AjuNiiJ.js → pi-embedded-helpers-DpJb0kUk.js} +69 -9
- package/dist/{pi-embedded-helpers-BTkXgwJ7.js → pi-embedded-helpers-ZI1UCSRM.js} +927 -136
- package/dist/{pi-tools.policy-gG96mWwA.js → pi-tools.policy-z5Wd_2WN.js} +4 -4
- package/dist/{plugin-auto-enable-D5ye7QnB.js → plugin-auto-enable-B8mX3rX3.js} +14 -5
- package/dist/{plugin-auto-enable-BROgMZcf.js → plugin-auto-enable-OO0eDINB.js} +14 -5
- package/dist/plugin-sdk/agents/apply-patch-update.d.ts +3 -1
- package/dist/plugin-sdk/agents/apply-patch.d.ts +11 -3
- package/dist/plugin-sdk/agents/auth-profiles/profiles.d.ts +5 -0
- package/dist/plugin-sdk/agents/auth-profiles.d.ts +1 -1
- package/dist/plugin-sdk/agents/bash-process-registry.d.ts +1 -0
- package/dist/plugin-sdk/agents/bash-tools.exec.d.ts +26 -0
- package/dist/plugin-sdk/agents/current-time.d.ts +17 -0
- package/dist/plugin-sdk/agents/huggingface-models.d.ts +17 -0
- package/dist/plugin-sdk/agents/models-config.providers.d.ts +10 -0
- package/dist/plugin-sdk/agents/openclaw-tools.d.ts +2 -0
- package/dist/plugin-sdk/agents/pi-auth-json.d.ts +14 -0
- package/dist/plugin-sdk/agents/pi-embedded-helpers/errors.d.ts +5 -1
- package/dist/plugin-sdk/agents/pi-embedded-helpers.d.ts +1 -1
- package/dist/plugin-sdk/agents/pi-embedded-runner/google.d.ts +1 -0
- package/dist/plugin-sdk/agents/pi-embedded-runner/run/images.d.ts +9 -4
- package/dist/plugin-sdk/agents/pi-embedded-runner/run/params.d.ts +2 -0
- package/dist/plugin-sdk/agents/pi-embedded-runner/run/payloads.d.ts +1 -0
- package/dist/plugin-sdk/agents/pi-embedded-runner/run/types.d.ts +2 -0
- package/dist/plugin-sdk/agents/pi-embedded-runner/types.d.ts +15 -0
- package/dist/plugin-sdk/agents/pi-embedded-subscribe.handlers.tools.d.ts +1 -1
- package/dist/plugin-sdk/agents/pi-embedded-subscribe.handlers.types.d.ts +2 -0
- package/dist/plugin-sdk/agents/pi-embedded-subscribe.types.d.ts +2 -0
- package/dist/plugin-sdk/agents/pi-tools.read.d.ts +8 -3
- package/dist/plugin-sdk/agents/sandbox/constants.d.ts +1 -1
- package/dist/plugin-sdk/agents/sandbox/docker.d.ts +14 -3
- package/dist/plugin-sdk/agents/sandbox/fs-bridge.d.ts +56 -0
- package/dist/plugin-sdk/agents/sandbox/types.d.ts +2 -0
- package/dist/plugin-sdk/agents/session-tool-result-guard-wrapper.d.ts +2 -0
- package/dist/plugin-sdk/agents/session-tool-result-guard.d.ts +4 -0
- package/dist/plugin-sdk/agents/subagent-registry.d.ts +3 -1
- package/dist/plugin-sdk/agents/tools/agent-step.d.ts +3 -0
- package/dist/plugin-sdk/agents/tools/browser-tool.schema.d.ts +2 -2
- package/dist/plugin-sdk/agents/tools/common.d.ts +4 -0
- package/dist/plugin-sdk/agents/tools/image-tool.d.ts +9 -1
- package/dist/plugin-sdk/agents/tools/web-search.d.ts +10 -1
- package/dist/plugin-sdk/agents/usage.d.ts +1 -0
- package/dist/plugin-sdk/auto-reply/reply/commands-status.d.ts +1 -0
- package/dist/plugin-sdk/auto-reply/reply/get-reply-directives.d.ts +1 -0
- package/dist/plugin-sdk/auto-reply/reply/memory-flush.d.ts +2 -2
- package/dist/plugin-sdk/auto-reply/reply/mentions.d.ts +1 -0
- package/dist/plugin-sdk/auto-reply/reply/model-selection.d.ts +3 -0
- package/dist/plugin-sdk/auto-reply/reply/reply-reference.d.ts +1 -1
- package/dist/plugin-sdk/auto-reply/reply/session-run-accounting.d.ts +11 -0
- package/dist/plugin-sdk/auto-reply/reply/session-usage.d.ts +8 -0
- package/dist/plugin-sdk/auto-reply/status.d.ts +2 -0
- package/dist/plugin-sdk/auto-reply/templating.d.ts +3 -0
- package/dist/plugin-sdk/auto-reply/thinking.d.ts +1 -1
- package/dist/plugin-sdk/auto-reply/types.d.ts +2 -0
- package/dist/plugin-sdk/browser/cdp.helpers.d.ts +2 -1
- package/dist/plugin-sdk/browser/client-actions-core.d.ts +1 -0
- package/dist/plugin-sdk/browser/control-auth.d.ts +13 -0
- package/dist/plugin-sdk/browser/pw-ai.d.ts +1 -1
- package/dist/plugin-sdk/browser/pw-session.d.ts +25 -0
- package/dist/plugin-sdk/browser/pw-tools-core.interactions.d.ts +2 -0
- package/dist/plugin-sdk/browser/routes/dispatcher.d.ts +1 -0
- package/dist/plugin-sdk/browser/routes/types.d.ts +5 -0
- package/dist/plugin-sdk/channels/plugins/onboarding/signal.d.ts +1 -0
- package/dist/plugin-sdk/channels/registry.d.ts +2 -2
- package/dist/plugin-sdk/cli/nodes-camera.d.ts +8 -2
- package/dist/plugin-sdk/cli/prompt.d.ts +1 -0
- package/dist/plugin-sdk/commands/agent/types.d.ts +2 -0
- package/dist/plugin-sdk/commands/onboard-helpers.d.ts +1 -0
- package/dist/plugin-sdk/commands/onboard-types.d.ts +9 -1
- package/dist/plugin-sdk/commands/signal-install.d.ts +20 -0
- package/dist/plugin-sdk/config/config.d.ts +1 -1
- package/dist/plugin-sdk/config/group-policy.d.ts +3 -0
- package/dist/plugin-sdk/config/merge-patch.d.ts +1 -0
- package/dist/plugin-sdk/config/sessions/paths.d.ts +14 -4
- package/dist/plugin-sdk/config/sessions/store.d.ts +8 -0
- package/dist/plugin-sdk/config/sessions/types.d.ts +8 -0
- package/dist/plugin-sdk/config/types.agents.d.ts +2 -0
- package/dist/plugin-sdk/config/types.channels.d.ts +2 -0
- package/dist/plugin-sdk/config/types.d.ts +1 -0
- package/dist/plugin-sdk/config/types.discord.d.ts +5 -0
- package/dist/plugin-sdk/config/types.gateway.d.ts +35 -0
- package/dist/plugin-sdk/config/types.hooks.d.ts +23 -1
- package/dist/plugin-sdk/config/types.irc.d.ts +96 -0
- package/dist/plugin-sdk/config/types.memory.d.ts +2 -0
- package/dist/plugin-sdk/config/types.openclaw.d.ts +6 -0
- package/dist/plugin-sdk/config/types.queue.d.ts +1 -0
- package/dist/plugin-sdk/config/types.slack.d.ts +2 -0
- package/dist/plugin-sdk/config/types.telegram.d.ts +2 -0
- package/dist/plugin-sdk/config/validation.d.ts +20 -0
- package/dist/plugin-sdk/config/zod-schema.agents.d.ts +1 -0
- package/dist/plugin-sdk/config/zod-schema.core.d.ts +2 -0
- package/dist/plugin-sdk/config/zod-schema.d.ts +193 -2
- package/dist/plugin-sdk/config/zod-schema.hooks.d.ts +3 -2
- package/dist/plugin-sdk/config/zod-schema.providers-core.d.ts +378 -0
- package/dist/plugin-sdk/config/zod-schema.providers.d.ts +176 -0
- package/dist/plugin-sdk/config/zod-schema.sensitive.d.ts +2 -0
- package/dist/plugin-sdk/config/zod-schema.session.d.ts +1 -0
- package/dist/plugin-sdk/cron/service/jobs.d.ts +8 -0
- package/dist/plugin-sdk/cron/service/state.d.ts +1 -0
- package/dist/plugin-sdk/cron/types.d.ts +2 -0
- package/dist/plugin-sdk/discord/monitor/allow-list.d.ts +15 -0
- package/dist/plugin-sdk/discord/send.types.d.ts +5 -0
- package/dist/plugin-sdk/gateway/auth-rate-limit.d.ts +59 -0
- package/dist/plugin-sdk/gateway/auth.d.ts +47 -0
- package/dist/plugin-sdk/gateway/net.d.ts +5 -0
- package/dist/plugin-sdk/gateway/protocol/index.d.ts +7 -7
- package/dist/plugin-sdk/gateway/protocol/schema/agent.d.ts +7 -1
- package/dist/plugin-sdk/gateway/protocol/schema/channels.d.ts +21 -0
- package/dist/plugin-sdk/gateway/protocol/schema/types.d.ts +3 -1
- package/dist/plugin-sdk/gateway/session-utils.fs.d.ts +3 -1
- package/dist/plugin-sdk/gateway/session-utils.types.d.ts +1 -0
- package/dist/plugin-sdk/imessage/send.d.ts +12 -0
- package/dist/plugin-sdk/index.js +2147 -900
- package/dist/plugin-sdk/infra/binaries.d.ts +3 -0
- package/dist/plugin-sdk/infra/brew.d.ts +8 -0
- package/dist/plugin-sdk/infra/heartbeat-active-hours.d.ts +5 -0
- package/dist/plugin-sdk/infra/heartbeat-runner.d.ts +1 -0
- package/dist/plugin-sdk/infra/heartbeat-wake.d.ts +8 -1
- package/dist/plugin-sdk/infra/net/fetch-guard.d.ts +1 -0
- package/dist/plugin-sdk/infra/net/ssrf.d.ts +1 -0
- package/dist/plugin-sdk/infra/outbound/message.d.ts +2 -0
- package/dist/plugin-sdk/infra/outbound/outbound-send-service.d.ts +2 -0
- package/dist/plugin-sdk/infra/session-cost-usage.d.ts +3 -0
- package/dist/plugin-sdk/infra/tailscale.d.ts +34 -0
- package/dist/plugin-sdk/infra/tmp-openclaw-dir.d.ts +10 -0
- package/dist/plugin-sdk/logging/console.d.ts +4 -0
- package/dist/plugin-sdk/logging/logger.d.ts +1 -1
- package/dist/plugin-sdk/logging/state.d.ts +1 -0
- package/dist/plugin-sdk/logging.d.ts +2 -2
- package/dist/plugin-sdk/markdown/ir.d.ts +1 -1
- package/dist/plugin-sdk/markdown/whatsapp.d.ts +14 -0
- package/dist/plugin-sdk/media/input-files.d.ts +5 -0
- package/dist/plugin-sdk/media/store.d.ts +10 -0
- package/dist/plugin-sdk/media-understanding/audio-preflight.d.ts +16 -0
- package/dist/plugin-sdk/media-understanding/types.d.ts +1 -0
- package/dist/plugin-sdk/memory/backend-config.d.ts +2 -1
- package/dist/plugin-sdk/memory/embedding-chunk-limits.d.ts +3 -0
- package/dist/plugin-sdk/memory/embedding-input-limits.d.ts +2 -0
- package/dist/plugin-sdk/memory/embedding-model-limits.d.ts +2 -0
- package/dist/plugin-sdk/memory/embeddings.d.ts +1 -0
- package/dist/plugin-sdk/memory/internal.d.ts +11 -0
- package/dist/plugin-sdk/memory/manager.d.ts +0 -6
- package/dist/plugin-sdk/memory/qmd-manager.d.ts +2 -0
- package/dist/plugin-sdk/memory/qmd-query-parser.d.ts +8 -0
- package/dist/plugin-sdk/memory/session-files.d.ts +2 -0
- package/dist/plugin-sdk/process/command-queue.d.ts +16 -0
- package/dist/plugin-sdk/providers/github-copilot-token.d.ts +3 -0
- package/dist/plugin-sdk/routing/resolve-route.d.ts +3 -1
- package/dist/plugin-sdk/security/external-content.d.ts +1 -1
- package/dist/plugin-sdk/security/secret-equal.d.ts +1 -0
- package/dist/plugin-sdk/sessions/input-provenance.d.ts +16 -0
- package/dist/plugin-sdk/signal/monitor/event-handler.types.d.ts +8 -0
- package/dist/plugin-sdk/signal/monitor/mentions.d.ts +2 -0
- package/dist/plugin-sdk/slack/monitor/commands.d.ts +5 -0
- package/dist/plugin-sdk/slack/monitor/media.d.ts +21 -0
- package/dist/plugin-sdk/slack/types.d.ts +1 -0
- package/dist/plugin-sdk/telegram/bot-message-context.d.ts +2 -1
- package/dist/plugin-sdk/telegram/fetch.d.ts +1 -0
- package/dist/plugin-sdk/telegram/monitor.d.ts +1 -0
- package/dist/plugin-sdk/telegram/send.d.ts +3 -0
- package/dist/plugin-sdk/tts/tts.d.ts +2 -2
- package/dist/plugin-sdk/utils/fetch-timeout.d.ts +2 -0
- package/dist/plugin-sdk/web/media.d.ts +12 -2
- package/dist/{plugins-CQw3z3Nw.js → plugins-CTjLu-z-.js} +4 -4
- package/dist/{plugins-B7F0Ly9G.js → plugins-CxrdL_IZ.js} +3 -3
- package/dist/{plugins-cli-CJ74eHvr.js → plugins-cli-CbX97Kvt.js} +259 -49
- package/dist/{plugins-cli-ubDwUAzK.js → plugins-cli-Dn9OeO53.js} +257 -47
- package/dist/{ports-kYsTYQdA.js → ports-C8YYHVlc.js} +2 -2
- package/dist/{program-1bQ15ivo.js → program-D-mNC0It.js} +86 -83
- package/dist/{progress-Da1ehW-x.js → progress-COHv-uNT.js} +1 -1
- package/dist/{progress-COzt9PNY.js → progress-DZb6yPcJ.js} +1 -1
- package/dist/{prompt-style-Dc0C5HC9.js → prompt-style-Cf1r1L6k.js} +1 -1
- package/dist/{prompt-style-DjZDxcFg.js → prompt-style-lSlXMhsd.js} +1 -1
- package/dist/{pw-ai-CQ4-gUNR.js → pw-ai-6GzTgK5g.js} +205 -32
- package/dist/{pw-ai-1NN0FrJb.js → pw-ai-C8YhJRaI.js} +207 -32
- package/dist/{pw-ai-qEMUq5Mt.js → pw-ai-CKGenizV.js} +203 -29
- package/dist/{pw-ai-IOqEXO1O.js → pw-ai-D7devT89.js} +206 -32
- package/dist/{qmd-manager-CEwp3el1.js → qmd-manager-CQzWovq-.js} +71 -90
- package/dist/{qmd-manager-D6N3qvQ5.js → qmd-manager-Cs8RJVQp.js} +73 -90
- package/dist/{qmd-manager-C48QzrRe.js → qmd-manager-DdgrQ2kc.js} +71 -88
- package/dist/{qmd-manager-DaUqCKB_.js → qmd-manager-dyIoOvKl.js} +73 -90
- package/dist/{register.subclis-Cm-VJ5nP.js → register.subclis-ifHtmF3e.js} +29 -29
- package/dist/{reply-CBs4e9Rm.js → reply-VIHqsQ-k.js} +7906 -8743
- package/dist/{routes-9ygR0GOk.js → routes-CaCvio4Q.js} +36 -15
- package/dist/{routes-BrWrBk2R.js → routes-Cpfxk96k.js} +36 -14
- package/dist/{rpc-Cjuz2Gv1.js → rpc-BhB01Bhj.js} +3 -3
- package/dist/{rpc-DhkLVY5H.js → rpc-C5WsS_Ne.js} +3 -3
- package/dist/{run-main-BlZ5l-X9.js → run-main-DVy6KJTe.js} +88 -85
- package/dist/runner-B7CKBC80.js +1800 -0
- package/dist/runner-BEy5ZGFv.js +1901 -0
- package/dist/runner-Bv0BmJPF.js +1800 -0
- package/dist/runner-ChqVEgPx.js +1901 -0
- package/dist/{sandbox-qt49csTr.js → sandbox-BAChxjC5.js} +627 -157
- package/dist/{sandbox-CPZiaKcS.js → sandbox-DNHDwHw8.js} +628 -158
- package/dist/{sandbox-cli-C6_iNuqO.js → sandbox-cli-9oq67QEg.js} +22 -22
- package/dist/{sandbox-cli-C_wK-KAE.js → sandbox-cli-BiNq9yUe.js} +22 -22
- package/dist/{security-cli-CTTD1vms.js → security-cli-CRg03hvq.js} +28 -28
- package/dist/{security-cli-DRpGF2Yc.js → security-cli-LmBBHnmh.js} +28 -28
- package/dist/{server-context-lyNcqJYD.js → server-context-FwqBRH3K.js} +10 -10
- package/dist/{server-context-39mkstUs.js → server-context-RY7lRaxl.js} +9 -9
- package/dist/{server-node-events-V_G9BRRw.js → server-node-events-BbHOZX3O.js} +48 -43
- package/dist/{server-node-events-o9G18PaE.js → server-node-events-CngNLVL-.js} +50 -45
- package/dist/{service-DOlJdIqe.js → service-BnqdBTAK.js} +8 -4
- package/dist/{service-DDPRbf8a.js → service-DZN7KRok.js} +8 -4
- package/dist/{service-audit-VDRrWefh.js → service-audit-0Eil3ISN.js} +4 -4
- package/dist/{service-audit-CVy00Ze_.js → service-audit-B8KIOe8A.js} +4 -4
- package/dist/{session-cost-usage-CcCEQNuc.js → session-cost-usage-B-tyjp76.js} +14 -14
- package/dist/{session-cost-usage-PvyVZz-g.js → session-cost-usage-BYUb7fov.js} +14 -14
- package/dist/{shared-BnpC3wMU.js → shared-BCdNboU1.js} +3 -3
- package/dist/{shared-CagUDdmp.js → shared-CsAwU6-q.js} +3 -3
- package/dist/{shared-BDk_zC9p.js → shared-Csn6DLBA.js} +5 -5
- package/dist/{shared-C92wo-6f.js → shared-DEanAgja.js} +4 -4
- package/dist/{skill-scanner-C_fQzVDu.js → skill-scanner-BrGkh5K7.js} +1 -1
- package/dist/{skill-scanner-DrVEHfC6.js → skill-scanner-CucvxYhu.js} +1 -1
- package/dist/{skills-Ccsv3IQq.js → skills-CE7by2IF.js} +151 -8
- package/dist/{skills-_eKGrw9z.js → skills-Dz15dAM4.js} +152 -9
- package/dist/{skills-cli-DqvLjooh.js → skills-cli-B5b75pDK.js} +13 -13
- package/dist/{skills-cli-DUncybht.js → skills-cli-CbCDrYwp.js} +13 -13
- package/dist/{skills-status-Cp2ZFhIx.js → skills-status-B99Us6yS.js} +2 -2
- package/dist/{skills-status-Ck0CCFZG.js → skills-status-ChM7JE47.js} +3 -3
- package/dist/{sqlite-DODNHWJb.js → sqlite-2UsPaJz5.js} +97 -2
- package/dist/{sqlite-cSdsHVEw.js → sqlite-CASnHrgX.js} +97 -1
- package/dist/{sqlite-Bwo2rASR.js → sqlite-CVWiMkGu.js} +97 -1
- package/dist/{sqlite-CpqIbY4-.js → sqlite-CcIWkGaM.js} +97 -1
- package/dist/{status-Bmx9_1C7.js → status-CKuX1-zb.js} +3 -3
- package/dist/{status-CBGgwlTW.js → status-Cm4q6o-I.js} +57 -49
- package/dist/{status-DkJgtvSz.js → status-DD2iqGc9.js} +4 -4
- package/dist/{subsystem-DPnkvS73.js → subsystem-DHfJG4gk.js} +73 -20
- package/dist/{system-cli-9fQ1uLiz.js → system-cli-BVJDR474.js} +87 -15
- package/dist/{system-cli-Gq8OWHFg.js → system-cli-C3Y_9VpI.js} +88 -16
- package/dist/{systemd-Pa7LURHB.js → systemd-DxddcFsa.js} +3 -3
- package/dist/{systemd-hints-zi4ohCOY.js → systemd-hints-BVLopJ9O.js} +1 -1
- package/dist/{systemd-linger-CDo2UbHM.js → systemd-linger-BThjV1Sr.js} +2 -2
- package/dist/{systemd-linger-6_naJcJp.js → systemd-linger-D3Va1Cv7.js} +2 -2
- package/dist/{systemd-BEWwfwn0.js → systemd-s3S2HVog.js} +3 -3
- package/dist/{table-Bb9gAVIp.js → table-BIk8Aan_.js} +2 -2
- package/dist/{table-cCoGqLsk.js → table-Bvka_vkc.js} +1 -1
- package/dist/{tool-display-DUVhO36P.js → tool-display-DbdMQFZx.js} +2 -2
- package/dist/{tool-display-DNOVCI6J.js → tool-display-kpW5Hg2z.js} +2 -2
- package/dist/{tui-DDVqLwqT.js → tui-B40Z2jMa.js} +120 -14
- package/dist/{tui-cli-CurbazQf.js → tui-cli-Bwa6K7xR.js} +28 -28
- package/dist/{tui-cli-BeN2K38I.js → tui-cli-DD6g7uZb.js} +27 -27
- package/dist/{tui-B9zLJxf6.js → tui-lFMZUnx6.js} +121 -13
- package/dist/{update-Ct9sqJC_.js → update-Bos8PPCG.js} +3 -3
- package/dist/{update--i077azM.js → update-Cg8MtrEr.js} +3 -3
- package/dist/{update-cli-CT5W0kpw.js → update-cli-CC-wTeje.js} +92 -73
- package/dist/{update-cli-C87lNK1S.js → update-cli-CULnXFL_.js} +91 -72
- package/dist/{update-runner-BIttRDyV.js → update-runner-BaLsla0c.js} +11 -11
- package/dist/{update-runner-xbeVkAD9.js → update-runner-Dbsdl5AU.js} +10 -10
- package/dist/{utils-Dk86IbEs.js → utils-BLJAc3ZV.js} +1 -1
- package/dist/{utils-BTaR--Ln.js → utils-BtIMES3N.js} +1 -1
- package/dist/{webhooks-cli-Db3zyJaw.js → webhooks-cli-ClHLUu_j.js} +21 -13
- package/dist/{webhooks-cli-DUUa8gVY.js → webhooks-cli-DVXr2uyN.js} +21 -13
- package/dist/{widearea-dns-BgYasW6m.js → widearea-dns-C4RnIR9O.js} +3 -3
- package/dist/{widearea-dns-CMIG6-74.js → widearea-dns-Ypwgjpsr.js} +3 -3
- package/dist/{ws-C0k_dhCP.js → ws-BcJt4pcg.js} +24 -2
- package/dist/{ws-DtDKpbLR.js → ws-MC-rTJLe.js} +24 -2
- package/dist/{ws-log-cMNgAyLy.js → ws-log-WrJ4QYu7.js} +1 -1
- package/dist/{ws-log-C6vm_XMA.js → ws-log-lip4ETlm.js} +2 -2
- package/dist/{wsl-rfIr_Sde.js → wsl-BvTIzy-8.js} +5 -3
- package/docs/assets/install-script.svg +1 -0
- package/docs/automation/hooks.md +1 -38
- package/docs/automation/webhook.md +52 -2
- package/docs/channels/discord.md +389 -381
- package/docs/channels/grammy.md +1 -1
- package/docs/channels/imessage.md +229 -218
- package/docs/channels/index.md +1 -0
- package/docs/channels/irc.md +234 -0
- package/docs/channels/msteams.md +2 -0
- package/docs/channels/pairing.md +1 -1
- package/docs/channels/slack.md +295 -415
- package/docs/channels/telegram.md +397 -460
- package/docs/channels/whatsapp.md +338 -310
- package/docs/ci.md +0 -12
- package/docs/cli/hooks.md +1 -14
- package/docs/cli/index.md +6 -1
- package/docs/cli/logs.md +4 -0
- package/docs/cli/onboard.md +33 -0
- package/docs/cli/plugins.md +20 -1
- package/docs/cli/security.md +2 -0
- package/docs/concepts/architecture.md +0 -16
- package/docs/concepts/memory.md +7 -4
- package/docs/concepts/model-providers.md +27 -0
- package/docs/concepts/session-tool.md +1 -0
- package/docs/concepts/system-prompt.md +13 -0
- package/docs/docs.json +18 -12
- package/docs/experiments/plans/browser-evaluate-cdp-refactor.md +229 -0
- package/docs/gateway/configuration-examples.md +9 -2
- package/docs/gateway/configuration-reference.md +2345 -0
- package/docs/gateway/configuration.md +338 -3297
- package/docs/gateway/index.md +162 -238
- package/docs/gateway/openai-http-api.md +1 -0
- package/docs/gateway/openresponses-http-api.md +16 -0
- package/docs/gateway/remote-gateway-readme.md +0 -16
- package/docs/gateway/security/index.md +4 -16
- package/docs/gateway/tools-invoke-http-api.md +26 -1
- package/docs/help/faq.md +9 -0
- package/docs/help/testing.md +11 -0
- package/docs/install/docker.md +18 -0
- package/docs/install/hetzner.md +21 -0
- package/docs/install/installer.md +20 -0
- package/docs/nodes/audio.md +19 -0
- package/docs/platforms/mac/release.md +7 -7
- package/docs/providers/glm.md +3 -3
- package/docs/providers/huggingface.md +209 -0
- package/docs/providers/index.md +3 -0
- package/docs/providers/litellm.md +153 -0
- package/docs/providers/together.md +2 -2
- package/docs/providers/vllm.md +92 -0
- package/docs/providers/zai.md +2 -2
- package/docs/reference/credits.md +4 -28
- package/docs/reference/test.md +2 -1
- package/docs/reference/token-use.md +1 -1
- package/docs/reference/transcript-hygiene.md +18 -0
- package/docs/start/getting-started.md +5 -0
- package/docs/start/onboarding-overview.md +51 -0
- package/docs/start/onboarding.md +1 -0
- package/docs/start/openclaw.md +0 -16
- package/docs/start/wizard-cli-automation.md +17 -0
- package/docs/start/wizard-cli-reference.md +12 -0
- package/docs/start/wizard.md +3 -1
- package/docs/tools/browser.md +6 -0
- package/docs/zh-CN/automation/hooks.md +1 -38
- package/docs/zh-CN/cli/hooks.md +1 -14
- package/extensions/bluebubbles/package.json +1 -1
- package/extensions/bluebubbles/src/monitor.test.ts +40 -28
- package/extensions/bluebubbles/src/monitor.ts +0 -4
- package/extensions/copilot-proxy/package.json +1 -1
- package/extensions/diagnostics-otel/package.json +10 -10
- package/extensions/discord/package.json +1 -1
- package/extensions/feishu/package.json +2 -5
- package/extensions/feishu/src/bot.checkBotMentioned.test.ts +64 -0
- package/extensions/feishu/src/bot.test.ts +265 -0
- package/extensions/feishu/src/bot.ts +73 -18
- package/extensions/feishu/src/channel.test.ts +48 -0
- package/extensions/feishu/src/channel.ts +1 -3
- package/extensions/feishu/src/config-schema.ts +6 -0
- package/extensions/feishu/src/docx.ts +14 -4
- package/extensions/feishu/src/media.test.ts +151 -0
- package/extensions/feishu/src/media.ts +27 -13
- package/extensions/feishu/src/reply-dispatcher.test.ts +116 -0
- package/extensions/feishu/src/reply-dispatcher.ts +124 -67
- package/extensions/feishu/src/streaming-card.ts +223 -0
- package/extensions/feishu/src/targets.test.ts +16 -0
- package/extensions/feishu/src/targets.ts +1 -1
- package/extensions/google-antigravity-auth/package.json +1 -1
- package/extensions/google-gemini-cli-auth/oauth.test.ts +4 -1
- package/extensions/google-gemini-cli-auth/package.json +1 -1
- package/extensions/googlechat/package.json +1 -1
- package/extensions/googlechat/src/channel.ts +3 -20
- package/extensions/googlechat/src/resolve-target.test.ts +138 -0
- package/extensions/imessage/package.json +1 -1
- package/extensions/irc/index.ts +17 -0
- package/extensions/irc/openclaw.plugin.json +9 -0
- package/extensions/irc/package.json +14 -0
- package/extensions/irc/src/accounts.ts +268 -0
- package/extensions/irc/src/channel.ts +367 -0
- package/extensions/irc/src/client.test.ts +43 -0
- package/extensions/irc/src/client.ts +439 -0
- package/extensions/irc/src/config-schema.test.ts +27 -0
- package/extensions/irc/src/config-schema.ts +97 -0
- package/extensions/irc/src/control-chars.ts +22 -0
- package/extensions/irc/src/inbound.ts +334 -0
- package/extensions/irc/src/monitor.test.ts +43 -0
- package/extensions/irc/src/monitor.ts +158 -0
- package/extensions/irc/src/normalize.test.ts +46 -0
- package/extensions/irc/src/normalize.ts +117 -0
- package/extensions/irc/src/onboarding.test.ts +118 -0
- package/extensions/irc/src/onboarding.ts +479 -0
- package/extensions/irc/src/policy.test.ts +132 -0
- package/extensions/irc/src/policy.ts +157 -0
- package/extensions/irc/src/probe.ts +64 -0
- package/extensions/irc/src/protocol.test.ts +44 -0
- package/extensions/irc/src/protocol.ts +169 -0
- package/extensions/irc/src/runtime.ts +14 -0
- package/extensions/irc/src/send.ts +99 -0
- package/extensions/irc/src/types.ts +94 -0
- 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/node_modules/.bin/markdown-it +2 -2
- package/extensions/matrix/node_modules/.bin/markdown-it.CMD +2 -2
- package/extensions/matrix/node_modules/.bin/markdown-it.ps1 +2 -2
- package/extensions/matrix/package.json +2 -2
- package/extensions/matrix/src/matrix/monitor/media.ts +4 -2
- package/extensions/mattermost/package.json +1 -1
- package/extensions/memory-core/package.json +1 -1
- package/extensions/memory-lancedb/index.ts +6 -2
- 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/index.ts +7 -5
- 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/media-helpers.test.ts +9 -0
- package/extensions/msteams/src/media-helpers.ts +15 -1
- package/extensions/msteams/src/mentions.test.ts +235 -0
- package/extensions/msteams/src/mentions.ts +114 -0
- package/extensions/msteams/src/messenger.test.ts +81 -1
- package/extensions/msteams/src/messenger.ts +11 -2
- package/extensions/nextcloud-talk/package.json +1 -1
- package/extensions/nostr/CHANGELOG.md +6 -0
- package/extensions/nostr/package.json +2 -2
- 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/telegram/src/channel.ts +1 -0
- package/extensions/tlon/package.json +1 -1
- package/extensions/twitch/CHANGELOG.md +6 -0
- package/extensions/twitch/package.json +1 -1
- package/extensions/twitch/src/onboarding.test.ts +5 -0
- package/extensions/twitch/src/outbound.test.ts +17 -6
- package/extensions/twitch/src/outbound.ts +12 -10
- package/extensions/voice-call/CHANGELOG.md +6 -0
- package/extensions/voice-call/package.json +1 -1
- package/extensions/voice-call/src/media-stream.ts +7 -1
- package/extensions/voice-call/src/providers/twilio.test.ts +5 -3
- package/extensions/voice-call/src/providers/twilio.ts +12 -1
- package/extensions/whatsapp/package.json +1 -1
- package/extensions/whatsapp/src/channel.ts +6 -16
- package/extensions/whatsapp/src/resolve-target.test.ts +154 -0
- package/extensions/zalo/CHANGELOG.md +6 -0
- package/extensions/zalo/package.json +1 -1
- package/extensions/zalouser/CHANGELOG.md +6 -0
- package/extensions/zalouser/package.json +1 -1
- package/package.json +26 -22
- package/dist/auth-BcNHFK-i.js +0 -184
- package/dist/auth-DkjJ3pm-.js +0 -184
- package/dist/boolean-M-esQJt6.js +0 -30
- package/dist/bundled/soul-evil/HOOK.md +0 -71
- package/dist/bundled/soul-evil/handler.js +0 -194
- package/dist/cli-B631__JU.js +0 -89
- package/dist/cli-DVhCVZZ6.js +0 -86
- package/dist/config-CI7EpvlP.js +0 -15
- package/dist/constants-DuoCkWRh.js +0 -65
- package/dist/control-ui/assets/index-CnB9IO4a.js.map +0 -1
- package/dist/control-ui/assets/index-DWhx-9JL.css +0 -1
- package/dist/date-time-c6HTX6IW.js +0 -187
- package/dist/frontmatter-xwTm0734.js +0 -105
- package/dist/parse-DqAvJRIf.js +0 -23
- package/dist/parse-duration-De_tAQSe.js +0 -24
- package/dist/parse-timeout-DV8NQQWk.js +0 -16
- package/dist/paths-IivnSNkP.js +0 -51
- package/dist/paths-MnZaxqPw.js +0 -48
- package/dist/paths-uoGO2aiO.js +0 -48
- package/dist/pi-model-discovery-DzFOAbQt.js +0 -20
- package/dist/plugin-sdk/tui/tui-formatters.d.ts +0 -31
- package/dist/session-key-nXYQSv-a.js +0 -167
- package/dist/tailscale-DU6DgqVy.js +0 -225
- package/dist/tailscale-DzJUWmKf.js +0 -252
- package/dist/utils-dp_OM900.js +0 -476
- package/docs/hooks/soul-evil.md +0 -69
- package/docs/zh-CN/hooks/soul-evil.md +0 -72
- package/skills/local-places/SERVER_README.md +0 -101
- package/skills/local-places/SKILL.md +0 -102
- package/skills/local-places/pyproject.toml +0 -21
- package/skills/local-places/src/local_places/__init__.py +0 -2
- package/skills/local-places/src/local_places/google_places.py +0 -314
- package/skills/local-places/src/local_places/main.py +0 -65
- package/skills/local-places/src/local_places/schemas.py +0 -107
- /package/dist/{archive-CXhvR9nU.js → archive-aSMUcOc6.js} +0 -0
- /package/dist/{archive-D0z3LZDK.js → archive-beaSfAzA.js} +0 -0
- /package/dist/{brew-BIrWdDps.js → brew-DlQQMJ3n.js} +0 -0
- /package/dist/{brew-B7YK4ZoL.js → brew-ROHf0-Xp.js} +0 -0
- /package/dist/{cli-utils-PlLcDZlM.js → cli-utils-CRhVAaLV.js} +0 -0
- /package/dist/{cli-utils-R-ECs5cY.js → cli-utils-CodyYLHe.js} +0 -0
- /package/dist/{command-format-BUxhT1xL.js → command-format-qUVxzqYm.js} +0 -0
- /package/dist/{constants-CNTiY-ZN.js → constants-BvQ6S8j5.js} +0 -0
- /package/dist/{errors-D3tYRJWG.js → errors-B91HIDPD.js} +0 -0
- /package/dist/{errors-B0eT3jVv.js → errors-Bv81hF2P.js} +0 -0
- /package/dist/{errors-x4NYs-1P.js → errors-Cojm0Kl7.js} +0 -0
- /package/dist/{format-CaxeRcue.js → format-CL8VOhxX.js} +0 -0
- /package/dist/{format-DLOJPZmo.js → format-DcfK-dwd.js} +0 -0
- /package/dist/{format-duration-CEmFWLyX.js → format-duration--hQihAvf.js} +0 -0
- /package/dist/{format-duration-DCXJx2ba.js → format-duration-84n6_DgO.js} +0 -0
- /package/dist/{format-relative-79_Y1n2Y.js → format-relative-Cywx6ldk.js} +0 -0
- /package/dist/{format-relative-Db7eqEu8.js → format-relative-cegC_FF5.js} +0 -0
- /package/dist/{helpers-CQI-5xS9.js → helpers-8O7IVGO-.js} +0 -0
- /package/dist/{helpers-DdwqKAAS.js → helpers-ByYj2Aq5.js} +0 -0
- /package/dist/{helpers-CRzoyyXS.js → helpers-CUVSCDJV.js} +0 -0
- /package/dist/{helpers-C89IG08W.js → helpers-HyeZXsnu.js} +0 -0
- /package/dist/{is-main-qJ675wPV.js → is-main-B9A8S9YC.js} +0 -0
- /package/dist/{is-main-WWuz28Ip.js → is-main-BWoXGz7p.js} +0 -0
- /package/dist/{logging-BzvBIA3Y.js → logging-D-Jq2wIo.js} +0 -0
- /package/dist/{logging-CfEk_PnX.js → logging-fywhKCmE.js} +0 -0
- /package/dist/{parse-Cjiudy6x.js → parse-Bw0oH-rT.js} +0 -0
- /package/dist/{parse-log-line-CUrpqe1w.js → parse-log-line-BuRiE-Ij.js} +0 -0
- /package/dist/{parse-log-line-D2UGw0wR.js → parse-log-line-CfVgwy6x.js} +0 -0
- /package/dist/{parse-timeout-DFSPLxpY.js → parse-timeout-D1XX_zN_.js} +0 -0
- /package/dist/{pi-model-discovery-CV2V1HHz.js → pi-model-discovery-DqgqUyAv.js} +0 -0
- /package/dist/{pi-model-discovery-DzEIEgHL.js → pi-model-discovery-EwKVHlZB.js} +0 -0
- /package/dist/{prompts--d-6l5Ln.js → prompts-Bg96reub.js} +0 -0
- /package/dist/{prompts-CXLLIBwP.js → prompts-Dszjy1n_.js} +0 -0
- /package/dist/{redact-BRmQPYDR.js → redact-BIMJ3ntQ.js} +0 -0
- /package/dist/{redact-BHmk44DI.js → redact-BRsnXqwD.js} +0 -0
- /package/dist/{redact-DAKeu7PA.js → redact-UvkXqguc.js} +0 -0
- /package/dist/{status-Cv36yYdi.js → status-C_dMhoE0.js} +0 -0
- /package/dist/{status-Drziap9H.js → status-DCkF_L3U.js} +0 -0
- /package/dist/{systemd-hints-CH4pbCFD.js → systemd-hints-CXNtLw9Q.js} +0 -0
- /package/dist/{tailnet-CL5GtL7t.js → tailnet-DATIFSsY.js} +0 -0
- /package/dist/{tailnet-DGRSvYuQ.js → tailnet-uoFvUSsw.js} +0 -0
- /package/dist/{transcript-events-BlIONGVn.js → transcript-events-BHS7QoRl.js} +0 -0
- /package/dist/{transcript-events-C1hdue6u.js → transcript-events-Bp7fGnwv.js} +0 -0
- /package/dist/{transcript-events-CZ8CG4ht.js → transcript-events-Ch7wLX-j.js} +0 -0
- /package/dist/{usage-format-6Uar63S0.js → usage-format-Bhl_WCWP.js} +0 -0
- /package/dist/{usage-format-hd37en6b.js → usage-format-CpORtVCG.js} +0 -0
- /package/extensions/{feishu → irc}/node_modules/.bin/claw +0 -0
- /package/extensions/{feishu → irc}/node_modules/.bin/claw.CMD +0 -0
- /package/extensions/{feishu → irc}/node_modules/.bin/claw.ps1 +0 -0
- /package/extensions/{feishu → irc}/node_modules/.bin/moltbot +0 -0
- /package/extensions/{feishu → irc}/node_modules/.bin/moltbot.CMD +0 -0
- /package/extensions/{feishu → irc}/node_modules/.bin/moltbot.ps1 +0 -0
- /package/extensions/{feishu → irc}/node_modules/.bin/pigbot +0 -0
- /package/extensions/{feishu → irc}/node_modules/.bin/pigbot.CMD +0 -0
- /package/extensions/{feishu → irc}/node_modules/.bin/pigbot.ps1 +0 -0
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import { i as resolveGatewayPort, t as STATE_DIR } from "./paths-BZtyHNCi.js";
|
|
2
|
-
import { c as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { t as
|
|
7
|
-
import {
|
|
8
|
-
import { t as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { C as DEFAULT_AI_SNAPSHOT_MAX_CHARS, D as DEFAULT_OPENCLAW_BROWSER_ENABLED, E as DEFAULT_OPENCLAW_BROWSER_COLOR, O as DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME, S as DEFAULT_AI_SNAPSHOT_EFFICIENT_MAX_CHARS, T as DEFAULT_BROWSER_EVALUATE_ENABLED, a as resolveOpenClawUserDataDir, c as captureScreenshot, d as normalizeCdpWsUrl, f as snapshotAria, g as stopChromeExtensionRelayServer, h as ensureChromeExtensionRelayServer, i as launchOpenClawChrome, l as createTargetViaCdp, m as getHeadersWithAuth, n as isChromeCdpReady, o as stopOpenClawChrome, p as appendCdpPath, r as isChromeReachable, s as resolveBrowserExecutableForPlatform, v as isLoopbackHost, w as DEFAULT_BROWSER_DEFAULT_PROFILE_NAME, x as DEFAULT_AI_SNAPSHOT_EFFICIENT_DEPTH } from "./chrome-CxRJz4ZD.js";
|
|
12
|
-
import { t as parseFrontmatterBlock } from "./frontmatter-xwTm0734.js";
|
|
13
|
-
import { n as formatErrorMessage, t as extractErrorCode } from "./errors-D3tYRJWG.js";
|
|
14
|
-
import { r as resolveSessionTranscriptPath, t as resolveDefaultSessionStorePath } from "./paths-MnZaxqPw.js";
|
|
15
|
-
import { t as emitSessionTranscriptUpdate } from "./transcript-events-BlIONGVn.js";
|
|
2
|
+
import { C as resolveOpenClawPackageRootSync, D as buildAgentMainSessionKey, M as normalizeAgentId, N as normalizeMainKey, P as resolveAgentIdFromSessionKey, T as DEFAULT_AGENT_ID, _ as DEFAULT_TOOLS_FILENAME, c as resolveDefaultAgentId, d as DEFAULT_AGENTS_FILENAME, f as DEFAULT_AGENT_WORKSPACE_DIR, g as DEFAULT_SOUL_FILENAME, h as DEFAULT_IDENTITY_FILENAME, j as normalizeAccountId$1, l as resolveSessionAgentId, m as DEFAULT_HEARTBEAT_FILENAME, n as resolveAgentConfig, p as DEFAULT_BOOTSTRAP_FILENAME, v as DEFAULT_USER_FILENAME, w as DEFAULT_ACCOUNT_ID, y as ensureAgentWorkspace } from "./agent-scope-DASgjz2_.js";
|
|
3
|
+
import { F as normalizeE164, L as resolveConfigDir, S as requireActivePluginRegistry, _ as getChatChannelMeta, b as normalizeChatChannelId, h as CHAT_CHANNEL_ORDER, k as escapeRegExp, l as createSubsystemLogger, m as CHANNEL_IDS, n as runExec, ot as resolvePreferredOpenClawTmpDir, u as defaultRuntime, v as normalizeAnyChannelId, w as CONFIG_DIR, x as getActivePluginRegistry, z as resolveUserPath } from "./exec-_PSUrMP8.js";
|
|
4
|
+
import { G as parseBooleanValue, W as isTruthyEnvValue } from "./model-auth-BvODRbV0.js";
|
|
5
|
+
import { t as formatCliCommand } from "./command-format-qUVxzqYm.js";
|
|
6
|
+
import { _ as normalizePluginsConfig, f as loadPluginManifestRegistry, h as MANIFEST_KEY, i as writeConfigFile, j as resolveWhatsAppAccount, m as LEGACY_MANIFEST_KEYS, o as parseByteSize, t as loadConfig, u as parseDurationMs, v as resolveEnableState, y as resolveMemorySlotDecision } from "./config-D8pgDSNo.js";
|
|
7
|
+
import { A as DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME, C as DEFAULT_AI_SNAPSHOT_EFFICIENT_DEPTH, D as DEFAULT_BROWSER_EVALUATE_ENABLED, E as DEFAULT_BROWSER_DEFAULT_PROFILE_NAME, O as DEFAULT_OPENCLAW_BROWSER_COLOR, T as DEFAULT_AI_SNAPSHOT_MAX_CHARS, _ as ensureChromeExtensionRelayServer, a as resolveOpenClawUserDataDir, b as isLoopbackHost, c as captureScreenshot, d as normalizeCdpWsUrl, f as snapshotAria, h as getHeadersWithAuth, i as launchOpenClawChrome, k as DEFAULT_OPENCLAW_BROWSER_ENABLED, l as createTargetViaCdp, n as isChromeCdpReady, o as stopOpenClawChrome, p as appendCdpPath, r as isChromeReachable, s as resolveBrowserExecutableForPlatform, v as stopChromeExtensionRelayServer, w as DEFAULT_AI_SNAPSHOT_EFFICIENT_MAX_CHARS } from "./chrome-n_3rtK2c.js";
|
|
8
|
+
import { n as formatErrorMessage, t as extractErrorCode } from "./errors-B91HIDPD.js";
|
|
9
|
+
import { n as resolveSessionFilePath, t as resolveDefaultSessionStorePath } from "./paths-SFzVNGbc.js";
|
|
10
|
+
import { t as emitSessionTranscriptUpdate } from "./transcript-events-BHS7QoRl.js";
|
|
16
11
|
import fs from "node:fs/promises";
|
|
17
12
|
import os from "node:os";
|
|
18
13
|
import path from "node:path";
|
|
@@ -23,6 +18,7 @@ import { fileURLToPath } from "node:url";
|
|
|
23
18
|
import { CURRENT_SESSION_VERSION, SessionManager, formatSkillsForPrompt, loadSkillsFromDir } from "@mariozechner/pi-coding-agent";
|
|
24
19
|
import crypto, { createHash } from "node:crypto";
|
|
25
20
|
import { fileTypeFromBuffer } from "file-type";
|
|
21
|
+
import YAML from "yaml";
|
|
26
22
|
import express from "express";
|
|
27
23
|
import { lookup } from "node:dns";
|
|
28
24
|
import { lookup as lookup$1 } from "node:dns/promises";
|
|
@@ -1334,6 +1330,108 @@ function resolveSandboxConfigForAgent(cfg, agentId) {
|
|
|
1334
1330
|
};
|
|
1335
1331
|
}
|
|
1336
1332
|
|
|
1333
|
+
//#endregion
|
|
1334
|
+
//#region src/markdown/frontmatter.ts
|
|
1335
|
+
function stripQuotes(value) {
|
|
1336
|
+
if (value.startsWith("\"") && value.endsWith("\"") || value.startsWith("'") && value.endsWith("'")) return value.slice(1, -1);
|
|
1337
|
+
return value;
|
|
1338
|
+
}
|
|
1339
|
+
function coerceFrontmatterValue(value) {
|
|
1340
|
+
if (value === null || value === void 0) return;
|
|
1341
|
+
if (typeof value === "string") return value.trim();
|
|
1342
|
+
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
1343
|
+
if (typeof value === "object") try {
|
|
1344
|
+
return JSON.stringify(value);
|
|
1345
|
+
} catch {
|
|
1346
|
+
return;
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
function parseYamlFrontmatter(block) {
|
|
1350
|
+
try {
|
|
1351
|
+
const parsed = YAML.parse(block);
|
|
1352
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
1353
|
+
const result = {};
|
|
1354
|
+
for (const [rawKey, value] of Object.entries(parsed)) {
|
|
1355
|
+
const key = rawKey.trim();
|
|
1356
|
+
if (!key) continue;
|
|
1357
|
+
const coerced = coerceFrontmatterValue(value);
|
|
1358
|
+
if (coerced === void 0) continue;
|
|
1359
|
+
result[key] = coerced;
|
|
1360
|
+
}
|
|
1361
|
+
return result;
|
|
1362
|
+
} catch {
|
|
1363
|
+
return null;
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
function extractMultiLineValue(lines, startIndex) {
|
|
1367
|
+
const match = lines[startIndex].match(/^([\w-]+):\s*(.*)$/);
|
|
1368
|
+
if (!match) return {
|
|
1369
|
+
value: "",
|
|
1370
|
+
linesConsumed: 1
|
|
1371
|
+
};
|
|
1372
|
+
const inlineValue = match[2].trim();
|
|
1373
|
+
if (inlineValue) return {
|
|
1374
|
+
value: inlineValue,
|
|
1375
|
+
linesConsumed: 1
|
|
1376
|
+
};
|
|
1377
|
+
const valueLines = [];
|
|
1378
|
+
let i = startIndex + 1;
|
|
1379
|
+
while (i < lines.length) {
|
|
1380
|
+
const line = lines[i];
|
|
1381
|
+
if (line.length > 0 && !line.startsWith(" ") && !line.startsWith(" ")) break;
|
|
1382
|
+
valueLines.push(line);
|
|
1383
|
+
i++;
|
|
1384
|
+
}
|
|
1385
|
+
return {
|
|
1386
|
+
value: valueLines.join("\n").trim(),
|
|
1387
|
+
linesConsumed: i - startIndex
|
|
1388
|
+
};
|
|
1389
|
+
}
|
|
1390
|
+
function parseLineFrontmatter(block) {
|
|
1391
|
+
const frontmatter = {};
|
|
1392
|
+
const lines = block.split("\n");
|
|
1393
|
+
let i = 0;
|
|
1394
|
+
while (i < lines.length) {
|
|
1395
|
+
const match = lines[i].match(/^([\w-]+):\s*(.*)$/);
|
|
1396
|
+
if (!match) {
|
|
1397
|
+
i++;
|
|
1398
|
+
continue;
|
|
1399
|
+
}
|
|
1400
|
+
const key = match[1];
|
|
1401
|
+
const inlineValue = match[2].trim();
|
|
1402
|
+
if (!key) {
|
|
1403
|
+
i++;
|
|
1404
|
+
continue;
|
|
1405
|
+
}
|
|
1406
|
+
if (!inlineValue && i + 1 < lines.length) {
|
|
1407
|
+
const nextLine = lines[i + 1];
|
|
1408
|
+
if (nextLine.startsWith(" ") || nextLine.startsWith(" ")) {
|
|
1409
|
+
const { value, linesConsumed } = extractMultiLineValue(lines, i);
|
|
1410
|
+
if (value) frontmatter[key] = value;
|
|
1411
|
+
i += linesConsumed;
|
|
1412
|
+
continue;
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
const value = stripQuotes(inlineValue);
|
|
1416
|
+
if (value) frontmatter[key] = value;
|
|
1417
|
+
i++;
|
|
1418
|
+
}
|
|
1419
|
+
return frontmatter;
|
|
1420
|
+
}
|
|
1421
|
+
function parseFrontmatterBlock(content) {
|
|
1422
|
+
const normalized = content.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
1423
|
+
if (!normalized.startsWith("---")) return {};
|
|
1424
|
+
const endIndex = normalized.indexOf("\n---", 3);
|
|
1425
|
+
if (endIndex === -1) return {};
|
|
1426
|
+
const block = normalized.slice(4, endIndex);
|
|
1427
|
+
const lineParsed = parseLineFrontmatter(block);
|
|
1428
|
+
const yamlParsed = parseYamlFrontmatter(block);
|
|
1429
|
+
if (yamlParsed === null) return lineParsed;
|
|
1430
|
+
const merged = { ...yamlParsed };
|
|
1431
|
+
for (const [key, value] of Object.entries(lineParsed)) if (value.startsWith("{") || value.startsWith("[")) merged[key] = value;
|
|
1432
|
+
return merged;
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1337
1435
|
//#endregion
|
|
1338
1436
|
//#region src/agents/skills/frontmatter.ts
|
|
1339
1437
|
function parseFrontmatter(content) {
|
|
@@ -1479,8 +1577,16 @@ function isBundledSkillAllowed(entry, allowlist) {
|
|
|
1479
1577
|
}
|
|
1480
1578
|
function hasBinary(bin) {
|
|
1481
1579
|
const parts = (process.env.PATH ?? "").split(path.delimiter).filter(Boolean);
|
|
1482
|
-
|
|
1483
|
-
|
|
1580
|
+
const winPathExt = process.env.PATHEXT;
|
|
1581
|
+
const winExtensions = winPathExt !== void 0 ? winPathExt.split(";").filter(Boolean) : [
|
|
1582
|
+
".EXE",
|
|
1583
|
+
".CMD",
|
|
1584
|
+
".BAT",
|
|
1585
|
+
".COM"
|
|
1586
|
+
];
|
|
1587
|
+
const extensions = process.platform === "win32" ? ["", ...winExtensions] : [""];
|
|
1588
|
+
for (const part of parts) for (const ext of extensions) {
|
|
1589
|
+
const candidate = path.join(part, bin + ext);
|
|
1484
1590
|
try {
|
|
1485
1591
|
fs$1.accessSync(candidate, fs$1.constants.X_OK);
|
|
1486
1592
|
return true;
|
|
@@ -1581,6 +1687,83 @@ function applySkillEnvOverridesFromSnapshot(params) {
|
|
|
1581
1687
|
};
|
|
1582
1688
|
}
|
|
1583
1689
|
|
|
1690
|
+
//#endregion
|
|
1691
|
+
//#region src/agents/sandbox-paths.ts
|
|
1692
|
+
const UNICODE_SPACES = /[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g;
|
|
1693
|
+
const HTTP_URL_RE = /^https?:\/\//i;
|
|
1694
|
+
const DATA_URL_RE = /^data:/i;
|
|
1695
|
+
function normalizeUnicodeSpaces(str) {
|
|
1696
|
+
return str.replace(UNICODE_SPACES, " ");
|
|
1697
|
+
}
|
|
1698
|
+
function expandPath(filePath) {
|
|
1699
|
+
const normalized = normalizeUnicodeSpaces(filePath);
|
|
1700
|
+
if (normalized === "~") return os.homedir();
|
|
1701
|
+
if (normalized.startsWith("~/")) return os.homedir() + normalized.slice(1);
|
|
1702
|
+
return normalized;
|
|
1703
|
+
}
|
|
1704
|
+
function resolveToCwd(filePath, cwd) {
|
|
1705
|
+
const expanded = expandPath(filePath);
|
|
1706
|
+
if (path.isAbsolute(expanded)) return expanded;
|
|
1707
|
+
return path.resolve(cwd, expanded);
|
|
1708
|
+
}
|
|
1709
|
+
function resolveSandboxPath(params) {
|
|
1710
|
+
const resolved = resolveToCwd(params.filePath, params.cwd);
|
|
1711
|
+
const rootResolved = path.resolve(params.root);
|
|
1712
|
+
const relative = path.relative(rootResolved, resolved);
|
|
1713
|
+
if (!relative || relative === "") return {
|
|
1714
|
+
resolved,
|
|
1715
|
+
relative: ""
|
|
1716
|
+
};
|
|
1717
|
+
if (relative.startsWith("..") || path.isAbsolute(relative)) throw new Error(`Path escapes sandbox root (${shortPath(rootResolved)}): ${params.filePath}`);
|
|
1718
|
+
return {
|
|
1719
|
+
resolved,
|
|
1720
|
+
relative
|
|
1721
|
+
};
|
|
1722
|
+
}
|
|
1723
|
+
async function assertSandboxPath(params) {
|
|
1724
|
+
const resolved = resolveSandboxPath(params);
|
|
1725
|
+
await assertNoSymlink(resolved.relative, path.resolve(params.root));
|
|
1726
|
+
return resolved;
|
|
1727
|
+
}
|
|
1728
|
+
function assertMediaNotDataUrl(media) {
|
|
1729
|
+
const raw = media.trim();
|
|
1730
|
+
if (DATA_URL_RE.test(raw)) throw new Error("data: URLs are not supported for media. Use buffer instead.");
|
|
1731
|
+
}
|
|
1732
|
+
async function resolveSandboxedMediaSource(params) {
|
|
1733
|
+
const raw = params.media.trim();
|
|
1734
|
+
if (!raw) return raw;
|
|
1735
|
+
if (HTTP_URL_RE.test(raw)) return raw;
|
|
1736
|
+
let candidate = raw;
|
|
1737
|
+
if (/^file:\/\//i.test(candidate)) try {
|
|
1738
|
+
candidate = fileURLToPath(candidate);
|
|
1739
|
+
} catch {
|
|
1740
|
+
throw new Error(`Invalid file:// URL for sandboxed media: ${raw}`);
|
|
1741
|
+
}
|
|
1742
|
+
return (await assertSandboxPath({
|
|
1743
|
+
filePath: candidate,
|
|
1744
|
+
cwd: params.sandboxRoot,
|
|
1745
|
+
root: params.sandboxRoot
|
|
1746
|
+
})).resolved;
|
|
1747
|
+
}
|
|
1748
|
+
async function assertNoSymlink(relative, root) {
|
|
1749
|
+
if (!relative) return;
|
|
1750
|
+
const parts = relative.split(path.sep).filter(Boolean);
|
|
1751
|
+
let current = root;
|
|
1752
|
+
for (const part of parts) {
|
|
1753
|
+
current = path.join(current, part);
|
|
1754
|
+
try {
|
|
1755
|
+
if ((await fs.lstat(current)).isSymbolicLink()) throw new Error(`Symlink not allowed in sandbox path: ${current}`);
|
|
1756
|
+
} catch (err) {
|
|
1757
|
+
if (err.code === "ENOENT") return;
|
|
1758
|
+
throw err;
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
function shortPath(value) {
|
|
1763
|
+
if (value.startsWith(os.homedir())) return `~${value.slice(os.homedir().length)}`;
|
|
1764
|
+
return value;
|
|
1765
|
+
}
|
|
1766
|
+
|
|
1584
1767
|
//#endregion
|
|
1585
1768
|
//#region src/agents/skills/bundled-dir.ts
|
|
1586
1769
|
function looksLikeSkillsDir(dir) {
|
|
@@ -1738,7 +1921,7 @@ function loadSkillEntries(workspaceDir, opts) {
|
|
|
1738
1921
|
return [];
|
|
1739
1922
|
};
|
|
1740
1923
|
const managedSkillsDir = opts?.managedSkillsDir ?? path.join(CONFIG_DIR, "skills");
|
|
1741
|
-
const workspaceSkillsDir = path.
|
|
1924
|
+
const workspaceSkillsDir = path.resolve(workspaceDir, "skills");
|
|
1742
1925
|
const bundledSkillsDir = opts?.bundledSkillsDir ?? resolveBundledSkillsDir();
|
|
1743
1926
|
const extraDirs = (opts?.config?.skills?.load?.extraDirs ?? []).map((d) => typeof d === "string" ? d.trim() : "").filter(Boolean);
|
|
1744
1927
|
const pluginSkillDirs = resolvePluginSkillDirs({
|
|
@@ -1760,6 +1943,14 @@ function loadSkillEntries(workspaceDir, opts) {
|
|
|
1760
1943
|
dir: managedSkillsDir,
|
|
1761
1944
|
source: "openclaw-managed"
|
|
1762
1945
|
});
|
|
1946
|
+
const personalAgentsSkills = loadSkills({
|
|
1947
|
+
dir: path.resolve(os.homedir(), ".agents", "skills"),
|
|
1948
|
+
source: "agents-skills-personal"
|
|
1949
|
+
});
|
|
1950
|
+
const projectAgentsSkills = loadSkills({
|
|
1951
|
+
dir: path.resolve(workspaceDir, ".agents", "skills"),
|
|
1952
|
+
source: "agents-skills-project"
|
|
1953
|
+
});
|
|
1763
1954
|
const workspaceSkills = loadSkills({
|
|
1764
1955
|
dir: workspaceSkillsDir,
|
|
1765
1956
|
source: "openclaw-workspace"
|
|
@@ -1768,6 +1959,8 @@ function loadSkillEntries(workspaceDir, opts) {
|
|
|
1768
1959
|
for (const skill of extraSkills) merged.set(skill.name, skill);
|
|
1769
1960
|
for (const skill of bundledSkills) merged.set(skill.name, skill);
|
|
1770
1961
|
for (const skill of managedSkills) merged.set(skill.name, skill);
|
|
1962
|
+
for (const skill of personalAgentsSkills) merged.set(skill.name, skill);
|
|
1963
|
+
for (const skill of projectAgentsSkills) merged.set(skill.name, skill);
|
|
1771
1964
|
for (const skill of workspaceSkills) merged.set(skill.name, skill);
|
|
1772
1965
|
return Array.from(merged.values()).map((skill) => {
|
|
1773
1966
|
let frontmatter = {};
|
|
@@ -1814,6 +2007,36 @@ function resolveSkillsPromptForRun(params) {
|
|
|
1814
2007
|
function loadWorkspaceSkillEntries(workspaceDir, opts) {
|
|
1815
2008
|
return loadSkillEntries(workspaceDir, opts);
|
|
1816
2009
|
}
|
|
2010
|
+
function resolveUniqueSyncedSkillDirName(base, used) {
|
|
2011
|
+
if (!used.has(base)) {
|
|
2012
|
+
used.add(base);
|
|
2013
|
+
return base;
|
|
2014
|
+
}
|
|
2015
|
+
for (let index = 2; index < 1e4; index += 1) {
|
|
2016
|
+
const candidate = `${base}-${index}`;
|
|
2017
|
+
if (!used.has(candidate)) {
|
|
2018
|
+
used.add(candidate);
|
|
2019
|
+
return candidate;
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
let fallbackIndex = 1e4;
|
|
2023
|
+
let fallback = `${base}-${fallbackIndex}`;
|
|
2024
|
+
while (used.has(fallback)) {
|
|
2025
|
+
fallbackIndex += 1;
|
|
2026
|
+
fallback = `${base}-${fallbackIndex}`;
|
|
2027
|
+
}
|
|
2028
|
+
used.add(fallback);
|
|
2029
|
+
return fallback;
|
|
2030
|
+
}
|
|
2031
|
+
function resolveSyncedSkillDestinationPath(params) {
|
|
2032
|
+
const sourceDirName = path.basename(params.entry.skill.baseDir).trim();
|
|
2033
|
+
if (!sourceDirName || sourceDirName === "." || sourceDirName === "..") return null;
|
|
2034
|
+
return resolveSandboxPath({
|
|
2035
|
+
filePath: resolveUniqueSyncedSkillDirName(sourceDirName, params.usedDirNames),
|
|
2036
|
+
cwd: params.targetSkillsDir,
|
|
2037
|
+
root: params.targetSkillsDir
|
|
2038
|
+
}).resolved;
|
|
2039
|
+
}
|
|
1817
2040
|
async function syncSkillsToWorkspace(params) {
|
|
1818
2041
|
const sourceDir = resolveUserPath(params.sourceWorkspaceDir);
|
|
1819
2042
|
const targetDir = resolveUserPath(params.targetWorkspaceDir);
|
|
@@ -1830,8 +2053,24 @@ async function syncSkillsToWorkspace(params) {
|
|
|
1830
2053
|
force: true
|
|
1831
2054
|
});
|
|
1832
2055
|
await fsp.mkdir(targetSkillsDir, { recursive: true });
|
|
2056
|
+
const usedDirNames = /* @__PURE__ */ new Set();
|
|
1833
2057
|
for (const entry of entries) {
|
|
1834
|
-
|
|
2058
|
+
let dest = null;
|
|
2059
|
+
try {
|
|
2060
|
+
dest = resolveSyncedSkillDestinationPath({
|
|
2061
|
+
targetSkillsDir,
|
|
2062
|
+
entry,
|
|
2063
|
+
usedDirNames
|
|
2064
|
+
});
|
|
2065
|
+
} catch (error) {
|
|
2066
|
+
const message = error instanceof Error ? error.message : JSON.stringify(error);
|
|
2067
|
+
console.warn(`[skills] Failed to resolve safe destination for ${entry.skill.name}: ${message}`);
|
|
2068
|
+
continue;
|
|
2069
|
+
}
|
|
2070
|
+
if (!dest) {
|
|
2071
|
+
console.warn(`[skills] Failed to resolve safe destination for ${entry.skill.name}: invalid source directory name`);
|
|
2072
|
+
continue;
|
|
2073
|
+
}
|
|
1835
2074
|
try {
|
|
1836
2075
|
await fsp.cp(entry.skill.baseDir, dest, {
|
|
1837
2076
|
recursive: true,
|
|
@@ -1944,7 +2183,7 @@ function isModuleNotFoundError(err) {
|
|
|
1944
2183
|
}
|
|
1945
2184
|
async function loadPwAiModule(mode) {
|
|
1946
2185
|
try {
|
|
1947
|
-
return await import("./pw-ai-
|
|
2186
|
+
return await import("./pw-ai-6GzTgK5g.js");
|
|
1948
2187
|
} catch (err) {
|
|
1949
2188
|
if (mode === "soft") return null;
|
|
1950
2189
|
if (isModuleNotFoundError(err)) return null;
|
|
@@ -2289,12 +2528,16 @@ function registerBrowserAgentActRoutes(app, ctx) {
|
|
|
2289
2528
|
const fn = toStringOrEmpty(body.fn);
|
|
2290
2529
|
if (!fn) return jsonError(res, 400, "fn is required");
|
|
2291
2530
|
const ref = toStringOrEmpty(body.ref) || void 0;
|
|
2292
|
-
const
|
|
2531
|
+
const evalTimeoutMs = toNumber(body.timeoutMs);
|
|
2532
|
+
const evalRequest = {
|
|
2293
2533
|
cdpUrl,
|
|
2294
2534
|
targetId: tab.targetId,
|
|
2295
2535
|
fn,
|
|
2296
|
-
ref
|
|
2297
|
-
|
|
2536
|
+
ref,
|
|
2537
|
+
signal: req.signal
|
|
2538
|
+
};
|
|
2539
|
+
if (evalTimeoutMs !== void 0) evalRequest.timeoutMs = evalTimeoutMs;
|
|
2540
|
+
const result = await pw.evaluateViaPlaywright(evalRequest);
|
|
2298
2541
|
return res.json({
|
|
2299
2542
|
ok: true,
|
|
2300
2543
|
targetId: tab.targetId,
|
|
@@ -2497,6 +2740,7 @@ function registerBrowserAgentActRoutes(app, ctx) {
|
|
|
2497
2740
|
|
|
2498
2741
|
//#endregion
|
|
2499
2742
|
//#region src/browser/routes/agent.debug.ts
|
|
2743
|
+
const DEFAULT_TRACE_DIR = resolvePreferredOpenClawTmpDir();
|
|
2500
2744
|
function registerBrowserAgentDebugRoutes(app, ctx) {
|
|
2501
2745
|
app.get("/console", async (req, res) => {
|
|
2502
2746
|
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
@@ -2607,7 +2851,7 @@ function registerBrowserAgentDebugRoutes(app, ctx) {
|
|
|
2607
2851
|
const pw = await requirePwAi(res, "trace stop");
|
|
2608
2852
|
if (!pw) return;
|
|
2609
2853
|
const id = crypto.randomUUID();
|
|
2610
|
-
const dir =
|
|
2854
|
+
const dir = DEFAULT_TRACE_DIR;
|
|
2611
2855
|
await fs.mkdir(dir, { recursive: true });
|
|
2612
2856
|
const tracePath = out.trim() || path.join(dir, `browser-trace-${id}.zip`);
|
|
2613
2857
|
await pw.traceStopViaPlaywright({
|
|
@@ -2650,6 +2894,22 @@ function normalizeHostnameSet(values) {
|
|
|
2650
2894
|
if (!values || values.length === 0) return /* @__PURE__ */ new Set();
|
|
2651
2895
|
return new Set(values.map((value) => normalizeHostname(value)).filter(Boolean));
|
|
2652
2896
|
}
|
|
2897
|
+
function normalizeHostnameAllowlist(values) {
|
|
2898
|
+
if (!values || values.length === 0) return [];
|
|
2899
|
+
return Array.from(new Set(values.map((value) => normalizeHostname(value)).filter((value) => value !== "*" && value !== "*." && value.length > 0)));
|
|
2900
|
+
}
|
|
2901
|
+
function isHostnameAllowedByPattern(hostname, pattern) {
|
|
2902
|
+
if (pattern.startsWith("*.")) {
|
|
2903
|
+
const suffix = pattern.slice(2);
|
|
2904
|
+
if (!suffix || hostname === suffix) return false;
|
|
2905
|
+
return hostname.endsWith(`.${suffix}`);
|
|
2906
|
+
}
|
|
2907
|
+
return hostname === pattern;
|
|
2908
|
+
}
|
|
2909
|
+
function matchesHostnameAllowlist(hostname, allowlist) {
|
|
2910
|
+
if (allowlist.length === 0) return true;
|
|
2911
|
+
return allowlist.some((pattern) => isHostnameAllowedByPattern(hostname, pattern));
|
|
2912
|
+
}
|
|
2653
2913
|
function parseIpv4(address) {
|
|
2654
2914
|
const parts = address.split(".");
|
|
2655
2915
|
if (parts.length !== 4) return null;
|
|
@@ -2750,7 +3010,10 @@ async function resolvePinnedHostnameWithPolicy(hostname, params = {}) {
|
|
|
2750
3010
|
const normalized = normalizeHostname(hostname);
|
|
2751
3011
|
if (!normalized) throw new Error("Invalid hostname");
|
|
2752
3012
|
const allowPrivateNetwork = Boolean(params.policy?.allowPrivateNetwork);
|
|
2753
|
-
const
|
|
3013
|
+
const allowedHostnames = normalizeHostnameSet(params.policy?.allowedHostnames);
|
|
3014
|
+
const hostnameAllowlist = normalizeHostnameAllowlist(params.policy?.hostnameAllowlist);
|
|
3015
|
+
const isExplicitAllowed = allowedHostnames.has(normalized);
|
|
3016
|
+
if (!matchesHostnameAllowlist(normalized, hostnameAllowlist)) throw new SsrFBlockedError(`Blocked hostname (not in allowlist): ${hostname}`);
|
|
2754
3017
|
if (!allowPrivateNetwork && !isExplicitAllowed) {
|
|
2755
3018
|
if (isBlockedHostname(normalized)) throw new SsrFBlockedError(`Blocked hostname: ${hostname}`);
|
|
2756
3019
|
if (isPrivateIpAddress(normalized)) throw new SsrFBlockedError("Blocked: private/internal IP address");
|
|
@@ -2771,9 +3034,6 @@ async function resolvePinnedHostnameWithPolicy(hostname, params = {}) {
|
|
|
2771
3034
|
})
|
|
2772
3035
|
};
|
|
2773
3036
|
}
|
|
2774
|
-
async function resolvePinnedHostname(hostname, lookupFn = lookup$1) {
|
|
2775
|
-
return await resolvePinnedHostnameWithPolicy(hostname, { lookupFn });
|
|
2776
|
-
}
|
|
2777
3037
|
function createPinnedDispatcher(pinned) {
|
|
2778
3038
|
return new Agent({ connect: { lookup: pinned.lookup } });
|
|
2779
3039
|
}
|
|
@@ -4471,7 +4731,7 @@ function normalizeWsUrl(raw, cdpBaseUrl) {
|
|
|
4471
4731
|
}
|
|
4472
4732
|
async function fetchJson(url, timeoutMs = 1500, init) {
|
|
4473
4733
|
const ctrl = new AbortController();
|
|
4474
|
-
const t = setTimeout(
|
|
4734
|
+
const t = setTimeout(ctrl.abort.bind(ctrl), timeoutMs);
|
|
4475
4735
|
try {
|
|
4476
4736
|
const headers = getHeadersWithAuth(url, init?.headers || {});
|
|
4477
4737
|
const res = await fetch(url, {
|
|
@@ -4487,7 +4747,7 @@ async function fetchJson(url, timeoutMs = 1500, init) {
|
|
|
4487
4747
|
}
|
|
4488
4748
|
async function fetchOk(url, timeoutMs = 1500, init) {
|
|
4489
4749
|
const ctrl = new AbortController();
|
|
4490
|
-
const t = setTimeout(
|
|
4750
|
+
const t = setTimeout(ctrl.abort.bind(ctrl), timeoutMs);
|
|
4491
4751
|
try {
|
|
4492
4752
|
const headers = getHeadersWithAuth(url, init?.headers || {});
|
|
4493
4753
|
const res = await fetch(url, {
|
|
@@ -4762,11 +5022,11 @@ function createProfileContext(opts, profile) {
|
|
|
4762
5022
|
const userDataDir = resolveOpenClawUserDataDir(profile.name);
|
|
4763
5023
|
const profileState = getProfileState();
|
|
4764
5024
|
if (await isHttpReachable(300) && !profileState.running) try {
|
|
4765
|
-
await (await import("./pw-ai-
|
|
5025
|
+
await (await import("./pw-ai-6GzTgK5g.js")).closePlaywrightBrowserConnection();
|
|
4766
5026
|
} catch {}
|
|
4767
5027
|
if (profileState.running) await stopRunningBrowser();
|
|
4768
5028
|
try {
|
|
4769
|
-
await (await import("./pw-ai-
|
|
5029
|
+
await (await import("./pw-ai-6GzTgK5g.js")).closePlaywrightBrowserConnection();
|
|
4770
5030
|
} catch {}
|
|
4771
5031
|
if (!fs$1.existsSync(userDataDir)) return {
|
|
4772
5032
|
moved: false,
|
|
@@ -4882,6 +5142,16 @@ async function startBrowserBridgeServer(params) {
|
|
|
4882
5142
|
const host = params.host ?? "127.0.0.1";
|
|
4883
5143
|
const port = params.port ?? 0;
|
|
4884
5144
|
const app = express();
|
|
5145
|
+
app.use((req, res, next) => {
|
|
5146
|
+
const ctrl = new AbortController();
|
|
5147
|
+
const abort = () => ctrl.abort(/* @__PURE__ */ new Error("request aborted"));
|
|
5148
|
+
req.once("aborted", abort);
|
|
5149
|
+
res.once("close", () => {
|
|
5150
|
+
if (!res.writableEnded) abort();
|
|
5151
|
+
});
|
|
5152
|
+
req.signal = ctrl.signal;
|
|
5153
|
+
next();
|
|
5154
|
+
});
|
|
4885
5155
|
app.use(express.json({ limit: "1mb" }));
|
|
4886
5156
|
const authToken = params.authToken?.trim();
|
|
4887
5157
|
if (authToken) app.use((req, res, next) => {
|
|
@@ -5050,26 +5320,55 @@ function resolveSandboxAgentId(scopeKey) {
|
|
|
5050
5320
|
|
|
5051
5321
|
//#endregion
|
|
5052
5322
|
//#region src/agents/sandbox/docker.ts
|
|
5053
|
-
|
|
5054
|
-
|
|
5323
|
+
function createAbortError() {
|
|
5324
|
+
const err = /* @__PURE__ */ new Error("Aborted");
|
|
5325
|
+
err.name = "AbortError";
|
|
5326
|
+
return err;
|
|
5327
|
+
}
|
|
5328
|
+
function execDockerRaw(args, opts) {
|
|
5055
5329
|
return new Promise((resolve, reject) => {
|
|
5056
5330
|
const child = spawn("docker", args, { stdio: [
|
|
5057
|
-
"
|
|
5331
|
+
"pipe",
|
|
5058
5332
|
"pipe",
|
|
5059
5333
|
"pipe"
|
|
5060
5334
|
] });
|
|
5061
|
-
|
|
5062
|
-
|
|
5335
|
+
const stdoutChunks = [];
|
|
5336
|
+
const stderrChunks = [];
|
|
5337
|
+
let aborted = false;
|
|
5338
|
+
const signal = opts?.signal;
|
|
5339
|
+
const handleAbort = () => {
|
|
5340
|
+
if (aborted) return;
|
|
5341
|
+
aborted = true;
|
|
5342
|
+
child.kill("SIGTERM");
|
|
5343
|
+
};
|
|
5344
|
+
if (signal) if (signal.aborted) handleAbort();
|
|
5345
|
+
else signal.addEventListener("abort", handleAbort);
|
|
5063
5346
|
child.stdout?.on("data", (chunk) => {
|
|
5064
|
-
|
|
5347
|
+
stdoutChunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
5065
5348
|
});
|
|
5066
5349
|
child.stderr?.on("data", (chunk) => {
|
|
5067
|
-
|
|
5350
|
+
stderrChunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
5351
|
+
});
|
|
5352
|
+
child.on("error", (error) => {
|
|
5353
|
+
if (signal) signal.removeEventListener("abort", handleAbort);
|
|
5354
|
+
reject(error);
|
|
5068
5355
|
});
|
|
5069
5356
|
child.on("close", (code) => {
|
|
5357
|
+
if (signal) signal.removeEventListener("abort", handleAbort);
|
|
5358
|
+
const stdout = Buffer.concat(stdoutChunks);
|
|
5359
|
+
const stderr = Buffer.concat(stderrChunks);
|
|
5360
|
+
if (aborted || signal?.aborted) {
|
|
5361
|
+
reject(createAbortError());
|
|
5362
|
+
return;
|
|
5363
|
+
}
|
|
5070
5364
|
const exitCode = code ?? 0;
|
|
5071
5365
|
if (exitCode !== 0 && !opts?.allowFailure) {
|
|
5072
|
-
|
|
5366
|
+
const message = stderr.length > 0 ? stderr.toString("utf8").trim() : "";
|
|
5367
|
+
reject(Object.assign(new Error(message || `docker ${args.join(" ")} failed`), {
|
|
5368
|
+
code: exitCode,
|
|
5369
|
+
stdout,
|
|
5370
|
+
stderr
|
|
5371
|
+
}));
|
|
5073
5372
|
return;
|
|
5074
5373
|
}
|
|
5075
5374
|
resolve({
|
|
@@ -5078,8 +5377,20 @@ function execDocker(args, opts) {
|
|
|
5078
5377
|
code: exitCode
|
|
5079
5378
|
});
|
|
5080
5379
|
});
|
|
5380
|
+
const stdin = child.stdin;
|
|
5381
|
+
if (stdin) if (opts?.input !== void 0) stdin.end(opts.input);
|
|
5382
|
+
else stdin.end();
|
|
5081
5383
|
});
|
|
5082
5384
|
}
|
|
5385
|
+
const HOT_CONTAINER_WINDOW_MS = 300 * 1e3;
|
|
5386
|
+
async function execDocker(args, opts) {
|
|
5387
|
+
const result = await execDockerRaw(args, opts);
|
|
5388
|
+
return {
|
|
5389
|
+
stdout: result.stdout.toString("utf8"),
|
|
5390
|
+
stderr: result.stderr.toString("utf8"),
|
|
5391
|
+
code: result.code
|
|
5392
|
+
};
|
|
5393
|
+
}
|
|
5083
5394
|
async function readDockerPort(containerName, port) {
|
|
5084
5395
|
const result = await execDocker([
|
|
5085
5396
|
"port",
|
|
@@ -5167,6 +5478,10 @@ function buildSandboxCreateArgs(params) {
|
|
|
5167
5478
|
for (const entry of params.cfg.tmpfs) args.push("--tmpfs", entry);
|
|
5168
5479
|
if (params.cfg.network) args.push("--network", params.cfg.network);
|
|
5169
5480
|
if (params.cfg.user) args.push("--user", params.cfg.user);
|
|
5481
|
+
for (const [key, value] of Object.entries(params.cfg.env ?? {})) {
|
|
5482
|
+
if (!key.trim()) continue;
|
|
5483
|
+
args.push("--env", key + "=" + value);
|
|
5484
|
+
}
|
|
5170
5485
|
for (const cap of params.cfg.capDrop) args.push("--cap-drop", cap);
|
|
5171
5486
|
args.push("--security-opt", "no-new-privileges");
|
|
5172
5487
|
if (params.cfg.seccompProfile) args.push("--security-opt", `seccomp=${params.cfg.seccompProfile}`);
|
|
@@ -5304,7 +5619,7 @@ async function waitForSandboxCdp(params) {
|
|
|
5304
5619
|
while (Date.now() < deadline) {
|
|
5305
5620
|
try {
|
|
5306
5621
|
const ctrl = new AbortController();
|
|
5307
|
-
const t = setTimeout(
|
|
5622
|
+
const t = setTimeout(ctrl.abort.bind(ctrl), 1e3);
|
|
5308
5623
|
try {
|
|
5309
5624
|
if ((await fetch(url, { signal: ctrl.signal })).ok) return true;
|
|
5310
5625
|
} finally {
|
|
@@ -5355,7 +5670,10 @@ async function ensureSandboxBrowser(params) {
|
|
|
5355
5670
|
await ensureSandboxBrowserImage(params.cfg.browser.image ?? DEFAULT_SANDBOX_BROWSER_IMAGE);
|
|
5356
5671
|
const args = buildSandboxCreateArgs({
|
|
5357
5672
|
name: containerName,
|
|
5358
|
-
cfg:
|
|
5673
|
+
cfg: {
|
|
5674
|
+
...params.cfg.docker,
|
|
5675
|
+
network: "bridge"
|
|
5676
|
+
},
|
|
5359
5677
|
scopeKey: params.scopeKey,
|
|
5360
5678
|
labels: { "openclaw.sandboxBrowser": "1" }
|
|
5361
5679
|
});
|
|
@@ -5433,6 +5751,142 @@ async function ensureSandboxBrowser(params) {
|
|
|
5433
5751
|
};
|
|
5434
5752
|
}
|
|
5435
5753
|
|
|
5754
|
+
//#endregion
|
|
5755
|
+
//#region src/agents/sandbox/fs-bridge.ts
|
|
5756
|
+
function createSandboxFsBridge(params) {
|
|
5757
|
+
return new SandboxFsBridgeImpl(params.sandbox);
|
|
5758
|
+
}
|
|
5759
|
+
var SandboxFsBridgeImpl = class {
|
|
5760
|
+
constructor(sandbox) {
|
|
5761
|
+
this.sandbox = sandbox;
|
|
5762
|
+
}
|
|
5763
|
+
resolvePath(params) {
|
|
5764
|
+
return resolveSandboxFsPath({
|
|
5765
|
+
sandbox: this.sandbox,
|
|
5766
|
+
filePath: params.filePath,
|
|
5767
|
+
cwd: params.cwd
|
|
5768
|
+
});
|
|
5769
|
+
}
|
|
5770
|
+
async readFile(params) {
|
|
5771
|
+
const target = this.resolvePath(params);
|
|
5772
|
+
return (await this.runCommand("set -eu; cat -- \"$1\"", {
|
|
5773
|
+
args: [target.containerPath],
|
|
5774
|
+
signal: params.signal
|
|
5775
|
+
})).stdout;
|
|
5776
|
+
}
|
|
5777
|
+
async writeFile(params) {
|
|
5778
|
+
this.ensureWriteAccess("write files");
|
|
5779
|
+
const target = this.resolvePath(params);
|
|
5780
|
+
const buffer = Buffer.isBuffer(params.data) ? params.data : Buffer.from(params.data, params.encoding ?? "utf8");
|
|
5781
|
+
const script = params.mkdir === false ? "set -eu; cat >\"$1\"" : "set -eu; dir=$(dirname -- \"$1\"); if [ \"$dir\" != \".\" ]; then mkdir -p -- \"$dir\"; fi; cat >\"$1\"";
|
|
5782
|
+
await this.runCommand(script, {
|
|
5783
|
+
args: [target.containerPath],
|
|
5784
|
+
stdin: buffer,
|
|
5785
|
+
signal: params.signal
|
|
5786
|
+
});
|
|
5787
|
+
}
|
|
5788
|
+
async mkdirp(params) {
|
|
5789
|
+
this.ensureWriteAccess("create directories");
|
|
5790
|
+
const target = this.resolvePath(params);
|
|
5791
|
+
await this.runCommand("set -eu; mkdir -p -- \"$1\"", {
|
|
5792
|
+
args: [target.containerPath],
|
|
5793
|
+
signal: params.signal
|
|
5794
|
+
});
|
|
5795
|
+
}
|
|
5796
|
+
async remove(params) {
|
|
5797
|
+
this.ensureWriteAccess("remove files");
|
|
5798
|
+
const target = this.resolvePath(params);
|
|
5799
|
+
const flags = [params.force === false ? "" : "-f", params.recursive ? "-r" : ""].filter(Boolean);
|
|
5800
|
+
const rmCommand = flags.length > 0 ? `rm ${flags.join(" ")}` : "rm";
|
|
5801
|
+
await this.runCommand(`set -eu; ${rmCommand} -- "$1"`, {
|
|
5802
|
+
args: [target.containerPath],
|
|
5803
|
+
signal: params.signal
|
|
5804
|
+
});
|
|
5805
|
+
}
|
|
5806
|
+
async rename(params) {
|
|
5807
|
+
this.ensureWriteAccess("rename files");
|
|
5808
|
+
const from = this.resolvePath({
|
|
5809
|
+
filePath: params.from,
|
|
5810
|
+
cwd: params.cwd
|
|
5811
|
+
});
|
|
5812
|
+
const to = this.resolvePath({
|
|
5813
|
+
filePath: params.to,
|
|
5814
|
+
cwd: params.cwd
|
|
5815
|
+
});
|
|
5816
|
+
await this.runCommand("set -eu; dir=$(dirname -- \"$2\"); if [ \"$dir\" != \".\" ]; then mkdir -p -- \"$dir\"; fi; mv -- \"$1\" \"$2\"", {
|
|
5817
|
+
args: [from.containerPath, to.containerPath],
|
|
5818
|
+
signal: params.signal
|
|
5819
|
+
});
|
|
5820
|
+
}
|
|
5821
|
+
async stat(params) {
|
|
5822
|
+
const target = this.resolvePath(params);
|
|
5823
|
+
const result = await this.runCommand("set -eu; stat -c \"%F|%s|%Y\" -- \"$1\"", {
|
|
5824
|
+
args: [target.containerPath],
|
|
5825
|
+
signal: params.signal,
|
|
5826
|
+
allowFailure: true
|
|
5827
|
+
});
|
|
5828
|
+
if (result.code !== 0) {
|
|
5829
|
+
const stderr = result.stderr.toString("utf8");
|
|
5830
|
+
if (stderr.includes("No such file or directory")) return null;
|
|
5831
|
+
const message = stderr.trim() || `stat failed with code ${result.code}`;
|
|
5832
|
+
throw new Error(`stat failed for ${target.containerPath}: ${message}`);
|
|
5833
|
+
}
|
|
5834
|
+
const [typeRaw, sizeRaw, mtimeRaw] = result.stdout.toString("utf8").trim().split("|");
|
|
5835
|
+
const size = Number.parseInt(sizeRaw ?? "0", 10);
|
|
5836
|
+
const mtime = Number.parseInt(mtimeRaw ?? "0", 10) * 1e3;
|
|
5837
|
+
return {
|
|
5838
|
+
type: coerceStatType(typeRaw),
|
|
5839
|
+
size: Number.isFinite(size) ? size : 0,
|
|
5840
|
+
mtimeMs: Number.isFinite(mtime) ? mtime : 0
|
|
5841
|
+
};
|
|
5842
|
+
}
|
|
5843
|
+
async runCommand(script, options = {}) {
|
|
5844
|
+
const dockerArgs = [
|
|
5845
|
+
"exec",
|
|
5846
|
+
"-i",
|
|
5847
|
+
this.sandbox.containerName,
|
|
5848
|
+
"sh",
|
|
5849
|
+
"-c",
|
|
5850
|
+
script,
|
|
5851
|
+
"moltbot-sandbox-fs"
|
|
5852
|
+
];
|
|
5853
|
+
if (options.args?.length) dockerArgs.push(...options.args);
|
|
5854
|
+
return execDockerRaw(dockerArgs, {
|
|
5855
|
+
input: options.stdin,
|
|
5856
|
+
allowFailure: options.allowFailure,
|
|
5857
|
+
signal: options.signal
|
|
5858
|
+
});
|
|
5859
|
+
}
|
|
5860
|
+
ensureWriteAccess(action) {
|
|
5861
|
+
if (!allowsWrites(this.sandbox.workspaceAccess)) throw new Error(`Sandbox workspace (${this.sandbox.workspaceAccess}) does not allow ${action}.`);
|
|
5862
|
+
}
|
|
5863
|
+
};
|
|
5864
|
+
function allowsWrites(access) {
|
|
5865
|
+
return access === "rw";
|
|
5866
|
+
}
|
|
5867
|
+
function resolveSandboxFsPath(params) {
|
|
5868
|
+
const root = params.sandbox.workspaceDir;
|
|
5869
|
+
const cwd = params.cwd ?? root;
|
|
5870
|
+
const { resolved, relative } = resolveSandboxPath({
|
|
5871
|
+
filePath: params.filePath,
|
|
5872
|
+
cwd,
|
|
5873
|
+
root
|
|
5874
|
+
});
|
|
5875
|
+
const normalizedRelative = relative ? relative.split(path.sep).filter(Boolean).join(path.posix.sep) : "";
|
|
5876
|
+
return {
|
|
5877
|
+
hostPath: resolved,
|
|
5878
|
+
relativePath: normalizedRelative,
|
|
5879
|
+
containerPath: normalizedRelative ? path.posix.join(params.sandbox.containerWorkdir, normalizedRelative) : params.sandbox.containerWorkdir
|
|
5880
|
+
};
|
|
5881
|
+
}
|
|
5882
|
+
function coerceStatType(typeRaw) {
|
|
5883
|
+
if (!typeRaw) return "other";
|
|
5884
|
+
const normalized = typeRaw.trim().toLowerCase();
|
|
5885
|
+
if (normalized.includes("directory")) return "directory";
|
|
5886
|
+
if (normalized.includes("file")) return "file";
|
|
5887
|
+
return "other";
|
|
5888
|
+
}
|
|
5889
|
+
|
|
5436
5890
|
//#endregion
|
|
5437
5891
|
//#region src/agents/sandbox/prune.ts
|
|
5438
5892
|
let lastPruneAtMs = 0;
|
|
@@ -5578,55 +6032,18 @@ function resolveConversationLabel(ctx) {
|
|
|
5578
6032
|
return `${base} id:${id}`;
|
|
5579
6033
|
}
|
|
5580
6034
|
|
|
5581
|
-
//#endregion
|
|
5582
|
-
//#region src/imessage/accounts.ts
|
|
5583
|
-
function resolveAccountConfig(cfg, accountId) {
|
|
5584
|
-
const accounts = cfg.channels?.imessage?.accounts;
|
|
5585
|
-
if (!accounts || typeof accounts !== "object") return;
|
|
5586
|
-
return accounts[accountId];
|
|
5587
|
-
}
|
|
5588
|
-
function mergeIMessageAccountConfig(cfg, accountId) {
|
|
5589
|
-
const { accounts: _ignored, ...base } = cfg.channels?.imessage ?? {};
|
|
5590
|
-
const account = resolveAccountConfig(cfg, accountId) ?? {};
|
|
5591
|
-
return {
|
|
5592
|
-
...base,
|
|
5593
|
-
...account
|
|
5594
|
-
};
|
|
5595
|
-
}
|
|
5596
|
-
function resolveIMessageAccount(params) {
|
|
5597
|
-
const accountId = normalizeAccountId$1(params.accountId);
|
|
5598
|
-
const baseEnabled = params.cfg.channels?.imessage?.enabled !== false;
|
|
5599
|
-
const merged = mergeIMessageAccountConfig(params.cfg, accountId);
|
|
5600
|
-
const accountEnabled = merged.enabled !== false;
|
|
5601
|
-
const configured = Boolean(merged.cliPath?.trim() || merged.dbPath?.trim() || merged.service || merged.region?.trim() || merged.allowFrom && merged.allowFrom.length > 0 || merged.groupAllowFrom && merged.groupAllowFrom.length > 0 || merged.dmPolicy || merged.groupPolicy || typeof merged.includeAttachments === "boolean" || typeof merged.mediaMaxMb === "number" || typeof merged.textChunkLimit === "number" || merged.groups && Object.keys(merged.groups).length > 0);
|
|
5602
|
-
return {
|
|
5603
|
-
accountId,
|
|
5604
|
-
enabled: baseEnabled && accountEnabled,
|
|
5605
|
-
name: merged.name?.trim() || void 0,
|
|
5606
|
-
config: merged,
|
|
5607
|
-
configured
|
|
5608
|
-
};
|
|
5609
|
-
}
|
|
5610
|
-
|
|
5611
|
-
//#endregion
|
|
5612
|
-
//#region src/slack/threading-tool-context.ts
|
|
5613
|
-
function buildSlackThreadingToolContext(params) {
|
|
5614
|
-
const configuredReplyToMode = resolveSlackReplyToMode(resolveSlackAccount({
|
|
5615
|
-
cfg: params.cfg,
|
|
5616
|
-
accountId: params.accountId
|
|
5617
|
-
}), params.context.ChatType);
|
|
5618
|
-
const effectiveReplyToMode = params.context.ThreadLabel ? "all" : configuredReplyToMode;
|
|
5619
|
-
const threadId = params.context.MessageThreadId ?? params.context.ReplyToId;
|
|
5620
|
-
return {
|
|
5621
|
-
currentChannelId: params.context.To?.startsWith("channel:") ? params.context.To.slice(8) : void 0,
|
|
5622
|
-
currentThreadTs: threadId != null ? String(threadId) : void 0,
|
|
5623
|
-
replyToMode: effectiveReplyToMode,
|
|
5624
|
-
hasRepliedRef: params.hasRepliedRef
|
|
5625
|
-
};
|
|
5626
|
-
}
|
|
5627
|
-
|
|
5628
6035
|
//#endregion
|
|
5629
6036
|
//#region src/config/group-policy.ts
|
|
6037
|
+
function resolveChannelGroupConfig(groups, groupId, caseInsensitive = false) {
|
|
6038
|
+
if (!groups) return;
|
|
6039
|
+
const direct = groups[groupId];
|
|
6040
|
+
if (direct) return direct;
|
|
6041
|
+
if (!caseInsensitive) return;
|
|
6042
|
+
const target = groupId.toLowerCase();
|
|
6043
|
+
const matchedKey = Object.keys(groups).find((key) => key !== "*" && key.toLowerCase() === target);
|
|
6044
|
+
if (!matchedKey) return;
|
|
6045
|
+
return groups[matchedKey];
|
|
6046
|
+
}
|
|
5630
6047
|
function normalizeSenderKey(value) {
|
|
5631
6048
|
const trimmed = value.trim();
|
|
5632
6049
|
if (!trimmed) return "";
|
|
@@ -5678,11 +6095,11 @@ function resolveChannelGroupPolicy(params) {
|
|
|
5678
6095
|
const groups = resolveChannelGroups(cfg, channel, params.accountId);
|
|
5679
6096
|
const allowlistEnabled = Boolean(groups && Object.keys(groups).length > 0);
|
|
5680
6097
|
const normalizedId = params.groupId?.trim();
|
|
5681
|
-
const groupConfig = normalizedId
|
|
6098
|
+
const groupConfig = normalizedId ? resolveChannelGroupConfig(groups, normalizedId, params.groupIdCaseInsensitive) : void 0;
|
|
5682
6099
|
const defaultConfig = groups?.["*"];
|
|
5683
6100
|
return {
|
|
5684
6101
|
allowlistEnabled,
|
|
5685
|
-
allowed: !allowlistEnabled || allowlistEnabled && Boolean(groups && Object.hasOwn(groups, "*")) ||
|
|
6102
|
+
allowed: !allowlistEnabled || allowlistEnabled && Boolean(groups && Object.hasOwn(groups, "*")) || Boolean(groupConfig),
|
|
5686
6103
|
groupConfig,
|
|
5687
6104
|
defaultConfig
|
|
5688
6105
|
};
|
|
@@ -5718,6 +6135,53 @@ function resolveChannelGroupToolsPolicy(params) {
|
|
|
5718
6135
|
if (defaultConfig?.tools) return defaultConfig.tools;
|
|
5719
6136
|
}
|
|
5720
6137
|
|
|
6138
|
+
//#endregion
|
|
6139
|
+
//#region src/imessage/accounts.ts
|
|
6140
|
+
function resolveAccountConfig(cfg, accountId) {
|
|
6141
|
+
const accounts = cfg.channels?.imessage?.accounts;
|
|
6142
|
+
if (!accounts || typeof accounts !== "object") return;
|
|
6143
|
+
return accounts[accountId];
|
|
6144
|
+
}
|
|
6145
|
+
function mergeIMessageAccountConfig(cfg, accountId) {
|
|
6146
|
+
const { accounts: _ignored, ...base } = cfg.channels?.imessage ?? {};
|
|
6147
|
+
const account = resolveAccountConfig(cfg, accountId) ?? {};
|
|
6148
|
+
return {
|
|
6149
|
+
...base,
|
|
6150
|
+
...account
|
|
6151
|
+
};
|
|
6152
|
+
}
|
|
6153
|
+
function resolveIMessageAccount(params) {
|
|
6154
|
+
const accountId = normalizeAccountId$1(params.accountId);
|
|
6155
|
+
const baseEnabled = params.cfg.channels?.imessage?.enabled !== false;
|
|
6156
|
+
const merged = mergeIMessageAccountConfig(params.cfg, accountId);
|
|
6157
|
+
const accountEnabled = merged.enabled !== false;
|
|
6158
|
+
const configured = Boolean(merged.cliPath?.trim() || merged.dbPath?.trim() || merged.service || merged.region?.trim() || merged.allowFrom && merged.allowFrom.length > 0 || merged.groupAllowFrom && merged.groupAllowFrom.length > 0 || merged.dmPolicy || merged.groupPolicy || typeof merged.includeAttachments === "boolean" || typeof merged.mediaMaxMb === "number" || typeof merged.textChunkLimit === "number" || merged.groups && Object.keys(merged.groups).length > 0);
|
|
6159
|
+
return {
|
|
6160
|
+
accountId,
|
|
6161
|
+
enabled: baseEnabled && accountEnabled,
|
|
6162
|
+
name: merged.name?.trim() || void 0,
|
|
6163
|
+
config: merged,
|
|
6164
|
+
configured
|
|
6165
|
+
};
|
|
6166
|
+
}
|
|
6167
|
+
|
|
6168
|
+
//#endregion
|
|
6169
|
+
//#region src/slack/threading-tool-context.ts
|
|
6170
|
+
function buildSlackThreadingToolContext(params) {
|
|
6171
|
+
const configuredReplyToMode = resolveSlackReplyToMode(resolveSlackAccount({
|
|
6172
|
+
cfg: params.cfg,
|
|
6173
|
+
accountId: params.accountId
|
|
6174
|
+
}), params.context.ChatType);
|
|
6175
|
+
const effectiveReplyToMode = params.context.ThreadLabel ? "all" : configuredReplyToMode;
|
|
6176
|
+
const threadId = params.context.MessageThreadId ?? params.context.ReplyToId;
|
|
6177
|
+
return {
|
|
6178
|
+
currentChannelId: params.context.To?.startsWith("channel:") ? params.context.To.slice(8) : void 0,
|
|
6179
|
+
currentThreadTs: threadId != null ? String(threadId) : void 0,
|
|
6180
|
+
replyToMode: effectiveReplyToMode,
|
|
6181
|
+
hasRepliedRef: params.hasRepliedRef
|
|
6182
|
+
};
|
|
6183
|
+
}
|
|
6184
|
+
|
|
5721
6185
|
//#endregion
|
|
5722
6186
|
//#region src/channels/plugins/group-mentions.ts
|
|
5723
6187
|
function normalizeDiscordSlug(value) {
|
|
@@ -6083,6 +6547,52 @@ const DOCKS = {
|
|
|
6083
6547
|
})
|
|
6084
6548
|
}
|
|
6085
6549
|
},
|
|
6550
|
+
irc: {
|
|
6551
|
+
id: "irc",
|
|
6552
|
+
capabilities: {
|
|
6553
|
+
chatTypes: ["direct", "group"],
|
|
6554
|
+
media: true,
|
|
6555
|
+
blockStreaming: true
|
|
6556
|
+
},
|
|
6557
|
+
outbound: { textChunkLimit: 350 },
|
|
6558
|
+
streaming: { blockStreamingCoalesceDefaults: {
|
|
6559
|
+
minChars: 300,
|
|
6560
|
+
idleMs: 1e3
|
|
6561
|
+
} },
|
|
6562
|
+
config: {
|
|
6563
|
+
resolveAllowFrom: ({ cfg, accountId }) => {
|
|
6564
|
+
const channel = cfg.channels?.irc;
|
|
6565
|
+
const normalized = normalizeAccountId$1(accountId);
|
|
6566
|
+
return ((channel?.accounts?.[normalized] ?? channel?.accounts?.[Object.keys(channel?.accounts ?? {}).find((key) => key.toLowerCase() === normalized.toLowerCase()) ?? ""])?.allowFrom ?? channel?.allowFrom ?? []).map((entry) => String(entry));
|
|
6567
|
+
},
|
|
6568
|
+
formatAllowFrom: ({ allowFrom }) => allowFrom.map((entry) => String(entry).trim()).filter(Boolean).map((entry) => entry.replace(/^irc:/i, "").replace(/^user:/i, "").toLowerCase())
|
|
6569
|
+
},
|
|
6570
|
+
groups: {
|
|
6571
|
+
resolveRequireMention: ({ cfg, accountId, groupId }) => {
|
|
6572
|
+
if (!groupId) return true;
|
|
6573
|
+
return resolveChannelGroupRequireMention({
|
|
6574
|
+
cfg,
|
|
6575
|
+
channel: "irc",
|
|
6576
|
+
groupId,
|
|
6577
|
+
accountId,
|
|
6578
|
+
groupIdCaseInsensitive: true
|
|
6579
|
+
});
|
|
6580
|
+
},
|
|
6581
|
+
resolveToolPolicy: ({ cfg, accountId, groupId, senderId, senderName, senderUsername }) => {
|
|
6582
|
+
if (!groupId) return;
|
|
6583
|
+
return resolveChannelGroupToolsPolicy({
|
|
6584
|
+
cfg,
|
|
6585
|
+
channel: "irc",
|
|
6586
|
+
groupId,
|
|
6587
|
+
accountId,
|
|
6588
|
+
groupIdCaseInsensitive: true,
|
|
6589
|
+
senderId,
|
|
6590
|
+
senderName,
|
|
6591
|
+
senderUsername
|
|
6592
|
+
});
|
|
6593
|
+
}
|
|
6594
|
+
}
|
|
6595
|
+
},
|
|
6086
6596
|
googlechat: {
|
|
6087
6597
|
id: "googlechat",
|
|
6088
6598
|
capabilities: {
|
|
@@ -6414,6 +6924,12 @@ function mergeSessionEntry(existing, patch) {
|
|
|
6414
6924
|
updatedAt
|
|
6415
6925
|
};
|
|
6416
6926
|
}
|
|
6927
|
+
function resolveFreshSessionTotalTokens(entry) {
|
|
6928
|
+
const total = entry?.totalTokens;
|
|
6929
|
+
if (typeof total !== "number" || !Number.isFinite(total) || total < 0) return;
|
|
6930
|
+
if (entry?.totalTokensFresh === false) return;
|
|
6931
|
+
return total;
|
|
6932
|
+
}
|
|
6417
6933
|
const DEFAULT_RESET_TRIGGERS = ["/new", "/reset"];
|
|
6418
6934
|
const DEFAULT_IDLE_MINUTES = 60;
|
|
6419
6935
|
|
|
@@ -6523,6 +7039,160 @@ function resolveSessionKey(scope, ctx, mainKey) {
|
|
|
6523
7039
|
return `agent:${DEFAULT_AGENT_ID}:${raw}`;
|
|
6524
7040
|
}
|
|
6525
7041
|
|
|
7042
|
+
//#endregion
|
|
7043
|
+
//#region src/agents/session-write-lock.ts
|
|
7044
|
+
const HELD_LOCKS = /* @__PURE__ */ new Map();
|
|
7045
|
+
const CLEANUP_SIGNALS = [
|
|
7046
|
+
"SIGINT",
|
|
7047
|
+
"SIGTERM",
|
|
7048
|
+
"SIGQUIT",
|
|
7049
|
+
"SIGABRT"
|
|
7050
|
+
];
|
|
7051
|
+
const CLEANUP_STATE_KEY = Symbol.for("openclaw.sessionWriteLockCleanupState");
|
|
7052
|
+
function resolveCleanupState() {
|
|
7053
|
+
const proc = process;
|
|
7054
|
+
if (!proc[CLEANUP_STATE_KEY]) proc[CLEANUP_STATE_KEY] = {
|
|
7055
|
+
registered: false,
|
|
7056
|
+
cleanupHandlers: /* @__PURE__ */ new Map()
|
|
7057
|
+
};
|
|
7058
|
+
return proc[CLEANUP_STATE_KEY];
|
|
7059
|
+
}
|
|
7060
|
+
function isAlive(pid) {
|
|
7061
|
+
if (!Number.isFinite(pid) || pid <= 0) return false;
|
|
7062
|
+
try {
|
|
7063
|
+
process.kill(pid, 0);
|
|
7064
|
+
return true;
|
|
7065
|
+
} catch {
|
|
7066
|
+
return false;
|
|
7067
|
+
}
|
|
7068
|
+
}
|
|
7069
|
+
/**
|
|
7070
|
+
* Synchronously release all held locks.
|
|
7071
|
+
* Used during process exit when async operations aren't reliable.
|
|
7072
|
+
*/
|
|
7073
|
+
function releaseAllLocksSync() {
|
|
7074
|
+
for (const [sessionFile, held] of HELD_LOCKS) {
|
|
7075
|
+
try {
|
|
7076
|
+
if (typeof held.handle.close === "function") held.handle.close().catch(() => {});
|
|
7077
|
+
} catch {}
|
|
7078
|
+
try {
|
|
7079
|
+
fs$1.rmSync(held.lockPath, { force: true });
|
|
7080
|
+
} catch {}
|
|
7081
|
+
HELD_LOCKS.delete(sessionFile);
|
|
7082
|
+
}
|
|
7083
|
+
}
|
|
7084
|
+
function handleTerminationSignal(signal) {
|
|
7085
|
+
releaseAllLocksSync();
|
|
7086
|
+
const cleanupState = resolveCleanupState();
|
|
7087
|
+
if (process.listenerCount(signal) === 1) {
|
|
7088
|
+
const handler = cleanupState.cleanupHandlers.get(signal);
|
|
7089
|
+
if (handler) process.off(signal, handler);
|
|
7090
|
+
try {
|
|
7091
|
+
process.kill(process.pid, signal);
|
|
7092
|
+
} catch {}
|
|
7093
|
+
}
|
|
7094
|
+
}
|
|
7095
|
+
function registerCleanupHandlers() {
|
|
7096
|
+
const cleanupState = resolveCleanupState();
|
|
7097
|
+
if (cleanupState.registered) return;
|
|
7098
|
+
cleanupState.registered = true;
|
|
7099
|
+
process.on("exit", () => {
|
|
7100
|
+
releaseAllLocksSync();
|
|
7101
|
+
});
|
|
7102
|
+
for (const signal of CLEANUP_SIGNALS) try {
|
|
7103
|
+
const handler = () => handleTerminationSignal(signal);
|
|
7104
|
+
cleanupState.cleanupHandlers.set(signal, handler);
|
|
7105
|
+
process.on(signal, handler);
|
|
7106
|
+
} catch {}
|
|
7107
|
+
}
|
|
7108
|
+
async function readLockPayload(lockPath) {
|
|
7109
|
+
try {
|
|
7110
|
+
const raw = await fs.readFile(lockPath, "utf8");
|
|
7111
|
+
const parsed = JSON.parse(raw);
|
|
7112
|
+
if (typeof parsed.pid !== "number") return null;
|
|
7113
|
+
if (typeof parsed.createdAt !== "string") return null;
|
|
7114
|
+
return {
|
|
7115
|
+
pid: parsed.pid,
|
|
7116
|
+
createdAt: parsed.createdAt
|
|
7117
|
+
};
|
|
7118
|
+
} catch {
|
|
7119
|
+
return null;
|
|
7120
|
+
}
|
|
7121
|
+
}
|
|
7122
|
+
async function acquireSessionWriteLock(params) {
|
|
7123
|
+
registerCleanupHandlers();
|
|
7124
|
+
const timeoutMs = params.timeoutMs ?? 1e4;
|
|
7125
|
+
const staleMs = params.staleMs ?? 1800 * 1e3;
|
|
7126
|
+
const sessionFile = path.resolve(params.sessionFile);
|
|
7127
|
+
const sessionDir = path.dirname(sessionFile);
|
|
7128
|
+
await fs.mkdir(sessionDir, { recursive: true });
|
|
7129
|
+
let normalizedDir = sessionDir;
|
|
7130
|
+
try {
|
|
7131
|
+
normalizedDir = await fs.realpath(sessionDir);
|
|
7132
|
+
} catch {}
|
|
7133
|
+
const normalizedSessionFile = path.join(normalizedDir, path.basename(sessionFile));
|
|
7134
|
+
const lockPath = `${normalizedSessionFile}.lock`;
|
|
7135
|
+
const held = HELD_LOCKS.get(normalizedSessionFile);
|
|
7136
|
+
if (held) {
|
|
7137
|
+
held.count += 1;
|
|
7138
|
+
return { release: async () => {
|
|
7139
|
+
const current = HELD_LOCKS.get(normalizedSessionFile);
|
|
7140
|
+
if (!current) return;
|
|
7141
|
+
current.count -= 1;
|
|
7142
|
+
if (current.count > 0) return;
|
|
7143
|
+
HELD_LOCKS.delete(normalizedSessionFile);
|
|
7144
|
+
await current.handle.close();
|
|
7145
|
+
await fs.rm(current.lockPath, { force: true });
|
|
7146
|
+
} };
|
|
7147
|
+
}
|
|
7148
|
+
const startedAt = Date.now();
|
|
7149
|
+
let attempt = 0;
|
|
7150
|
+
while (Date.now() - startedAt < timeoutMs) {
|
|
7151
|
+
attempt += 1;
|
|
7152
|
+
try {
|
|
7153
|
+
const handle = await fs.open(lockPath, "wx");
|
|
7154
|
+
await handle.writeFile(JSON.stringify({
|
|
7155
|
+
pid: process.pid,
|
|
7156
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
7157
|
+
}, null, 2), "utf8");
|
|
7158
|
+
HELD_LOCKS.set(normalizedSessionFile, {
|
|
7159
|
+
count: 1,
|
|
7160
|
+
handle,
|
|
7161
|
+
lockPath
|
|
7162
|
+
});
|
|
7163
|
+
return { release: async () => {
|
|
7164
|
+
const current = HELD_LOCKS.get(normalizedSessionFile);
|
|
7165
|
+
if (!current) return;
|
|
7166
|
+
current.count -= 1;
|
|
7167
|
+
if (current.count > 0) return;
|
|
7168
|
+
HELD_LOCKS.delete(normalizedSessionFile);
|
|
7169
|
+
await current.handle.close();
|
|
7170
|
+
await fs.rm(current.lockPath, { force: true });
|
|
7171
|
+
} };
|
|
7172
|
+
} catch (err) {
|
|
7173
|
+
if (err.code !== "EEXIST") throw err;
|
|
7174
|
+
const payload = await readLockPayload(lockPath);
|
|
7175
|
+
const createdAt = payload?.createdAt ? Date.parse(payload.createdAt) : NaN;
|
|
7176
|
+
const stale = !Number.isFinite(createdAt) || Date.now() - createdAt > staleMs;
|
|
7177
|
+
const alive = payload?.pid ? isAlive(payload.pid) : false;
|
|
7178
|
+
if (stale || !alive) {
|
|
7179
|
+
await fs.rm(lockPath, { force: true });
|
|
7180
|
+
continue;
|
|
7181
|
+
}
|
|
7182
|
+
const delay = Math.min(1e3, 50 * attempt);
|
|
7183
|
+
await new Promise((r) => setTimeout(r, delay));
|
|
7184
|
+
}
|
|
7185
|
+
}
|
|
7186
|
+
const payload = await readLockPayload(lockPath);
|
|
7187
|
+
const owner = payload?.pid ? `pid=${payload.pid}` : "unknown";
|
|
7188
|
+
throw new Error(`session file locked (timeout ${timeoutMs}ms): ${owner} ${lockPath}`);
|
|
7189
|
+
}
|
|
7190
|
+
const __testing = {
|
|
7191
|
+
cleanupSignals: [...CLEANUP_SIGNALS],
|
|
7192
|
+
handleTerminationSignal,
|
|
7193
|
+
releaseAllLocksSync
|
|
7194
|
+
};
|
|
7195
|
+
|
|
6526
7196
|
//#endregion
|
|
6527
7197
|
//#region src/utils/account-id.ts
|
|
6528
7198
|
function normalizeAccountId(value) {
|
|
@@ -6699,7 +7369,7 @@ function loadSessionStore(storePath, opts = {}) {
|
|
|
6699
7369
|
let mtimeMs = getFileMtimeMs(storePath);
|
|
6700
7370
|
try {
|
|
6701
7371
|
const raw = fs$1.readFileSync(storePath, "utf-8");
|
|
6702
|
-
const parsed =
|
|
7372
|
+
const parsed = JSON.parse(raw);
|
|
6703
7373
|
if (isSessionStoreRecord(parsed)) store = parsed;
|
|
6704
7374
|
mtimeMs = getFileMtimeMs(storePath) ?? mtimeMs;
|
|
6705
7375
|
} catch {}
|
|
@@ -6952,47 +7622,98 @@ async function updateSessionStore(storePath, mutator, opts) {
|
|
|
6952
7622
|
return result;
|
|
6953
7623
|
});
|
|
6954
7624
|
}
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
const
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
7625
|
+
const LOCK_QUEUES = /* @__PURE__ */ new Map();
|
|
7626
|
+
function lockTimeoutError(storePath) {
|
|
7627
|
+
return /* @__PURE__ */ new Error(`timeout waiting for session store lock: ${storePath}`);
|
|
7628
|
+
}
|
|
7629
|
+
function getOrCreateLockQueue(storePath) {
|
|
7630
|
+
const existing = LOCK_QUEUES.get(storePath);
|
|
7631
|
+
if (existing) return existing;
|
|
7632
|
+
const created = {
|
|
7633
|
+
running: false,
|
|
7634
|
+
pending: []
|
|
7635
|
+
};
|
|
7636
|
+
LOCK_QUEUES.set(storePath, created);
|
|
7637
|
+
return created;
|
|
7638
|
+
}
|
|
7639
|
+
function removePendingTask(queue, task) {
|
|
7640
|
+
const idx = queue.pending.indexOf(task);
|
|
7641
|
+
if (idx >= 0) queue.pending.splice(idx, 1);
|
|
7642
|
+
}
|
|
7643
|
+
async function drainSessionStoreLockQueue(storePath) {
|
|
7644
|
+
const queue = LOCK_QUEUES.get(storePath);
|
|
7645
|
+
if (!queue || queue.running) return;
|
|
7646
|
+
queue.running = true;
|
|
7647
|
+
try {
|
|
7648
|
+
while (queue.pending.length > 0) {
|
|
7649
|
+
const task = queue.pending.shift();
|
|
7650
|
+
if (!task || task.timedOut) continue;
|
|
7651
|
+
if (task.timer) clearTimeout(task.timer);
|
|
7652
|
+
task.started = true;
|
|
7653
|
+
const remainingTimeoutMs = task.timeoutAt != null ? Math.max(0, task.timeoutAt - Date.now()) : Number.POSITIVE_INFINITY;
|
|
7654
|
+
if (task.timeoutAt != null && remainingTimeoutMs <= 0) {
|
|
7655
|
+
task.timedOut = true;
|
|
7656
|
+
task.reject(lockTimeoutError(storePath));
|
|
6985
7657
|
continue;
|
|
6986
7658
|
}
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
|
|
6990
|
-
|
|
6991
|
-
|
|
7659
|
+
let lock;
|
|
7660
|
+
let result;
|
|
7661
|
+
let failed;
|
|
7662
|
+
let hasFailure = false;
|
|
7663
|
+
try {
|
|
7664
|
+
lock = await acquireSessionWriteLock({
|
|
7665
|
+
sessionFile: storePath,
|
|
7666
|
+
timeoutMs: remainingTimeoutMs,
|
|
7667
|
+
staleMs: task.staleMs
|
|
7668
|
+
});
|
|
7669
|
+
result = await task.fn();
|
|
7670
|
+
} catch (err) {
|
|
7671
|
+
hasFailure = true;
|
|
7672
|
+
failed = err;
|
|
7673
|
+
} finally {
|
|
7674
|
+
await lock?.release().catch(() => void 0);
|
|
7675
|
+
}
|
|
7676
|
+
if (hasFailure) {
|
|
7677
|
+
task.reject(failed);
|
|
7678
|
+
continue;
|
|
7679
|
+
}
|
|
7680
|
+
task.resolve(result);
|
|
7681
|
+
}
|
|
6992
7682
|
} finally {
|
|
6993
|
-
|
|
7683
|
+
queue.running = false;
|
|
7684
|
+
if (queue.pending.length === 0) LOCK_QUEUES.delete(storePath);
|
|
7685
|
+
else queueMicrotask(() => {
|
|
7686
|
+
drainSessionStoreLockQueue(storePath);
|
|
7687
|
+
});
|
|
6994
7688
|
}
|
|
6995
7689
|
}
|
|
7690
|
+
async function withSessionStoreLock(storePath, fn, opts = {}) {
|
|
7691
|
+
const timeoutMs = opts.timeoutMs ?? 1e4;
|
|
7692
|
+
const staleMs = opts.staleMs ?? 3e4;
|
|
7693
|
+
opts.pollIntervalMs;
|
|
7694
|
+
const hasTimeout = timeoutMs > 0 && Number.isFinite(timeoutMs);
|
|
7695
|
+
const timeoutAt = hasTimeout ? Date.now() + timeoutMs : void 0;
|
|
7696
|
+
const queue = getOrCreateLockQueue(storePath);
|
|
7697
|
+
return await new Promise((resolve, reject) => {
|
|
7698
|
+
const task = {
|
|
7699
|
+
fn: async () => await fn(),
|
|
7700
|
+
resolve: (value) => resolve(value),
|
|
7701
|
+
reject,
|
|
7702
|
+
timeoutAt,
|
|
7703
|
+
staleMs,
|
|
7704
|
+
started: false,
|
|
7705
|
+
timedOut: false
|
|
7706
|
+
};
|
|
7707
|
+
if (hasTimeout) task.timer = setTimeout(() => {
|
|
7708
|
+
if (task.started || task.timedOut) return;
|
|
7709
|
+
task.timedOut = true;
|
|
7710
|
+
removePendingTask(queue, task);
|
|
7711
|
+
reject(lockTimeoutError(storePath));
|
|
7712
|
+
}, timeoutMs);
|
|
7713
|
+
queue.pending.push(task);
|
|
7714
|
+
drainSessionStoreLockQueue(storePath);
|
|
7715
|
+
});
|
|
7716
|
+
}
|
|
6996
7717
|
async function updateSessionStoreEntry(params) {
|
|
6997
7718
|
const { storePath, sessionKey, update } = params;
|
|
6998
7719
|
return await withSessionStoreLock(storePath, async () => {
|
|
@@ -7139,7 +7860,15 @@ async function appendAssistantMessageToSessionTranscript(params) {
|
|
|
7139
7860
|
ok: false,
|
|
7140
7861
|
reason: `unknown sessionKey: ${sessionKey}`
|
|
7141
7862
|
};
|
|
7142
|
-
|
|
7863
|
+
let sessionFile;
|
|
7864
|
+
try {
|
|
7865
|
+
sessionFile = resolveSessionFilePath(entry.sessionId, entry, { sessionsDir: path.dirname(storePath) });
|
|
7866
|
+
} catch (err) {
|
|
7867
|
+
return {
|
|
7868
|
+
ok: false,
|
|
7869
|
+
reason: err instanceof Error ? err.message : String(err)
|
|
7870
|
+
};
|
|
7871
|
+
}
|
|
7143
7872
|
await ensureSessionHeader({
|
|
7144
7873
|
sessionFile,
|
|
7145
7874
|
sessionId: entry.sessionId
|
|
@@ -7346,7 +8075,7 @@ async function resolveSandboxContext(params) {
|
|
|
7346
8075
|
cfg,
|
|
7347
8076
|
evaluateEnabled: params.config?.browser?.evaluateEnabled ?? DEFAULT_BROWSER_EVALUATE_ENABLED
|
|
7348
8077
|
});
|
|
7349
|
-
|
|
8078
|
+
const sandboxContext = {
|
|
7350
8079
|
enabled: true,
|
|
7351
8080
|
sessionKey: rawSessionKey,
|
|
7352
8081
|
workspaceDir,
|
|
@@ -7359,6 +8088,8 @@ async function resolveSandboxContext(params) {
|
|
|
7359
8088
|
browserAllowHostControl: cfg.browser.allowHostControl,
|
|
7360
8089
|
browser: browser ?? void 0
|
|
7361
8090
|
};
|
|
8091
|
+
sandboxContext.fsBridge = createSandboxFsBridge({ sandbox: sandboxContext });
|
|
8092
|
+
return sandboxContext;
|
|
7362
8093
|
}
|
|
7363
8094
|
async function ensureSandboxWorkspaceForSession(params) {
|
|
7364
8095
|
const rawSessionKey = params.sessionKey?.trim();
|
|
@@ -7395,7 +8126,12 @@ async function ensureSandboxWorkspaceForSession(params) {
|
|
|
7395
8126
|
|
|
7396
8127
|
//#endregion
|
|
7397
8128
|
//#region src/agents/pi-embedded-helpers/errors.ts
|
|
7398
|
-
|
|
8129
|
+
function formatBillingErrorMessage(provider) {
|
|
8130
|
+
const providerName = provider?.trim();
|
|
8131
|
+
if (providerName) return `⚠️ ${providerName} returned a billing error — your API key has run out of credits or has an insufficient balance. Check your ${providerName} billing dashboard and top up or switch to a different API key.`;
|
|
8132
|
+
return "⚠️ API provider returned a billing error — your API key has run out of credits or has an insufficient balance. Check your provider's billing dashboard and top up or switch to a different API key.";
|
|
8133
|
+
}
|
|
8134
|
+
const BILLING_ERROR_USER_MESSAGE = formatBillingErrorMessage();
|
|
7399
8135
|
function isContextOverflowError(errorMessage) {
|
|
7400
8136
|
if (!errorMessage) return false;
|
|
7401
8137
|
const lower = errorMessage.toLowerCase();
|
|
@@ -7404,24 +8140,49 @@ function isContextOverflowError(errorMessage) {
|
|
|
7404
8140
|
return lower.includes("request_too_large") || lower.includes("request exceeds the maximum size") || lower.includes("context length exceeded") || lower.includes("maximum context length") || lower.includes("prompt is too long") || lower.includes("exceeds model context window") || hasRequestSizeExceeds && hasContextWindow || lower.includes("context overflow:") || lower.includes("413") && lower.includes("too large");
|
|
7405
8141
|
}
|
|
7406
8142
|
const CONTEXT_WINDOW_TOO_SMALL_RE = /context window.*(too small|minimum is)/i;
|
|
7407
|
-
const CONTEXT_OVERFLOW_HINT_RE = /context.*overflow|context window.*(too (?:large|long)|exceed|over|limit|max(?:imum)?|requested|sent|tokens)|(?:
|
|
8143
|
+
const CONTEXT_OVERFLOW_HINT_RE = /context.*overflow|context window.*(too (?:large|long)|exceed|over|limit|max(?:imum)?|requested|sent|tokens)|prompt.*(too (?:large|long)|exceed|over|limit|max(?:imum)?)|(?:request|input).*(?:context|window|length|token).*(too (?:large|long)|exceed|over|limit|max(?:imum)?)/i;
|
|
8144
|
+
const RATE_LIMIT_HINT_RE = /rate limit|too many requests|requests per (?:minute|hour|day)|quota|throttl|429\b/i;
|
|
7408
8145
|
function isLikelyContextOverflowError(errorMessage) {
|
|
7409
8146
|
if (!errorMessage) return false;
|
|
7410
8147
|
if (CONTEXT_WINDOW_TOO_SMALL_RE.test(errorMessage)) return false;
|
|
8148
|
+
if (isRateLimitErrorMessage(errorMessage)) return false;
|
|
7411
8149
|
if (isContextOverflowError(errorMessage)) return true;
|
|
8150
|
+
if (RATE_LIMIT_HINT_RE.test(errorMessage)) return false;
|
|
7412
8151
|
return CONTEXT_OVERFLOW_HINT_RE.test(errorMessage);
|
|
7413
8152
|
}
|
|
7414
8153
|
function isCompactionFailureError(errorMessage) {
|
|
7415
8154
|
if (!errorMessage) return false;
|
|
7416
8155
|
const lower = errorMessage.toLowerCase();
|
|
7417
8156
|
if (!(lower.includes("summarization failed") || lower.includes("auto-compaction") || lower.includes("compaction failed") || lower.includes("compaction"))) return false;
|
|
7418
|
-
|
|
8157
|
+
if (isLikelyContextOverflowError(errorMessage)) return true;
|
|
8158
|
+
return lower.includes("context overflow");
|
|
7419
8159
|
}
|
|
7420
8160
|
const ERROR_PAYLOAD_PREFIX_RE = /^(?:error|api\s*error|apierror|openai\s*error|anthropic\s*error|gateway\s*error)[:\s-]+/i;
|
|
7421
8161
|
const FINAL_TAG_RE = /<\s*\/?\s*final\s*>/gi;
|
|
7422
8162
|
const ERROR_PREFIX_RE = /^(?:error|api\s*error|openai\s*error|anthropic\s*error|gateway\s*error|request failed|failed|exception)[:\s-]+/i;
|
|
7423
8163
|
const CONTEXT_OVERFLOW_ERROR_HEAD_RE = /^(?:context overflow:|request_too_large\b|request size exceeds\b|request exceeds the maximum size\b|context length exceeded\b|maximum context length\b|prompt is too long\b|exceeds model context window\b)/i;
|
|
7424
8164
|
const HTTP_STATUS_PREFIX_RE = /^(?:http\s*)?(\d{3})\s+(.+)$/i;
|
|
8165
|
+
const HTTP_STATUS_CODE_PREFIX_RE = /^(?:http\s*)?(\d{3})(?:\s+([\s\S]+))?$/i;
|
|
8166
|
+
const HTML_ERROR_PREFIX_RE = /^\s*(?:<!doctype\s+html\b|<html\b)/i;
|
|
8167
|
+
const CLOUDFLARE_HTML_ERROR_CODES = new Set([
|
|
8168
|
+
521,
|
|
8169
|
+
522,
|
|
8170
|
+
523,
|
|
8171
|
+
524,
|
|
8172
|
+
525,
|
|
8173
|
+
526,
|
|
8174
|
+
530
|
|
8175
|
+
]);
|
|
8176
|
+
const TRANSIENT_HTTP_ERROR_CODES = new Set([
|
|
8177
|
+
500,
|
|
8178
|
+
502,
|
|
8179
|
+
503,
|
|
8180
|
+
521,
|
|
8181
|
+
522,
|
|
8182
|
+
523,
|
|
8183
|
+
524,
|
|
8184
|
+
529
|
|
8185
|
+
]);
|
|
7425
8186
|
const HTTP_ERROR_HINTS = [
|
|
7426
8187
|
"error",
|
|
7427
8188
|
"bad request",
|
|
@@ -7439,6 +8200,31 @@ const HTTP_ERROR_HINTS = [
|
|
|
7439
8200
|
"too many requests",
|
|
7440
8201
|
"permission"
|
|
7441
8202
|
];
|
|
8203
|
+
function extractLeadingHttpStatus(raw) {
|
|
8204
|
+
const match = raw.match(HTTP_STATUS_CODE_PREFIX_RE);
|
|
8205
|
+
if (!match) return null;
|
|
8206
|
+
const code = Number(match[1]);
|
|
8207
|
+
if (!Number.isFinite(code)) return null;
|
|
8208
|
+
return {
|
|
8209
|
+
code,
|
|
8210
|
+
rest: (match[2] ?? "").trim()
|
|
8211
|
+
};
|
|
8212
|
+
}
|
|
8213
|
+
function isCloudflareOrHtmlErrorPage(raw) {
|
|
8214
|
+
const trimmed = raw.trim();
|
|
8215
|
+
if (!trimmed) return false;
|
|
8216
|
+
const status = extractLeadingHttpStatus(trimmed);
|
|
8217
|
+
if (!status || status.code < 500) return false;
|
|
8218
|
+
if (CLOUDFLARE_HTML_ERROR_CODES.has(status.code)) return true;
|
|
8219
|
+
return status.code < 600 && HTML_ERROR_PREFIX_RE.test(status.rest) && /<\/html>/i.test(status.rest);
|
|
8220
|
+
}
|
|
8221
|
+
function isTransientHttpError(raw) {
|
|
8222
|
+
const trimmed = raw.trim();
|
|
8223
|
+
if (!trimmed) return false;
|
|
8224
|
+
const status = extractLeadingHttpStatus(trimmed);
|
|
8225
|
+
if (!status) return false;
|
|
8226
|
+
return TRANSIENT_HTTP_ERROR_CODES.has(status.code);
|
|
8227
|
+
}
|
|
7442
8228
|
function stripFinalTagsFromText(text) {
|
|
7443
8229
|
if (!text) return text;
|
|
7444
8230
|
return text.replace(FINAL_TAG_RE, "");
|
|
@@ -7461,6 +8247,7 @@ function collapseConsecutiveDuplicateBlocks(text) {
|
|
|
7461
8247
|
return result.join("\n\n");
|
|
7462
8248
|
}
|
|
7463
8249
|
function isLikelyHttpErrorText(raw) {
|
|
8250
|
+
if (isCloudflareOrHtmlErrorPage(raw)) return true;
|
|
7464
8251
|
const match = raw.match(HTTP_STATUS_PREFIX_RE);
|
|
7465
8252
|
if (!match) return false;
|
|
7466
8253
|
const code = Number(match[1]);
|
|
@@ -7550,6 +8337,8 @@ function parseApiErrorInfo(raw) {
|
|
|
7550
8337
|
function formatRawAssistantErrorForUi(raw) {
|
|
7551
8338
|
const trimmed = (raw ?? "").trim();
|
|
7552
8339
|
if (!trimmed) return "LLM request failed with an unknown error.";
|
|
8340
|
+
const leadingStatus = extractLeadingHttpStatus(trimmed);
|
|
8341
|
+
if (leadingStatus && isCloudflareOrHtmlErrorPage(trimmed)) return `The AI service is temporarily unavailable (HTTP ${leadingStatus.code}). Please try again in a moment.`;
|
|
7553
8342
|
const httpMatch = trimmed.match(HTTP_STATUS_PREFIX_RE);
|
|
7554
8343
|
if (httpMatch) {
|
|
7555
8344
|
const rest = httpMatch[2].trim();
|
|
@@ -7583,7 +8372,7 @@ function formatAssistantErrorText(msg, opts) {
|
|
|
7583
8372
|
const invalidRequest = raw.match(/"type":"invalid_request_error".*?"message":"([^"]+)"/);
|
|
7584
8373
|
if (invalidRequest?.[1]) return `LLM request rejected: ${invalidRequest[1]}`;
|
|
7585
8374
|
if (isOverloadedErrorMessage(raw)) return "The AI service is temporarily overloaded. Please try again in a moment.";
|
|
7586
|
-
if (isBillingErrorMessage(raw)) return
|
|
8375
|
+
if (isBillingErrorMessage(raw)) return formatBillingErrorMessage(opts?.provider);
|
|
7587
8376
|
if (isLikelyHttpErrorText(raw) || isRawApiErrorPayload(raw)) return formatRawAssistantErrorForUi(raw);
|
|
7588
8377
|
if (raw.length > 600) console.warn("[formatAssistantErrorText] Long error truncated:", raw.slice(0, 200));
|
|
7589
8378
|
return raw.length > 600 ? `${raw.slice(0, 600)}…` : raw;
|
|
@@ -7628,7 +8417,7 @@ const ERROR_PATTERNS = {
|
|
|
7628
8417
|
"context deadline exceeded"
|
|
7629
8418
|
],
|
|
7630
8419
|
billing: [
|
|
7631
|
-
|
|
8420
|
+
/["']?(?:status|code)["']?\s*[:=]\s*402\b|\bhttp\s*402\b|\berror(?:\s+code)?\s*[:=]?\s*402\b|\b(?:got|returned|received)\s+(?:a\s+)?402\b|^\s*402\s+payment/i,
|
|
7632
8421
|
"payment required",
|
|
7633
8422
|
"insufficient credits",
|
|
7634
8423
|
"credit balance",
|
|
@@ -7734,6 +8523,7 @@ function isAuthAssistantError(msg) {
|
|
|
7734
8523
|
function classifyFailoverReason(raw) {
|
|
7735
8524
|
if (isImageDimensionErrorMessage(raw)) return null;
|
|
7736
8525
|
if (isImageSizeError(raw)) return null;
|
|
8526
|
+
if (isTransientHttpError(raw)) return "timeout";
|
|
7737
8527
|
if (isRateLimitErrorMessage(raw)) return "rate_limit";
|
|
7738
8528
|
if (isOverloadedErrorMessage(raw)) return "rate_limit";
|
|
7739
8529
|
if (isCloudCodeAssistFormatError(raw)) return "format";
|
|
@@ -8153,7 +8943,7 @@ async function sanitizeToolResultImages(result, label, opts = {}) {
|
|
|
8153
8943
|
//#region src/agents/pi-embedded-helpers/images.ts
|
|
8154
8944
|
async function sanitizeSessionMessagesImages(messages, label, options) {
|
|
8155
8945
|
const allowNonImageSanitization = (options?.sanitizeMode ?? "full") === "full";
|
|
8156
|
-
const sanitizedIds =
|
|
8946
|
+
const sanitizedIds = options?.sanitizeToolCallIds ? sanitizeToolCallIdsForCloudCodeAssist(messages, options.toolCallIdMode) : messages;
|
|
8157
8947
|
const out = [];
|
|
8158
8948
|
for (const msg of sanitizedIds) {
|
|
8159
8949
|
if (!msg || typeof msg !== "object") {
|
|
@@ -8266,6 +9056,7 @@ function isBinaryThinkingProvider(provider) {
|
|
|
8266
9056
|
const XHIGH_MODEL_REFS = [
|
|
8267
9057
|
"openai/gpt-5.2",
|
|
8268
9058
|
"openai-codex/gpt-5.3-codex",
|
|
9059
|
+
"openai-codex/gpt-5.3-codex-spark",
|
|
8269
9060
|
"openai-codex/gpt-5.2-codex",
|
|
8270
9061
|
"openai-codex/gpt-5.1-codex",
|
|
8271
9062
|
"github-copilot/gpt-5.2-codex",
|
|
@@ -8563,4 +9354,4 @@ function validateAnthropicTurns(messages) {
|
|
|
8563
9354
|
}
|
|
8564
9355
|
|
|
8565
9356
|
//#endregion
|
|
8566
|
-
export {
|
|
9357
|
+
export { updateSessionStore as $, normalizeDiscordToken as $n, applySkillEnvOverridesFromSnapshot as $t, isBillingAssistantError as A, isGifMedia as An, registerBrowserRoutes as At, isTransientHttpError as B, isWhatsAppGroupJid as Bn, SsrFBlockedError as Bt, BILLING_ERROR_USER_MESSAGE as C, GATEWAY_CLIENT_MODES as Cn, resolveIMessageAccount as Ct, formatRawAssistantErrorForUi as D, getFileExtension as Dn, resolveConversationLabel as Dt, formatBillingErrorMessage as E, extensionForMime as En, resolveChannelGroupToolsPolicy as Et, isFailoverErrorMessage as F, listEnabledSignalAccounts as Fn, hasAlphaChannel as Ft, resolveSandboxContext as G, resolveTelegramToken as Gn, buildWorkspaceSkillSnapshot as Gt, parseImageSizeError as H, listEnabledTelegramAccounts as Hn, createPinnedDispatcher as Ht, isLikelyContextOverflowError as I, resolveSignalAccount as In, optimizeImageToPng as It, resolveMirroredTranscriptText as J, resolveSlackAppToken as Jn, resolvePluginSkillDirs as Jt, resolveSandboxRuntimeStatus as K, listBindings as Kn, loadWorkspaceSkillEntries as Kt, isRateLimitAssistantError as L, getChannelPlugin as Ln, resizeToJpeg as Lt, isCompactionFailureError as M, MAX_IMAGE_BYTES$1 as Mn, resolveProfile as Mt, isContextOverflowError as N, maxBytesForKind as Nn, convertHeicToJpeg as Nt, getApiErrorPayloadFingerprint as O, imageMimeFromFormat as On, resolveGroupSessionKey as Ot, isFailoverAssistantError as P, mediaKindFromMime as Pn, getImageMetadata as Pt, updateLastRoute as Q, resolveDiscordAccount as Qn, applySkillEnvOverrides as Qt, isRawApiErrorPayload as R, listChannelPlugins as Rn, getMediaDir as Rt, isGoogleModelApi as S, GATEWAY_CLIENT_IDS as Sn, listChannelDocks as St, formatAssistantErrorText as T, detectMime as Tn, resolveChannelGroupRequireMention as Tt, sanitizeUserFacingText as U, listTelegramAccountIds as Un, resolvePinnedHostnameWithPolicy as Ut, parseImageDimensionError as V, normalizeWhatsAppTarget as Vn, closeDispatcher as Vt, ensureSandboxWorkspaceForSession as W, resolveTelegramAccount as Wn, buildWorkspaceSkillCommandSpecs as Wt, readSessionUpdatedAt as X, normalizeChatType as Xn, assertSandboxPath as Xt, loadSessionStore as Y, resolveSlackBotToken as Yn, assertMediaNotDataUrl as Yt, recordSessionMetaFromInbound as Z, listEnabledDiscordAccounts as Zn, resolveSandboxedMediaSource as Zt, sanitizeSessionMessagesImages as _, isMarkdownCapableMessageChannel as _n, resolveFreshSessionTotalTokens as _t, formatXHighModelHint as a, expandToolGroups as an, mergeDeliveryContext as at, downgradeOpenAIReasoningBlocks as b, resolveGatewayMessageChannel as bn, deriveSessionMetaPatch as bt, normalizeReasoningLevel as c, stripPluginOnlyAllowlist as cn, normalizeAccountId as ct, normalizeVerboseLevel as d, resolveBootstrapMaxChars as dn, evaluateSessionFreshness as dt, resolveSandboxConfigForAgent as en, updateSessionStoreEntry as et, resolveResponseUsageMode as f, sanitizeGoogleTurnOrdering as fn, resolveChannelResetConfig as ft, normalizeTextForComparison as g, isInternalMessageChannel as gn, DEFAULT_RESET_TRIGGERS as gt, isMessagingToolDuplicateNormalized as h, isGatewayMessageChannel as hn, resolveThreadFlag as ht, formatThinkingLevels as i, expandPolicyWithPluginGroups as in, deliveryContextKey as it, isCloudCodeAssistFormatError as j, kindFromMime as jn, resolveBrowserConfig as jt, isAuthAssistantError as k, isAudioFileName as kn, createBrowserRouteContext as kt, normalizeThinkLevel as l, buildBootstrapContextFiles as ln, acquireSessionWriteLock as lt, isMessagingToolDuplicate as m, isDeliverableMessageChannel as mn, resolveSessionResetType as mt, validateGeminiTurns as n, buildPluginToolGroups as nn, resolveCacheTtlMs as nt, listThinkingLevels as o, normalizeToolName as on, normalizeDeliveryContext as ot, supportsXHighThinking as p, INTERNAL_MESSAGE_CHANNEL as pn, resolveSessionResetPolicy as pt, appendAssistantMessageToSessionTranscript as q, resolveSlackAccount as qn, resolveSkillsPromptForRun as qt, pickFallbackThinkingLevel as r, collectExplicitAllowlist as rn, deliveryContextFromSession as rt, normalizeElevatedLevel as s, resolveToolProfilePolicy as sn, normalizeSessionDeliveryFields as st, validateAnthropicTurns as t, applyOwnerOnlyToolPolicy as tn, isCacheEnabled as tt, normalizeUsageDisplay as u, ensureSessionHeader$1 as un, resolveSessionKey as ut, sanitizeImageBlocks as v, listDeliverableMessageChannels as vn, resolveExplicitAgentSessionKey as vt, classifyFailoverReason as w, GATEWAY_CLIENT_NAMES as wn, resolveChannelGroupPolicy as wt, isAntigravityClaude as x, resolveMessageChannel as xn, getChannelDock as xt, sanitizeToolResultImages as y, normalizeMessageChannel as yn, resolveMainSessionKey as yt, isTimeoutErrorMessage as z, normalizeChannelId as zn, saveMediaBuffer as zt };
|