@xopcai/xopc 0.0.286 → 0.0.291
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 +16 -0
- package/README.zh-CN.md +16 -0
- package/dist/browser-ext/dist/assets/{auth-BXCWrPlg.js → auth-B2CDTr_F.js} +2 -1
- package/dist/browser-ext/dist/background.js +1 -1
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +36 -10
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-xOhV8FHx.js → activity-store-6lmzUBEr.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BzQbYWEj.js → agent-avatar-dicebear-BCtrkF15.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-D2eYNelh.js +1 -0
- package/dist/gateway/static/root/assets/agents-BedA5XwI.js +1 -0
- package/dist/gateway/static/root/assets/{api-CVJQLBv9.js → api-D6yepxBp.js} +1 -1
- package/dist/gateway/static/root/assets/api-Dnfnl1Gd.js +1 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CTyuXkNC.js → app-management-settings-panel-Md562Fo-.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-Tk-GJtvF.js → appearance-settings-BiBFI4BM.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-BA-7OrhJ.js → apps-page-Corla83b.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-O49jeeXo.js → archive-plugin-A_Unp751.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-r9lBF2tW.js → attachment-load-D6idSUyP.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CFFLXYgS.js → automations-page-C6j71Lgs.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-DjZdhLQ5.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BpM43vsn.js → binary-plugins-BkKYh-8v.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DFrfEcGw.js → block-editor-CDcMvaku.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-CyHGQwxQ.js → browser-automation-inputs-Cq4sIJt2.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-CPkOWfM9.js → browser-automations-page-C64k4TBH.js} +2 -2
- package/dist/gateway/static/root/assets/{browser-settings-page-BOcseZxg.js → browser-settings-page-1k5rj_qR.js} +3 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-B2NvoTYb.js +8 -0
- package/dist/gateway/static/root/assets/channels-settings-DExixzp4.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-BArPeImO.js → channels-status-swr-CVzEYBpX.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-D5Aka4S8.js → chat-terminal-dock-B9eKFkbg.js} +2 -2
- package/dist/gateway/static/root/assets/computer-model-settings-DW6j2lsn.js +1 -0
- package/dist/gateway/static/root/assets/computer-settings-page-C2Qyw63Q.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-C3ubZz7K.js +2 -0
- package/dist/gateway/static/root/assets/{date-picker-DNtRu6EB.js → date-picker-BdxjXVKL.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-Dng3dIQa.js → dependency-picker-CXOa4uh4.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BicYycxy.js → desktop-pet-CBWiAaSv.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BEse55eX.js → desktop-pet-settings-BX1aILDK.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-be30HuFI.js → device-pairing-wizard-bqm_Yf4i.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-YzhYyuay.js → extension-debug-page-B4MMerja.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CEXVIkDl.js → extension-page-B3ZtINak.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CrlbgK8g.js → extension-settings-page-8BkQVh0z.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-BNuoHXiZ.js → gateway-config-swr-BBovMBQ1.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-ZyhacQX5.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-zMPfje0n.js → gateway-startup-retry-NXDtzZED.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-BtxitqZ3.js → heartbeat-settings-Bllcxm2A.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-Cv2e8XBR.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-B_Tyx74A.js → image-generation-api-D01ieqGC.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-eZciuLw_.js → imports-page-DJG1BJzd.js} +1 -1
- package/dist/gateway/static/root/assets/index-B7EieIE4.js +75 -0
- package/dist/gateway/static/root/assets/index-BD5uNzie.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-B796W039.js → keyboard-shortcuts-settings-6A6JOHTI.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-Cipj52Zq.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DXmY5jwM.js → local-apps-page-bD-m7YHJ.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-D0001I7p.js → locale-store-eliqUnBr.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-D5feO2yw.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-b1MG7s-3.js → management-settings-B7mz0_44.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-2txE_Blz.js → markdown-view-BIg7cei7.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CDEf3ksI.js → media-plugins-DQ2HfMeG.js} +1 -1
- package/dist/gateway/static/root/assets/messages-NYDOR8-j.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-DhYJigb3.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-Bg5NPUdf.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-Bi_-DA5J.js → page-tabs-DmG_Qjl8.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Dhfdf14p.js → preview-open-alternatives-Y9J1kjKC.js} +1 -1
- package/dist/gateway/static/root/assets/{proactive-page-BNouL7Tv.js → proactive-page-Duc_NQ8l.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-BkbZBqBr.js → product-open-page-DtgWUAwT.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DVOiucVA.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-Dr_kDoCJ.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-icwoEKYB.js → registry-api-Dpm3N2h0.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-hyJ2KKKK.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-bmgxwWpW.js → runtime-tools-settings-panel-DB7J9opJ.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-DoZeepCg.js → schema-form-CMYuPOlE.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DGsnYcoh.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DuzZqQMn.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-sw2bbS2b.js → settings-form-section-BayJP08a.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-BWF8uac0.js → settings-page-CWBqZtt6.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-C97S5g5c.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BIHYD6-O.js → share-preview-page-Wn5bQA-5.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-pfVzP8F7.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DDJ0ZKx3.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-DbDpLjDW.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-dvue6Ish.js → skills-page.utils-DCHY_kou.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-DCyxPWCl.js → system-settings-panel-DhgITgId.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-UqwtiHYu.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-CZwYGpbY.js → theme-store-DUHPzKzv.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-__auf8Ww.js → tunnel-api-DJ3gz2tM.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-Iq83UDt3.js → use-autosave-htvgT192.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-xOsXY_2W.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-D-QssKik.js → voice-api-key-field-BviJF3Oa.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-B0wNN_tE.js → voice-config-api-Bjy8EFqi.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-5NRYg1iI.js → work-discovery-overlay-BOBVNEYZ.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Ds2SZjLG.js → workflow-run-setup-panel-D1N9uUyM.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-2ylzlgkG.js +6 -0
- package/dist/gateway/static/root/index.html +10 -10
- package/dist/package.js +1 -1
- package/dist/packages/computer-control-contract/src/index.js +178 -0
- package/dist/packages/realtime-protocol/src/voice-audio.js +15 -10
- package/dist/packages/realtime-protocol/src/voice-catalog.js +61 -0
- package/dist/packages/realtime-protocol/src/voice.js +257 -248
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +5 -4
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/embedded/run-turn.js +9 -1
- package/dist/src/agent/external-tools/endpoint-provider.js +4 -2
- 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.js +2 -2
- 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/index.js +25 -15
- package/dist/src/agent/skills/parse-skill-metadata.d.ts +5 -1
- package/dist/src/agent/skills/parse-skill-metadata.js +21 -1
- package/dist/src/agent/skills/types.d.ts +7 -0
- package/dist/src/agent/tasks/task-judge-service.js +3 -3
- package/dist/src/agent/tool-manuals/computer.d.ts +1 -0
- package/dist/src/agent/tool-manuals/computer.js +19 -0
- package/dist/src/agent/tool-manuals/index.js +7 -0
- package/dist/src/agent/tools/computer-use-tool.d.ts +11 -0
- package/dist/src/agent/tools/computer-use-tool.js +86 -0
- package/dist/src/agent/tools/factory.d.ts +2 -0
- package/dist/src/agent/tools/factory.js +30 -0
- 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 +32 -0
- package/dist/src/agent-config/schema.js +5 -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 +1 -1
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/capabilities/readiness/from-config.js +14 -2
- package/dist/src/capabilities/readiness/planner.js +3 -2
- package/dist/src/capabilities/readiness/types.d.ts +1 -1
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/cli/commands/agent.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +3 -3
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/computer/broker.d.ts +97 -0
- package/dist/src/computer/broker.js +337 -0
- package/dist/src/computer/config.d.ts +9 -0
- package/dist/src/computer/config.js +16 -0
- package/dist/src/computer/control-guard.d.ts +4 -0
- package/dist/src/computer/control-guard.js +17 -0
- package/dist/src/computer/errors.d.ts +7 -0
- package/dist/src/computer/errors.js +30 -0
- package/dist/src/computer/model-adapter.d.ts +44 -0
- package/dist/src/computer/model-adapter.js +273 -0
- package/dist/src/computer/model-config.d.ts +3 -0
- package/dist/src/computer/model-config.js +27 -0
- package/dist/src/computer/model-policy.d.ts +3 -0
- package/dist/src/computer/model-policy.js +20 -0
- package/dist/src/computer/runtime.d.ts +128 -0
- package/dist/src/computer/runtime.js +388 -0
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.d.ts +36 -0
- package/dist/src/config/models-json.js +15 -1
- package/dist/src/config/schema.d.ts +37 -0
- package/dist/src/config/schema.js +11 -2
- package/dist/src/config/voice.js +2 -2
- package/dist/src/endpoint-tools/invocation-service.d.ts +1 -0
- package/dist/src/endpoint-tools/invocation-service.js +5 -2
- package/dist/src/endpoint-tools/policy.js +7 -0
- package/dist/src/endpoint-tools/runtime.js +1 -0
- package/dist/src/endpoint-tools/upload-service.d.ts +13 -1
- package/dist/src/endpoint-tools/upload-service.js +73 -8
- package/dist/src/extensions/lockfile.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 +1 -1
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/global-defaults-admin.js +16 -0
- package/dist/src/gateway/hono/lib/config-payload.d.ts +15 -0
- package/dist/src/gateway/hono/lib/config-payload.js +2 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +13 -2
- package/dist/src/gateway/hono/routes/endpoint-tools.js +3 -2
- package/dist/src/gateway/hono/routes/models.js +6 -3
- package/dist/src/gateway/hono/routes/voice.js +55 -1
- package/dist/src/gateway/hono/routes/workflows.js +2 -2
- package/dist/src/gateway/security/gateway-scopes.d.ts +1 -1
- package/dist/src/gateway/security/gateway-scopes.js +3 -0
- package/dist/src/gateway/service/config-coordinator.js +4 -1
- package/dist/src/gateway/service.js +12 -12
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-catalog-persistence.js +11 -2
- package/dist/src/providers/model-catalog-store.js +1 -0
- package/dist/src/providers/model-catalog-types.d.ts +7 -2
- package/dist/src/providers/model-reference-auditor.js +6 -3
- package/dist/src/providers/model-registry.js +4 -1
- package/dist/src/providers/model-supplements.js +18 -2
- package/dist/src/providers/presentation.js +4 -2
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/providers/xopc-cloud-model-source.js +10 -4
- package/dist/src/storage/sqlite/index.d.ts +1 -1
- package/dist/src/storage/sqlite/index.js +2 -2
- package/dist/src/storage/sqlite/migrations/conversation-backup.d.ts +8 -0
- package/dist/src/storage/sqlite/migrations/conversation-backup.js +17 -7
- package/dist/src/storage/sqlite/migrations/conversation-windows-owners.js +5 -2
- package/dist/src/storage/sqlite/migrations/discover.js +2 -2
- package/dist/src/storage/sqlite/migrations/errors.d.ts +5 -0
- package/dist/src/storage/sqlite/migrations/errors.js +12 -2
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -2
- package/dist/src/storage/sqlite/schema.js +2 -2
- package/dist/src/storage/sqlite/schema.sql +2641 -526
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +2 -2
- package/dist/src/voice/platform-catalog.d.ts +81 -0
- package/dist/src/voice/platform-catalog.js +16 -0
- package/dist/src/voice/platform-settings.d.ts +4 -0
- package/dist/src/voice/platform-settings.js +120 -0
- package/dist/src/voice/platform-streams.d.ts +12 -0
- package/dist/src/voice/platform-streams.js +250 -0
- package/dist/src/voice/realtime/omniEngine.js +8 -5
- package/dist/src/voice/realtime/omniRoute.d.ts +1 -0
- package/dist/src/voice/realtime/omniRoute.js +11 -1
- package/dist/src/voice/realtime/runtime.js +14 -6
- package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +15 -8
- package/dist/src/voice/tts/providers/xopc-cloud-speech.js +12 -19
- package/dist/src/work-discovery/service.js +2 -2
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +7 -4
- package/skills/creative/algorithmic-art/SKILL.md +7 -0
- package/skills/creative/frontend-design/SKILL.md +8 -0
- package/skills/creative/hatch-pet/SKILL.md +7 -0
- package/skills/creative/theme-factory/SKILL.md +8 -0
- package/skills/documents/doc-coauthoring/SKILL.md +7 -0
- package/skills/documents/docx/SKILL.md +7 -0
- package/skills/documents/pdf/SKILL.md +7 -0
- package/skills/documents/pptx/SKILL.md +7 -0
- package/skills/documents/xlsx/SKILL.md +9 -1
- package/skills/engineering/build-xopc-local-app/SKILL.md +7 -0
- package/skills/engineering/define-task/SKILL.md +7 -0
- package/skills/engineering/diagnose/SKILL.md +8 -0
- package/skills/engineering/tdd/SKILL.md +8 -0
- package/skills/tools/find-skills/SKILL.md +8 -0
- package/skills/tools/github/SKILL.md +7 -0
- package/skills/tools/summarize/SKILL.md +8 -0
- package/skills/tools/webapp-testing/SKILL.md +8 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BxR5eog4.js +0 -1
- package/dist/gateway/static/root/assets/agents-Dx1om1eN.js +0 -1
- package/dist/gateway/static/root/assets/api-q1kIMCLW.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-DUZE1NOH.js +0 -6
- package/dist/gateway/static/root/assets/capabilities-settings-panel-ohEV64hG.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-UOf9mgqt.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-BEQR0NRq.js +0 -2
- package/dist/gateway/static/root/assets/gateway-settings-CDJY1AOW.js +0 -1
- package/dist/gateway/static/root/assets/home-page-_oqo0pNR.js +0 -1
- package/dist/gateway/static/root/assets/index--YC42LAz.css +0 -2
- package/dist/gateway/static/root/assets/index-fVtuw2o9.js +0 -75
- package/dist/gateway/static/root/assets/local-app-workbench-page-Z8mpau9d.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-BGOO8ouT.js +0 -2
- package/dist/gateway/static/root/assets/messages-BWANv-N-.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-Bm33_3xJ.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-C32-xssK.js +0 -8
- package/dist/gateway/static/root/assets/project-detail-page-CZ7glGYw.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-DP3ZINZz.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-xqJcPdOO.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BaxIfjpm.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-Cy3Ab3Vg.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BuYto2mT.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DKtWUneq.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Dn7ElMUk.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-D-7UtJIc.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-efmH43Pq.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-DByIJcQq.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-BJv3eoKR.js +0 -6
- package/dist/src/storage/sqlite/migrations/002_add_flush_columns.sql +0 -3
- package/dist/src/storage/sqlite/migrations/003_add_note_markdown_meta.sql +0 -4
- package/dist/src/storage/sqlite/migrations/004_add_session_type_metadata.sql +0 -15
- package/dist/src/storage/sqlite/migrations/005_add_note_agent_contexts.sql +0 -10
- package/dist/src/storage/sqlite/migrations/006_add_goals.sql +0 -108
- package/dist/src/storage/sqlite/migrations/007_goal_run_judge_schema.sql +0 -4
- package/dist/src/storage/sqlite/migrations/008_goal_queue_workflow_runs.sql +0 -53
- package/dist/src/storage/sqlite/migrations/009_cron_jobs.sql +0 -24
- package/dist/src/storage/sqlite/migrations/010_session_id_identity.sql +0 -30
- package/dist/src/storage/sqlite/migrations/011_goal_context_messages.sql +0 -8
- package/dist/src/storage/sqlite/migrations/012_memory_records.sql +0 -63
- package/dist/src/storage/sqlite/migrations/013_memory_trace_events.sql +0 -21
- package/dist/src/storage/sqlite/migrations/014_memory_record_governance.sql +0 -10
- package/dist/src/storage/sqlite/migrations/015_memory_trace_feedback.sql +0 -4
- package/dist/src/storage/sqlite/migrations/016_automations.sql +0 -47
- package/dist/src/storage/sqlite/migrations/017_automation_run_events.sql +0 -14
- package/dist/src/storage/sqlite/migrations/018_automation_safety.sql +0 -1
- package/dist/src/storage/sqlite/migrations/019_projects.sql +0 -40
- package/dist/src/storage/sqlite/migrations/020_project_default_agent.sql +0 -1
- package/dist/src/storage/sqlite/migrations/021_projects_fts.sql +0 -21
- package/dist/src/storage/sqlite/migrations/022_work_items.sql +0 -61
- package/dist/src/storage/sqlite/migrations/023_work_item_attachments.sql +0 -15
- package/dist/src/storage/sqlite/migrations/024_activity_events.sql +0 -62
- package/dist/src/storage/sqlite/migrations/025_project_pinned_at.sql +0 -5
- package/dist/src/storage/sqlite/migrations/026_goal_contracts.sql +0 -10
- package/dist/src/storage/sqlite/migrations/027_mobile_notifications.sql +0 -43
- package/dist/src/storage/sqlite/migrations/028_goal_evidence_requirements.sql +0 -47
- package/dist/src/storage/sqlite/migrations/029_user_understanding.sql +0 -133
- package/dist/src/storage/sqlite/migrations/030_connectors.sql +0 -94
- package/dist/src/storage/sqlite/migrations/031_connector_approvals.sql +0 -24
- package/dist/src/storage/sqlite/migrations/032_connector_webhook_deliveries.sql +0 -15
- package/dist/src/storage/sqlite/migrations/033_user_trust_policies.sql +0 -6
- package/dist/src/storage/sqlite/migrations/034_allow_global_auto_trust.sql +0 -14
- package/dist/src/storage/sqlite/migrations/035_user_profile_prompt_state.sql +0 -7
- package/dist/src/storage/sqlite/migrations/036_goal_outcome_metric.sql +0 -12
- package/dist/src/storage/sqlite/migrations/037_connected_knowledge_pipeline.sql +0 -47
- package/dist/src/storage/sqlite/migrations/038_user_owned_memory.sql +0 -68
- package/dist/src/storage/sqlite/migrations/039_memory_reference_consents.sql +0 -19
- package/dist/src/storage/sqlite/migrations/040_local_apps.sql +0 -32
- package/dist/src/storage/sqlite/migrations/041_local_app_release_lifecycle.sql +0 -17
- package/dist/src/storage/sqlite/migrations/042_work_discovery.sql +0 -41
- package/dist/src/storage/sqlite/migrations/043_local_app_acceptance_runs.sql +0 -16
- package/dist/src/storage/sqlite/migrations/044_repair_work_discovery_foreign_keys.sql +0 -75
- package/dist/src/storage/sqlite/migrations/045_extension_ui_grants.sql +0 -13
- package/dist/src/storage/sqlite/migrations/046_work_discovery_feedback.sql +0 -13
- package/dist/src/storage/sqlite/migrations/047_work_discovery_sources.sql +0 -16
- package/dist/src/storage/sqlite/migrations/048_work_understanding_investigations.sql +0 -40
- package/dist/src/storage/sqlite/migrations/049_work_understanding_threads.sql +0 -52
- package/dist/src/storage/sqlite/migrations/050_work_discovery_source_refreshes.sql +0 -15
- package/dist/src/storage/sqlite/migrations/051_focus_watches.sql +0 -26
- package/dist/src/storage/sqlite/migrations/052_proactive_insights.sql +0 -25
- package/dist/src/storage/sqlite/migrations/053_browser_recipes.sql +0 -45
- package/dist/src/storage/sqlite/migrations/054_task_outcomes.sql +0 -24
- package/dist/src/storage/sqlite/migrations/055_relationship_settings.sql +0 -14
- package/dist/src/storage/sqlite/migrations/056_task_verification.sql +0 -6
- package/dist/src/storage/sqlite/migrations/057_interaction_states.sql +0 -11
- package/dist/src/storage/sqlite/migrations/058_proactive_value.sql +0 -3
- package/dist/src/storage/sqlite/migrations/059_composer_input_history.sql +0 -8
- package/dist/src/storage/sqlite/migrations/060_remove_runtime_transcript_messages.sql +0 -45
- package/dist/src/storage/sqlite/migrations/061_drop_compaction_checkpoints.sql +0 -2
- package/dist/src/storage/sqlite/migrations/062_connector_learning_jobs.sql +0 -27
- package/dist/src/storage/sqlite/migrations/063_knowledge_collection_scopes.sql +0 -14
- package/dist/src/storage/sqlite/migrations/064_user_claims.sql +0 -60
- package/dist/src/storage/sqlite/migrations/065_knowledge_item_scope_identity.sql +0 -116
- package/dist/src/storage/sqlite/migrations/066_first_class_focuses.sql +0 -126
- package/dist/src/storage/sqlite/migrations/067_home_attention_acknowledgements.sql +0 -9
- package/dist/src/storage/sqlite/migrations/068_proactive_event_spine.sql +0 -71
- package/dist/src/storage/sqlite/migrations/069_proactive_scenario_control.sql +0 -69
- package/dist/src/storage/sqlite/migrations/070_proactive_execution.sql +0 -55
- package/dist/src/storage/sqlite/migrations/071_proactive_inbox.sql +0 -45
- package/dist/src/storage/sqlite/migrations/072_proactive_judgments.sql +0 -14
- package/dist/src/storage/sqlite/migrations/073_enable_default_proactive_scenarios.sql +0 -13
- package/dist/src/storage/sqlite/migrations/074_deduplicate_blocked_work_routing.sql +0 -5
- package/dist/src/storage/sqlite/migrations/075_connector_sync_policies.sql +0 -13
- package/dist/src/storage/sqlite/migrations/076_meeting_preparation_scenario.sql +0 -29
- package/dist/src/storage/sqlite/migrations/077_proactive_insight_fingerprints.sql +0 -4
- package/dist/src/storage/sqlite/migrations/078_discussion_captures.sql +0 -64
- package/dist/src/storage/sqlite/migrations/079_discussion_follow_up_scenario.sql +0 -29
- package/dist/src/storage/sqlite/migrations/080_task_outcome_context.sql +0 -15
- package/dist/src/storage/sqlite/migrations/081_project_monitoring_policies.sql +0 -10
- package/dist/src/storage/sqlite/migrations/082_one_click_live_discussions.sql +0 -100
- package/dist/src/storage/sqlite/migrations/083_session_task_plans.sql +0 -9
- package/dist/src/storage/sqlite/migrations/084_work_intake_lifecycle.sql +0 -26
- package/dist/src/storage/sqlite/migrations/085_task_outcome_projection.sql +0 -19
- package/dist/src/storage/sqlite/migrations/086_outcome_aggregates.sql +0 -168
- package/dist/src/storage/sqlite/migrations/087_context_snapshots.sql +0 -21
- package/dist/src/storage/sqlite/migrations/088_automation_execution_deadlines.sql +0 -5
- package/dist/src/storage/sqlite/migrations/089_automation_run_leases.sql +0 -8
- package/dist/src/storage/sqlite/migrations/090_outcome_contract_judgment.sql +0 -2
- package/dist/src/storage/sqlite/migrations/091_context_allocation.sql +0 -1
- package/dist/src/storage/sqlite/migrations/092_outcome_execution_runtime.sql +0 -88
- package/dist/src/storage/sqlite/migrations/093_remove_legacy_goals.sql +0 -174
- package/dist/src/storage/sqlite/migrations/094_outcome_judgment_and_authority.sql +0 -3
- package/dist/src/storage/sqlite/migrations/095_session_input_queue.sql +0 -35
- package/dist/src/storage/sqlite/migrations/096_drop_work_intakes.sql +0 -6
- package/dist/src/storage/sqlite/migrations/097_work_item_lifecycle.sql +0 -194
- package/dist/src/storage/sqlite/migrations/098_discussion_note_documents.sql +0 -99
- package/dist/src/storage/sqlite/migrations/099_task_model.sql +0 -500
- package/dist/src/storage/sqlite/migrations/100_project_task_taskrun.sql +0 -763
- package/dist/src/storage/sqlite/migrations/101_session_response_language.sql +0 -1
- package/dist/src/storage/sqlite/migrations/102_session_user_context_mode.sql +0 -2
- package/dist/src/storage/sqlite/migrations/103_finalize_structured_memory.sql +0 -3
- package/dist/src/storage/sqlite/migrations/104_turn_memory_feedback.sql +0 -77
- package/dist/src/storage/sqlite/migrations/105_dreaming_ledger.sql +0 -34
- package/dist/src/storage/sqlite/migrations/106_dreaming_run_reproducibility.sql +0 -2
- package/dist/src/storage/sqlite/migrations/107_connector_accounts.sql +0 -146
- package/dist/src/storage/sqlite/migrations/108_repair_user_memory_provider.sql +0 -18
- package/dist/src/storage/sqlite/migrations/109_endpoint_principals.sql +0 -14
- package/dist/src/storage/sqlite/migrations/110_session_input_origin.sql +0 -43
- package/dist/src/storage/sqlite/migrations/111_endpoint_tool_invocations.sql +0 -18
- package/dist/src/storage/sqlite/migrations/112_endpoint_instance_bindings.sql +0 -8
- package/dist/src/storage/sqlite/migrations/113_memory_evidence_single_source.sql +0 -76
- package/dist/src/storage/sqlite/migrations/114_user_context_domain.sql +0 -193
- package/dist/src/storage/sqlite/migrations/115_remove_legacy_user_context.sql +0 -6
- package/dist/src/storage/sqlite/migrations/116_structured_context_consolidation.sql +0 -38
- package/dist/src/storage/sqlite/migrations/117_unified_understanding_sources.sql +0 -110
- package/dist/src/storage/sqlite/migrations/118_task_board_rank.sql +0 -6
- package/dist/src/storage/sqlite/migrations/119_proactive_disposition.sql +0 -13
- package/dist/src/storage/sqlite/migrations/120_task_conversation.sql +0 -112
- package/dist/src/storage/sqlite/migrations/121_automation_inbox.sql +0 -24
- package/dist/src/storage/sqlite/migrations/122_automation_session_projects.sql +0 -18
- package/dist/src/storage/sqlite/migrations/123_remove_v2_compaction_boundaries.sql +0 -25
- package/dist/src/storage/sqlite/migrations/124_workflow_context_snapshots.sql +0 -15
- package/dist/src/storage/sqlite/migrations/125_project_workflow_presets.sql +0 -12
- package/dist/src/storage/sqlite/migrations/126_focus_context_governance.sql +0 -72
- package/dist/src/storage/sqlite/migrations/127_context_object_origin.sql +0 -36
- package/dist/src/storage/sqlite/migrations/128_context_extraction.sql +0 -73
- package/dist/src/storage/sqlite/migrations/129_focus_versions.sql +0 -51
- package/dist/src/storage/sqlite/migrations/130_context_evidence_provenance.sql +0 -18
- package/dist/src/storage/sqlite/migrations/131_session_input_contexts.sql +0 -2
- package/dist/src/storage/sqlite/migrations/132_transcript_source_context_metadata.sql +0 -34
- package/dist/src/storage/sqlite/migrations/133_archive_legacy_work_discovery_profile_facts.sql +0 -11
- package/dist/src/storage/sqlite/migrations/134_memory_provenance.sql +0 -18
- package/dist/src/storage/sqlite/migrations/135_user_people.sql +0 -59
- package/dist/src/storage/sqlite/migrations/136_product_notifications.sql +0 -79
- package/dist/src/storage/sqlite/migrations/137_understanding_status_audit.sql +0 -71
- package/dist/src/storage/sqlite/migrations/138_device_access.sql +0 -96
- package/dist/src/storage/sqlite/migrations/139_turn_outcome_artifact_backfill.sql +0 -231
- package/dist/src/storage/sqlite/migrations/140_endpoint_session_bindings.sql +0 -8
- package/dist/src/storage/sqlite/migrations/141_device_pairing_approval.sql +0 -17
- package/dist/src/storage/sqlite/migrations/142_session_input_instance.sql +0 -1
- package/dist/src/storage/sqlite/migrations/143_fixed_session_model.sql +0 -1
- package/dist/src/storage/sqlite/migrations/144_execution_environments.sql +0 -59
- package/dist/src/storage/sqlite/migrations/145_project_execution_mode.sql +0 -5
- package/dist/src/storage/sqlite/migrations/146_understanding_focus_exclusions.sql +0 -9
- package/dist/src/storage/sqlite/migrations/147_durable_application_state.sql +0 -39
- package/dist/src/storage/sqlite/migrations/148_user_model_foundation.sql +0 -554
- package/dist/src/storage/sqlite/migrations/149_separate_source_index_from_memory.sql +0 -18
- package/dist/src/storage/sqlite/migrations/150_session_connection_waits.sql +0 -47
- package/dist/src/storage/sqlite/migrations/151_proactive_scope_cleanup.sql +0 -6
- package/dist/src/storage/sqlite/migrations/152_proactive_scenario_contract.sql +0 -140
- package/dist/src/storage/sqlite/migrations/153_browser_control_v2.sql +0 -45
- package/dist/src/storage/sqlite/migrations/154_session_clarification_waits.sql +0 -60
- package/dist/src/storage/sqlite/migrations/155_browser_extension.sql +0 -120
- package/dist/src/storage/sqlite/migrations/156_browser_tab_bindings.sql +0 -14
- package/dist/src/storage/sqlite/migrations/157_browser_endpoint_principals.sql +0 -50
- package/dist/src/storage/sqlite/migrations/158_browser_native_enrollment.sql +0 -4
- package/dist/src/storage/sqlite/migrations/159_proactive_controls.sql +0 -68
- package/dist/src/storage/sqlite/migrations/160_proactive_web_push.sql +0 -27
- package/dist/src/storage/sqlite/migrations/161_proactive_delivery_and_lifecycle.sql +0 -51
- package/dist/src/storage/sqlite/migrations/162_proactive_product.sql +0 -7
- package/dist/src/storage/sqlite/migrations/163_proactive_follow_ups.sql +0 -29
- package/dist/src/storage/sqlite/migrations/164_browser_sessions.sql +0 -8
- package/dist/src/storage/sqlite/migrations/165_device_pairing_target.sql +0 -40
- package/dist/src/storage/sqlite/migrations/__tests__/mobile-discussion-source.test.ts +0 -20
- package/dist/src/storage/sqlite/migrations/conversation-backup.ts +0 -66
- package/dist/src/storage/sqlite/migrations/conversation-key-decoder.ts +0 -50
- package/dist/src/storage/sqlite/migrations/conversation-uuid.ts +0 -324
- package/dist/src/storage/sqlite/migrations/conversation-windows-owners.ts +0 -71
- package/dist/src/storage/sqlite/migrations/discover.ts +0 -52
- package/dist/src/storage/sqlite/migrations/errors.ts +0 -32
- package/dist/src/storage/sqlite/migrations/runner.ts +0 -204
- package/dist/src/storage/sqlite/migrations/types.ts +0 -15
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init_paths, resolveCredentialsDir } from "../../config/paths.js";
|
|
2
1
|
import { init_write_file_atomic, writeTextAtomicSync } from "../../infra/write-file-atomic.js";
|
|
2
|
+
import { init_paths, resolveCredentialsDir } from "../../config/paths.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { chmodSync, existsSync, mkdirSync, readFileSync } from "node:fs";
|
|
5
5
|
//#region src/auth/profiles/store.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
3
2
|
import { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveOAuthPath } from "../config/paths.js";
|
|
4
|
-
import { init_loader, loadConfig } from "../config/loader.js";
|
|
5
3
|
import { init_registry, isOAuthOnlyProvider } from "./oauth/registry.js";
|
|
4
|
+
import { init_loader, loadConfig } from "../config/loader.js";
|
|
5
|
+
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
6
6
|
import { existsSync, readFileSync } from "node:fs";
|
|
7
7
|
//#region src/auth/sync-provider-auth.ts
|
|
8
8
|
/**
|
|
@@ -2,8 +2,8 @@ import { PACKAGE_VERSION, init_package_version } from "../../package-version.js"
|
|
|
2
2
|
import { resolveStateDir } from "../../config/paths-state.js";
|
|
3
3
|
import { createLogger } from "../../utils/logger/index.js";
|
|
4
4
|
import { init_logger } from "../../utils/logger.js";
|
|
5
|
-
import { init_paths, resolveBinDir, resolveConfigPath } from "../../config/paths.js";
|
|
6
5
|
import { init_write_file_atomic, writeTextAtomic } from "../../infra/write-file-atomic.js";
|
|
6
|
+
import { init_paths, resolveBinDir, resolveConfigPath } from "../../config/paths.js";
|
|
7
7
|
import { assertCacheDir } from "../cache-dir-policy.js";
|
|
8
8
|
import { BROWSER_EXTENSION_ID, BROWSER_NATIVE_HOST_NAME } from "../extension-identity.js";
|
|
9
9
|
import "../native-messaging-host.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, init_schema, parseModelRef } from "../../config/schema.js";
|
|
2
|
+
import { init_model_policy, isComputerModel } from "../../computer/model-policy.js";
|
|
2
3
|
import { getModelCatalogStore, init_model_catalog_store } from "../../providers/model-catalog-store.js";
|
|
3
|
-
import { init_providers, isProviderConfiguredSync } from "../../providers/index.js";
|
|
4
|
+
import { init_providers, isProviderConfiguredSync, resolveModel } from "../../providers/index.js";
|
|
4
5
|
import { compareCatalogModels } from "../../providers/model-catalog-ranking.js";
|
|
5
6
|
import { DEFAULT_LOCAL_VOICE_MODEL_ID, hasInstalledLocalVoiceModel } from "../../voice/local/models.js";
|
|
6
7
|
import { planCapabilities } from "./planner.js";
|
|
@@ -8,6 +9,7 @@ import { planCapabilities } from "./planner.js";
|
|
|
8
9
|
init_schema();
|
|
9
10
|
init_model_catalog_store();
|
|
10
11
|
init_providers();
|
|
12
|
+
init_model_policy();
|
|
11
13
|
function buildCapabilityPlansForConfig(config, options = {}) {
|
|
12
14
|
const catalog = options.catalog ?? getModelCatalogStore().load();
|
|
13
15
|
const cloud = catalog.sources["xopc-cloud"];
|
|
@@ -18,6 +20,7 @@ function buildCapabilityPlansForConfig(config, options = {}) {
|
|
|
18
20
|
const tts = config.messages?.tts;
|
|
19
21
|
const policies = {
|
|
20
22
|
vision: { explicit: refs(getAgentDefaultImageModelConfig(config)) },
|
|
23
|
+
"computer-use": { explicit: refs(config.agents.defaults.models.computerUse) },
|
|
21
24
|
"image-generation": { explicit: refs(getAgentDefaultImageGenerationModelConfig(config, agentId)) },
|
|
22
25
|
stt: {
|
|
23
26
|
disabled: stt?.enabled === false,
|
|
@@ -92,6 +95,11 @@ function markExplicitReadiness(policies, catalog, providerReady) {
|
|
|
92
95
|
}
|
|
93
96
|
function explicitReady(capability, provider, model, catalog, providerReady) {
|
|
94
97
|
if (!providerReady(provider)) return false;
|
|
98
|
+
if (capability === "computer-use" && provider !== "xopc-cloud") try {
|
|
99
|
+
return isComputerModel(resolveModel(`${provider}/${model}`));
|
|
100
|
+
} catch {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
95
103
|
if (provider !== "xopc-cloud") return true;
|
|
96
104
|
return (catalog.sources["xopc-cloud"]?.models ?? []).some((entry) => entry.id === model && matchesCapability(entry, capability));
|
|
97
105
|
}
|
|
@@ -106,7 +114,11 @@ function cloudCandidates(capability, models, authorized, basePriority = 0, recom
|
|
|
106
114
|
function matchesCapability(model, capability) {
|
|
107
115
|
if (model.availability !== "available") return false;
|
|
108
116
|
switch (capability) {
|
|
109
|
-
case "vision": return model.kind === "language" && model.input.includes("image");
|
|
117
|
+
case "vision": return model.kind === "language" && model.input.includes("image") && !model.computerUse;
|
|
118
|
+
case "computer-use": return model.operations.includes("chat.completions") && isComputerModel({
|
|
119
|
+
...model,
|
|
120
|
+
api: "openai-completions"
|
|
121
|
+
});
|
|
110
122
|
case "image-generation": return model.kind === "image" && model.operations.includes("images.generate");
|
|
111
123
|
case "stt": return model.kind === "stt" && model.operations.includes("audio.transcription");
|
|
112
124
|
case "tts": return model.kind === "tts" && model.operations.includes("audio.speech") && Boolean(model.tts?.defaultVoice);
|
|
@@ -3,7 +3,8 @@ const CAPABILITIES = [
|
|
|
3
3
|
"vision",
|
|
4
4
|
"image-generation",
|
|
5
5
|
"stt",
|
|
6
|
-
"tts"
|
|
6
|
+
"tts",
|
|
7
|
+
"computer-use"
|
|
7
8
|
];
|
|
8
9
|
function planCapabilities(input) {
|
|
9
10
|
return Object.fromEntries(CAPABILITIES.map((capability) => [capability, planCapability(capability, input)]));
|
|
@@ -28,7 +29,7 @@ function planCapability(capability, input) {
|
|
|
28
29
|
reasons: entry.reasons ?? (entry.ready === false ? ["explicit_model_unavailable"] : [])
|
|
29
30
|
}));
|
|
30
31
|
const automatic = [...input.automatic[capability] ?? []].sort((left, right) => left.priority - right.priority || left.provider.localeCompare(right.provider) || left.model.localeCompare(right.model));
|
|
31
|
-
const candidates = dedupeCandidates([...explicit, ...automatic]);
|
|
32
|
+
const candidates = capability === "computer-use" ? explicit.slice(0, 1) : dedupeCandidates([...explicit, ...automatic]);
|
|
32
33
|
const ready = candidates.filter((candidate) => candidate.ready);
|
|
33
34
|
const rejected = candidates.filter((candidate) => !candidate.ready);
|
|
34
35
|
const primary = ready[0];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type CapabilityId = 'vision' | 'image-generation' | 'stt' | 'tts';
|
|
1
|
+
export type CapabilityId = 'vision' | 'image-generation' | 'stt' | 'tts' | 'computer-use';
|
|
2
2
|
export type CandidateSource = 'native-model' | 'explicit-config' | 'installed-local' | 'xopc-cloud-managed' | 'configured-provider' | 'credentialless-fallback';
|
|
3
3
|
export interface CapabilityCandidate {
|
|
4
4
|
capability: CapabilityId;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { init_agent_scope, normalizeAgentId, resolveAgentProfileDir } from "../agent/agent-scope.js";
|
|
2
|
-
import { init_agent_session_key, resolveAgentIdFromConversationId } from "../routing/agent-session-key.js";
|
|
3
2
|
import { WORKSPACE_FILES, init_paths } from "../config/paths.js";
|
|
3
|
+
import { init_agent_session_key, resolveAgentIdFromConversationId } from "../routing/agent-session-key.js";
|
|
4
4
|
import { commandRegistry } from "./registry.js";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { readFile } from "node:fs/promises";
|
|
@@ -2,8 +2,8 @@ import { createLogger } from "../../utils/logger/index.js";
|
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
|
|
4
4
|
import { init_agent_scope, resolveDefaultAgentId } from "../../agent/agent-scope.js";
|
|
5
|
-
import { init_agent_session_key, resolveAgentMainConversationId } from "../../routing/agent-session-key.js";
|
|
6
5
|
import { loadConfig } from "../../config/loader.js";
|
|
6
|
+
import { init_agent_session_key, resolveAgentMainConversationId } from "../../routing/agent-session-key.js";
|
|
7
7
|
import { ExtensionLoader } from "../../extensions/loader.js";
|
|
8
8
|
import "../../extensions/index.js";
|
|
9
9
|
import { MessageBus, MessageBusShutdownError } from "../../infra/bus/queue.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getAgentDefaultModelRef, init_schema, parseModelRef } from "../../../../config/schema.js";
|
|
2
|
-
import { getDefaultAgentId, init_resolve_route } from "../../../../routing/resolve-route.js";
|
|
3
|
-
import { init_loader, loadConfig } from "../../../../config/loader.js";
|
|
4
|
-
import { getModelOAuthProviderIds, init_registry } from "../../../../auth/oauth/registry.js";
|
|
5
2
|
import { PROVIDER_ENV_MAP, init_env_keys } from "../../../../providers/env-keys.js";
|
|
3
|
+
import { getModelOAuthProviderIds, init_registry } from "../../../../auth/oauth/registry.js";
|
|
6
4
|
import { CredentialResolver, init_credentials } from "../../../../auth/credentials.js";
|
|
5
|
+
import { init_loader, loadConfig } from "../../../../config/loader.js";
|
|
6
|
+
import { getDefaultAgentId, init_resolve_route } from "../../../../routing/resolve-route.js";
|
|
7
7
|
import { existsSync } from "node:fs";
|
|
8
8
|
//#region src/cli/commands/doctor/checks/provider-auth.ts
|
|
9
9
|
init_credentials();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
|
|
2
|
-
import { loadConfig, saveConfig } from "../../config/loader.js";
|
|
3
2
|
import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
|
|
3
|
+
import { loadConfig, saveConfig } from "../../config/loader.js";
|
|
4
4
|
import { getAllModels, getAvailableModels, getConfiguredProviders, getProviderAuthState, getProviderDisplayName, init_providers, isProviderConfigured, providerSupportsApiKey, providerSupportsOAuth, resolveModel } from "../../providers/index.js";
|
|
5
5
|
import { formatExamples, register } from "../registry.js";
|
|
6
6
|
import { getContextWithOpts } from "../context.js";
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { type ComputerAction, type ComputerCommand, type ComputerModelBinding, type ComputerObservation, type ComputerReceipt, type ComputerTarget, type ComputerApp, type ComputerWindow } from '@xopcai/computer-control-contract';
|
|
2
|
+
import { type ComputerConfig } from './config.js';
|
|
3
|
+
export interface DriverObservation {
|
|
4
|
+
target: ComputerTarget;
|
|
5
|
+
summary: string;
|
|
6
|
+
focusedEditableRef?: string;
|
|
7
|
+
stateDigest: string;
|
|
8
|
+
image: Uint8Array;
|
|
9
|
+
mimeType: 'image/png' | 'image/jpeg';
|
|
10
|
+
imageWidth: number;
|
|
11
|
+
imageHeight: number;
|
|
12
|
+
}
|
|
13
|
+
export interface ComputerDriver {
|
|
14
|
+
discover(query: string, signal: AbortSignal): Promise<Array<{
|
|
15
|
+
appId: string;
|
|
16
|
+
name: string;
|
|
17
|
+
running: boolean;
|
|
18
|
+
}>>;
|
|
19
|
+
validateAction?(action: ComputerAction): void;
|
|
20
|
+
resolveTarget(appId: string, signal: AbortSignal, options: {
|
|
21
|
+
prepare: boolean;
|
|
22
|
+
windowRef?: string;
|
|
23
|
+
}): Promise<ComputerTarget>;
|
|
24
|
+
observe(target: ComputerTarget, signal: AbortSignal): Promise<DriverObservation>;
|
|
25
|
+
perform(target: ComputerTarget, action: ComputerAction, signal: AbortSignal): Promise<void>;
|
|
26
|
+
/** Must finish only after no further input can be dispatched. */
|
|
27
|
+
stop(): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
export type ComputerApproval = {
|
|
30
|
+
kind: 'session';
|
|
31
|
+
id: string;
|
|
32
|
+
appId: string;
|
|
33
|
+
appName: string;
|
|
34
|
+
mode: 'observe' | 'control';
|
|
35
|
+
prepare: boolean;
|
|
36
|
+
model: ComputerModelBinding;
|
|
37
|
+
} | {
|
|
38
|
+
kind: 'action';
|
|
39
|
+
id: string;
|
|
40
|
+
target: ComputerTarget;
|
|
41
|
+
action: ComputerAction;
|
|
42
|
+
};
|
|
43
|
+
export interface ComputerBrokerHost {
|
|
44
|
+
requestApproval(request: ComputerApproval, signal: AbortSignal): Promise<boolean>;
|
|
45
|
+
isVisible(): boolean;
|
|
46
|
+
hasFullControl?(): boolean;
|
|
47
|
+
onStateChange?(): void;
|
|
48
|
+
}
|
|
49
|
+
type Status = 'pending_authorization' | 'ready' | 'running' | 'pending_action' | 'paused' | 'stopped';
|
|
50
|
+
export interface BrokerResult {
|
|
51
|
+
status: Status;
|
|
52
|
+
sessionId: string;
|
|
53
|
+
brokerEpoch: string;
|
|
54
|
+
generation: number;
|
|
55
|
+
grantId?: string;
|
|
56
|
+
observation?: ComputerObservation;
|
|
57
|
+
receipt?: ComputerReceipt;
|
|
58
|
+
errorCode?: string;
|
|
59
|
+
apps?: ComputerApp[];
|
|
60
|
+
windows?: ComputerWindow[];
|
|
61
|
+
frame?: {
|
|
62
|
+
bytes: Uint8Array;
|
|
63
|
+
mimeType: 'image/png' | 'image/jpeg';
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/** Main-process-only authority. Never expose this object or its approval hook to a renderer. */
|
|
67
|
+
export declare class ComputerBroker {
|
|
68
|
+
private readonly driver;
|
|
69
|
+
private readonly host;
|
|
70
|
+
private readonly now;
|
|
71
|
+
readonly epoch: `${string}-${string}-${string}-${string}-${string}`;
|
|
72
|
+
private session?;
|
|
73
|
+
private busy;
|
|
74
|
+
private stopping?;
|
|
75
|
+
private discovery?;
|
|
76
|
+
private readonly apps;
|
|
77
|
+
private readonly config;
|
|
78
|
+
private readonly timer;
|
|
79
|
+
constructor(driver: ComputerDriver, host: ComputerBrokerHost, config?: Partial<ComputerConfig>, now?: () => number);
|
|
80
|
+
private expired;
|
|
81
|
+
private result;
|
|
82
|
+
private active;
|
|
83
|
+
command(raw: ComputerCommand): Promise<BrokerResult>;
|
|
84
|
+
private discover;
|
|
85
|
+
private open;
|
|
86
|
+
private observe;
|
|
87
|
+
private act;
|
|
88
|
+
stop(): Promise<void>;
|
|
89
|
+
cancel(command: ComputerCommand): Promise<void>;
|
|
90
|
+
snapshot(): {
|
|
91
|
+
status: Status | 'idle';
|
|
92
|
+
errorCode?: string;
|
|
93
|
+
appId?: string;
|
|
94
|
+
};
|
|
95
|
+
dispose(): Promise<void>;
|
|
96
|
+
}
|
|
97
|
+
export {};
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { ComputerConfigSchema, init_config } from "./config.js";
|
|
2
|
+
import { ActionEnvelopeSchema, ComputerCommandSchema, init_src } from "../../packages/computer-control-contract/src/index.js";
|
|
3
|
+
import { ComputerTargetError } from "./errors.js";
|
|
4
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
5
|
+
//#region src/computer/broker.ts
|
|
6
|
+
init_src();
|
|
7
|
+
init_config();
|
|
8
|
+
/** Main-process-only authority. Never expose this object or its approval hook to a renderer. */
|
|
9
|
+
var ComputerBroker = class {
|
|
10
|
+
epoch = randomUUID();
|
|
11
|
+
session;
|
|
12
|
+
busy = false;
|
|
13
|
+
stopping;
|
|
14
|
+
discovery;
|
|
15
|
+
apps = /* @__PURE__ */ new Map();
|
|
16
|
+
config;
|
|
17
|
+
timer;
|
|
18
|
+
constructor(driver, host, config = {}, now = Date.now) {
|
|
19
|
+
this.driver = driver;
|
|
20
|
+
this.host = host;
|
|
21
|
+
this.now = now;
|
|
22
|
+
this.config = ComputerConfigSchema.parse(config);
|
|
23
|
+
this.timer = setInterval(() => {
|
|
24
|
+
const s = this.session;
|
|
25
|
+
if (s && s.status !== "stopped" && (this.expired(s) || !this.host.isVisible())) this.stop().catch(() => {});
|
|
26
|
+
}, 1e3);
|
|
27
|
+
this.timer.unref?.();
|
|
28
|
+
}
|
|
29
|
+
expired(s) {
|
|
30
|
+
return this.now() - s.createdAt >= this.config.maxSessionDurationMs || this.now() - s.touchedAt >= this.config.idleGrantTtlMs;
|
|
31
|
+
}
|
|
32
|
+
result(s) {
|
|
33
|
+
return {
|
|
34
|
+
sessionId: s.id,
|
|
35
|
+
brokerEpoch: this.epoch,
|
|
36
|
+
generation: s.generation,
|
|
37
|
+
status: s.status,
|
|
38
|
+
...s.errorCode ? { errorCode: s.errorCode } : {},
|
|
39
|
+
...s.windows ? { windows: s.windows } : {},
|
|
40
|
+
...s.status === "ready" ? { grantId: s.grantId } : {}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
active(s) {
|
|
44
|
+
if (this.session !== s || s.controller.signal.aborted || this.expired(s) || !this.host.isVisible()) throw new Error("COMPUTER_GRANT_REVOKED");
|
|
45
|
+
}
|
|
46
|
+
async command(raw) {
|
|
47
|
+
const command = ComputerCommandSchema.parse(raw);
|
|
48
|
+
if (command.op === "discover") return this.discover(command);
|
|
49
|
+
if (command.op === "open") return this.open(command);
|
|
50
|
+
const s = this.session;
|
|
51
|
+
if (!s || s.id !== command.sessionId || s.owner !== command.owner) throw new Error("COMPUTER_SESSION_NOT_FOUND");
|
|
52
|
+
if (command.op === "release") {
|
|
53
|
+
await this.stop();
|
|
54
|
+
return this.result(s);
|
|
55
|
+
}
|
|
56
|
+
if (command.op === "status") return this.result(s);
|
|
57
|
+
this.active(s);
|
|
58
|
+
if (this.busy || s.status !== "ready" && s.status !== "pending_action") throw new Error("COMPUTER_NOT_READY");
|
|
59
|
+
this.busy = true;
|
|
60
|
+
try {
|
|
61
|
+
if (command.op === "observe") {
|
|
62
|
+
if (s.pending) throw new Error("COMPUTER_ACTION_PENDING");
|
|
63
|
+
return await this.observe(s);
|
|
64
|
+
}
|
|
65
|
+
return await this.act(s, command.envelope);
|
|
66
|
+
} finally {
|
|
67
|
+
this.busy = false;
|
|
68
|
+
this.host.onStateChange?.();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async discover(command) {
|
|
72
|
+
if (!this.config.enabled) throw new Error("COMPUTER_DISABLED");
|
|
73
|
+
if (!this.host.isVisible()) throw new Error("COMPUTER_LOCAL_UI_REQUIRED");
|
|
74
|
+
if (this.busy || this.discovery || this.stopping || this.session && this.session.status !== "stopped" && (this.session.owner !== command.owner || this.session.status !== "ready")) throw new Error("COMPUTER_BUSY");
|
|
75
|
+
const controller = new AbortController();
|
|
76
|
+
this.discovery = {
|
|
77
|
+
controller,
|
|
78
|
+
owner: command.owner,
|
|
79
|
+
id: command.sessionId
|
|
80
|
+
};
|
|
81
|
+
this.busy = true;
|
|
82
|
+
try {
|
|
83
|
+
const found = await this.driver.discover(command.query, controller.signal);
|
|
84
|
+
controller.signal.throwIfAborted();
|
|
85
|
+
if (!this.host.isVisible()) throw new Error("COMPUTER_LOCAL_UI_REQUIRED");
|
|
86
|
+
for (const [ref, app] of this.apps) if (app.owner === command.owner || app.expires <= this.now()) this.apps.delete(ref);
|
|
87
|
+
const apps = found.slice(0, 100).map((app) => {
|
|
88
|
+
const appRef = randomUUID();
|
|
89
|
+
this.apps.set(appRef, {
|
|
90
|
+
owner: command.owner,
|
|
91
|
+
appId: app.appId,
|
|
92
|
+
name: app.name,
|
|
93
|
+
expires: this.now() + 3e5
|
|
94
|
+
});
|
|
95
|
+
return {
|
|
96
|
+
appRef,
|
|
97
|
+
name: app.name,
|
|
98
|
+
running: app.running
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
while (this.apps.size > 500) this.apps.delete(this.apps.keys().next().value);
|
|
102
|
+
return {
|
|
103
|
+
status: "ready",
|
|
104
|
+
sessionId: command.sessionId,
|
|
105
|
+
brokerEpoch: this.epoch,
|
|
106
|
+
generation: 0,
|
|
107
|
+
apps
|
|
108
|
+
};
|
|
109
|
+
} finally {
|
|
110
|
+
try {
|
|
111
|
+
if (!this.session || this.session.status === "stopped") await this.driver.stop();
|
|
112
|
+
} finally {
|
|
113
|
+
this.discovery = void 0;
|
|
114
|
+
this.busy = false;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
async open(command) {
|
|
119
|
+
if (!this.config.enabled) throw new Error("COMPUTER_DISABLED");
|
|
120
|
+
if (!this.host.isVisible()) throw new Error("COMPUTER_LOCAL_UI_REQUIRED");
|
|
121
|
+
if (this.stopping) throw new Error("COMPUTER_STOPPING");
|
|
122
|
+
if (this.discovery || this.busy) throw new Error("COMPUTER_BUSY");
|
|
123
|
+
if (this.session && this.session.status !== "stopped") {
|
|
124
|
+
const s = this.session;
|
|
125
|
+
if (s.id !== command.sessionId || s.owner !== command.owner || s.appRef !== command.appRef || s.mode !== command.mode || s.prepare !== command.prepare || s.windowRef !== command.windowRef || JSON.stringify(s.model) !== JSON.stringify(command.model)) throw new Error("COMPUTER_DEVICE_BUSY");
|
|
126
|
+
return this.result(s);
|
|
127
|
+
}
|
|
128
|
+
const app = this.apps.get(command.appRef);
|
|
129
|
+
if (!app || app.owner !== command.owner || app.expires <= this.now()) throw new Error("COMPUTER_APP_REF_EXPIRED");
|
|
130
|
+
const s = {
|
|
131
|
+
id: command.sessionId,
|
|
132
|
+
owner: command.owner,
|
|
133
|
+
appId: app.appId,
|
|
134
|
+
model: command.model,
|
|
135
|
+
appRef: command.appRef,
|
|
136
|
+
mode: command.mode,
|
|
137
|
+
prepare: command.prepare,
|
|
138
|
+
windowRef: command.windowRef,
|
|
139
|
+
grantId: randomUUID(),
|
|
140
|
+
generation: 0,
|
|
141
|
+
status: "pending_authorization",
|
|
142
|
+
createdAt: this.now(),
|
|
143
|
+
touchedAt: this.now(),
|
|
144
|
+
controller: new AbortController(),
|
|
145
|
+
receipts: /* @__PURE__ */ new Map(),
|
|
146
|
+
actions: 0
|
|
147
|
+
};
|
|
148
|
+
this.session = s;
|
|
149
|
+
const fullControl = this.host.hasFullControl?.() === true;
|
|
150
|
+
const authorization = (fullControl ? Promise.resolve(true) : this.host.requestApproval({
|
|
151
|
+
kind: "session",
|
|
152
|
+
id: s.id,
|
|
153
|
+
appId: s.appId,
|
|
154
|
+
appName: app.name,
|
|
155
|
+
mode: s.mode,
|
|
156
|
+
prepare: s.prepare,
|
|
157
|
+
model: s.model
|
|
158
|
+
}, s.controller.signal)).then(async (approved) => {
|
|
159
|
+
this.active(s);
|
|
160
|
+
if (!approved) {
|
|
161
|
+
await this.stop();
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
s.target = await this.driver.resolveTarget(s.appId, s.controller.signal, {
|
|
165
|
+
prepare: s.prepare,
|
|
166
|
+
windowRef: s.windowRef
|
|
167
|
+
});
|
|
168
|
+
this.active(s);
|
|
169
|
+
if (s.target.appId !== s.appId) throw new Error("COMPUTER_TARGET_MISMATCH");
|
|
170
|
+
s.status = "ready";
|
|
171
|
+
s.touchedAt = this.now();
|
|
172
|
+
}).catch((error) => {
|
|
173
|
+
if (this.session !== s) return;
|
|
174
|
+
s.errorCode = error instanceof Error && /^COMPUTER_[A-Z_]+$/.test(error.message) ? error.message : "COMPUTER_NATIVE_SETUP_FAILED";
|
|
175
|
+
if (error instanceof ComputerTargetError) s.windows = error.windows;
|
|
176
|
+
return this.stop().catch(() => {});
|
|
177
|
+
}).finally(() => this.host.onStateChange?.());
|
|
178
|
+
if (fullControl) await authorization;
|
|
179
|
+
return this.result(s);
|
|
180
|
+
}
|
|
181
|
+
async observe(s) {
|
|
182
|
+
const frame = await this.driver.observe(s.target, s.controller.signal);
|
|
183
|
+
try {
|
|
184
|
+
this.active(s);
|
|
185
|
+
if (frame.target.appId !== s.appId || frame.target.processIdentity !== s.target.processIdentity || frame.target.windowId !== s.target.windowId) throw new Error("COMPUTER_TARGET_CHANGED");
|
|
186
|
+
if (frame.image.byteLength > 5 * 1024 * 1024 || frame.imageWidth * frame.imageHeight > 16e6) throw new Error("COMPUTER_FRAME_LIMIT");
|
|
187
|
+
s.target = frame.target;
|
|
188
|
+
s.observation = {
|
|
189
|
+
id: randomUUID(),
|
|
190
|
+
sessionId: s.id,
|
|
191
|
+
brokerEpoch: this.epoch,
|
|
192
|
+
generation: s.generation,
|
|
193
|
+
target: frame.target,
|
|
194
|
+
capturedAt: this.now(),
|
|
195
|
+
imageWidth: frame.imageWidth,
|
|
196
|
+
imageHeight: frame.imageHeight,
|
|
197
|
+
summary: frame.summary.slice(0, 12e3),
|
|
198
|
+
focusedEditableRef: frame.focusedEditableRef,
|
|
199
|
+
stateDigest: frame.stateDigest
|
|
200
|
+
};
|
|
201
|
+
s.touchedAt = this.now();
|
|
202
|
+
return {
|
|
203
|
+
...this.result(s),
|
|
204
|
+
observation: s.observation,
|
|
205
|
+
frame: {
|
|
206
|
+
bytes: frame.image,
|
|
207
|
+
mimeType: frame.mimeType
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
} catch (error) {
|
|
211
|
+
frame.image.fill(0);
|
|
212
|
+
throw error;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
async act(s, raw) {
|
|
216
|
+
if (s.mode === "observe") throw new Error("COMPUTER_READ_ONLY");
|
|
217
|
+
const e = ActionEnvelopeSchema.parse(raw);
|
|
218
|
+
if (e.sessionId !== s.id || e.brokerEpoch !== this.epoch || e.generation !== s.generation || e.grantId !== s.grantId || e.deadlineAt <= this.now()) throw new Error("COMPUTER_STALE_ACTION");
|
|
219
|
+
const digest = createHash("sha256").update(JSON.stringify(e)).digest("hex");
|
|
220
|
+
const previous = s.receipts.get(e.actionId);
|
|
221
|
+
if (previous) {
|
|
222
|
+
if (previous.digest !== digest) throw new Error("COMPUTER_ACTION_ID_REUSED");
|
|
223
|
+
return {
|
|
224
|
+
...this.result(s),
|
|
225
|
+
receipt: previous.receipt
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
const observed = s.observation;
|
|
229
|
+
if (!observed || e.observationId !== observed.id || this.now() - observed.capturedAt > 12e4) throw new Error("COMPUTER_STALE_OBSERVATION");
|
|
230
|
+
if (s.actions >= this.config.maxActionsPerSession) throw new Error("COMPUTER_ACTION_BUDGET");
|
|
231
|
+
if ("point" in e.action && e.action.point && (e.action.point.x >= observed.imageWidth || e.action.point.y >= observed.imageHeight)) throw new Error("COMPUTER_COORDINATE_OUTSIDE_WINDOW");
|
|
232
|
+
if (e.action.kind === "typeText" && !e.action.point && !observed.focusedEditableRef) throw new Error("COMPUTER_EDITABLE_TARGET_REQUIRED");
|
|
233
|
+
this.driver.validateAction?.(e.action);
|
|
234
|
+
if (e.action.kind !== "wait" && !this.host.hasFullControl?.()) {
|
|
235
|
+
if (!s.pending) {
|
|
236
|
+
s.pending = {
|
|
237
|
+
envelope: e,
|
|
238
|
+
digest
|
|
239
|
+
};
|
|
240
|
+
s.status = "pending_action";
|
|
241
|
+
this.host.requestApproval({
|
|
242
|
+
kind: "action",
|
|
243
|
+
id: e.actionId,
|
|
244
|
+
target: observed.target,
|
|
245
|
+
action: e.action
|
|
246
|
+
}, s.controller.signal).then((approved) => {
|
|
247
|
+
this.active(s);
|
|
248
|
+
if (s.pending?.digest === digest) s.pending.approved = approved;
|
|
249
|
+
}).catch(() => {}).finally(() => this.host.onStateChange?.());
|
|
250
|
+
return this.result(s);
|
|
251
|
+
}
|
|
252
|
+
if (s.pending.digest !== digest) throw new Error("COMPUTER_DIFFERENT_ACTION_PENDING");
|
|
253
|
+
if (s.pending.approved === void 0) return this.result(s);
|
|
254
|
+
if (!s.pending.approved) {
|
|
255
|
+
await this.stop();
|
|
256
|
+
return this.result(s);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
const current = await this.driver.observe(s.target, s.controller.signal);
|
|
260
|
+
try {
|
|
261
|
+
this.active(s);
|
|
262
|
+
if (JSON.stringify(current.target) !== JSON.stringify(observed.target) || current.stateDigest !== observed.stateDigest || e.deadlineAt <= this.now()) {
|
|
263
|
+
s.pending = void 0;
|
|
264
|
+
s.observation = void 0;
|
|
265
|
+
s.status = "ready";
|
|
266
|
+
throw new Error("COMPUTER_APPROVAL_TARGET_CHANGED");
|
|
267
|
+
}
|
|
268
|
+
this.driver.validateAction?.(e.action);
|
|
269
|
+
} finally {
|
|
270
|
+
current.image.fill(0);
|
|
271
|
+
}
|
|
272
|
+
const receipt = {
|
|
273
|
+
actionId: e.actionId,
|
|
274
|
+
dispatch: "started",
|
|
275
|
+
outcome: "unknown",
|
|
276
|
+
verification: "none"
|
|
277
|
+
};
|
|
278
|
+
s.receipts.set(e.actionId, {
|
|
279
|
+
digest,
|
|
280
|
+
receipt
|
|
281
|
+
});
|
|
282
|
+
s.actions++;
|
|
283
|
+
s.pending = void 0;
|
|
284
|
+
s.status = "running";
|
|
285
|
+
try {
|
|
286
|
+
await this.driver.perform(s.target, e.action, s.controller.signal);
|
|
287
|
+
this.active(s);
|
|
288
|
+
receipt.dispatch = "completed";
|
|
289
|
+
s.status = "ready";
|
|
290
|
+
const after = await this.observe(s);
|
|
291
|
+
receipt.verification = after.observation ? "visual" : "none";
|
|
292
|
+
return {
|
|
293
|
+
...after,
|
|
294
|
+
receipt
|
|
295
|
+
};
|
|
296
|
+
} catch {
|
|
297
|
+
receipt.dispatch = "unknown";
|
|
298
|
+
await this.stop();
|
|
299
|
+
return {
|
|
300
|
+
...this.result(s),
|
|
301
|
+
receipt
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
stop() {
|
|
306
|
+
this.discovery?.controller.abort();
|
|
307
|
+
const s = this.session;
|
|
308
|
+
if (s && s.status !== "stopped") {
|
|
309
|
+
s.generation++;
|
|
310
|
+
s.status = "stopped";
|
|
311
|
+
s.pending = void 0;
|
|
312
|
+
s.observation = void 0;
|
|
313
|
+
s.controller.abort();
|
|
314
|
+
}
|
|
315
|
+
if (!this.stopping) this.stopping = this.driver.stop().finally(() => {
|
|
316
|
+
this.stopping = void 0;
|
|
317
|
+
this.host.onStateChange?.();
|
|
318
|
+
});
|
|
319
|
+
return this.stopping;
|
|
320
|
+
}
|
|
321
|
+
async cancel(command) {
|
|
322
|
+
if (this.session?.id === command.sessionId && this.session.owner === command.owner || this.discovery?.id === command.sessionId && this.discovery.owner === command.owner) await this.stop();
|
|
323
|
+
}
|
|
324
|
+
snapshot() {
|
|
325
|
+
return this.session ? {
|
|
326
|
+
status: this.session.status,
|
|
327
|
+
errorCode: this.session.errorCode,
|
|
328
|
+
appId: this.session.appId
|
|
329
|
+
} : { status: "idle" };
|
|
330
|
+
}
|
|
331
|
+
async dispose() {
|
|
332
|
+
clearInterval(this.timer);
|
|
333
|
+
await this.stop();
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
//#endregion
|
|
337
|
+
export { ComputerBroker };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ComputerConfigSchema: z.ZodPrefault<z.ZodObject<{
|
|
3
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
4
|
+
maxActionsPerSession: z.ZodDefault<z.ZodNumber>;
|
|
5
|
+
maxModelRequests: z.ZodDefault<z.ZodNumber>;
|
|
6
|
+
maxSessionDurationMs: z.ZodDefault<z.ZodNumber>;
|
|
7
|
+
idleGrantTtlMs: z.ZodDefault<z.ZodNumber>;
|
|
8
|
+
}, z.core.$strict>>;
|
|
9
|
+
export type ComputerConfig = z.infer<typeof ComputerConfigSchema>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/computer/config.ts
|
|
4
|
+
var ComputerConfigSchema;
|
|
5
|
+
var init_config = __esmMin((() => {
|
|
6
|
+
ComputerConfigSchema = z.object({
|
|
7
|
+
enabled: z.boolean().default(false),
|
|
8
|
+
maxActionsPerSession: z.number().int().min(1).max(80).default(80),
|
|
9
|
+
maxModelRequests: z.number().int().min(1).max(120).default(120),
|
|
10
|
+
maxSessionDurationMs: z.number().int().min(1e3).max(9e5).default(9e5),
|
|
11
|
+
idleGrantTtlMs: z.number().int().min(1e3).max(3e5).default(3e5)
|
|
12
|
+
}).strict().prefault({});
|
|
13
|
+
}));
|
|
14
|
+
//#endregion
|
|
15
|
+
init_config();
|
|
16
|
+
export { ComputerConfigSchema, init_config };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function enterComputerControl(owner: string, close: () => Promise<void>): void;
|
|
2
|
+
export declare function leaveComputerControl(owner: string): void;
|
|
3
|
+
export declare function isComputerControlActive(owner: string): boolean;
|
|
4
|
+
export declare function stopComputerControl(owner: string): Promise<void>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/computer/control-guard.ts
|
|
2
|
+
/** Process-local admission gate; authority itself remains in the desktop broker. */
|
|
3
|
+
const owners = /* @__PURE__ */ new Map();
|
|
4
|
+
function enterComputerControl(owner, close) {
|
|
5
|
+
owners.set(owner, close);
|
|
6
|
+
}
|
|
7
|
+
function leaveComputerControl(owner) {
|
|
8
|
+
owners.delete(owner);
|
|
9
|
+
}
|
|
10
|
+
function isComputerControlActive(owner) {
|
|
11
|
+
return owners.has(owner);
|
|
12
|
+
}
|
|
13
|
+
async function stopComputerControl(owner) {
|
|
14
|
+
await owners.get(owner)?.();
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { enterComputerControl, isComputerControlActive, leaveComputerControl, stopComputerControl };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComputerWindow } from '@xopcai/computer-control-contract';
|
|
2
|
+
export declare class ComputerTargetError extends Error {
|
|
3
|
+
readonly windows: ComputerWindow[];
|
|
4
|
+
constructor(code: string, windows?: ComputerWindow[]);
|
|
5
|
+
}
|
|
6
|
+
/** Recovery instructions are deterministic; never replay an input with unknown delivery. */
|
|
7
|
+
export declare function computerRecovery(code: string): string;
|