@xopcai/xopc 0.0.250 → 0.0.252
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/README.md +8 -5
- package/README.zh-CN.md +8 -5
- package/dist/browser-ext/dist/background.js +358 -768
- package/dist/browser-ext/manifest.json +1 -2
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-DfBjTSo9.js → activity-store-w3eq3YpP.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BN6FJXkJ.js → agent-avatar-dicebear-k039rbUz.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-C7rZH1A2.js → agent-defaults-settings-panel-D4J4oq8p.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-CgGaoo4z.js → agents-Bmth_bSQ.js} +1 -1
- package/dist/gateway/static/root/assets/{api-zxpcJfgj.js → api-2joIfbrH.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-D2gMshuS.js → app-management-settings-panel-ByJ4kiD0.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-wMu0jSKx.js → appearance-settings-BK2Jga-B.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-B3ky7cWU.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-u6EE3JV8.js → archive-plugin-DMDKtYpi.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-DbJurnv-.js → attachment-load-B764Ql3Z.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-Ew_e5HDn.js → automations-page-D-sO8CZe.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-Ds5-_-9z.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-DtDFNfPM.js → binary-plugins-fxtzYRpv.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CnAwmabq.js → block-editor-Bcjtvckh.js} +50 -50
- package/dist/gateway/static/root/assets/browser-automation-inputs-BSmnusjD.js +1 -0
- package/dist/gateway/static/root/assets/browser-automations-page-DC_OQIBk.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-C1FojyG6.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-Bs59UCut.js +7 -0
- package/dist/gateway/static/root/assets/channels-settings-CM9vNmoo.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-CX-yWwLD.js → channels-status-swr-BuWjIG_a.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CryTDNdD.js → chat-terminal-dock-5SevEo_I.js} +2 -2
- package/dist/gateway/static/root/assets/connectors-page-BPZ44D-V.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-ji5aWrjG.js → cron-expression-DtsfalBM.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-Dro_w3eX.js → date-picker-tDEQV5TP.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-Ce19KKnX.js → dependency-picker-HhNwg0Y2.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DsSi-3uZ.js → desktop-pet-acU4Li-C.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-8WQ4woJy.js → desktop-pet-settings-R84AR0Pe.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CgvEBfLZ.js → extension-debug-page-CrLlRkSN.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DkznBbMj.js → extension-page-BH5lmZXE.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BOjhchK2.js → extension-settings-page-BscjNAd1.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-CMNbl0FZ.js → gateway-config-swr-9HidFZUd.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-BxLcW6ij.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CR7Xg8As.js → gateway-startup-retry-DRCPXONr.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-K5Zhl2rx.js +1 -0
- package/dist/gateway/static/root/assets/home-page-CZAg9RBv.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-C5mn73ca.js → image-generation-api-CR6Kle8H.js} +1 -1
- package/dist/gateway/static/root/assets/index-D4Ykja-U.js +72 -0
- package/dist/gateway/static/root/assets/index-zIJ3AXgR.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BYhfzsqe.js → keyboard-shortcuts-settings-B1QR49-7.js} +1 -1
- package/dist/gateway/static/root/assets/languages-5WaOu0Lf.js +2 -0
- package/dist/gateway/static/root/assets/local-app-workbench-page-wicoV-ti.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-vBlknU7C.js → local-apps-page-C74It-T8.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-CF4erhjB.js → locale-store-BfZGZKSs.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-xX-7S49A.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-Dnx6mSNe.js → management-settings-1kNnYL97.js} +1 -1
- package/dist/gateway/static/root/assets/markdown-editor-BjMTIM-m.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-CQvzsE24.js → markdown-view-DjiwT28p.js} +2 -2
- package/dist/gateway/static/root/assets/{media-plugins-DrMYeHe7.js → media-plugins-B5c0AoS1.js} +1 -1
- package/dist/gateway/static/root/assets/messages-DaIwVWar.js +3 -0
- package/dist/gateway/static/root/assets/{mobile-pairing-wizard-AKgGy3Kx.js → mobile-pairing-wizard-CsIZqK51.js} +1 -1
- package/dist/gateway/static/root/assets/note-detail-panel-CfWxopl4.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-CYN-LCHJ.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-CX9T71by.js → page-tabs-CqJN6Ljz.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-DvEHoimN.js → preview-open-alternatives-DqRIGxf4.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-COcr_NUJ.js → product-open-page-DE2nPE_K.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-B5G3LzDq.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-CuVK2mKu.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BsRBlji7.js → registry-api-Bpy8XX-5.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Dnd73xWt.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CQ13P-mS.js → runtime-tools-settings-panel-Bb4b74-P.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-BUVyTpZj.js → schema-form-DoPU5j3J.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-XL4LyKZe.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-0ForzDSS.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-DVY-8_B9.js → settings-form-section-Ci-9WajJ.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-CdiVYyTl.js → settings-page-CL_2F95D.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DVws6XZc.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-C88YLKm4.js → share-preview-page-XUA3oKQX.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-BwDvcacF.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-BJjrATqE.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-DLir1nM0.js → skills-page-sXXAZDc9.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-BMZAfS3G.js → skills-page.utils-DD79Bl1I.js} +1 -1
- package/dist/gateway/static/root/assets/source-workspace-editor-CVWzt0oT.js +1 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-BM8ivYan.js → system-settings-panel-BEH64qBV.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-0jxMi75O.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-BOgkc_9D.js → theme-store-CISSxU1c.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-DemxChjo.js → tunnel-api-DrKDhnJm.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-CV3Ui5hu.js → use-autosave-CPYePL-Q.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-B6zLDfDl.js +2 -0
- package/dist/gateway/static/root/assets/{vendor-codemirror--gTq3YAI.js → vendor-codemirror-Qdcjid65.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-CUoCi4Sq.js → voice-api-key-field-DKqzrCXx.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-C-ryeIxj.js → voice-config-api-e9xWjwBX.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BhDlkCMB.js → work-discovery-overlay-kTQug6bq.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D8CcPc_C.js → workflow-run-setup-panel-m9SKj_GT.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-Bcd1XqP7.js +5 -0
- package/dist/gateway/static/root/index.html +10 -10
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/new-session.js +9 -0
- package/dist/src/agent/agent-manager.d.ts +2 -1
- package/dist/src/agent/agent-manager.js +2 -1
- package/dist/src/agent/coding/repository-instructions.js +2 -2
- package/dist/src/agent/coding/workspace-revision.js +2 -2
- package/dist/src/agent/commands/command-isolation.js +2 -2
- package/dist/src/agent/external-tools/composio-provider.d.ts +1 -0
- package/dist/src/agent/external-tools/composio-provider.js +64 -34
- package/dist/src/agent/external-tools/search-error.js +5 -3
- package/dist/src/agent/service.js +2 -1
- package/dist/src/agent/service.types.d.ts +2 -1
- package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +4 -0
- package/dist/src/agent/tool-manuals/browser.d.ts +1 -1
- package/dist/src/agent/tool-manuals/browser.js +15 -226
- package/dist/src/agent/tools/browser/tool/browser-use-tool.d.ts +4 -21
- package/dist/src/agent/tools/browser/tool/browser-use-tool.js +48 -165
- package/dist/src/agent/tools/browser/tool/schemas.d.ts +203 -16
- package/dist/src/agent/tools/browser/tool/schemas.js +146 -16
- package/dist/src/agent/tools/browser-automation-tool.d.ts +121 -0
- package/dist/src/agent/tools/browser-automation-tool.js +197 -0
- package/dist/src/agent/tools/factory.d.ts +6 -9
- package/dist/src/agent/tools/factory.js +28 -55
- package/dist/src/agent/tools/index.d.ts +2 -2
- package/dist/src/agent/tools/index.js +3 -3
- package/dist/src/agent/tools/review-workspace.js +2 -2
- package/dist/src/auth/oauth/xopc-cloud.js +3 -1
- package/dist/src/automations/domain/defaults.js +1 -1
- package/dist/src/automations/domain/types.d.ts +5 -5
- package/dist/src/automations/domain/validation.d.ts +12 -12
- package/dist/src/automations/domain/validation.js +3 -3
- package/dist/src/automations/draft/automation-draft-validator.d.ts +3 -3
- package/dist/src/automations/draft/automation-draft-validator.js +1 -1
- package/dist/src/automations/service/action-executor.d.ts +1 -1
- package/dist/src/automations/service/action-executor.js +7 -7
- package/dist/src/browser/{recipes → automations}/index.d.ts +1 -0
- package/dist/src/browser/automations/index.js +4 -0
- package/dist/src/browser/automations/repository.d.ts +13 -0
- package/dist/src/browser/automations/repository.js +60 -0
- package/dist/src/browser/automations/runner.d.ts +17 -0
- package/dist/src/browser/automations/runner.js +173 -0
- package/dist/src/browser/automations/runtime-service.d.ts +6 -0
- package/dist/src/browser/automations/runtime-service.js +37 -0
- package/dist/src/browser/automations/schema.d.ts +144 -0
- package/dist/src/browser/automations/schema.js +135 -0
- package/dist/src/browser/automations/service.d.ts +146 -0
- package/dist/src/browser/automations/service.js +168 -0
- package/dist/src/browser/automations/types.d.ts +90 -0
- package/dist/src/browser/cache-dir-policy.d.ts +1 -1
- package/dist/src/browser/cache-dir-policy.js +1 -4
- package/dist/src/browser/drivers/browser-driver.d.ts +17 -0
- package/dist/src/browser/drivers/create-driver.d.ts +3 -0
- package/dist/src/browser/drivers/create-driver.js +84 -0
- package/dist/src/browser/drivers/extension-driver.d.ts +20 -0
- package/dist/src/browser/drivers/extension-driver.js +47 -0
- package/dist/src/browser/drivers/playwright-driver.d.ts +38 -0
- package/dist/src/browser/drivers/playwright-driver.js +406 -0
- package/dist/src/browser/index.d.ts +10 -15
- package/dist/src/browser/index.js +10 -15
- package/dist/src/browser/install-lock.d.ts +1 -2
- package/dist/src/browser/install-lock.js +3 -9
- package/dist/src/browser/install-progress.d.ts +1 -1
- package/dist/src/browser/observation/format.d.ts +2 -0
- package/dist/src/browser/observation/format.js +26 -0
- package/dist/src/browser/policy/approval-store.d.ts +17 -0
- package/dist/src/browser/policy/approval-store.js +62 -0
- package/dist/src/browser/policy/browser-policy.d.ts +3 -0
- package/dist/src/browser/policy/browser-policy.js +27 -0
- package/dist/src/browser/providers/browser-ext-install.d.ts +1 -1
- package/dist/src/browser/providers/browser-ext-install.js +3 -5
- package/dist/src/browser/providers/browser-use.js +1 -1
- package/dist/src/browser/providers/browserbase.js +1 -1
- package/dist/src/browser/providers/extension-ws-acquire.d.ts +1 -4
- package/dist/src/browser/providers/extension-ws-acquire.js +1 -13
- package/dist/src/browser/providers/extension.d.ts +3 -22
- package/dist/src/browser/providers/extension.js +7 -15
- package/dist/src/browser/providers/index.d.ts +2 -2
- package/dist/src/browser/providers/index.js +3 -3
- package/dist/src/browser/providers/types.d.ts +0 -94
- package/dist/src/browser/readiness.d.ts +4 -22
- package/dist/src/browser/readiness.js +55 -118
- package/dist/src/browser/runtime/browser-runtime.d.ts +30 -0
- package/dist/src/browser/runtime/browser-runtime.js +362 -0
- package/dist/src/browser/url-policy.d.ts +3 -3
- package/dist/src/browser/url-policy.js +7 -6
- package/dist/src/browser/verification/expectation.d.ts +2 -0
- package/dist/src/browser/verification/expectation.js +17 -0
- package/dist/src/cli/command-loaders.js +1 -0
- package/dist/src/cli/command-manifest.js +5 -1
- package/dist/src/cli/commands/browser-cli-helpers.d.ts +0 -6
- package/dist/src/cli/commands/browser-cli-helpers.js +11 -144
- package/dist/src/cli/commands/browser.d.ts +0 -5
- package/dist/src/cli/commands/browser.js +11 -152
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/node-version.js +25 -9
- package/dist/src/cli/commands/platform.d.ts +1 -0
- package/dist/src/cli/commands/platform.js +111 -0
- package/dist/src/config/loader.js +9 -3
- package/dist/src/config/schema.d.ts +131 -84
- package/dist/src/config/schema.js +112 -59
- package/dist/src/connectors/composio-sessions.js +1 -3
- package/dist/src/extensions/marketplace.js +4 -0
- package/dist/src/files/file-service.js +139 -14
- package/dist/src/gateway/hono/lib/config-payload.d.ts +12 -26
- package/dist/src/gateway/hono/lib/config-payload.js +10 -39
- package/dist/src/gateway/hono/routes/browser-automations.d.ts +3 -0
- package/dist/src/gateway/hono/routes/browser-automations.js +77 -0
- package/dist/src/gateway/hono/routes/browser-install.js +0 -32
- package/dist/src/gateway/hono/routes/browser.d.ts +0 -17
- package/dist/src/gateway/hono/routes/browser.js +46 -568
- package/dist/src/gateway/hono/routes/config-patch/misc.js +8 -1
- package/dist/src/gateway/hono/routes/config.js +0 -11
- package/dist/src/gateway/hono/routes/lazy-bundles.js +5 -5
- package/dist/src/gateway/service.d.ts +4 -6
- package/dist/src/gateway/service.js +20 -23
- package/dist/src/platform/client.d.ts +121 -0
- package/dist/src/platform/client.js +108 -0
- package/dist/src/platform/contracts.d.ts +194 -0
- package/dist/src/platform/contracts.js +150 -0
- package/dist/src/platform/index.d.ts +4 -0
- package/dist/src/platform/index.js +9 -0
- package/dist/src/platform/resolution.d.ts +4 -0
- package/dist/src/platform/resolution.js +16 -0
- package/dist/src/platform/worker.d.ts +6 -0
- package/dist/src/platform/worker.js +75 -0
- package/dist/src/providers/xopc-cloud-config.js +3 -1
- package/dist/src/session/session-context-for-llm.js +41 -1
- package/dist/src/share/hosted-session-share.js +3 -1
- package/dist/src/share/share-thumbnail.js +1 -1
- package/dist/src/storage/sqlite/migrations/153_browser_control_v2.sql +45 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +16 -20
- package/dist/src/tasks/home-query-service.js +1 -1
- package/dist/src/tunnel/env.js +3 -1
- package/dist/src/voice/realtime/agentEngine.js +0 -1
- package/package.json +7 -7
- package/dist/gateway/static/root/assets/apps-page-KF1Gnv36.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-Ch-ldu35.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-DtVhsHJW.js +0 -8
- package/dist/gateway/static/root/assets/browser-workflow-inputs-BX1-uM9L.js +0 -1
- package/dist/gateway/static/root/assets/browser-workflows-page-CcbUOWDF.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel--sXeylhe.js +0 -7
- package/dist/gateway/static/root/assets/channels-settings-AXSBDujZ.js +0 -1
- package/dist/gateway/static/root/assets/code-editor-D4_k-6QN.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-HBHUWohz.js +0 -2
- package/dist/gateway/static/root/assets/gateway-config-api-OEruhhX3.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-BgH3A0LO.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-C97naDkO.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BBKKme4G.js +0 -1
- package/dist/gateway/static/root/assets/html-workspace-editor-C3DKAkMc.js +0 -1
- package/dist/gateway/static/root/assets/index-BcaF-dgQ.js +0 -72
- package/dist/gateway/static/root/assets/index-DAryGvZ7.css +0 -2
- package/dist/gateway/static/root/assets/local-app-workbench-page-DNncc2tn.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-CizZInrT.js +0 -2
- package/dist/gateway/static/root/assets/markdown-editor-nDLmA_LF.js +0 -2
- package/dist/gateway/static/root/assets/markdown-split-DtBtcHWi.js +0 -1
- package/dist/gateway/static/root/assets/messages-Cf5hpZE6.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-Bw3jD9Jf.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-Dpqq7Z-J.js +0 -8
- package/dist/gateway/static/root/assets/project-detail-page-BuT6MCTs.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-DXWMxOjf.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-7rBCUWzZ.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-gmEOYNb4.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DYYoJcl7.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BhenBnUj.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-Dq7xIj0_.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-MDI9Lz6z.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-P0_RldWv.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-CxfnoRVn.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-Bxn2Dc16.js +0 -5
- package/dist/src/agent/tools/browser-recipe-tool.d.ts +0 -12
- package/dist/src/agent/tools/browser-recipe-tool.js +0 -113
- package/dist/src/browser/actions/extension-registry-bridge.d.ts +0 -5
- package/dist/src/browser/actions/extension-registry-bridge.js +0 -312
- package/dist/src/browser/actions/registry.d.ts +0 -5
- package/dist/src/browser/actions/registry.js +0 -741
- package/dist/src/browser/actions/types.d.ts +0 -65
- package/dist/src/browser/backend-from-config.d.ts +0 -22
- package/dist/src/browser/backend-from-config.js +0 -99
- package/dist/src/browser/browser-command-timeout.d.ts +0 -2
- package/dist/src/browser/browser-command-timeout.js +0 -11
- package/dist/src/browser/cdp-local-launcher.d.ts +0 -35
- package/dist/src/browser/cdp-local-launcher.js +0 -154
- package/dist/src/browser/cdp-supervisor.d.ts +0 -58
- package/dist/src/browser/cdp-supervisor.js +0 -133
- package/dist/src/browser/humanize.d.ts +0 -80
- package/dist/src/browser/humanize.js +0 -363
- package/dist/src/browser/manager.d.ts +0 -50
- package/dist/src/browser/manager.js +0 -251
- package/dist/src/browser/pipeline/output.d.ts +0 -35
- package/dist/src/browser/pipeline/output.js +0 -74
- package/dist/src/browser/pipeline/runner.d.ts +0 -27
- package/dist/src/browser/pipeline/runner.js +0 -453
- package/dist/src/browser/pipeline/schema.d.ts +0 -42
- package/dist/src/browser/pipeline/schema.js +0 -116
- package/dist/src/browser/pipeline/template.d.ts +0 -30
- package/dist/src/browser/pipeline/template.js +0 -112
- package/dist/src/browser/providers/cloakbrowser.d.ts +0 -83
- package/dist/src/browser/providers/cloakbrowser.js +0 -612
- package/dist/src/browser/recipes/index.js +0 -3
- package/dist/src/browser/recipes/repository.d.ts +0 -13
- package/dist/src/browser/recipes/repository.js +0 -81
- package/dist/src/browser/recipes/runtime-service.d.ts +0 -6
- package/dist/src/browser/recipes/runtime-service.js +0 -30
- package/dist/src/browser/recipes/service.d.ts +0 -36
- package/dist/src/browser/recipes/service.js +0 -186
- package/dist/src/browser/recipes/types.d.ts +0 -36
- package/dist/src/browser/schemas.d.ts +0 -53
- package/dist/src/browser/schemas.js +0 -68
- package/dist/src/browser/session-lifecycle.d.ts +0 -40
- package/dist/src/browser/session-lifecycle.js +0 -136
- package/dist/src/browser/snapshot-helpers.d.ts +0 -24
- package/dist/src/browser/snapshot-helpers.js +0 -70
- package/dist/src/browser/stealth.d.ts +0 -46
- package/dist/src/browser/stealth.js +0 -163
- package/dist/src/gateway/hono/routes/browser-workflows.d.ts +0 -3
- package/dist/src/gateway/hono/routes/browser-workflows.js +0 -78
- /package/dist/src/browser/{actions → automations}/types.js +0 -0
- /package/dist/src/browser/{recipes/types.js → drivers/browser-driver.js} +0 -0
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { getSqliteDatabase, runSqliteWriteTransaction } from "../../storage/sqlite/transaction.js";
|
|
2
|
-
//#region src/browser/recipes/repository.ts
|
|
3
|
-
const RECIPE_SELECT = `SELECT recipe_id, revision, name, description, status, yaml_source, risk_level, domains_json, created_at_ms, updated_at_ms FROM browser_recipes`;
|
|
4
|
-
const RUN_SELECT = `SELECT run_id, recipe_id, recipe_revision, recipe_yaml, status, args_json, result_json, error, created_at_ms, started_at_ms, ended_at_ms, duration_ms FROM browser_recipe_runs`;
|
|
5
|
-
function recipeFromRow(row) {
|
|
6
|
-
return {
|
|
7
|
-
id: row.recipe_id,
|
|
8
|
-
revision: row.revision,
|
|
9
|
-
name: row.name,
|
|
10
|
-
description: row.description ?? void 0,
|
|
11
|
-
status: row.status,
|
|
12
|
-
yaml: row.yaml_source,
|
|
13
|
-
risk: row.risk_level,
|
|
14
|
-
domains: JSON.parse(row.domains_json),
|
|
15
|
-
createdAtMs: row.created_at_ms,
|
|
16
|
-
updatedAtMs: row.updated_at_ms
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
function runFromRow(row) {
|
|
20
|
-
return {
|
|
21
|
-
id: row.run_id,
|
|
22
|
-
recipeId: row.recipe_id,
|
|
23
|
-
recipeRevision: row.recipe_revision,
|
|
24
|
-
recipeYaml: row.recipe_yaml,
|
|
25
|
-
status: row.status,
|
|
26
|
-
args: JSON.parse(row.args_json),
|
|
27
|
-
result: row.result_json ? JSON.parse(row.result_json) : void 0,
|
|
28
|
-
error: row.error ?? void 0,
|
|
29
|
-
createdAtMs: row.created_at_ms,
|
|
30
|
-
startedAtMs: row.started_at_ms ?? void 0,
|
|
31
|
-
endedAtMs: row.ended_at_ms ?? void 0,
|
|
32
|
-
durationMs: row.duration_ms ?? void 0
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
function listBrowserRecipes() {
|
|
36
|
-
return getSqliteDatabase().prepare(`${RECIPE_SELECT} ORDER BY updated_at_ms DESC`).all().map(recipeFromRow);
|
|
37
|
-
}
|
|
38
|
-
function getBrowserRecipe(id) {
|
|
39
|
-
const row = getSqliteDatabase().prepare(`${RECIPE_SELECT} WHERE recipe_id = ?`).get(id);
|
|
40
|
-
return row ? recipeFromRow(row) : null;
|
|
41
|
-
}
|
|
42
|
-
function saveBrowserRecipe(recipe) {
|
|
43
|
-
runSqliteWriteTransaction((db) => db.prepare(`INSERT INTO browser_recipes (recipe_id, revision, name, description, status, yaml_source, risk_level, domains_json, created_at_ms, updated_at_ms) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ON CONFLICT(recipe_id) DO UPDATE SET revision=excluded.revision, name=excluded.name, description=excluded.description, status=excluded.status, yaml_source=excluded.yaml_source, risk_level=excluded.risk_level, domains_json=excluded.domains_json, updated_at_ms=excluded.updated_at_ms`).run(recipe.id, recipe.revision, recipe.name, recipe.description ?? null, recipe.status, recipe.yaml, recipe.risk, JSON.stringify(recipe.domains), recipe.createdAtMs, recipe.updatedAtMs));
|
|
44
|
-
}
|
|
45
|
-
function deleteBrowserRecipe(id) {
|
|
46
|
-
return runSqliteWriteTransaction((db) => db.prepare("DELETE FROM browser_recipes WHERE recipe_id = ?").run(id).changes > 0);
|
|
47
|
-
}
|
|
48
|
-
function saveBrowserRecipeRun(run) {
|
|
49
|
-
runSqliteWriteTransaction((db) => db.prepare(`INSERT INTO browser_recipe_runs (run_id, recipe_id, recipe_revision, recipe_yaml, status, args_json, result_json, error, created_at_ms, started_at_ms, ended_at_ms, duration_ms) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ON CONFLICT(run_id) DO UPDATE SET status=excluded.status, result_json=excluded.result_json, error=excluded.error, started_at_ms=excluded.started_at_ms, ended_at_ms=excluded.ended_at_ms, duration_ms=excluded.duration_ms`).run(run.id, run.recipeId, run.recipeRevision, run.recipeYaml, run.status, JSON.stringify(run.args), run.result === void 0 ? null : JSON.stringify(run.result), run.error ?? null, run.createdAtMs, run.startedAtMs ?? null, run.endedAtMs ?? null, run.durationMs ?? null));
|
|
50
|
-
}
|
|
51
|
-
function getBrowserRecipeRun(id) {
|
|
52
|
-
const row = getSqliteDatabase().prepare(`${RUN_SELECT} WHERE run_id = ?`).get(id);
|
|
53
|
-
return row ? runFromRow(row) : null;
|
|
54
|
-
}
|
|
55
|
-
function listBrowserRecipeRuns(recipeId) {
|
|
56
|
-
return (recipeId ? getSqliteDatabase().prepare(`${RUN_SELECT} WHERE recipe_id = ? ORDER BY created_at_ms DESC LIMIT 100`).all(recipeId) : getSqliteDatabase().prepare(`${RUN_SELECT} ORDER BY created_at_ms DESC LIMIT 100`).all()).map(runFromRow);
|
|
57
|
-
}
|
|
58
|
-
function hasActiveBrowserRecipeRuns(recipeId) {
|
|
59
|
-
return Boolean(getSqliteDatabase().prepare(`SELECT 1 FROM browser_recipe_runs WHERE recipe_id = ? AND status IN ('queued', 'running') LIMIT 1`).get(recipeId));
|
|
60
|
-
}
|
|
61
|
-
function listActiveBrowserRecipeRuns() {
|
|
62
|
-
return getSqliteDatabase().prepare(`${RUN_SELECT} WHERE status IN ('queued', 'running') ORDER BY created_at_ms ASC`).all().map(runFromRow);
|
|
63
|
-
}
|
|
64
|
-
function nextBrowserRecipeRunEventSeq(runId) {
|
|
65
|
-
return getSqliteDatabase().prepare("SELECT COALESCE(MAX(seq), 0) + 1 AS seq FROM browser_recipe_run_events WHERE run_id = ?").get(runId).seq;
|
|
66
|
-
}
|
|
67
|
-
function appendBrowserRecipeRunEvent(event) {
|
|
68
|
-
runSqliteWriteTransaction((db) => db.prepare("INSERT INTO browser_recipe_run_events (event_id, run_id, seq, type, data_json, created_at_ms) VALUES (?, ?, ?, ?, ?, ?)").run(event.id, event.runId, event.seq, event.type, event.data === void 0 ? null : JSON.stringify(event.data), event.createdAtMs));
|
|
69
|
-
}
|
|
70
|
-
function listBrowserRecipeRunEvents(runId) {
|
|
71
|
-
return getSqliteDatabase().prepare("SELECT event_id, run_id, seq, type, data_json, created_at_ms FROM browser_recipe_run_events WHERE run_id = ? ORDER BY seq ASC").all(runId).map((row) => ({
|
|
72
|
-
id: row.event_id,
|
|
73
|
-
runId: row.run_id,
|
|
74
|
-
seq: row.seq,
|
|
75
|
-
type: row.type,
|
|
76
|
-
data: row.data_json ? JSON.parse(row.data_json) : void 0,
|
|
77
|
-
createdAtMs: row.created_at_ms
|
|
78
|
-
}));
|
|
79
|
-
}
|
|
80
|
-
//#endregion
|
|
81
|
-
export { appendBrowserRecipeRunEvent, deleteBrowserRecipe, getBrowserRecipe, getBrowserRecipeRun, hasActiveBrowserRecipeRuns, listActiveBrowserRecipeRuns, listBrowserRecipeRunEvents, listBrowserRecipeRuns, listBrowserRecipes, nextBrowserRecipeRunEventSeq, saveBrowserRecipe, saveBrowserRecipeRun };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Config } from '../../config/schema.js';
|
|
2
|
-
import { BrowserRecipeService } from './service.js';
|
|
3
|
-
export declare function createRuntimeBrowserRecipeService(deps: {
|
|
4
|
-
getConfig: () => Config;
|
|
5
|
-
emit?: (type: string, payload: unknown) => void;
|
|
6
|
-
}): BrowserRecipeService;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { BrowserManager } from "../manager.js";
|
|
2
|
-
import { resolveBrowserBackendFromConfig } from "../backend-from-config.js";
|
|
3
|
-
import { createBrowserActionRegistry } from "../actions/registry.js";
|
|
4
|
-
import { runBrowserPipeline } from "../pipeline/runner.js";
|
|
5
|
-
import { BrowserRecipeService } from "./service.js";
|
|
6
|
-
//#region src/browser/recipes/runtime-service.ts
|
|
7
|
-
function createRuntimeBrowserRecipeService(deps) {
|
|
8
|
-
const registry = createBrowserActionRegistry();
|
|
9
|
-
return new BrowserRecipeService(registry, async ({ yaml, args, signal, onStep }) => {
|
|
10
|
-
const manager = new BrowserManager({
|
|
11
|
-
getHeadless: () => false,
|
|
12
|
-
getBackend: () => resolveBrowserBackendFromConfig(deps.getConfig())
|
|
13
|
-
});
|
|
14
|
-
const taskId = `recipe-${Date.now()}`;
|
|
15
|
-
try {
|
|
16
|
-
await manager.ensureConnected();
|
|
17
|
-
return await runBrowserPipeline(yaml, args, {
|
|
18
|
-
page: manager.getExtensionProvider() ? null : await manager.getPage(taskId),
|
|
19
|
-
manager,
|
|
20
|
-
config: deps.getConfig(),
|
|
21
|
-
taskId,
|
|
22
|
-
signal
|
|
23
|
-
}, registry, { onStep });
|
|
24
|
-
} finally {
|
|
25
|
-
await manager.shutdown().catch(() => void 0);
|
|
26
|
-
}
|
|
27
|
-
}, deps.emit);
|
|
28
|
-
}
|
|
29
|
-
//#endregion
|
|
30
|
-
export { createRuntimeBrowserRecipeService };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { type BrowserRecipeStepEvent } from '../pipeline/runner.js';
|
|
2
|
-
import type { BrowserActionRegistry, BrowserActionResult } from '../actions/types.js';
|
|
3
|
-
import type { BrowserRecipe, BrowserRecipeRun, BrowserRecipeStatus } from './types.js';
|
|
4
|
-
export type BrowserRecipeExecutor = (input: {
|
|
5
|
-
yaml: string;
|
|
6
|
-
args: Record<string, unknown>;
|
|
7
|
-
signal: AbortSignal;
|
|
8
|
-
onStep: (event: BrowserRecipeStepEvent) => void;
|
|
9
|
-
}) => Promise<BrowserActionResult>;
|
|
10
|
-
export declare class BrowserRecipeService {
|
|
11
|
-
private readonly registry;
|
|
12
|
-
private readonly executeRecipe;
|
|
13
|
-
private readonly emit?;
|
|
14
|
-
private activeRuns;
|
|
15
|
-
private executions;
|
|
16
|
-
private runWaiters;
|
|
17
|
-
constructor(registry: BrowserActionRegistry, executeRecipe: BrowserRecipeExecutor, emit?: (type: string, payload: unknown) => void);
|
|
18
|
-
list(): BrowserRecipe[];
|
|
19
|
-
get(id: string): BrowserRecipe;
|
|
20
|
-
listRuns(recipeId?: string): BrowserRecipeRun[];
|
|
21
|
-
getRun(id: string): BrowserRecipeRun;
|
|
22
|
-
listRunEvents(id: string): import("./types.js").BrowserRecipeRunEvent[];
|
|
23
|
-
validate(yaml: string): import("../pipeline/runner.js").ValidateResult;
|
|
24
|
-
save(input: {
|
|
25
|
-
yaml: string;
|
|
26
|
-
status?: BrowserRecipeStatus;
|
|
27
|
-
expectedId?: string;
|
|
28
|
-
}): BrowserRecipe;
|
|
29
|
-
remove(id: string): boolean;
|
|
30
|
-
startRun(recipeId: string, args: Record<string, unknown>): BrowserRecipeRun;
|
|
31
|
-
cancel(runId: string): boolean;
|
|
32
|
-
shutdown(): Promise<void>;
|
|
33
|
-
runAndWait(recipeId: string, args: Record<string, unknown>, signal?: AbortSignal): Promise<BrowserRecipeRun>;
|
|
34
|
-
private addEvent;
|
|
35
|
-
private execute;
|
|
36
|
-
}
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import { validateBrowserPipeline } from "../pipeline/runner.js";
|
|
2
|
-
import { appendBrowserRecipeRunEvent, deleteBrowserRecipe, getBrowserRecipe, getBrowserRecipeRun, hasActiveBrowserRecipeRuns, listActiveBrowserRecipeRuns, listBrowserRecipeRunEvents, listBrowserRecipeRuns, listBrowserRecipes, nextBrowserRecipeRunEventSeq, saveBrowserRecipe, saveBrowserRecipeRun } from "./repository.js";
|
|
3
|
-
import { randomUUID } from "node:crypto";
|
|
4
|
-
//#region src/browser/recipes/service.ts
|
|
5
|
-
var BrowserRecipeService = class {
|
|
6
|
-
activeRuns = /* @__PURE__ */ new Map();
|
|
7
|
-
executions = /* @__PURE__ */ new Map();
|
|
8
|
-
runWaiters = /* @__PURE__ */ new Map();
|
|
9
|
-
constructor(registry, executeRecipe, emit) {
|
|
10
|
-
this.registry = registry;
|
|
11
|
-
this.executeRecipe = executeRecipe;
|
|
12
|
-
this.emit = emit;
|
|
13
|
-
for (const run of listActiveBrowserRecipeRuns()) {
|
|
14
|
-
const endedAtMs = Date.now();
|
|
15
|
-
const recovered = {
|
|
16
|
-
...run,
|
|
17
|
-
status: "failed",
|
|
18
|
-
error: "Gateway stopped before the run completed",
|
|
19
|
-
endedAtMs,
|
|
20
|
-
durationMs: run.startedAtMs ? endedAtMs - run.startedAtMs : void 0
|
|
21
|
-
};
|
|
22
|
-
saveBrowserRecipeRun(recovered);
|
|
23
|
-
this.addEvent(run.id, "run.completed", {
|
|
24
|
-
status: recovered.status,
|
|
25
|
-
error: recovered.error
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
list() {
|
|
30
|
-
return listBrowserRecipes();
|
|
31
|
-
}
|
|
32
|
-
get(id) {
|
|
33
|
-
return getBrowserRecipe(id);
|
|
34
|
-
}
|
|
35
|
-
listRuns(recipeId) {
|
|
36
|
-
return listBrowserRecipeRuns(recipeId);
|
|
37
|
-
}
|
|
38
|
-
getRun(id) {
|
|
39
|
-
return getBrowserRecipeRun(id);
|
|
40
|
-
}
|
|
41
|
-
listRunEvents(id) {
|
|
42
|
-
return listBrowserRecipeRunEvents(id);
|
|
43
|
-
}
|
|
44
|
-
validate(yaml) {
|
|
45
|
-
return validateBrowserPipeline(yaml, this.registry);
|
|
46
|
-
}
|
|
47
|
-
save(input) {
|
|
48
|
-
const validation = this.validate(input.yaml);
|
|
49
|
-
if (!validation.ok || !validation.document) throw new Error(validation.errors.map((error) => `${error.path}: ${error.message}`).join("\n"));
|
|
50
|
-
const document = validation.document;
|
|
51
|
-
if (input.expectedId && document.id !== input.expectedId) throw new Error("Recipe id cannot change");
|
|
52
|
-
const existing = getBrowserRecipe(document.id);
|
|
53
|
-
const now = Date.now();
|
|
54
|
-
const recipe = {
|
|
55
|
-
id: document.id,
|
|
56
|
-
revision: (existing?.revision ?? 0) + 1,
|
|
57
|
-
name: document.name,
|
|
58
|
-
description: document.description,
|
|
59
|
-
status: input.status ?? existing?.status ?? "published",
|
|
60
|
-
yaml: input.yaml,
|
|
61
|
-
risk: document.risk,
|
|
62
|
-
domains: document.domains,
|
|
63
|
-
createdAtMs: existing?.createdAtMs ?? now,
|
|
64
|
-
updatedAtMs: now
|
|
65
|
-
};
|
|
66
|
-
saveBrowserRecipe(recipe);
|
|
67
|
-
return recipe;
|
|
68
|
-
}
|
|
69
|
-
remove(id) {
|
|
70
|
-
if (hasActiveBrowserRecipeRuns(id)) throw new Error("Cannot delete a browser automation while it is running");
|
|
71
|
-
return deleteBrowserRecipe(id);
|
|
72
|
-
}
|
|
73
|
-
startRun(recipeId, args) {
|
|
74
|
-
const recipe = getBrowserRecipe(recipeId);
|
|
75
|
-
if (!recipe) throw new Error("Browser automation not found");
|
|
76
|
-
if (recipe.status !== "published") throw new Error("Only enabled browser automations can run");
|
|
77
|
-
if (!this.validate(recipe.yaml).ok) throw new Error("Browser automation is invalid");
|
|
78
|
-
const run = {
|
|
79
|
-
id: randomUUID(),
|
|
80
|
-
recipeId,
|
|
81
|
-
recipeRevision: recipe.revision,
|
|
82
|
-
recipeYaml: recipe.yaml,
|
|
83
|
-
status: "queued",
|
|
84
|
-
args,
|
|
85
|
-
createdAtMs: Date.now()
|
|
86
|
-
};
|
|
87
|
-
saveBrowserRecipeRun(run);
|
|
88
|
-
this.addEvent(run.id, "run.queued", { recipeId });
|
|
89
|
-
const execution = this.execute(run);
|
|
90
|
-
this.executions.set(run.id, execution);
|
|
91
|
-
execution.finally(() => this.executions.delete(run.id)).catch(() => void 0);
|
|
92
|
-
return run;
|
|
93
|
-
}
|
|
94
|
-
cancel(runId) {
|
|
95
|
-
const controller = this.activeRuns.get(runId);
|
|
96
|
-
if (!controller) return false;
|
|
97
|
-
controller.abort();
|
|
98
|
-
return true;
|
|
99
|
-
}
|
|
100
|
-
async shutdown() {
|
|
101
|
-
for (const controller of this.activeRuns.values()) controller.abort();
|
|
102
|
-
await Promise.allSettled(this.executions.values());
|
|
103
|
-
}
|
|
104
|
-
async runAndWait(recipeId, args, signal) {
|
|
105
|
-
const run = this.startRun(recipeId, args);
|
|
106
|
-
return new Promise((resolve) => {
|
|
107
|
-
const onAbort = () => this.cancel(run.id);
|
|
108
|
-
const complete = (completed) => {
|
|
109
|
-
signal?.removeEventListener("abort", onAbort);
|
|
110
|
-
const active = this.runWaiters.get(run.id);
|
|
111
|
-
active?.delete(complete);
|
|
112
|
-
if (active?.size === 0) this.runWaiters.delete(run.id);
|
|
113
|
-
resolve(completed);
|
|
114
|
-
};
|
|
115
|
-
const waiters = this.runWaiters.get(run.id) ?? /* @__PURE__ */ new Set();
|
|
116
|
-
waiters.add(complete);
|
|
117
|
-
this.runWaiters.set(run.id, waiters);
|
|
118
|
-
signal?.addEventListener("abort", onAbort, { once: true });
|
|
119
|
-
if (signal?.aborted) onAbort();
|
|
120
|
-
const current = this.getRun(run.id);
|
|
121
|
-
if (current && current.status !== "queued" && current.status !== "running") complete(current);
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
addEvent(runId, type, data) {
|
|
125
|
-
const seq = nextBrowserRecipeRunEventSeq(runId);
|
|
126
|
-
const event = {
|
|
127
|
-
id: randomUUID(),
|
|
128
|
-
runId,
|
|
129
|
-
seq,
|
|
130
|
-
type,
|
|
131
|
-
data,
|
|
132
|
-
createdAtMs: Date.now()
|
|
133
|
-
};
|
|
134
|
-
appendBrowserRecipeRunEvent(event);
|
|
135
|
-
this.emit?.(`browser.recipe.${type}`, event);
|
|
136
|
-
}
|
|
137
|
-
async execute(run) {
|
|
138
|
-
const controller = new AbortController();
|
|
139
|
-
this.activeRuns.set(run.id, controller);
|
|
140
|
-
const startedAtMs = Date.now();
|
|
141
|
-
let current = {
|
|
142
|
-
...run,
|
|
143
|
-
status: "running",
|
|
144
|
-
startedAtMs
|
|
145
|
-
};
|
|
146
|
-
saveBrowserRecipeRun(current);
|
|
147
|
-
this.addEvent(run.id, "run.started");
|
|
148
|
-
try {
|
|
149
|
-
const result = await this.executeRecipe({
|
|
150
|
-
yaml: run.recipeYaml,
|
|
151
|
-
args: run.args,
|
|
152
|
-
signal: controller.signal,
|
|
153
|
-
onStep: (event) => this.addEvent(run.id, `step.${event.status}`, event)
|
|
154
|
-
});
|
|
155
|
-
const endedAtMs = Date.now();
|
|
156
|
-
current = {
|
|
157
|
-
...current,
|
|
158
|
-
status: controller.signal.aborted ? "cancelled" : result.ok ? "succeeded" : "failed",
|
|
159
|
-
result: result.data,
|
|
160
|
-
error: result.error?.message,
|
|
161
|
-
endedAtMs,
|
|
162
|
-
durationMs: endedAtMs - startedAtMs
|
|
163
|
-
};
|
|
164
|
-
} catch (error) {
|
|
165
|
-
const endedAtMs = Date.now();
|
|
166
|
-
current = {
|
|
167
|
-
...current,
|
|
168
|
-
status: controller.signal.aborted ? "cancelled" : "failed",
|
|
169
|
-
error: error instanceof Error ? error.message : String(error),
|
|
170
|
-
endedAtMs,
|
|
171
|
-
durationMs: endedAtMs - startedAtMs
|
|
172
|
-
};
|
|
173
|
-
} finally {
|
|
174
|
-
saveBrowserRecipeRun(current);
|
|
175
|
-
this.addEvent(run.id, "run.completed", {
|
|
176
|
-
status: current.status,
|
|
177
|
-
error: current.error
|
|
178
|
-
});
|
|
179
|
-
this.activeRuns.delete(run.id);
|
|
180
|
-
for (const resolve of this.runWaiters.get(run.id) ?? []) resolve(current);
|
|
181
|
-
this.runWaiters.delete(run.id);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
//#endregion
|
|
186
|
-
export { BrowserRecipeService };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export type BrowserRecipeStatus = 'published' | 'disabled';
|
|
2
|
-
export type BrowserRecipeRunStatus = 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled';
|
|
3
|
-
export interface BrowserRecipe {
|
|
4
|
-
id: string;
|
|
5
|
-
revision: number;
|
|
6
|
-
name: string;
|
|
7
|
-
description?: string;
|
|
8
|
-
status: BrowserRecipeStatus;
|
|
9
|
-
yaml: string;
|
|
10
|
-
risk: 'read_only' | 'account_write' | 'sensitive';
|
|
11
|
-
domains: string[];
|
|
12
|
-
createdAtMs: number;
|
|
13
|
-
updatedAtMs: number;
|
|
14
|
-
}
|
|
15
|
-
export interface BrowserRecipeRun {
|
|
16
|
-
id: string;
|
|
17
|
-
recipeId: string;
|
|
18
|
-
recipeRevision: number;
|
|
19
|
-
recipeYaml: string;
|
|
20
|
-
status: BrowserRecipeRunStatus;
|
|
21
|
-
args: Record<string, unknown>;
|
|
22
|
-
result?: unknown;
|
|
23
|
-
error?: string;
|
|
24
|
-
createdAtMs: number;
|
|
25
|
-
startedAtMs?: number;
|
|
26
|
-
endedAtMs?: number;
|
|
27
|
-
durationMs?: number;
|
|
28
|
-
}
|
|
29
|
-
export interface BrowserRecipeRunEvent {
|
|
30
|
-
id: string;
|
|
31
|
-
runId: string;
|
|
32
|
-
seq: number;
|
|
33
|
-
type: string;
|
|
34
|
-
data?: unknown;
|
|
35
|
-
createdAtMs: number;
|
|
36
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
export declare const BrowserNavigateSchema: import("@sinclair/typebox").TObject<{
|
|
2
|
-
url: import("@sinclair/typebox").TString;
|
|
3
|
-
waitFor: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"load">, import("@sinclair/typebox").TLiteral<"domcontentloaded">, import("@sinclair/typebox").TLiteral<"networkidle">]>>;
|
|
4
|
-
}>;
|
|
5
|
-
export declare const BrowserSnapshotSchema: import("@sinclair/typebox").TObject<{
|
|
6
|
-
selector: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
7
|
-
maxLength: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
8
|
-
}>;
|
|
9
|
-
export declare const BrowserClickSchema: import("@sinclair/typebox").TObject<{
|
|
10
|
-
selector: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
11
|
-
text: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
12
|
-
role: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
13
|
-
}>;
|
|
14
|
-
export declare const BrowserTypeSchema: import("@sinclair/typebox").TObject<{
|
|
15
|
-
selector: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
16
|
-
label: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
17
|
-
text: import("@sinclair/typebox").TString;
|
|
18
|
-
pressEnter: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
19
|
-
}>;
|
|
20
|
-
export declare const BrowserScrollSchema: import("@sinclair/typebox").TObject<{
|
|
21
|
-
direction: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"down">, import("@sinclair/typebox").TLiteral<"up">]>;
|
|
22
|
-
amount: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
23
|
-
}>;
|
|
24
|
-
export declare const BrowserScreenshotSchema: import("@sinclair/typebox").TObject<{
|
|
25
|
-
selector: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
26
|
-
description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
27
|
-
}>;
|
|
28
|
-
export declare const BrowserBackSchema: import("@sinclair/typebox").TObject<{
|
|
29
|
-
waitFor: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"load">, import("@sinclair/typebox").TLiteral<"domcontentloaded">, import("@sinclair/typebox").TLiteral<"networkidle">]>>;
|
|
30
|
-
}>;
|
|
31
|
-
export declare const BrowserPressSchema: import("@sinclair/typebox").TObject<{
|
|
32
|
-
key: import("@sinclair/typebox").TString;
|
|
33
|
-
}>;
|
|
34
|
-
export declare const BrowserConsoleSchema: import("@sinclair/typebox").TObject<{
|
|
35
|
-
javascript: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
36
|
-
}>;
|
|
37
|
-
export declare const BrowserGetImagesSchema: import("@sinclair/typebox").TObject<{
|
|
38
|
-
selector: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
39
|
-
maxImages: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
40
|
-
}>;
|
|
41
|
-
export declare const BrowserCloseSchema: import("@sinclair/typebox").TObject<{}>;
|
|
42
|
-
export declare const BrowserVisionSchema: import("@sinclair/typebox").TObject<{
|
|
43
|
-
prompt: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
44
|
-
selector: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
45
|
-
}>;
|
|
46
|
-
export declare const BrowserDialogSchema: import("@sinclair/typebox").TObject<{
|
|
47
|
-
action: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"accept">, import("@sinclair/typebox").TLiteral<"dismiss">]>;
|
|
48
|
-
promptText: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
49
|
-
}>;
|
|
50
|
-
export declare const BrowserCdpSchema: import("@sinclair/typebox").TObject<{
|
|
51
|
-
method: import("@sinclair/typebox").TString;
|
|
52
|
-
params: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
|
|
53
|
-
}>;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { Type } from "@sinclair/typebox";
|
|
2
|
-
//#region src/browser/schemas.ts
|
|
3
|
-
const BrowserNavigateSchema = Type.Object({
|
|
4
|
-
url: Type.String({ description: "URL to navigate to" }),
|
|
5
|
-
waitFor: Type.Optional(Type.Union([
|
|
6
|
-
Type.Literal("load"),
|
|
7
|
-
Type.Literal("domcontentloaded"),
|
|
8
|
-
Type.Literal("networkidle")
|
|
9
|
-
], { description: "Wait condition (default: domcontentloaded)" }))
|
|
10
|
-
});
|
|
11
|
-
const BrowserSnapshotSchema = Type.Object({
|
|
12
|
-
selector: Type.Optional(Type.String({ description: "CSS selector to snapshot a specific element. Omit for full page." })),
|
|
13
|
-
maxLength: Type.Optional(Type.Number({
|
|
14
|
-
description: "Max characters in snapshot (default: 30000)",
|
|
15
|
-
default: 3e4
|
|
16
|
-
}))
|
|
17
|
-
});
|
|
18
|
-
const BrowserClickSchema = Type.Object({
|
|
19
|
-
selector: Type.Optional(Type.String({ description: "CSS selector of the element to click" })),
|
|
20
|
-
text: Type.Optional(Type.String({ description: "Visible text of the element to click (uses getByText)" })),
|
|
21
|
-
role: Type.Optional(Type.String({ description: "ARIA role and accessible name, e.g. \"button:Submit\" (uses getByRole)" }))
|
|
22
|
-
});
|
|
23
|
-
const BrowserTypeSchema = Type.Object({
|
|
24
|
-
selector: Type.Optional(Type.String({ description: "CSS selector of the input field" })),
|
|
25
|
-
label: Type.Optional(Type.String({ description: "Label text of the input field (uses getByLabel)" })),
|
|
26
|
-
text: Type.String({ description: "Text to type into the field" }),
|
|
27
|
-
pressEnter: Type.Optional(Type.Boolean({ description: "Press Enter after typing (default: false)" }))
|
|
28
|
-
});
|
|
29
|
-
const BrowserScrollSchema = Type.Object({
|
|
30
|
-
direction: Type.Union([Type.Literal("down"), Type.Literal("up")], { description: "Scroll direction" }),
|
|
31
|
-
amount: Type.Optional(Type.Number({
|
|
32
|
-
description: "Pixels to scroll (default: 500)",
|
|
33
|
-
default: 500
|
|
34
|
-
}))
|
|
35
|
-
});
|
|
36
|
-
const BrowserScreenshotSchema = Type.Object({
|
|
37
|
-
selector: Type.Optional(Type.String({ description: "CSS selector to screenshot a specific element. Omit for full page." })),
|
|
38
|
-
description: Type.Optional(Type.String({ description: "What to look for in the screenshot (passed to the vision model)" }))
|
|
39
|
-
});
|
|
40
|
-
const BrowserBackSchema = Type.Object({ waitFor: Type.Optional(Type.Union([
|
|
41
|
-
Type.Literal("load"),
|
|
42
|
-
Type.Literal("domcontentloaded"),
|
|
43
|
-
Type.Literal("networkidle")
|
|
44
|
-
], { description: "Wait condition after going back (default: domcontentloaded)" })) });
|
|
45
|
-
const BrowserPressSchema = Type.Object({ key: Type.String({ description: "Key or key combination to press, e.g. \"Enter\", \"Tab\", \"Escape\", \"ArrowDown\", \"Control+A\", \"Shift+Enter\"" }) });
|
|
46
|
-
const BrowserConsoleSchema = Type.Object({ javascript: Type.Optional(Type.String({ description: "JavaScript expression to evaluate in the page context. The return value is serialized to JSON." })) });
|
|
47
|
-
const BrowserGetImagesSchema = Type.Object({
|
|
48
|
-
selector: Type.Optional(Type.String({ description: "CSS selector to limit image extraction scope. Omit for full page." })),
|
|
49
|
-
maxImages: Type.Optional(Type.Number({
|
|
50
|
-
description: "Max images to return (default: 20)",
|
|
51
|
-
default: 20
|
|
52
|
-
}))
|
|
53
|
-
});
|
|
54
|
-
const BrowserCloseSchema = Type.Object({});
|
|
55
|
-
const BrowserVisionSchema = Type.Object({
|
|
56
|
-
prompt: Type.Optional(Type.String({ description: "What to analyze in the screenshot (default: describe the visible UI state). Requires an available image model." })),
|
|
57
|
-
selector: Type.Optional(Type.String({ description: "CSS selector to screenshot a specific element. Omit for full page." }))
|
|
58
|
-
});
|
|
59
|
-
const BrowserDialogSchema = Type.Object({
|
|
60
|
-
action: Type.Union([Type.Literal("accept"), Type.Literal("dismiss")], { description: "Whether to accept or dismiss the dialog" }),
|
|
61
|
-
promptText: Type.Optional(Type.String({ description: "Text to enter into a prompt() dialog before accepting" }))
|
|
62
|
-
});
|
|
63
|
-
const BrowserCdpSchema = Type.Object({
|
|
64
|
-
method: Type.String({ description: "CDP method name, e.g. \"Runtime.evaluate\", \"Page.captureScreenshot\"" }),
|
|
65
|
-
params: Type.Optional(Type.Record(Type.String(), Type.Unknown(), { description: "CDP method parameters as a JSON object" }))
|
|
66
|
-
});
|
|
67
|
-
//#endregion
|
|
68
|
-
export { BrowserBackSchema, BrowserCdpSchema, BrowserClickSchema, BrowserCloseSchema, BrowserConsoleSchema, BrowserDialogSchema, BrowserGetImagesSchema, BrowserNavigateSchema, BrowserPressSchema, BrowserScreenshotSchema, BrowserScrollSchema, BrowserSnapshotSchema, BrowserTypeSchema, BrowserVisionSchema };
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { BrowserContext, Page } from 'playwright-core';
|
|
2
|
-
export interface TracingOptions {
|
|
3
|
-
/** Enable session recording. Default: false. */
|
|
4
|
-
enabled: boolean;
|
|
5
|
-
/** Directory to save trace files. */
|
|
6
|
-
outputDir: string;
|
|
7
|
-
/** Include screenshots in trace. Default: true. */
|
|
8
|
-
screenshots?: boolean;
|
|
9
|
-
/** Include DOM snapshots in trace. Default: false (large files). */
|
|
10
|
-
snapshots?: boolean;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Start Playwright tracing on a browser context for session recording.
|
|
14
|
-
* Captures network, actions, and optionally screenshots/snapshots.
|
|
15
|
-
*/
|
|
16
|
-
export declare function startTracing(context: BrowserContext, options?: Partial<TracingOptions>): Promise<void>;
|
|
17
|
-
/**
|
|
18
|
-
* Stop tracing and save the trace file.
|
|
19
|
-
*
|
|
20
|
-
* @returns Path to the saved trace file, or undefined if tracing was not active.
|
|
21
|
-
*/
|
|
22
|
-
export declare function stopTracing(context: BrowserContext, options?: Partial<TracingOptions>): Promise<string | undefined>;
|
|
23
|
-
export interface BotDetectionResult {
|
|
24
|
-
detected: boolean;
|
|
25
|
-
indicators: string[];
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Check a page for signs of bot detection / CAPTCHA challenge.
|
|
29
|
-
* Returns indicators found. Non-blocking — for advisory logging only.
|
|
30
|
-
*/
|
|
31
|
-
export declare function checkBotDetection(page: Page): Promise<BotDetectionResult>;
|
|
32
|
-
/**
|
|
33
|
-
* Kill orphan Chromium processes that may have been left behind by crashed sessions.
|
|
34
|
-
*
|
|
35
|
-
* This is a best-effort cleanup. On macOS/Linux, searches for chromium/chrome
|
|
36
|
-
* processes with the `--no-sandbox` flag (which xopc adds to all launches).
|
|
37
|
-
*
|
|
38
|
-
* @returns Number of processes killed.
|
|
39
|
-
*/
|
|
40
|
-
export declare function cleanupOrphanProcesses(): Promise<number>;
|