@xopcai/xopc 0.0.251 → 0.0.253
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/src/inbound-processor.js +2 -2
- package/dist/extensions/telegram/src/plugin.js +3 -2
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-DfBjTSo9.js → activity-store-CeS1bgXP.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Bo_dmLv8.js → agent-avatar-dicebear-BdF3HhCW.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-Bs34Kp0K.js +1 -0
- package/dist/gateway/static/root/assets/{agents-yuUn8n-f.js → agents-DARlgjTm.js} +1 -1
- package/dist/gateway/static/root/assets/{api-zxpcJfgj.js → api-zMPeC0yU.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-Cz56nrVF.js → app-management-settings-panel-BaAFln8W.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DxSws5U4.js → appearance-settings-CXvsoBlw.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-BhgvfBJT.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-7k15-hqo.js → archive-plugin-C0o_mVQI.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-B-SFpjd9.js → attachment-load-B5Ry3tGL.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-Qy36j19q.js → automations-page-DY5QAEQd.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BzX4lILP.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-CPOZQt8F.js → binary-plugins-BydpEgBA.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DhvVlIp9.js → block-editor-D0CpUOMo.js} +3 -3
- package/dist/gateway/static/root/assets/browser-automation-inputs-DzbTsGI6.js +1 -0
- package/dist/gateway/static/root/assets/browser-automations-page-D7fZYjni.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-BBdMqxl0.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-D_WfftDW.js +7 -0
- package/dist/gateway/static/root/assets/channels-settings-bdRLT9KA.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-CX-yWwLD.js → channels-status-swr-BGGRTkn6.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-1PJoxRuV.js → chat-terminal-dock-_CP4nvlg.js} +2 -2
- package/dist/gateway/static/root/assets/connectors-page-CPDjU5wU.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-CBCc6zFA.js → cron-expression-g2U8Rllf.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-u8K5Kt_N.js → date-picker-SmVlhtj_.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-y_i_cnpz.js → dependency-picker-D-0gcbbM.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DyL0JxLm.js → desktop-pet-Cl3JRIu6.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-d2d_IsyP.js → desktop-pet-settings-D7kvWQ9H.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DqIBKJwl.js → extension-debug-page-DtP2tJHY.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DUW1xxj2.js → extension-page-CphZDdoT.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BHY9qaNw.js → extension-settings-page-CsxVLV4-.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-CMNbl0FZ.js → gateway-config-swr-BW3Bx-aV.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-DxBZ05dX.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CR7Xg8As.js → gateway-startup-retry-DAq74TZe.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-7CD9iPR7.js → heartbeat-settings-DWcKsIoZ.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-BdvLZKQZ.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-C5mn73ca.js → image-generation-api-MPuaXDRs.js} +1 -1
- package/dist/gateway/static/root/assets/index-C7RDs6S-.js +74 -0
- package/dist/gateway/static/root/assets/index-Cu8xqZQ9.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BtlqMleF.js → keyboard-shortcuts-settings-CfhaTqgE.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-BjxfkjxE.js → local-app-workbench-page-CR6asX7L.js} +2 -2
- package/dist/gateway/static/root/assets/{local-apps-page-B7xqQe2s.js → local-apps-page-g01W3kEK.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-CF4erhjB.js → locale-store-BkeaPZpn.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-kACaPZKL.js → logs-page-ZP4QTWoC.js} +2 -2
- package/dist/gateway/static/root/assets/{management-settings-A432siER.js → management-settings-DeGxJF_Z.js} +1 -1
- package/dist/gateway/static/root/assets/markdown-view-Ca7BRBLL.js +201 -0
- package/dist/gateway/static/root/assets/{media-plugins-CpvYiauZ.js → media-plugins-FmOhmzlD.js} +1 -1
- package/dist/gateway/static/root/assets/messages-C72stReU.js +3 -0
- package/dist/gateway/static/root/assets/{mobile-pairing-wizard-DyjVGngO.js → mobile-pairing-wizard-BXNbn05L.js} +1 -1
- package/dist/gateway/static/root/assets/note-detail-panel-EeVeF4II.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-D7bMff96.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-B3FKzjR6.js → page-tabs-pyukZ1PJ.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-DnjrwAHD.js → preview-open-alternatives-slFHoMUe.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-COcr_NUJ.js → product-open-page-CXa3FNNk.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-BDF88VdN.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DeTD6pu1.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BsRBlji7.js → registry-api-CviQoUBf.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CxKrdQ6a.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-LO4wZ_dO.js → runtime-tools-settings-panel-O9D9o7-O.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-crcj4-Pm.js → schema-form-8FesicnL.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DUFJN-2t.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CcSYDjaH.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-Bl4MvTmq.js → settings-form-section-CBic9TFH.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DplrjZ6x.js → settings-page-Xz66_Mjg.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-C6DuwrP5.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-CJP1kURj.js → share-preview-page--JpjwB58.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-CemgzEi4.js → shares-settings-CovcdHSC.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CrHagTsE.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-DsjcKg9Q.js → skills-page-fVKExKv5.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-D6gWBbvy.js → skills-page.utils-Yv9u3uJp.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-_eCXfqCo.js → system-settings-panel-CCWjVdc2.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-D0Z_K5JT.js → task-detail-page-I8hueJnG.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-BOgkc_9D.js → theme-store-BtkaVpMm.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-W5mktxl1.js → tunnel-api-C__W9BaN.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-Na2DYzT3.js → use-autosave-Dow9RRcq.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-CU6nxmoM.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-OXweUxS_.js → voice-api-key-field-CvF3lEyx.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-C-ryeIxj.js → voice-config-api-BEUVAyM6.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BqOsO47I.js → work-discovery-overlay-B9PDfReq.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-B9S_lfT1.js → workflow-run-setup-panel-kWGFkhjz.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-B4Is5E42.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/packages/realtime-protocol/src/voice.js +6 -1
- package/dist/src/agent/agent-manager.d.ts +2 -1
- package/dist/src/agent/agent-manager.js +26 -8
- package/dist/src/agent/background-review/run-background-review.js +1 -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/embedded/execution-context.d.ts +2 -1
- package/dist/src/agent/embedded/execution-context.js +10 -4
- package/dist/src/agent/embedded/index.d.ts +1 -1
- package/dist/src/agent/embedded/index.js +2 -2
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +5 -4
- package/dist/src/agent/embedded/run-turn.js +22 -3
- package/dist/src/agent/embedded/types.d.ts +1 -1
- 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/image/tool-model-config.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js +6 -3
- package/dist/src/agent/service/process-direct-streaming.js +6 -3
- package/dist/src/agent/service.d.ts +2 -0
- package/dist/src/agent/service.js +25 -10
- package/dist/src/agent/service.types.d.ts +2 -1
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +4 -0
- package/dist/src/agent/tasks/task-judge-service.js +3 -3
- 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/clarify-tool.d.ts +17 -3
- package/dist/src/agent/tools/clarify-tool.js +27 -32
- package/dist/src/agent/tools/cli-clarify.js +23 -8
- package/dist/src/agent/tools/factory.d.ts +6 -9
- package/dist/src/agent/tools/factory.js +42 -59
- 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/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/oauth/xopc-cloud.js +3 -1
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- 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 +16 -16
- package/dist/src/automations/domain/validation.js +3 -3
- package/dist/src/automations/draft/automation-draft-validator.d.ts +4 -4
- 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 +4 -6
- 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/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/platform.d.ts +1 -0
- package/dist/src/cli/commands/platform.js +111 -0
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +10 -4
- package/dist/src/config/models-json.js +1 -1
- 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/lockfile.js +1 -1
- package/dist/src/extensions/marketplace.js +4 -0
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/chat-stream/mapper.js +5 -1
- package/dist/src/gateway/chat-stream/protocol.d.ts +5 -1
- package/dist/src/gateway/clarify-runtime.d.ts +7 -5
- package/dist/src/gateway/clarify-runtime.js +8 -11
- package/dist/src/gateway/ephemeral-clarification-waiter.d.ts +17 -0
- package/dist/src/gateway/ephemeral-clarification-waiter.js +46 -0
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +12 -26
- package/dist/src/gateway/hono/lib/config-payload.js +11 -40
- package/dist/src/gateway/hono/routes/agent-stream.js +44 -18
- 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/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +10 -2
- package/dist/src/gateway/hono/routes/side-chats.js +24 -4
- package/dist/src/gateway/security/gateway-scopes.js +1 -1
- package/dist/src/gateway/service/agent-runner.d.ts +25 -36
- package/dist/src/gateway/service/agent-runner.js +103 -32
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service/run-gateway-agent.js +5 -2
- package/dist/src/gateway/service/session-input-coordinator.js +4 -1
- package/dist/src/gateway/service/sessions-api.js +1 -1
- package/dist/src/gateway/service.d.ts +8 -8
- package/dist/src/gateway/service.js +50 -37
- package/dist/src/gateway/side-chat/manager.d.ts +2 -1
- package/dist/src/gateway/side-chat/manager.js +5 -4
- package/dist/src/gateway/side-chat/run-service.d.ts +5 -1
- package/dist/src/gateway/side-chat/run-service.js +24 -23
- package/dist/src/gateway/side-chat/types.d.ts +3 -1
- package/dist/src/heartbeat/index.js +1 -1
- 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/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- 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/clarification-wait-repository.d.ts +41 -0
- package/dist/src/storage/sqlite/clarification-wait-repository.js +418 -0
- package/dist/src/storage/sqlite/index.d.ts +2 -1
- package/dist/src/storage/sqlite/index.js +2 -1
- package/dist/src/storage/sqlite/migrations/153_browser_control_v2.sql +45 -0
- package/dist/src/storage/sqlite/migrations/154_session_clarification_waits.sql +60 -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/storage/sqlite/session-input-repository.d.ts +11 -6
- package/dist/src/tasks/home-query-service.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/tunnel/env.js +3 -1
- package/dist/src/voice/realtime/agentEngine.js +7 -2
- package/dist/src/voice/realtime/runtime.types.d.ts +5 -0
- package/dist/src/work-discovery/service.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +7 -7
- package/skills/creative/hatch-pet/SKILL.md +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-kILWelNb.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-BnizTdgs.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-CZRKqSqY.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-pN5LbChY.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-C65MI57t.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CJw2e16J.js +0 -7
- package/dist/gateway/static/root/assets/channels-settings-CRgjb4Ck.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-Dcpdy06y.js +0 -2
- package/dist/gateway/static/root/assets/gateway-config-api-e3BRcgDx.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-Cheo0Rkc.js +0 -1
- package/dist/gateway/static/root/assets/home-page-DVrTRqNc.js +0 -1
- package/dist/gateway/static/root/assets/index-B7CX4Qob.css +0 -2
- package/dist/gateway/static/root/assets/index-BHrpyJ4t.js +0 -72
- package/dist/gateway/static/root/assets/markdown-view-CQvzsE24.js +0 -201
- package/dist/gateway/static/root/assets/messages-Cf5hpZE6.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-CUd8O4K7.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-BLQwd39W.js +0 -8
- package/dist/gateway/static/root/assets/project-detail-page-NttW338u.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-BzH8pjEz.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BxpjSDnL.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BLMaibOb.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BRvvKhoH.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DTOsxQC1.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BWYanBlQ.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-B_-SNat-.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-CNOT2Coo.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/clarify-bridge.d.ts +0 -46
- package/dist/src/gateway/clarify-bridge.js +0 -111
- 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
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { BrowserControlResult } from '@xopcai/browser-control-contract';
|
|
2
|
+
import type { BrowserRuntime } from '../runtime/browser-runtime.js';
|
|
3
|
+
import type { BrowserAutomationDefinition } from './types.js';
|
|
4
|
+
export declare function runBrowserAutomation(input: {
|
|
5
|
+
definition: BrowserAutomationDefinition;
|
|
6
|
+
inputs: Record<string, unknown>;
|
|
7
|
+
runtime: BrowserRuntime;
|
|
8
|
+
taskKey: string;
|
|
9
|
+
signal: AbortSignal;
|
|
10
|
+
onStep: (event: {
|
|
11
|
+
index: number;
|
|
12
|
+
action: string;
|
|
13
|
+
status: 'started' | 'completed' | 'failed';
|
|
14
|
+
result?: BrowserControlResult;
|
|
15
|
+
}) => void;
|
|
16
|
+
}): Promise<BrowserControlResult>;
|
|
17
|
+
export declare function resolveBrowserAutomationInputs(definition: BrowserAutomationDefinition, provided: Record<string, unknown>): Record<string, unknown>;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
//#region src/browser/automations/runner.ts
|
|
2
|
+
async function runBrowserAutomation(input) {
|
|
3
|
+
const startedAt = Date.now();
|
|
4
|
+
const values = resolveBrowserAutomationInputs(input.definition, input.inputs);
|
|
5
|
+
let observation;
|
|
6
|
+
let sessionId;
|
|
7
|
+
for (let index = 0; index < input.definition.steps.length; index += 1) {
|
|
8
|
+
const step = input.definition.steps[index];
|
|
9
|
+
input.onStep({
|
|
10
|
+
index,
|
|
11
|
+
action: step.action,
|
|
12
|
+
status: "started"
|
|
13
|
+
});
|
|
14
|
+
try {
|
|
15
|
+
if (step.action !== "navigate" && !observation) {
|
|
16
|
+
const observed = await input.runtime.execute(input.taskKey, {
|
|
17
|
+
action: "observe",
|
|
18
|
+
sessionId
|
|
19
|
+
}, input.signal);
|
|
20
|
+
if (!observed.ok) {
|
|
21
|
+
input.onStep({
|
|
22
|
+
index,
|
|
23
|
+
action: step.action,
|
|
24
|
+
status: "failed",
|
|
25
|
+
result: observed
|
|
26
|
+
});
|
|
27
|
+
return observed;
|
|
28
|
+
}
|
|
29
|
+
observation = observed.receipt.observation;
|
|
30
|
+
sessionId = observation?.sessionId;
|
|
31
|
+
}
|
|
32
|
+
if (step.action === "navigate") assertAllowedDomain(input.definition.allowedDomains, render(step.url, values));
|
|
33
|
+
const action = buildAction(step, values, observation, sessionId);
|
|
34
|
+
const result = await input.runtime.execute(input.taskKey, action, input.signal);
|
|
35
|
+
if (!result.ok) {
|
|
36
|
+
input.onStep({
|
|
37
|
+
index,
|
|
38
|
+
action: step.action,
|
|
39
|
+
status: "failed",
|
|
40
|
+
result
|
|
41
|
+
});
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
observation = result.receipt.observation ?? observation;
|
|
45
|
+
sessionId = observation?.sessionId ?? sessionId;
|
|
46
|
+
if (step.action === "navigate") assertAllowedDomain(input.definition.allowedDomains, observation?.url ?? render(step.url, values));
|
|
47
|
+
input.onStep({
|
|
48
|
+
index,
|
|
49
|
+
action: step.action,
|
|
50
|
+
status: "completed",
|
|
51
|
+
result
|
|
52
|
+
});
|
|
53
|
+
} catch (error) {
|
|
54
|
+
const result = automationFailure(step.action === "navigate" ? "BLOCKED_URL" : "INVALID_INPUT", error, observation);
|
|
55
|
+
input.onStep({
|
|
56
|
+
index,
|
|
57
|
+
action: step.action,
|
|
58
|
+
status: "failed",
|
|
59
|
+
result
|
|
60
|
+
});
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
ok: true,
|
|
66
|
+
receipt: {
|
|
67
|
+
action: "sequence",
|
|
68
|
+
risk: input.definition.risk,
|
|
69
|
+
durationMs: Date.now() - startedAt,
|
|
70
|
+
verified: true,
|
|
71
|
+
observation
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function buildAction(step, inputs, observation, sessionId) {
|
|
76
|
+
if (step.action === "navigate") return {
|
|
77
|
+
...step,
|
|
78
|
+
url: render(step.url, inputs),
|
|
79
|
+
sessionId
|
|
80
|
+
};
|
|
81
|
+
if (!observation) throw new Error("Browser observation is unavailable.");
|
|
82
|
+
const revision = observation.revision;
|
|
83
|
+
const ref = "target" in step && step.target ? resolveTarget(step.target, observation) : void 0;
|
|
84
|
+
switch (step.action) {
|
|
85
|
+
case "click": return {
|
|
86
|
+
action: "click",
|
|
87
|
+
sessionId,
|
|
88
|
+
revision,
|
|
89
|
+
ref,
|
|
90
|
+
expect: step.expect
|
|
91
|
+
};
|
|
92
|
+
case "fill": return {
|
|
93
|
+
action: "fill",
|
|
94
|
+
sessionId,
|
|
95
|
+
revision,
|
|
96
|
+
ref,
|
|
97
|
+
value: render(step.value, inputs),
|
|
98
|
+
submit: step.submit,
|
|
99
|
+
expect: step.expect
|
|
100
|
+
};
|
|
101
|
+
case "select": return {
|
|
102
|
+
action: "select",
|
|
103
|
+
sessionId,
|
|
104
|
+
revision,
|
|
105
|
+
ref,
|
|
106
|
+
value: render(step.value, inputs),
|
|
107
|
+
expect: step.expect
|
|
108
|
+
};
|
|
109
|
+
case "press": return {
|
|
110
|
+
action: "press",
|
|
111
|
+
sessionId,
|
|
112
|
+
revision,
|
|
113
|
+
ref,
|
|
114
|
+
key: render(step.key, inputs),
|
|
115
|
+
expect: step.expect
|
|
116
|
+
};
|
|
117
|
+
case "scroll": return {
|
|
118
|
+
action: "scroll",
|
|
119
|
+
sessionId,
|
|
120
|
+
revision,
|
|
121
|
+
ref,
|
|
122
|
+
deltaY: step.deltaY,
|
|
123
|
+
expect: step.expect
|
|
124
|
+
};
|
|
125
|
+
case "wait": return {
|
|
126
|
+
action: "wait",
|
|
127
|
+
sessionId,
|
|
128
|
+
revision,
|
|
129
|
+
ref,
|
|
130
|
+
condition: step.condition,
|
|
131
|
+
value: step.value ? render(step.value, inputs) : void 0,
|
|
132
|
+
timeoutMs: step.timeoutMs
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function resolveTarget(target, observation) {
|
|
137
|
+
const matches = observation.nodes.filter((node) => node.role === target.role && (!target.name || node.name === target.name) && (!target.nameIncludes || node.name.includes(target.nameIncludes)));
|
|
138
|
+
if (matches.length !== 1) throw new Error(`Semantic target must match exactly one element; matched ${matches.length}: ${JSON.stringify(target)}`);
|
|
139
|
+
return matches[0].ref;
|
|
140
|
+
}
|
|
141
|
+
function render(value, inputs) {
|
|
142
|
+
return value.replace(/\$\{input\.([a-zA-Z][a-zA-Z0-9_]*)\}/g, (_match, key) => {
|
|
143
|
+
if (!(key in inputs)) throw new Error(`Missing automation input: ${key}`);
|
|
144
|
+
return String(inputs[key]);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function resolveBrowserAutomationInputs(definition, provided) {
|
|
148
|
+
const values = { ...provided };
|
|
149
|
+
for (const [name, spec] of Object.entries(definition.inputs)) {
|
|
150
|
+
const value = values[name] ?? spec.default;
|
|
151
|
+
if (value === void 0 && spec.required) throw new Error(`Missing required automation input: ${name}`);
|
|
152
|
+
if (value !== void 0 && typeof value !== spec.type) throw new Error(`Automation input ${name} must be ${spec.type}.`);
|
|
153
|
+
if (values[name] === void 0 && value !== void 0) values[name] = value;
|
|
154
|
+
}
|
|
155
|
+
for (const name of Object.keys(values)) if (!definition.inputs[name]) throw new Error(`Unknown automation input: ${name}`);
|
|
156
|
+
return values;
|
|
157
|
+
}
|
|
158
|
+
function assertAllowedDomain(allowedDomains, url) {
|
|
159
|
+
const host = new URL(url).hostname.toLowerCase();
|
|
160
|
+
if (!allowedDomains.some((domain) => domain.toLowerCase() === host)) throw new Error(`Automation navigated outside its allowed domains: ${host}`);
|
|
161
|
+
}
|
|
162
|
+
function automationFailure(code, error, observation) {
|
|
163
|
+
return {
|
|
164
|
+
ok: false,
|
|
165
|
+
error: {
|
|
166
|
+
code,
|
|
167
|
+
message: error instanceof Error ? error.message : String(error),
|
|
168
|
+
observation
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
//#endregion
|
|
173
|
+
export { resolveBrowserAutomationInputs, runBrowserAutomation };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Config } from '../../config/schema.js';
|
|
2
|
+
import { BrowserAutomationService } from './service.js';
|
|
3
|
+
export declare function createRuntimeBrowserAutomationService(deps: {
|
|
4
|
+
getConfig: () => Config;
|
|
5
|
+
emit?: (type: string, payload: unknown) => void;
|
|
6
|
+
}): BrowserAutomationService;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BrowserRuntime } from "../runtime/browser-runtime.js";
|
|
2
|
+
import { createBrowserDriver } from "../drivers/create-driver.js";
|
|
3
|
+
import { runBrowserAutomation } from "./runner.js";
|
|
4
|
+
import { BrowserAutomationService } from "./service.js";
|
|
5
|
+
//#region src/browser/automations/runtime-service.ts
|
|
6
|
+
function createRuntimeBrowserAutomationService(deps) {
|
|
7
|
+
const runtime = new BrowserRuntime({
|
|
8
|
+
getConfig: () => deps.getConfig().browser,
|
|
9
|
+
createDriver: () => createBrowserDriver(deps.getConfig().browser),
|
|
10
|
+
allowedUploadRoots: [process.cwd()],
|
|
11
|
+
emit: deps.emit
|
|
12
|
+
});
|
|
13
|
+
return new BrowserAutomationService(async ({ definition, inputs, signal, onStep }) => {
|
|
14
|
+
const taskKey = `browser-automation:${crypto.randomUUID()}`;
|
|
15
|
+
try {
|
|
16
|
+
const result = await runBrowserAutomation({
|
|
17
|
+
definition,
|
|
18
|
+
inputs,
|
|
19
|
+
runtime,
|
|
20
|
+
taskKey,
|
|
21
|
+
signal,
|
|
22
|
+
onStep
|
|
23
|
+
});
|
|
24
|
+
return result.ok ? {
|
|
25
|
+
ok: true,
|
|
26
|
+
result: result.receipt
|
|
27
|
+
} : {
|
|
28
|
+
ok: false,
|
|
29
|
+
error: "error" in result ? result.error.message : "Browser automation failed."
|
|
30
|
+
};
|
|
31
|
+
} finally {
|
|
32
|
+
await runtime.closeTaskSession(taskKey);
|
|
33
|
+
}
|
|
34
|
+
}, deps.emit);
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { createRuntimeBrowserAutomationService };
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const BrowserAutomationDefinitionSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
description: z.ZodOptional<z.ZodString>;
|
|
6
|
+
allowedDomains: z.ZodArray<z.ZodString>;
|
|
7
|
+
risk: z.ZodEnum<{
|
|
8
|
+
read: "read";
|
|
9
|
+
sensitive: "sensitive";
|
|
10
|
+
destructive: "destructive";
|
|
11
|
+
draft: "draft";
|
|
12
|
+
external_effect: "external_effect";
|
|
13
|
+
}>;
|
|
14
|
+
inputs: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
15
|
+
type: z.ZodEnum<{
|
|
16
|
+
string: "string";
|
|
17
|
+
number: "number";
|
|
18
|
+
boolean: "boolean";
|
|
19
|
+
}>;
|
|
20
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
22
|
+
description: z.ZodOptional<z.ZodString>;
|
|
23
|
+
choices: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
24
|
+
}, z.core.$strict>>>;
|
|
25
|
+
steps: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
26
|
+
action: z.ZodLiteral<"navigate">;
|
|
27
|
+
url: z.ZodString;
|
|
28
|
+
expect: z.ZodOptional<z.ZodObject<{
|
|
29
|
+
urlIncludes: z.ZodOptional<z.ZodString>;
|
|
30
|
+
titleIncludes: z.ZodOptional<z.ZodString>;
|
|
31
|
+
textIncludes: z.ZodOptional<z.ZodString>;
|
|
32
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
33
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
34
|
+
hidden: "hidden";
|
|
35
|
+
visible: "visible";
|
|
36
|
+
}>>;
|
|
37
|
+
}, z.core.$strict>>;
|
|
38
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
39
|
+
action: z.ZodLiteral<"click">;
|
|
40
|
+
target: z.ZodObject<{
|
|
41
|
+
role: z.ZodString;
|
|
42
|
+
name: z.ZodOptional<z.ZodString>;
|
|
43
|
+
nameIncludes: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, z.core.$strict>;
|
|
45
|
+
expect: z.ZodOptional<z.ZodObject<{
|
|
46
|
+
urlIncludes: z.ZodOptional<z.ZodString>;
|
|
47
|
+
titleIncludes: z.ZodOptional<z.ZodString>;
|
|
48
|
+
textIncludes: z.ZodOptional<z.ZodString>;
|
|
49
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
50
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
51
|
+
hidden: "hidden";
|
|
52
|
+
visible: "visible";
|
|
53
|
+
}>>;
|
|
54
|
+
}, z.core.$strict>>;
|
|
55
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
56
|
+
action: z.ZodLiteral<"fill">;
|
|
57
|
+
target: z.ZodObject<{
|
|
58
|
+
role: z.ZodString;
|
|
59
|
+
name: z.ZodOptional<z.ZodString>;
|
|
60
|
+
nameIncludes: z.ZodOptional<z.ZodString>;
|
|
61
|
+
}, z.core.$strict>;
|
|
62
|
+
value: z.ZodString;
|
|
63
|
+
submit: z.ZodOptional<z.ZodBoolean>;
|
|
64
|
+
expect: z.ZodOptional<z.ZodObject<{
|
|
65
|
+
urlIncludes: z.ZodOptional<z.ZodString>;
|
|
66
|
+
titleIncludes: z.ZodOptional<z.ZodString>;
|
|
67
|
+
textIncludes: z.ZodOptional<z.ZodString>;
|
|
68
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
69
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
70
|
+
hidden: "hidden";
|
|
71
|
+
visible: "visible";
|
|
72
|
+
}>>;
|
|
73
|
+
}, z.core.$strict>>;
|
|
74
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
75
|
+
action: z.ZodLiteral<"select">;
|
|
76
|
+
target: z.ZodObject<{
|
|
77
|
+
role: z.ZodString;
|
|
78
|
+
name: z.ZodOptional<z.ZodString>;
|
|
79
|
+
nameIncludes: z.ZodOptional<z.ZodString>;
|
|
80
|
+
}, z.core.$strict>;
|
|
81
|
+
value: z.ZodString;
|
|
82
|
+
expect: z.ZodOptional<z.ZodObject<{
|
|
83
|
+
urlIncludes: z.ZodOptional<z.ZodString>;
|
|
84
|
+
titleIncludes: z.ZodOptional<z.ZodString>;
|
|
85
|
+
textIncludes: z.ZodOptional<z.ZodString>;
|
|
86
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
87
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
88
|
+
hidden: "hidden";
|
|
89
|
+
visible: "visible";
|
|
90
|
+
}>>;
|
|
91
|
+
}, z.core.$strict>>;
|
|
92
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
93
|
+
action: z.ZodLiteral<"press">;
|
|
94
|
+
target: z.ZodOptional<z.ZodObject<{
|
|
95
|
+
role: z.ZodString;
|
|
96
|
+
name: z.ZodOptional<z.ZodString>;
|
|
97
|
+
nameIncludes: z.ZodOptional<z.ZodString>;
|
|
98
|
+
}, z.core.$strict>>;
|
|
99
|
+
key: z.ZodString;
|
|
100
|
+
expect: z.ZodOptional<z.ZodObject<{
|
|
101
|
+
urlIncludes: z.ZodOptional<z.ZodString>;
|
|
102
|
+
titleIncludes: z.ZodOptional<z.ZodString>;
|
|
103
|
+
textIncludes: z.ZodOptional<z.ZodString>;
|
|
104
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
105
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
106
|
+
hidden: "hidden";
|
|
107
|
+
visible: "visible";
|
|
108
|
+
}>>;
|
|
109
|
+
}, z.core.$strict>>;
|
|
110
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
111
|
+
action: z.ZodLiteral<"scroll">;
|
|
112
|
+
target: z.ZodOptional<z.ZodObject<{
|
|
113
|
+
role: z.ZodString;
|
|
114
|
+
name: z.ZodOptional<z.ZodString>;
|
|
115
|
+
nameIncludes: z.ZodOptional<z.ZodString>;
|
|
116
|
+
}, z.core.$strict>>;
|
|
117
|
+
deltaY: z.ZodNumber;
|
|
118
|
+
expect: z.ZodOptional<z.ZodObject<{
|
|
119
|
+
urlIncludes: z.ZodOptional<z.ZodString>;
|
|
120
|
+
titleIncludes: z.ZodOptional<z.ZodString>;
|
|
121
|
+
textIncludes: z.ZodOptional<z.ZodString>;
|
|
122
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
123
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
124
|
+
hidden: "hidden";
|
|
125
|
+
visible: "visible";
|
|
126
|
+
}>>;
|
|
127
|
+
}, z.core.$strict>>;
|
|
128
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
129
|
+
action: z.ZodLiteral<"wait">;
|
|
130
|
+
condition: z.ZodEnum<{
|
|
131
|
+
hidden: "hidden";
|
|
132
|
+
text: "text";
|
|
133
|
+
visible: "visible";
|
|
134
|
+
page_idle: "page_idle";
|
|
135
|
+
}>;
|
|
136
|
+
value: z.ZodOptional<z.ZodString>;
|
|
137
|
+
target: z.ZodOptional<z.ZodObject<{
|
|
138
|
+
role: z.ZodString;
|
|
139
|
+
name: z.ZodOptional<z.ZodString>;
|
|
140
|
+
nameIncludes: z.ZodOptional<z.ZodString>;
|
|
141
|
+
}, z.core.$strict>>;
|
|
142
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
143
|
+
}, z.core.$strict>], "action">>;
|
|
144
|
+
}, z.core.$strict>;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/browser/automations/schema.ts
|
|
3
|
+
const ExpectationSchema = z.object({
|
|
4
|
+
urlIncludes: z.string().optional(),
|
|
5
|
+
titleIncludes: z.string().optional(),
|
|
6
|
+
textIncludes: z.string().optional(),
|
|
7
|
+
ref: z.string().optional(),
|
|
8
|
+
state: z.enum(["visible", "hidden"]).optional()
|
|
9
|
+
}).strict();
|
|
10
|
+
const TargetSchema = z.object({
|
|
11
|
+
role: z.string().min(1),
|
|
12
|
+
name: z.string().min(1).optional(),
|
|
13
|
+
nameIncludes: z.string().min(1).optional()
|
|
14
|
+
}).strict().superRefine((target, ctx) => {
|
|
15
|
+
if (target.name && target.nameIncludes) ctx.addIssue({
|
|
16
|
+
code: "custom",
|
|
17
|
+
message: "Use name or nameIncludes, not both."
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
const StepSchema = z.discriminatedUnion("action", [
|
|
21
|
+
z.object({
|
|
22
|
+
action: z.literal("navigate"),
|
|
23
|
+
url: z.string().min(1),
|
|
24
|
+
expect: ExpectationSchema.optional()
|
|
25
|
+
}).strict(),
|
|
26
|
+
z.object({
|
|
27
|
+
action: z.literal("click"),
|
|
28
|
+
target: TargetSchema,
|
|
29
|
+
expect: ExpectationSchema.optional()
|
|
30
|
+
}).strict(),
|
|
31
|
+
z.object({
|
|
32
|
+
action: z.literal("fill"),
|
|
33
|
+
target: TargetSchema,
|
|
34
|
+
value: z.string(),
|
|
35
|
+
submit: z.boolean().optional(),
|
|
36
|
+
expect: ExpectationSchema.optional()
|
|
37
|
+
}).strict(),
|
|
38
|
+
z.object({
|
|
39
|
+
action: z.literal("select"),
|
|
40
|
+
target: TargetSchema,
|
|
41
|
+
value: z.string(),
|
|
42
|
+
expect: ExpectationSchema.optional()
|
|
43
|
+
}).strict(),
|
|
44
|
+
z.object({
|
|
45
|
+
action: z.literal("press"),
|
|
46
|
+
target: TargetSchema.optional(),
|
|
47
|
+
key: z.string().min(1),
|
|
48
|
+
expect: ExpectationSchema.optional()
|
|
49
|
+
}).strict(),
|
|
50
|
+
z.object({
|
|
51
|
+
action: z.literal("scroll"),
|
|
52
|
+
target: TargetSchema.optional(),
|
|
53
|
+
deltaY: z.number(),
|
|
54
|
+
expect: ExpectationSchema.optional()
|
|
55
|
+
}).strict(),
|
|
56
|
+
z.object({
|
|
57
|
+
action: z.literal("wait"),
|
|
58
|
+
condition: z.enum([
|
|
59
|
+
"page_idle",
|
|
60
|
+
"text",
|
|
61
|
+
"visible",
|
|
62
|
+
"hidden"
|
|
63
|
+
]),
|
|
64
|
+
value: z.string().optional(),
|
|
65
|
+
target: TargetSchema.optional(),
|
|
66
|
+
timeoutMs: z.number().int().min(100).max(12e4).optional()
|
|
67
|
+
}).strict()
|
|
68
|
+
]);
|
|
69
|
+
const InputSchema = z.object({
|
|
70
|
+
type: z.enum([
|
|
71
|
+
"string",
|
|
72
|
+
"number",
|
|
73
|
+
"boolean"
|
|
74
|
+
]),
|
|
75
|
+
required: z.boolean().optional(),
|
|
76
|
+
default: z.union([
|
|
77
|
+
z.string(),
|
|
78
|
+
z.number(),
|
|
79
|
+
z.boolean()
|
|
80
|
+
]).optional(),
|
|
81
|
+
description: z.string().min(1).max(200).optional(),
|
|
82
|
+
choices: z.array(z.union([
|
|
83
|
+
z.string(),
|
|
84
|
+
z.number(),
|
|
85
|
+
z.boolean()
|
|
86
|
+
])).min(1).max(50).optional()
|
|
87
|
+
}).strict().superRefine((input, ctx) => {
|
|
88
|
+
if (input.default !== void 0 && typeof input.default !== input.type) ctx.addIssue({
|
|
89
|
+
code: "custom",
|
|
90
|
+
message: `Default must be ${input.type}.`
|
|
91
|
+
});
|
|
92
|
+
if (input.choices?.some((choice) => typeof choice !== input.type)) ctx.addIssue({
|
|
93
|
+
code: "custom",
|
|
94
|
+
message: `Every choice must be ${input.type}.`
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
const DomainSchema = z.string().min(1).refine((value) => {
|
|
98
|
+
if (value !== value.toLowerCase() || value.includes("/") || value.includes(":")) return false;
|
|
99
|
+
try {
|
|
100
|
+
return new URL(`https://${value}`).hostname === value;
|
|
101
|
+
} catch {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
}, "Domain must be one exact lowercase hostname.");
|
|
105
|
+
const BrowserAutomationDefinitionSchema = z.object({
|
|
106
|
+
id: z.string().regex(/^[a-z][a-z0-9-]{1,63}$/),
|
|
107
|
+
name: z.string().min(1).max(120),
|
|
108
|
+
description: z.string().max(500).optional(),
|
|
109
|
+
allowedDomains: z.array(DomainSchema).min(1),
|
|
110
|
+
risk: z.enum([
|
|
111
|
+
"read",
|
|
112
|
+
"draft",
|
|
113
|
+
"external_effect",
|
|
114
|
+
"destructive",
|
|
115
|
+
"sensitive"
|
|
116
|
+
]),
|
|
117
|
+
inputs: z.record(z.string(), InputSchema).default({}),
|
|
118
|
+
steps: z.array(StepSchema).min(1).max(100)
|
|
119
|
+
}).strict().superRefine((definition, ctx) => {
|
|
120
|
+
if (new Set(definition.allowedDomains).size !== definition.allowedDomains.length) ctx.addIssue({
|
|
121
|
+
code: "custom",
|
|
122
|
+
path: ["allowedDomains"],
|
|
123
|
+
message: "Domains must be unique."
|
|
124
|
+
});
|
|
125
|
+
for (const [index, step] of definition.steps.entries()) {
|
|
126
|
+
const values = step.action === "navigate" ? [step.url] : step.action === "fill" || step.action === "select" ? [step.value] : step.action === "press" ? [step.key] : step.action === "wait" && step.value ? [step.value] : [];
|
|
127
|
+
for (const value of values) for (const match of value.matchAll(/\$\{input\.([a-zA-Z][a-zA-Z0-9_]*)\}/g)) if (!definition.inputs[match[1]]) ctx.addIssue({
|
|
128
|
+
code: "custom",
|
|
129
|
+
path: ["steps", index],
|
|
130
|
+
message: `Unknown input template: ${match[1]}.`
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
//#endregion
|
|
135
|
+
export { BrowserAutomationDefinitionSchema };
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { BrowserAutomation, BrowserAutomationDefinition, BrowserAutomationRun, BrowserAutomationStatus } from './types.js';
|
|
2
|
+
export type BrowserAutomationExecutor = (input: {
|
|
3
|
+
definition: BrowserAutomationDefinition;
|
|
4
|
+
inputs: Record<string, unknown>;
|
|
5
|
+
signal: AbortSignal;
|
|
6
|
+
onStep: (event: unknown) => void;
|
|
7
|
+
}) => Promise<{
|
|
8
|
+
ok: boolean;
|
|
9
|
+
result?: unknown;
|
|
10
|
+
error?: string;
|
|
11
|
+
}>;
|
|
12
|
+
export declare class BrowserAutomationService {
|
|
13
|
+
private readonly executor;
|
|
14
|
+
private readonly emit?;
|
|
15
|
+
private activeRuns;
|
|
16
|
+
private executions;
|
|
17
|
+
private waiters;
|
|
18
|
+
constructor(executor: BrowserAutomationExecutor, emit?: (type: string, payload: unknown) => void);
|
|
19
|
+
list(): BrowserAutomation[];
|
|
20
|
+
get(id: string): BrowserAutomation;
|
|
21
|
+
listRuns(automationId?: string): BrowserAutomationRun[];
|
|
22
|
+
getRun(id: string): BrowserAutomationRun;
|
|
23
|
+
listRunEvents(id: string): import("./types.js").BrowserAutomationRunEvent[];
|
|
24
|
+
validate(definition: unknown): import("zod/index.cjs").ZodSafeParseResult<{
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
allowedDomains: string[];
|
|
28
|
+
risk: "read" | "sensitive" | "destructive" | "draft" | "external_effect";
|
|
29
|
+
inputs: Record<string, {
|
|
30
|
+
type: "string" | "number" | "boolean";
|
|
31
|
+
required?: boolean;
|
|
32
|
+
default?: string | number | boolean;
|
|
33
|
+
description?: string;
|
|
34
|
+
choices?: (string | number | boolean)[];
|
|
35
|
+
}>;
|
|
36
|
+
steps: ({
|
|
37
|
+
action: "navigate";
|
|
38
|
+
url: string;
|
|
39
|
+
expect?: {
|
|
40
|
+
urlIncludes?: string;
|
|
41
|
+
titleIncludes?: string;
|
|
42
|
+
textIncludes?: string;
|
|
43
|
+
ref?: string;
|
|
44
|
+
state?: "hidden" | "visible";
|
|
45
|
+
};
|
|
46
|
+
} | {
|
|
47
|
+
action: "click";
|
|
48
|
+
target: {
|
|
49
|
+
role: string;
|
|
50
|
+
name?: string;
|
|
51
|
+
nameIncludes?: string;
|
|
52
|
+
};
|
|
53
|
+
expect?: {
|
|
54
|
+
urlIncludes?: string;
|
|
55
|
+
titleIncludes?: string;
|
|
56
|
+
textIncludes?: string;
|
|
57
|
+
ref?: string;
|
|
58
|
+
state?: "hidden" | "visible";
|
|
59
|
+
};
|
|
60
|
+
} | {
|
|
61
|
+
action: "fill";
|
|
62
|
+
target: {
|
|
63
|
+
role: string;
|
|
64
|
+
name?: string;
|
|
65
|
+
nameIncludes?: string;
|
|
66
|
+
};
|
|
67
|
+
value: string;
|
|
68
|
+
submit?: boolean;
|
|
69
|
+
expect?: {
|
|
70
|
+
urlIncludes?: string;
|
|
71
|
+
titleIncludes?: string;
|
|
72
|
+
textIncludes?: string;
|
|
73
|
+
ref?: string;
|
|
74
|
+
state?: "hidden" | "visible";
|
|
75
|
+
};
|
|
76
|
+
} | {
|
|
77
|
+
action: "select";
|
|
78
|
+
target: {
|
|
79
|
+
role: string;
|
|
80
|
+
name?: string;
|
|
81
|
+
nameIncludes?: string;
|
|
82
|
+
};
|
|
83
|
+
value: string;
|
|
84
|
+
expect?: {
|
|
85
|
+
urlIncludes?: string;
|
|
86
|
+
titleIncludes?: string;
|
|
87
|
+
textIncludes?: string;
|
|
88
|
+
ref?: string;
|
|
89
|
+
state?: "hidden" | "visible";
|
|
90
|
+
};
|
|
91
|
+
} | {
|
|
92
|
+
action: "press";
|
|
93
|
+
key: string;
|
|
94
|
+
target?: {
|
|
95
|
+
role: string;
|
|
96
|
+
name?: string;
|
|
97
|
+
nameIncludes?: string;
|
|
98
|
+
};
|
|
99
|
+
expect?: {
|
|
100
|
+
urlIncludes?: string;
|
|
101
|
+
titleIncludes?: string;
|
|
102
|
+
textIncludes?: string;
|
|
103
|
+
ref?: string;
|
|
104
|
+
state?: "hidden" | "visible";
|
|
105
|
+
};
|
|
106
|
+
} | {
|
|
107
|
+
action: "scroll";
|
|
108
|
+
deltaY: number;
|
|
109
|
+
target?: {
|
|
110
|
+
role: string;
|
|
111
|
+
name?: string;
|
|
112
|
+
nameIncludes?: string;
|
|
113
|
+
};
|
|
114
|
+
expect?: {
|
|
115
|
+
urlIncludes?: string;
|
|
116
|
+
titleIncludes?: string;
|
|
117
|
+
textIncludes?: string;
|
|
118
|
+
ref?: string;
|
|
119
|
+
state?: "hidden" | "visible";
|
|
120
|
+
};
|
|
121
|
+
} | {
|
|
122
|
+
action: "wait";
|
|
123
|
+
condition: "hidden" | "text" | "visible" | "page_idle";
|
|
124
|
+
value?: string;
|
|
125
|
+
target?: {
|
|
126
|
+
role: string;
|
|
127
|
+
name?: string;
|
|
128
|
+
nameIncludes?: string;
|
|
129
|
+
};
|
|
130
|
+
timeoutMs?: number;
|
|
131
|
+
})[];
|
|
132
|
+
description?: string;
|
|
133
|
+
}>;
|
|
134
|
+
save(input: {
|
|
135
|
+
definition: unknown;
|
|
136
|
+
status?: BrowserAutomationStatus;
|
|
137
|
+
expectedId?: string;
|
|
138
|
+
}): BrowserAutomation;
|
|
139
|
+
remove(id: string): boolean;
|
|
140
|
+
startRun(automationId: string, inputs: Record<string, unknown>): BrowserAutomationRun;
|
|
141
|
+
cancel(runId: string): boolean;
|
|
142
|
+
shutdown(): Promise<void>;
|
|
143
|
+
runAndWait(automationId: string, inputs: Record<string, unknown>, signal?: AbortSignal): Promise<BrowserAutomationRun>;
|
|
144
|
+
private addEvent;
|
|
145
|
+
private execute;
|
|
146
|
+
}
|