@xopcai/xopc 0.0.411 → 0.0.413
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/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-sGJnq-SA.js → agent-avatar-dicebear-BT6oqCMD.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BFmRRD_4.js +1 -0
- package/dist/gateway/static/root/assets/agents-Clwskw2J.js +77 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-uGDeJR1f.js → agents-admin-api-CeBkHnl8.js} +1 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-BdCgtTfT.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-C3-hCFlF.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-DJbKg3va.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-CGdU_E5B.js → archive-plugin-BviFGCy4.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BAPZY56r.js → automations-page-CfzazXE5.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-D_X0_1X3.js +8 -0
- package/dist/gateway/static/root/assets/{binary-plugins-B0ispXo2.js → binary-plugins-Dp-gtJEk.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-B9Ci-prO.js → block-editor-D-DEPdpi.js} +4 -4
- package/dist/gateway/static/root/assets/{browser-automation-inputs-D4-vQc4g.js → browser-automation-inputs-D1pDgMJu.js} +1 -1
- package/dist/gateway/static/root/assets/browser-automations-page-BI-ep6uM.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-BTyQ4-vN.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-Bpeh6E22.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-page-GNS95mG9.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DBiv1HN-.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-Cic05oWh.js → capability-header-actions-CP2fI9Fe.js} +1 -1
- package/dist/gateway/static/root/assets/channels-DWlrUKBr.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-Bm-IGeDe.js → chat-terminal-dock-BL3tFntQ.js} +2 -2
- package/dist/gateway/static/root/assets/computer-settings-page-DEQ5GYfC.js +1 -0
- package/dist/gateway/static/root/assets/{connector-service-page-DcdASUU9.js → connector-service-page-CecwMnC5.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-BcpUvrtl.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-gVLWu9R0.js → date-picker-N5jnlvPs.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-C0LARyok.js → dependency-picker-C4jddxFl.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-v_le3sCs.js → desktop-pet-BCbiUNQG.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-CkKU0JMY.js +1 -0
- package/dist/gateway/static/root/assets/device-pairing-wizard--E2GQoY1.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-CBefVUPR.js → directory-picker-path-field-CbMbPimD.js} +1 -1
- package/dist/gateway/static/root/assets/extension-debug-page-OE1nJMQ8.js +1 -0
- package/dist/gateway/static/root/assets/{extension-page-C0-oP7S_.js → extension-page-BEomiKhy.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-BFOjQeSX.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-BVqYVaGy.js → gateway-config-swr-DF_HV6NP.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-CY1LBGBS.js → gateway-realtime-DMAzNlm-.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-CoIgC1Al.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-CR4CsfNN.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CPKGkr6D.js → gateway-startup-retry-B91CBTzO.js} +1 -1
- package/dist/gateway/static/root/assets/highlight-code-6ONPRH5r.js +1 -0
- package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-CN5PNRN3.js → highlighted-body-KQOG7T2V-EJ9Kg4iQ.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-B9w3a6r2.js +2 -0
- package/dist/gateway/static/root/assets/{image-generation-api-DRLXG9Ws.js → image-generation-api-D0HNic89.js} +1 -1
- package/dist/gateway/static/root/assets/imports-page-bxTINe-2.js +1 -0
- package/dist/gateway/static/root/assets/index-D1oivYvN.js +710 -0
- package/dist/gateway/static/root/assets/index-D_7q1UkI.css +1 -0
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-Cmi-2SIh.js +1 -0
- package/dist/gateway/static/root/assets/local-app-workbench-page-NGCmXpa_.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-BChE6nUD.js → local-apps-page-jgaogH9Z.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-BCaC-1rH.js → local-session-drafts-DvmwiLUx.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DAgpZxAS.js → locale-store-JogcXC4J.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-drrr-c2W.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-Dc1opXVr.js +1 -0
- package/dist/gateway/static/root/assets/{media-plugins-BmLuWkkZ.js → media-plugins-BRS9puQV.js} +1 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-B--edI1I.js +1 -0
- package/dist/gateway/static/root/assets/{messages-DMXSIJUO.js → messages-RzwPiQNL.js} +2 -2
- package/dist/gateway/static/root/assets/note-detail-panel-C3s4-ytB.js +5 -0
- package/dist/gateway/static/root/assets/note-image-lightbox-D7q5-KuS.js +1 -0
- package/dist/gateway/static/root/assets/notes-page-qVxoErUS.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-B7rDRlS7.js → page-context-capture-button-D_VOB2_C.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-B-T8NzQo.js +1 -0
- package/dist/gateway/static/root/assets/personal-settings-panel-BKA4fbYH.js +1 -0
- package/dist/gateway/static/root/assets/phone-dependencies-card-DhEsfEUN.js +1 -0
- package/dist/gateway/static/root/assets/phone-model-picker-J4mFDk21.js +1 -0
- package/dist/gateway/static/root/assets/phone-settings-page-BLflz8CQ.js +1 -0
- package/dist/gateway/static/root/assets/plugin-details-dialog-1BwvmKZi.js +1 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Z4NM7_Dn.js → preview-open-alternatives-DaTaSKox.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-C5TcIaJj.js → product-open-page-wYlC0IVZ.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-5xID6jIj.js → product-preview-content-Bxur-p6S.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DwowzxzD.js +7 -0
- package/dist/gateway/static/root/assets/projects-page-Bwvn4i_e.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-B6kqbuw8.js → registry-api-BGqSwITi.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-DrHisOUe.js +1 -0
- package/dist/gateway/static/root/assets/runtime-tools-api-CSm5SpnR.js +5 -0
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-DXNidliV.js +1 -0
- package/dist/gateway/static/root/assets/{schema-form-DtPkiYwm.js → schema-form-DeSZ7SiO.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-D6-Vz8xK.js → session-api-DTxZyMta.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-DWbcMHcj.js → session-manager-B2HDomj4.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-seP7t0kv.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-VqBu7gHu.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-DD3iD5t5.js → settings-form-section-BNYQjZU4.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-iLY3LRDq.js → settings-page-29Ix0jSQ.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-Dx5S-Msc.js → settings-page-header-CYpuTXUW.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-layout-B20AfmFG.js +1 -0
- package/dist/gateway/static/root/assets/setup-status-panel-COQZgKX9.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-B8h9lqDL.js → share-preview-page-CwMRULXc.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-BWaykw9E.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-C9RsrvOp.js → skill-api-xfB5fUAh.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Bq-3_MCt.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-C3LfWsAZ.js +2 -0
- package/dist/gateway/static/root/assets/system-settings-panel-DRJu1ehM.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-XCJFP-Aa.js +2 -0
- package/dist/gateway/static/root/assets/{task-result-evidence-DjNWPpn_.js → task-result-evidence-C4o_Yue_.js} +1 -1
- package/dist/gateway/static/root/assets/tracing-settings-page-CYslh-Pu.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-C6XfsSWy.js → tunnel-api-Bi_kw6bv.js} +1 -1
- package/dist/gateway/static/root/assets/usage-page-CTTmklCs.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-DO-Twmbm.js → use-autosave-BkB9uD93.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-BDqguzRE.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-MGe3HkS_.js → voice-api-key-field-bt8_Agih.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-CPKzUb4R.js → voice-config-api-D7xsWrdh.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DptHqYh5.js → work-discovery-overlay-D3NG14dX.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-Y_UIryBH.js → xopc-cloud-account-card-B2OUKOQi.js} +1 -1
- package/dist/gateway/static/root/index.html +14 -14
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/capabilities.js +1 -0
- package/dist/src/agent/agent-manager.js +1 -1
- package/dist/src/agent/background-review/prompts.js +4 -3
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/embedded/run-turn.js +1 -1
- package/dist/src/agent/embedded/xopc-stream-bridge.js +7 -3
- package/dist/src/agent/external-tools/cliProvider.js +2 -2
- package/dist/src/agent/external-tools/composio-provider.js +2 -2
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/prompt/system-prompt.js +1 -1
- package/dist/src/agent/service.js +1 -1
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/tool-manuals/index.js +7 -0
- package/dist/src/agent/tool-manuals/phone.d.ts +1 -0
- package/dist/src/agent/tool-manuals/phone.js +16 -0
- package/dist/src/agent/tools/factory.js +15 -0
- package/dist/src/agent/tools/knowledge-memory-tool.js +1 -1
- package/dist/src/agent/tools/personal-read-tool.js +1 -1
- package/dist/src/agent/tools/personal-task-tool.d.ts +2 -1
- package/dist/src/agent/tools/personal-task-tool.js +43 -20
- package/dist/src/agent/tools/phone-use-tool.d.ts +8 -0
- package/dist/src/agent/tools/phone-use-tool.js +49 -0
- package/dist/src/agent/tools/session-recall-tool.js +2 -1
- package/dist/src/agent/tools/session-search-tool.js +11 -5
- package/dist/src/agent/tools/user-context-tool.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.js +2 -2
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/agent-catalog/repository.js +5 -1
- package/dist/src/agent-config/index.js +2 -2
- package/dist/src/agent-config/resolver.js +5 -0
- package/dist/src/agent-config/schema.d.ts +24 -0
- package/dist/src/agent-config/schema.js +5 -2
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/cli/command-manifest.js +1 -1
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +1 -1
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/runtime.js +32 -4
- package/dist/src/cli/utils/init-workspace-core.js +6 -4
- package/dist/src/computer/diagnostics.d.ts +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/config-file.d.ts +6 -0
- package/dist/src/config/config-file.js +35 -0
- package/dist/src/config/loader.js +5 -4
- package/dist/src/config/models-json.d.ts +36 -0
- package/dist/src/config/models-json.js +9 -0
- package/dist/src/config/schema.d.ts +12 -0
- package/dist/src/config/schema.js +6 -2
- package/dist/src/execution-environments/local-worktree-manager.js +1 -1
- package/dist/src/extensions/agent-plugins/skill-catalog.js +1 -1
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +7 -1
- package/dist/src/gateway/agent-builtin-tools.js +7 -0
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/global-defaults-admin.js +2 -0
- package/dist/src/gateway/hono/lib/config-payload.d.ts +8 -0
- package/dist/src/gateway/hono/routes/agents.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/models.js +3 -0
- package/dist/src/gateway/hono/routes/notes.js +2 -2
- package/dist/src/gateway/hono/routes/phone-dependencies.d.ts +3 -0
- package/dist/src/gateway/hono/routes/phone-dependencies.js +137 -0
- package/dist/src/gateway/hono/routes/phone.d.ts +4 -0
- package/dist/src/gateway/hono/routes/phone.js +445 -0
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- package/dist/src/gateway/hono/routes/runtime-tools.js +2 -0
- package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/image-generation-setup.js +1 -1
- package/dist/src/gateway/server.js +1 -0
- package/dist/src/gateway/service/config-coordinator.d.ts +8 -0
- package/dist/src/gateway/service.d.ts +2 -0
- package/dist/src/gateway/service.js +17 -12
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/home-intelligence/host.js +2 -2
- package/dist/src/imports/importService.js +1 -1
- package/dist/src/knowledge-memory/repository.js +5 -0
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/memory-learning/forget-capture.js +12 -3
- package/dist/src/memory-learning/forgotten-history.d.ts +4 -0
- package/dist/src/memory-learning/forgotten-history.js +71 -4
- package/dist/src/memory-learning/work-capture.d.ts +1 -0
- package/dist/src/memory-learning/work-capture.js +28 -17
- package/dist/src/personal-agent/prompts.js +3 -2
- package/dist/src/personal-agent/service.js +1 -1
- package/dist/src/phone/adb-driver.d.ts +35 -0
- package/dist/src/phone/adb-driver.js +368 -0
- package/dist/src/phone/cloud-adb.d.ts +34 -0
- package/dist/src/phone/cloud-adb.js +223 -0
- package/dist/src/phone/cloud-phones.d.ts +29 -0
- package/dist/src/phone/cloud-phones.js +141 -0
- package/dist/src/phone/cloud-scrcpy.d.ts +20 -0
- package/dist/src/phone/cloud-scrcpy.js +122 -0
- package/dist/src/phone/contracts.d.ts +204 -0
- package/dist/src/phone/contracts.js +115 -0
- package/dist/src/phone/interactive-session.d.ts +34 -0
- package/dist/src/phone/interactive-session.js +164 -0
- package/dist/src/phone/live-provider.d.ts +57 -0
- package/dist/src/phone/live-provider.js +18 -0
- package/dist/src/phone/live-state.d.ts +28 -0
- package/dist/src/phone/live-state.js +71 -0
- package/dist/src/phone/model-adapter.d.ts +25 -0
- package/dist/src/phone/model-adapter.js +340 -0
- package/dist/src/phone/repository.d.ts +19 -0
- package/dist/src/phone/repository.js +100 -0
- package/dist/src/phone/runtime.d.ts +83 -0
- package/dist/src/phone/runtime.js +896 -0
- package/dist/src/phone/scrcpy.d.ts +62 -0
- package/dist/src/phone/scrcpy.js +345 -0
- package/dist/src/phone/stream-gateway.d.ts +26 -0
- package/dist/src/phone/stream-gateway.js +210 -0
- package/dist/src/process/phone-process.d.ts +4 -0
- package/dist/src/process/phone-process.js +38 -0
- package/dist/src/providers/extension-stream-bridge.js +8 -1
- package/dist/src/providers/model-call.js +6 -2
- package/dist/src/providers/model-catalog-persistence.js +3 -0
- package/dist/src/providers/model-catalog-types.d.ts +3 -0
- package/dist/src/providers/model-reference-auditor.js +5 -1
- package/dist/src/providers/model-registry.js +3 -0
- package/dist/src/runtime-tools/archive.d.ts +2 -2
- package/dist/src/runtime-tools/archive.js +1 -1
- package/dist/src/runtime-tools/downloader.d.ts +2 -2
- package/dist/src/runtime-tools/errors.d.ts +3 -3
- package/dist/src/runtime-tools/phone-dependencies.d.ts +40 -0
- package/dist/src/runtime-tools/phone-dependencies.js +188 -0
- package/dist/src/runtime-tools/phone-dependency-catalog.d.ts +16 -0
- package/dist/src/runtime-tools/phone-dependency-catalog.js +51 -0
- package/dist/src/runtime-tools/types.d.ts +1 -0
- package/dist/src/storage/sqlite/context-extraction-repository.d.ts +1 -0
- package/dist/src/storage/sqlite/context-extraction-repository.js +12 -2
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/capabilities/write.js +1 -1
- package/dist/src/tasks/task-research-result.js +19 -2
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/usage/cloud-receipts.d.ts +5 -1
- package/dist/src/usage/cloud-receipts.js +10 -4
- package/dist/src/usage/cloud-wire.d.ts +37 -0
- package/dist/src/usage/cloud-wire.js +181 -0
- package/dist/src/usage/recorder.js +5 -4
- package/dist/src/user-model/capture/semantic.js +2 -2
- package/dist/src/voice/platform-catalog.d.ts +3 -0
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/package.json +9 -4
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BI7OTo-T.js +0 -1
- package/dist/gateway/static/root/assets/agents-RIXL0p7_.js +0 -77
- package/dist/gateway/static/root/assets/app-management-settings-panel-BGzhSS6H.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-DtEZq4b2.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-DZqBof2D.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-CI-yQnSj.js +0 -8
- package/dist/gateway/static/root/assets/browser-automations-page-Xzdif447.js +0 -3
- package/dist/gateway/static/root/assets/browser-settings-page-Bhu-83eC.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-B9b5KCBb.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-page-BIc0Zlsw.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CQEfpLdj.js +0 -8
- package/dist/gateway/static/root/assets/channels-DQbEoo_o.js +0 -1
- package/dist/gateway/static/root/assets/computer-settings-page-C9xMfwXK.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-eh-xpMPK.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-B_-j-D4W.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-CxG_FcQ6.js +0 -1
- package/dist/gateway/static/root/assets/extension-debug-page-CTe7Molh.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-DYJmgMUg.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-Dafw95ol.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-C13P4lQd.js +0 -1
- package/dist/gateway/static/root/assets/highlight-code-CslBKXdS.js +0 -1
- package/dist/gateway/static/root/assets/home-page-B_XrkGmA.js +0 -2
- package/dist/gateway/static/root/assets/imports-page--cuF5vwU.js +0 -1
- package/dist/gateway/static/root/assets/index-6YjAt50A.js +0 -710
- package/dist/gateway/static/root/assets/index-caRW34rg.css +0 -1
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-5g2PxgBs.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-B6U1HQpp.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-B9mq03SK.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-2W_qJsha.js +0 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-61Il2HQR.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-C4gZsNBL.js +0 -5
- package/dist/gateway/static/root/assets/note-image-lightbox-XqJIaaRV.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-Chdwrjni.js +0 -8
- package/dist/gateway/static/root/assets/personal-page-mQl9BftY.js +0 -1
- package/dist/gateway/static/root/assets/personal-settings-panel-BgcJLmZN.js +0 -1
- package/dist/gateway/static/root/assets/plugin-details-dialog-FvwSxZPB.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-CGOyx7zX.js +0 -7
- package/dist/gateway/static/root/assets/projects-page-Dd11tbRX.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Bintk9nL.js +0 -1
- package/dist/gateway/static/root/assets/runtime-tools-api-CY3R7unQ.js +0 -5
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-CbmiiLsq.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BBlEP7y3.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BCQUth4g.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-v4P0IAkG.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DMzej6z2.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-B20x7EE9.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-C_ulsnv7.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-PTRGMKkq.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-DEPwo4vf.js +0 -2
- package/dist/gateway/static/root/assets/tracing-settings-page-CVJt7IXC.js +0 -1
- package/dist/gateway/static/root/assets/usage-page-DgqLD8Y5.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-BwK37aob.js +0 -2
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { PhoneError, init_contracts } from "./contracts.js";
|
|
2
|
+
import { CloudAdbConnection, PhoneCloudKeyStore, parseCloudEndpoint, parseCloudPrivateKey } from "./cloud-adb.js";
|
|
3
|
+
import { CloudScrcpyProvider } from "./cloud-scrcpy.js";
|
|
4
|
+
import { randomUUID } from "node:crypto";
|
|
5
|
+
import sharp from "sharp";
|
|
6
|
+
//#region src/phone/cloud-phones.ts
|
|
7
|
+
init_contracts();
|
|
8
|
+
var CloudPhones = class {
|
|
9
|
+
drafts = /* @__PURE__ */ new Map();
|
|
10
|
+
connections = /* @__PURE__ */ new Map();
|
|
11
|
+
constructor(repository, keys = new PhoneCloudKeyStore(), connect = (endpoint, key) => new CloudAdbConnection(endpoint, key)) {
|
|
12
|
+
this.repository = repository;
|
|
13
|
+
this.keys = keys;
|
|
14
|
+
this.connect = connect;
|
|
15
|
+
}
|
|
16
|
+
discard(token) {
|
|
17
|
+
const draft = this.drafts.get(token);
|
|
18
|
+
if (draft) {
|
|
19
|
+
clearTimeout(draft.timer);
|
|
20
|
+
draft.key.fill(0);
|
|
21
|
+
this.drafts.delete(token);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
async test(owner, address, pem, signal) {
|
|
25
|
+
if (this.drafts.size >= 10) throw new PhoneError("PHONE_SETUP_BUSY", "Too many pending phone connections. Try again later.", 409);
|
|
26
|
+
const { endpoint } = parseCloudEndpoint(address);
|
|
27
|
+
const key = parseCloudPrivateKey(pem);
|
|
28
|
+
let lease;
|
|
29
|
+
try {
|
|
30
|
+
lease = this.repository.acquire(endpoint);
|
|
31
|
+
} catch (error) {
|
|
32
|
+
key.fill(0);
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
const connection = this.connect(endpoint, Buffer.from(key));
|
|
36
|
+
try {
|
|
37
|
+
const command = (...args) => connection.command("", [
|
|
38
|
+
"-s",
|
|
39
|
+
endpoint,
|
|
40
|
+
...args
|
|
41
|
+
], signal, 2e4);
|
|
42
|
+
const model = (await command("shell", "getprop", "ro.product.model")).toString().trim().slice(0, 100);
|
|
43
|
+
const androidVersion = (await command("shell", "getprop", "ro.build.version.release")).toString().trim().slice(0, 50);
|
|
44
|
+
const pixels = await command("exec-out", "screencap", "-p");
|
|
45
|
+
let screenshot;
|
|
46
|
+
try {
|
|
47
|
+
screenshot = `data:image/jpeg;base64,${(await sharp(pixels, { limitInputPixels: 16e6 }).resize({
|
|
48
|
+
width: 360,
|
|
49
|
+
withoutEnlargement: true
|
|
50
|
+
}).jpeg({ quality: 70 }).toBuffer()).toString("base64")}`;
|
|
51
|
+
} finally {
|
|
52
|
+
pixels.fill(0);
|
|
53
|
+
}
|
|
54
|
+
signal.throwIfAborted();
|
|
55
|
+
const token = randomUUID();
|
|
56
|
+
const expiresAt = Date.now() + 6e5;
|
|
57
|
+
const timer = setTimeout(() => this.discard(token), 6e5);
|
|
58
|
+
timer.unref();
|
|
59
|
+
this.drafts.set(token, {
|
|
60
|
+
owner,
|
|
61
|
+
endpoint,
|
|
62
|
+
key: Buffer.from(key),
|
|
63
|
+
expiresAt,
|
|
64
|
+
timer
|
|
65
|
+
});
|
|
66
|
+
return {
|
|
67
|
+
token,
|
|
68
|
+
expiresAt,
|
|
69
|
+
model,
|
|
70
|
+
androidVersion,
|
|
71
|
+
screenshot,
|
|
72
|
+
endpoint,
|
|
73
|
+
media: "snapshot"
|
|
74
|
+
};
|
|
75
|
+
} finally {
|
|
76
|
+
key.fill(0);
|
|
77
|
+
connection.dispose();
|
|
78
|
+
this.repository.release(endpoint, lease);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async add(owner, token, name, makeDefault) {
|
|
82
|
+
const draft = this.drafts.get(token);
|
|
83
|
+
if (!draft || draft.owner !== owner || draft.expiresAt < Date.now()) throw new PhoneError("PHONE_SETUP_EXPIRED", "Connection test expired. Test the connection again.", 409);
|
|
84
|
+
this.drafts.delete(token);
|
|
85
|
+
clearTimeout(draft.timer);
|
|
86
|
+
let credentialId;
|
|
87
|
+
try {
|
|
88
|
+
credentialId = await this.keys.save(draft.key);
|
|
89
|
+
const device = this.repository.save({
|
|
90
|
+
serial: draft.endpoint,
|
|
91
|
+
name,
|
|
92
|
+
enabled: true,
|
|
93
|
+
allowedApps: ["com.android.settings"],
|
|
94
|
+
connection: {
|
|
95
|
+
kind: "aliyun-adb",
|
|
96
|
+
endpoint: draft.endpoint,
|
|
97
|
+
credentialId
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
if (makeDefault || !this.repository.defaultDevice()) this.repository.setDefault(device.id);
|
|
101
|
+
return device;
|
|
102
|
+
} catch (error) {
|
|
103
|
+
if (credentialId) await this.keys.remove(credentialId);
|
|
104
|
+
throw error;
|
|
105
|
+
} finally {
|
|
106
|
+
draft.key.fill(0);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
cancel(owner, token) {
|
|
110
|
+
if (this.drafts.get(token)?.owner === owner) this.discard(token);
|
|
111
|
+
}
|
|
112
|
+
async driver(device) {
|
|
113
|
+
const binding = device.connection;
|
|
114
|
+
if (!binding) throw new PhoneError("PHONE_CONNECTION_INVALID", "Missing cloud connection");
|
|
115
|
+
let connection = this.connections.get(device.id);
|
|
116
|
+
if (!connection) {
|
|
117
|
+
connection = this.connect(binding.endpoint, await this.keys.load(binding.credentialId));
|
|
118
|
+
this.connections.set(device.id, connection);
|
|
119
|
+
}
|
|
120
|
+
return connection.driver();
|
|
121
|
+
}
|
|
122
|
+
async interactive(device, failed) {
|
|
123
|
+
const binding = device.connection;
|
|
124
|
+
if (!binding) throw new PhoneError("PHONE_CONNECTION_INVALID", "Missing cloud connection");
|
|
125
|
+
return new CloudScrcpyProvider(binding.endpoint, await this.keys.load(binding.credentialId), failed, this.connect);
|
|
126
|
+
}
|
|
127
|
+
disconnect(id) {
|
|
128
|
+
this.connections.get(id)?.dispose();
|
|
129
|
+
this.connections.delete(id);
|
|
130
|
+
}
|
|
131
|
+
async remove(device) {
|
|
132
|
+
this.disconnect(device.id);
|
|
133
|
+
if (device.connection) await this.keys.remove(device.connection.credentialId);
|
|
134
|
+
}
|
|
135
|
+
close() {
|
|
136
|
+
for (const token of this.drafts.keys()) this.discard(token);
|
|
137
|
+
for (const id of this.connections.keys()) this.disconnect(id);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
//#endregion
|
|
141
|
+
export { CloudPhones };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CloudAdbConnection } from './cloud-adb.js';
|
|
2
|
+
import { ScrcpyProvider } from './scrcpy.js';
|
|
3
|
+
/** Dedicated authenticated ADB transport: no host ADB key, server or port forwarding. */
|
|
4
|
+
export declare class CloudScrcpyProvider extends ScrcpyProvider {
|
|
5
|
+
private endpoint;
|
|
6
|
+
private connection;
|
|
7
|
+
private process?;
|
|
8
|
+
private video?;
|
|
9
|
+
private control?;
|
|
10
|
+
private writer?;
|
|
11
|
+
private remote;
|
|
12
|
+
private scid;
|
|
13
|
+
constructor(endpoint: string, key: Buffer, onFailure: () => void, connect?: (address: string, credential: Buffer) => CloudAdbConnection);
|
|
14
|
+
foreground(signal: AbortSignal): Promise<string>;
|
|
15
|
+
protected startTransport(): Promise<void>;
|
|
16
|
+
private drain;
|
|
17
|
+
private readVideo;
|
|
18
|
+
protected write(buffer: Buffer): Promise<void>;
|
|
19
|
+
protected cleanup(): Promise<void>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { PhoneError, init_contracts } from "./contracts.js";
|
|
2
|
+
import { SCRCPY_VERSION } from "../runtime-tools/phone-dependency-catalog.js";
|
|
3
|
+
import { ScrcpyProvider, ScrcpyVideoParser, readScrcpyServer } from "./scrcpy.js";
|
|
4
|
+
import { CloudAdbConnection } from "./cloud-adb.js";
|
|
5
|
+
import { randomBytes } from "node:crypto";
|
|
6
|
+
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
7
|
+
import { ReadableStream } from "@yume-chan/stream-extra";
|
|
8
|
+
//#region src/phone/cloud-scrcpy.ts
|
|
9
|
+
init_contracts();
|
|
10
|
+
/** Dedicated authenticated ADB transport: no host ADB key, server or port forwarding. */
|
|
11
|
+
var CloudScrcpyProvider = class extends ScrcpyProvider {
|
|
12
|
+
connection;
|
|
13
|
+
process;
|
|
14
|
+
video;
|
|
15
|
+
control;
|
|
16
|
+
writer;
|
|
17
|
+
remote = "";
|
|
18
|
+
scid = "";
|
|
19
|
+
constructor(endpoint, key, onFailure, connect = (address, credential) => new CloudAdbConnection(address, credential)) {
|
|
20
|
+
super(onFailure);
|
|
21
|
+
this.endpoint = endpoint;
|
|
22
|
+
this.connection = connect(endpoint, key);
|
|
23
|
+
}
|
|
24
|
+
foreground(signal) {
|
|
25
|
+
return this.connection.driver().foreground(this.endpoint, signal);
|
|
26
|
+
}
|
|
27
|
+
async startTransport() {
|
|
28
|
+
const timer = setTimeout(() => this.connection.close(), 2e4);
|
|
29
|
+
try {
|
|
30
|
+
const binary = await readScrcpyServer();
|
|
31
|
+
const adb = await this.connection.client();
|
|
32
|
+
if (this.closing) throw new Error("Video closed");
|
|
33
|
+
this.scid = (randomBytes(4).readUInt32BE() & 2147483647).toString(16);
|
|
34
|
+
const socketName = `scrcpy_${this.scid.padStart(8, "0")}`;
|
|
35
|
+
this.remote = `/data/local/tmp/xopc-${socketName}.jar`;
|
|
36
|
+
const sync = await adb.sync();
|
|
37
|
+
try {
|
|
38
|
+
await sync.write({
|
|
39
|
+
filename: this.remote,
|
|
40
|
+
permission: 384,
|
|
41
|
+
file: new ReadableStream({ start(controller) {
|
|
42
|
+
controller.enqueue(binary);
|
|
43
|
+
controller.close();
|
|
44
|
+
} })
|
|
45
|
+
});
|
|
46
|
+
} finally {
|
|
47
|
+
await sync.dispose();
|
|
48
|
+
}
|
|
49
|
+
if (this.closing) throw new Error("Video closed");
|
|
50
|
+
this.process = await adb.createSocket(`exec:CLASSPATH=${this.remote} app_process / com.genymobile.scrcpy.Server ${SCRCPY_VERSION} scid=${this.scid} tunnel_forward=true audio=false control=true cleanup=false max_size=960 max_fps=30 video_bit_rate=2000000 video_codec=h264 video_codec_options=i-frame-interval=1 send_dummy_byte=false send_device_meta=false send_codec_meta=true send_frame_meta=true clipboard_autosync=false`);
|
|
51
|
+
this.drain(this.process);
|
|
52
|
+
for (let attempt = 0; attempt < 60; attempt++) {
|
|
53
|
+
if (this.closing) throw new Error("Video closed");
|
|
54
|
+
try {
|
|
55
|
+
this.video = await adb.createSocket(`localabstract:${socketName}`);
|
|
56
|
+
break;
|
|
57
|
+
} catch {
|
|
58
|
+
await setTimeout$1(50);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (!this.video) throw new Error("Scrcpy connection timed out");
|
|
62
|
+
this.control = await adb.createSocket(`localabstract:${socketName}`);
|
|
63
|
+
this.writer = this.control.writable.getWriter();
|
|
64
|
+
this.drain(this.control);
|
|
65
|
+
this.readVideo(this.video);
|
|
66
|
+
} finally {
|
|
67
|
+
clearTimeout(timer);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async drain(socket) {
|
|
71
|
+
try {
|
|
72
|
+
for await (const _chunk of socket.readable);
|
|
73
|
+
} catch {}
|
|
74
|
+
if (!this.closing) this.fail();
|
|
75
|
+
}
|
|
76
|
+
async readVideo(socket) {
|
|
77
|
+
const parser = new ScrcpyVideoParser();
|
|
78
|
+
try {
|
|
79
|
+
for await (const chunk of socket.readable) parser.push(Buffer.from(chunk), (packet) => this.packet(packet));
|
|
80
|
+
} catch {}
|
|
81
|
+
if (!this.closing) this.fail();
|
|
82
|
+
}
|
|
83
|
+
async write(buffer) {
|
|
84
|
+
if (!this.writer) throw new PhoneError("PHONE_INPUT_DISCONNECTED", "Cloud phone input channel unavailable");
|
|
85
|
+
const timer = setTimeout(() => this.connection.close(), 2e3);
|
|
86
|
+
try {
|
|
87
|
+
await this.writer.write(buffer);
|
|
88
|
+
} finally {
|
|
89
|
+
clearTimeout(timer);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async cleanup() {
|
|
93
|
+
try {
|
|
94
|
+
await this.revoke().catch(() => {});
|
|
95
|
+
this.writer?.releaseLock();
|
|
96
|
+
this.writer = void 0;
|
|
97
|
+
await Promise.allSettled([
|
|
98
|
+
this.video?.close(),
|
|
99
|
+
this.control?.close(),
|
|
100
|
+
this.process?.close()
|
|
101
|
+
]);
|
|
102
|
+
if (this.scid) {
|
|
103
|
+
const command = (...args) => this.connection.command("", [
|
|
104
|
+
"-s",
|
|
105
|
+
this.endpoint,
|
|
106
|
+
"shell",
|
|
107
|
+
...args
|
|
108
|
+
], void 0, 3e3);
|
|
109
|
+
const processes = await command("ps", "-A", "-o", "PID,ARGS").catch(() => Buffer.alloc(0));
|
|
110
|
+
for (const line of processes.toString().split("\n")) {
|
|
111
|
+
const pid = /^\s*(\d+)\s+/.exec(line)?.[1];
|
|
112
|
+
if (pid && line.includes("com.genymobile.scrcpy.Server ") && new RegExp(`(?:^|\\s)scid=${this.scid}(?:\\s|$)`).test(line)) await command("kill", "-TERM", pid).catch(() => {});
|
|
113
|
+
}
|
|
114
|
+
if (this.remote) await command("rm", "-f", this.remote).catch(() => {});
|
|
115
|
+
}
|
|
116
|
+
} finally {
|
|
117
|
+
this.connection.dispose();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
//#endregion
|
|
122
|
+
export { CloudScrcpyProvider };
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const PhoneProfileSchema: z.ZodEnum<{
|
|
3
|
+
"autoglm-phone-v1": "autoglm-phone-v1";
|
|
4
|
+
"structured-phone-v1": "structured-phone-v1";
|
|
5
|
+
}>;
|
|
6
|
+
export declare const PhoneModelMetadataSchema: z.ZodObject<{
|
|
7
|
+
profile: z.ZodEnum<{
|
|
8
|
+
"autoglm-phone-v1": "autoglm-phone-v1";
|
|
9
|
+
"structured-phone-v1": "structured-phone-v1";
|
|
10
|
+
}>;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
export declare const MOCK_PHONE_MODEL = "phone-mock/settings-about";
|
|
13
|
+
export declare const MOCK_PHONE_GOAL = "Open Android Settings and inspect About phone";
|
|
14
|
+
export declare const PhoneConfigSchema: z.ZodPrefault<z.ZodObject<{
|
|
15
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
16
|
+
adbPath: z.ZodOptional<z.ZodString>;
|
|
17
|
+
maxActionsPerSession: z.ZodDefault<z.ZodNumber>;
|
|
18
|
+
maxModelRequests: z.ZodDefault<z.ZodNumber>;
|
|
19
|
+
maxOperationDurationMs: z.ZodDefault<z.ZodNumber>;
|
|
20
|
+
maxSessionDurationMs: z.ZodDefault<z.ZodNumber>;
|
|
21
|
+
}, z.core.$strict>>;
|
|
22
|
+
export type PhoneConfig = z.infer<typeof PhoneConfigSchema>;
|
|
23
|
+
export declare const PhoneDeviceSchema: z.ZodObject<{
|
|
24
|
+
id: z.ZodString;
|
|
25
|
+
serial: z.ZodString;
|
|
26
|
+
name: z.ZodString;
|
|
27
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
28
|
+
allowedApps: z.ZodArray<z.ZodString>;
|
|
29
|
+
connection: z.ZodOptional<z.ZodObject<{
|
|
30
|
+
kind: z.ZodLiteral<"aliyun-adb">;
|
|
31
|
+
endpoint: z.ZodString;
|
|
32
|
+
credentialId: z.ZodString;
|
|
33
|
+
}, z.core.$strict>>;
|
|
34
|
+
createdAt: z.ZodNumber;
|
|
35
|
+
revision: z.ZodNumber;
|
|
36
|
+
}, z.core.$strict>;
|
|
37
|
+
export type PhoneDevice = z.infer<typeof PhoneDeviceSchema>;
|
|
38
|
+
export type DiscoveredPhone = {
|
|
39
|
+
serial: string;
|
|
40
|
+
state: string;
|
|
41
|
+
name: string;
|
|
42
|
+
emulator: boolean;
|
|
43
|
+
};
|
|
44
|
+
export declare const PhoneActionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
45
|
+
type: z.ZodLiteral<"launch">;
|
|
46
|
+
package: z.ZodString;
|
|
47
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
48
|
+
type: z.ZodLiteral<"tap">;
|
|
49
|
+
point: z.ZodArray<z.ZodNumber>;
|
|
50
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
51
|
+
type: z.ZodLiteral<"doubleTap">;
|
|
52
|
+
point: z.ZodArray<z.ZodNumber>;
|
|
53
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
54
|
+
type: z.ZodLiteral<"longPress">;
|
|
55
|
+
point: z.ZodArray<z.ZodNumber>;
|
|
56
|
+
durationMs: z.ZodDefault<z.ZodNumber>;
|
|
57
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
58
|
+
type: z.ZodLiteral<"swipe">;
|
|
59
|
+
start: z.ZodArray<z.ZodNumber>;
|
|
60
|
+
end: z.ZodArray<z.ZodNumber>;
|
|
61
|
+
durationMs: z.ZodDefault<z.ZodNumber>;
|
|
62
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
63
|
+
type: z.ZodLiteral<"typeText">;
|
|
64
|
+
text: z.ZodString;
|
|
65
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
66
|
+
type: z.ZodEnum<{
|
|
67
|
+
home: "home";
|
|
68
|
+
back: "back";
|
|
69
|
+
}>;
|
|
70
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
71
|
+
type: z.ZodLiteral<"wait">;
|
|
72
|
+
durationMs: z.ZodNumber;
|
|
73
|
+
}, z.core.$strict>], "type">;
|
|
74
|
+
export type PhoneAction = z.infer<typeof PhoneActionSchema>;
|
|
75
|
+
export declare const PhoneDecisionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
76
|
+
kind: z.ZodLiteral<"action">;
|
|
77
|
+
action: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
78
|
+
type: z.ZodLiteral<"launch">;
|
|
79
|
+
package: z.ZodString;
|
|
80
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
81
|
+
type: z.ZodLiteral<"tap">;
|
|
82
|
+
point: z.ZodArray<z.ZodNumber>;
|
|
83
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
84
|
+
type: z.ZodLiteral<"doubleTap">;
|
|
85
|
+
point: z.ZodArray<z.ZodNumber>;
|
|
86
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
87
|
+
type: z.ZodLiteral<"longPress">;
|
|
88
|
+
point: z.ZodArray<z.ZodNumber>;
|
|
89
|
+
durationMs: z.ZodDefault<z.ZodNumber>;
|
|
90
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
91
|
+
type: z.ZodLiteral<"swipe">;
|
|
92
|
+
start: z.ZodArray<z.ZodNumber>;
|
|
93
|
+
end: z.ZodArray<z.ZodNumber>;
|
|
94
|
+
durationMs: z.ZodDefault<z.ZodNumber>;
|
|
95
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
96
|
+
type: z.ZodLiteral<"typeText">;
|
|
97
|
+
text: z.ZodString;
|
|
98
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
99
|
+
type: z.ZodEnum<{
|
|
100
|
+
home: "home";
|
|
101
|
+
back: "back";
|
|
102
|
+
}>;
|
|
103
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
104
|
+
type: z.ZodLiteral<"wait">;
|
|
105
|
+
durationMs: z.ZodNumber;
|
|
106
|
+
}, z.core.$strict>], "type">;
|
|
107
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
108
|
+
kind: z.ZodLiteral<"complete">;
|
|
109
|
+
summary: z.ZodString;
|
|
110
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
111
|
+
kind: z.ZodLiteral<"needsUser">;
|
|
112
|
+
reason: z.ZodString;
|
|
113
|
+
}, z.core.$strict>], "kind">;
|
|
114
|
+
export type PhoneDecision = z.infer<typeof PhoneDecisionSchema>;
|
|
115
|
+
export type PhoneElement = {
|
|
116
|
+
text: string;
|
|
117
|
+
description: string;
|
|
118
|
+
resourceId: string;
|
|
119
|
+
clickable: boolean;
|
|
120
|
+
focused: boolean;
|
|
121
|
+
password: boolean;
|
|
122
|
+
editable?: boolean;
|
|
123
|
+
bounds: [number, number, number, number];
|
|
124
|
+
};
|
|
125
|
+
export type PhoneObservation = {
|
|
126
|
+
frameId: string;
|
|
127
|
+
capturedAt: number;
|
|
128
|
+
width: number;
|
|
129
|
+
height: number;
|
|
130
|
+
rotation: number;
|
|
131
|
+
package: string;
|
|
132
|
+
frame: Buffer;
|
|
133
|
+
elements: PhoneElement[];
|
|
134
|
+
};
|
|
135
|
+
export declare const PhoneInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
136
|
+
op: z.ZodLiteral<"discover">;
|
|
137
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
138
|
+
op: z.ZodLiteral<"open">;
|
|
139
|
+
deviceId: z.ZodOptional<z.ZodString>;
|
|
140
|
+
mode: z.ZodEnum<{
|
|
141
|
+
observe: "observe";
|
|
142
|
+
control: "control";
|
|
143
|
+
}>;
|
|
144
|
+
appPackage: z.ZodOptional<z.ZodString>;
|
|
145
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
146
|
+
op: z.ZodLiteral<"observe">;
|
|
147
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
148
|
+
op: z.ZodEnum<{
|
|
149
|
+
run: "run";
|
|
150
|
+
step: "step";
|
|
151
|
+
}>;
|
|
152
|
+
goal: z.ZodString;
|
|
153
|
+
scenario: z.ZodOptional<z.ZodLiteral<"settings-about">>;
|
|
154
|
+
expectText: z.ZodOptional<z.ZodString>;
|
|
155
|
+
maxActions: z.ZodDefault<z.ZodNumber>;
|
|
156
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
157
|
+
op: z.ZodEnum<{
|
|
158
|
+
cancel: "cancel";
|
|
159
|
+
status: "status";
|
|
160
|
+
close: "close";
|
|
161
|
+
pause: "pause";
|
|
162
|
+
resume: "resume";
|
|
163
|
+
}>;
|
|
164
|
+
}, z.core.$strict>], "op">;
|
|
165
|
+
export type PhoneInput = z.infer<typeof PhoneInputSchema>;
|
|
166
|
+
export type PhoneStatus = 'ready' | 'running' | 'paused' | 'needs_user' | 'completed' | 'cancelled' | 'closed' | 'failed' | 'outcome_unknown';
|
|
167
|
+
export type PhoneReport = {
|
|
168
|
+
sessionId: string;
|
|
169
|
+
deviceId: string;
|
|
170
|
+
deviceName: string;
|
|
171
|
+
owner: string;
|
|
172
|
+
agentId: string;
|
|
173
|
+
modelRef: string;
|
|
174
|
+
mock: boolean;
|
|
175
|
+
mode: 'observe' | 'control';
|
|
176
|
+
status: PhoneStatus;
|
|
177
|
+
actions: number;
|
|
178
|
+
humanActions?: number;
|
|
179
|
+
modelRequests: number;
|
|
180
|
+
createdAt: number;
|
|
181
|
+
updatedAt: number;
|
|
182
|
+
verified: boolean;
|
|
183
|
+
verificationLevel: 'none' | 'ui';
|
|
184
|
+
stopReason?: string;
|
|
185
|
+
errorCode?: string;
|
|
186
|
+
facts?: string[];
|
|
187
|
+
foregroundApp?: string;
|
|
188
|
+
message?: string;
|
|
189
|
+
steps: Array<{
|
|
190
|
+
action: PhoneAction['type'];
|
|
191
|
+
at: number;
|
|
192
|
+
dispatch: 'completed' | 'unknown';
|
|
193
|
+
actor?: 'agent' | 'human';
|
|
194
|
+
}>;
|
|
195
|
+
controlOwner?: 'agent' | 'human' | 'none';
|
|
196
|
+
controlEpoch?: number;
|
|
197
|
+
handoff?: 'idle' | 'acquiring' | 'returning';
|
|
198
|
+
currentAction?: PhoneAction['type'];
|
|
199
|
+
};
|
|
200
|
+
export declare class PhoneError extends Error {
|
|
201
|
+
readonly code: string;
|
|
202
|
+
readonly status: 400 | 403 | 404 | 409 | 500 | 502;
|
|
203
|
+
constructor(code: string, message: string, status?: 400 | 403 | 404 | 409 | 500 | 502);
|
|
204
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/phone/contracts.ts
|
|
4
|
+
var PhoneProfileSchema, PhoneModelMetadataSchema, MOCK_PHONE_MODEL, MOCK_PHONE_GOAL, PhoneConfigSchema, PhoneDeviceSchema, Point, PhoneActionSchema, PhoneDecisionSchema, PhoneInputSchema, PhoneError;
|
|
5
|
+
var init_contracts = __esmMin((() => {
|
|
6
|
+
PhoneProfileSchema = z.enum(["autoglm-phone-v1", "structured-phone-v1"]);
|
|
7
|
+
PhoneModelMetadataSchema = z.object({ profile: PhoneProfileSchema }).strict();
|
|
8
|
+
MOCK_PHONE_MODEL = "phone-mock/settings-about";
|
|
9
|
+
MOCK_PHONE_GOAL = "Open Android Settings and inspect About phone";
|
|
10
|
+
PhoneConfigSchema = z.object({
|
|
11
|
+
enabled: z.boolean().default(false),
|
|
12
|
+
adbPath: z.string().min(1).optional(),
|
|
13
|
+
maxActionsPerSession: z.number().int().min(1).max(80).default(40),
|
|
14
|
+
maxModelRequests: z.number().int().min(1).max(120).default(60),
|
|
15
|
+
maxOperationDurationMs: z.number().int().min(1e3).max(9e5).default(3e5),
|
|
16
|
+
maxSessionDurationMs: z.number().int().min(1e3).max(9e5).default(9e5)
|
|
17
|
+
}).strict().prefault({});
|
|
18
|
+
PhoneDeviceSchema = z.object({
|
|
19
|
+
id: z.string().uuid(),
|
|
20
|
+
serial: z.string().min(1).max(200),
|
|
21
|
+
name: z.string().trim().min(1).max(100),
|
|
22
|
+
enabled: z.boolean().default(true),
|
|
23
|
+
allowedApps: z.array(z.string().regex(/^[a-zA-Z][\w]*(?:\.[\w]+)+$/)).min(1).max(50),
|
|
24
|
+
connection: z.object({
|
|
25
|
+
kind: z.literal("aliyun-adb"),
|
|
26
|
+
endpoint: z.string().max(200),
|
|
27
|
+
credentialId: z.string().uuid()
|
|
28
|
+
}).strict().optional(),
|
|
29
|
+
createdAt: z.number(),
|
|
30
|
+
revision: z.number().int().positive()
|
|
31
|
+
}).strict();
|
|
32
|
+
Point = z.array(z.number().finite().min(0).max(1e3)).length(2);
|
|
33
|
+
PhoneActionSchema = z.discriminatedUnion("type", [
|
|
34
|
+
z.object({
|
|
35
|
+
type: z.literal("launch"),
|
|
36
|
+
package: z.string().regex(/^[a-zA-Z][\w]*(?:\.[\w]+)+$/)
|
|
37
|
+
}).strict(),
|
|
38
|
+
z.object({
|
|
39
|
+
type: z.literal("tap"),
|
|
40
|
+
point: Point
|
|
41
|
+
}).strict(),
|
|
42
|
+
z.object({
|
|
43
|
+
type: z.literal("doubleTap"),
|
|
44
|
+
point: Point
|
|
45
|
+
}).strict(),
|
|
46
|
+
z.object({
|
|
47
|
+
type: z.literal("longPress"),
|
|
48
|
+
point: Point,
|
|
49
|
+
durationMs: z.number().int().min(100).max(3e3).default(800)
|
|
50
|
+
}).strict(),
|
|
51
|
+
z.object({
|
|
52
|
+
type: z.literal("swipe"),
|
|
53
|
+
start: Point,
|
|
54
|
+
end: Point,
|
|
55
|
+
durationMs: z.number().int().min(100).max(2e3).default(500)
|
|
56
|
+
}).strict(),
|
|
57
|
+
z.object({
|
|
58
|
+
type: z.literal("typeText"),
|
|
59
|
+
text: z.string().min(1).max(4e3)
|
|
60
|
+
}).strict(),
|
|
61
|
+
z.object({ type: z.enum(["back", "home"]) }).strict(),
|
|
62
|
+
z.object({
|
|
63
|
+
type: z.literal("wait"),
|
|
64
|
+
durationMs: z.number().int().min(100).max(3e3)
|
|
65
|
+
}).strict()
|
|
66
|
+
]);
|
|
67
|
+
PhoneDecisionSchema = z.discriminatedUnion("kind", [
|
|
68
|
+
z.object({
|
|
69
|
+
kind: z.literal("action"),
|
|
70
|
+
action: PhoneActionSchema
|
|
71
|
+
}).strict(),
|
|
72
|
+
z.object({
|
|
73
|
+
kind: z.literal("complete"),
|
|
74
|
+
summary: z.string().max(1e3)
|
|
75
|
+
}).strict(),
|
|
76
|
+
z.object({
|
|
77
|
+
kind: z.literal("needsUser"),
|
|
78
|
+
reason: z.string().max(1e3)
|
|
79
|
+
}).strict()
|
|
80
|
+
]);
|
|
81
|
+
PhoneInputSchema = z.discriminatedUnion("op", [
|
|
82
|
+
z.object({ op: z.literal("discover") }).strict(),
|
|
83
|
+
z.object({
|
|
84
|
+
op: z.literal("open"),
|
|
85
|
+
deviceId: z.string().uuid().optional(),
|
|
86
|
+
mode: z.enum(["observe", "control"]),
|
|
87
|
+
appPackage: z.string().regex(/^[a-zA-Z][\w]*(?:\.[\w]+)+$/).optional()
|
|
88
|
+
}).strict(),
|
|
89
|
+
z.object({ op: z.literal("observe") }).strict(),
|
|
90
|
+
z.object({
|
|
91
|
+
op: z.enum(["run", "step"]),
|
|
92
|
+
goal: z.string().trim().min(1).max(2e3),
|
|
93
|
+
scenario: z.literal("settings-about").optional(),
|
|
94
|
+
expectText: z.string().min(1).max(200).optional(),
|
|
95
|
+
maxActions: z.number().int().min(1).max(12).default(6)
|
|
96
|
+
}).strict(),
|
|
97
|
+
z.object({ op: z.enum([
|
|
98
|
+
"status",
|
|
99
|
+
"pause",
|
|
100
|
+
"resume",
|
|
101
|
+
"cancel",
|
|
102
|
+
"close"
|
|
103
|
+
]) }).strict()
|
|
104
|
+
]);
|
|
105
|
+
PhoneError = class extends Error {
|
|
106
|
+
constructor(code, message, status = 400) {
|
|
107
|
+
super(message);
|
|
108
|
+
this.code = code;
|
|
109
|
+
this.status = status;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
}));
|
|
113
|
+
//#endregion
|
|
114
|
+
init_contracts();
|
|
115
|
+
export { MOCK_PHONE_GOAL, MOCK_PHONE_MODEL, PhoneActionSchema, PhoneConfigSchema, PhoneDecisionSchema, PhoneDeviceSchema, PhoneError, PhoneInputSchema, PhoneModelMetadataSchema, PhoneProfileSchema, init_contracts };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { PhoneInteractiveProvider, PhonePointer, PhoneVideoPacket } from './live-provider.js';
|
|
2
|
+
/** Shared device source with bounded video gating and ordered, fenced input. */
|
|
3
|
+
export declare class PhoneInteractiveSession {
|
|
4
|
+
readonly provider: PhoneInteractiveProvider;
|
|
5
|
+
private checkScreen;
|
|
6
|
+
private authorize;
|
|
7
|
+
private onGesture;
|
|
8
|
+
private viewers;
|
|
9
|
+
private queue;
|
|
10
|
+
private pending;
|
|
11
|
+
private seq;
|
|
12
|
+
private packets;
|
|
13
|
+
private bytes;
|
|
14
|
+
private checkedAt;
|
|
15
|
+
private allowed;
|
|
16
|
+
private closed;
|
|
17
|
+
private timer?;
|
|
18
|
+
private unsubscribe?;
|
|
19
|
+
private config?;
|
|
20
|
+
private started?;
|
|
21
|
+
private gesture?;
|
|
22
|
+
private verification?;
|
|
23
|
+
constructor(provider: PhoneInteractiveProvider, checkScreen: () => Promise<void>, authorize: (client: string, epoch: number) => void, onGesture?: (action: 'tap' | 'longPress' | 'swipe') => void);
|
|
24
|
+
start(): Promise<void>;
|
|
25
|
+
private verifyScreen;
|
|
26
|
+
private poll;
|
|
27
|
+
subscribe(client: string, packet: (packet: PhoneVideoPacket) => void, fault: (code: string) => void): () => void;
|
|
28
|
+
input(client: string, input: PhonePointer): Promise<void>;
|
|
29
|
+
revoke(): Promise<void>;
|
|
30
|
+
close(): Promise<void>;
|
|
31
|
+
get viewerCount(): number;
|
|
32
|
+
verifyGeometry(version: number): boolean;
|
|
33
|
+
authorizeClient(client: string, epoch: number): void;
|
|
34
|
+
}
|