@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
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { createLogger } from "../utils/logger/index.js";
|
|
2
|
-
import { init_logger } from "../utils/logger.js";
|
|
3
|
-
//#region src/browser/session-lifecycle.ts
|
|
4
|
-
init_logger();
|
|
5
|
-
const log = createLogger("BrowserLifecycle");
|
|
6
|
-
const DEFAULT_TRACING = {
|
|
7
|
-
enabled: false,
|
|
8
|
-
outputDir: "/tmp/xopc-traces",
|
|
9
|
-
screenshots: true,
|
|
10
|
-
snapshots: false
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Start Playwright tracing on a browser context for session recording.
|
|
14
|
-
* Captures network, actions, and optionally screenshots/snapshots.
|
|
15
|
-
*/
|
|
16
|
-
async function startTracing(context, options) {
|
|
17
|
-
const opts = {
|
|
18
|
-
...DEFAULT_TRACING,
|
|
19
|
-
...options
|
|
20
|
-
};
|
|
21
|
-
if (!opts.enabled) return;
|
|
22
|
-
try {
|
|
23
|
-
await context.tracing.start({
|
|
24
|
-
screenshots: opts.screenshots ?? true,
|
|
25
|
-
snapshots: opts.snapshots ?? false
|
|
26
|
-
});
|
|
27
|
-
log.info({ outputDir: opts.outputDir }, "Session tracing started");
|
|
28
|
-
} catch (e) {
|
|
29
|
-
const msg = e instanceof Error ? e.message : String(e);
|
|
30
|
-
log.warn({ errorMessage: msg }, `Failed to start tracing: ${msg}`);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Stop tracing and save the trace file.
|
|
35
|
-
*
|
|
36
|
-
* @returns Path to the saved trace file, or undefined if tracing was not active.
|
|
37
|
-
*/
|
|
38
|
-
async function stopTracing(context, options) {
|
|
39
|
-
const opts = {
|
|
40
|
-
...DEFAULT_TRACING,
|
|
41
|
-
...options
|
|
42
|
-
};
|
|
43
|
-
if (!opts.enabled) return void 0;
|
|
44
|
-
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
45
|
-
const tracePath = `${opts.outputDir}/trace-${timestamp}.zip`;
|
|
46
|
-
try {
|
|
47
|
-
const { mkdir } = await import("node:fs/promises");
|
|
48
|
-
await mkdir(opts.outputDir, { recursive: true });
|
|
49
|
-
await context.tracing.stop({ path: tracePath });
|
|
50
|
-
log.info({ tracePath }, "Session trace saved");
|
|
51
|
-
return tracePath;
|
|
52
|
-
} catch (e) {
|
|
53
|
-
const msg = e instanceof Error ? e.message : String(e);
|
|
54
|
-
log.warn({ errorMessage: msg }, `Failed to save trace: ${msg}`);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Known bot detection indicators in page content or response headers.
|
|
60
|
-
* When detected, we log a warning so the agent/user can adjust strategy.
|
|
61
|
-
*/
|
|
62
|
-
const BOT_DETECTION_PATTERNS = [
|
|
63
|
-
/captcha/i,
|
|
64
|
-
/recaptcha/i,
|
|
65
|
-
/hcaptcha/i,
|
|
66
|
-
/cloudflare.*challenge/i,
|
|
67
|
-
/please verify you are (a )?human/i,
|
|
68
|
-
/access denied/i,
|
|
69
|
-
/403 forbidden/i,
|
|
70
|
-
/blocked.*bot/i,
|
|
71
|
-
/automated.*browser/i,
|
|
72
|
-
/unusual.*traffic/i,
|
|
73
|
-
/just a moment/i,
|
|
74
|
-
/checking your browser/i,
|
|
75
|
-
/security check/i,
|
|
76
|
-
/verify.*not.*robot/i,
|
|
77
|
-
/turnstile/i,
|
|
78
|
-
/browser.*verification/i
|
|
79
|
-
];
|
|
80
|
-
/**
|
|
81
|
-
* Check a page for signs of bot detection / CAPTCHA challenge.
|
|
82
|
-
* Returns indicators found. Non-blocking — for advisory logging only.
|
|
83
|
-
*/
|
|
84
|
-
async function checkBotDetection(page) {
|
|
85
|
-
const indicators = [];
|
|
86
|
-
try {
|
|
87
|
-
const combined = `${await page.title()}\n${await page.evaluate(() => globalThis.document.body.innerText.slice(0, 2e3)).catch(() => "")}`;
|
|
88
|
-
for (const pattern of BOT_DETECTION_PATTERNS) {
|
|
89
|
-
const match = combined.match(pattern);
|
|
90
|
-
if (match) indicators.push(match[0]);
|
|
91
|
-
}
|
|
92
|
-
if (indicators.length > 0) log.warn({
|
|
93
|
-
url: page.url(),
|
|
94
|
-
indicators
|
|
95
|
-
}, `Bot detection likely: ${indicators.join(", ")}`);
|
|
96
|
-
} catch {}
|
|
97
|
-
return {
|
|
98
|
-
detected: indicators.length > 0,
|
|
99
|
-
indicators
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Kill orphan Chromium processes that may have been left behind by crashed sessions.
|
|
104
|
-
*
|
|
105
|
-
* This is a best-effort cleanup. On macOS/Linux, searches for chromium/chrome
|
|
106
|
-
* processes with the `--no-sandbox` flag (which xopc adds to all launches).
|
|
107
|
-
*
|
|
108
|
-
* @returns Number of processes killed.
|
|
109
|
-
*/
|
|
110
|
-
async function cleanupOrphanProcesses() {
|
|
111
|
-
const { exec } = await import("node:child_process");
|
|
112
|
-
const { promisify } = await import("node:util");
|
|
113
|
-
const execAsync = promisify(exec);
|
|
114
|
-
let killed = 0;
|
|
115
|
-
try {
|
|
116
|
-
const { stdout } = await execAsync("ps aux | grep -E \"chromium|chrome\" | grep \"no-sandbox\" | grep -v grep").catch(() => ({ stdout: "" }));
|
|
117
|
-
const lines = stdout.trim().split("\n").filter(Boolean);
|
|
118
|
-
for (const line of lines) {
|
|
119
|
-
const parts = line.trim().split(/\s+/);
|
|
120
|
-
const pid = Number(parts[1]);
|
|
121
|
-
if (!pid || pid === process.pid) continue;
|
|
122
|
-
try {
|
|
123
|
-
process.kill(pid, "SIGTERM");
|
|
124
|
-
killed++;
|
|
125
|
-
log.info({ pid }, "Killed orphan browser process");
|
|
126
|
-
} catch {}
|
|
127
|
-
}
|
|
128
|
-
if (killed > 0) log.info({ killed }, `Cleaned up ${killed} orphan browser process(es)`);
|
|
129
|
-
} catch (e) {
|
|
130
|
-
const msg = e instanceof Error ? e.message : String(e);
|
|
131
|
-
log.debug({ errorMessage: msg }, "Orphan cleanup skipped or failed");
|
|
132
|
-
}
|
|
133
|
-
return killed;
|
|
134
|
-
}
|
|
135
|
-
//#endregion
|
|
136
|
-
export { checkBotDetection, cleanupOrphanProcesses, startTracing, stopTracing };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Snapshot intelligence helpers — structure-aware truncation for ARIA snapshots.
|
|
3
|
-
*
|
|
4
|
-
* ARIA snapshots use indentation-based YAML-like trees. Naive character-based
|
|
5
|
-
* truncation can split in the middle of a node, making the output confusing.
|
|
6
|
-
* These helpers preserve tree-node boundaries and provide metadata.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Truncate an ARIA snapshot at a line boundary, preserving complete tree nodes.
|
|
10
|
-
*
|
|
11
|
-
* Strategy:
|
|
12
|
-
* 1. If the text is within `maxLength`, return as-is.
|
|
13
|
-
* 2. Find the last newline before `maxLength`.
|
|
14
|
-
* 3. Walk backwards to find a line at indentation level ≤ 2 (top-level nodes),
|
|
15
|
-
* ensuring we don't cut inside a deeply nested subtree.
|
|
16
|
-
* 4. Append a truncation notice with stats.
|
|
17
|
-
*/
|
|
18
|
-
export declare function truncateSnapshotAtBoundary(text: string, maxLength: number): string;
|
|
19
|
-
/**
|
|
20
|
-
* Produce a compact summary header for a snapshot.
|
|
21
|
-
* Counts interactive elements (links, buttons, inputs) to help the agent
|
|
22
|
-
* understand page complexity at a glance.
|
|
23
|
-
*/
|
|
24
|
-
export declare function snapshotSummaryHeader(snapshotText: string, pageUrl: string): string;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
//#region src/browser/snapshot-helpers.ts
|
|
2
|
-
/**
|
|
3
|
-
* Snapshot intelligence helpers — structure-aware truncation for ARIA snapshots.
|
|
4
|
-
*
|
|
5
|
-
* ARIA snapshots use indentation-based YAML-like trees. Naive character-based
|
|
6
|
-
* truncation can split in the middle of a node, making the output confusing.
|
|
7
|
-
* These helpers preserve tree-node boundaries and provide metadata.
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Truncate an ARIA snapshot at a line boundary, preserving complete tree nodes.
|
|
11
|
-
*
|
|
12
|
-
* Strategy:
|
|
13
|
-
* 1. If the text is within `maxLength`, return as-is.
|
|
14
|
-
* 2. Find the last newline before `maxLength`.
|
|
15
|
-
* 3. Walk backwards to find a line at indentation level ≤ 2 (top-level nodes),
|
|
16
|
-
* ensuring we don't cut inside a deeply nested subtree.
|
|
17
|
-
* 4. Append a truncation notice with stats.
|
|
18
|
-
*/
|
|
19
|
-
function truncateSnapshotAtBoundary(text, maxLength) {
|
|
20
|
-
if (text.length <= maxLength) return text;
|
|
21
|
-
let cutoff = text.lastIndexOf("\n", maxLength);
|
|
22
|
-
if (cutoff <= 0) return `${text.slice(0, maxLength)}\n... (truncated)`;
|
|
23
|
-
const searchStart = Math.max(0, cutoff - 2e3);
|
|
24
|
-
const lines = text.slice(searchStart, cutoff).split("\n");
|
|
25
|
-
let bestCutIndex = cutoff;
|
|
26
|
-
let accumulated = cutoff;
|
|
27
|
-
for (let i = lines.length - 1; i >= 0; i--) {
|
|
28
|
-
const line = lines[i];
|
|
29
|
-
const indent = line.search(/\S/);
|
|
30
|
-
if (indent >= 0 && indent <= 2) {
|
|
31
|
-
bestCutIndex = accumulated;
|
|
32
|
-
break;
|
|
33
|
-
}
|
|
34
|
-
accumulated -= line.length + 1;
|
|
35
|
-
}
|
|
36
|
-
const truncated = text.slice(0, bestCutIndex);
|
|
37
|
-
const totalLines = text.split("\n").length;
|
|
38
|
-
const shownLines = truncated.split("\n").length;
|
|
39
|
-
return `${truncated}\n... (truncated: showing ${shownLines} of ${totalLines} lines, ${totalLines - shownLines} lines omitted)`;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Produce a compact summary header for a snapshot.
|
|
43
|
-
* Counts interactive elements (links, buttons, inputs) to help the agent
|
|
44
|
-
* understand page complexity at a glance.
|
|
45
|
-
*/
|
|
46
|
-
function snapshotSummaryHeader(snapshotText, pageUrl) {
|
|
47
|
-
const lines = snapshotText.split("\n");
|
|
48
|
-
const totalLines = lines.length;
|
|
49
|
-
let linkCount = 0;
|
|
50
|
-
let buttonCount = 0;
|
|
51
|
-
let inputCount = 0;
|
|
52
|
-
let imageCount = 0;
|
|
53
|
-
for (const line of lines) {
|
|
54
|
-
const trimmed = line.trimStart();
|
|
55
|
-
if (trimmed.startsWith("- link ") || trimmed.startsWith("- link:")) linkCount++;
|
|
56
|
-
if (trimmed.startsWith("- button ") || trimmed.startsWith("- button:")) buttonCount++;
|
|
57
|
-
if (trimmed.startsWith("- textbox ") || trimmed.startsWith("- textbox:") || trimmed.startsWith("- searchbox ") || trimmed.startsWith("- combobox ")) inputCount++;
|
|
58
|
-
if (trimmed.startsWith("- img ") || trimmed.startsWith("- img:")) imageCount++;
|
|
59
|
-
}
|
|
60
|
-
const parts = [`Page: ${pageUrl}`, `Snapshot: ${totalLines} lines`];
|
|
61
|
-
const counts = [];
|
|
62
|
-
if (linkCount > 0) counts.push(`${linkCount} links`);
|
|
63
|
-
if (buttonCount > 0) counts.push(`${buttonCount} buttons`);
|
|
64
|
-
if (inputCount > 0) counts.push(`${inputCount} inputs`);
|
|
65
|
-
if (imageCount > 0) counts.push(`${imageCount} images`);
|
|
66
|
-
if (counts.length > 0) parts.push(`Interactive: ${counts.join(", ")}`);
|
|
67
|
-
return parts.join(" | ");
|
|
68
|
-
}
|
|
69
|
-
//#endregion
|
|
70
|
-
export { snapshotSummaryHeader, truncateSnapshotAtBoundary };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Stealth launch utilities for anti-detection browser automation.
|
|
3
|
-
*
|
|
4
|
-
* Provides argument deduplication, fingerprint seed generation, and
|
|
5
|
-
* macOS quarantine attribute removal. Shared by CloakBrowser provider
|
|
6
|
-
* and enhanced local launch paths.
|
|
7
|
-
*/
|
|
8
|
-
export interface StealthOptions {
|
|
9
|
-
/** Timezone to emulate (e.g. "America/New_York"). */
|
|
10
|
-
timezone?: string;
|
|
11
|
-
/** Locale to emulate (e.g. "en-US"). */
|
|
12
|
-
locale?: string;
|
|
13
|
-
/** Public IP for WebRTC leak prevention. */
|
|
14
|
-
webrtcIp?: string;
|
|
15
|
-
/** Platform to emulate in fingerprint (e.g. "windows", "macos"). */
|
|
16
|
-
fingerprintPlatform?: string;
|
|
17
|
-
}
|
|
18
|
-
/** Strip sandbox flags before passing user extraArgs to CloakBrowser. */
|
|
19
|
-
export declare function filterCloakBrowserExtraArgs(extraArgs?: string[]): string[];
|
|
20
|
-
/**
|
|
21
|
-
* Build stealth launch args with deduplication.
|
|
22
|
-
* User `extraArgs` override any default args with the same `--key=` prefix.
|
|
23
|
-
*/
|
|
24
|
-
export declare function buildStealthArgs(extraArgs?: string[], options?: StealthOptions): string[];
|
|
25
|
-
/**
|
|
26
|
-
* Basic stealth args for the local Playwright launcher (less aggressive than CloakBrowser).
|
|
27
|
-
* Does not include fingerprint or geo args — just reduces automation signals.
|
|
28
|
-
*/
|
|
29
|
-
export declare function buildLocalStealthArgs(extraArgs?: string[]): string[];
|
|
30
|
-
/** Generate a timestamp-based fingerprint seed for CloakBrowser. */
|
|
31
|
-
export declare function generateFingerprintSeed(): number;
|
|
32
|
-
/**
|
|
33
|
-
* Remove the `com.apple.quarantine` extended attribute from a file or app bundle on macOS.
|
|
34
|
-
* Files downloaded from the internet are tagged with this attribute, causing Gatekeeper
|
|
35
|
-
* to block unsigned binaries. Without this, CloakBrowser silently fails to launch.
|
|
36
|
-
*
|
|
37
|
-
* Non-fatal — logs and returns on any error.
|
|
38
|
-
*/
|
|
39
|
-
export declare function removeQuarantineAttr(path: string): Promise<void>;
|
|
40
|
-
/**
|
|
41
|
-
* JavaScript snippet to inject into every new page to hide automation signals.
|
|
42
|
-
* Removes `navigator.webdriver` and patches other detectable properties.
|
|
43
|
-
*/
|
|
44
|
-
export declare const WEBDRIVER_OVERRIDE_SCRIPT = "\nObject.defineProperty(navigator, 'webdriver', { get: () => undefined });\nif (navigator.plugins.length === 0) {\n Object.defineProperty(navigator, 'plugins', {\n get: () => [1, 2, 3, 4, 5],\n });\n}\nObject.defineProperty(navigator, 'languages', {\n get: () => ['en-US', 'en'],\n});\nwindow.chrome = window.chrome || {};\nwindow.chrome.runtime = window.chrome.runtime || {};\n";
|
|
45
|
-
/** Ensure a binary file has executable permissions (Unix only, no-op on Windows). */
|
|
46
|
-
export declare function makeExecutable(path: string): Promise<void>;
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { createLogger } from "../utils/logger/index.js";
|
|
2
|
-
import { init_logger } from "../utils/logger.js";
|
|
3
|
-
import { platform } from "node:os";
|
|
4
|
-
import { exec } from "node:child_process";
|
|
5
|
-
import { chmod, stat } from "node:fs/promises";
|
|
6
|
-
import { promisify } from "node:util";
|
|
7
|
-
//#region src/browser/stealth.ts
|
|
8
|
-
/**
|
|
9
|
-
* Stealth launch utilities for anti-detection browser automation.
|
|
10
|
-
*
|
|
11
|
-
* Provides argument deduplication, fingerprint seed generation, and
|
|
12
|
-
* macOS quarantine attribute removal. Shared by CloakBrowser provider
|
|
13
|
-
* and enhanced local launch paths.
|
|
14
|
-
*/
|
|
15
|
-
init_logger();
|
|
16
|
-
const execAsync = promisify(exec);
|
|
17
|
-
const log = createLogger("BrowserStealth");
|
|
18
|
-
/**
|
|
19
|
-
* Default Chromium args that reduce automation detectability for CloakBrowser.
|
|
20
|
-
* Does not include `--no-sandbox` — CloakBrowser rejects it with an infobar warning.
|
|
21
|
-
*/
|
|
22
|
-
const BASE_STEALTH_ARGS = [
|
|
23
|
-
"--disable-blink-features=AutomationControlled",
|
|
24
|
-
"--disable-infobars",
|
|
25
|
-
"--disable-dev-shm-usage",
|
|
26
|
-
"--disable-background-networking",
|
|
27
|
-
"--disable-default-apps",
|
|
28
|
-
"--disable-extensions-except=",
|
|
29
|
-
"--disable-sync",
|
|
30
|
-
"--metrics-recording-only",
|
|
31
|
-
"--no-first-run"
|
|
32
|
-
];
|
|
33
|
-
/** Flags CloakBrowser does not support (shown as unsupported infobar if passed). */
|
|
34
|
-
const CLOAK_UNSUPPORTED_FLAGS = new Set(["--no-sandbox", "--disable-setuid-sandbox"]);
|
|
35
|
-
/** Strip sandbox flags before passing user extraArgs to CloakBrowser. */
|
|
36
|
-
function filterCloakBrowserExtraArgs(extraArgs = []) {
|
|
37
|
-
return extraArgs.filter((arg) => !CLOAK_UNSUPPORTED_FLAGS.has(arg.split("=")[0] ?? arg));
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Build stealth launch args with deduplication.
|
|
41
|
-
* User `extraArgs` override any default args with the same `--key=` prefix.
|
|
42
|
-
*/
|
|
43
|
-
function buildStealthArgs(extraArgs = [], options = {}) {
|
|
44
|
-
const argsMap = /* @__PURE__ */ new Map();
|
|
45
|
-
const positionalArgs = [];
|
|
46
|
-
for (const arg of BASE_STEALTH_ARGS) {
|
|
47
|
-
const eqIdx = arg.indexOf("=");
|
|
48
|
-
if (eqIdx >= 0) argsMap.set(arg.slice(0, eqIdx), arg);
|
|
49
|
-
else positionalArgs.push(arg);
|
|
50
|
-
}
|
|
51
|
-
const fingerprintPlatform = options.fingerprintPlatform ?? detectFingerprintPlatform();
|
|
52
|
-
argsMap.set("--fingerprint", `--fingerprint=${generateFingerprintSeed()}`);
|
|
53
|
-
argsMap.set("--fingerprint-platform", `--fingerprint-platform=${fingerprintPlatform}`);
|
|
54
|
-
if (options.timezone) argsMap.set("--fingerprint-timezone", `--fingerprint-timezone=${options.timezone}`);
|
|
55
|
-
if (options.locale) {
|
|
56
|
-
argsMap.set("--lang", `--lang=${options.locale}`);
|
|
57
|
-
argsMap.set("--fingerprint-locale", `--fingerprint-locale=${options.locale}`);
|
|
58
|
-
}
|
|
59
|
-
if (options.webrtcIp) argsMap.set("--fingerprint-webrtc-ip", `--fingerprint-webrtc-ip=${options.webrtcIp}`);
|
|
60
|
-
for (const arg of extraArgs) {
|
|
61
|
-
const eqIdx = arg.indexOf("=");
|
|
62
|
-
if (eqIdx >= 0) argsMap.set(arg.slice(0, eqIdx), arg);
|
|
63
|
-
else positionalArgs.push(arg);
|
|
64
|
-
}
|
|
65
|
-
const kvArgs = [...argsMap.values()].sort();
|
|
66
|
-
return [...positionalArgs, ...kvArgs];
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Basic stealth args for the local Playwright launcher (less aggressive than CloakBrowser).
|
|
70
|
-
* Does not include fingerprint or geo args — just reduces automation signals.
|
|
71
|
-
*/
|
|
72
|
-
function buildLocalStealthArgs(extraArgs = []) {
|
|
73
|
-
const baseArgs = [
|
|
74
|
-
"--disable-blink-features=AutomationControlled",
|
|
75
|
-
"--no-sandbox",
|
|
76
|
-
"--disable-setuid-sandbox"
|
|
77
|
-
];
|
|
78
|
-
const seen = /* @__PURE__ */ new Set();
|
|
79
|
-
const result = [];
|
|
80
|
-
for (const arg of extraArgs) {
|
|
81
|
-
const key = arg.split("=")[0];
|
|
82
|
-
if (!seen.has(key)) {
|
|
83
|
-
seen.add(key);
|
|
84
|
-
result.push(arg);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
for (const arg of baseArgs) {
|
|
88
|
-
const key = arg.split("=")[0];
|
|
89
|
-
if (!seen.has(key)) {
|
|
90
|
-
seen.add(key);
|
|
91
|
-
result.push(arg);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return result;
|
|
95
|
-
}
|
|
96
|
-
/** Generate a timestamp-based fingerprint seed for CloakBrowser. */
|
|
97
|
-
function generateFingerprintSeed() {
|
|
98
|
-
return Date.now();
|
|
99
|
-
}
|
|
100
|
-
/** Detect the fingerprint platform based on the current OS. */
|
|
101
|
-
function detectFingerprintPlatform() {
|
|
102
|
-
switch (platform()) {
|
|
103
|
-
case "darwin": return "macos";
|
|
104
|
-
case "win32": return "windows";
|
|
105
|
-
default: return "windows";
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Remove the `com.apple.quarantine` extended attribute from a file or app bundle on macOS.
|
|
110
|
-
* Files downloaded from the internet are tagged with this attribute, causing Gatekeeper
|
|
111
|
-
* to block unsigned binaries. Without this, CloakBrowser silently fails to launch.
|
|
112
|
-
*
|
|
113
|
-
* Non-fatal — logs and returns on any error.
|
|
114
|
-
*/
|
|
115
|
-
async function removeQuarantineAttr(path) {
|
|
116
|
-
if (platform() !== "darwin") return;
|
|
117
|
-
const target = findAppBundle(path) ?? path;
|
|
118
|
-
log.debug({ target }, "Removing com.apple.quarantine");
|
|
119
|
-
try {
|
|
120
|
-
const { stderr } = await execAsync(`xattr -rd com.apple.quarantine "${target}"`);
|
|
121
|
-
if (stderr?.trim()) log.debug({ stderr: stderr.trim() }, "xattr stderr (non-fatal)");
|
|
122
|
-
log.debug("Quarantine attribute removed");
|
|
123
|
-
} catch {
|
|
124
|
-
log.debug("xattr command failed or attribute not set (non-fatal)");
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
/** Find the .app bundle root by walking up from an executable path. */
|
|
128
|
-
function findAppBundle(executablePath) {
|
|
129
|
-
const parts = executablePath.split("/");
|
|
130
|
-
for (let i = parts.length - 1; i >= 0; i--) if (parts[i].endsWith(".app")) return parts.slice(0, i + 1).join("/");
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* JavaScript snippet to inject into every new page to hide automation signals.
|
|
134
|
-
* Removes `navigator.webdriver` and patches other detectable properties.
|
|
135
|
-
*/
|
|
136
|
-
const WEBDRIVER_OVERRIDE_SCRIPT = `
|
|
137
|
-
Object.defineProperty(navigator, 'webdriver', { get: () => undefined });
|
|
138
|
-
if (navigator.plugins.length === 0) {
|
|
139
|
-
Object.defineProperty(navigator, 'plugins', {
|
|
140
|
-
get: () => [1, 2, 3, 4, 5],
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
Object.defineProperty(navigator, 'languages', {
|
|
144
|
-
get: () => ['en-US', 'en'],
|
|
145
|
-
});
|
|
146
|
-
window.chrome = window.chrome || {};
|
|
147
|
-
window.chrome.runtime = window.chrome.runtime || {};
|
|
148
|
-
`;
|
|
149
|
-
/** Ensure a binary file has executable permissions (Unix only, no-op on Windows). */
|
|
150
|
-
async function makeExecutable(path) {
|
|
151
|
-
if (platform() === "win32") return;
|
|
152
|
-
try {
|
|
153
|
-
await chmod(path, (await stat(path)).mode | 73);
|
|
154
|
-
} catch (e) {
|
|
155
|
-
const msg = e instanceof Error ? e.message : String(e);
|
|
156
|
-
log.warn({
|
|
157
|
-
path,
|
|
158
|
-
errorMessage: msg
|
|
159
|
-
}, `Failed to chmod binary: ${msg}`);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
//#endregion
|
|
163
|
-
export { WEBDRIVER_OVERRIDE_SCRIPT, buildLocalStealthArgs, buildStealthArgs, filterCloakBrowserExtraArgs, generateFingerprintSeed, makeExecutable, removeQuarantineAttr };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export type ClarifyStreamEvent = {
|
|
2
|
-
type: string;
|
|
3
|
-
} & Record<string, unknown>;
|
|
4
|
-
/** User inactivity window before pending clarification is rejected (web/Telegram, etc.). */
|
|
5
|
-
export declare const CLARIFY_USER_RESPONSE_TIMEOUT_MS: number;
|
|
6
|
-
export interface ClarifyBridgeRequest {
|
|
7
|
-
kind?: 'approval';
|
|
8
|
-
question: string;
|
|
9
|
-
choices?: string[];
|
|
10
|
-
default?: string;
|
|
11
|
-
}
|
|
12
|
-
export interface StartClarifyRequestOptions {
|
|
13
|
-
/** null delegates the deadline to the owning ephemeral session. */
|
|
14
|
-
timeoutMs?: number | null;
|
|
15
|
-
beforeResponse?: () => boolean;
|
|
16
|
-
sessionKey: string;
|
|
17
|
-
/** Present for in-flight webchat runs. */
|
|
18
|
-
runId?: string;
|
|
19
|
-
publishStream?: (event: ClarifyStreamEvent) => void;
|
|
20
|
-
request: ClarifyBridgeRequest;
|
|
21
|
-
/** e.g. Telegram inline keyboard + prompt message */
|
|
22
|
-
deliver?: (ctx: {
|
|
23
|
-
sessionKey: string;
|
|
24
|
-
requestId: string;
|
|
25
|
-
request: ClarifyBridgeRequest;
|
|
26
|
-
}) => Promise<void>;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Pending user answers for the `clarify` tool (web UI, Telegram, etc.).
|
|
30
|
-
*/
|
|
31
|
-
export declare class ClarifyBridge {
|
|
32
|
-
private pending;
|
|
33
|
-
/** sessionKey → requestId when waiting for a free-text reply (no multiple-choice). */
|
|
34
|
-
private pendingFreeTextBySession;
|
|
35
|
-
startRequest(opts: StartClarifyRequestOptions): Promise<string>;
|
|
36
|
-
private deletePending;
|
|
37
|
-
private clearFreeTextSlot;
|
|
38
|
-
/**
|
|
39
|
-
* Consume the user's next text message as the clarify answer (Telegram DM/group).
|
|
40
|
-
*/
|
|
41
|
-
tryConsumeFreeTextReply(sessionKey: string, text: string): boolean;
|
|
42
|
-
handleChoiceCallback(requestId: string, choiceIndex: number): boolean;
|
|
43
|
-
handleResponse(requestId: string, answer: string): boolean;
|
|
44
|
-
cancelForRun(runId: string): void;
|
|
45
|
-
dispose(): void;
|
|
46
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { createLogger } from "../utils/logger/index.js";
|
|
2
|
-
import { init_logger } from "../utils/logger.js";
|
|
3
|
-
import { createPetFeedback } from "./chat-stream/pet-feedback.js";
|
|
4
|
-
//#region src/gateway/clarify-bridge.ts
|
|
5
|
-
init_logger();
|
|
6
|
-
const log = createLogger("gateway:clarify");
|
|
7
|
-
/** User inactivity window before pending clarification is rejected (web/Telegram, etc.). */
|
|
8
|
-
const CLARIFY_USER_RESPONSE_TIMEOUT_MS = 300 * 1e3;
|
|
9
|
-
/**
|
|
10
|
-
* Pending user answers for the `clarify` tool (web UI, Telegram, etc.).
|
|
11
|
-
*/
|
|
12
|
-
var ClarifyBridge = class {
|
|
13
|
-
pending = /* @__PURE__ */ new Map();
|
|
14
|
-
/** sessionKey → requestId when waiting for a free-text reply (no multiple-choice). */
|
|
15
|
-
pendingFreeTextBySession = /* @__PURE__ */ new Map();
|
|
16
|
-
startRequest(opts) {
|
|
17
|
-
const { sessionKey, runId, publishStream, request, deliver } = opts;
|
|
18
|
-
const requestId = crypto.randomUUID();
|
|
19
|
-
const hasChoices = Array.isArray(request.choices) && request.choices.length >= 2;
|
|
20
|
-
const needsFreeText = !hasChoices;
|
|
21
|
-
return new Promise((resolve, reject) => {
|
|
22
|
-
const failStart = (err) => {
|
|
23
|
-
const e = this.deletePending(requestId);
|
|
24
|
-
if (e) e.reject(err instanceof Error ? err : new Error(String(err)));
|
|
25
|
-
};
|
|
26
|
-
const timeoutMs = opts.timeoutMs === void 0 ? CLARIFY_USER_RESPONSE_TIMEOUT_MS : opts.timeoutMs;
|
|
27
|
-
const timeout = timeoutMs === null ? void 0 : setTimeout(() => {
|
|
28
|
-
const entry = this.deletePending(requestId);
|
|
29
|
-
if (entry) entry.reject(/* @__PURE__ */ new Error(`Clarification timeout: user did not respond within ${timeoutMs / 6e4} minutes`));
|
|
30
|
-
}, timeoutMs);
|
|
31
|
-
this.pending.set(requestId, {
|
|
32
|
-
runId: runId ?? "",
|
|
33
|
-
sessionKey,
|
|
34
|
-
choices: hasChoices ? request.choices : void 0,
|
|
35
|
-
resolve,
|
|
36
|
-
reject,
|
|
37
|
-
timeout,
|
|
38
|
-
beforeResponse: opts.beforeResponse
|
|
39
|
-
});
|
|
40
|
-
if (needsFreeText) this.pendingFreeTextBySession.set(sessionKey, requestId);
|
|
41
|
-
const payload = {
|
|
42
|
-
type: "clarify_request",
|
|
43
|
-
kind: request.kind,
|
|
44
|
-
requestId,
|
|
45
|
-
question: request.question,
|
|
46
|
-
choices: request.choices,
|
|
47
|
-
default: request.default,
|
|
48
|
-
petFeedback: createPetFeedback("clarify")
|
|
49
|
-
};
|
|
50
|
-
try {
|
|
51
|
-
if (runId) publishStream?.(payload);
|
|
52
|
-
} catch (err) {
|
|
53
|
-
log.warn({
|
|
54
|
-
err,
|
|
55
|
-
requestId
|
|
56
|
-
}, "Clarify stream publication failed");
|
|
57
|
-
}
|
|
58
|
-
if (deliver) deliver({
|
|
59
|
-
sessionKey,
|
|
60
|
-
requestId,
|
|
61
|
-
request
|
|
62
|
-
}).catch(failStart);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
deletePending(requestId) {
|
|
66
|
-
const entry = this.pending.get(requestId);
|
|
67
|
-
if (!entry) return void 0;
|
|
68
|
-
clearTimeout(entry.timeout);
|
|
69
|
-
this.pending.delete(requestId);
|
|
70
|
-
this.clearFreeTextSlot(entry.sessionKey, requestId);
|
|
71
|
-
return entry;
|
|
72
|
-
}
|
|
73
|
-
clearFreeTextSlot(sessionKey, requestId) {
|
|
74
|
-
if (this.pendingFreeTextBySession.get(sessionKey) === requestId) this.pendingFreeTextBySession.delete(sessionKey);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Consume the user's next text message as the clarify answer (Telegram DM/group).
|
|
78
|
-
*/
|
|
79
|
-
tryConsumeFreeTextReply(sessionKey, text) {
|
|
80
|
-
const requestId = this.pendingFreeTextBySession.get(sessionKey);
|
|
81
|
-
if (!requestId) return false;
|
|
82
|
-
return this.handleResponse(requestId, text);
|
|
83
|
-
}
|
|
84
|
-
handleChoiceCallback(requestId, choiceIndex) {
|
|
85
|
-
const entry = this.pending.get(requestId);
|
|
86
|
-
if (!entry?.choices || choiceIndex < 0 || choiceIndex >= entry.choices.length) return false;
|
|
87
|
-
return this.handleResponse(requestId, entry.choices[choiceIndex]);
|
|
88
|
-
}
|
|
89
|
-
handleResponse(requestId, answer) {
|
|
90
|
-
const pending = this.pending.get(requestId);
|
|
91
|
-
if (!pending || pending.beforeResponse?.() === false) return false;
|
|
92
|
-
const entry = this.deletePending(requestId);
|
|
93
|
-
if (!entry) return false;
|
|
94
|
-
entry.resolve(answer.trim());
|
|
95
|
-
return true;
|
|
96
|
-
}
|
|
97
|
-
cancelForRun(runId) {
|
|
98
|
-
for (const [id, entry] of [...this.pending]) if (entry.runId === runId) this.deletePending(id)?.reject(/* @__PURE__ */ new Error("Clarification cancelled: agent run aborted"));
|
|
99
|
-
}
|
|
100
|
-
dispose() {
|
|
101
|
-
for (const [id, entry] of [...this.pending]) {
|
|
102
|
-
clearTimeout(entry.timeout);
|
|
103
|
-
entry.reject(/* @__PURE__ */ new Error("Gateway shutting down"));
|
|
104
|
-
this.pending.delete(id);
|
|
105
|
-
}
|
|
106
|
-
this.pending.clear();
|
|
107
|
-
this.pendingFreeTextBySession.clear();
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
//#endregion
|
|
111
|
-
export { CLARIFY_USER_RESPONSE_TIMEOUT_MS, ClarifyBridge };
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
//#region src/gateway/hono/routes/browser-workflows.ts
|
|
2
|
-
function presentWorkflow(service, recipe) {
|
|
3
|
-
const inputs = service.validate(recipe.yaml).document?.args ?? {};
|
|
4
|
-
return {
|
|
5
|
-
id: recipe.id,
|
|
6
|
-
name: recipe.name,
|
|
7
|
-
description: recipe.description,
|
|
8
|
-
enabled: recipe.status === "published",
|
|
9
|
-
risk: recipe.risk,
|
|
10
|
-
domains: recipe.domains,
|
|
11
|
-
inputs,
|
|
12
|
-
createdAtMs: recipe.createdAtMs,
|
|
13
|
-
updatedAtMs: recipe.updatedAtMs
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
function presentRun(run) {
|
|
17
|
-
return {
|
|
18
|
-
id: run.id,
|
|
19
|
-
workflowId: run.recipeId,
|
|
20
|
-
status: run.status,
|
|
21
|
-
inputs: run.args,
|
|
22
|
-
result: run.result,
|
|
23
|
-
error: run.error,
|
|
24
|
-
createdAtMs: run.createdAtMs,
|
|
25
|
-
startedAtMs: run.startedAtMs,
|
|
26
|
-
endedAtMs: run.endedAtMs,
|
|
27
|
-
durationMs: run.durationMs
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function registerBrowserWorkflowRoutes(authenticated, deps) {
|
|
31
|
-
const service = deps.service.browserRecipes;
|
|
32
|
-
authenticated.get("/api/browser/workflows", (c) => c.json({ workflows: service.list().map((recipe) => presentWorkflow(service, recipe)) }));
|
|
33
|
-
authenticated.get("/api/browser/workflows/:id", (c) => {
|
|
34
|
-
const recipe = service.get(c.req.param("id"));
|
|
35
|
-
return recipe ? c.json({ workflow: presentWorkflow(service, recipe) }) : c.json({ error: "Browser automation not found" }, 404);
|
|
36
|
-
});
|
|
37
|
-
authenticated.patch("/api/browser/workflows/:id", deps.strictRateLimitMiddleware, async (c) => {
|
|
38
|
-
try {
|
|
39
|
-
const current = service.get(c.req.param("id"));
|
|
40
|
-
if (!current) return c.json({ error: "Browser automation not found" }, 404);
|
|
41
|
-
const body = await c.req.json().catch(() => null);
|
|
42
|
-
if (typeof body?.enabled !== "boolean") return c.json({ error: "enabled must be a boolean" }, 400);
|
|
43
|
-
const workflow = service.save({
|
|
44
|
-
yaml: current.yaml,
|
|
45
|
-
status: body.enabled ? "published" : "disabled",
|
|
46
|
-
expectedId: current.id
|
|
47
|
-
});
|
|
48
|
-
return c.json({ workflow: presentWorkflow(service, workflow) });
|
|
49
|
-
} catch (error) {
|
|
50
|
-
return c.json({ error: error instanceof Error ? error.message : String(error) }, 400);
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
authenticated.delete("/api/browser/workflows/:id", deps.strictRateLimitMiddleware, (c) => {
|
|
54
|
-
try {
|
|
55
|
-
return c.json({ removed: service.remove(c.req.param("id")) });
|
|
56
|
-
} catch (error) {
|
|
57
|
-
return c.json({ error: error instanceof Error ? error.message : String(error) }, 409);
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
authenticated.post("/api/browser/workflows/:id/run", deps.strictRateLimitMiddleware, async (c) => {
|
|
61
|
-
try {
|
|
62
|
-
const body = await c.req.json().catch(() => ({}));
|
|
63
|
-
if (body.inputs !== void 0 && (!body.inputs || typeof body.inputs !== "object" || Array.isArray(body.inputs))) return c.json({ error: "inputs must be an object" }, 400);
|
|
64
|
-
const run = service.startRun(c.req.param("id"), body.inputs ?? {});
|
|
65
|
-
return c.json({ run: presentRun(run) }, 202);
|
|
66
|
-
} catch (error) {
|
|
67
|
-
return c.json({ error: error instanceof Error ? error.message : String(error) }, 400);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
authenticated.get("/api/browser/workflow-runs", (c) => c.json({ runs: service.listRuns(c.req.query("workflowId")).map(presentRun) }));
|
|
71
|
-
authenticated.get("/api/browser/workflow-runs/:id", (c) => {
|
|
72
|
-
const run = service.getRun(c.req.param("id"));
|
|
73
|
-
return run ? c.json({ run: presentRun(run) }) : c.json({ error: "Run not found" }, 404);
|
|
74
|
-
});
|
|
75
|
-
authenticated.post("/api/browser/workflow-runs/:id/cancel", deps.strictRateLimitMiddleware, (c) => c.json({ cancelled: service.cancel(c.req.param("id")) }));
|
|
76
|
-
}
|
|
77
|
-
//#endregion
|
|
78
|
-
export { registerBrowserWorkflowRoutes };
|
|
File without changes
|