@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,21 +1,151 @@
|
|
|
1
1
|
import { Type } from "@sinclair/typebox";
|
|
2
2
|
//#region src/agent/tools/browser/tool/schemas.ts
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
const ApprovalId = Type.Optional(Type.String({ description: "One-time local-owner approval id for this exact action." }));
|
|
4
|
+
const SessionId = Type.Optional(Type.String({ description: "Browser session id returned by the previous observation." }));
|
|
5
|
+
const Revision = Type.Number({ description: "Observation revision used to resolve element refs." });
|
|
6
|
+
const Ref = Type.String({ description: "Ephemeral element ref from the latest observation." });
|
|
7
|
+
const Expectation = Type.Optional(Type.Object({
|
|
8
|
+
urlIncludes: Type.Optional(Type.String()),
|
|
9
|
+
titleIncludes: Type.Optional(Type.String()),
|
|
10
|
+
textIncludes: Type.Optional(Type.String()),
|
|
11
|
+
ref: Type.Optional(Type.String()),
|
|
12
|
+
state: Type.Optional(Type.Union([Type.Literal("visible"), Type.Literal("hidden")]))
|
|
13
|
+
}, { additionalProperties: false }));
|
|
14
|
+
function action(name, properties) {
|
|
15
|
+
return Type.Object({
|
|
16
|
+
action: Type.Literal(name),
|
|
17
|
+
sessionId: SessionId,
|
|
18
|
+
approvalId: ApprovalId,
|
|
19
|
+
...properties
|
|
20
|
+
}, { additionalProperties: false });
|
|
21
|
+
}
|
|
22
|
+
const Observe = action("observe", { visual: Type.Optional(Type.Union([
|
|
23
|
+
Type.Literal("never"),
|
|
24
|
+
Type.Literal("auto"),
|
|
25
|
+
Type.Literal("always")
|
|
26
|
+
])) });
|
|
27
|
+
const Navigate = action("navigate", {
|
|
28
|
+
url: Type.String({ minLength: 1 }),
|
|
29
|
+
expect: Expectation
|
|
30
|
+
});
|
|
31
|
+
const Click = action("click", {
|
|
32
|
+
revision: Revision,
|
|
33
|
+
ref: Ref,
|
|
34
|
+
expect: Expectation
|
|
35
|
+
});
|
|
36
|
+
const Fill = action("fill", {
|
|
37
|
+
revision: Revision,
|
|
38
|
+
ref: Ref,
|
|
39
|
+
value: Type.String(),
|
|
40
|
+
submit: Type.Optional(Type.Boolean()),
|
|
41
|
+
expect: Expectation
|
|
42
|
+
});
|
|
43
|
+
const Select = action("select", {
|
|
44
|
+
revision: Revision,
|
|
45
|
+
ref: Ref,
|
|
46
|
+
value: Type.String(),
|
|
47
|
+
expect: Expectation
|
|
48
|
+
});
|
|
49
|
+
const Press = action("press", {
|
|
50
|
+
revision: Revision,
|
|
51
|
+
ref: Type.Optional(Ref),
|
|
52
|
+
key: Type.String({ minLength: 1 }),
|
|
53
|
+
expect: Expectation
|
|
54
|
+
});
|
|
55
|
+
const Scroll = action("scroll", {
|
|
56
|
+
revision: Revision,
|
|
57
|
+
ref: Type.Optional(Ref),
|
|
58
|
+
deltaY: Type.Number(),
|
|
59
|
+
expect: Expectation
|
|
60
|
+
});
|
|
61
|
+
const Wait = action("wait", {
|
|
62
|
+
revision: Revision,
|
|
63
|
+
condition: Type.Union([
|
|
64
|
+
Type.Literal("page_idle"),
|
|
65
|
+
Type.Literal("text"),
|
|
66
|
+
Type.Literal("visible"),
|
|
67
|
+
Type.Literal("hidden")
|
|
68
|
+
]),
|
|
69
|
+
value: Type.Optional(Type.String()),
|
|
70
|
+
ref: Type.Optional(Ref),
|
|
71
|
+
timeoutMs: Type.Optional(Type.Number({
|
|
72
|
+
minimum: 100,
|
|
73
|
+
maximum: 12e4
|
|
74
|
+
}))
|
|
75
|
+
});
|
|
76
|
+
const Upload = action("upload", {
|
|
77
|
+
revision: Revision,
|
|
78
|
+
ref: Ref,
|
|
79
|
+
paths: Type.Array(Type.String({ minLength: 1 }), {
|
|
80
|
+
minItems: 1,
|
|
81
|
+
maxItems: 20
|
|
82
|
+
}),
|
|
83
|
+
expect: Expectation
|
|
84
|
+
});
|
|
85
|
+
const Tabs = action("tabs", {
|
|
86
|
+
operation: Type.Union([
|
|
87
|
+
Type.Literal("list"),
|
|
88
|
+
Type.Literal("create"),
|
|
89
|
+
Type.Literal("activate"),
|
|
14
90
|
Type.Literal("close")
|
|
15
|
-
]
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
91
|
+
]),
|
|
92
|
+
tabId: Type.Optional(Type.String()),
|
|
93
|
+
url: Type.Optional(Type.String())
|
|
94
|
+
});
|
|
95
|
+
const SequenceStep = Type.Union([
|
|
96
|
+
Type.Object({
|
|
97
|
+
action: Type.Literal("click"),
|
|
98
|
+
ref: Ref,
|
|
99
|
+
expect: Expectation
|
|
100
|
+
}, { additionalProperties: false }),
|
|
101
|
+
Type.Object({
|
|
102
|
+
action: Type.Literal("fill"),
|
|
103
|
+
ref: Ref,
|
|
104
|
+
value: Type.String(),
|
|
105
|
+
submit: Type.Optional(Type.Boolean()),
|
|
106
|
+
expect: Expectation
|
|
107
|
+
}, { additionalProperties: false }),
|
|
108
|
+
Type.Object({
|
|
109
|
+
action: Type.Literal("select"),
|
|
110
|
+
ref: Ref,
|
|
111
|
+
value: Type.String(),
|
|
112
|
+
expect: Expectation
|
|
113
|
+
}, { additionalProperties: false }),
|
|
114
|
+
Type.Object({
|
|
115
|
+
action: Type.Literal("press"),
|
|
116
|
+
ref: Type.Optional(Ref),
|
|
117
|
+
key: Type.String(),
|
|
118
|
+
expect: Expectation
|
|
119
|
+
}, { additionalProperties: false }),
|
|
120
|
+
Type.Object({
|
|
121
|
+
action: Type.Literal("scroll"),
|
|
122
|
+
ref: Type.Optional(Ref),
|
|
123
|
+
deltaY: Type.Number(),
|
|
124
|
+
expect: Expectation
|
|
125
|
+
}, { additionalProperties: false })
|
|
126
|
+
]);
|
|
127
|
+
const Sequence = action("sequence", {
|
|
128
|
+
revision: Revision,
|
|
129
|
+
steps: Type.Array(SequenceStep, {
|
|
130
|
+
minItems: 1,
|
|
131
|
+
maxItems: 10
|
|
132
|
+
}),
|
|
133
|
+
expect: Expectation
|
|
19
134
|
});
|
|
135
|
+
const Close = action("close", {});
|
|
136
|
+
const BrowserUseSchema = Type.Union([
|
|
137
|
+
Observe,
|
|
138
|
+
Navigate,
|
|
139
|
+
Click,
|
|
140
|
+
Fill,
|
|
141
|
+
Select,
|
|
142
|
+
Press,
|
|
143
|
+
Scroll,
|
|
144
|
+
Wait,
|
|
145
|
+
Upload,
|
|
146
|
+
Tabs,
|
|
147
|
+
Sequence,
|
|
148
|
+
Close
|
|
149
|
+
]);
|
|
20
150
|
//#endregion
|
|
21
|
-
export {
|
|
151
|
+
export { BrowserUseSchema };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { AgentTool } from '@earendil-works/pi-agent-core';
|
|
2
|
+
import type { BrowserAutomationService } from '../../browser/automations/index.js';
|
|
3
|
+
declare const BrowserAutomationToolSchema: import("@sinclair/typebox").TObject<{
|
|
4
|
+
action: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"list">, import("@sinclair/typebox").TLiteral<"get">, import("@sinclair/typebox").TLiteral<"save">, import("@sinclair/typebox").TLiteral<"enable">, import("@sinclair/typebox").TLiteral<"disable">, import("@sinclair/typebox").TLiteral<"delete">, import("@sinclair/typebox").TLiteral<"run">]>;
|
|
5
|
+
automationId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
6
|
+
definition: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
7
|
+
id: import("@sinclair/typebox").TString;
|
|
8
|
+
name: import("@sinclair/typebox").TString;
|
|
9
|
+
description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
10
|
+
allowedDomains: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
11
|
+
risk: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"read">, import("@sinclair/typebox").TLiteral<"draft">, import("@sinclair/typebox").TLiteral<"external_effect">, import("@sinclair/typebox").TLiteral<"destructive">, import("@sinclair/typebox").TLiteral<"sensitive">]>;
|
|
12
|
+
inputs: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
|
|
13
|
+
type: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"string">, import("@sinclair/typebox").TLiteral<"number">, import("@sinclair/typebox").TLiteral<"boolean">]>;
|
|
14
|
+
required: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
15
|
+
default: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TBoolean]>>;
|
|
16
|
+
description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
17
|
+
choices: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TBoolean]>>>;
|
|
18
|
+
}>>;
|
|
19
|
+
steps: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
20
|
+
action: import("@sinclair/typebox").TLiteral<"navigate">;
|
|
21
|
+
url: import("@sinclair/typebox").TString;
|
|
22
|
+
expect: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
23
|
+
urlIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
24
|
+
titleIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
25
|
+
textIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
26
|
+
ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
27
|
+
state: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"visible">, import("@sinclair/typebox").TLiteral<"hidden">]>>;
|
|
28
|
+
}>>;
|
|
29
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
30
|
+
action: import("@sinclair/typebox").TLiteral<"click">;
|
|
31
|
+
target: import("@sinclair/typebox").TObject<{
|
|
32
|
+
role: import("@sinclair/typebox").TString;
|
|
33
|
+
name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
34
|
+
nameIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
35
|
+
}>;
|
|
36
|
+
expect: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
37
|
+
urlIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
38
|
+
titleIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
39
|
+
textIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
40
|
+
ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
41
|
+
state: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"visible">, import("@sinclair/typebox").TLiteral<"hidden">]>>;
|
|
42
|
+
}>>;
|
|
43
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
44
|
+
action: import("@sinclair/typebox").TLiteral<"fill">;
|
|
45
|
+
target: import("@sinclair/typebox").TObject<{
|
|
46
|
+
role: import("@sinclair/typebox").TString;
|
|
47
|
+
name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
48
|
+
nameIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
49
|
+
}>;
|
|
50
|
+
value: import("@sinclair/typebox").TString;
|
|
51
|
+
submit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
52
|
+
expect: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
53
|
+
urlIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
54
|
+
titleIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
55
|
+
textIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
56
|
+
ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
57
|
+
state: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"visible">, import("@sinclair/typebox").TLiteral<"hidden">]>>;
|
|
58
|
+
}>>;
|
|
59
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
60
|
+
action: import("@sinclair/typebox").TLiteral<"select">;
|
|
61
|
+
target: import("@sinclair/typebox").TObject<{
|
|
62
|
+
role: import("@sinclair/typebox").TString;
|
|
63
|
+
name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
64
|
+
nameIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
65
|
+
}>;
|
|
66
|
+
value: import("@sinclair/typebox").TString;
|
|
67
|
+
expect: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
68
|
+
urlIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
69
|
+
titleIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
70
|
+
textIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
71
|
+
ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
72
|
+
state: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"visible">, import("@sinclair/typebox").TLiteral<"hidden">]>>;
|
|
73
|
+
}>>;
|
|
74
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
75
|
+
action: import("@sinclair/typebox").TLiteral<"press">;
|
|
76
|
+
target: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
77
|
+
role: import("@sinclair/typebox").TString;
|
|
78
|
+
name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
79
|
+
nameIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
80
|
+
}>>;
|
|
81
|
+
key: import("@sinclair/typebox").TString;
|
|
82
|
+
expect: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
83
|
+
urlIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
84
|
+
titleIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
85
|
+
textIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
86
|
+
ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
87
|
+
state: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"visible">, import("@sinclair/typebox").TLiteral<"hidden">]>>;
|
|
88
|
+
}>>;
|
|
89
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
90
|
+
action: import("@sinclair/typebox").TLiteral<"scroll">;
|
|
91
|
+
target: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
92
|
+
role: import("@sinclair/typebox").TString;
|
|
93
|
+
name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
94
|
+
nameIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
95
|
+
}>>;
|
|
96
|
+
deltaY: import("@sinclair/typebox").TNumber;
|
|
97
|
+
expect: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
98
|
+
urlIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
99
|
+
titleIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
100
|
+
textIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
101
|
+
ref: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
102
|
+
state: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"visible">, import("@sinclair/typebox").TLiteral<"hidden">]>>;
|
|
103
|
+
}>>;
|
|
104
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
105
|
+
action: import("@sinclair/typebox").TLiteral<"wait">;
|
|
106
|
+
condition: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"page_idle">, import("@sinclair/typebox").TLiteral<"text">, import("@sinclair/typebox").TLiteral<"visible">, import("@sinclair/typebox").TLiteral<"hidden">]>;
|
|
107
|
+
value: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
108
|
+
target: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
|
109
|
+
role: import("@sinclair/typebox").TString;
|
|
110
|
+
name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
111
|
+
nameIncludes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
112
|
+
}>>;
|
|
113
|
+
timeoutMs: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
114
|
+
}>]>>;
|
|
115
|
+
}>>;
|
|
116
|
+
inputs: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
|
|
117
|
+
}>;
|
|
118
|
+
export declare function createBrowserAutomationTool(deps: {
|
|
119
|
+
getBrowserAutomationService: () => BrowserAutomationService | undefined;
|
|
120
|
+
}): AgentTool<typeof BrowserAutomationToolSchema, Record<string, unknown>>;
|
|
121
|
+
export {};
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
//#region src/agent/tools/browser-automation-tool.ts
|
|
3
|
+
const ExpectationSchema = Type.Object({
|
|
4
|
+
urlIncludes: Type.Optional(Type.String()),
|
|
5
|
+
titleIncludes: Type.Optional(Type.String()),
|
|
6
|
+
textIncludes: Type.Optional(Type.String()),
|
|
7
|
+
ref: Type.Optional(Type.String()),
|
|
8
|
+
state: Type.Optional(Type.Union([Type.Literal("visible"), Type.Literal("hidden")]))
|
|
9
|
+
}, { additionalProperties: false });
|
|
10
|
+
const TargetSchema = Type.Object({
|
|
11
|
+
role: Type.String(),
|
|
12
|
+
name: Type.Optional(Type.String()),
|
|
13
|
+
nameIncludes: Type.Optional(Type.String())
|
|
14
|
+
}, { additionalProperties: false });
|
|
15
|
+
const StepSchema = Type.Union([
|
|
16
|
+
Type.Object({
|
|
17
|
+
action: Type.Literal("navigate"),
|
|
18
|
+
url: Type.String(),
|
|
19
|
+
expect: Type.Optional(ExpectationSchema)
|
|
20
|
+
}, { additionalProperties: false }),
|
|
21
|
+
Type.Object({
|
|
22
|
+
action: Type.Literal("click"),
|
|
23
|
+
target: TargetSchema,
|
|
24
|
+
expect: Type.Optional(ExpectationSchema)
|
|
25
|
+
}, { additionalProperties: false }),
|
|
26
|
+
Type.Object({
|
|
27
|
+
action: Type.Literal("fill"),
|
|
28
|
+
target: TargetSchema,
|
|
29
|
+
value: Type.String(),
|
|
30
|
+
submit: Type.Optional(Type.Boolean()),
|
|
31
|
+
expect: Type.Optional(ExpectationSchema)
|
|
32
|
+
}, { additionalProperties: false }),
|
|
33
|
+
Type.Object({
|
|
34
|
+
action: Type.Literal("select"),
|
|
35
|
+
target: TargetSchema,
|
|
36
|
+
value: Type.String(),
|
|
37
|
+
expect: Type.Optional(ExpectationSchema)
|
|
38
|
+
}, { additionalProperties: false }),
|
|
39
|
+
Type.Object({
|
|
40
|
+
action: Type.Literal("press"),
|
|
41
|
+
target: Type.Optional(TargetSchema),
|
|
42
|
+
key: Type.String(),
|
|
43
|
+
expect: Type.Optional(ExpectationSchema)
|
|
44
|
+
}, { additionalProperties: false }),
|
|
45
|
+
Type.Object({
|
|
46
|
+
action: Type.Literal("scroll"),
|
|
47
|
+
target: Type.Optional(TargetSchema),
|
|
48
|
+
deltaY: Type.Number(),
|
|
49
|
+
expect: Type.Optional(ExpectationSchema)
|
|
50
|
+
}, { additionalProperties: false }),
|
|
51
|
+
Type.Object({
|
|
52
|
+
action: Type.Literal("wait"),
|
|
53
|
+
condition: Type.Union([
|
|
54
|
+
Type.Literal("page_idle"),
|
|
55
|
+
Type.Literal("text"),
|
|
56
|
+
Type.Literal("visible"),
|
|
57
|
+
Type.Literal("hidden")
|
|
58
|
+
]),
|
|
59
|
+
value: Type.Optional(Type.String()),
|
|
60
|
+
target: Type.Optional(TargetSchema),
|
|
61
|
+
timeoutMs: Type.Optional(Type.Integer())
|
|
62
|
+
}, { additionalProperties: false })
|
|
63
|
+
]);
|
|
64
|
+
const BrowserAutomationToolSchema = Type.Object({
|
|
65
|
+
action: Type.Union([
|
|
66
|
+
Type.Literal("list"),
|
|
67
|
+
Type.Literal("get"),
|
|
68
|
+
Type.Literal("save"),
|
|
69
|
+
Type.Literal("enable"),
|
|
70
|
+
Type.Literal("disable"),
|
|
71
|
+
Type.Literal("delete"),
|
|
72
|
+
Type.Literal("run")
|
|
73
|
+
]),
|
|
74
|
+
automationId: Type.Optional(Type.String()),
|
|
75
|
+
definition: Type.Optional(Type.Object({
|
|
76
|
+
id: Type.String(),
|
|
77
|
+
name: Type.String(),
|
|
78
|
+
description: Type.Optional(Type.String()),
|
|
79
|
+
allowedDomains: Type.Array(Type.String()),
|
|
80
|
+
risk: Type.Union([
|
|
81
|
+
Type.Literal("read"),
|
|
82
|
+
Type.Literal("draft"),
|
|
83
|
+
Type.Literal("external_effect"),
|
|
84
|
+
Type.Literal("destructive"),
|
|
85
|
+
Type.Literal("sensitive")
|
|
86
|
+
]),
|
|
87
|
+
inputs: Type.Record(Type.String(), Type.Object({
|
|
88
|
+
type: Type.Union([
|
|
89
|
+
Type.Literal("string"),
|
|
90
|
+
Type.Literal("number"),
|
|
91
|
+
Type.Literal("boolean")
|
|
92
|
+
]),
|
|
93
|
+
required: Type.Optional(Type.Boolean()),
|
|
94
|
+
default: Type.Optional(Type.Union([
|
|
95
|
+
Type.String(),
|
|
96
|
+
Type.Number(),
|
|
97
|
+
Type.Boolean()
|
|
98
|
+
])),
|
|
99
|
+
description: Type.Optional(Type.String()),
|
|
100
|
+
choices: Type.Optional(Type.Array(Type.Union([
|
|
101
|
+
Type.String(),
|
|
102
|
+
Type.Number(),
|
|
103
|
+
Type.Boolean()
|
|
104
|
+
])))
|
|
105
|
+
}, { additionalProperties: false })),
|
|
106
|
+
steps: Type.Array(StepSchema)
|
|
107
|
+
}, { additionalProperties: false })),
|
|
108
|
+
inputs: Type.Optional(Type.Record(Type.String(), Type.Unknown()))
|
|
109
|
+
}, { additionalProperties: false });
|
|
110
|
+
function createBrowserAutomationTool(deps) {
|
|
111
|
+
return {
|
|
112
|
+
name: "browser_automation",
|
|
113
|
+
label: "Browser Automation",
|
|
114
|
+
description: "Create and run strict JSON browser automations. Saved steps use semantic role/name targets and exact allowed domains; CSS, XPath, JavaScript, cookies, and network access are not supported.",
|
|
115
|
+
parameters: BrowserAutomationToolSchema,
|
|
116
|
+
async execute(_toolCallId, params, signal) {
|
|
117
|
+
const service = deps.getBrowserAutomationService();
|
|
118
|
+
if (!service) return output("Browser automation is unavailable.", { ok: false });
|
|
119
|
+
if (params.action === "list") {
|
|
120
|
+
const automations = service.list();
|
|
121
|
+
return output(automations.length ? automations.map((item) => `- ${item.id}: ${item.definition.name} (${item.status}, ${item.definition.risk})`).join("\n") : "No browser automations.", {
|
|
122
|
+
ok: true,
|
|
123
|
+
automations
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
if (params.action === "save") {
|
|
127
|
+
if (!params.definition) return output("definition is required.", { ok: false });
|
|
128
|
+
try {
|
|
129
|
+
const automation = service.save({ definition: params.definition });
|
|
130
|
+
return output(`Saved browser automation: ${automation.definition.name}`, {
|
|
131
|
+
ok: true,
|
|
132
|
+
automation
|
|
133
|
+
});
|
|
134
|
+
} catch (error) {
|
|
135
|
+
return output(`Could not save browser automation: ${message(error)}`, {
|
|
136
|
+
ok: false,
|
|
137
|
+
error: message(error)
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const id = params.automationId?.trim();
|
|
142
|
+
if (!id) return output("automationId is required.", { ok: false });
|
|
143
|
+
const current = service.get(id);
|
|
144
|
+
if (params.action === "get") return current ? output(JSON.stringify(current.definition, null, 2), {
|
|
145
|
+
ok: true,
|
|
146
|
+
automation: current
|
|
147
|
+
}) : output(`Browser automation not found: ${id}`, { ok: false });
|
|
148
|
+
if (params.action === "enable" || params.action === "disable") {
|
|
149
|
+
if (!current) return output(`Browser automation not found: ${id}`, { ok: false });
|
|
150
|
+
const automation = service.save({
|
|
151
|
+
definition: current.definition,
|
|
152
|
+
expectedId: id,
|
|
153
|
+
status: params.action === "enable" ? "enabled" : "disabled"
|
|
154
|
+
});
|
|
155
|
+
return output(`${automation.definition.name} is ${automation.status}.`, {
|
|
156
|
+
ok: true,
|
|
157
|
+
automation
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
if (params.action === "delete") try {
|
|
161
|
+
const removed = service.remove(id);
|
|
162
|
+
return output(removed ? `Deleted browser automation: ${id}` : `Browser automation not found: ${id}`, { ok: removed });
|
|
163
|
+
} catch (error) {
|
|
164
|
+
return output(`Could not delete browser automation: ${message(error)}`, {
|
|
165
|
+
ok: false,
|
|
166
|
+
error: message(error)
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
try {
|
|
170
|
+
const run = await service.runAndWait(id, params.inputs ?? {}, signal);
|
|
171
|
+
return output(run.status === "succeeded" ? `Browser automation ${id} completed.` : `Browser automation ${id} ${run.status}: ${run.error ?? "No details"}`, {
|
|
172
|
+
ok: run.status === "succeeded",
|
|
173
|
+
run
|
|
174
|
+
});
|
|
175
|
+
} catch (error) {
|
|
176
|
+
return output(`Browser automation failed: ${message(error)}`, {
|
|
177
|
+
ok: false,
|
|
178
|
+
error: message(error)
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
function output(text, details) {
|
|
185
|
+
return {
|
|
186
|
+
content: [{
|
|
187
|
+
type: "text",
|
|
188
|
+
text
|
|
189
|
+
}],
|
|
190
|
+
details
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function message(error) {
|
|
194
|
+
return error instanceof Error ? error.message : String(error);
|
|
195
|
+
}
|
|
196
|
+
//#endregion
|
|
197
|
+
export { createBrowserAutomationTool };
|
|
@@ -18,7 +18,7 @@ import type { MemoryManager } from '../memory/manager.js';
|
|
|
18
18
|
import type { SessionStore } from '../../session/store.js';
|
|
19
19
|
import type { GatewayClarifyRequestFn } from './clarify-tool.js';
|
|
20
20
|
import type { AutomationService } from '../../automations/index.js';
|
|
21
|
-
import type {
|
|
21
|
+
import type { BrowserAutomationService } from '../../browser/automations/index.js';
|
|
22
22
|
import type { NotesService } from '../../notes/index.js';
|
|
23
23
|
import type { ProjectService } from '../../projects/index.js';
|
|
24
24
|
import type { LocalAppService } from '../../local-apps/index.js';
|
|
@@ -54,7 +54,8 @@ export interface ToolFactoryDeps {
|
|
|
54
54
|
};
|
|
55
55
|
/** Gateway: enables the `automation` tool. */
|
|
56
56
|
getAutomationService?: () => AutomationService | undefined;
|
|
57
|
-
|
|
57
|
+
getBrowserAutomationService?: () => BrowserAutomationService | undefined;
|
|
58
|
+
emitBrowserEvent?: (type: string, payload: unknown) => void;
|
|
58
59
|
/** Gateway: enables the `xopc_use` product-object tool. */
|
|
59
60
|
getNotesService?: () => NotesService | undefined;
|
|
60
61
|
getProjectService?: () => ProjectService | undefined;
|
|
@@ -98,10 +99,8 @@ export interface CreateCoreToolsOptions {
|
|
|
98
99
|
}
|
|
99
100
|
export declare class AgentToolsFactory {
|
|
100
101
|
private deps;
|
|
101
|
-
private
|
|
102
|
-
/**
|
|
103
|
-
private readonly browserTaskSupervisors;
|
|
104
|
-
/** Cached readiness probe — keyed by backend mode + extension host:port. */
|
|
102
|
+
private browserRuntime;
|
|
103
|
+
/** Cached readiness probe keyed by the active driver configuration. */
|
|
105
104
|
private browserReadinessCache;
|
|
106
105
|
constructor(deps: ToolFactoryDeps);
|
|
107
106
|
private prepareRuntimeEnv;
|
|
@@ -109,9 +108,7 @@ export declare class AgentToolsFactory {
|
|
|
109
108
|
private checkBrowserReadinessCached;
|
|
110
109
|
/** Invalidate the readiness cache (config hot-reload, settings-page save, etc.). */
|
|
111
110
|
invalidateBrowserReadinessCache(): void;
|
|
112
|
-
private
|
|
113
|
-
private acquireBrowserPage;
|
|
114
|
-
private ensureBrowserManager;
|
|
111
|
+
private ensureBrowserRuntime;
|
|
115
112
|
/** Close Playwright and all pages (gateway stop, agent manager dispose, or config hot-reload). */
|
|
116
113
|
shutdownBrowser(): Promise<void>;
|
|
117
114
|
/** Drop the tab for a session when its agent instance is removed. */
|