clawbrah 1.0.1
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 +1577 -0
- package/LICENSE +21 -0
- package/README-header.png +0 -0
- package/README.md +655 -0
- package/assets/avatar-placeholder.svg +19 -0
- package/assets/chrome-extension/README.md +22 -0
- package/assets/chrome-extension/background.js +438 -0
- package/assets/chrome-extension/icons/icon128.png +0 -0
- package/assets/chrome-extension/icons/icon16.png +0 -0
- package/assets/chrome-extension/icons/icon32.png +0 -0
- package/assets/chrome-extension/icons/icon48.png +0 -0
- package/assets/chrome-extension/manifest.json +25 -0
- package/assets/chrome-extension/options.html +196 -0
- package/assets/chrome-extension/options.js +59 -0
- package/assets/dmg-background-small.png +0 -0
- package/assets/dmg-background.png +0 -0
- package/clawbrah.mjs +14 -0
- package/dist/accounts-CjPkmYhF.js +251 -0
- package/dist/accounts-D9U5z8T8.js +250 -0
- package/dist/acp-cli-BnKXNti3.js +929 -0
- package/dist/acp-cli-CQw991sO.js +925 -0
- package/dist/agent-BIxLfYkv.js +702 -0
- package/dist/agent-Dj_EwzkO.js +702 -0
- package/dist/agent-scope-BCxtHmMP.js +370 -0
- package/dist/agent-scope-C-hibssz.js +606 -0
- package/dist/agent-scope-CbEuCv2l.js +370 -0
- package/dist/ansi-Dslhk-pR.js +67 -0
- package/dist/archive-CCWYT_Aq.js +85 -0
- package/dist/archive-CIDIaMie.js +85 -0
- package/dist/audit-DK1NXsUR.js +1853 -0
- package/dist/audit-XFpWISrQ.js +1853 -0
- package/dist/auth-BPnkbfof.js +192 -0
- package/dist/auth-DwH9mnk7.js +192 -0
- package/dist/auth-health-DO7finG2.js +149 -0
- package/dist/auth-health-DUIg_lRU.js +149 -0
- package/dist/auth-profiles-BMF1fdhQ.js +2938 -0
- package/dist/boolean-C6Pbt2Ue.js +30 -0
- package/dist/brah-provider-CKcQ2qQ8.js +59 -0
- package/dist/brah-provider-D7G_zAuN.js +53 -0
- package/dist/brah-provider-Djzuocx7.js +54 -0
- package/dist/branding-CONYHJSC.js +82 -0
- package/dist/branding-DcW4KU4p.js +82 -0
- package/dist/brew-BIrWdDps.js +46 -0
- package/dist/brew-DYTEg8IL.js +46 -0
- package/dist/build-info.json +5 -0
- package/dist/call-B0EB11Hz.js +278 -0
- package/dist/call-Bykpt9_M.js +278 -0
- package/dist/canvas-host/a2ui/.bundle.hash +1 -0
- package/dist/canvas-host/a2ui/a2ui.bundle.js +17765 -0
- package/dist/canvas-host/a2ui/index.html +307 -0
- package/dist/channel-options-DLVRytYw.js +62 -0
- package/dist/channel-options-tgFQd3C0.js +32 -0
- package/dist/channel-selection-BE7PqmOC.js +51 -0
- package/dist/channel-selection-Dqp6K4Pw.js +51 -0
- package/dist/channel-summary-DZDiZAGl.js +1120 -0
- package/dist/channel-summary-ECvQTB5n.js +1121 -0
- package/dist/channels-cli-BFG8o_5O.js +1416 -0
- package/dist/channels-cli-NW8TfhTG.js +1419 -0
- package/dist/channels-status-issues-BiIcz4nz.js +18 -0
- package/dist/channels-status-issues-CIiu_Xxf.js +18 -0
- package/dist/chrome-4hKxr5KT.js +1973 -0
- package/dist/chrome-DQIhPH0W.js +1953 -0
- package/dist/clack-prompter-CJZpapQF.js +94 -0
- package/dist/clack-prompter-Dujo5dAa.js +94 -0
- package/dist/cli/daemon-cli.js +2 -0
- package/dist/cli-CBWZx_9K.js +94 -0
- package/dist/cli-Dpw7vdkR.js +90 -0
- package/dist/cli-utils-EpvLL-7H.js +43 -0
- package/dist/cli-utils-Yv4G3uEz.js +43 -0
- package/dist/client-DyaYZBTP.js +1617 -0
- package/dist/client-to8eMV2s.js +1617 -0
- package/dist/command-format-B96YFpq4.js +53 -0
- package/dist/command-format-Bb91kyB5.js +39 -0
- package/dist/command-format-Ch4rJeOo.js +133 -0
- package/dist/command-options-CiVRXfHE.js +33 -0
- package/dist/commands-DH9qcYUu.js +230 -0
- package/dist/completion-cli-BO3ziRR1.js +773 -0
- package/dist/completion-cli-xQqLK_Ni.js +434 -0
- package/dist/config-Ddbeba_Z.js +4915 -0
- package/dist/config-JJ_qstMV.js +4916 -0
- package/dist/config-c_xnI78-.js +5657 -0
- package/dist/config-guard-CKr985of.js +5971 -0
- package/dist/configure-Baroiqo5.js +895 -0
- package/dist/configure-tZw988ro.js +896 -0
- package/dist/constants-AeetkqWc.js +67 -0
- package/dist/constants-Dz79cVwc.js +67 -0
- package/dist/control-service-D6DqOGJY.js +61 -0
- package/dist/control-service-Dssk9Kaa.js +61 -0
- package/dist/control-ui/apple-touch-icon.png +0 -0
- package/dist/control-ui/assets/index-BoXosYY6.css +1 -0
- package/dist/control-ui/assets/index-Dm6g1E26.js +7553 -0
- package/dist/control-ui/assets/index-Dm6g1E26.js.map +1 -0
- package/dist/control-ui/favicon-32.png +0 -0
- package/dist/control-ui/favicon.ico +0 -0
- package/dist/control-ui/favicon.svg +22 -0
- package/dist/control-ui/index.html +17 -0
- package/dist/cron-cli-B-LWRLK-.js +460 -0
- package/dist/cron-cli-Ck-LIACc.js +456 -0
- package/dist/daemon-cli-CatDQvXp.js +759 -0
- package/dist/daemon-cli-DyljCSvh.js +757 -0
- package/dist/daemon-runtime-Bfpf-iTt.js +517 -0
- package/dist/daemon-runtime-Bof4EAty.js +517 -0
- package/dist/deliver-BBwjenkx.js +2587 -0
- package/dist/deliver-CQNhT-AZ.js +2587 -0
- package/dist/deliver-CqtN8jzj.js +2557 -0
- package/dist/deps-CwIHF5Kq.js +27 -0
- package/dist/deps-NlR-vxlh.js +27 -0
- package/dist/devices-cli-D2gNGH39.js +206 -0
- package/dist/devices-cli-_rugjRme.js +210 -0
- package/dist/directory-cli-BiGqaTbn.js +246 -0
- package/dist/directory-cli-DamxdQvl.js +250 -0
- package/dist/dispatcher-DOZGzrqb.js +160 -0
- package/dist/dns-cli-BGvF-HPE.js +200 -0
- package/dist/dns-cli-CwFuD5pv.js +204 -0
- package/dist/docs-cli-DJWF_t89.js +163 -0
- package/dist/docs-cli-Dplzz8Mq.js +160 -0
- package/dist/doctor-CdqmZxrK.js +2586 -0
- package/dist/doctor-DdHvLQSW.js +2588 -0
- package/dist/entry.js +1330 -0
- package/dist/env-YhBsuZYR.js +32 -0
- package/dist/errors-HrPt6FJ9.js +1952 -0
- package/dist/exec-4puFQDLB.js +246 -0
- package/dist/exec-BMnoMcZW.js +1099 -0
- package/dist/exec-BtbR_Cur.js +246 -0
- package/dist/exec-approvals-CA18XenO.js +1043 -0
- package/dist/exec-approvals-cli-BGB1TyrS.js +392 -0
- package/dist/exec-approvals-cli-Bq2Rv7if.js +388 -0
- package/dist/exec-approvals-iOoxTSaW.js +1043 -0
- package/dist/extensionAPI.js +67491 -0
- package/dist/format-DSCRXSo3.js +34 -0
- package/dist/format-DZA-SIiB.js +34 -0
- package/dist/gateway-cli-Ctozr1Nr.js +17356 -0
- package/dist/gateway-cli-Dm6fyKOW.js +17354 -0
- package/dist/gateway-rpc-DIBI9dZU.js +28 -0
- package/dist/gateway-rpc-DiR8jxC9.js +28 -0
- package/dist/github-copilot-auth-CWMgcPFb.js +1190 -0
- package/dist/github-copilot-auth-DBciFmic.js +1190 -0
- package/dist/github-copilot-token-B3SA95yo.js +103 -0
- package/dist/github-copilot-token-B9LJ8KjT.js +103 -0
- package/dist/github-copilot-token-BqZxoChM.js +103 -0
- package/dist/gmail-setup-utils-DC0hK-al.js +428 -0
- package/dist/gmail-setup-utils-Dt5K3pG2.js +428 -0
- package/dist/health-format-DZpQiSPr.js +1383 -0
- package/dist/health-format-rvKQDZAe.js +1385 -0
- package/dist/help-format-DUy1KRxq.js +17 -0
- package/dist/help-format-dO-Q4-RZ.js +17 -0
- package/dist/helpers-8O7IVGO-.js +25 -0
- package/dist/helpers-CcHGV820.js +10 -0
- package/dist/helpers-D_jqdWkd.js +25 -0
- package/dist/helpers-f7Q47hAD.js +10 -0
- package/dist/hooks/bundled/boot-md/HOOK.md +19 -0
- package/dist/hooks/bundled/command-logger/HOOK.md +122 -0
- package/dist/hooks/bundled/session-memory/HOOK.md +109 -0
- package/dist/hooks/bundled/soul-evil/HOOK.md +71 -0
- package/dist/hooks-cli-Dk70ZlpQ.js +1065 -0
- package/dist/hooks-cli-DkN_zNe_.js +1061 -0
- package/dist/hooks-status-BKToL6h7.js +443 -0
- package/dist/hooks-status-DAZqmvvU.js +443 -0
- package/dist/image-BZtCTxrR.js +634 -0
- package/dist/image-Yc5sSkOR.js +1426 -0
- package/dist/image-fscCHaO2.js +634 -0
- package/dist/index.js +6159 -0
- package/dist/installs-B8pY7vqZ.js +425 -0
- package/dist/installs-OI3UrTrZ.js +425 -0
- package/dist/is-main-BI9IbomE.js +25 -0
- package/dist/is-main-CatKw_er.js +25 -0
- package/dist/links-4bWi9tNq.js +15 -0
- package/dist/links-DPN-zsft.js +15 -0
- package/dist/loader-BQu3NLsc.js +64119 -0
- package/dist/logging-BggTN-OA.js +15 -0
- package/dist/logging-BvdokaVt.js +1 -0
- package/dist/logging-BzvBIA3Y.js +1 -0
- package/dist/logging-C-XFUtHZ.js +15 -0
- package/dist/login-qr-AehM-U7T.js +478 -0
- package/dist/login-qr-BbkDI6z-.js +475 -0
- package/dist/login-qr-KkxF3src.js +478 -0
- package/dist/logs-cli-GIy-ReUJ.js +232 -0
- package/dist/logs-cli-PkeymkCI.js +228 -0
- package/dist/manager-5cVcI5p8.js +2870 -0
- package/dist/manager-BHVQTR5S.js +2870 -0
- package/dist/manager-DYwowaGP.js +2872 -0
- package/dist/manifest-registry-CWVhL1Tp.js +669 -0
- package/dist/manifest-registry-yIkIFf0S.js +669 -0
- package/dist/message-channel-C0Y-pfV3.js +110 -0
- package/dist/message-channel-C3TK8GwV.js +110 -0
- package/dist/model-selection-BtrQIp5S.js +2940 -0
- package/dist/model-selection-DpbwUcPt.js +2691 -0
- package/dist/models-cli-BD-etPw9.js +2548 -0
- package/dist/models-cli-bdUO1YB5.js +2544 -0
- package/dist/net-8u61izyE.js +137 -0
- package/dist/net-D2zciGj5.js +137 -0
- package/dist/node-cli-DfUhskVm.js +1457 -0
- package/dist/node-cli-nnREUTNh.js +1461 -0
- package/dist/node-service-BF4ipV1g.js +67 -0
- package/dist/node-service-BQlkoIs-.js +67 -0
- package/dist/nodes-cli-BTFnWb5A.js +1209 -0
- package/dist/nodes-cli-C1KLCUgY.js +1213 -0
- package/dist/nodes-screen-BZIbguNP.js +157 -0
- package/dist/nodes-screen-D9YOHKnK.js +157 -0
- package/dist/note-DGwSQRou.js +73 -0
- package/dist/note-u0j4Zri6.js +73 -0
- package/dist/onboard-channels--6mZlRdm.js +671 -0
- package/dist/onboard-channels-Cjs_-7rV.js +671 -0
- package/dist/onboard-skills-CKh0otKb.js +3392 -0
- package/dist/onboard-skills-DFX908cv.js +3392 -0
- package/dist/onboarding-C9T4fYdo.js +3269 -0
- package/dist/openclaw-root-CNUzBTmy.js +84 -0
- package/dist/openclaw-root-DHli8vJO.js +84 -0
- package/dist/pairing-cli-DfM3LkLw.js +115 -0
- package/dist/pairing-cli-_nN81r25.js +119 -0
- package/dist/pairing-labels-BjA6wnhH.js +9 -0
- package/dist/pairing-labels-uGmG1FM-.js +9 -0
- package/dist/pairing-store-DfYWlf47.js +391 -0
- package/dist/pairing-store-RVhKX0MC.js +391 -0
- package/dist/parse-87ybtYW1.js +23 -0
- package/dist/parse-DOybnFJK.js +23 -0
- package/dist/parse-log-line-BoDqomM4.js +44 -0
- package/dist/parse-log-line-BuRiE-Ij.js +44 -0
- package/dist/parse-timeout-BIB19Upi.js +16 -0
- package/dist/parse-timeout-R8SiSP1t.js +16 -0
- package/dist/path-env-CXWUFfFv.js +77 -0
- package/dist/path-env-Dkh275Rh.js +77 -0
- package/dist/paths-B1kfl4h5.js +164 -0
- package/dist/paths-BPTe_oCW.js +43 -0
- package/dist/paths-BgalzSrB.js +40 -0
- package/dist/paths-DoU2wF-8.js +43 -0
- package/dist/paths-scjhy7N2.js +180 -0
- package/dist/pi-embedded-helpers-B8VNIgsS.js +8475 -0
- package/dist/pi-embedded-helpers-BpYQcZB0.js +1298 -0
- package/dist/pi-embedded-helpers-R5an9K5m.js +1298 -0
- package/dist/pi-model-discovery-CmCpGwer.js +20 -0
- package/dist/pi-model-discovery-DqgqUyAv.js +20 -0
- package/dist/pi-model-discovery-EhM2JAQo.js +20 -0
- package/dist/pi-tools.policy-6uFIt3Ju.js +230 -0
- package/dist/plugin-auto-enable-BhpgoPQ-.js +461 -0
- package/dist/plugin-auto-enable-C5fXErMQ.js +461 -0
- package/dist/plugin-sdk/brah-provider-Dv55ggdB.js +48 -0
- package/dist/plugin-sdk/index.d.ts +8856 -0
- package/dist/plugin-sdk/index.js +21240 -0
- package/dist/plugin-sdk/model-selection-D1wuaM-4.js +3184 -0
- package/dist/plugin-sdk/pi-model-discovery-Dw3A6oXH.js +37 -0
- package/dist/plugins-09ktk12_.js +496 -0
- package/dist/plugins-CDPqd0g4.js +495 -0
- package/dist/plugins-cli-BKPTobSa.js +445 -0
- package/dist/plugins-cli-FsBHhKXs.js +449 -0
- package/dist/ports-CNd5FYYb.js +96 -0
- package/dist/program-Tlz-_XHE.js +196 -0
- package/dist/progress-CkVQZWRm.js +133 -0
- package/dist/progress-DsH6InCn.js +133 -0
- package/dist/prompt-style-BdTr09G0.js +9 -0
- package/dist/prompt-style-XexlH5fB.js +9 -0
- package/dist/prompts-BaP7USwc.js +13 -0
- package/dist/prompts-CFRoaX7f.js +13 -0
- package/dist/pw-ai-8Eyk8VuD.js +1649 -0
- package/dist/pw-ai-Cl6-KNxy.js +1650 -0
- package/dist/pw-ai-DRdnHJHd.js +1653 -0
- package/dist/qmd-manager-BAFM4z59.js +619 -0
- package/dist/qmd-manager-Bmxs48Ir.js +615 -0
- package/dist/qmd-manager-CWJVDrwW.js +617 -0
- package/dist/redact-BIMJ3ntQ.js +94 -0
- package/dist/redact-CjQe_7H_.js +97 -0
- package/dist/redact-DAKeu7PA.js +97 -0
- package/dist/register.subclis-Buhb02qd.js +348 -0
- package/dist/reply-E1ga4GXi.js +64123 -0
- package/dist/rolldown-runtime-Cbj13DAv.js +20 -0
- package/dist/routes-CcDbWmxz.js +2410 -0
- package/dist/routes-f7Edit7G.js +2410 -0
- package/dist/rpc-B655pmNJ.js +95 -0
- package/dist/rpc-CGmdslK7.js +95 -0
- package/dist/run-main-7eydAwGv.js +200 -0
- package/dist/sandbox-B4M0ryQ9.js +2945 -0
- package/dist/sandbox-BO_Ngn9c.js +2944 -0
- package/dist/sandbox-cli-CM0-sW9i.js +461 -0
- package/dist/sandbox-cli-CoTcXRmo.js +465 -0
- package/dist/security-cli-B_s4Rfs1.js +511 -0
- package/dist/security-cli-D3igkp01.js +507 -0
- package/dist/server-context-BqWI0WDa.js +740 -0
- package/dist/server-context-DGn4KtxY.js +740 -0
- package/dist/server-node-events-DXWeo9KB.js +224 -0
- package/dist/server-node-events-DxMqJ1vi.js +220 -0
- package/dist/service-BmhixqmA.js +680 -0
- package/dist/service-CkduwhWU.js +680 -0
- package/dist/service-audit-BaAmsSA_.js +542 -0
- package/dist/service-audit-Nmqw1tRw.js +542 -0
- package/dist/session-cost-usage-Oj8cY19d.js +692 -0
- package/dist/session-cost-usage-hz41m3rR.js +692 -0
- package/dist/session-key-Dm2EOhrH.js +177 -0
- package/dist/shared-ByqSbw-o.js +150 -0
- package/dist/shared-CUArCxmj.js +74 -0
- package/dist/shared-DV0YxQE5.js +150 -0
- package/dist/shared-Oinouexg.js +74 -0
- package/dist/skill-scanner-BSMluzCy.js +255 -0
- package/dist/skill-scanner-ClmmXaeD.js +255 -0
- package/dist/skills-CTnvXE52.js +693 -0
- package/dist/skills-cli-B7GNsN5Z.js +292 -0
- package/dist/skills-cli-DfNIFyiP.js +288 -0
- package/dist/skills-iqJKhB3Q.js +694 -0
- package/dist/skills-status-B6Hjszph.js +187 -0
- package/dist/skills-status-B9teTTgu.js +187 -0
- package/dist/sqlite-BK4CGCLp.js +197 -0
- package/dist/sqlite-Dnmf3LS7.js +215 -0
- package/dist/sqlite-wME36UET.js +215 -0
- package/dist/status-BH22yQwC.js +27 -0
- package/dist/status-C09l2YXY.js +3176 -0
- package/dist/status-C_dMhoE0.js +21 -0
- package/dist/status-CoAy6bEC.js +21 -0
- package/dist/status-UIA3ZI_U.js +27 -0
- package/dist/subsystem-MZJ7YwGv.js +771 -0
- package/dist/system-cli-DEm78jPM.js +86 -0
- package/dist/system-cli-DW-cysMR.js +82 -0
- package/dist/systemd-DSVtqGOg.js +438 -0
- package/dist/systemd-QeNHBKY_.js +438 -0
- package/dist/systemd-hints-Bm58h2q6.js +19 -0
- package/dist/systemd-hints-DpYzxoFm.js +19 -0
- package/dist/systemd-linger-6najuv4T.js +75 -0
- package/dist/systemd-linger-BAqwxT4B.js +75 -0
- package/dist/table-BnT-yxX7.js +279 -0
- package/dist/table-Br4x1U8t.js +279 -0
- package/dist/tailnet-PJSFUYzh.js +42 -0
- package/dist/tailnet-tKZZ7PZm.js +42 -0
- package/dist/tailscale-CLOGxzVe.js +225 -0
- package/dist/tailscale-Csps5HaJ.js +252 -0
- package/dist/tool-display-B-D4P2Fx.js +795 -0
- package/dist/tool-display-CeXLhfq_.js +795 -0
- package/dist/transcript-events-C1hdue6u.js +17 -0
- package/dist/transcript-events-CSDpB0zT.js +17 -0
- package/dist/transcript-events-JLH5W4He.js +17 -0
- package/dist/tui-DpSIQB-L.js +2671 -0
- package/dist/tui-M4SDqVBr.js +2672 -0
- package/dist/tui-cli-BgeLL-6G.js +57 -0
- package/dist/tui-cli-DM2GolnA.js +61 -0
- package/dist/update-By6OFSOm.js +317 -0
- package/dist/update-CrY_whxA.js +317 -0
- package/dist/update-cli-Bfsx9UKw.js +1039 -0
- package/dist/update-cli-DoiUKlNw.js +1042 -0
- package/dist/update-runner-LPAHTmXu.js +1458 -0
- package/dist/update-runner-_TG-7dl6.js +1458 -0
- package/dist/usage-format-Bhl_WCWP.js +36 -0
- package/dist/usage-format-C0mOZv3Q.js +36 -0
- package/dist/utils-BQRXRRrc.js +188 -0
- package/dist/utils-DZrCbm8I.js +192 -0
- package/dist/webhooks-cli-D5oYa1jv.js +314 -0
- package/dist/webhooks-cli-HqwLm34I.js +310 -0
- package/dist/widearea-dns-DYYvkzkp.js +127 -0
- package/dist/widearea-dns-pTj59jZd.js +127 -0
- package/dist/ws-CdWr05vX.js +13 -0
- package/dist/ws-log-CDRetW_w.js +267 -0
- package/dist/ws-log-Cmu4Hs9k.js +267 -0
- package/dist/ws-odwH8aKX.js +13 -0
- package/dist/wsl-BrI_Sz-3.js +160 -0
- package/docs/.i18n/README.md +31 -0
- package/docs/.i18n/glossary.zh-CN.json +210 -0
- package/docs/.i18n/zh-CN.tm.jsonl +1329 -0
- package/docs/CNAME +1 -0
- package/docs/assets/macos-onboarding/01-macos-warning.jpeg +0 -0
- package/docs/assets/macos-onboarding/02-local-networks.jpeg +0 -0
- package/docs/assets/macos-onboarding/03-security-notice.png +0 -0
- package/docs/assets/macos-onboarding/04-choose-gateway.png +0 -0
- package/docs/assets/macos-onboarding/05-permissions.png +0 -0
- package/docs/assets/openclaw-logo-text-dark.png +0 -0
- package/docs/assets/openclaw-logo-text.png +0 -0
- package/docs/assets/pixel-lobster.svg +60 -0
- package/docs/assets/showcase/agents-ui.jpg +0 -0
- package/docs/assets/showcase/bambu-cli.png +0 -0
- package/docs/assets/showcase/codexmonitor.png +0 -0
- package/docs/assets/showcase/gohome-grafana.png +0 -0
- package/docs/assets/showcase/ios-testflight.jpg +0 -0
- package/docs/assets/showcase/oura-health.png +0 -0
- package/docs/assets/showcase/padel-cli.svg +11 -0
- package/docs/assets/showcase/padel-screenshot.jpg +0 -0
- package/docs/assets/showcase/papla-tts.jpg +0 -0
- package/docs/assets/showcase/pr-review-telegram.jpg +0 -0
- package/docs/assets/showcase/roborock-screenshot.jpg +0 -0
- package/docs/assets/showcase/roborock-status.svg +13 -0
- package/docs/assets/showcase/roof-camera-sky.jpg +0 -0
- package/docs/assets/showcase/snag.png +0 -0
- package/docs/assets/showcase/tesco-shop.jpg +0 -0
- package/docs/assets/showcase/wienerlinien.png +0 -0
- package/docs/assets/showcase/wine-cellar-skill.jpg +0 -0
- package/docs/assets/showcase/winix-air-purifier.jpg +0 -0
- package/docs/assets/showcase/xuezh-pronunciation.jpeg +0 -0
- package/docs/automation/auth-monitoring.md +44 -0
- package/docs/automation/cron-jobs.md +468 -0
- package/docs/automation/cron-vs-heartbeat.md +282 -0
- package/docs/automation/gmail-pubsub.md +256 -0
- package/docs/automation/poll.md +69 -0
- package/docs/automation/webhook.md +163 -0
- package/docs/bedrock.md +176 -0
- package/docs/brave-search.md +41 -0
- package/docs/broadcast-groups.md +442 -0
- package/docs/channels/bluebubbles.md +338 -0
- package/docs/channels/brah-sync.md +92 -0
- package/docs/channels/discord.md +476 -0
- package/docs/channels/feishu.md +577 -0
- package/docs/channels/googlechat.md +250 -0
- package/docs/channels/grammy.md +31 -0
- package/docs/channels/imessage.md +299 -0
- package/docs/channels/index.md +47 -0
- package/docs/channels/line.md +186 -0
- package/docs/channels/location.md +56 -0
- package/docs/channels/matrix.md +233 -0
- package/docs/channels/mattermost.md +138 -0
- package/docs/channels/msteams.md +768 -0
- package/docs/channels/nextcloud-talk.md +136 -0
- package/docs/channels/nostr.md +233 -0
- package/docs/channels/signal.md +202 -0
- package/docs/channels/slack.md +548 -0
- package/docs/channels/telegram.md +769 -0
- package/docs/channels/tlon.md +132 -0
- package/docs/channels/troubleshooting.md +29 -0
- package/docs/channels/twitch.md +379 -0
- package/docs/channels/whatsapp.md +404 -0
- package/docs/channels/zalo.md +189 -0
- package/docs/channels/zalouser.md +140 -0
- package/docs/cli/acp.md +170 -0
- package/docs/cli/agent.md +24 -0
- package/docs/cli/agents.md +75 -0
- package/docs/cli/approvals.md +50 -0
- package/docs/cli/browser.md +107 -0
- package/docs/cli/channels.md +79 -0
- package/docs/cli/config.md +50 -0
- package/docs/cli/configure.md +33 -0
- package/docs/cli/cron.md +42 -0
- package/docs/cli/dashboard.md +16 -0
- package/docs/cli/devices.md +70 -0
- package/docs/cli/directory.md +63 -0
- package/docs/cli/dns.md +23 -0
- package/docs/cli/docs.md +15 -0
- package/docs/cli/doctor.md +41 -0
- package/docs/cli/gateway.md +202 -0
- package/docs/cli/health.md +21 -0
- package/docs/cli/hooks.md +304 -0
- package/docs/cli/index.md +1031 -0
- package/docs/cli/logs.md +24 -0
- package/docs/cli/memory.md +45 -0
- package/docs/cli/message.md +239 -0
- package/docs/cli/models.md +79 -0
- package/docs/cli/node.md +112 -0
- package/docs/cli/nodes.md +73 -0
- package/docs/cli/onboard.md +43 -0
- package/docs/cli/pairing.md +21 -0
- package/docs/cli/plugins.md +62 -0
- package/docs/cli/reset.md +17 -0
- package/docs/cli/sandbox.md +152 -0
- package/docs/cli/security.md +26 -0
- package/docs/cli/sessions.md +16 -0
- package/docs/cli/setup.md +29 -0
- package/docs/cli/skills.md +26 -0
- package/docs/cli/status.md +26 -0
- package/docs/cli/system.md +60 -0
- package/docs/cli/tui.md +23 -0
- package/docs/cli/uninstall.md +17 -0
- package/docs/cli/update.md +98 -0
- package/docs/cli/voicecall.md +34 -0
- package/docs/cli/webhooks.md +25 -0
- package/docs/concepts/agent-loop.md +146 -0
- package/docs/concepts/agent-workspace.md +233 -0
- package/docs/concepts/agent.md +123 -0
- package/docs/concepts/architecture.md +129 -0
- package/docs/concepts/channel-routing.md +114 -0
- package/docs/concepts/compaction.md +61 -0
- package/docs/concepts/context.md +161 -0
- package/docs/concepts/features.md +53 -0
- package/docs/concepts/group-messages.md +84 -0
- package/docs/concepts/groups.md +373 -0
- package/docs/concepts/markdown-formatting.md +130 -0
- package/docs/concepts/memory.md +546 -0
- package/docs/concepts/messages.md +154 -0
- package/docs/concepts/model-failover.md +149 -0
- package/docs/concepts/model-providers.md +316 -0
- package/docs/concepts/models.md +208 -0
- package/docs/concepts/multi-agent.md +376 -0
- package/docs/concepts/oauth.md +145 -0
- package/docs/concepts/presence.md +102 -0
- package/docs/concepts/queue.md +89 -0
- package/docs/concepts/retry.md +69 -0
- package/docs/concepts/session-pruning.md +122 -0
- package/docs/concepts/session-tool.md +193 -0
- package/docs/concepts/session.md +204 -0
- package/docs/concepts/sessions.md +10 -0
- package/docs/concepts/streaming.md +135 -0
- package/docs/concepts/system-prompt.md +115 -0
- package/docs/concepts/timezone.md +91 -0
- package/docs/concepts/typebox.md +289 -0
- package/docs/concepts/typing-indicators.md +68 -0
- package/docs/concepts/usage-tracking.md +35 -0
- package/docs/date-time.md +128 -0
- package/docs/debug/node-issue.md +83 -0
- package/docs/debugging.md +162 -0
- package/docs/diagnostics/flags.md +91 -0
- package/docs/docs.json +1736 -0
- package/docs/environment.md +81 -0
- package/docs/experiments/onboarding-config-protocol.md +40 -0
- package/docs/experiments/plans/cron-add-hardening.md +63 -0
- package/docs/experiments/plans/group-policy-hardening.md +40 -0
- package/docs/experiments/plans/openresponses-gateway.md +123 -0
- package/docs/experiments/proposals/model-config.md +36 -0
- package/docs/experiments/research/memory.md +228 -0
- package/docs/gateway/authentication.md +145 -0
- package/docs/gateway/background-process.md +93 -0
- package/docs/gateway/bonjour.md +167 -0
- package/docs/gateway/bridge-protocol.md +89 -0
- package/docs/gateway/cli-backends.md +225 -0
- package/docs/gateway/configuration-examples.md +606 -0
- package/docs/gateway/configuration.md +3411 -0
- package/docs/gateway/discovery.md +116 -0
- package/docs/gateway/doctor.md +282 -0
- package/docs/gateway/gateway-lock.md +34 -0
- package/docs/gateway/health.md +35 -0
- package/docs/gateway/heartbeat.md +362 -0
- package/docs/gateway/index.md +328 -0
- package/docs/gateway/local-models.md +150 -0
- package/docs/gateway/logging.md +113 -0
- package/docs/gateway/multiple-gateways.md +112 -0
- package/docs/gateway/network-model.md +17 -0
- package/docs/gateway/openai-http-api.md +118 -0
- package/docs/gateway/openresponses-http-api.md +317 -0
- package/docs/gateway/pairing.md +99 -0
- package/docs/gateway/protocol.md +221 -0
- package/docs/gateway/remote-gateway-readme.md +157 -0
- package/docs/gateway/remote.md +129 -0
- package/docs/gateway/sandbox-vs-tool-policy-vs-elevated.md +128 -0
- package/docs/gateway/sandboxing.md +193 -0
- package/docs/gateway/security/formal-verification.md +164 -0
- package/docs/gateway/security/index.md +825 -0
- package/docs/gateway/tailscale.md +127 -0
- package/docs/gateway/tools-invoke-http-api.md +85 -0
- package/docs/gateway/troubleshooting.md +767 -0
- package/docs/help/faq.md +2829 -0
- package/docs/help/index.md +21 -0
- package/docs/help/submitting-a-pr.md +214 -0
- package/docs/help/submitting-an-issue.md +165 -0
- package/docs/help/troubleshooting.md +98 -0
- package/docs/hooks/soul-evil.md +69 -0
- package/docs/hooks.md +913 -0
- package/docs/images/feishu-step2-create-app.png +0 -0
- package/docs/images/feishu-step3-credentials.png +0 -0
- package/docs/images/feishu-step4-permissions.png +0 -0
- package/docs/images/feishu-step5-bot-capability.png +0 -0
- package/docs/images/feishu-step6-event-subscription.png +0 -0
- package/docs/images/groups-flow.svg +52 -0
- package/docs/images/mobile-ui-screenshot.png +0 -0
- package/docs/index.md +192 -0
- package/docs/install/ansible.md +208 -0
- package/docs/install/bun.md +59 -0
- package/docs/install/development-channels.md +75 -0
- package/docs/install/docker.md +567 -0
- package/docs/install/exe-dev.md +126 -0
- package/docs/install/fly.md +486 -0
- package/docs/install/gcp.md +503 -0
- package/docs/install/hetzner.md +330 -0
- package/docs/install/index.md +187 -0
- package/docs/install/installer.md +123 -0
- package/docs/install/macos-vm.md +281 -0
- package/docs/install/migrating.md +192 -0
- package/docs/install/nix.md +96 -0
- package/docs/install/node.md +78 -0
- package/docs/install/northflank.mdx +53 -0
- package/docs/install/railway.mdx +99 -0
- package/docs/install/render.mdx +165 -0
- package/docs/install/uninstall.md +128 -0
- package/docs/install/updating.md +228 -0
- package/docs/logging.md +350 -0
- package/docs/multi-agent-sandbox-tools.md +395 -0
- package/docs/network.md +54 -0
- package/docs/nodes/audio.md +114 -0
- package/docs/nodes/camera.md +156 -0
- package/docs/nodes/images.md +72 -0
- package/docs/nodes/index.md +341 -0
- package/docs/nodes/location-command.md +113 -0
- package/docs/nodes/media-understanding.md +379 -0
- package/docs/nodes/talk.md +90 -0
- package/docs/nodes/voicewake.md +65 -0
- package/docs/perplexity.md +80 -0
- package/docs/pi-dev.md +70 -0
- package/docs/pi.md +612 -0
- package/docs/platforms/android.md +148 -0
- package/docs/platforms/digitalocean.md +262 -0
- package/docs/platforms/index.md +53 -0
- package/docs/platforms/ios.md +107 -0
- package/docs/platforms/linux.md +94 -0
- package/docs/platforms/mac/bundled-gateway.md +73 -0
- package/docs/platforms/mac/canvas.md +125 -0
- package/docs/platforms/mac/child-process.md +69 -0
- package/docs/platforms/mac/dev-setup.md +102 -0
- package/docs/platforms/mac/health.md +34 -0
- package/docs/platforms/mac/icon.md +31 -0
- package/docs/platforms/mac/logging.md +57 -0
- package/docs/platforms/mac/menu-bar.md +81 -0
- package/docs/platforms/mac/peekaboo.md +65 -0
- package/docs/platforms/mac/permissions.md +44 -0
- package/docs/platforms/mac/release.md +85 -0
- package/docs/platforms/mac/remote.md +83 -0
- package/docs/platforms/mac/signing.md +47 -0
- package/docs/platforms/mac/skills.md +33 -0
- package/docs/platforms/mac/voice-overlay.md +60 -0
- package/docs/platforms/mac/voicewake.md +67 -0
- package/docs/platforms/mac/webchat.md +41 -0
- package/docs/platforms/mac/xpc.md +61 -0
- package/docs/platforms/macos.md +203 -0
- package/docs/platforms/oracle.md +303 -0
- package/docs/platforms/raspberry-pi.md +358 -0
- package/docs/platforms/windows.md +159 -0
- package/docs/plugin.md +664 -0
- package/docs/plugins/agent-tools.md +99 -0
- package/docs/plugins/manifest.md +71 -0
- package/docs/plugins/voice-call.md +284 -0
- package/docs/plugins/zalouser.md +81 -0
- package/docs/prose.md +134 -0
- package/docs/providers/anthropic.md +152 -0
- package/docs/providers/claude-max-api-proxy.md +148 -0
- package/docs/providers/cloudflare-ai-gateway.md +71 -0
- package/docs/providers/deepgram.md +93 -0
- package/docs/providers/github-copilot.md +72 -0
- package/docs/providers/glm.md +33 -0
- package/docs/providers/index.md +63 -0
- package/docs/providers/minimax.md +208 -0
- package/docs/providers/models.md +51 -0
- package/docs/providers/moonshot.md +142 -0
- package/docs/providers/ollama.md +277 -0
- package/docs/providers/openai.md +62 -0
- package/docs/providers/opencode.md +36 -0
- package/docs/providers/openrouter.md +37 -0
- package/docs/providers/qwen.md +53 -0
- package/docs/providers/synthetic.md +99 -0
- package/docs/providers/venice.md +267 -0
- package/docs/providers/vercel-ai-gateway.md +50 -0
- package/docs/providers/xiaomi.md +64 -0
- package/docs/providers/zai.md +36 -0
- package/docs/refactor/clawnet.md +417 -0
- package/docs/refactor/exec-host.md +316 -0
- package/docs/refactor/outbound-session-mirroring.md +85 -0
- package/docs/refactor/plugin-sdk.md +214 -0
- package/docs/refactor/strict-config.md +93 -0
- package/docs/reference/AGENTS.default.md +124 -0
- package/docs/reference/RELEASING.md +120 -0
- package/docs/reference/api-usage-costs.md +137 -0
- package/docs/reference/credits.md +27 -0
- package/docs/reference/device-models.md +47 -0
- package/docs/reference/rpc.md +43 -0
- package/docs/reference/session-management-compaction.md +285 -0
- package/docs/reference/templates/AGENTS.dev.md +83 -0
- package/docs/reference/templates/AGENTS.md +218 -0
- package/docs/reference/templates/BOOT.md +10 -0
- package/docs/reference/templates/BOOTSTRAP.md +61 -0
- package/docs/reference/templates/HEARTBEAT.md +11 -0
- package/docs/reference/templates/IDENTITY.dev.md +47 -0
- package/docs/reference/templates/IDENTITY.md +27 -0
- package/docs/reference/templates/SOUL.dev.md +76 -0
- package/docs/reference/templates/SOUL.md +42 -0
- package/docs/reference/templates/TOOLS.dev.md +24 -0
- package/docs/reference/templates/TOOLS.md +46 -0
- package/docs/reference/templates/USER.dev.md +18 -0
- package/docs/reference/templates/USER.md +22 -0
- package/docs/reference/test.md +50 -0
- package/docs/reference/transcript-hygiene.md +129 -0
- package/docs/reference/wizard.md +268 -0
- package/docs/scripts.md +28 -0
- package/docs/security/formal-verification.md +164 -0
- package/docs/start/bootstrapping.md +41 -0
- package/docs/start/docs-directory.md +64 -0
- package/docs/start/getting-started.md +120 -0
- package/docs/start/hubs.md +197 -0
- package/docs/start/lore.md +219 -0
- package/docs/start/onboarding.md +80 -0
- package/docs/start/openclaw.md +224 -0
- package/docs/start/pairing.md +86 -0
- package/docs/start/quickstart.md +22 -0
- package/docs/start/setup.md +162 -0
- package/docs/start/showcase.md +416 -0
- package/docs/start/wizard-cli-automation.md +141 -0
- package/docs/start/wizard-cli-reference.md +244 -0
- package/docs/start/wizard.md +108 -0
- package/docs/style.css +3 -0
- package/docs/testing.md +368 -0
- package/docs/token-use.md +112 -0
- package/docs/tools/agent-send.md +53 -0
- package/docs/tools/apply-patch.md +50 -0
- package/docs/tools/browser-linux-troubleshooting.md +139 -0
- package/docs/tools/browser-login.md +68 -0
- package/docs/tools/browser.md +576 -0
- package/docs/tools/chrome-extension.md +178 -0
- package/docs/tools/clawhub.md +257 -0
- package/docs/tools/creating-skills.md +54 -0
- package/docs/tools/elevated.md +57 -0
- package/docs/tools/exec-approvals.md +246 -0
- package/docs/tools/exec.md +179 -0
- package/docs/tools/firecrawl.md +61 -0
- package/docs/tools/index.md +512 -0
- package/docs/tools/llm-task.md +115 -0
- package/docs/tools/lobster.md +342 -0
- package/docs/tools/reactions.md +22 -0
- package/docs/tools/skills-config.md +76 -0
- package/docs/tools/skills.md +300 -0
- package/docs/tools/slash-commands.md +198 -0
- package/docs/tools/subagents.md +151 -0
- package/docs/tools/thinking.md +74 -0
- package/docs/tools/web.md +261 -0
- package/docs/tts.md +396 -0
- package/docs/tui.md +162 -0
- package/docs/vps.md +43 -0
- package/docs/web/control-ui.md +223 -0
- package/docs/web/dashboard.md +46 -0
- package/docs/web/index.md +116 -0
- package/docs/web/webchat.md +49 -0
- package/docs/whatsapp-openclaw-ai-zh.jpg +0 -0
- package/docs/whatsapp-openclaw.jpg +0 -0
- package/docs/zh-CN/AGENTS.md +59 -0
- package/docs/zh-CN/automation/auth-monitoring.md +47 -0
- package/docs/zh-CN/automation/cron-jobs.md +424 -0
- package/docs/zh-CN/automation/cron-vs-heartbeat.md +286 -0
- package/docs/zh-CN/automation/gmail-pubsub.md +249 -0
- package/docs/zh-CN/automation/poll.md +76 -0
- package/docs/zh-CN/automation/webhook.md +163 -0
- package/docs/zh-CN/bedrock.md +170 -0
- package/docs/zh-CN/brave-search.md +48 -0
- package/docs/zh-CN/broadcast-groups.md +449 -0
- package/docs/zh-CN/channels/bluebubbles.md +271 -0
- package/docs/zh-CN/channels/discord.md +468 -0
- package/docs/zh-CN/channels/feishu.md +629 -0
- package/docs/zh-CN/channels/googlechat.md +257 -0
- package/docs/zh-CN/channels/grammy.md +38 -0
- package/docs/zh-CN/channels/imessage.md +302 -0
- package/docs/zh-CN/channels/index.md +53 -0
- package/docs/zh-CN/channels/line.md +180 -0
- package/docs/zh-CN/channels/location.md +63 -0
- package/docs/zh-CN/channels/matrix.md +221 -0
- package/docs/zh-CN/channels/mattermost.md +144 -0
- package/docs/zh-CN/channels/msteams.md +775 -0
- package/docs/zh-CN/channels/nextcloud-talk.md +142 -0
- package/docs/zh-CN/channels/nostr.md +240 -0
- package/docs/zh-CN/channels/signal.md +209 -0
- package/docs/zh-CN/channels/slack.md +531 -0
- package/docs/zh-CN/channels/telegram.md +751 -0
- package/docs/zh-CN/channels/tlon.md +136 -0
- package/docs/zh-CN/channels/troubleshooting.md +36 -0
- package/docs/zh-CN/channels/twitch.md +385 -0
- package/docs/zh-CN/channels/whatsapp.md +411 -0
- package/docs/zh-CN/channels/zalo.md +196 -0
- package/docs/zh-CN/channels/zalouser.md +147 -0
- package/docs/zh-CN/cli/acp.md +173 -0
- package/docs/zh-CN/cli/agent.md +30 -0
- package/docs/zh-CN/cli/agents.md +82 -0
- package/docs/zh-CN/cli/approvals.md +57 -0
- package/docs/zh-CN/cli/browser.md +114 -0
- package/docs/zh-CN/cli/channels.md +86 -0
- package/docs/zh-CN/cli/config.md +57 -0
- package/docs/zh-CN/cli/configure.md +38 -0
- package/docs/zh-CN/cli/cron.md +43 -0
- package/docs/zh-CN/cli/dashboard.md +23 -0
- package/docs/zh-CN/cli/devices.md +74 -0
- package/docs/zh-CN/cli/directory.md +70 -0
- package/docs/zh-CN/cli/dns.md +30 -0
- package/docs/zh-CN/cli/docs.md +22 -0
- package/docs/zh-CN/cli/doctor.md +48 -0
- package/docs/zh-CN/cli/gateway.md +206 -0
- package/docs/zh-CN/cli/health.md +28 -0
- package/docs/zh-CN/cli/hooks.md +311 -0
- package/docs/zh-CN/cli/index.md +1032 -0
- package/docs/zh-CN/cli/logs.md +31 -0
- package/docs/zh-CN/cli/memory.md +52 -0
- package/docs/zh-CN/cli/message.md +246 -0
- package/docs/zh-CN/cli/models.md +85 -0
- package/docs/zh-CN/cli/node.md +115 -0
- package/docs/zh-CN/cli/nodes.md +80 -0
- package/docs/zh-CN/cli/onboard.md +36 -0
- package/docs/zh-CN/cli/pairing.md +28 -0
- package/docs/zh-CN/cli/plugins.md +66 -0
- package/docs/zh-CN/cli/reset.md +24 -0
- package/docs/zh-CN/cli/sandbox.md +158 -0
- package/docs/zh-CN/cli/security.md +33 -0
- package/docs/zh-CN/cli/sessions.md +23 -0
- package/docs/zh-CN/cli/setup.md +36 -0
- package/docs/zh-CN/cli/skills.md +33 -0
- package/docs/zh-CN/cli/status.md +33 -0
- package/docs/zh-CN/cli/system.md +63 -0
- package/docs/zh-CN/cli/tui.md +30 -0
- package/docs/zh-CN/cli/uninstall.md +24 -0
- package/docs/zh-CN/cli/update.md +101 -0
- package/docs/zh-CN/cli/voicecall.md +41 -0
- package/docs/zh-CN/cli/webhooks.md +32 -0
- package/docs/zh-CN/concepts/agent-loop.md +146 -0
- package/docs/zh-CN/concepts/agent-workspace.md +219 -0
- package/docs/zh-CN/concepts/agent.md +115 -0
- package/docs/zh-CN/concepts/architecture.md +123 -0
- package/docs/zh-CN/concepts/channel-routing.md +117 -0
- package/docs/zh-CN/concepts/compaction.md +67 -0
- package/docs/zh-CN/concepts/context.md +168 -0
- package/docs/zh-CN/concepts/features.md +59 -0
- package/docs/zh-CN/concepts/group-messages.md +91 -0
- package/docs/zh-CN/concepts/groups.md +379 -0
- package/docs/zh-CN/concepts/markdown-formatting.md +117 -0
- package/docs/zh-CN/concepts/memory.md +412 -0
- package/docs/zh-CN/concepts/messages.md +141 -0
- package/docs/zh-CN/concepts/model-failover.md +145 -0
- package/docs/zh-CN/concepts/model-providers.md +320 -0
- package/docs/zh-CN/concepts/models.md +196 -0
- package/docs/zh-CN/concepts/multi-agent.md +372 -0
- package/docs/zh-CN/concepts/oauth.md +151 -0
- package/docs/zh-CN/concepts/presence.md +99 -0
- package/docs/zh-CN/concepts/queue.md +94 -0
- package/docs/zh-CN/concepts/retry.md +76 -0
- package/docs/zh-CN/concepts/session-pruning.md +129 -0
- package/docs/zh-CN/concepts/session-tool.md +200 -0
- package/docs/zh-CN/concepts/session.md +166 -0
- package/docs/zh-CN/concepts/sessions.md +17 -0
- package/docs/zh-CN/concepts/streaming.md +133 -0
- package/docs/zh-CN/concepts/system-prompt.md +101 -0
- package/docs/zh-CN/concepts/timezone.md +96 -0
- package/docs/zh-CN/concepts/typebox.md +284 -0
- package/docs/zh-CN/concepts/typing-indicators.md +74 -0
- package/docs/zh-CN/concepts/usage-tracking.md +42 -0
- package/docs/zh-CN/date-time.md +129 -0
- package/docs/zh-CN/debug/node-issue.md +90 -0
- package/docs/zh-CN/debugging.md +160 -0
- package/docs/zh-CN/diagnostics/flags.md +98 -0
- package/docs/zh-CN/environment.md +88 -0
- package/docs/zh-CN/experiments/onboarding-config-protocol.md +47 -0
- package/docs/zh-CN/experiments/plans/cron-add-hardening.md +70 -0
- package/docs/zh-CN/experiments/plans/group-policy-hardening.md +45 -0
- package/docs/zh-CN/experiments/plans/openresponses-gateway.md +121 -0
- package/docs/zh-CN/experiments/proposals/model-config.md +42 -0
- package/docs/zh-CN/experiments/research/memory.md +235 -0
- package/docs/zh-CN/gateway/authentication.md +142 -0
- package/docs/zh-CN/gateway/background-process.md +100 -0
- package/docs/zh-CN/gateway/bonjour.md +174 -0
- package/docs/zh-CN/gateway/bridge-protocol.md +86 -0
- package/docs/zh-CN/gateway/cli-backends.md +213 -0
- package/docs/zh-CN/gateway/configuration-examples.md +587 -0
- package/docs/zh-CN/gateway/configuration.md +3332 -0
- package/docs/zh-CN/gateway/discovery.md +123 -0
- package/docs/zh-CN/gateway/doctor.md +238 -0
- package/docs/zh-CN/gateway/gateway-lock.md +41 -0
- package/docs/zh-CN/gateway/health.md +42 -0
- package/docs/zh-CN/gateway/heartbeat.md +274 -0
- package/docs/zh-CN/gateway/index.md +335 -0
- package/docs/zh-CN/gateway/local-models.md +157 -0
- package/docs/zh-CN/gateway/logging.md +114 -0
- package/docs/zh-CN/gateway/multiple-gateways.md +119 -0
- package/docs/zh-CN/gateway/network-model.md +23 -0
- package/docs/zh-CN/gateway/openai-http-api.md +125 -0
- package/docs/zh-CN/gateway/openresponses-http-api.md +317 -0
- package/docs/zh-CN/gateway/pairing.md +99 -0
- package/docs/zh-CN/gateway/protocol.md +220 -0
- package/docs/zh-CN/gateway/remote-gateway-readme.md +164 -0
- package/docs/zh-CN/gateway/remote.md +133 -0
- package/docs/zh-CN/gateway/sandbox-vs-tool-policy-vs-elevated.md +135 -0
- package/docs/zh-CN/gateway/sandboxing.md +188 -0
- package/docs/zh-CN/gateway/security/formal-verification.md +169 -0
- package/docs/zh-CN/gateway/security/index.md +777 -0
- package/docs/zh-CN/gateway/tailscale.md +124 -0
- package/docs/zh-CN/gateway/tools-invoke-http-api.md +92 -0
- package/docs/zh-CN/gateway/troubleshooting.md +771 -0
- package/docs/zh-CN/help/faq.md +2628 -0
- package/docs/zh-CN/help/index.md +28 -0
- package/docs/zh-CN/help/troubleshooting.md +104 -0
- package/docs/zh-CN/hooks/soul-evil.md +72 -0
- package/docs/zh-CN/hooks.md +919 -0
- package/docs/zh-CN/index.md +186 -0
- package/docs/zh-CN/install/ansible.md +215 -0
- package/docs/zh-CN/install/bun.md +65 -0
- package/docs/zh-CN/install/development-channels.md +81 -0
- package/docs/zh-CN/install/docker.md +532 -0
- package/docs/zh-CN/install/exe-dev.md +127 -0
- package/docs/zh-CN/install/fly.md +490 -0
- package/docs/zh-CN/install/gcp.md +510 -0
- package/docs/zh-CN/install/hetzner.md +337 -0
- package/docs/zh-CN/install/index.md +193 -0
- package/docs/zh-CN/install/installer.md +128 -0
- package/docs/zh-CN/install/macos-vm.md +288 -0
- package/docs/zh-CN/install/migrating.md +199 -0
- package/docs/zh-CN/install/nix.md +99 -0
- package/docs/zh-CN/install/node.md +85 -0
- package/docs/zh-CN/install/northflank.mdx +60 -0
- package/docs/zh-CN/install/railway.mdx +106 -0
- package/docs/zh-CN/install/render.mdx +169 -0
- package/docs/zh-CN/install/uninstall.md +135 -0
- package/docs/zh-CN/install/updating.md +233 -0
- package/docs/zh-CN/logging.md +329 -0
- package/docs/zh-CN/multi-agent-sandbox-tools.md +401 -0
- package/docs/zh-CN/network.md +59 -0
- package/docs/zh-CN/nodes/audio.md +120 -0
- package/docs/zh-CN/nodes/camera.md +162 -0
- package/docs/zh-CN/nodes/images.md +79 -0
- package/docs/zh-CN/nodes/index.md +348 -0
- package/docs/zh-CN/nodes/location-command.md +120 -0
- package/docs/zh-CN/nodes/media-understanding.md +380 -0
- package/docs/zh-CN/nodes/talk.md +97 -0
- package/docs/zh-CN/nodes/voicewake.md +72 -0
- package/docs/zh-CN/perplexity.md +84 -0
- package/docs/zh-CN/pi-dev.md +77 -0
- package/docs/zh-CN/pi.md +619 -0
- package/docs/zh-CN/platforms/android.md +155 -0
- package/docs/zh-CN/platforms/digitalocean.md +269 -0
- package/docs/zh-CN/platforms/index.md +60 -0
- package/docs/zh-CN/platforms/ios.md +114 -0
- package/docs/zh-CN/platforms/linux.md +101 -0
- package/docs/zh-CN/platforms/mac/bundled-gateway.md +75 -0
- package/docs/zh-CN/platforms/mac/canvas.md +128 -0
- package/docs/zh-CN/platforms/mac/child-process.md +73 -0
- package/docs/zh-CN/platforms/mac/dev-setup.md +109 -0
- package/docs/zh-CN/platforms/mac/health.md +41 -0
- package/docs/zh-CN/platforms/mac/icon.md +38 -0
- package/docs/zh-CN/platforms/mac/logging.md +64 -0
- package/docs/zh-CN/platforms/mac/menu-bar.md +88 -0
- package/docs/zh-CN/platforms/mac/peekaboo.md +62 -0
- package/docs/zh-CN/platforms/mac/permissions.md +46 -0
- package/docs/zh-CN/platforms/mac/release.md +92 -0
- package/docs/zh-CN/platforms/mac/remote.md +90 -0
- package/docs/zh-CN/platforms/mac/signing.md +54 -0
- package/docs/zh-CN/platforms/mac/skills.md +40 -0
- package/docs/zh-CN/platforms/mac/voice-overlay.md +67 -0
- package/docs/zh-CN/platforms/mac/voicewake.md +74 -0
- package/docs/zh-CN/platforms/mac/webchat.md +43 -0
- package/docs/zh-CN/platforms/mac/xpc.md +68 -0
- package/docs/zh-CN/platforms/macos.md +193 -0
- package/docs/zh-CN/platforms/oracle.md +310 -0
- package/docs/zh-CN/platforms/raspberry-pi.md +365 -0
- package/docs/zh-CN/platforms/windows.md +156 -0
- package/docs/zh-CN/plugin.md +639 -0
- package/docs/zh-CN/plugins/agent-tools.md +99 -0
- package/docs/zh-CN/plugins/manifest.md +68 -0
- package/docs/zh-CN/plugins/voice-call.md +250 -0
- package/docs/zh-CN/plugins/zalouser.md +88 -0
- package/docs/zh-CN/prose.md +141 -0
- package/docs/zh-CN/providers/anthropic.md +159 -0
- package/docs/zh-CN/providers/claude-max-api-proxy.md +155 -0
- package/docs/zh-CN/providers/deepgram.md +97 -0
- package/docs/zh-CN/providers/github-copilot.md +67 -0
- package/docs/zh-CN/providers/glm.md +39 -0
- package/docs/zh-CN/providers/index.md +68 -0
- package/docs/zh-CN/providers/minimax.md +206 -0
- package/docs/zh-CN/providers/models.md +55 -0
- package/docs/zh-CN/providers/moonshot.md +145 -0
- package/docs/zh-CN/providers/ollama.md +230 -0
- package/docs/zh-CN/providers/openai.md +68 -0
- package/docs/zh-CN/providers/opencode.md +41 -0
- package/docs/zh-CN/providers/openrouter.md +43 -0
- package/docs/zh-CN/providers/qwen.md +55 -0
- package/docs/zh-CN/providers/synthetic.md +102 -0
- package/docs/zh-CN/providers/venice.md +274 -0
- package/docs/zh-CN/providers/vercel-ai-gateway.md +57 -0
- package/docs/zh-CN/providers/xiaomi.md +68 -0
- package/docs/zh-CN/providers/zai.md +41 -0
- package/docs/zh-CN/refactor/clawnet.md +424 -0
- package/docs/zh-CN/refactor/exec-host.md +323 -0
- package/docs/zh-CN/refactor/outbound-session-mirroring.md +92 -0
- package/docs/zh-CN/refactor/plugin-sdk.md +221 -0
- package/docs/zh-CN/refactor/strict-config.md +100 -0
- package/docs/zh-CN/reference/AGENTS.default.md +131 -0
- package/docs/zh-CN/reference/RELEASING.md +123 -0
- package/docs/zh-CN/reference/api-usage-costs.md +136 -0
- package/docs/zh-CN/reference/credits.md +34 -0
- package/docs/zh-CN/reference/device-models.md +54 -0
- package/docs/zh-CN/reference/rpc.md +48 -0
- package/docs/zh-CN/reference/session-management-compaction.md +287 -0
- package/docs/zh-CN/reference/templates/AGENTS.dev.md +89 -0
- package/docs/zh-CN/reference/templates/AGENTS.md +225 -0
- package/docs/zh-CN/reference/templates/BOOT.md +17 -0
- package/docs/zh-CN/reference/templates/BOOTSTRAP.md +68 -0
- package/docs/zh-CN/reference/templates/HEARTBEAT.md +18 -0
- package/docs/zh-CN/reference/templates/IDENTITY.dev.md +54 -0
- package/docs/zh-CN/reference/templates/IDENTITY.md +35 -0
- package/docs/zh-CN/reference/templates/SOUL.dev.md +83 -0
- package/docs/zh-CN/reference/templates/SOUL.md +49 -0
- package/docs/zh-CN/reference/templates/TOOLS.dev.md +31 -0
- package/docs/zh-CN/reference/templates/TOOLS.md +53 -0
- package/docs/zh-CN/reference/templates/USER.dev.md +25 -0
- package/docs/zh-CN/reference/templates/USER.md +30 -0
- package/docs/zh-CN/reference/test.md +57 -0
- package/docs/zh-CN/reference/transcript-hygiene.md +109 -0
- package/docs/zh-CN/scripts.md +35 -0
- package/docs/zh-CN/security/formal-verification.md +171 -0
- package/docs/zh-CN/start/docs-directory.md +70 -0
- package/docs/zh-CN/start/getting-started.md +206 -0
- package/docs/zh-CN/start/hubs.md +200 -0
- package/docs/zh-CN/start/lore.md +226 -0
- package/docs/zh-CN/start/onboarding.md +105 -0
- package/docs/zh-CN/start/openclaw.md +248 -0
- package/docs/zh-CN/start/pairing.md +89 -0
- package/docs/zh-CN/start/quickstart.md +88 -0
- package/docs/zh-CN/start/setup.md +153 -0
- package/docs/zh-CN/start/showcase.md +423 -0
- package/docs/zh-CN/start/wizard.md +331 -0
- package/docs/zh-CN/testing.md +375 -0
- package/docs/zh-CN/token-use.md +119 -0
- package/docs/zh-CN/tools/agent-send.md +59 -0
- package/docs/zh-CN/tools/apply-patch.md +57 -0
- package/docs/zh-CN/tools/browser-linux-troubleshooting.md +144 -0
- package/docs/zh-CN/tools/browser-login.md +75 -0
- package/docs/zh-CN/tools/browser.md +553 -0
- package/docs/zh-CN/tools/chrome-extension.md +183 -0
- package/docs/zh-CN/tools/clawhub.md +209 -0
- package/docs/zh-CN/tools/creating-skills.md +61 -0
- package/docs/zh-CN/tools/elevated.md +64 -0
- package/docs/zh-CN/tools/exec-approvals.md +234 -0
- package/docs/zh-CN/tools/exec.md +169 -0
- package/docs/zh-CN/tools/firecrawl.md +68 -0
- package/docs/zh-CN/tools/index.md +515 -0
- package/docs/zh-CN/tools/llm-task.md +117 -0
- package/docs/zh-CN/tools/lobster.md +349 -0
- package/docs/zh-CN/tools/reactions.md +29 -0
- package/docs/zh-CN/tools/skills-config.md +78 -0
- package/docs/zh-CN/tools/skills.md +279 -0
- package/docs/zh-CN/tools/slash-commands.md +205 -0
- package/docs/zh-CN/tools/subagents.md +156 -0
- package/docs/zh-CN/tools/thinking.md +80 -0
- package/docs/zh-CN/tools/web.md +257 -0
- package/docs/zh-CN/tts.md +375 -0
- package/docs/zh-CN/tui.md +166 -0
- package/docs/zh-CN/vps.md +47 -0
- package/docs/zh-CN/web/control-ui.md +191 -0
- package/docs/zh-CN/web/dashboard.md +53 -0
- package/docs/zh-CN/web/index.md +118 -0
- package/docs/zh-CN/web/webchat.md +56 -0
- package/extensions/bluebubbles/README.md +45 -0
- package/extensions/bluebubbles/index.ts +19 -0
- package/extensions/bluebubbles/node_modules/.bin/clawbrah +21 -0
- package/extensions/bluebubbles/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/bluebubbles/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/bluebubbles/node_modules/.bin/openclaw +21 -0
- package/extensions/bluebubbles/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/bluebubbles/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/bluebubbles/openclaw.plugin.json +9 -0
- package/extensions/bluebubbles/package.json +36 -0
- package/extensions/bluebubbles/src/accounts.ts +88 -0
- package/extensions/bluebubbles/src/actions.test.ts +650 -0
- package/extensions/bluebubbles/src/actions.ts +438 -0
- package/extensions/bluebubbles/src/attachments.test.ts +345 -0
- package/extensions/bluebubbles/src/attachments.ts +300 -0
- package/extensions/bluebubbles/src/channel.ts +414 -0
- package/extensions/bluebubbles/src/chat.test.ts +461 -0
- package/extensions/bluebubbles/src/chat.ts +378 -0
- package/extensions/bluebubbles/src/config-schema.ts +51 -0
- package/extensions/bluebubbles/src/media-send.ts +174 -0
- package/extensions/bluebubbles/src/monitor.test.ts +2342 -0
- package/extensions/bluebubbles/src/monitor.ts +2499 -0
- package/extensions/bluebubbles/src/onboarding.ts +352 -0
- package/extensions/bluebubbles/src/probe.ts +135 -0
- package/extensions/bluebubbles/src/reactions.test.ts +392 -0
- package/extensions/bluebubbles/src/reactions.ts +188 -0
- package/extensions/bluebubbles/src/runtime.ts +14 -0
- package/extensions/bluebubbles/src/send.test.ts +808 -0
- package/extensions/bluebubbles/src/send.ts +467 -0
- package/extensions/bluebubbles/src/targets.test.ts +183 -0
- package/extensions/bluebubbles/src/targets.ts +422 -0
- package/extensions/bluebubbles/src/types.ts +127 -0
- package/extensions/brah-sync/README.md +53 -0
- package/extensions/brah-sync/index.ts +19 -0
- package/extensions/brah-sync/node_modules/.bin/clawbrah +21 -0
- package/extensions/brah-sync/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/brah-sync/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/brah-sync/node_modules/.bin/openclaw +21 -0
- package/extensions/brah-sync/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/brah-sync/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/brah-sync/openclaw.plugin.json +9 -0
- package/extensions/brah-sync/package.json +12 -0
- package/extensions/brah-sync/src/channel.ts +100 -0
- package/extensions/brah-sync/src/config-schema.ts +35 -0
- package/extensions/brah-sync/src/runtime.ts +14 -0
- package/extensions/copilot-proxy/README.md +24 -0
- package/extensions/copilot-proxy/index.ts +149 -0
- package/extensions/copilot-proxy/node_modules/.bin/clawbrah +21 -0
- package/extensions/copilot-proxy/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/copilot-proxy/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/copilot-proxy/node_modules/.bin/openclaw +21 -0
- package/extensions/copilot-proxy/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/copilot-proxy/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/copilot-proxy/openclaw.plugin.json +9 -0
- package/extensions/copilot-proxy/package.json +14 -0
- package/extensions/diagnostics-otel/index.ts +15 -0
- package/extensions/diagnostics-otel/node_modules/.bin/acorn +21 -0
- package/extensions/diagnostics-otel/node_modules/.bin/acorn.CMD +12 -0
- package/extensions/diagnostics-otel/node_modules/.bin/acorn.ps1 +41 -0
- package/extensions/diagnostics-otel/node_modules/.bin/clawbrah +21 -0
- package/extensions/diagnostics-otel/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/diagnostics-otel/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/diagnostics-otel/node_modules/.bin/openclaw +21 -0
- package/extensions/diagnostics-otel/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/diagnostics-otel/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/diagnostics-otel/openclaw.plugin.json +8 -0
- package/extensions/diagnostics-otel/package.json +27 -0
- package/extensions/diagnostics-otel/src/service.test.ts +226 -0
- package/extensions/diagnostics-otel/src/service.ts +635 -0
- package/extensions/discord/index.ts +17 -0
- package/extensions/discord/node_modules/.bin/clawbrah +21 -0
- package/extensions/discord/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/discord/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/discord/node_modules/.bin/openclaw +21 -0
- package/extensions/discord/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/discord/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/discord/openclaw.plugin.json +9 -0
- package/extensions/discord/package.json +14 -0
- package/extensions/discord/src/channel.ts +422 -0
- package/extensions/discord/src/runtime.ts +14 -0
- package/extensions/feishu/index.ts +63 -0
- package/extensions/feishu/node_modules/.bin/clawbrah +21 -0
- package/extensions/feishu/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/feishu/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/feishu/node_modules/.bin/openclaw +21 -0
- package/extensions/feishu/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/feishu/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/feishu/openclaw.plugin.json +10 -0
- package/extensions/feishu/package.json +37 -0
- package/extensions/feishu/skills/feishu-doc/SKILL.md +105 -0
- package/extensions/feishu/skills/feishu-doc/references/block-types.md +103 -0
- package/extensions/feishu/skills/feishu-drive/SKILL.md +97 -0
- package/extensions/feishu/skills/feishu-perm/SKILL.md +119 -0
- package/extensions/feishu/skills/feishu-wiki/SKILL.md +111 -0
- package/extensions/feishu/src/accounts.ts +144 -0
- package/extensions/feishu/src/bitable.ts +459 -0
- package/extensions/feishu/src/bot.ts +871 -0
- package/extensions/feishu/src/channel.ts +341 -0
- package/extensions/feishu/src/client.ts +118 -0
- package/extensions/feishu/src/config-schema.ts +172 -0
- package/extensions/feishu/src/directory.ts +177 -0
- package/extensions/feishu/src/doc-schema.ts +47 -0
- package/extensions/feishu/src/docx.ts +521 -0
- package/extensions/feishu/src/drive-schema.ts +46 -0
- package/extensions/feishu/src/drive.ts +227 -0
- package/extensions/feishu/src/media.ts +527 -0
- package/extensions/feishu/src/mention.ts +126 -0
- package/extensions/feishu/src/monitor.ts +190 -0
- package/extensions/feishu/src/onboarding.ts +356 -0
- package/extensions/feishu/src/outbound.ts +40 -0
- package/extensions/feishu/src/perm-schema.ts +52 -0
- package/extensions/feishu/src/perm.ts +173 -0
- package/extensions/feishu/src/policy.ts +104 -0
- package/extensions/feishu/src/probe.ts +44 -0
- package/extensions/feishu/src/reactions.ts +160 -0
- package/extensions/feishu/src/reply-dispatcher.ts +184 -0
- package/extensions/feishu/src/runtime.ts +14 -0
- package/extensions/feishu/src/send.ts +358 -0
- package/extensions/feishu/src/targets.ts +78 -0
- package/extensions/feishu/src/tools-config.ts +21 -0
- package/extensions/feishu/src/types.ts +75 -0
- package/extensions/feishu/src/typing.ts +80 -0
- package/extensions/feishu/src/wiki-schema.ts +55 -0
- package/extensions/feishu/src/wiki.ts +232 -0
- package/extensions/google-antigravity-auth/README.md +24 -0
- package/extensions/google-antigravity-auth/index.ts +461 -0
- package/extensions/google-antigravity-auth/node_modules/.bin/clawbrah +21 -0
- package/extensions/google-antigravity-auth/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/google-antigravity-auth/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/google-antigravity-auth/node_modules/.bin/openclaw +21 -0
- package/extensions/google-antigravity-auth/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/google-antigravity-auth/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/google-antigravity-auth/openclaw.plugin.json +9 -0
- package/extensions/google-antigravity-auth/package.json +14 -0
- package/extensions/google-gemini-cli-auth/README.md +35 -0
- package/extensions/google-gemini-cli-auth/index.ts +88 -0
- package/extensions/google-gemini-cli-auth/node_modules/.bin/clawbrah +21 -0
- package/extensions/google-gemini-cli-auth/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/google-gemini-cli-auth/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/google-gemini-cli-auth/node_modules/.bin/openclaw +21 -0
- package/extensions/google-gemini-cli-auth/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/google-gemini-cli-auth/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/google-gemini-cli-auth/oauth.test.ts +240 -0
- package/extensions/google-gemini-cli-auth/oauth.ts +662 -0
- package/extensions/google-gemini-cli-auth/openclaw.plugin.json +9 -0
- package/extensions/google-gemini-cli-auth/package.json +14 -0
- package/extensions/googlechat/index.ts +19 -0
- package/extensions/googlechat/node_modules/.bin/clawbrah +21 -0
- package/extensions/googlechat/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/googlechat/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/googlechat/node_modules/.bin/openclaw +21 -0
- package/extensions/googlechat/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/googlechat/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/googlechat/openclaw.plugin.json +9 -0
- package/extensions/googlechat/package.json +39 -0
- package/extensions/googlechat/src/accounts.ts +147 -0
- package/extensions/googlechat/src/actions.ts +181 -0
- package/extensions/googlechat/src/api.test.ts +61 -0
- package/extensions/googlechat/src/api.ts +282 -0
- package/extensions/googlechat/src/auth.ts +123 -0
- package/extensions/googlechat/src/channel.ts +583 -0
- package/extensions/googlechat/src/monitor.test.ts +22 -0
- package/extensions/googlechat/src/monitor.ts +960 -0
- package/extensions/googlechat/src/onboarding.ts +269 -0
- package/extensions/googlechat/src/runtime.ts +14 -0
- package/extensions/googlechat/src/targets.test.ts +32 -0
- package/extensions/googlechat/src/targets.ts +65 -0
- package/extensions/googlechat/src/types.config.ts +3 -0
- package/extensions/googlechat/src/types.ts +73 -0
- package/extensions/imessage/index.ts +17 -0
- package/extensions/imessage/node_modules/.bin/clawbrah +21 -0
- package/extensions/imessage/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/imessage/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/imessage/node_modules/.bin/openclaw +21 -0
- package/extensions/imessage/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/imessage/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/imessage/openclaw.plugin.json +9 -0
- package/extensions/imessage/package.json +14 -0
- package/extensions/imessage/src/channel.ts +294 -0
- package/extensions/imessage/src/runtime.ts +14 -0
- package/extensions/line/index.ts +19 -0
- package/extensions/line/node_modules/.bin/clawbrah +21 -0
- package/extensions/line/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/line/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/line/node_modules/.bin/openclaw +21 -0
- package/extensions/line/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/line/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/line/openclaw.plugin.json +9 -0
- package/extensions/line/package.json +29 -0
- package/extensions/line/src/card-command.ts +344 -0
- package/extensions/line/src/channel.logout.test.ts +99 -0
- package/extensions/line/src/channel.sendPayload.test.ts +306 -0
- package/extensions/line/src/channel.ts +780 -0
- package/extensions/line/src/runtime.ts +14 -0
- package/extensions/llm-task/README.md +97 -0
- package/extensions/llm-task/index.ts +6 -0
- package/extensions/llm-task/node_modules/.bin/clawbrah +21 -0
- package/extensions/llm-task/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/llm-task/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/llm-task/node_modules/.bin/openclaw +21 -0
- package/extensions/llm-task/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/llm-task/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/llm-task/openclaw.plugin.json +21 -0
- package/extensions/llm-task/package.json +14 -0
- package/extensions/llm-task/src/llm-task-tool.test.ts +138 -0
- package/extensions/llm-task/src/llm-task-tool.ts +245 -0
- package/extensions/lobster/README.md +75 -0
- package/extensions/lobster/SKILL.md +97 -0
- package/extensions/lobster/index.ts +14 -0
- package/extensions/lobster/node_modules/.bin/clawbrah +21 -0
- package/extensions/lobster/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/lobster/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/lobster/node_modules/.bin/openclaw +21 -0
- package/extensions/lobster/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/lobster/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/lobster/openclaw.plugin.json +10 -0
- package/extensions/lobster/package.json +14 -0
- package/extensions/lobster/src/lobster-tool.test.ts +247 -0
- package/extensions/lobster/src/lobster-tool.ts +328 -0
- package/extensions/matrix/CHANGELOG.md +93 -0
- package/extensions/matrix/index.ts +17 -0
- package/extensions/matrix/node_modules/.bin/clawbrah +21 -0
- package/extensions/matrix/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/matrix/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/matrix/node_modules/.bin/markdown-it +21 -0
- package/extensions/matrix/node_modules/.bin/markdown-it.CMD +12 -0
- package/extensions/matrix/node_modules/.bin/markdown-it.ps1 +41 -0
- package/extensions/matrix/node_modules/.bin/openclaw +21 -0
- package/extensions/matrix/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/matrix/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/matrix/openclaw.plugin.json +9 -0
- package/extensions/matrix/package.json +36 -0
- package/extensions/matrix/src/actions.ts +195 -0
- package/extensions/matrix/src/channel.directory.test.ts +64 -0
- package/extensions/matrix/src/channel.ts +439 -0
- package/extensions/matrix/src/config-schema.ts +63 -0
- package/extensions/matrix/src/directory-live.ts +188 -0
- package/extensions/matrix/src/group-mentions.ts +66 -0
- package/extensions/matrix/src/matrix/accounts.test.ts +82 -0
- package/extensions/matrix/src/matrix/accounts.ts +65 -0
- package/extensions/matrix/src/matrix/actions/client.ts +57 -0
- package/extensions/matrix/src/matrix/actions/messages.ts +128 -0
- package/extensions/matrix/src/matrix/actions/pins.ts +76 -0
- package/extensions/matrix/src/matrix/actions/reactions.ts +96 -0
- package/extensions/matrix/src/matrix/actions/room.ts +85 -0
- package/extensions/matrix/src/matrix/actions/summary.ts +75 -0
- package/extensions/matrix/src/matrix/actions/types.ts +84 -0
- package/extensions/matrix/src/matrix/actions.ts +15 -0
- package/extensions/matrix/src/matrix/active-client.ts +11 -0
- package/extensions/matrix/src/matrix/client/config.ts +160 -0
- package/extensions/matrix/src/matrix/client/create-client.ts +123 -0
- package/extensions/matrix/src/matrix/client/logging.ts +36 -0
- package/extensions/matrix/src/matrix/client/runtime.ts +4 -0
- package/extensions/matrix/src/matrix/client/shared.ts +170 -0
- package/extensions/matrix/src/matrix/client/storage.ts +131 -0
- package/extensions/matrix/src/matrix/client/types.ts +34 -0
- package/extensions/matrix/src/matrix/client.test.ts +56 -0
- package/extensions/matrix/src/matrix/client.ts +5 -0
- package/extensions/matrix/src/matrix/credentials.ts +105 -0
- package/extensions/matrix/src/matrix/deps.ts +60 -0
- package/extensions/matrix/src/matrix/format.test.ts +33 -0
- package/extensions/matrix/src/matrix/format.ts +22 -0
- package/extensions/matrix/src/matrix/index.ts +11 -0
- package/extensions/matrix/src/matrix/monitor/allowlist.test.ts +45 -0
- package/extensions/matrix/src/matrix/monitor/allowlist.ts +103 -0
- package/extensions/matrix/src/matrix/monitor/auto-join.ts +71 -0
- package/extensions/matrix/src/matrix/monitor/direct.ts +104 -0
- package/extensions/matrix/src/matrix/monitor/events.ts +101 -0
- package/extensions/matrix/src/matrix/monitor/handler.ts +665 -0
- package/extensions/matrix/src/matrix/monitor/index.ts +338 -0
- package/extensions/matrix/src/matrix/monitor/location.ts +100 -0
- package/extensions/matrix/src/matrix/monitor/media.test.ts +102 -0
- package/extensions/matrix/src/matrix/monitor/media.ts +113 -0
- package/extensions/matrix/src/matrix/monitor/mentions.ts +31 -0
- package/extensions/matrix/src/matrix/monitor/replies.ts +97 -0
- package/extensions/matrix/src/matrix/monitor/room-info.ts +55 -0
- package/extensions/matrix/src/matrix/monitor/rooms.test.ts +39 -0
- package/extensions/matrix/src/matrix/monitor/rooms.ts +47 -0
- package/extensions/matrix/src/matrix/monitor/threads.ts +68 -0
- package/extensions/matrix/src/matrix/monitor/types.ts +39 -0
- package/extensions/matrix/src/matrix/poll-types.test.ts +21 -0
- package/extensions/matrix/src/matrix/poll-types.ts +166 -0
- package/extensions/matrix/src/matrix/probe.ts +70 -0
- package/extensions/matrix/src/matrix/send/client.ts +66 -0
- package/extensions/matrix/src/matrix/send/formatting.ts +89 -0
- package/extensions/matrix/src/matrix/send/media.ts +229 -0
- package/extensions/matrix/src/matrix/send/targets.test.ts +98 -0
- package/extensions/matrix/src/matrix/send/targets.ts +136 -0
- package/extensions/matrix/src/matrix/send/types.ts +109 -0
- package/extensions/matrix/src/matrix/send.test.ts +171 -0
- package/extensions/matrix/src/matrix/send.ts +260 -0
- package/extensions/matrix/src/onboarding.ts +449 -0
- package/extensions/matrix/src/outbound.ts +52 -0
- package/extensions/matrix/src/resolve-targets.test.ts +48 -0
- package/extensions/matrix/src/resolve-targets.ts +135 -0
- package/extensions/matrix/src/runtime.ts +14 -0
- package/extensions/matrix/src/tool-actions.ts +164 -0
- package/extensions/matrix/src/types.ts +97 -0
- package/extensions/mattermost/index.ts +17 -0
- package/extensions/mattermost/node_modules/.bin/clawbrah +21 -0
- package/extensions/mattermost/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/mattermost/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/mattermost/node_modules/.bin/openclaw +21 -0
- package/extensions/mattermost/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/mattermost/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/mattermost/openclaw.plugin.json +9 -0
- package/extensions/mattermost/package.json +28 -0
- package/extensions/mattermost/src/channel.test.ts +72 -0
- package/extensions/mattermost/src/channel.ts +337 -0
- package/extensions/mattermost/src/config-schema.ts +56 -0
- package/extensions/mattermost/src/group-mentions.ts +15 -0
- package/extensions/mattermost/src/mattermost/accounts.ts +128 -0
- package/extensions/mattermost/src/mattermost/client.ts +220 -0
- package/extensions/mattermost/src/mattermost/index.ts +9 -0
- package/extensions/mattermost/src/mattermost/monitor-helpers.ts +166 -0
- package/extensions/mattermost/src/mattermost/monitor.ts +991 -0
- package/extensions/mattermost/src/mattermost/probe.ts +74 -0
- package/extensions/mattermost/src/mattermost/send.ts +231 -0
- package/extensions/mattermost/src/normalize.ts +46 -0
- package/extensions/mattermost/src/onboarding-helpers.ts +44 -0
- package/extensions/mattermost/src/onboarding.ts +186 -0
- package/extensions/mattermost/src/runtime.ts +14 -0
- package/extensions/mattermost/src/types.ts +52 -0
- package/extensions/memory-core/index.ts +38 -0
- package/extensions/memory-core/node_modules/.bin/clawbrah +21 -0
- package/extensions/memory-core/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/memory-core/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/memory-core/node_modules/.bin/openclaw +21 -0
- package/extensions/memory-core/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/memory-core/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/memory-core/openclaw.plugin.json +9 -0
- package/extensions/memory-core/package.json +17 -0
- package/extensions/memory-lancedb/config.ts +139 -0
- package/extensions/memory-lancedb/index.test.ts +295 -0
- package/extensions/memory-lancedb/index.ts +608 -0
- package/extensions/memory-lancedb/node_modules/.bin/arrow2csv +21 -0
- package/extensions/memory-lancedb/node_modules/.bin/arrow2csv.CMD +12 -0
- package/extensions/memory-lancedb/node_modules/.bin/arrow2csv.ps1 +41 -0
- package/extensions/memory-lancedb/node_modules/.bin/clawbrah +21 -0
- package/extensions/memory-lancedb/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/memory-lancedb/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/memory-lancedb/node_modules/.bin/openai +21 -0
- package/extensions/memory-lancedb/node_modules/.bin/openai.CMD +12 -0
- package/extensions/memory-lancedb/node_modules/.bin/openai.ps1 +41 -0
- package/extensions/memory-lancedb/node_modules/.bin/openclaw +21 -0
- package/extensions/memory-lancedb/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/memory-lancedb/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/memory-lancedb/openclaw.plugin.json +60 -0
- package/extensions/memory-lancedb/package.json +19 -0
- package/extensions/minimax-portal-auth/README.md +33 -0
- package/extensions/minimax-portal-auth/index.ts +155 -0
- package/extensions/minimax-portal-auth/node_modules/.bin/clawbrah +21 -0
- package/extensions/minimax-portal-auth/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/minimax-portal-auth/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/minimax-portal-auth/node_modules/.bin/openclaw +21 -0
- package/extensions/minimax-portal-auth/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/minimax-portal-auth/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/minimax-portal-auth/oauth.ts +247 -0
- package/extensions/minimax-portal-auth/openclaw.plugin.json +9 -0
- package/extensions/minimax-portal-auth/package.json +14 -0
- package/extensions/msteams/CHANGELOG.md +89 -0
- package/extensions/msteams/index.ts +17 -0
- package/extensions/msteams/node_modules/.bin/clawbrah +21 -0
- package/extensions/msteams/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/msteams/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/msteams/node_modules/.bin/openclaw +21 -0
- package/extensions/msteams/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/msteams/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/msteams/openclaw.plugin.json +9 -0
- package/extensions/msteams/package.json +39 -0
- package/extensions/msteams/src/attachments/download.ts +283 -0
- package/extensions/msteams/src/attachments/graph.ts +353 -0
- package/extensions/msteams/src/attachments/html.ts +90 -0
- package/extensions/msteams/src/attachments/payload.ts +22 -0
- package/extensions/msteams/src/attachments/shared.ts +291 -0
- package/extensions/msteams/src/attachments/types.ts +37 -0
- package/extensions/msteams/src/attachments.test.ts +459 -0
- package/extensions/msteams/src/attachments.ts +18 -0
- package/extensions/msteams/src/channel.directory.test.ts +48 -0
- package/extensions/msteams/src/channel.ts +459 -0
- package/extensions/msteams/src/conversation-store-fs.test.ts +88 -0
- package/extensions/msteams/src/conversation-store-fs.ts +165 -0
- package/extensions/msteams/src/conversation-store-memory.ts +47 -0
- package/extensions/msteams/src/conversation-store.ts +41 -0
- package/extensions/msteams/src/directory-live.ts +205 -0
- package/extensions/msteams/src/errors.test.ts +45 -0
- package/extensions/msteams/src/errors.ts +190 -0
- package/extensions/msteams/src/file-consent-helpers.test.ts +243 -0
- package/extensions/msteams/src/file-consent-helpers.ts +73 -0
- package/extensions/msteams/src/file-consent.ts +126 -0
- package/extensions/msteams/src/graph-chat.ts +53 -0
- package/extensions/msteams/src/graph-upload.ts +453 -0
- package/extensions/msteams/src/inbound.test.ts +66 -0
- package/extensions/msteams/src/inbound.ts +48 -0
- package/extensions/msteams/src/index.ts +4 -0
- package/extensions/msteams/src/media-helpers.test.ts +189 -0
- package/extensions/msteams/src/media-helpers.ts +86 -0
- package/extensions/msteams/src/messenger.test.ts +248 -0
- package/extensions/msteams/src/messenger.ts +495 -0
- package/extensions/msteams/src/monitor-handler/inbound-media.ts +128 -0
- package/extensions/msteams/src/monitor-handler/message-handler.ts +641 -0
- package/extensions/msteams/src/monitor-handler.ts +162 -0
- package/extensions/msteams/src/monitor-types.ts +5 -0
- package/extensions/msteams/src/monitor.ts +295 -0
- package/extensions/msteams/src/onboarding.ts +431 -0
- package/extensions/msteams/src/outbound.ts +46 -0
- package/extensions/msteams/src/pending-uploads.ts +89 -0
- package/extensions/msteams/src/policy.test.ts +209 -0
- package/extensions/msteams/src/policy.ts +273 -0
- package/extensions/msteams/src/polls-store-memory.ts +32 -0
- package/extensions/msteams/src/polls-store.test.ts +38 -0
- package/extensions/msteams/src/polls.test.ts +72 -0
- package/extensions/msteams/src/polls.ts +315 -0
- package/extensions/msteams/src/probe.test.ts +58 -0
- package/extensions/msteams/src/probe.ts +107 -0
- package/extensions/msteams/src/reply-dispatcher.ts +132 -0
- package/extensions/msteams/src/resolve-allowlist.ts +297 -0
- package/extensions/msteams/src/runtime.ts +14 -0
- package/extensions/msteams/src/sdk-types.ts +19 -0
- package/extensions/msteams/src/sdk.ts +33 -0
- package/extensions/msteams/src/send-context.ts +164 -0
- package/extensions/msteams/src/send.ts +519 -0
- package/extensions/msteams/src/sent-message-cache.test.ts +15 -0
- package/extensions/msteams/src/sent-message-cache.ts +47 -0
- package/extensions/msteams/src/storage.ts +25 -0
- package/extensions/msteams/src/store-fs.ts +83 -0
- package/extensions/msteams/src/token.ts +19 -0
- package/extensions/nextcloud-talk/index.ts +17 -0
- package/extensions/nextcloud-talk/node_modules/.bin/clawbrah +21 -0
- package/extensions/nextcloud-talk/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/nextcloud-talk/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/nextcloud-talk/node_modules/.bin/openclaw +21 -0
- package/extensions/nextcloud-talk/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/nextcloud-talk/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/nextcloud-talk/openclaw.plugin.json +9 -0
- package/extensions/nextcloud-talk/package.json +33 -0
- package/extensions/nextcloud-talk/src/accounts.ts +174 -0
- package/extensions/nextcloud-talk/src/channel.ts +409 -0
- package/extensions/nextcloud-talk/src/config-schema.ts +79 -0
- package/extensions/nextcloud-talk/src/format.ts +79 -0
- package/extensions/nextcloud-talk/src/inbound.ts +327 -0
- package/extensions/nextcloud-talk/src/monitor.ts +246 -0
- package/extensions/nextcloud-talk/src/normalize.ts +39 -0
- package/extensions/nextcloud-talk/src/onboarding.ts +343 -0
- package/extensions/nextcloud-talk/src/policy.test.ts +33 -0
- package/extensions/nextcloud-talk/src/policy.ts +180 -0
- package/extensions/nextcloud-talk/src/room-info.ts +125 -0
- package/extensions/nextcloud-talk/src/runtime.ts +14 -0
- package/extensions/nextcloud-talk/src/send.ts +215 -0
- package/extensions/nextcloud-talk/src/signature.ts +72 -0
- package/extensions/nextcloud-talk/src/types.ts +181 -0
- package/extensions/nostr/CHANGELOG.md +80 -0
- package/extensions/nostr/README.md +136 -0
- package/extensions/nostr/index.ts +68 -0
- package/extensions/nostr/node_modules/.bin/clawbrah +21 -0
- package/extensions/nostr/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/nostr/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/nostr/node_modules/.bin/openclaw +21 -0
- package/extensions/nostr/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/nostr/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/nostr/node_modules/.bin/tsc +21 -0
- package/extensions/nostr/node_modules/.bin/tsc.CMD +12 -0
- package/extensions/nostr/node_modules/.bin/tsc.ps1 +41 -0
- package/extensions/nostr/node_modules/.bin/tsserver +21 -0
- package/extensions/nostr/node_modules/.bin/tsserver.CMD +12 -0
- package/extensions/nostr/node_modules/.bin/tsserver.ps1 +41 -0
- package/extensions/nostr/openclaw.plugin.json +9 -0
- package/extensions/nostr/package.json +34 -0
- package/extensions/nostr/src/channel.test.ts +151 -0
- package/extensions/nostr/src/channel.ts +353 -0
- package/extensions/nostr/src/config-schema.ts +90 -0
- package/extensions/nostr/src/metrics.ts +478 -0
- package/extensions/nostr/src/nostr-bus.fuzz.test.ts +533 -0
- package/extensions/nostr/src/nostr-bus.integration.test.ts +448 -0
- package/extensions/nostr/src/nostr-bus.test.ts +199 -0
- package/extensions/nostr/src/nostr-bus.ts +715 -0
- package/extensions/nostr/src/nostr-profile-http.test.ts +378 -0
- package/extensions/nostr/src/nostr-profile-http.ts +519 -0
- package/extensions/nostr/src/nostr-profile-import.test.ts +119 -0
- package/extensions/nostr/src/nostr-profile-import.ts +262 -0
- package/extensions/nostr/src/nostr-profile.fuzz.test.ts +477 -0
- package/extensions/nostr/src/nostr-profile.test.ts +410 -0
- package/extensions/nostr/src/nostr-profile.ts +277 -0
- package/extensions/nostr/src/nostr-state-store.test.ts +131 -0
- package/extensions/nostr/src/nostr-state-store.ts +226 -0
- package/extensions/nostr/src/runtime.ts +14 -0
- package/extensions/nostr/src/seen-tracker.ts +303 -0
- package/extensions/nostr/src/types.test.ts +157 -0
- package/extensions/nostr/src/types.ts +101 -0
- package/extensions/nostr/test/setup.ts +5 -0
- package/extensions/open-prose/README.md +25 -0
- package/extensions/open-prose/index.ts +5 -0
- package/extensions/open-prose/node_modules/.bin/clawbrah +21 -0
- package/extensions/open-prose/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/open-prose/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/open-prose/node_modules/.bin/openclaw +21 -0
- package/extensions/open-prose/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/open-prose/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/open-prose/openclaw.plugin.json +11 -0
- package/extensions/open-prose/package.json +14 -0
- package/extensions/open-prose/skills/prose/LICENSE +21 -0
- package/extensions/open-prose/skills/prose/SKILL.md +323 -0
- package/extensions/open-prose/skills/prose/alt-borges.md +141 -0
- package/extensions/open-prose/skills/prose/alts/arabian-nights.md +358 -0
- package/extensions/open-prose/skills/prose/alts/borges.md +360 -0
- package/extensions/open-prose/skills/prose/alts/folk.md +322 -0
- package/extensions/open-prose/skills/prose/alts/homer.md +346 -0
- package/extensions/open-prose/skills/prose/alts/kafka.md +373 -0
- package/extensions/open-prose/skills/prose/compiler.md +2971 -0
- package/extensions/open-prose/skills/prose/examples/01-hello-world.prose +4 -0
- package/extensions/open-prose/skills/prose/examples/02-research-and-summarize.prose +6 -0
- package/extensions/open-prose/skills/prose/examples/03-code-review.prose +17 -0
- package/extensions/open-prose/skills/prose/examples/04-write-and-refine.prose +14 -0
- package/extensions/open-prose/skills/prose/examples/05-debug-issue.prose +20 -0
- package/extensions/open-prose/skills/prose/examples/06-explain-codebase.prose +17 -0
- package/extensions/open-prose/skills/prose/examples/07-refactor.prose +20 -0
- package/extensions/open-prose/skills/prose/examples/08-blog-post.prose +20 -0
- package/extensions/open-prose/skills/prose/examples/09-research-with-agents.prose +25 -0
- package/extensions/open-prose/skills/prose/examples/10-code-review-agents.prose +32 -0
- package/extensions/open-prose/skills/prose/examples/11-skills-and-imports.prose +27 -0
- package/extensions/open-prose/skills/prose/examples/12-secure-agent-permissions.prose +43 -0
- package/extensions/open-prose/skills/prose/examples/13-variables-and-context.prose +51 -0
- package/extensions/open-prose/skills/prose/examples/14-composition-blocks.prose +48 -0
- package/extensions/open-prose/skills/prose/examples/15-inline-sequences.prose +23 -0
- package/extensions/open-prose/skills/prose/examples/16-parallel-reviews.prose +19 -0
- package/extensions/open-prose/skills/prose/examples/17-parallel-research.prose +19 -0
- package/extensions/open-prose/skills/prose/examples/18-mixed-parallel-sequential.prose +36 -0
- package/extensions/open-prose/skills/prose/examples/19-advanced-parallel.prose +71 -0
- package/extensions/open-prose/skills/prose/examples/20-fixed-loops.prose +20 -0
- package/extensions/open-prose/skills/prose/examples/21-pipeline-operations.prose +35 -0
- package/extensions/open-prose/skills/prose/examples/22-error-handling.prose +51 -0
- package/extensions/open-prose/skills/prose/examples/23-retry-with-backoff.prose +63 -0
- package/extensions/open-prose/skills/prose/examples/24-choice-blocks.prose +86 -0
- package/extensions/open-prose/skills/prose/examples/25-conditionals.prose +114 -0
- package/extensions/open-prose/skills/prose/examples/26-parameterized-blocks.prose +100 -0
- package/extensions/open-prose/skills/prose/examples/27-string-interpolation.prose +105 -0
- package/extensions/open-prose/skills/prose/examples/28-automated-pr-review.prose +37 -0
- package/extensions/open-prose/skills/prose/examples/28-gas-town.prose +1572 -0
- package/extensions/open-prose/skills/prose/examples/29-captains-chair.prose +218 -0
- package/extensions/open-prose/skills/prose/examples/30-captains-chair-simple.prose +42 -0
- package/extensions/open-prose/skills/prose/examples/31-captains-chair-with-memory.prose +145 -0
- package/extensions/open-prose/skills/prose/examples/33-pr-review-autofix.prose +168 -0
- package/extensions/open-prose/skills/prose/examples/34-content-pipeline.prose +204 -0
- package/extensions/open-prose/skills/prose/examples/35-feature-factory.prose +296 -0
- package/extensions/open-prose/skills/prose/examples/36-bug-hunter.prose +237 -0
- package/extensions/open-prose/skills/prose/examples/37-the-forge.prose +1474 -0
- package/extensions/open-prose/skills/prose/examples/38-skill-scan.prose +455 -0
- package/extensions/open-prose/skills/prose/examples/39-architect-by-simulation.prose +277 -0
- package/extensions/open-prose/skills/prose/examples/40-rlm-self-refine.prose +32 -0
- package/extensions/open-prose/skills/prose/examples/41-rlm-divide-conquer.prose +38 -0
- package/extensions/open-prose/skills/prose/examples/42-rlm-filter-recurse.prose +46 -0
- package/extensions/open-prose/skills/prose/examples/43-rlm-pairwise.prose +50 -0
- package/extensions/open-prose/skills/prose/examples/44-run-endpoint-ux-test.prose +261 -0
- package/extensions/open-prose/skills/prose/examples/45-plugin-release.prose +159 -0
- package/extensions/open-prose/skills/prose/examples/45-run-endpoint-ux-test-with-remediation.prose +637 -0
- package/extensions/open-prose/skills/prose/examples/46-run-endpoint-ux-test-fast.prose +148 -0
- package/extensions/open-prose/skills/prose/examples/46-workflow-crystallizer.prose +225 -0
- package/extensions/open-prose/skills/prose/examples/47-language-self-improvement.prose +356 -0
- package/extensions/open-prose/skills/prose/examples/48-habit-miner.prose +445 -0
- package/extensions/open-prose/skills/prose/examples/49-prose-run-retrospective.prose +210 -0
- package/extensions/open-prose/skills/prose/examples/README.md +391 -0
- package/extensions/open-prose/skills/prose/examples/roadmap/README.md +22 -0
- package/extensions/open-prose/skills/prose/examples/roadmap/iterative-refinement.prose +20 -0
- package/extensions/open-prose/skills/prose/examples/roadmap/parallel-review.prose +18 -0
- package/extensions/open-prose/skills/prose/examples/roadmap/simple-pipeline.prose +17 -0
- package/extensions/open-prose/skills/prose/examples/roadmap/syntax/open-prose-syntax.prose +223 -0
- package/extensions/open-prose/skills/prose/guidance/antipatterns.md +951 -0
- package/extensions/open-prose/skills/prose/guidance/patterns.md +700 -0
- package/extensions/open-prose/skills/prose/guidance/system-prompt.md +180 -0
- package/extensions/open-prose/skills/prose/help.md +144 -0
- package/extensions/open-prose/skills/prose/lib/README.md +108 -0
- package/extensions/open-prose/skills/prose/lib/calibrator.prose +215 -0
- package/extensions/open-prose/skills/prose/lib/cost-analyzer.prose +174 -0
- package/extensions/open-prose/skills/prose/lib/error-forensics.prose +250 -0
- package/extensions/open-prose/skills/prose/lib/inspector.prose +196 -0
- package/extensions/open-prose/skills/prose/lib/profiler.prose +460 -0
- package/extensions/open-prose/skills/prose/lib/program-improver.prose +275 -0
- package/extensions/open-prose/skills/prose/lib/project-memory.prose +118 -0
- package/extensions/open-prose/skills/prose/lib/user-memory.prose +93 -0
- package/extensions/open-prose/skills/prose/lib/vm-improver.prose +243 -0
- package/extensions/open-prose/skills/prose/primitives/session.md +593 -0
- package/extensions/open-prose/skills/prose/prose.md +1237 -0
- package/extensions/open-prose/skills/prose/state/filesystem.md +498 -0
- package/extensions/open-prose/skills/prose/state/in-context.md +384 -0
- package/extensions/open-prose/skills/prose/state/postgres.md +880 -0
- package/extensions/open-prose/skills/prose/state/sqlite.md +574 -0
- package/extensions/qwen-portal-auth/README.md +24 -0
- package/extensions/qwen-portal-auth/index.ts +130 -0
- package/extensions/qwen-portal-auth/oauth.ts +190 -0
- package/extensions/qwen-portal-auth/openclaw.plugin.json +9 -0
- package/extensions/signal/index.ts +17 -0
- package/extensions/signal/node_modules/.bin/clawbrah +21 -0
- package/extensions/signal/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/signal/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/signal/node_modules/.bin/openclaw +21 -0
- package/extensions/signal/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/signal/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/signal/openclaw.plugin.json +9 -0
- package/extensions/signal/package.json +14 -0
- package/extensions/signal/src/channel.ts +315 -0
- package/extensions/signal/src/runtime.ts +14 -0
- package/extensions/slack/index.ts +17 -0
- package/extensions/slack/node_modules/.bin/clawbrah +21 -0
- package/extensions/slack/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/slack/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/slack/node_modules/.bin/openclaw +21 -0
- package/extensions/slack/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/slack/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/slack/openclaw.plugin.json +9 -0
- package/extensions/slack/package.json +14 -0
- package/extensions/slack/src/channel.ts +604 -0
- package/extensions/slack/src/runtime.ts +14 -0
- package/extensions/telegram/index.ts +17 -0
- package/extensions/telegram/node_modules/.bin/clawbrah +21 -0
- package/extensions/telegram/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/telegram/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/telegram/node_modules/.bin/openclaw +21 -0
- package/extensions/telegram/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/telegram/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/telegram/openclaw.plugin.json +9 -0
- package/extensions/telegram/package.json +14 -0
- package/extensions/telegram/src/channel.ts +482 -0
- package/extensions/telegram/src/runtime.ts +14 -0
- package/extensions/tlon/README.md +5 -0
- package/extensions/tlon/index.ts +17 -0
- package/extensions/tlon/node_modules/.bin/clawbrah +21 -0
- package/extensions/tlon/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/tlon/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/tlon/node_modules/.bin/openclaw +21 -0
- package/extensions/tlon/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/tlon/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/tlon/openclaw.plugin.json +9 -0
- package/extensions/tlon/package.json +33 -0
- package/extensions/tlon/src/channel.ts +392 -0
- package/extensions/tlon/src/config-schema.test.ts +31 -0
- package/extensions/tlon/src/config-schema.ts +45 -0
- package/extensions/tlon/src/monitor/discovery.ts +76 -0
- package/extensions/tlon/src/monitor/history.ts +90 -0
- package/extensions/tlon/src/monitor/index.ts +580 -0
- package/extensions/tlon/src/monitor/processed-messages.test.ts +23 -0
- package/extensions/tlon/src/monitor/processed-messages.ts +46 -0
- package/extensions/tlon/src/monitor/utils.ts +106 -0
- package/extensions/tlon/src/onboarding.ts +214 -0
- package/extensions/tlon/src/runtime.ts +14 -0
- package/extensions/tlon/src/targets.ts +89 -0
- package/extensions/tlon/src/types.ts +92 -0
- package/extensions/tlon/src/urbit/auth.ts +18 -0
- package/extensions/tlon/src/urbit/http-api.ts +38 -0
- package/extensions/tlon/src/urbit/send.test.ts +38 -0
- package/extensions/tlon/src/urbit/send.ts +131 -0
- package/extensions/tlon/src/urbit/sse-client.test.ts +40 -0
- package/extensions/tlon/src/urbit/sse-client.ts +395 -0
- package/extensions/twitch/CHANGELOG.md +51 -0
- package/extensions/twitch/README.md +89 -0
- package/extensions/twitch/index.ts +20 -0
- package/extensions/twitch/node_modules/.bin/clawbrah +21 -0
- package/extensions/twitch/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/twitch/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/twitch/node_modules/.bin/openclaw +21 -0
- package/extensions/twitch/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/twitch/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/twitch/openclaw.plugin.json +9 -0
- package/extensions/twitch/package.json +20 -0
- package/extensions/twitch/src/access-control.test.ts +489 -0
- package/extensions/twitch/src/access-control.ts +166 -0
- package/extensions/twitch/src/actions.ts +173 -0
- package/extensions/twitch/src/client-manager-registry.ts +115 -0
- package/extensions/twitch/src/config-schema.ts +84 -0
- package/extensions/twitch/src/config.test.ts +87 -0
- package/extensions/twitch/src/config.ts +116 -0
- package/extensions/twitch/src/monitor.ts +272 -0
- package/extensions/twitch/src/onboarding.test.ts +311 -0
- package/extensions/twitch/src/onboarding.ts +417 -0
- package/extensions/twitch/src/outbound.test.ts +373 -0
- package/extensions/twitch/src/outbound.ts +184 -0
- package/extensions/twitch/src/plugin.test.ts +39 -0
- package/extensions/twitch/src/plugin.ts +274 -0
- package/extensions/twitch/src/probe.test.ts +195 -0
- package/extensions/twitch/src/probe.ts +120 -0
- package/extensions/twitch/src/resolver.ts +137 -0
- package/extensions/twitch/src/runtime.ts +14 -0
- package/extensions/twitch/src/send.test.ts +289 -0
- package/extensions/twitch/src/send.ts +136 -0
- package/extensions/twitch/src/status.test.ts +270 -0
- package/extensions/twitch/src/status.ts +178 -0
- package/extensions/twitch/src/token.test.ts +171 -0
- package/extensions/twitch/src/token.ts +91 -0
- package/extensions/twitch/src/twitch-client.test.ts +589 -0
- package/extensions/twitch/src/twitch-client.ts +277 -0
- package/extensions/twitch/src/types.ts +143 -0
- package/extensions/twitch/src/utils/markdown.ts +98 -0
- package/extensions/twitch/src/utils/twitch.ts +78 -0
- package/extensions/twitch/test/setup.ts +7 -0
- package/extensions/voice-call/CHANGELOG.md +115 -0
- package/extensions/voice-call/README.md +139 -0
- package/extensions/voice-call/index.ts +493 -0
- package/extensions/voice-call/node_modules/.bin/clawbrah +21 -0
- package/extensions/voice-call/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/voice-call/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/voice-call/node_modules/.bin/openclaw +21 -0
- package/extensions/voice-call/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/voice-call/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/voice-call/openclaw.plugin.json +559 -0
- package/extensions/voice-call/package.json +19 -0
- package/extensions/voice-call/src/allowlist.ts +19 -0
- package/extensions/voice-call/src/cli.ts +279 -0
- package/extensions/voice-call/src/config.test.ts +234 -0
- package/extensions/voice-call/src/config.ts +523 -0
- package/extensions/voice-call/src/core-bridge.ts +159 -0
- package/extensions/voice-call/src/manager/context.ts +21 -0
- package/extensions/voice-call/src/manager/events.ts +188 -0
- package/extensions/voice-call/src/manager/lookup.ts +35 -0
- package/extensions/voice-call/src/manager/outbound.ts +275 -0
- package/extensions/voice-call/src/manager/state.ts +48 -0
- package/extensions/voice-call/src/manager/store.ts +91 -0
- package/extensions/voice-call/src/manager/timers.ts +89 -0
- package/extensions/voice-call/src/manager/twiml.ts +9 -0
- package/extensions/voice-call/src/manager.test.ts +224 -0
- package/extensions/voice-call/src/manager.ts +887 -0
- package/extensions/voice-call/src/media-stream.test.ts +96 -0
- package/extensions/voice-call/src/media-stream.ts +411 -0
- package/extensions/voice-call/src/providers/base.ts +67 -0
- package/extensions/voice-call/src/providers/index.ts +10 -0
- package/extensions/voice-call/src/providers/mock.ts +165 -0
- package/extensions/voice-call/src/providers/plivo.test.ts +27 -0
- package/extensions/voice-call/src/providers/plivo.ts +515 -0
- package/extensions/voice-call/src/providers/stt-openai-realtime.ts +311 -0
- package/extensions/voice-call/src/providers/telnyx.ts +371 -0
- package/extensions/voice-call/src/providers/tts-openai.ts +259 -0
- package/extensions/voice-call/src/providers/twilio/api.ts +42 -0
- package/extensions/voice-call/src/providers/twilio/webhook.ts +32 -0
- package/extensions/voice-call/src/providers/twilio.test.ts +60 -0
- package/extensions/voice-call/src/providers/twilio.ts +626 -0
- package/extensions/voice-call/src/response-generator.ts +158 -0
- package/extensions/voice-call/src/runtime.ts +212 -0
- package/extensions/voice-call/src/telephony-audio.ts +90 -0
- package/extensions/voice-call/src/telephony-tts.ts +104 -0
- package/extensions/voice-call/src/tunnel.ts +314 -0
- package/extensions/voice-call/src/types.ts +272 -0
- package/extensions/voice-call/src/utils.ts +14 -0
- package/extensions/voice-call/src/voice-mapping.ts +67 -0
- package/extensions/voice-call/src/webhook-security.test.ts +377 -0
- package/extensions/voice-call/src/webhook-security.ts +689 -0
- package/extensions/voice-call/src/webhook.ts +491 -0
- package/extensions/whatsapp/index.ts +17 -0
- package/extensions/whatsapp/node_modules/.bin/clawbrah +21 -0
- package/extensions/whatsapp/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/whatsapp/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/whatsapp/node_modules/.bin/openclaw +21 -0
- package/extensions/whatsapp/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/whatsapp/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/whatsapp/openclaw.plugin.json +9 -0
- package/extensions/whatsapp/package.json +14 -0
- package/extensions/whatsapp/src/channel.ts +508 -0
- package/extensions/whatsapp/src/runtime.ts +14 -0
- package/extensions/zalo/CHANGELOG.md +95 -0
- package/extensions/zalo/README.md +50 -0
- package/extensions/zalo/index.ts +19 -0
- package/extensions/zalo/node_modules/.bin/clawbrah +21 -0
- package/extensions/zalo/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/zalo/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/zalo/node_modules/.bin/openclaw +21 -0
- package/extensions/zalo/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/zalo/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/zalo/openclaw.plugin.json +9 -0
- package/extensions/zalo/package.json +36 -0
- package/extensions/zalo/src/accounts.ts +80 -0
- package/extensions/zalo/src/actions.ts +67 -0
- package/extensions/zalo/src/api.ts +208 -0
- package/extensions/zalo/src/channel.directory.test.ts +43 -0
- package/extensions/zalo/src/channel.ts +414 -0
- package/extensions/zalo/src/config-schema.ts +25 -0
- package/extensions/zalo/src/monitor.ts +764 -0
- package/extensions/zalo/src/monitor.webhook.test.ts +73 -0
- package/extensions/zalo/src/onboarding.ts +401 -0
- package/extensions/zalo/src/probe.ts +46 -0
- package/extensions/zalo/src/proxy.ts +21 -0
- package/extensions/zalo/src/runtime.ts +14 -0
- package/extensions/zalo/src/send.ts +124 -0
- package/extensions/zalo/src/status-issues.ts +53 -0
- package/extensions/zalo/src/token.ts +63 -0
- package/extensions/zalo/src/types.ts +44 -0
- package/extensions/zalouser/CHANGELOG.md +67 -0
- package/extensions/zalouser/README.md +225 -0
- package/extensions/zalouser/index.ts +31 -0
- package/extensions/zalouser/node_modules/.bin/clawbrah +21 -0
- package/extensions/zalouser/node_modules/.bin/clawbrah.CMD +12 -0
- package/extensions/zalouser/node_modules/.bin/clawbrah.ps1 +41 -0
- package/extensions/zalouser/node_modules/.bin/openclaw +21 -0
- package/extensions/zalouser/node_modules/.bin/openclaw.CMD +12 -0
- package/extensions/zalouser/node_modules/.bin/openclaw.ps1 +41 -0
- package/extensions/zalouser/openclaw.plugin.json +9 -0
- package/extensions/zalouser/package.json +36 -0
- package/extensions/zalouser/src/accounts.ts +135 -0
- package/extensions/zalouser/src/channel.test.ts +18 -0
- package/extensions/zalouser/src/channel.ts +686 -0
- package/extensions/zalouser/src/config-schema.ts +28 -0
- package/extensions/zalouser/src/monitor.ts +601 -0
- package/extensions/zalouser/src/onboarding.ts +504 -0
- package/extensions/zalouser/src/probe.ts +28 -0
- package/extensions/zalouser/src/runtime.ts +14 -0
- package/extensions/zalouser/src/send.ts +160 -0
- package/extensions/zalouser/src/status-issues.test.ts +57 -0
- package/extensions/zalouser/src/status-issues.ts +89 -0
- package/extensions/zalouser/src/tool.ts +164 -0
- package/extensions/zalouser/src/types.ts +110 -0
- package/extensions/zalouser/src/zca.ts +202 -0
- package/openclaw.mjs +14 -0
- package/package.json +228 -0
- package/skills/1password/SKILL.md +70 -0
- package/skills/1password/references/cli-examples.md +29 -0
- package/skills/1password/references/get-started.md +17 -0
- package/skills/apple-notes/SKILL.md +77 -0
- package/skills/apple-reminders/SKILL.md +96 -0
- package/skills/bear-notes/SKILL.md +107 -0
- package/skills/bird/SKILL.md +224 -0
- package/skills/blogwatcher/SKILL.md +69 -0
- package/skills/blucli/SKILL.md +47 -0
- package/skills/bluebubbles/SKILL.md +131 -0
- package/skills/camsnap/SKILL.md +45 -0
- package/skills/canvas/SKILL.md +198 -0
- package/skills/clawhub/SKILL.md +77 -0
- package/skills/coding-agent/SKILL.md +284 -0
- package/skills/discord/SKILL.md +578 -0
- package/skills/eightctl/SKILL.md +50 -0
- package/skills/food-order/SKILL.md +48 -0
- package/skills/gemini/SKILL.md +43 -0
- package/skills/gifgrep/SKILL.md +79 -0
- package/skills/github/SKILL.md +77 -0
- package/skills/gog/SKILL.md +116 -0
- package/skills/goplaces/SKILL.md +52 -0
- package/skills/healthcheck/SKILL.md +245 -0
- package/skills/himalaya/SKILL.md +257 -0
- package/skills/himalaya/references/configuration.md +184 -0
- package/skills/himalaya/references/message-composition.md +199 -0
- package/skills/imsg/SKILL.md +74 -0
- package/skills/local-places/SERVER_README.md +101 -0
- package/skills/local-places/SKILL.md +102 -0
- package/skills/local-places/pyproject.toml +21 -0
- package/skills/local-places/src/local_places/__init__.py +2 -0
- package/skills/local-places/src/local_places/google_places.py +314 -0
- package/skills/local-places/src/local_places/main.py +65 -0
- package/skills/local-places/src/local_places/schemas.py +107 -0
- package/skills/mcporter/SKILL.md +61 -0
- package/skills/model-usage/SKILL.md +69 -0
- package/skills/model-usage/references/codexbar-cli.md +33 -0
- package/skills/model-usage/scripts/model_usage.py +310 -0
- package/skills/nano-banana-pro/SKILL.md +58 -0
- package/skills/nano-banana-pro/scripts/generate_image.py +184 -0
- package/skills/nano-pdf/SKILL.md +38 -0
- package/skills/notion/SKILL.md +172 -0
- package/skills/obsidian/SKILL.md +81 -0
- package/skills/openai-image-gen/SKILL.md +89 -0
- package/skills/openai-image-gen/scripts/gen.py +240 -0
- package/skills/openai-whisper/SKILL.md +38 -0
- package/skills/openai-whisper-api/SKILL.md +52 -0
- package/skills/openai-whisper-api/scripts/transcribe.sh +85 -0
- package/skills/openhue/SKILL.md +51 -0
- package/skills/oracle/SKILL.md +125 -0
- package/skills/ordercli/SKILL.md +78 -0
- package/skills/peekaboo/SKILL.md +190 -0
- package/skills/sag/SKILL.md +87 -0
- package/skills/session-logs/SKILL.md +115 -0
- package/skills/sherpa-onnx-tts/SKILL.md +103 -0
- package/skills/sherpa-onnx-tts/bin/sherpa-onnx-tts +178 -0
- package/skills/skill-creator/SKILL.md +370 -0
- package/skills/skill-creator/license.txt +202 -0
- package/skills/skill-creator/scripts/init_skill.py +378 -0
- package/skills/skill-creator/scripts/package_skill.py +111 -0
- package/skills/skill-creator/scripts/quick_validate.py +101 -0
- package/skills/slack/SKILL.md +144 -0
- package/skills/songsee/SKILL.md +49 -0
- package/skills/sonoscli/SKILL.md +46 -0
- package/skills/spotify-player/SKILL.md +64 -0
- package/skills/summarize/SKILL.md +87 -0
- package/skills/things-mac/SKILL.md +86 -0
- package/skills/tmux/SKILL.md +135 -0
- package/skills/tmux/scripts/find-sessions.sh +112 -0
- package/skills/tmux/scripts/wait-for-text.sh +83 -0
- package/skills/trello/SKILL.md +95 -0
- package/skills/video-frames/SKILL.md +46 -0
- package/skills/video-frames/scripts/frame.sh +81 -0
- package/skills/voice-call/SKILL.md +45 -0
- package/skills/wacli/SKILL.md +72 -0
- package/skills/weather/SKILL.md +54 -0
|
@@ -0,0 +1,2410 @@
|
|
|
1
|
+
import { a as parseBooleanValue } from "./entry.js";
|
|
2
|
+
import { d as resolveConfigDir } from "./utils-BQRXRRrc.js";
|
|
3
|
+
import { n as runExec } from "./exec-4puFQDLB.js";
|
|
4
|
+
import { c as writeConfigFile, i as loadConfig } from "./config-Ddbeba_Z.js";
|
|
5
|
+
import { c as allocateColor, d as isValidProfileName, f as deriveDefaultBrowserCdpPortRange, i as parseHttpUrl, l as getUsedColors, n as movePathToTrash, o as resolveProfile, r as getPwAiModule$1, s as allocateCdpPort, u as getUsedPorts } from "./server-context-DGn4KtxY.js";
|
|
6
|
+
import { D as DEFAULT_BROWSER_DEFAULT_PROFILE_NAME, E as DEFAULT_AI_SNAPSHOT_MAX_CHARS, T as DEFAULT_AI_SNAPSHOT_EFFICIENT_MAX_CHARS, c as resolveOpenClawUserDataDir, h as captureScreenshot, u as resolveBrowserExecutableForPlatform, w as DEFAULT_AI_SNAPSHOT_EFFICIENT_DEPTH, y as snapshotAria } from "./errors-HrPt6FJ9.js";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import os from "node:os";
|
|
9
|
+
import fs from "node:fs";
|
|
10
|
+
import fs$1 from "node:fs/promises";
|
|
11
|
+
import crypto from "node:crypto";
|
|
12
|
+
import { fileTypeFromBuffer } from "file-type";
|
|
13
|
+
import { lookup } from "node:dns";
|
|
14
|
+
import { lookup as lookup$1 } from "node:dns/promises";
|
|
15
|
+
import { Agent } from "undici";
|
|
16
|
+
import { pipeline } from "node:stream/promises";
|
|
17
|
+
|
|
18
|
+
//#region src/media/constants.ts
|
|
19
|
+
const MAX_IMAGE_BYTES = 6 * 1024 * 1024;
|
|
20
|
+
const MAX_AUDIO_BYTES = 16 * 1024 * 1024;
|
|
21
|
+
const MAX_VIDEO_BYTES = 16 * 1024 * 1024;
|
|
22
|
+
const MAX_DOCUMENT_BYTES = 100 * 1024 * 1024;
|
|
23
|
+
function mediaKindFromMime(mime) {
|
|
24
|
+
if (!mime) return "unknown";
|
|
25
|
+
if (mime.startsWith("image/")) return "image";
|
|
26
|
+
if (mime.startsWith("audio/")) return "audio";
|
|
27
|
+
if (mime.startsWith("video/")) return "video";
|
|
28
|
+
if (mime === "application/pdf") return "document";
|
|
29
|
+
if (mime.startsWith("application/")) return "document";
|
|
30
|
+
return "unknown";
|
|
31
|
+
}
|
|
32
|
+
function maxBytesForKind(kind) {
|
|
33
|
+
switch (kind) {
|
|
34
|
+
case "image": return MAX_IMAGE_BYTES;
|
|
35
|
+
case "audio": return MAX_AUDIO_BYTES;
|
|
36
|
+
case "video": return MAX_VIDEO_BYTES;
|
|
37
|
+
case "document": return MAX_DOCUMENT_BYTES;
|
|
38
|
+
default: return MAX_DOCUMENT_BYTES;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/media/mime.ts
|
|
44
|
+
const EXT_BY_MIME = {
|
|
45
|
+
"image/heic": ".heic",
|
|
46
|
+
"image/heif": ".heif",
|
|
47
|
+
"image/jpeg": ".jpg",
|
|
48
|
+
"image/png": ".png",
|
|
49
|
+
"image/webp": ".webp",
|
|
50
|
+
"image/gif": ".gif",
|
|
51
|
+
"audio/ogg": ".ogg",
|
|
52
|
+
"audio/mpeg": ".mp3",
|
|
53
|
+
"audio/x-m4a": ".m4a",
|
|
54
|
+
"audio/mp4": ".m4a",
|
|
55
|
+
"video/mp4": ".mp4",
|
|
56
|
+
"video/quicktime": ".mov",
|
|
57
|
+
"application/pdf": ".pdf",
|
|
58
|
+
"application/json": ".json",
|
|
59
|
+
"application/zip": ".zip",
|
|
60
|
+
"application/gzip": ".gz",
|
|
61
|
+
"application/x-tar": ".tar",
|
|
62
|
+
"application/x-7z-compressed": ".7z",
|
|
63
|
+
"application/vnd.rar": ".rar",
|
|
64
|
+
"application/msword": ".doc",
|
|
65
|
+
"application/vnd.ms-excel": ".xls",
|
|
66
|
+
"application/vnd.ms-powerpoint": ".ppt",
|
|
67
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": ".docx",
|
|
68
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": ".xlsx",
|
|
69
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation": ".pptx",
|
|
70
|
+
"text/csv": ".csv",
|
|
71
|
+
"text/plain": ".txt",
|
|
72
|
+
"text/markdown": ".md"
|
|
73
|
+
};
|
|
74
|
+
const MIME_BY_EXT = {
|
|
75
|
+
...Object.fromEntries(Object.entries(EXT_BY_MIME).map(([mime, ext]) => [ext, mime])),
|
|
76
|
+
".jpeg": "image/jpeg"
|
|
77
|
+
};
|
|
78
|
+
const AUDIO_FILE_EXTENSIONS = new Set([
|
|
79
|
+
".aac",
|
|
80
|
+
".flac",
|
|
81
|
+
".m4a",
|
|
82
|
+
".mp3",
|
|
83
|
+
".oga",
|
|
84
|
+
".ogg",
|
|
85
|
+
".opus",
|
|
86
|
+
".wav"
|
|
87
|
+
]);
|
|
88
|
+
function normalizeHeaderMime(mime) {
|
|
89
|
+
if (!mime) return;
|
|
90
|
+
return mime.split(";")[0]?.trim().toLowerCase() || void 0;
|
|
91
|
+
}
|
|
92
|
+
async function sniffMime(buffer) {
|
|
93
|
+
if (!buffer) return;
|
|
94
|
+
try {
|
|
95
|
+
return (await fileTypeFromBuffer(buffer))?.mime ?? void 0;
|
|
96
|
+
} catch {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function getFileExtension(filePath) {
|
|
101
|
+
if (!filePath) return;
|
|
102
|
+
try {
|
|
103
|
+
if (/^https?:\/\//i.test(filePath)) {
|
|
104
|
+
const url = new URL(filePath);
|
|
105
|
+
return path.extname(url.pathname).toLowerCase() || void 0;
|
|
106
|
+
}
|
|
107
|
+
} catch {}
|
|
108
|
+
return path.extname(filePath).toLowerCase() || void 0;
|
|
109
|
+
}
|
|
110
|
+
function isAudioFileName(fileName) {
|
|
111
|
+
const ext = getFileExtension(fileName);
|
|
112
|
+
if (!ext) return false;
|
|
113
|
+
return AUDIO_FILE_EXTENSIONS.has(ext);
|
|
114
|
+
}
|
|
115
|
+
function detectMime(opts) {
|
|
116
|
+
return detectMimeImpl(opts);
|
|
117
|
+
}
|
|
118
|
+
function isGenericMime(mime) {
|
|
119
|
+
if (!mime) return true;
|
|
120
|
+
const m = mime.toLowerCase();
|
|
121
|
+
return m === "application/octet-stream" || m === "application/zip";
|
|
122
|
+
}
|
|
123
|
+
async function detectMimeImpl(opts) {
|
|
124
|
+
const ext = getFileExtension(opts.filePath);
|
|
125
|
+
const extMime = ext ? MIME_BY_EXT[ext] : void 0;
|
|
126
|
+
const headerMime = normalizeHeaderMime(opts.headerMime);
|
|
127
|
+
const sniffed = await sniffMime(opts.buffer);
|
|
128
|
+
if (sniffed && (!isGenericMime(sniffed) || !extMime)) return sniffed;
|
|
129
|
+
if (extMime) return extMime;
|
|
130
|
+
if (headerMime && !isGenericMime(headerMime)) return headerMime;
|
|
131
|
+
if (sniffed) return sniffed;
|
|
132
|
+
if (headerMime) return headerMime;
|
|
133
|
+
}
|
|
134
|
+
function extensionForMime(mime) {
|
|
135
|
+
if (!mime) return;
|
|
136
|
+
return EXT_BY_MIME[mime.toLowerCase()];
|
|
137
|
+
}
|
|
138
|
+
function isGifMedia(opts) {
|
|
139
|
+
if (opts.contentType?.toLowerCase() === "image/gif") return true;
|
|
140
|
+
return getFileExtension(opts.fileName) === ".gif";
|
|
141
|
+
}
|
|
142
|
+
function imageMimeFromFormat(format) {
|
|
143
|
+
if (!format) return;
|
|
144
|
+
switch (format.toLowerCase()) {
|
|
145
|
+
case "jpg":
|
|
146
|
+
case "jpeg": return "image/jpeg";
|
|
147
|
+
case "heic": return "image/heic";
|
|
148
|
+
case "heif": return "image/heif";
|
|
149
|
+
case "png": return "image/png";
|
|
150
|
+
case "webp": return "image/webp";
|
|
151
|
+
case "gif": return "image/gif";
|
|
152
|
+
default: return;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function kindFromMime(mime) {
|
|
156
|
+
return mediaKindFromMime(mime);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region src/media/image-ops.ts
|
|
161
|
+
function isBun() {
|
|
162
|
+
return typeof process.versions.bun === "string";
|
|
163
|
+
}
|
|
164
|
+
function prefersSips() {
|
|
165
|
+
return process.env.OPENCLAW_IMAGE_BACKEND === "sips" || process.env.OPENCLAW_IMAGE_BACKEND !== "sharp" && isBun() && process.platform === "darwin";
|
|
166
|
+
}
|
|
167
|
+
async function loadSharp() {
|
|
168
|
+
const mod = await import("sharp");
|
|
169
|
+
const sharp = mod.default ?? mod;
|
|
170
|
+
return (buffer) => sharp(buffer, { failOnError: false });
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Reads EXIF orientation from JPEG buffer.
|
|
174
|
+
* Returns orientation value 1-8, or null if not found/not JPEG.
|
|
175
|
+
*
|
|
176
|
+
* EXIF orientation values:
|
|
177
|
+
* 1 = Normal, 2 = Flip H, 3 = Rotate 180, 4 = Flip V,
|
|
178
|
+
* 5 = Rotate 270 CW + Flip H, 6 = Rotate 90 CW, 7 = Rotate 90 CW + Flip H, 8 = Rotate 270 CW
|
|
179
|
+
*/
|
|
180
|
+
function readJpegExifOrientation(buffer) {
|
|
181
|
+
if (buffer.length < 2 || buffer[0] !== 255 || buffer[1] !== 216) return null;
|
|
182
|
+
let offset = 2;
|
|
183
|
+
while (offset < buffer.length - 4) {
|
|
184
|
+
if (buffer[offset] !== 255) {
|
|
185
|
+
offset++;
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
const marker = buffer[offset + 1];
|
|
189
|
+
if (marker === 255) {
|
|
190
|
+
offset++;
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
if (marker === 225) {
|
|
194
|
+
const exifStart = offset + 4;
|
|
195
|
+
if (buffer.length > exifStart + 6 && buffer.toString("ascii", exifStart, exifStart + 4) === "Exif" && buffer[exifStart + 4] === 0 && buffer[exifStart + 5] === 0) {
|
|
196
|
+
const tiffStart = exifStart + 6;
|
|
197
|
+
if (buffer.length < tiffStart + 8) return null;
|
|
198
|
+
const isLittleEndian = buffer.toString("ascii", tiffStart, tiffStart + 2) === "II";
|
|
199
|
+
const readU16 = (pos) => isLittleEndian ? buffer.readUInt16LE(pos) : buffer.readUInt16BE(pos);
|
|
200
|
+
const readU32 = (pos) => isLittleEndian ? buffer.readUInt32LE(pos) : buffer.readUInt32BE(pos);
|
|
201
|
+
const ifd0Start = tiffStart + readU32(tiffStart + 4);
|
|
202
|
+
if (buffer.length < ifd0Start + 2) return null;
|
|
203
|
+
const numEntries = readU16(ifd0Start);
|
|
204
|
+
for (let i = 0; i < numEntries; i++) {
|
|
205
|
+
const entryOffset = ifd0Start + 2 + i * 12;
|
|
206
|
+
if (buffer.length < entryOffset + 12) break;
|
|
207
|
+
if (readU16(entryOffset) === 274) {
|
|
208
|
+
const value = readU16(entryOffset + 8);
|
|
209
|
+
return value >= 1 && value <= 8 ? value : null;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
if (marker >= 224 && marker <= 239) {
|
|
216
|
+
const segmentLength = buffer.readUInt16BE(offset + 2);
|
|
217
|
+
offset += 2 + segmentLength;
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
if (marker === 192 || marker === 218) break;
|
|
221
|
+
offset++;
|
|
222
|
+
}
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
async function withTempDir(fn) {
|
|
226
|
+
const dir = await fs$1.mkdtemp(path.join(os.tmpdir(), "openclaw-img-"));
|
|
227
|
+
try {
|
|
228
|
+
return await fn(dir);
|
|
229
|
+
} finally {
|
|
230
|
+
await fs$1.rm(dir, {
|
|
231
|
+
recursive: true,
|
|
232
|
+
force: true
|
|
233
|
+
}).catch(() => {});
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
async function sipsMetadataFromBuffer(buffer) {
|
|
237
|
+
return await withTempDir(async (dir) => {
|
|
238
|
+
const input = path.join(dir, "in.img");
|
|
239
|
+
await fs$1.writeFile(input, buffer);
|
|
240
|
+
const { stdout } = await runExec("/usr/bin/sips", [
|
|
241
|
+
"-g",
|
|
242
|
+
"pixelWidth",
|
|
243
|
+
"-g",
|
|
244
|
+
"pixelHeight",
|
|
245
|
+
input
|
|
246
|
+
], {
|
|
247
|
+
timeoutMs: 1e4,
|
|
248
|
+
maxBuffer: 512 * 1024
|
|
249
|
+
});
|
|
250
|
+
const w = stdout.match(/pixelWidth:\s*([0-9]+)/);
|
|
251
|
+
const h = stdout.match(/pixelHeight:\s*([0-9]+)/);
|
|
252
|
+
if (!w?.[1] || !h?.[1]) return null;
|
|
253
|
+
const width = Number.parseInt(w[1], 10);
|
|
254
|
+
const height = Number.parseInt(h[1], 10);
|
|
255
|
+
if (!Number.isFinite(width) || !Number.isFinite(height)) return null;
|
|
256
|
+
if (width <= 0 || height <= 0) return null;
|
|
257
|
+
return {
|
|
258
|
+
width,
|
|
259
|
+
height
|
|
260
|
+
};
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
async function sipsResizeToJpeg(params) {
|
|
264
|
+
return await withTempDir(async (dir) => {
|
|
265
|
+
const input = path.join(dir, "in.img");
|
|
266
|
+
const output = path.join(dir, "out.jpg");
|
|
267
|
+
await fs$1.writeFile(input, params.buffer);
|
|
268
|
+
await runExec("/usr/bin/sips", [
|
|
269
|
+
"-Z",
|
|
270
|
+
String(Math.max(1, Math.round(params.maxSide))),
|
|
271
|
+
"-s",
|
|
272
|
+
"format",
|
|
273
|
+
"jpeg",
|
|
274
|
+
"-s",
|
|
275
|
+
"formatOptions",
|
|
276
|
+
String(Math.max(1, Math.min(100, Math.round(params.quality)))),
|
|
277
|
+
input,
|
|
278
|
+
"--out",
|
|
279
|
+
output
|
|
280
|
+
], {
|
|
281
|
+
timeoutMs: 2e4,
|
|
282
|
+
maxBuffer: 1024 * 1024
|
|
283
|
+
});
|
|
284
|
+
return await fs$1.readFile(output);
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
async function sipsConvertToJpeg(buffer) {
|
|
288
|
+
return await withTempDir(async (dir) => {
|
|
289
|
+
const input = path.join(dir, "in.heic");
|
|
290
|
+
const output = path.join(dir, "out.jpg");
|
|
291
|
+
await fs$1.writeFile(input, buffer);
|
|
292
|
+
await runExec("/usr/bin/sips", [
|
|
293
|
+
"-s",
|
|
294
|
+
"format",
|
|
295
|
+
"jpeg",
|
|
296
|
+
input,
|
|
297
|
+
"--out",
|
|
298
|
+
output
|
|
299
|
+
], {
|
|
300
|
+
timeoutMs: 2e4,
|
|
301
|
+
maxBuffer: 1024 * 1024
|
|
302
|
+
});
|
|
303
|
+
return await fs$1.readFile(output);
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
async function getImageMetadata(buffer) {
|
|
307
|
+
if (prefersSips()) return await sipsMetadataFromBuffer(buffer).catch(() => null);
|
|
308
|
+
try {
|
|
309
|
+
const meta = await (await loadSharp())(buffer).metadata();
|
|
310
|
+
const width = Number(meta.width ?? 0);
|
|
311
|
+
const height = Number(meta.height ?? 0);
|
|
312
|
+
if (!Number.isFinite(width) || !Number.isFinite(height)) return null;
|
|
313
|
+
if (width <= 0 || height <= 0) return null;
|
|
314
|
+
return {
|
|
315
|
+
width,
|
|
316
|
+
height
|
|
317
|
+
};
|
|
318
|
+
} catch {
|
|
319
|
+
return null;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Applies rotation/flip to image buffer using sips based on EXIF orientation.
|
|
324
|
+
*/
|
|
325
|
+
async function sipsApplyOrientation(buffer, orientation) {
|
|
326
|
+
const ops = [];
|
|
327
|
+
switch (orientation) {
|
|
328
|
+
case 2:
|
|
329
|
+
ops.push("-f", "horizontal");
|
|
330
|
+
break;
|
|
331
|
+
case 3:
|
|
332
|
+
ops.push("-r", "180");
|
|
333
|
+
break;
|
|
334
|
+
case 4:
|
|
335
|
+
ops.push("-f", "vertical");
|
|
336
|
+
break;
|
|
337
|
+
case 5:
|
|
338
|
+
ops.push("-r", "270", "-f", "horizontal");
|
|
339
|
+
break;
|
|
340
|
+
case 6:
|
|
341
|
+
ops.push("-r", "90");
|
|
342
|
+
break;
|
|
343
|
+
case 7:
|
|
344
|
+
ops.push("-r", "90", "-f", "horizontal");
|
|
345
|
+
break;
|
|
346
|
+
case 8:
|
|
347
|
+
ops.push("-r", "270");
|
|
348
|
+
break;
|
|
349
|
+
default: return buffer;
|
|
350
|
+
}
|
|
351
|
+
return await withTempDir(async (dir) => {
|
|
352
|
+
const input = path.join(dir, "in.jpg");
|
|
353
|
+
const output = path.join(dir, "out.jpg");
|
|
354
|
+
await fs$1.writeFile(input, buffer);
|
|
355
|
+
await runExec("/usr/bin/sips", [
|
|
356
|
+
...ops,
|
|
357
|
+
input,
|
|
358
|
+
"--out",
|
|
359
|
+
output
|
|
360
|
+
], {
|
|
361
|
+
timeoutMs: 2e4,
|
|
362
|
+
maxBuffer: 1024 * 1024
|
|
363
|
+
});
|
|
364
|
+
return await fs$1.readFile(output);
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
async function resizeToJpeg(params) {
|
|
368
|
+
if (prefersSips()) {
|
|
369
|
+
const normalized = await normalizeExifOrientationSips(params.buffer);
|
|
370
|
+
if (params.withoutEnlargement !== false) {
|
|
371
|
+
const meta = await getImageMetadata(normalized);
|
|
372
|
+
if (meta) {
|
|
373
|
+
const maxDim = Math.max(meta.width, meta.height);
|
|
374
|
+
if (maxDim > 0 && maxDim <= params.maxSide) return await sipsResizeToJpeg({
|
|
375
|
+
buffer: normalized,
|
|
376
|
+
maxSide: maxDim,
|
|
377
|
+
quality: params.quality
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
return await sipsResizeToJpeg({
|
|
382
|
+
buffer: normalized,
|
|
383
|
+
maxSide: params.maxSide,
|
|
384
|
+
quality: params.quality
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
return await (await loadSharp())(params.buffer).rotate().resize({
|
|
388
|
+
width: params.maxSide,
|
|
389
|
+
height: params.maxSide,
|
|
390
|
+
fit: "inside",
|
|
391
|
+
withoutEnlargement: params.withoutEnlargement !== false
|
|
392
|
+
}).jpeg({
|
|
393
|
+
quality: params.quality,
|
|
394
|
+
mozjpeg: true
|
|
395
|
+
}).toBuffer();
|
|
396
|
+
}
|
|
397
|
+
async function convertHeicToJpeg(buffer) {
|
|
398
|
+
if (prefersSips()) return await sipsConvertToJpeg(buffer);
|
|
399
|
+
return await (await loadSharp())(buffer).jpeg({
|
|
400
|
+
quality: 90,
|
|
401
|
+
mozjpeg: true
|
|
402
|
+
}).toBuffer();
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Checks if an image has an alpha channel (transparency).
|
|
406
|
+
* Returns true if the image has alpha, false otherwise.
|
|
407
|
+
*/
|
|
408
|
+
async function hasAlphaChannel(buffer) {
|
|
409
|
+
try {
|
|
410
|
+
const meta = await (await loadSharp())(buffer).metadata();
|
|
411
|
+
return meta.hasAlpha || meta.channels === 4;
|
|
412
|
+
} catch {
|
|
413
|
+
return false;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Resizes an image to PNG format, preserving alpha channel (transparency).
|
|
418
|
+
* Falls back to sharp only (no sips fallback for PNG with alpha).
|
|
419
|
+
*/
|
|
420
|
+
async function resizeToPng(params) {
|
|
421
|
+
const sharp = await loadSharp();
|
|
422
|
+
const compressionLevel = params.compressionLevel ?? 6;
|
|
423
|
+
return await sharp(params.buffer).rotate().resize({
|
|
424
|
+
width: params.maxSide,
|
|
425
|
+
height: params.maxSide,
|
|
426
|
+
fit: "inside",
|
|
427
|
+
withoutEnlargement: params.withoutEnlargement !== false
|
|
428
|
+
}).png({ compressionLevel }).toBuffer();
|
|
429
|
+
}
|
|
430
|
+
async function optimizeImageToPng(buffer, maxBytes) {
|
|
431
|
+
const sides = [
|
|
432
|
+
2048,
|
|
433
|
+
1536,
|
|
434
|
+
1280,
|
|
435
|
+
1024,
|
|
436
|
+
800
|
|
437
|
+
];
|
|
438
|
+
const compressionLevels = [
|
|
439
|
+
6,
|
|
440
|
+
7,
|
|
441
|
+
8,
|
|
442
|
+
9
|
|
443
|
+
];
|
|
444
|
+
let smallest = null;
|
|
445
|
+
for (const side of sides) for (const compressionLevel of compressionLevels) try {
|
|
446
|
+
const out = await resizeToPng({
|
|
447
|
+
buffer,
|
|
448
|
+
maxSide: side,
|
|
449
|
+
compressionLevel,
|
|
450
|
+
withoutEnlargement: true
|
|
451
|
+
});
|
|
452
|
+
const size = out.length;
|
|
453
|
+
if (!smallest || size < smallest.size) smallest = {
|
|
454
|
+
buffer: out,
|
|
455
|
+
size,
|
|
456
|
+
resizeSide: side,
|
|
457
|
+
compressionLevel
|
|
458
|
+
};
|
|
459
|
+
if (size <= maxBytes) return {
|
|
460
|
+
buffer: out,
|
|
461
|
+
optimizedSize: size,
|
|
462
|
+
resizeSide: side,
|
|
463
|
+
compressionLevel
|
|
464
|
+
};
|
|
465
|
+
} catch {}
|
|
466
|
+
if (smallest) return {
|
|
467
|
+
buffer: smallest.buffer,
|
|
468
|
+
optimizedSize: smallest.size,
|
|
469
|
+
resizeSide: smallest.resizeSide,
|
|
470
|
+
compressionLevel: smallest.compressionLevel
|
|
471
|
+
};
|
|
472
|
+
throw new Error("Failed to optimize PNG image");
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* Internal sips-only EXIF normalization (no sharp fallback).
|
|
476
|
+
* Used by resizeToJpeg to normalize before sips resize.
|
|
477
|
+
*/
|
|
478
|
+
async function normalizeExifOrientationSips(buffer) {
|
|
479
|
+
try {
|
|
480
|
+
const orientation = readJpegExifOrientation(buffer);
|
|
481
|
+
if (!orientation || orientation === 1) return buffer;
|
|
482
|
+
return await sipsApplyOrientation(buffer, orientation);
|
|
483
|
+
} catch {
|
|
484
|
+
return buffer;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
//#endregion
|
|
489
|
+
//#region src/infra/net/ssrf.ts
|
|
490
|
+
var SsrFBlockedError = class extends Error {
|
|
491
|
+
constructor(message) {
|
|
492
|
+
super(message);
|
|
493
|
+
this.name = "SsrFBlockedError";
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
const PRIVATE_IPV6_PREFIXES = [
|
|
497
|
+
"fe80:",
|
|
498
|
+
"fec0:",
|
|
499
|
+
"fc",
|
|
500
|
+
"fd"
|
|
501
|
+
];
|
|
502
|
+
const BLOCKED_HOSTNAMES = new Set(["localhost", "metadata.google.internal"]);
|
|
503
|
+
function normalizeHostname(hostname) {
|
|
504
|
+
const normalized = hostname.trim().toLowerCase().replace(/\.$/, "");
|
|
505
|
+
if (normalized.startsWith("[") && normalized.endsWith("]")) return normalized.slice(1, -1);
|
|
506
|
+
return normalized;
|
|
507
|
+
}
|
|
508
|
+
function normalizeHostnameSet(values) {
|
|
509
|
+
if (!values || values.length === 0) return /* @__PURE__ */ new Set();
|
|
510
|
+
return new Set(values.map((value) => normalizeHostname(value)).filter(Boolean));
|
|
511
|
+
}
|
|
512
|
+
function parseIpv4(address) {
|
|
513
|
+
const parts = address.split(".");
|
|
514
|
+
if (parts.length !== 4) return null;
|
|
515
|
+
const numbers = parts.map((part) => Number.parseInt(part, 10));
|
|
516
|
+
if (numbers.some((value) => Number.isNaN(value) || value < 0 || value > 255)) return null;
|
|
517
|
+
return numbers;
|
|
518
|
+
}
|
|
519
|
+
function parseIpv4FromMappedIpv6(mapped) {
|
|
520
|
+
if (mapped.includes(".")) return parseIpv4(mapped);
|
|
521
|
+
const parts = mapped.split(":").filter(Boolean);
|
|
522
|
+
if (parts.length === 1) {
|
|
523
|
+
const value = Number.parseInt(parts[0], 16);
|
|
524
|
+
if (Number.isNaN(value) || value < 0 || value > 4294967295) return null;
|
|
525
|
+
return [
|
|
526
|
+
value >>> 24 & 255,
|
|
527
|
+
value >>> 16 & 255,
|
|
528
|
+
value >>> 8 & 255,
|
|
529
|
+
value & 255
|
|
530
|
+
];
|
|
531
|
+
}
|
|
532
|
+
if (parts.length !== 2) return null;
|
|
533
|
+
const high = Number.parseInt(parts[0], 16);
|
|
534
|
+
const low = Number.parseInt(parts[1], 16);
|
|
535
|
+
if (Number.isNaN(high) || Number.isNaN(low) || high < 0 || low < 0 || high > 65535 || low > 65535) return null;
|
|
536
|
+
const value = (high << 16) + low;
|
|
537
|
+
return [
|
|
538
|
+
value >>> 24 & 255,
|
|
539
|
+
value >>> 16 & 255,
|
|
540
|
+
value >>> 8 & 255,
|
|
541
|
+
value & 255
|
|
542
|
+
];
|
|
543
|
+
}
|
|
544
|
+
function isPrivateIpv4(parts) {
|
|
545
|
+
const [octet1, octet2] = parts;
|
|
546
|
+
if (octet1 === 0) return true;
|
|
547
|
+
if (octet1 === 10) return true;
|
|
548
|
+
if (octet1 === 127) return true;
|
|
549
|
+
if (octet1 === 169 && octet2 === 254) return true;
|
|
550
|
+
if (octet1 === 172 && octet2 >= 16 && octet2 <= 31) return true;
|
|
551
|
+
if (octet1 === 192 && octet2 === 168) return true;
|
|
552
|
+
if (octet1 === 100 && octet2 >= 64 && octet2 <= 127) return true;
|
|
553
|
+
return false;
|
|
554
|
+
}
|
|
555
|
+
function isPrivateIpAddress(address) {
|
|
556
|
+
let normalized = address.trim().toLowerCase();
|
|
557
|
+
if (normalized.startsWith("[") && normalized.endsWith("]")) normalized = normalized.slice(1, -1);
|
|
558
|
+
if (!normalized) return false;
|
|
559
|
+
if (normalized.startsWith("::ffff:")) {
|
|
560
|
+
const ipv4 = parseIpv4FromMappedIpv6(normalized.slice(7));
|
|
561
|
+
if (ipv4) return isPrivateIpv4(ipv4);
|
|
562
|
+
}
|
|
563
|
+
if (normalized.includes(":")) {
|
|
564
|
+
if (normalized === "::" || normalized === "::1") return true;
|
|
565
|
+
return PRIVATE_IPV6_PREFIXES.some((prefix) => normalized.startsWith(prefix));
|
|
566
|
+
}
|
|
567
|
+
const ipv4 = parseIpv4(normalized);
|
|
568
|
+
if (!ipv4) return false;
|
|
569
|
+
return isPrivateIpv4(ipv4);
|
|
570
|
+
}
|
|
571
|
+
function isBlockedHostname(hostname) {
|
|
572
|
+
const normalized = normalizeHostname(hostname);
|
|
573
|
+
if (!normalized) return false;
|
|
574
|
+
if (BLOCKED_HOSTNAMES.has(normalized)) return true;
|
|
575
|
+
return normalized.endsWith(".localhost") || normalized.endsWith(".local") || normalized.endsWith(".internal");
|
|
576
|
+
}
|
|
577
|
+
function createPinnedLookup(params) {
|
|
578
|
+
const normalizedHost = normalizeHostname(params.hostname);
|
|
579
|
+
const fallback = params.fallback ?? lookup;
|
|
580
|
+
const fallbackLookup = fallback;
|
|
581
|
+
const fallbackWithOptions = fallback;
|
|
582
|
+
const records = params.addresses.map((address) => ({
|
|
583
|
+
address,
|
|
584
|
+
family: address.includes(":") ? 6 : 4
|
|
585
|
+
}));
|
|
586
|
+
let index = 0;
|
|
587
|
+
return ((host, options, callback) => {
|
|
588
|
+
const cb = typeof options === "function" ? options : callback;
|
|
589
|
+
if (!cb) return;
|
|
590
|
+
const normalized = normalizeHostname(host);
|
|
591
|
+
if (!normalized || normalized !== normalizedHost) {
|
|
592
|
+
if (typeof options === "function" || options === void 0) return fallbackLookup(host, cb);
|
|
593
|
+
return fallbackWithOptions(host, options, cb);
|
|
594
|
+
}
|
|
595
|
+
const opts = typeof options === "object" && options !== null ? options : {};
|
|
596
|
+
const requestedFamily = typeof options === "number" ? options : typeof opts.family === "number" ? opts.family : 0;
|
|
597
|
+
const candidates = requestedFamily === 4 || requestedFamily === 6 ? records.filter((entry) => entry.family === requestedFamily) : records;
|
|
598
|
+
const usable = candidates.length > 0 ? candidates : records;
|
|
599
|
+
if (opts.all) {
|
|
600
|
+
cb(null, usable);
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
const chosen = usable[index % usable.length];
|
|
604
|
+
index += 1;
|
|
605
|
+
cb(null, chosen.address, chosen.family);
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
async function resolvePinnedHostnameWithPolicy(hostname, params = {}) {
|
|
609
|
+
const normalized = normalizeHostname(hostname);
|
|
610
|
+
if (!normalized) throw new Error("Invalid hostname");
|
|
611
|
+
const allowPrivateNetwork = Boolean(params.policy?.allowPrivateNetwork);
|
|
612
|
+
const isExplicitAllowed = normalizeHostnameSet(params.policy?.allowedHostnames).has(normalized);
|
|
613
|
+
if (!allowPrivateNetwork && !isExplicitAllowed) {
|
|
614
|
+
if (isBlockedHostname(normalized)) throw new SsrFBlockedError(`Blocked hostname: ${hostname}`);
|
|
615
|
+
if (isPrivateIpAddress(normalized)) throw new SsrFBlockedError("Blocked: private/internal IP address");
|
|
616
|
+
}
|
|
617
|
+
const results = await (params.lookupFn ?? lookup$1)(normalized, { all: true });
|
|
618
|
+
if (results.length === 0) throw new Error(`Unable to resolve hostname: ${hostname}`);
|
|
619
|
+
if (!allowPrivateNetwork && !isExplicitAllowed) {
|
|
620
|
+
for (const entry of results) if (isPrivateIpAddress(entry.address)) throw new SsrFBlockedError("Blocked: resolves to private/internal IP address");
|
|
621
|
+
}
|
|
622
|
+
const addresses = Array.from(new Set(results.map((entry) => entry.address)));
|
|
623
|
+
if (addresses.length === 0) throw new Error(`Unable to resolve hostname: ${hostname}`);
|
|
624
|
+
return {
|
|
625
|
+
hostname: normalized,
|
|
626
|
+
addresses,
|
|
627
|
+
lookup: createPinnedLookup({
|
|
628
|
+
hostname: normalized,
|
|
629
|
+
addresses
|
|
630
|
+
})
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
async function resolvePinnedHostname(hostname, lookupFn = lookup$1) {
|
|
634
|
+
return await resolvePinnedHostnameWithPolicy(hostname, { lookupFn });
|
|
635
|
+
}
|
|
636
|
+
function createPinnedDispatcher(pinned) {
|
|
637
|
+
return new Agent({ connect: { lookup: pinned.lookup } });
|
|
638
|
+
}
|
|
639
|
+
async function closeDispatcher(dispatcher) {
|
|
640
|
+
if (!dispatcher) return;
|
|
641
|
+
const candidate = dispatcher;
|
|
642
|
+
try {
|
|
643
|
+
if (typeof candidate.close === "function") {
|
|
644
|
+
await candidate.close();
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
647
|
+
if (typeof candidate.destroy === "function") candidate.destroy();
|
|
648
|
+
} catch {}
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
//#endregion
|
|
652
|
+
//#region src/browser/routes/agent.act.shared.ts
|
|
653
|
+
const ACT_KINDS = [
|
|
654
|
+
"click",
|
|
655
|
+
"close",
|
|
656
|
+
"drag",
|
|
657
|
+
"evaluate",
|
|
658
|
+
"fill",
|
|
659
|
+
"hover",
|
|
660
|
+
"scrollIntoView",
|
|
661
|
+
"press",
|
|
662
|
+
"resize",
|
|
663
|
+
"select",
|
|
664
|
+
"type",
|
|
665
|
+
"wait"
|
|
666
|
+
];
|
|
667
|
+
function isActKind(value) {
|
|
668
|
+
if (typeof value !== "string") return false;
|
|
669
|
+
return ACT_KINDS.includes(value);
|
|
670
|
+
}
|
|
671
|
+
const ALLOWED_CLICK_MODIFIERS = new Set([
|
|
672
|
+
"Alt",
|
|
673
|
+
"Control",
|
|
674
|
+
"ControlOrMeta",
|
|
675
|
+
"Meta",
|
|
676
|
+
"Shift"
|
|
677
|
+
]);
|
|
678
|
+
function parseClickButton(raw) {
|
|
679
|
+
if (raw === "left" || raw === "right" || raw === "middle") return raw;
|
|
680
|
+
}
|
|
681
|
+
function parseClickModifiers(raw) {
|
|
682
|
+
if (raw.filter((m) => !ALLOWED_CLICK_MODIFIERS.has(m)).length) return { error: "modifiers must be Alt|Control|ControlOrMeta|Meta|Shift" };
|
|
683
|
+
return { modifiers: raw.length ? raw : void 0 };
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
//#endregion
|
|
687
|
+
//#region src/browser/routes/utils.ts
|
|
688
|
+
/**
|
|
689
|
+
* Extract profile name from query string or body and get profile context.
|
|
690
|
+
* Query string takes precedence over body for consistency with GET routes.
|
|
691
|
+
*/
|
|
692
|
+
function getProfileContext(req, ctx) {
|
|
693
|
+
let profileName;
|
|
694
|
+
if (typeof req.query.profile === "string") profileName = req.query.profile.trim() || void 0;
|
|
695
|
+
if (!profileName && req.body && typeof req.body === "object") {
|
|
696
|
+
const body = req.body;
|
|
697
|
+
if (typeof body.profile === "string") profileName = body.profile.trim() || void 0;
|
|
698
|
+
}
|
|
699
|
+
try {
|
|
700
|
+
return ctx.forProfile(profileName);
|
|
701
|
+
} catch (err) {
|
|
702
|
+
return {
|
|
703
|
+
error: String(err),
|
|
704
|
+
status: 404
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
function jsonError(res, status, message) {
|
|
709
|
+
res.status(status).json({ error: message });
|
|
710
|
+
}
|
|
711
|
+
function toStringOrEmpty(value) {
|
|
712
|
+
if (typeof value === "string") return value.trim();
|
|
713
|
+
if (typeof value === "number" || typeof value === "boolean") return String(value).trim();
|
|
714
|
+
return "";
|
|
715
|
+
}
|
|
716
|
+
function toNumber(value) {
|
|
717
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
718
|
+
if (typeof value === "string" && value.trim()) {
|
|
719
|
+
const parsed = Number(value);
|
|
720
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
function toBoolean(value) {
|
|
724
|
+
return parseBooleanValue(value, {
|
|
725
|
+
truthy: [
|
|
726
|
+
"true",
|
|
727
|
+
"1",
|
|
728
|
+
"yes"
|
|
729
|
+
],
|
|
730
|
+
falsy: [
|
|
731
|
+
"false",
|
|
732
|
+
"0",
|
|
733
|
+
"no"
|
|
734
|
+
]
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
function toStringArray(value) {
|
|
738
|
+
if (!Array.isArray(value)) return;
|
|
739
|
+
const strings = value.map((v) => toStringOrEmpty(v)).filter(Boolean);
|
|
740
|
+
return strings.length ? strings : void 0;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
//#endregion
|
|
744
|
+
//#region src/browser/routes/agent.shared.ts
|
|
745
|
+
const SELECTOR_UNSUPPORTED_MESSAGE = [
|
|
746
|
+
"Error: 'selector' is not supported. Use 'ref' from snapshot instead.",
|
|
747
|
+
"",
|
|
748
|
+
"Example workflow:",
|
|
749
|
+
"1. snapshot action to get page state with refs",
|
|
750
|
+
"2. act with ref: \"e123\" to interact with element",
|
|
751
|
+
"",
|
|
752
|
+
"This is more reliable for modern SPAs."
|
|
753
|
+
].join("\n");
|
|
754
|
+
function readBody(req) {
|
|
755
|
+
const body = req.body;
|
|
756
|
+
if (!body || typeof body !== "object" || Array.isArray(body)) return {};
|
|
757
|
+
return body;
|
|
758
|
+
}
|
|
759
|
+
function handleRouteError(ctx, res, err) {
|
|
760
|
+
const mapped = ctx.mapTabError(err);
|
|
761
|
+
if (mapped) return jsonError(res, mapped.status, mapped.message);
|
|
762
|
+
jsonError(res, 500, String(err));
|
|
763
|
+
}
|
|
764
|
+
function resolveProfileContext(req, res, ctx) {
|
|
765
|
+
const profileCtx = getProfileContext(req, ctx);
|
|
766
|
+
if ("error" in profileCtx) {
|
|
767
|
+
jsonError(res, profileCtx.status, profileCtx.error);
|
|
768
|
+
return null;
|
|
769
|
+
}
|
|
770
|
+
return profileCtx;
|
|
771
|
+
}
|
|
772
|
+
async function getPwAiModule() {
|
|
773
|
+
return await getPwAiModule$1({ mode: "soft" });
|
|
774
|
+
}
|
|
775
|
+
async function requirePwAi(res, feature) {
|
|
776
|
+
const mod = await getPwAiModule();
|
|
777
|
+
if (mod) return mod;
|
|
778
|
+
jsonError(res, 501, [
|
|
779
|
+
`Playwright is not available in this gateway build; '${feature}' is unsupported.`,
|
|
780
|
+
"Install the full Playwright package (not playwright-core) and restart the gateway, or reinstall with browser support.",
|
|
781
|
+
"Docs: /tools/browser#playwright-requirement"
|
|
782
|
+
].join("\n"));
|
|
783
|
+
return null;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
//#endregion
|
|
787
|
+
//#region src/browser/routes/agent.act.ts
|
|
788
|
+
function registerBrowserAgentActRoutes(app, ctx) {
|
|
789
|
+
app.post("/act", async (req, res) => {
|
|
790
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
791
|
+
if (!profileCtx) return;
|
|
792
|
+
const body = readBody(req);
|
|
793
|
+
const kindRaw = toStringOrEmpty(body.kind);
|
|
794
|
+
if (!isActKind(kindRaw)) return jsonError(res, 400, "kind is required");
|
|
795
|
+
const kind = kindRaw;
|
|
796
|
+
const targetId = toStringOrEmpty(body.targetId) || void 0;
|
|
797
|
+
if (Object.hasOwn(body, "selector") && kind !== "wait") return jsonError(res, 400, SELECTOR_UNSUPPORTED_MESSAGE);
|
|
798
|
+
try {
|
|
799
|
+
const tab = await profileCtx.ensureTabAvailable(targetId);
|
|
800
|
+
const cdpUrl = profileCtx.profile.cdpUrl;
|
|
801
|
+
const pw = await requirePwAi(res, `act:${kind}`);
|
|
802
|
+
if (!pw) return;
|
|
803
|
+
const evaluateEnabled = ctx.state().resolved.evaluateEnabled;
|
|
804
|
+
switch (kind) {
|
|
805
|
+
case "click": {
|
|
806
|
+
const ref = toStringOrEmpty(body.ref);
|
|
807
|
+
if (!ref) return jsonError(res, 400, "ref is required");
|
|
808
|
+
const doubleClick = toBoolean(body.doubleClick) ?? false;
|
|
809
|
+
const timeoutMs = toNumber(body.timeoutMs);
|
|
810
|
+
const buttonRaw = toStringOrEmpty(body.button) || "";
|
|
811
|
+
const button = buttonRaw ? parseClickButton(buttonRaw) : void 0;
|
|
812
|
+
if (buttonRaw && !button) return jsonError(res, 400, "button must be left|right|middle");
|
|
813
|
+
const parsedModifiers = parseClickModifiers(toStringArray(body.modifiers) ?? []);
|
|
814
|
+
if (parsedModifiers.error) return jsonError(res, 400, parsedModifiers.error);
|
|
815
|
+
const modifiers = parsedModifiers.modifiers;
|
|
816
|
+
const clickRequest = {
|
|
817
|
+
cdpUrl,
|
|
818
|
+
targetId: tab.targetId,
|
|
819
|
+
ref,
|
|
820
|
+
doubleClick
|
|
821
|
+
};
|
|
822
|
+
if (button) clickRequest.button = button;
|
|
823
|
+
if (modifiers) clickRequest.modifiers = modifiers;
|
|
824
|
+
if (timeoutMs) clickRequest.timeoutMs = timeoutMs;
|
|
825
|
+
await pw.clickViaPlaywright(clickRequest);
|
|
826
|
+
return res.json({
|
|
827
|
+
ok: true,
|
|
828
|
+
targetId: tab.targetId,
|
|
829
|
+
url: tab.url
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
case "type": {
|
|
833
|
+
const ref = toStringOrEmpty(body.ref);
|
|
834
|
+
if (!ref) return jsonError(res, 400, "ref is required");
|
|
835
|
+
if (typeof body.text !== "string") return jsonError(res, 400, "text is required");
|
|
836
|
+
const text = body.text;
|
|
837
|
+
const submit = toBoolean(body.submit) ?? false;
|
|
838
|
+
const slowly = toBoolean(body.slowly) ?? false;
|
|
839
|
+
const timeoutMs = toNumber(body.timeoutMs);
|
|
840
|
+
const typeRequest = {
|
|
841
|
+
cdpUrl,
|
|
842
|
+
targetId: tab.targetId,
|
|
843
|
+
ref,
|
|
844
|
+
text,
|
|
845
|
+
submit,
|
|
846
|
+
slowly
|
|
847
|
+
};
|
|
848
|
+
if (timeoutMs) typeRequest.timeoutMs = timeoutMs;
|
|
849
|
+
await pw.typeViaPlaywright(typeRequest);
|
|
850
|
+
return res.json({
|
|
851
|
+
ok: true,
|
|
852
|
+
targetId: tab.targetId
|
|
853
|
+
});
|
|
854
|
+
}
|
|
855
|
+
case "press": {
|
|
856
|
+
const key = toStringOrEmpty(body.key);
|
|
857
|
+
if (!key) return jsonError(res, 400, "key is required");
|
|
858
|
+
const delayMs = toNumber(body.delayMs);
|
|
859
|
+
await pw.pressKeyViaPlaywright({
|
|
860
|
+
cdpUrl,
|
|
861
|
+
targetId: tab.targetId,
|
|
862
|
+
key,
|
|
863
|
+
delayMs: delayMs ?? void 0
|
|
864
|
+
});
|
|
865
|
+
return res.json({
|
|
866
|
+
ok: true,
|
|
867
|
+
targetId: tab.targetId
|
|
868
|
+
});
|
|
869
|
+
}
|
|
870
|
+
case "hover": {
|
|
871
|
+
const ref = toStringOrEmpty(body.ref);
|
|
872
|
+
if (!ref) return jsonError(res, 400, "ref is required");
|
|
873
|
+
const timeoutMs = toNumber(body.timeoutMs);
|
|
874
|
+
await pw.hoverViaPlaywright({
|
|
875
|
+
cdpUrl,
|
|
876
|
+
targetId: tab.targetId,
|
|
877
|
+
ref,
|
|
878
|
+
timeoutMs: timeoutMs ?? void 0
|
|
879
|
+
});
|
|
880
|
+
return res.json({
|
|
881
|
+
ok: true,
|
|
882
|
+
targetId: tab.targetId
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
case "scrollIntoView": {
|
|
886
|
+
const ref = toStringOrEmpty(body.ref);
|
|
887
|
+
if (!ref) return jsonError(res, 400, "ref is required");
|
|
888
|
+
const timeoutMs = toNumber(body.timeoutMs);
|
|
889
|
+
const scrollRequest = {
|
|
890
|
+
cdpUrl,
|
|
891
|
+
targetId: tab.targetId,
|
|
892
|
+
ref
|
|
893
|
+
};
|
|
894
|
+
if (timeoutMs) scrollRequest.timeoutMs = timeoutMs;
|
|
895
|
+
await pw.scrollIntoViewViaPlaywright(scrollRequest);
|
|
896
|
+
return res.json({
|
|
897
|
+
ok: true,
|
|
898
|
+
targetId: tab.targetId
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
case "drag": {
|
|
902
|
+
const startRef = toStringOrEmpty(body.startRef);
|
|
903
|
+
const endRef = toStringOrEmpty(body.endRef);
|
|
904
|
+
if (!startRef || !endRef) return jsonError(res, 400, "startRef and endRef are required");
|
|
905
|
+
const timeoutMs = toNumber(body.timeoutMs);
|
|
906
|
+
await pw.dragViaPlaywright({
|
|
907
|
+
cdpUrl,
|
|
908
|
+
targetId: tab.targetId,
|
|
909
|
+
startRef,
|
|
910
|
+
endRef,
|
|
911
|
+
timeoutMs: timeoutMs ?? void 0
|
|
912
|
+
});
|
|
913
|
+
return res.json({
|
|
914
|
+
ok: true,
|
|
915
|
+
targetId: tab.targetId
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
case "select": {
|
|
919
|
+
const ref = toStringOrEmpty(body.ref);
|
|
920
|
+
const values = toStringArray(body.values);
|
|
921
|
+
if (!ref || !values?.length) return jsonError(res, 400, "ref and values are required");
|
|
922
|
+
const timeoutMs = toNumber(body.timeoutMs);
|
|
923
|
+
await pw.selectOptionViaPlaywright({
|
|
924
|
+
cdpUrl,
|
|
925
|
+
targetId: tab.targetId,
|
|
926
|
+
ref,
|
|
927
|
+
values,
|
|
928
|
+
timeoutMs: timeoutMs ?? void 0
|
|
929
|
+
});
|
|
930
|
+
return res.json({
|
|
931
|
+
ok: true,
|
|
932
|
+
targetId: tab.targetId
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
case "fill": {
|
|
936
|
+
const fields = (Array.isArray(body.fields) ? body.fields : []).map((field) => {
|
|
937
|
+
if (!field || typeof field !== "object") return null;
|
|
938
|
+
const rec = field;
|
|
939
|
+
const ref = toStringOrEmpty(rec.ref);
|
|
940
|
+
const type = toStringOrEmpty(rec.type);
|
|
941
|
+
if (!ref || !type) return null;
|
|
942
|
+
const value = typeof rec.value === "string" || typeof rec.value === "number" || typeof rec.value === "boolean" ? rec.value : void 0;
|
|
943
|
+
return value === void 0 ? {
|
|
944
|
+
ref,
|
|
945
|
+
type
|
|
946
|
+
} : {
|
|
947
|
+
ref,
|
|
948
|
+
type,
|
|
949
|
+
value
|
|
950
|
+
};
|
|
951
|
+
}).filter((field) => field !== null);
|
|
952
|
+
if (!fields.length) return jsonError(res, 400, "fields are required");
|
|
953
|
+
const timeoutMs = toNumber(body.timeoutMs);
|
|
954
|
+
await pw.fillFormViaPlaywright({
|
|
955
|
+
cdpUrl,
|
|
956
|
+
targetId: tab.targetId,
|
|
957
|
+
fields,
|
|
958
|
+
timeoutMs: timeoutMs ?? void 0
|
|
959
|
+
});
|
|
960
|
+
return res.json({
|
|
961
|
+
ok: true,
|
|
962
|
+
targetId: tab.targetId
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
case "resize": {
|
|
966
|
+
const width = toNumber(body.width);
|
|
967
|
+
const height = toNumber(body.height);
|
|
968
|
+
if (!width || !height) return jsonError(res, 400, "width and height are required");
|
|
969
|
+
await pw.resizeViewportViaPlaywright({
|
|
970
|
+
cdpUrl,
|
|
971
|
+
targetId: tab.targetId,
|
|
972
|
+
width,
|
|
973
|
+
height
|
|
974
|
+
});
|
|
975
|
+
return res.json({
|
|
976
|
+
ok: true,
|
|
977
|
+
targetId: tab.targetId,
|
|
978
|
+
url: tab.url
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
case "wait": {
|
|
982
|
+
const timeMs = toNumber(body.timeMs);
|
|
983
|
+
const text = toStringOrEmpty(body.text) || void 0;
|
|
984
|
+
const textGone = toStringOrEmpty(body.textGone) || void 0;
|
|
985
|
+
const selector = toStringOrEmpty(body.selector) || void 0;
|
|
986
|
+
const url = toStringOrEmpty(body.url) || void 0;
|
|
987
|
+
const loadStateRaw = toStringOrEmpty(body.loadState);
|
|
988
|
+
const loadState = loadStateRaw === "load" || loadStateRaw === "domcontentloaded" || loadStateRaw === "networkidle" ? loadStateRaw : void 0;
|
|
989
|
+
const fn = toStringOrEmpty(body.fn) || void 0;
|
|
990
|
+
const timeoutMs = toNumber(body.timeoutMs) ?? void 0;
|
|
991
|
+
if (fn && !evaluateEnabled) return jsonError(res, 403, ["wait --fn is disabled by config (browser.evaluateEnabled=false).", "Docs: /gateway/configuration#browser-openclaw-managed-browser"].join("\n"));
|
|
992
|
+
if (timeMs === void 0 && !text && !textGone && !selector && !url && !loadState && !fn) return jsonError(res, 400, "wait requires at least one of: timeMs, text, textGone, selector, url, loadState, fn");
|
|
993
|
+
await pw.waitForViaPlaywright({
|
|
994
|
+
cdpUrl,
|
|
995
|
+
targetId: tab.targetId,
|
|
996
|
+
timeMs,
|
|
997
|
+
text,
|
|
998
|
+
textGone,
|
|
999
|
+
selector,
|
|
1000
|
+
url,
|
|
1001
|
+
loadState,
|
|
1002
|
+
fn,
|
|
1003
|
+
timeoutMs
|
|
1004
|
+
});
|
|
1005
|
+
return res.json({
|
|
1006
|
+
ok: true,
|
|
1007
|
+
targetId: tab.targetId
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
case "evaluate": {
|
|
1011
|
+
if (!evaluateEnabled) return jsonError(res, 403, ["act:evaluate is disabled by config (browser.evaluateEnabled=false).", "Docs: /gateway/configuration#browser-openclaw-managed-browser"].join("\n"));
|
|
1012
|
+
const fn = toStringOrEmpty(body.fn);
|
|
1013
|
+
if (!fn) return jsonError(res, 400, "fn is required");
|
|
1014
|
+
const ref = toStringOrEmpty(body.ref) || void 0;
|
|
1015
|
+
const result = await pw.evaluateViaPlaywright({
|
|
1016
|
+
cdpUrl,
|
|
1017
|
+
targetId: tab.targetId,
|
|
1018
|
+
fn,
|
|
1019
|
+
ref
|
|
1020
|
+
});
|
|
1021
|
+
return res.json({
|
|
1022
|
+
ok: true,
|
|
1023
|
+
targetId: tab.targetId,
|
|
1024
|
+
url: tab.url,
|
|
1025
|
+
result
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
case "close":
|
|
1029
|
+
await pw.closePageViaPlaywright({
|
|
1030
|
+
cdpUrl,
|
|
1031
|
+
targetId: tab.targetId
|
|
1032
|
+
});
|
|
1033
|
+
return res.json({
|
|
1034
|
+
ok: true,
|
|
1035
|
+
targetId: tab.targetId
|
|
1036
|
+
});
|
|
1037
|
+
default: return jsonError(res, 400, "unsupported kind");
|
|
1038
|
+
}
|
|
1039
|
+
} catch (err) {
|
|
1040
|
+
handleRouteError(ctx, res, err);
|
|
1041
|
+
}
|
|
1042
|
+
});
|
|
1043
|
+
app.post("/hooks/file-chooser", async (req, res) => {
|
|
1044
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1045
|
+
if (!profileCtx) return;
|
|
1046
|
+
const body = readBody(req);
|
|
1047
|
+
const targetId = toStringOrEmpty(body.targetId) || void 0;
|
|
1048
|
+
const ref = toStringOrEmpty(body.ref) || void 0;
|
|
1049
|
+
const inputRef = toStringOrEmpty(body.inputRef) || void 0;
|
|
1050
|
+
const element = toStringOrEmpty(body.element) || void 0;
|
|
1051
|
+
const paths = toStringArray(body.paths) ?? [];
|
|
1052
|
+
const timeoutMs = toNumber(body.timeoutMs);
|
|
1053
|
+
if (!paths.length) return jsonError(res, 400, "paths are required");
|
|
1054
|
+
try {
|
|
1055
|
+
const tab = await profileCtx.ensureTabAvailable(targetId);
|
|
1056
|
+
const pw = await requirePwAi(res, "file chooser hook");
|
|
1057
|
+
if (!pw) return;
|
|
1058
|
+
if (inputRef || element) {
|
|
1059
|
+
if (ref) return jsonError(res, 400, "ref cannot be combined with inputRef/element");
|
|
1060
|
+
await pw.setInputFilesViaPlaywright({
|
|
1061
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1062
|
+
targetId: tab.targetId,
|
|
1063
|
+
inputRef,
|
|
1064
|
+
element,
|
|
1065
|
+
paths
|
|
1066
|
+
});
|
|
1067
|
+
} else {
|
|
1068
|
+
await pw.armFileUploadViaPlaywright({
|
|
1069
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1070
|
+
targetId: tab.targetId,
|
|
1071
|
+
paths,
|
|
1072
|
+
timeoutMs: timeoutMs ?? void 0
|
|
1073
|
+
});
|
|
1074
|
+
if (ref) await pw.clickViaPlaywright({
|
|
1075
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1076
|
+
targetId: tab.targetId,
|
|
1077
|
+
ref
|
|
1078
|
+
});
|
|
1079
|
+
}
|
|
1080
|
+
res.json({ ok: true });
|
|
1081
|
+
} catch (err) {
|
|
1082
|
+
handleRouteError(ctx, res, err);
|
|
1083
|
+
}
|
|
1084
|
+
});
|
|
1085
|
+
app.post("/hooks/dialog", async (req, res) => {
|
|
1086
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1087
|
+
if (!profileCtx) return;
|
|
1088
|
+
const body = readBody(req);
|
|
1089
|
+
const targetId = toStringOrEmpty(body.targetId) || void 0;
|
|
1090
|
+
const accept = toBoolean(body.accept);
|
|
1091
|
+
const promptText = toStringOrEmpty(body.promptText) || void 0;
|
|
1092
|
+
const timeoutMs = toNumber(body.timeoutMs);
|
|
1093
|
+
if (accept === void 0) return jsonError(res, 400, "accept is required");
|
|
1094
|
+
try {
|
|
1095
|
+
const tab = await profileCtx.ensureTabAvailable(targetId);
|
|
1096
|
+
const pw = await requirePwAi(res, "dialog hook");
|
|
1097
|
+
if (!pw) return;
|
|
1098
|
+
await pw.armDialogViaPlaywright({
|
|
1099
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1100
|
+
targetId: tab.targetId,
|
|
1101
|
+
accept,
|
|
1102
|
+
promptText,
|
|
1103
|
+
timeoutMs: timeoutMs ?? void 0
|
|
1104
|
+
});
|
|
1105
|
+
res.json({ ok: true });
|
|
1106
|
+
} catch (err) {
|
|
1107
|
+
handleRouteError(ctx, res, err);
|
|
1108
|
+
}
|
|
1109
|
+
});
|
|
1110
|
+
app.post("/wait/download", async (req, res) => {
|
|
1111
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1112
|
+
if (!profileCtx) return;
|
|
1113
|
+
const body = readBody(req);
|
|
1114
|
+
const targetId = toStringOrEmpty(body.targetId) || void 0;
|
|
1115
|
+
const out = toStringOrEmpty(body.path) || void 0;
|
|
1116
|
+
const timeoutMs = toNumber(body.timeoutMs);
|
|
1117
|
+
try {
|
|
1118
|
+
const tab = await profileCtx.ensureTabAvailable(targetId);
|
|
1119
|
+
const pw = await requirePwAi(res, "wait for download");
|
|
1120
|
+
if (!pw) return;
|
|
1121
|
+
const result = await pw.waitForDownloadViaPlaywright({
|
|
1122
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1123
|
+
targetId: tab.targetId,
|
|
1124
|
+
path: out,
|
|
1125
|
+
timeoutMs: timeoutMs ?? void 0
|
|
1126
|
+
});
|
|
1127
|
+
res.json({
|
|
1128
|
+
ok: true,
|
|
1129
|
+
targetId: tab.targetId,
|
|
1130
|
+
download: result
|
|
1131
|
+
});
|
|
1132
|
+
} catch (err) {
|
|
1133
|
+
handleRouteError(ctx, res, err);
|
|
1134
|
+
}
|
|
1135
|
+
});
|
|
1136
|
+
app.post("/download", async (req, res) => {
|
|
1137
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1138
|
+
if (!profileCtx) return;
|
|
1139
|
+
const body = readBody(req);
|
|
1140
|
+
const targetId = toStringOrEmpty(body.targetId) || void 0;
|
|
1141
|
+
const ref = toStringOrEmpty(body.ref);
|
|
1142
|
+
const out = toStringOrEmpty(body.path);
|
|
1143
|
+
const timeoutMs = toNumber(body.timeoutMs);
|
|
1144
|
+
if (!ref) return jsonError(res, 400, "ref is required");
|
|
1145
|
+
if (!out) return jsonError(res, 400, "path is required");
|
|
1146
|
+
try {
|
|
1147
|
+
const tab = await profileCtx.ensureTabAvailable(targetId);
|
|
1148
|
+
const pw = await requirePwAi(res, "download");
|
|
1149
|
+
if (!pw) return;
|
|
1150
|
+
const result = await pw.downloadViaPlaywright({
|
|
1151
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1152
|
+
targetId: tab.targetId,
|
|
1153
|
+
ref,
|
|
1154
|
+
path: out,
|
|
1155
|
+
timeoutMs: timeoutMs ?? void 0
|
|
1156
|
+
});
|
|
1157
|
+
res.json({
|
|
1158
|
+
ok: true,
|
|
1159
|
+
targetId: tab.targetId,
|
|
1160
|
+
download: result
|
|
1161
|
+
});
|
|
1162
|
+
} catch (err) {
|
|
1163
|
+
handleRouteError(ctx, res, err);
|
|
1164
|
+
}
|
|
1165
|
+
});
|
|
1166
|
+
app.post("/response/body", async (req, res) => {
|
|
1167
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1168
|
+
if (!profileCtx) return;
|
|
1169
|
+
const body = readBody(req);
|
|
1170
|
+
const targetId = toStringOrEmpty(body.targetId) || void 0;
|
|
1171
|
+
const url = toStringOrEmpty(body.url);
|
|
1172
|
+
const timeoutMs = toNumber(body.timeoutMs);
|
|
1173
|
+
const maxChars = toNumber(body.maxChars);
|
|
1174
|
+
if (!url) return jsonError(res, 400, "url is required");
|
|
1175
|
+
try {
|
|
1176
|
+
const tab = await profileCtx.ensureTabAvailable(targetId);
|
|
1177
|
+
const pw = await requirePwAi(res, "response body");
|
|
1178
|
+
if (!pw) return;
|
|
1179
|
+
const result = await pw.responseBodyViaPlaywright({
|
|
1180
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1181
|
+
targetId: tab.targetId,
|
|
1182
|
+
url,
|
|
1183
|
+
timeoutMs: timeoutMs ?? void 0,
|
|
1184
|
+
maxChars: maxChars ?? void 0
|
|
1185
|
+
});
|
|
1186
|
+
res.json({
|
|
1187
|
+
ok: true,
|
|
1188
|
+
targetId: tab.targetId,
|
|
1189
|
+
response: result
|
|
1190
|
+
});
|
|
1191
|
+
} catch (err) {
|
|
1192
|
+
handleRouteError(ctx, res, err);
|
|
1193
|
+
}
|
|
1194
|
+
});
|
|
1195
|
+
app.post("/highlight", async (req, res) => {
|
|
1196
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1197
|
+
if (!profileCtx) return;
|
|
1198
|
+
const body = readBody(req);
|
|
1199
|
+
const targetId = toStringOrEmpty(body.targetId) || void 0;
|
|
1200
|
+
const ref = toStringOrEmpty(body.ref);
|
|
1201
|
+
if (!ref) return jsonError(res, 400, "ref is required");
|
|
1202
|
+
try {
|
|
1203
|
+
const tab = await profileCtx.ensureTabAvailable(targetId);
|
|
1204
|
+
const pw = await requirePwAi(res, "highlight");
|
|
1205
|
+
if (!pw) return;
|
|
1206
|
+
await pw.highlightViaPlaywright({
|
|
1207
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1208
|
+
targetId: tab.targetId,
|
|
1209
|
+
ref
|
|
1210
|
+
});
|
|
1211
|
+
res.json({
|
|
1212
|
+
ok: true,
|
|
1213
|
+
targetId: tab.targetId
|
|
1214
|
+
});
|
|
1215
|
+
} catch (err) {
|
|
1216
|
+
handleRouteError(ctx, res, err);
|
|
1217
|
+
}
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
//#endregion
|
|
1222
|
+
//#region src/browser/routes/agent.debug.ts
|
|
1223
|
+
function registerBrowserAgentDebugRoutes(app, ctx) {
|
|
1224
|
+
app.get("/console", async (req, res) => {
|
|
1225
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1226
|
+
if (!profileCtx) return;
|
|
1227
|
+
const targetId = typeof req.query.targetId === "string" ? req.query.targetId.trim() : "";
|
|
1228
|
+
const level = typeof req.query.level === "string" ? req.query.level : "";
|
|
1229
|
+
try {
|
|
1230
|
+
const tab = await profileCtx.ensureTabAvailable(targetId || void 0);
|
|
1231
|
+
const pw = await requirePwAi(res, "console messages");
|
|
1232
|
+
if (!pw) return;
|
|
1233
|
+
const messages = await pw.getConsoleMessagesViaPlaywright({
|
|
1234
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1235
|
+
targetId: tab.targetId,
|
|
1236
|
+
level: level.trim() || void 0
|
|
1237
|
+
});
|
|
1238
|
+
res.json({
|
|
1239
|
+
ok: true,
|
|
1240
|
+
messages,
|
|
1241
|
+
targetId: tab.targetId
|
|
1242
|
+
});
|
|
1243
|
+
} catch (err) {
|
|
1244
|
+
handleRouteError(ctx, res, err);
|
|
1245
|
+
}
|
|
1246
|
+
});
|
|
1247
|
+
app.get("/errors", async (req, res) => {
|
|
1248
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1249
|
+
if (!profileCtx) return;
|
|
1250
|
+
const targetId = typeof req.query.targetId === "string" ? req.query.targetId.trim() : "";
|
|
1251
|
+
const clear = toBoolean(req.query.clear) ?? false;
|
|
1252
|
+
try {
|
|
1253
|
+
const tab = await profileCtx.ensureTabAvailable(targetId || void 0);
|
|
1254
|
+
const pw = await requirePwAi(res, "page errors");
|
|
1255
|
+
if (!pw) return;
|
|
1256
|
+
const result = await pw.getPageErrorsViaPlaywright({
|
|
1257
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1258
|
+
targetId: tab.targetId,
|
|
1259
|
+
clear
|
|
1260
|
+
});
|
|
1261
|
+
res.json({
|
|
1262
|
+
ok: true,
|
|
1263
|
+
targetId: tab.targetId,
|
|
1264
|
+
...result
|
|
1265
|
+
});
|
|
1266
|
+
} catch (err) {
|
|
1267
|
+
handleRouteError(ctx, res, err);
|
|
1268
|
+
}
|
|
1269
|
+
});
|
|
1270
|
+
app.get("/requests", async (req, res) => {
|
|
1271
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1272
|
+
if (!profileCtx) return;
|
|
1273
|
+
const targetId = typeof req.query.targetId === "string" ? req.query.targetId.trim() : "";
|
|
1274
|
+
const filter = typeof req.query.filter === "string" ? req.query.filter : "";
|
|
1275
|
+
const clear = toBoolean(req.query.clear) ?? false;
|
|
1276
|
+
try {
|
|
1277
|
+
const tab = await profileCtx.ensureTabAvailable(targetId || void 0);
|
|
1278
|
+
const pw = await requirePwAi(res, "network requests");
|
|
1279
|
+
if (!pw) return;
|
|
1280
|
+
const result = await pw.getNetworkRequestsViaPlaywright({
|
|
1281
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1282
|
+
targetId: tab.targetId,
|
|
1283
|
+
filter: filter.trim() || void 0,
|
|
1284
|
+
clear
|
|
1285
|
+
});
|
|
1286
|
+
res.json({
|
|
1287
|
+
ok: true,
|
|
1288
|
+
targetId: tab.targetId,
|
|
1289
|
+
...result
|
|
1290
|
+
});
|
|
1291
|
+
} catch (err) {
|
|
1292
|
+
handleRouteError(ctx, res, err);
|
|
1293
|
+
}
|
|
1294
|
+
});
|
|
1295
|
+
app.post("/trace/start", async (req, res) => {
|
|
1296
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1297
|
+
if (!profileCtx) return;
|
|
1298
|
+
const body = readBody(req);
|
|
1299
|
+
const targetId = toStringOrEmpty(body.targetId) || void 0;
|
|
1300
|
+
const screenshots = toBoolean(body.screenshots) ?? void 0;
|
|
1301
|
+
const snapshots = toBoolean(body.snapshots) ?? void 0;
|
|
1302
|
+
const sources = toBoolean(body.sources) ?? void 0;
|
|
1303
|
+
try {
|
|
1304
|
+
const tab = await profileCtx.ensureTabAvailable(targetId);
|
|
1305
|
+
const pw = await requirePwAi(res, "trace start");
|
|
1306
|
+
if (!pw) return;
|
|
1307
|
+
await pw.traceStartViaPlaywright({
|
|
1308
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1309
|
+
targetId: tab.targetId,
|
|
1310
|
+
screenshots,
|
|
1311
|
+
snapshots,
|
|
1312
|
+
sources
|
|
1313
|
+
});
|
|
1314
|
+
res.json({
|
|
1315
|
+
ok: true,
|
|
1316
|
+
targetId: tab.targetId
|
|
1317
|
+
});
|
|
1318
|
+
} catch (err) {
|
|
1319
|
+
handleRouteError(ctx, res, err);
|
|
1320
|
+
}
|
|
1321
|
+
});
|
|
1322
|
+
app.post("/trace/stop", async (req, res) => {
|
|
1323
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1324
|
+
if (!profileCtx) return;
|
|
1325
|
+
const body = readBody(req);
|
|
1326
|
+
const targetId = toStringOrEmpty(body.targetId) || void 0;
|
|
1327
|
+
const out = toStringOrEmpty(body.path) || "";
|
|
1328
|
+
try {
|
|
1329
|
+
const tab = await profileCtx.ensureTabAvailable(targetId);
|
|
1330
|
+
const pw = await requirePwAi(res, "trace stop");
|
|
1331
|
+
if (!pw) return;
|
|
1332
|
+
const id = crypto.randomUUID();
|
|
1333
|
+
const dir = "/tmp/openclaw";
|
|
1334
|
+
await fs$1.mkdir(dir, { recursive: true });
|
|
1335
|
+
const tracePath = out.trim() || path.join(dir, `browser-trace-${id}.zip`);
|
|
1336
|
+
await pw.traceStopViaPlaywright({
|
|
1337
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1338
|
+
targetId: tab.targetId,
|
|
1339
|
+
path: tracePath
|
|
1340
|
+
});
|
|
1341
|
+
res.json({
|
|
1342
|
+
ok: true,
|
|
1343
|
+
targetId: tab.targetId,
|
|
1344
|
+
path: path.resolve(tracePath)
|
|
1345
|
+
});
|
|
1346
|
+
} catch (err) {
|
|
1347
|
+
handleRouteError(ctx, res, err);
|
|
1348
|
+
}
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
//#endregion
|
|
1353
|
+
//#region src/media/store.ts
|
|
1354
|
+
const resolveMediaDir = () => path.join(resolveConfigDir(), "media");
|
|
1355
|
+
const MEDIA_MAX_BYTES = 5 * 1024 * 1024;
|
|
1356
|
+
const MAX_BYTES = MEDIA_MAX_BYTES;
|
|
1357
|
+
const DEFAULT_TTL_MS = 120 * 1e3;
|
|
1358
|
+
/**
|
|
1359
|
+
* Sanitize a filename for cross-platform safety.
|
|
1360
|
+
* Removes chars unsafe on Windows/SharePoint/all platforms.
|
|
1361
|
+
* Keeps: alphanumeric, dots, hyphens, underscores, Unicode letters/numbers.
|
|
1362
|
+
*/
|
|
1363
|
+
function sanitizeFilename(name) {
|
|
1364
|
+
const trimmed = name.trim();
|
|
1365
|
+
if (!trimmed) return "";
|
|
1366
|
+
return trimmed.replace(/[^\p{L}\p{N}._-]+/gu, "_").replace(/_+/g, "_").replace(/^_|_$/g, "").slice(0, 60);
|
|
1367
|
+
}
|
|
1368
|
+
function getMediaDir() {
|
|
1369
|
+
return resolveMediaDir();
|
|
1370
|
+
}
|
|
1371
|
+
async function ensureMediaDir() {
|
|
1372
|
+
const mediaDir = resolveMediaDir();
|
|
1373
|
+
await fs$1.mkdir(mediaDir, {
|
|
1374
|
+
recursive: true,
|
|
1375
|
+
mode: 448
|
|
1376
|
+
});
|
|
1377
|
+
return mediaDir;
|
|
1378
|
+
}
|
|
1379
|
+
async function saveMediaBuffer(buffer, contentType, subdir = "inbound", maxBytes = MAX_BYTES, originalFilename) {
|
|
1380
|
+
if (buffer.byteLength > maxBytes) throw new Error(`Media exceeds ${(maxBytes / (1024 * 1024)).toFixed(0)}MB limit`);
|
|
1381
|
+
const dir = path.join(resolveMediaDir(), subdir);
|
|
1382
|
+
await fs$1.mkdir(dir, {
|
|
1383
|
+
recursive: true,
|
|
1384
|
+
mode: 448
|
|
1385
|
+
});
|
|
1386
|
+
const uuid = crypto.randomUUID();
|
|
1387
|
+
const headerExt = extensionForMime(contentType?.split(";")[0]?.trim() ?? void 0);
|
|
1388
|
+
const mime = await detectMime({
|
|
1389
|
+
buffer,
|
|
1390
|
+
headerMime: contentType
|
|
1391
|
+
});
|
|
1392
|
+
const ext = headerExt ?? extensionForMime(mime) ?? "";
|
|
1393
|
+
let id;
|
|
1394
|
+
if (originalFilename) {
|
|
1395
|
+
const base = path.parse(originalFilename).name;
|
|
1396
|
+
const sanitized = sanitizeFilename(base);
|
|
1397
|
+
id = sanitized ? `${sanitized}---${uuid}${ext}` : `${uuid}${ext}`;
|
|
1398
|
+
} else id = ext ? `${uuid}${ext}` : uuid;
|
|
1399
|
+
const dest = path.join(dir, id);
|
|
1400
|
+
await fs$1.writeFile(dest, buffer, { mode: 384 });
|
|
1401
|
+
return {
|
|
1402
|
+
id,
|
|
1403
|
+
path: dest,
|
|
1404
|
+
size: buffer.byteLength,
|
|
1405
|
+
contentType: mime
|
|
1406
|
+
};
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
//#endregion
|
|
1410
|
+
//#region src/browser/screenshot.ts
|
|
1411
|
+
const DEFAULT_BROWSER_SCREENSHOT_MAX_SIDE = 2e3;
|
|
1412
|
+
const DEFAULT_BROWSER_SCREENSHOT_MAX_BYTES = 5 * 1024 * 1024;
|
|
1413
|
+
async function normalizeBrowserScreenshot(buffer, opts) {
|
|
1414
|
+
const maxSide = Math.max(1, Math.round(opts?.maxSide ?? DEFAULT_BROWSER_SCREENSHOT_MAX_SIDE));
|
|
1415
|
+
const maxBytes = Math.max(1, Math.round(opts?.maxBytes ?? DEFAULT_BROWSER_SCREENSHOT_MAX_BYTES));
|
|
1416
|
+
const meta = await getImageMetadata(buffer);
|
|
1417
|
+
const width = Number(meta?.width ?? 0);
|
|
1418
|
+
const height = Number(meta?.height ?? 0);
|
|
1419
|
+
const maxDim = Math.max(width, height);
|
|
1420
|
+
if (buffer.byteLength <= maxBytes && (maxDim === 0 || width <= maxSide && height <= maxSide)) return { buffer };
|
|
1421
|
+
const qualities = [
|
|
1422
|
+
85,
|
|
1423
|
+
75,
|
|
1424
|
+
65,
|
|
1425
|
+
55,
|
|
1426
|
+
45,
|
|
1427
|
+
35
|
|
1428
|
+
];
|
|
1429
|
+
const sideGrid = [
|
|
1430
|
+
maxDim > 0 ? Math.min(maxSide, maxDim) : maxSide,
|
|
1431
|
+
1800,
|
|
1432
|
+
1600,
|
|
1433
|
+
1400,
|
|
1434
|
+
1200,
|
|
1435
|
+
1e3,
|
|
1436
|
+
800
|
|
1437
|
+
].map((v) => Math.min(maxSide, v)).filter((v, i, arr) => v > 0 && arr.indexOf(v) === i).toSorted((a, b) => b - a);
|
|
1438
|
+
let smallest = null;
|
|
1439
|
+
for (const side of sideGrid) for (const quality of qualities) {
|
|
1440
|
+
const out = await resizeToJpeg({
|
|
1441
|
+
buffer,
|
|
1442
|
+
maxSide: side,
|
|
1443
|
+
quality,
|
|
1444
|
+
withoutEnlargement: true
|
|
1445
|
+
});
|
|
1446
|
+
if (!smallest || out.byteLength < smallest.size) smallest = {
|
|
1447
|
+
buffer: out,
|
|
1448
|
+
size: out.byteLength
|
|
1449
|
+
};
|
|
1450
|
+
if (out.byteLength <= maxBytes) return {
|
|
1451
|
+
buffer: out,
|
|
1452
|
+
contentType: "image/jpeg"
|
|
1453
|
+
};
|
|
1454
|
+
}
|
|
1455
|
+
const best = smallest?.buffer ?? buffer;
|
|
1456
|
+
throw new Error(`Browser screenshot could not be reduced below ${(maxBytes / (1024 * 1024)).toFixed(0)}MB (got ${(best.byteLength / (1024 * 1024)).toFixed(2)}MB)`);
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
//#endregion
|
|
1460
|
+
//#region src/browser/routes/agent.snapshot.ts
|
|
1461
|
+
function registerBrowserAgentSnapshotRoutes(app, ctx) {
|
|
1462
|
+
app.post("/navigate", async (req, res) => {
|
|
1463
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1464
|
+
if (!profileCtx) return;
|
|
1465
|
+
const body = readBody(req);
|
|
1466
|
+
const url = toStringOrEmpty(body.url);
|
|
1467
|
+
const targetId = toStringOrEmpty(body.targetId) || void 0;
|
|
1468
|
+
if (!url) return jsonError(res, 400, "url is required");
|
|
1469
|
+
try {
|
|
1470
|
+
const tab = await profileCtx.ensureTabAvailable(targetId);
|
|
1471
|
+
const pw = await requirePwAi(res, "navigate");
|
|
1472
|
+
if (!pw) return;
|
|
1473
|
+
const result = await pw.navigateViaPlaywright({
|
|
1474
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1475
|
+
targetId: tab.targetId,
|
|
1476
|
+
url
|
|
1477
|
+
});
|
|
1478
|
+
res.json({
|
|
1479
|
+
ok: true,
|
|
1480
|
+
targetId: tab.targetId,
|
|
1481
|
+
...result
|
|
1482
|
+
});
|
|
1483
|
+
} catch (err) {
|
|
1484
|
+
handleRouteError(ctx, res, err);
|
|
1485
|
+
}
|
|
1486
|
+
});
|
|
1487
|
+
app.post("/pdf", async (req, res) => {
|
|
1488
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1489
|
+
if (!profileCtx) return;
|
|
1490
|
+
const targetId = toStringOrEmpty(readBody(req).targetId) || void 0;
|
|
1491
|
+
try {
|
|
1492
|
+
const tab = await profileCtx.ensureTabAvailable(targetId);
|
|
1493
|
+
const pw = await requirePwAi(res, "pdf");
|
|
1494
|
+
if (!pw) return;
|
|
1495
|
+
const pdf = await pw.pdfViaPlaywright({
|
|
1496
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1497
|
+
targetId: tab.targetId
|
|
1498
|
+
});
|
|
1499
|
+
await ensureMediaDir();
|
|
1500
|
+
const saved = await saveMediaBuffer(pdf.buffer, "application/pdf", "browser", pdf.buffer.byteLength);
|
|
1501
|
+
res.json({
|
|
1502
|
+
ok: true,
|
|
1503
|
+
path: path.resolve(saved.path),
|
|
1504
|
+
targetId: tab.targetId,
|
|
1505
|
+
url: tab.url
|
|
1506
|
+
});
|
|
1507
|
+
} catch (err) {
|
|
1508
|
+
handleRouteError(ctx, res, err);
|
|
1509
|
+
}
|
|
1510
|
+
});
|
|
1511
|
+
app.post("/screenshot", async (req, res) => {
|
|
1512
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1513
|
+
if (!profileCtx) return;
|
|
1514
|
+
const body = readBody(req);
|
|
1515
|
+
const targetId = toStringOrEmpty(body.targetId) || void 0;
|
|
1516
|
+
const fullPage = toBoolean(body.fullPage) ?? false;
|
|
1517
|
+
const ref = toStringOrEmpty(body.ref) || void 0;
|
|
1518
|
+
const element = toStringOrEmpty(body.element) || void 0;
|
|
1519
|
+
const type = body.type === "jpeg" ? "jpeg" : "png";
|
|
1520
|
+
if (fullPage && (ref || element)) return jsonError(res, 400, "fullPage is not supported for element screenshots");
|
|
1521
|
+
try {
|
|
1522
|
+
const tab = await profileCtx.ensureTabAvailable(targetId);
|
|
1523
|
+
let buffer;
|
|
1524
|
+
if (profileCtx.profile.driver === "extension" || !tab.wsUrl || Boolean(ref) || Boolean(element)) {
|
|
1525
|
+
const pw = await requirePwAi(res, "screenshot");
|
|
1526
|
+
if (!pw) return;
|
|
1527
|
+
buffer = (await pw.takeScreenshotViaPlaywright({
|
|
1528
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1529
|
+
targetId: tab.targetId,
|
|
1530
|
+
ref,
|
|
1531
|
+
element,
|
|
1532
|
+
fullPage,
|
|
1533
|
+
type
|
|
1534
|
+
})).buffer;
|
|
1535
|
+
} else buffer = await captureScreenshot({
|
|
1536
|
+
wsUrl: tab.wsUrl ?? "",
|
|
1537
|
+
fullPage,
|
|
1538
|
+
format: type,
|
|
1539
|
+
quality: type === "jpeg" ? 85 : void 0
|
|
1540
|
+
});
|
|
1541
|
+
const normalized = await normalizeBrowserScreenshot(buffer, {
|
|
1542
|
+
maxSide: DEFAULT_BROWSER_SCREENSHOT_MAX_SIDE,
|
|
1543
|
+
maxBytes: DEFAULT_BROWSER_SCREENSHOT_MAX_BYTES
|
|
1544
|
+
});
|
|
1545
|
+
await ensureMediaDir();
|
|
1546
|
+
const saved = await saveMediaBuffer(normalized.buffer, normalized.contentType ?? `image/${type}`, "browser", DEFAULT_BROWSER_SCREENSHOT_MAX_BYTES);
|
|
1547
|
+
res.json({
|
|
1548
|
+
ok: true,
|
|
1549
|
+
path: path.resolve(saved.path),
|
|
1550
|
+
targetId: tab.targetId,
|
|
1551
|
+
url: tab.url
|
|
1552
|
+
});
|
|
1553
|
+
} catch (err) {
|
|
1554
|
+
handleRouteError(ctx, res, err);
|
|
1555
|
+
}
|
|
1556
|
+
});
|
|
1557
|
+
app.get("/snapshot", async (req, res) => {
|
|
1558
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1559
|
+
if (!profileCtx) return;
|
|
1560
|
+
const targetId = typeof req.query.targetId === "string" ? req.query.targetId.trim() : "";
|
|
1561
|
+
const mode = req.query.mode === "efficient" ? "efficient" : void 0;
|
|
1562
|
+
const labels = toBoolean(req.query.labels) ?? void 0;
|
|
1563
|
+
const format = (req.query.format === "aria" ? "aria" : req.query.format === "ai" ? "ai" : void 0) ?? (mode ? "ai" : await getPwAiModule() ? "ai" : "aria");
|
|
1564
|
+
const limitRaw = typeof req.query.limit === "string" ? Number(req.query.limit) : void 0;
|
|
1565
|
+
const hasMaxChars = Object.hasOwn(req.query, "maxChars");
|
|
1566
|
+
const maxCharsRaw = typeof req.query.maxChars === "string" ? Number(req.query.maxChars) : void 0;
|
|
1567
|
+
const limit = Number.isFinite(limitRaw) ? limitRaw : void 0;
|
|
1568
|
+
const resolvedMaxChars = format === "ai" ? hasMaxChars ? typeof maxCharsRaw === "number" && Number.isFinite(maxCharsRaw) && maxCharsRaw > 0 ? Math.floor(maxCharsRaw) : void 0 : mode === "efficient" ? DEFAULT_AI_SNAPSHOT_EFFICIENT_MAX_CHARS : DEFAULT_AI_SNAPSHOT_MAX_CHARS : void 0;
|
|
1569
|
+
const interactiveRaw = toBoolean(req.query.interactive);
|
|
1570
|
+
const compactRaw = toBoolean(req.query.compact);
|
|
1571
|
+
const depthRaw = toNumber(req.query.depth);
|
|
1572
|
+
const refsModeRaw = toStringOrEmpty(req.query.refs).trim();
|
|
1573
|
+
const refsMode = refsModeRaw === "aria" ? "aria" : refsModeRaw === "role" ? "role" : void 0;
|
|
1574
|
+
const interactive = interactiveRaw ?? (mode === "efficient" ? true : void 0);
|
|
1575
|
+
const compact = compactRaw ?? (mode === "efficient" ? true : void 0);
|
|
1576
|
+
const depth = depthRaw ?? (mode === "efficient" ? DEFAULT_AI_SNAPSHOT_EFFICIENT_DEPTH : void 0);
|
|
1577
|
+
const selector = toStringOrEmpty(req.query.selector);
|
|
1578
|
+
const frameSelector = toStringOrEmpty(req.query.frame);
|
|
1579
|
+
try {
|
|
1580
|
+
const tab = await profileCtx.ensureTabAvailable(targetId || void 0);
|
|
1581
|
+
if ((labels || mode === "efficient") && format === "aria") return jsonError(res, 400, "labels/mode=efficient require format=ai");
|
|
1582
|
+
if (format === "ai") {
|
|
1583
|
+
const pw = await requirePwAi(res, "ai snapshot");
|
|
1584
|
+
if (!pw) return;
|
|
1585
|
+
const snap = labels === true || mode === "efficient" || interactive === true || compact === true || depth !== void 0 || Boolean(selector.trim()) || Boolean(frameSelector.trim()) ? await pw.snapshotRoleViaPlaywright({
|
|
1586
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1587
|
+
targetId: tab.targetId,
|
|
1588
|
+
selector: selector.trim() || void 0,
|
|
1589
|
+
frameSelector: frameSelector.trim() || void 0,
|
|
1590
|
+
refsMode,
|
|
1591
|
+
options: {
|
|
1592
|
+
interactive: interactive ?? void 0,
|
|
1593
|
+
compact: compact ?? void 0,
|
|
1594
|
+
maxDepth: depth ?? void 0
|
|
1595
|
+
}
|
|
1596
|
+
}) : await pw.snapshotAiViaPlaywright({
|
|
1597
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1598
|
+
targetId: tab.targetId,
|
|
1599
|
+
...typeof resolvedMaxChars === "number" ? { maxChars: resolvedMaxChars } : {}
|
|
1600
|
+
}).catch(async (err) => {
|
|
1601
|
+
if (String(err).toLowerCase().includes("_snapshotforai")) return await pw.snapshotRoleViaPlaywright({
|
|
1602
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1603
|
+
targetId: tab.targetId,
|
|
1604
|
+
selector: selector.trim() || void 0,
|
|
1605
|
+
frameSelector: frameSelector.trim() || void 0,
|
|
1606
|
+
refsMode,
|
|
1607
|
+
options: {
|
|
1608
|
+
interactive: interactive ?? void 0,
|
|
1609
|
+
compact: compact ?? void 0,
|
|
1610
|
+
maxDepth: depth ?? void 0
|
|
1611
|
+
}
|
|
1612
|
+
});
|
|
1613
|
+
throw err;
|
|
1614
|
+
});
|
|
1615
|
+
if (labels) {
|
|
1616
|
+
const labeled = await pw.screenshotWithLabelsViaPlaywright({
|
|
1617
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1618
|
+
targetId: tab.targetId,
|
|
1619
|
+
refs: "refs" in snap ? snap.refs : {},
|
|
1620
|
+
type: "png"
|
|
1621
|
+
});
|
|
1622
|
+
const normalized = await normalizeBrowserScreenshot(labeled.buffer, {
|
|
1623
|
+
maxSide: DEFAULT_BROWSER_SCREENSHOT_MAX_SIDE,
|
|
1624
|
+
maxBytes: DEFAULT_BROWSER_SCREENSHOT_MAX_BYTES
|
|
1625
|
+
});
|
|
1626
|
+
await ensureMediaDir();
|
|
1627
|
+
const saved = await saveMediaBuffer(normalized.buffer, normalized.contentType ?? "image/png", "browser", DEFAULT_BROWSER_SCREENSHOT_MAX_BYTES);
|
|
1628
|
+
const imageType = normalized.contentType?.includes("jpeg") ? "jpeg" : "png";
|
|
1629
|
+
return res.json({
|
|
1630
|
+
ok: true,
|
|
1631
|
+
format,
|
|
1632
|
+
targetId: tab.targetId,
|
|
1633
|
+
url: tab.url,
|
|
1634
|
+
labels: true,
|
|
1635
|
+
labelsCount: labeled.labels,
|
|
1636
|
+
labelsSkipped: labeled.skipped,
|
|
1637
|
+
imagePath: path.resolve(saved.path),
|
|
1638
|
+
imageType,
|
|
1639
|
+
...snap
|
|
1640
|
+
});
|
|
1641
|
+
}
|
|
1642
|
+
return res.json({
|
|
1643
|
+
ok: true,
|
|
1644
|
+
format,
|
|
1645
|
+
targetId: tab.targetId,
|
|
1646
|
+
url: tab.url,
|
|
1647
|
+
...snap
|
|
1648
|
+
});
|
|
1649
|
+
}
|
|
1650
|
+
const snap = profileCtx.profile.driver === "extension" || !tab.wsUrl ? requirePwAi(res, "aria snapshot").then(async (pw) => {
|
|
1651
|
+
if (!pw) return null;
|
|
1652
|
+
return await pw.snapshotAriaViaPlaywright({
|
|
1653
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1654
|
+
targetId: tab.targetId,
|
|
1655
|
+
limit
|
|
1656
|
+
});
|
|
1657
|
+
}) : snapshotAria({
|
|
1658
|
+
wsUrl: tab.wsUrl ?? "",
|
|
1659
|
+
limit
|
|
1660
|
+
});
|
|
1661
|
+
const resolved = await Promise.resolve(snap);
|
|
1662
|
+
if (!resolved) return;
|
|
1663
|
+
return res.json({
|
|
1664
|
+
ok: true,
|
|
1665
|
+
format,
|
|
1666
|
+
targetId: tab.targetId,
|
|
1667
|
+
url: tab.url,
|
|
1668
|
+
...resolved
|
|
1669
|
+
});
|
|
1670
|
+
} catch (err) {
|
|
1671
|
+
handleRouteError(ctx, res, err);
|
|
1672
|
+
}
|
|
1673
|
+
});
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
//#endregion
|
|
1677
|
+
//#region src/browser/routes/agent.storage.ts
|
|
1678
|
+
function registerBrowserAgentStorageRoutes(app, ctx) {
|
|
1679
|
+
app.get("/cookies", async (req, res) => {
|
|
1680
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1681
|
+
if (!profileCtx) return;
|
|
1682
|
+
const targetId = typeof req.query.targetId === "string" ? req.query.targetId.trim() : "";
|
|
1683
|
+
try {
|
|
1684
|
+
const tab = await profileCtx.ensureTabAvailable(targetId || void 0);
|
|
1685
|
+
const pw = await requirePwAi(res, "cookies");
|
|
1686
|
+
if (!pw) return;
|
|
1687
|
+
const result = await pw.cookiesGetViaPlaywright({
|
|
1688
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1689
|
+
targetId: tab.targetId
|
|
1690
|
+
});
|
|
1691
|
+
res.json({
|
|
1692
|
+
ok: true,
|
|
1693
|
+
targetId: tab.targetId,
|
|
1694
|
+
...result
|
|
1695
|
+
});
|
|
1696
|
+
} catch (err) {
|
|
1697
|
+
handleRouteError(ctx, res, err);
|
|
1698
|
+
}
|
|
1699
|
+
});
|
|
1700
|
+
app.post("/cookies/set", async (req, res) => {
|
|
1701
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1702
|
+
if (!profileCtx) return;
|
|
1703
|
+
const body = readBody(req);
|
|
1704
|
+
const targetId = toStringOrEmpty(body.targetId) || void 0;
|
|
1705
|
+
const cookie = body.cookie && typeof body.cookie === "object" && !Array.isArray(body.cookie) ? body.cookie : null;
|
|
1706
|
+
if (!cookie) return jsonError(res, 400, "cookie is required");
|
|
1707
|
+
try {
|
|
1708
|
+
const tab = await profileCtx.ensureTabAvailable(targetId);
|
|
1709
|
+
const pw = await requirePwAi(res, "cookies set");
|
|
1710
|
+
if (!pw) return;
|
|
1711
|
+
await pw.cookiesSetViaPlaywright({
|
|
1712
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1713
|
+
targetId: tab.targetId,
|
|
1714
|
+
cookie: {
|
|
1715
|
+
name: toStringOrEmpty(cookie.name),
|
|
1716
|
+
value: toStringOrEmpty(cookie.value),
|
|
1717
|
+
url: toStringOrEmpty(cookie.url) || void 0,
|
|
1718
|
+
domain: toStringOrEmpty(cookie.domain) || void 0,
|
|
1719
|
+
path: toStringOrEmpty(cookie.path) || void 0,
|
|
1720
|
+
expires: toNumber(cookie.expires) ?? void 0,
|
|
1721
|
+
httpOnly: toBoolean(cookie.httpOnly) ?? void 0,
|
|
1722
|
+
secure: toBoolean(cookie.secure) ?? void 0,
|
|
1723
|
+
sameSite: cookie.sameSite === "Lax" || cookie.sameSite === "None" || cookie.sameSite === "Strict" ? cookie.sameSite : void 0
|
|
1724
|
+
}
|
|
1725
|
+
});
|
|
1726
|
+
res.json({
|
|
1727
|
+
ok: true,
|
|
1728
|
+
targetId: tab.targetId
|
|
1729
|
+
});
|
|
1730
|
+
} catch (err) {
|
|
1731
|
+
handleRouteError(ctx, res, err);
|
|
1732
|
+
}
|
|
1733
|
+
});
|
|
1734
|
+
app.post("/cookies/clear", async (req, res) => {
|
|
1735
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1736
|
+
if (!profileCtx) return;
|
|
1737
|
+
const targetId = toStringOrEmpty(readBody(req).targetId) || void 0;
|
|
1738
|
+
try {
|
|
1739
|
+
const tab = await profileCtx.ensureTabAvailable(targetId);
|
|
1740
|
+
const pw = await requirePwAi(res, "cookies clear");
|
|
1741
|
+
if (!pw) return;
|
|
1742
|
+
await pw.cookiesClearViaPlaywright({
|
|
1743
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1744
|
+
targetId: tab.targetId
|
|
1745
|
+
});
|
|
1746
|
+
res.json({
|
|
1747
|
+
ok: true,
|
|
1748
|
+
targetId: tab.targetId
|
|
1749
|
+
});
|
|
1750
|
+
} catch (err) {
|
|
1751
|
+
handleRouteError(ctx, res, err);
|
|
1752
|
+
}
|
|
1753
|
+
});
|
|
1754
|
+
app.get("/storage/:kind", async (req, res) => {
|
|
1755
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1756
|
+
if (!profileCtx) return;
|
|
1757
|
+
const kind = toStringOrEmpty(req.params.kind);
|
|
1758
|
+
if (kind !== "local" && kind !== "session") return jsonError(res, 400, "kind must be local|session");
|
|
1759
|
+
const targetId = typeof req.query.targetId === "string" ? req.query.targetId.trim() : "";
|
|
1760
|
+
const key = typeof req.query.key === "string" ? req.query.key : "";
|
|
1761
|
+
try {
|
|
1762
|
+
const tab = await profileCtx.ensureTabAvailable(targetId || void 0);
|
|
1763
|
+
const pw = await requirePwAi(res, "storage get");
|
|
1764
|
+
if (!pw) return;
|
|
1765
|
+
const result = await pw.storageGetViaPlaywright({
|
|
1766
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1767
|
+
targetId: tab.targetId,
|
|
1768
|
+
kind,
|
|
1769
|
+
key: key.trim() || void 0
|
|
1770
|
+
});
|
|
1771
|
+
res.json({
|
|
1772
|
+
ok: true,
|
|
1773
|
+
targetId: tab.targetId,
|
|
1774
|
+
...result
|
|
1775
|
+
});
|
|
1776
|
+
} catch (err) {
|
|
1777
|
+
handleRouteError(ctx, res, err);
|
|
1778
|
+
}
|
|
1779
|
+
});
|
|
1780
|
+
app.post("/storage/:kind/set", async (req, res) => {
|
|
1781
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1782
|
+
if (!profileCtx) return;
|
|
1783
|
+
const kind = toStringOrEmpty(req.params.kind);
|
|
1784
|
+
if (kind !== "local" && kind !== "session") return jsonError(res, 400, "kind must be local|session");
|
|
1785
|
+
const body = readBody(req);
|
|
1786
|
+
const targetId = toStringOrEmpty(body.targetId) || void 0;
|
|
1787
|
+
const key = toStringOrEmpty(body.key);
|
|
1788
|
+
if (!key) return jsonError(res, 400, "key is required");
|
|
1789
|
+
const value = typeof body.value === "string" ? body.value : "";
|
|
1790
|
+
try {
|
|
1791
|
+
const tab = await profileCtx.ensureTabAvailable(targetId);
|
|
1792
|
+
const pw = await requirePwAi(res, "storage set");
|
|
1793
|
+
if (!pw) return;
|
|
1794
|
+
await pw.storageSetViaPlaywright({
|
|
1795
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1796
|
+
targetId: tab.targetId,
|
|
1797
|
+
kind,
|
|
1798
|
+
key,
|
|
1799
|
+
value
|
|
1800
|
+
});
|
|
1801
|
+
res.json({
|
|
1802
|
+
ok: true,
|
|
1803
|
+
targetId: tab.targetId
|
|
1804
|
+
});
|
|
1805
|
+
} catch (err) {
|
|
1806
|
+
handleRouteError(ctx, res, err);
|
|
1807
|
+
}
|
|
1808
|
+
});
|
|
1809
|
+
app.post("/storage/:kind/clear", async (req, res) => {
|
|
1810
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1811
|
+
if (!profileCtx) return;
|
|
1812
|
+
const kind = toStringOrEmpty(req.params.kind);
|
|
1813
|
+
if (kind !== "local" && kind !== "session") return jsonError(res, 400, "kind must be local|session");
|
|
1814
|
+
const targetId = toStringOrEmpty(readBody(req).targetId) || void 0;
|
|
1815
|
+
try {
|
|
1816
|
+
const tab = await profileCtx.ensureTabAvailable(targetId);
|
|
1817
|
+
const pw = await requirePwAi(res, "storage clear");
|
|
1818
|
+
if (!pw) return;
|
|
1819
|
+
await pw.storageClearViaPlaywright({
|
|
1820
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1821
|
+
targetId: tab.targetId,
|
|
1822
|
+
kind
|
|
1823
|
+
});
|
|
1824
|
+
res.json({
|
|
1825
|
+
ok: true,
|
|
1826
|
+
targetId: tab.targetId
|
|
1827
|
+
});
|
|
1828
|
+
} catch (err) {
|
|
1829
|
+
handleRouteError(ctx, res, err);
|
|
1830
|
+
}
|
|
1831
|
+
});
|
|
1832
|
+
app.post("/set/offline", async (req, res) => {
|
|
1833
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1834
|
+
if (!profileCtx) return;
|
|
1835
|
+
const body = readBody(req);
|
|
1836
|
+
const targetId = toStringOrEmpty(body.targetId) || void 0;
|
|
1837
|
+
const offline = toBoolean(body.offline);
|
|
1838
|
+
if (offline === void 0) return jsonError(res, 400, "offline is required");
|
|
1839
|
+
try {
|
|
1840
|
+
const tab = await profileCtx.ensureTabAvailable(targetId);
|
|
1841
|
+
const pw = await requirePwAi(res, "offline");
|
|
1842
|
+
if (!pw) return;
|
|
1843
|
+
await pw.setOfflineViaPlaywright({
|
|
1844
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1845
|
+
targetId: tab.targetId,
|
|
1846
|
+
offline
|
|
1847
|
+
});
|
|
1848
|
+
res.json({
|
|
1849
|
+
ok: true,
|
|
1850
|
+
targetId: tab.targetId
|
|
1851
|
+
});
|
|
1852
|
+
} catch (err) {
|
|
1853
|
+
handleRouteError(ctx, res, err);
|
|
1854
|
+
}
|
|
1855
|
+
});
|
|
1856
|
+
app.post("/set/headers", async (req, res) => {
|
|
1857
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1858
|
+
if (!profileCtx) return;
|
|
1859
|
+
const body = readBody(req);
|
|
1860
|
+
const targetId = toStringOrEmpty(body.targetId) || void 0;
|
|
1861
|
+
const headers = body.headers && typeof body.headers === "object" && !Array.isArray(body.headers) ? body.headers : null;
|
|
1862
|
+
if (!headers) return jsonError(res, 400, "headers is required");
|
|
1863
|
+
const parsed = {};
|
|
1864
|
+
for (const [k, v] of Object.entries(headers)) if (typeof v === "string") parsed[k] = v;
|
|
1865
|
+
try {
|
|
1866
|
+
const tab = await profileCtx.ensureTabAvailable(targetId);
|
|
1867
|
+
const pw = await requirePwAi(res, "headers");
|
|
1868
|
+
if (!pw) return;
|
|
1869
|
+
await pw.setExtraHTTPHeadersViaPlaywright({
|
|
1870
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1871
|
+
targetId: tab.targetId,
|
|
1872
|
+
headers: parsed
|
|
1873
|
+
});
|
|
1874
|
+
res.json({
|
|
1875
|
+
ok: true,
|
|
1876
|
+
targetId: tab.targetId
|
|
1877
|
+
});
|
|
1878
|
+
} catch (err) {
|
|
1879
|
+
handleRouteError(ctx, res, err);
|
|
1880
|
+
}
|
|
1881
|
+
});
|
|
1882
|
+
app.post("/set/credentials", async (req, res) => {
|
|
1883
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1884
|
+
if (!profileCtx) return;
|
|
1885
|
+
const body = readBody(req);
|
|
1886
|
+
const targetId = toStringOrEmpty(body.targetId) || void 0;
|
|
1887
|
+
const clear = toBoolean(body.clear) ?? false;
|
|
1888
|
+
const username = toStringOrEmpty(body.username) || void 0;
|
|
1889
|
+
const password = typeof body.password === "string" ? body.password : void 0;
|
|
1890
|
+
try {
|
|
1891
|
+
const tab = await profileCtx.ensureTabAvailable(targetId);
|
|
1892
|
+
const pw = await requirePwAi(res, "http credentials");
|
|
1893
|
+
if (!pw) return;
|
|
1894
|
+
await pw.setHttpCredentialsViaPlaywright({
|
|
1895
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1896
|
+
targetId: tab.targetId,
|
|
1897
|
+
username,
|
|
1898
|
+
password,
|
|
1899
|
+
clear
|
|
1900
|
+
});
|
|
1901
|
+
res.json({
|
|
1902
|
+
ok: true,
|
|
1903
|
+
targetId: tab.targetId
|
|
1904
|
+
});
|
|
1905
|
+
} catch (err) {
|
|
1906
|
+
handleRouteError(ctx, res, err);
|
|
1907
|
+
}
|
|
1908
|
+
});
|
|
1909
|
+
app.post("/set/geolocation", async (req, res) => {
|
|
1910
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1911
|
+
if (!profileCtx) return;
|
|
1912
|
+
const body = readBody(req);
|
|
1913
|
+
const targetId = toStringOrEmpty(body.targetId) || void 0;
|
|
1914
|
+
const clear = toBoolean(body.clear) ?? false;
|
|
1915
|
+
const latitude = toNumber(body.latitude);
|
|
1916
|
+
const longitude = toNumber(body.longitude);
|
|
1917
|
+
const accuracy = toNumber(body.accuracy) ?? void 0;
|
|
1918
|
+
const origin = toStringOrEmpty(body.origin) || void 0;
|
|
1919
|
+
try {
|
|
1920
|
+
const tab = await profileCtx.ensureTabAvailable(targetId);
|
|
1921
|
+
const pw = await requirePwAi(res, "geolocation");
|
|
1922
|
+
if (!pw) return;
|
|
1923
|
+
await pw.setGeolocationViaPlaywright({
|
|
1924
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1925
|
+
targetId: tab.targetId,
|
|
1926
|
+
latitude,
|
|
1927
|
+
longitude,
|
|
1928
|
+
accuracy,
|
|
1929
|
+
origin,
|
|
1930
|
+
clear
|
|
1931
|
+
});
|
|
1932
|
+
res.json({
|
|
1933
|
+
ok: true,
|
|
1934
|
+
targetId: tab.targetId
|
|
1935
|
+
});
|
|
1936
|
+
} catch (err) {
|
|
1937
|
+
handleRouteError(ctx, res, err);
|
|
1938
|
+
}
|
|
1939
|
+
});
|
|
1940
|
+
app.post("/set/media", async (req, res) => {
|
|
1941
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1942
|
+
if (!profileCtx) return;
|
|
1943
|
+
const body = readBody(req);
|
|
1944
|
+
const targetId = toStringOrEmpty(body.targetId) || void 0;
|
|
1945
|
+
const schemeRaw = toStringOrEmpty(body.colorScheme);
|
|
1946
|
+
const colorScheme = schemeRaw === "dark" || schemeRaw === "light" || schemeRaw === "no-preference" ? schemeRaw : schemeRaw === "none" ? null : void 0;
|
|
1947
|
+
if (colorScheme === void 0) return jsonError(res, 400, "colorScheme must be dark|light|no-preference|none");
|
|
1948
|
+
try {
|
|
1949
|
+
const tab = await profileCtx.ensureTabAvailable(targetId);
|
|
1950
|
+
const pw = await requirePwAi(res, "media emulation");
|
|
1951
|
+
if (!pw) return;
|
|
1952
|
+
await pw.emulateMediaViaPlaywright({
|
|
1953
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1954
|
+
targetId: tab.targetId,
|
|
1955
|
+
colorScheme
|
|
1956
|
+
});
|
|
1957
|
+
res.json({
|
|
1958
|
+
ok: true,
|
|
1959
|
+
targetId: tab.targetId
|
|
1960
|
+
});
|
|
1961
|
+
} catch (err) {
|
|
1962
|
+
handleRouteError(ctx, res, err);
|
|
1963
|
+
}
|
|
1964
|
+
});
|
|
1965
|
+
app.post("/set/timezone", async (req, res) => {
|
|
1966
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1967
|
+
if (!profileCtx) return;
|
|
1968
|
+
const body = readBody(req);
|
|
1969
|
+
const targetId = toStringOrEmpty(body.targetId) || void 0;
|
|
1970
|
+
const timezoneId = toStringOrEmpty(body.timezoneId);
|
|
1971
|
+
if (!timezoneId) return jsonError(res, 400, "timezoneId is required");
|
|
1972
|
+
try {
|
|
1973
|
+
const tab = await profileCtx.ensureTabAvailable(targetId);
|
|
1974
|
+
const pw = await requirePwAi(res, "timezone");
|
|
1975
|
+
if (!pw) return;
|
|
1976
|
+
await pw.setTimezoneViaPlaywright({
|
|
1977
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
1978
|
+
targetId: tab.targetId,
|
|
1979
|
+
timezoneId
|
|
1980
|
+
});
|
|
1981
|
+
res.json({
|
|
1982
|
+
ok: true,
|
|
1983
|
+
targetId: tab.targetId
|
|
1984
|
+
});
|
|
1985
|
+
} catch (err) {
|
|
1986
|
+
handleRouteError(ctx, res, err);
|
|
1987
|
+
}
|
|
1988
|
+
});
|
|
1989
|
+
app.post("/set/locale", async (req, res) => {
|
|
1990
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
1991
|
+
if (!profileCtx) return;
|
|
1992
|
+
const body = readBody(req);
|
|
1993
|
+
const targetId = toStringOrEmpty(body.targetId) || void 0;
|
|
1994
|
+
const locale = toStringOrEmpty(body.locale);
|
|
1995
|
+
if (!locale) return jsonError(res, 400, "locale is required");
|
|
1996
|
+
try {
|
|
1997
|
+
const tab = await profileCtx.ensureTabAvailable(targetId);
|
|
1998
|
+
const pw = await requirePwAi(res, "locale");
|
|
1999
|
+
if (!pw) return;
|
|
2000
|
+
await pw.setLocaleViaPlaywright({
|
|
2001
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
2002
|
+
targetId: tab.targetId,
|
|
2003
|
+
locale
|
|
2004
|
+
});
|
|
2005
|
+
res.json({
|
|
2006
|
+
ok: true,
|
|
2007
|
+
targetId: tab.targetId
|
|
2008
|
+
});
|
|
2009
|
+
} catch (err) {
|
|
2010
|
+
handleRouteError(ctx, res, err);
|
|
2011
|
+
}
|
|
2012
|
+
});
|
|
2013
|
+
app.post("/set/device", async (req, res) => {
|
|
2014
|
+
const profileCtx = resolveProfileContext(req, res, ctx);
|
|
2015
|
+
if (!profileCtx) return;
|
|
2016
|
+
const body = readBody(req);
|
|
2017
|
+
const targetId = toStringOrEmpty(body.targetId) || void 0;
|
|
2018
|
+
const name = toStringOrEmpty(body.name);
|
|
2019
|
+
if (!name) return jsonError(res, 400, "name is required");
|
|
2020
|
+
try {
|
|
2021
|
+
const tab = await profileCtx.ensureTabAvailable(targetId);
|
|
2022
|
+
const pw = await requirePwAi(res, "device emulation");
|
|
2023
|
+
if (!pw) return;
|
|
2024
|
+
await pw.setDeviceViaPlaywright({
|
|
2025
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
2026
|
+
targetId: tab.targetId,
|
|
2027
|
+
name
|
|
2028
|
+
});
|
|
2029
|
+
res.json({
|
|
2030
|
+
ok: true,
|
|
2031
|
+
targetId: tab.targetId
|
|
2032
|
+
});
|
|
2033
|
+
} catch (err) {
|
|
2034
|
+
handleRouteError(ctx, res, err);
|
|
2035
|
+
}
|
|
2036
|
+
});
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2039
|
+
//#endregion
|
|
2040
|
+
//#region src/browser/routes/agent.ts
|
|
2041
|
+
function registerBrowserAgentRoutes(app, ctx) {
|
|
2042
|
+
registerBrowserAgentSnapshotRoutes(app, ctx);
|
|
2043
|
+
registerBrowserAgentActRoutes(app, ctx);
|
|
2044
|
+
registerBrowserAgentDebugRoutes(app, ctx);
|
|
2045
|
+
registerBrowserAgentStorageRoutes(app, ctx);
|
|
2046
|
+
}
|
|
2047
|
+
|
|
2048
|
+
//#endregion
|
|
2049
|
+
//#region src/browser/profiles-service.ts
|
|
2050
|
+
const HEX_COLOR_RE = /^#[0-9A-Fa-f]{6}$/;
|
|
2051
|
+
function createBrowserProfilesService(ctx) {
|
|
2052
|
+
const listProfiles = async () => {
|
|
2053
|
+
return await ctx.listProfiles();
|
|
2054
|
+
};
|
|
2055
|
+
const createProfile = async (params) => {
|
|
2056
|
+
const name = params.name.trim();
|
|
2057
|
+
const rawCdpUrl = params.cdpUrl?.trim() || void 0;
|
|
2058
|
+
const driver = params.driver === "extension" ? "extension" : void 0;
|
|
2059
|
+
if (!isValidProfileName(name)) throw new Error("invalid profile name: use lowercase letters, numbers, and hyphens only");
|
|
2060
|
+
const state = ctx.state();
|
|
2061
|
+
const resolvedProfiles = state.resolved.profiles;
|
|
2062
|
+
if (name in resolvedProfiles) throw new Error(`profile "${name}" already exists`);
|
|
2063
|
+
const cfg = loadConfig();
|
|
2064
|
+
const rawProfiles = cfg.browser?.profiles ?? {};
|
|
2065
|
+
if (name in rawProfiles) throw new Error(`profile "${name}" already exists`);
|
|
2066
|
+
const usedColors = getUsedColors(resolvedProfiles);
|
|
2067
|
+
const profileColor = params.color && HEX_COLOR_RE.test(params.color) ? params.color : allocateColor(usedColors);
|
|
2068
|
+
let profileConfig;
|
|
2069
|
+
if (rawCdpUrl) profileConfig = {
|
|
2070
|
+
cdpUrl: parseHttpUrl(rawCdpUrl, "browser.profiles.cdpUrl").normalized,
|
|
2071
|
+
...driver ? { driver } : {},
|
|
2072
|
+
color: profileColor
|
|
2073
|
+
};
|
|
2074
|
+
else {
|
|
2075
|
+
const cdpPort = allocateCdpPort(getUsedPorts(resolvedProfiles), deriveDefaultBrowserCdpPortRange(state.resolved.controlPort));
|
|
2076
|
+
if (cdpPort === null) throw new Error("no available CDP ports in range");
|
|
2077
|
+
profileConfig = {
|
|
2078
|
+
cdpPort,
|
|
2079
|
+
...driver ? { driver } : {},
|
|
2080
|
+
color: profileColor
|
|
2081
|
+
};
|
|
2082
|
+
}
|
|
2083
|
+
await writeConfigFile({
|
|
2084
|
+
...cfg,
|
|
2085
|
+
browser: {
|
|
2086
|
+
...cfg.browser,
|
|
2087
|
+
profiles: {
|
|
2088
|
+
...rawProfiles,
|
|
2089
|
+
[name]: profileConfig
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2092
|
+
});
|
|
2093
|
+
state.resolved.profiles[name] = profileConfig;
|
|
2094
|
+
const resolved = resolveProfile(state.resolved, name);
|
|
2095
|
+
if (!resolved) throw new Error(`profile "${name}" not found after creation`);
|
|
2096
|
+
return {
|
|
2097
|
+
ok: true,
|
|
2098
|
+
profile: name,
|
|
2099
|
+
cdpPort: resolved.cdpPort,
|
|
2100
|
+
cdpUrl: resolved.cdpUrl,
|
|
2101
|
+
color: resolved.color,
|
|
2102
|
+
isRemote: !resolved.cdpIsLoopback
|
|
2103
|
+
};
|
|
2104
|
+
};
|
|
2105
|
+
const deleteProfile = async (nameRaw) => {
|
|
2106
|
+
const name = nameRaw.trim();
|
|
2107
|
+
if (!name) throw new Error("profile name is required");
|
|
2108
|
+
if (!isValidProfileName(name)) throw new Error("invalid profile name");
|
|
2109
|
+
const cfg = loadConfig();
|
|
2110
|
+
const profiles = cfg.browser?.profiles ?? {};
|
|
2111
|
+
if (!(name in profiles)) throw new Error(`profile "${name}" not found`);
|
|
2112
|
+
if (name === (cfg.browser?.defaultProfile ?? DEFAULT_BROWSER_DEFAULT_PROFILE_NAME)) throw new Error(`cannot delete the default profile "${name}"; change browser.defaultProfile first`);
|
|
2113
|
+
let deleted = false;
|
|
2114
|
+
const state = ctx.state();
|
|
2115
|
+
if (resolveProfile(state.resolved, name)?.cdpIsLoopback) {
|
|
2116
|
+
try {
|
|
2117
|
+
await ctx.forProfile(name).stopRunningBrowser();
|
|
2118
|
+
} catch {}
|
|
2119
|
+
const userDataDir = resolveOpenClawUserDataDir(name);
|
|
2120
|
+
const profileDir = path.dirname(userDataDir);
|
|
2121
|
+
if (fs.existsSync(profileDir)) {
|
|
2122
|
+
await movePathToTrash(profileDir);
|
|
2123
|
+
deleted = true;
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
2126
|
+
const { [name]: _removed, ...remainingProfiles } = profiles;
|
|
2127
|
+
await writeConfigFile({
|
|
2128
|
+
...cfg,
|
|
2129
|
+
browser: {
|
|
2130
|
+
...cfg.browser,
|
|
2131
|
+
profiles: remainingProfiles
|
|
2132
|
+
}
|
|
2133
|
+
});
|
|
2134
|
+
delete state.resolved.profiles[name];
|
|
2135
|
+
state.profiles.delete(name);
|
|
2136
|
+
return {
|
|
2137
|
+
ok: true,
|
|
2138
|
+
profile: name,
|
|
2139
|
+
deleted
|
|
2140
|
+
};
|
|
2141
|
+
};
|
|
2142
|
+
return {
|
|
2143
|
+
listProfiles,
|
|
2144
|
+
createProfile,
|
|
2145
|
+
deleteProfile
|
|
2146
|
+
};
|
|
2147
|
+
}
|
|
2148
|
+
|
|
2149
|
+
//#endregion
|
|
2150
|
+
//#region src/browser/routes/basic.ts
|
|
2151
|
+
function registerBrowserBasicRoutes(app, ctx) {
|
|
2152
|
+
app.get("/profiles", async (_req, res) => {
|
|
2153
|
+
try {
|
|
2154
|
+
const profiles = await createBrowserProfilesService(ctx).listProfiles();
|
|
2155
|
+
res.json({ profiles });
|
|
2156
|
+
} catch (err) {
|
|
2157
|
+
jsonError(res, 500, String(err));
|
|
2158
|
+
}
|
|
2159
|
+
});
|
|
2160
|
+
app.get("/", async (req, res) => {
|
|
2161
|
+
let current;
|
|
2162
|
+
try {
|
|
2163
|
+
current = ctx.state();
|
|
2164
|
+
} catch {
|
|
2165
|
+
return jsonError(res, 503, "browser server not started");
|
|
2166
|
+
}
|
|
2167
|
+
const profileCtx = getProfileContext(req, ctx);
|
|
2168
|
+
if ("error" in profileCtx) return jsonError(res, profileCtx.status, profileCtx.error);
|
|
2169
|
+
const [cdpHttp, cdpReady] = await Promise.all([profileCtx.isHttpReachable(300), profileCtx.isReachable(600)]);
|
|
2170
|
+
const profileState = current.profiles.get(profileCtx.profile.name);
|
|
2171
|
+
let detectedBrowser = null;
|
|
2172
|
+
let detectedExecutablePath = null;
|
|
2173
|
+
let detectError = null;
|
|
2174
|
+
try {
|
|
2175
|
+
const detected = resolveBrowserExecutableForPlatform(current.resolved, process.platform);
|
|
2176
|
+
if (detected) {
|
|
2177
|
+
detectedBrowser = detected.kind;
|
|
2178
|
+
detectedExecutablePath = detected.path;
|
|
2179
|
+
}
|
|
2180
|
+
} catch (err) {
|
|
2181
|
+
detectError = String(err);
|
|
2182
|
+
}
|
|
2183
|
+
res.json({
|
|
2184
|
+
enabled: current.resolved.enabled,
|
|
2185
|
+
profile: profileCtx.profile.name,
|
|
2186
|
+
running: cdpReady,
|
|
2187
|
+
cdpReady,
|
|
2188
|
+
cdpHttp,
|
|
2189
|
+
pid: profileState?.running?.pid ?? null,
|
|
2190
|
+
cdpPort: profileCtx.profile.cdpPort,
|
|
2191
|
+
cdpUrl: profileCtx.profile.cdpUrl,
|
|
2192
|
+
chosenBrowser: profileState?.running?.exe.kind ?? null,
|
|
2193
|
+
detectedBrowser,
|
|
2194
|
+
detectedExecutablePath,
|
|
2195
|
+
detectError,
|
|
2196
|
+
userDataDir: profileState?.running?.userDataDir ?? null,
|
|
2197
|
+
color: profileCtx.profile.color,
|
|
2198
|
+
headless: current.resolved.headless,
|
|
2199
|
+
noSandbox: current.resolved.noSandbox,
|
|
2200
|
+
executablePath: current.resolved.executablePath ?? null,
|
|
2201
|
+
attachOnly: current.resolved.attachOnly
|
|
2202
|
+
});
|
|
2203
|
+
});
|
|
2204
|
+
app.post("/start", async (req, res) => {
|
|
2205
|
+
const profileCtx = getProfileContext(req, ctx);
|
|
2206
|
+
if ("error" in profileCtx) return jsonError(res, profileCtx.status, profileCtx.error);
|
|
2207
|
+
try {
|
|
2208
|
+
await profileCtx.ensureBrowserAvailable();
|
|
2209
|
+
res.json({
|
|
2210
|
+
ok: true,
|
|
2211
|
+
profile: profileCtx.profile.name
|
|
2212
|
+
});
|
|
2213
|
+
} catch (err) {
|
|
2214
|
+
jsonError(res, 500, String(err));
|
|
2215
|
+
}
|
|
2216
|
+
});
|
|
2217
|
+
app.post("/stop", async (req, res) => {
|
|
2218
|
+
const profileCtx = getProfileContext(req, ctx);
|
|
2219
|
+
if ("error" in profileCtx) return jsonError(res, profileCtx.status, profileCtx.error);
|
|
2220
|
+
try {
|
|
2221
|
+
const result = await profileCtx.stopRunningBrowser();
|
|
2222
|
+
res.json({
|
|
2223
|
+
ok: true,
|
|
2224
|
+
stopped: result.stopped,
|
|
2225
|
+
profile: profileCtx.profile.name
|
|
2226
|
+
});
|
|
2227
|
+
} catch (err) {
|
|
2228
|
+
jsonError(res, 500, String(err));
|
|
2229
|
+
}
|
|
2230
|
+
});
|
|
2231
|
+
app.post("/reset-profile", async (req, res) => {
|
|
2232
|
+
const profileCtx = getProfileContext(req, ctx);
|
|
2233
|
+
if ("error" in profileCtx) return jsonError(res, profileCtx.status, profileCtx.error);
|
|
2234
|
+
try {
|
|
2235
|
+
const result = await profileCtx.resetProfile();
|
|
2236
|
+
res.json({
|
|
2237
|
+
ok: true,
|
|
2238
|
+
profile: profileCtx.profile.name,
|
|
2239
|
+
...result
|
|
2240
|
+
});
|
|
2241
|
+
} catch (err) {
|
|
2242
|
+
jsonError(res, 500, String(err));
|
|
2243
|
+
}
|
|
2244
|
+
});
|
|
2245
|
+
app.post("/profiles/create", async (req, res) => {
|
|
2246
|
+
const name = toStringOrEmpty(req.body?.name);
|
|
2247
|
+
const color = toStringOrEmpty(req.body?.color);
|
|
2248
|
+
const cdpUrl = toStringOrEmpty(req.body?.cdpUrl);
|
|
2249
|
+
const driver = toStringOrEmpty(req.body?.driver);
|
|
2250
|
+
if (!name) return jsonError(res, 400, "name is required");
|
|
2251
|
+
try {
|
|
2252
|
+
const result = await createBrowserProfilesService(ctx).createProfile({
|
|
2253
|
+
name,
|
|
2254
|
+
color: color || void 0,
|
|
2255
|
+
cdpUrl: cdpUrl || void 0,
|
|
2256
|
+
driver: driver === "extension" ? "extension" : void 0
|
|
2257
|
+
});
|
|
2258
|
+
res.json(result);
|
|
2259
|
+
} catch (err) {
|
|
2260
|
+
const msg = String(err);
|
|
2261
|
+
if (msg.includes("already exists")) return jsonError(res, 409, msg);
|
|
2262
|
+
if (msg.includes("invalid profile name")) return jsonError(res, 400, msg);
|
|
2263
|
+
if (msg.includes("no available CDP ports")) return jsonError(res, 507, msg);
|
|
2264
|
+
if (msg.includes("cdpUrl")) return jsonError(res, 400, msg);
|
|
2265
|
+
jsonError(res, 500, msg);
|
|
2266
|
+
}
|
|
2267
|
+
});
|
|
2268
|
+
app.delete("/profiles/:name", async (req, res) => {
|
|
2269
|
+
const name = toStringOrEmpty(req.params.name);
|
|
2270
|
+
if (!name) return jsonError(res, 400, "profile name is required");
|
|
2271
|
+
try {
|
|
2272
|
+
const result = await createBrowserProfilesService(ctx).deleteProfile(name);
|
|
2273
|
+
res.json(result);
|
|
2274
|
+
} catch (err) {
|
|
2275
|
+
const msg = String(err);
|
|
2276
|
+
if (msg.includes("invalid profile name")) return jsonError(res, 400, msg);
|
|
2277
|
+
if (msg.includes("default profile")) return jsonError(res, 400, msg);
|
|
2278
|
+
if (msg.includes("not found")) return jsonError(res, 404, msg);
|
|
2279
|
+
jsonError(res, 500, msg);
|
|
2280
|
+
}
|
|
2281
|
+
});
|
|
2282
|
+
}
|
|
2283
|
+
|
|
2284
|
+
//#endregion
|
|
2285
|
+
//#region src/browser/routes/tabs.ts
|
|
2286
|
+
function registerBrowserTabRoutes(app, ctx) {
|
|
2287
|
+
app.get("/tabs", async (req, res) => {
|
|
2288
|
+
const profileCtx = getProfileContext(req, ctx);
|
|
2289
|
+
if ("error" in profileCtx) return jsonError(res, profileCtx.status, profileCtx.error);
|
|
2290
|
+
try {
|
|
2291
|
+
if (!await profileCtx.isReachable(300)) return res.json({
|
|
2292
|
+
running: false,
|
|
2293
|
+
tabs: []
|
|
2294
|
+
});
|
|
2295
|
+
const tabs = await profileCtx.listTabs();
|
|
2296
|
+
res.json({
|
|
2297
|
+
running: true,
|
|
2298
|
+
tabs
|
|
2299
|
+
});
|
|
2300
|
+
} catch (err) {
|
|
2301
|
+
jsonError(res, 500, String(err));
|
|
2302
|
+
}
|
|
2303
|
+
});
|
|
2304
|
+
app.post("/tabs/open", async (req, res) => {
|
|
2305
|
+
const profileCtx = getProfileContext(req, ctx);
|
|
2306
|
+
if ("error" in profileCtx) return jsonError(res, profileCtx.status, profileCtx.error);
|
|
2307
|
+
const url = toStringOrEmpty(req.body?.url);
|
|
2308
|
+
if (!url) return jsonError(res, 400, "url is required");
|
|
2309
|
+
try {
|
|
2310
|
+
await profileCtx.ensureBrowserAvailable();
|
|
2311
|
+
const tab = await profileCtx.openTab(url);
|
|
2312
|
+
res.json(tab);
|
|
2313
|
+
} catch (err) {
|
|
2314
|
+
jsonError(res, 500, String(err));
|
|
2315
|
+
}
|
|
2316
|
+
});
|
|
2317
|
+
app.post("/tabs/focus", async (req, res) => {
|
|
2318
|
+
const profileCtx = getProfileContext(req, ctx);
|
|
2319
|
+
if ("error" in profileCtx) return jsonError(res, profileCtx.status, profileCtx.error);
|
|
2320
|
+
const targetId = toStringOrEmpty(req.body?.targetId);
|
|
2321
|
+
if (!targetId) return jsonError(res, 400, "targetId is required");
|
|
2322
|
+
try {
|
|
2323
|
+
if (!await profileCtx.isReachable(300)) return jsonError(res, 409, "browser not running");
|
|
2324
|
+
await profileCtx.focusTab(targetId);
|
|
2325
|
+
res.json({ ok: true });
|
|
2326
|
+
} catch (err) {
|
|
2327
|
+
const mapped = ctx.mapTabError(err);
|
|
2328
|
+
if (mapped) return jsonError(res, mapped.status, mapped.message);
|
|
2329
|
+
jsonError(res, 500, String(err));
|
|
2330
|
+
}
|
|
2331
|
+
});
|
|
2332
|
+
app.delete("/tabs/:targetId", async (req, res) => {
|
|
2333
|
+
const profileCtx = getProfileContext(req, ctx);
|
|
2334
|
+
if ("error" in profileCtx) return jsonError(res, profileCtx.status, profileCtx.error);
|
|
2335
|
+
const targetId = toStringOrEmpty(req.params.targetId);
|
|
2336
|
+
if (!targetId) return jsonError(res, 400, "targetId is required");
|
|
2337
|
+
try {
|
|
2338
|
+
if (!await profileCtx.isReachable(300)) return jsonError(res, 409, "browser not running");
|
|
2339
|
+
await profileCtx.closeTab(targetId);
|
|
2340
|
+
res.json({ ok: true });
|
|
2341
|
+
} catch (err) {
|
|
2342
|
+
const mapped = ctx.mapTabError(err);
|
|
2343
|
+
if (mapped) return jsonError(res, mapped.status, mapped.message);
|
|
2344
|
+
jsonError(res, 500, String(err));
|
|
2345
|
+
}
|
|
2346
|
+
});
|
|
2347
|
+
app.post("/tabs/action", async (req, res) => {
|
|
2348
|
+
const profileCtx = getProfileContext(req, ctx);
|
|
2349
|
+
if ("error" in profileCtx) return jsonError(res, profileCtx.status, profileCtx.error);
|
|
2350
|
+
const action = toStringOrEmpty(req.body?.action);
|
|
2351
|
+
const index = toNumber(req.body?.index);
|
|
2352
|
+
try {
|
|
2353
|
+
if (action === "list") {
|
|
2354
|
+
if (!await profileCtx.isReachable(300)) return res.json({
|
|
2355
|
+
ok: true,
|
|
2356
|
+
tabs: []
|
|
2357
|
+
});
|
|
2358
|
+
const tabs = await profileCtx.listTabs();
|
|
2359
|
+
return res.json({
|
|
2360
|
+
ok: true,
|
|
2361
|
+
tabs
|
|
2362
|
+
});
|
|
2363
|
+
}
|
|
2364
|
+
if (action === "new") {
|
|
2365
|
+
await profileCtx.ensureBrowserAvailable();
|
|
2366
|
+
const tab = await profileCtx.openTab("about:blank");
|
|
2367
|
+
return res.json({
|
|
2368
|
+
ok: true,
|
|
2369
|
+
tab
|
|
2370
|
+
});
|
|
2371
|
+
}
|
|
2372
|
+
if (action === "close") {
|
|
2373
|
+
const tabs = await profileCtx.listTabs();
|
|
2374
|
+
const target = typeof index === "number" ? tabs[index] : tabs.at(0);
|
|
2375
|
+
if (!target) return jsonError(res, 404, "tab not found");
|
|
2376
|
+
await profileCtx.closeTab(target.targetId);
|
|
2377
|
+
return res.json({
|
|
2378
|
+
ok: true,
|
|
2379
|
+
targetId: target.targetId
|
|
2380
|
+
});
|
|
2381
|
+
}
|
|
2382
|
+
if (action === "select") {
|
|
2383
|
+
if (typeof index !== "number") return jsonError(res, 400, "index is required");
|
|
2384
|
+
const target = (await profileCtx.listTabs())[index];
|
|
2385
|
+
if (!target) return jsonError(res, 404, "tab not found");
|
|
2386
|
+
await profileCtx.focusTab(target.targetId);
|
|
2387
|
+
return res.json({
|
|
2388
|
+
ok: true,
|
|
2389
|
+
targetId: target.targetId
|
|
2390
|
+
});
|
|
2391
|
+
}
|
|
2392
|
+
return jsonError(res, 400, "unknown tab action");
|
|
2393
|
+
} catch (err) {
|
|
2394
|
+
const mapped = ctx.mapTabError(err);
|
|
2395
|
+
if (mapped) return jsonError(res, mapped.status, mapped.message);
|
|
2396
|
+
jsonError(res, 500, String(err));
|
|
2397
|
+
}
|
|
2398
|
+
});
|
|
2399
|
+
}
|
|
2400
|
+
|
|
2401
|
+
//#endregion
|
|
2402
|
+
//#region src/browser/routes/index.ts
|
|
2403
|
+
function registerBrowserRoutes(app, ctx) {
|
|
2404
|
+
registerBrowserBasicRoutes(app, ctx);
|
|
2405
|
+
registerBrowserTabRoutes(app, ctx);
|
|
2406
|
+
registerBrowserAgentRoutes(app, ctx);
|
|
2407
|
+
}
|
|
2408
|
+
|
|
2409
|
+
//#endregion
|
|
2410
|
+
export { mediaKindFromMime as C, maxBytesForKind as S, imageMimeFromFormat as _, closeDispatcher as a, kindFromMime as b, resolvePinnedHostnameWithPolicy as c, hasAlphaChannel as d, optimizeImageToPng as f, getFileExtension as g, extensionForMime as h, SsrFBlockedError as i, convertHeicToJpeg as l, detectMime as m, getMediaDir as n, createPinnedDispatcher as o, resizeToJpeg as p, saveMediaBuffer as r, resolvePinnedHostname as s, registerBrowserRoutes as t, getImageMetadata as u, isAudioFileName as v, MAX_IMAGE_BYTES as x, isGifMedia as y };
|