@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
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import { COMPUTER_CONTROL_TOOL, ComputerAppSchema, ComputerObservationSchema, ComputerWindowSchema, init_src } from "../../packages/computer-control-contract/src/index.js";
|
|
2
|
+
import { computerModelProfile, init_model_policy } from "./model-policy.js";
|
|
3
|
+
import { getApiKey, init_providers, resolveModel } from "../providers/index.js";
|
|
4
|
+
import { resolveEffectiveAgentConfigForSession } from "../config/agent-profile.js";
|
|
5
|
+
import { enterComputerControl, leaveComputerControl } from "./control-guard.js";
|
|
6
|
+
import { ComputerModelAdapter, predictComputerStep, readComputerJson } from "./model-adapter.js";
|
|
7
|
+
import { computerRecovery } from "./errors.js";
|
|
8
|
+
import { randomUUID } from "node:crypto";
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
//#region src/computer/runtime.ts
|
|
11
|
+
init_src();
|
|
12
|
+
init_providers();
|
|
13
|
+
init_model_policy();
|
|
14
|
+
const Reply = z.object({
|
|
15
|
+
status: z.enum([
|
|
16
|
+
"pending_authorization",
|
|
17
|
+
"ready",
|
|
18
|
+
"running",
|
|
19
|
+
"pending_action",
|
|
20
|
+
"paused",
|
|
21
|
+
"stopped"
|
|
22
|
+
]),
|
|
23
|
+
sessionId: z.string(),
|
|
24
|
+
brokerEpoch: z.string(),
|
|
25
|
+
generation: z.number().int().nonnegative(),
|
|
26
|
+
grantId: z.string().optional(),
|
|
27
|
+
observation: ComputerObservationSchema.optional(),
|
|
28
|
+
errorCode: z.string().optional(),
|
|
29
|
+
apps: z.array(ComputerAppSchema).max(100).optional(),
|
|
30
|
+
windows: z.array(ComputerWindowSchema).max(100).optional(),
|
|
31
|
+
receipt: z.object({
|
|
32
|
+
actionId: z.string(),
|
|
33
|
+
dispatch: z.enum([
|
|
34
|
+
"notStarted",
|
|
35
|
+
"started",
|
|
36
|
+
"completed",
|
|
37
|
+
"unknown"
|
|
38
|
+
]),
|
|
39
|
+
outcome: z.enum([
|
|
40
|
+
"applied",
|
|
41
|
+
"notApplied",
|
|
42
|
+
"unknown"
|
|
43
|
+
]),
|
|
44
|
+
verification: z.enum([
|
|
45
|
+
"semantic",
|
|
46
|
+
"artifact",
|
|
47
|
+
"visual",
|
|
48
|
+
"none"
|
|
49
|
+
]),
|
|
50
|
+
errorCode: z.string().optional()
|
|
51
|
+
}).optional()
|
|
52
|
+
}).strict();
|
|
53
|
+
const ComputerUseInputSchema = z.discriminatedUnion("op", [
|
|
54
|
+
z.object({
|
|
55
|
+
op: z.literal("discover"),
|
|
56
|
+
query: z.string().max(200)
|
|
57
|
+
}).strict(),
|
|
58
|
+
z.object({
|
|
59
|
+
op: z.literal("open"),
|
|
60
|
+
appRef: z.string().min(1).max(200),
|
|
61
|
+
windowRef: z.string().min(1).max(200).optional(),
|
|
62
|
+
mode: z.enum(["observe", "control"]),
|
|
63
|
+
prepare: z.boolean()
|
|
64
|
+
}).strict(),
|
|
65
|
+
z.object({
|
|
66
|
+
op: z.literal("observe"),
|
|
67
|
+
question: z.string().min(1).max(4e3).optional()
|
|
68
|
+
}).strict(),
|
|
69
|
+
z.object({
|
|
70
|
+
op: z.literal("step"),
|
|
71
|
+
goal: z.string().min(1).max(4e3)
|
|
72
|
+
}).strict(),
|
|
73
|
+
z.object({ op: z.literal("close") }).strict()
|
|
74
|
+
]);
|
|
75
|
+
var ComputerRuntime = class {
|
|
76
|
+
sessions = /* @__PURE__ */ new Map();
|
|
77
|
+
operations = /* @__PURE__ */ new Map();
|
|
78
|
+
constructor(endpoints, getConfig, getTurnEndpoint) {
|
|
79
|
+
this.endpoints = endpoints;
|
|
80
|
+
this.getConfig = getConfig;
|
|
81
|
+
this.getTurnEndpoint = getTurnEndpoint;
|
|
82
|
+
}
|
|
83
|
+
async execute(owner, input, signal) {
|
|
84
|
+
input = ComputerUseInputSchema.parse(input);
|
|
85
|
+
if (!owner) throw new Error("COMPUTER_CONVERSATION_REQUIRED");
|
|
86
|
+
if (input.op === "close") {
|
|
87
|
+
const sessionId = this.sessions.get(owner)?.id ?? "none";
|
|
88
|
+
await this.close(owner);
|
|
89
|
+
return {
|
|
90
|
+
status: "stopped",
|
|
91
|
+
sessionId
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
if (this.operations.has(owner)) throw new Error("COMPUTER_BUSY");
|
|
95
|
+
const operation = new AbortController();
|
|
96
|
+
this.operations.set(owner, operation);
|
|
97
|
+
try {
|
|
98
|
+
return await this.executeInput(owner, input, signal ? AbortSignal.any([signal, operation.signal]) : operation.signal);
|
|
99
|
+
} finally {
|
|
100
|
+
if (this.operations.get(owner) === operation) this.operations.delete(owner);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
async executeInput(owner, input, signal) {
|
|
104
|
+
signal.throwIfAborted();
|
|
105
|
+
const config = this.getConfig();
|
|
106
|
+
if (!config.computer.enabled) {
|
|
107
|
+
await this.close(owner);
|
|
108
|
+
throw new Error("COMPUTER_DISABLED");
|
|
109
|
+
}
|
|
110
|
+
let s = this.sessions.get(owner);
|
|
111
|
+
if (input.op === "discover") {
|
|
112
|
+
const endpoint = this.resolveEndpoint(owner);
|
|
113
|
+
const id = randomUUID();
|
|
114
|
+
const reply = await this.send({
|
|
115
|
+
endpointId: endpoint.endpointId,
|
|
116
|
+
id
|
|
117
|
+
}, {
|
|
118
|
+
op: "discover",
|
|
119
|
+
sessionId: id,
|
|
120
|
+
owner,
|
|
121
|
+
query: input.query
|
|
122
|
+
}, signal);
|
|
123
|
+
reply.frame?.fill(0);
|
|
124
|
+
return this.present(reply.value);
|
|
125
|
+
}
|
|
126
|
+
if (input.op === "open" && !s) {
|
|
127
|
+
const endpoint = this.resolveEndpoint(owner);
|
|
128
|
+
const effective = resolveEffectiveAgentConfigForSession(config, owner).config;
|
|
129
|
+
const ref = effective.models.computerUse?.primary;
|
|
130
|
+
if (!ref) throw new Error("COMPUTER_MODEL_REQUIRED");
|
|
131
|
+
const model = resolveModel(ref);
|
|
132
|
+
const profile = computerModelProfile(model);
|
|
133
|
+
if (!profile) throw new Error("COMPUTER_MODEL_CAPABILITY_REQUIRED");
|
|
134
|
+
const apiKey = await getApiKey(model.provider, {
|
|
135
|
+
agentId: effective.id,
|
|
136
|
+
appConfig: config
|
|
137
|
+
});
|
|
138
|
+
if (!apiKey) throw new Error("COMPUTER_MODEL_KEY_MISSING");
|
|
139
|
+
let deployment;
|
|
140
|
+
if (model.provider === "xopc-cloud") {
|
|
141
|
+
const response = await fetch(`${model.baseUrl.replace(/\/$/, "")}/models`, {
|
|
142
|
+
headers: { Authorization: `Bearer ${apiKey}` },
|
|
143
|
+
redirect: "error",
|
|
144
|
+
signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(15e3)]) : AbortSignal.timeout(15e3)
|
|
145
|
+
});
|
|
146
|
+
if (!response.ok) {
|
|
147
|
+
await response.body?.cancel();
|
|
148
|
+
throw new Error("COMPUTER_DEPLOYMENT_UNAVAILABLE");
|
|
149
|
+
}
|
|
150
|
+
const body = await readComputerJson(response, 2 * 1024 * 1024);
|
|
151
|
+
deployment = z.object({
|
|
152
|
+
revision: z.string().regex(/^[a-f0-9]{64}$/),
|
|
153
|
+
origin: z.string().url()
|
|
154
|
+
}).parse(body.data?.find((item) => item.id === model.id)?.xopc?.computerDeployment);
|
|
155
|
+
}
|
|
156
|
+
const adapter = new ComputerModelAdapter({
|
|
157
|
+
modelId: model.id,
|
|
158
|
+
baseUrl: model.baseUrl,
|
|
159
|
+
apiKey,
|
|
160
|
+
profile,
|
|
161
|
+
headers: model.headers,
|
|
162
|
+
deploymentRevision: deployment?.revision
|
|
163
|
+
});
|
|
164
|
+
signal.throwIfAborted();
|
|
165
|
+
s = {
|
|
166
|
+
id: randomUUID(),
|
|
167
|
+
owner,
|
|
168
|
+
appRef: input.appRef,
|
|
169
|
+
mode: input.mode,
|
|
170
|
+
prepare: input.prepare,
|
|
171
|
+
windowRef: input.windowRef,
|
|
172
|
+
endpointId: endpoint.endpointId,
|
|
173
|
+
adapter,
|
|
174
|
+
binding: {
|
|
175
|
+
modelRef: ref,
|
|
176
|
+
profile,
|
|
177
|
+
origin: new URL(model.baseUrl).origin,
|
|
178
|
+
runtimeLocation: "unknown",
|
|
179
|
+
...deployment ? { upstreamOrigin: deployment.origin } : {}
|
|
180
|
+
},
|
|
181
|
+
createdAt: Date.now(),
|
|
182
|
+
actions: 0,
|
|
183
|
+
modelRequests: 0,
|
|
184
|
+
controller: new AbortController()
|
|
185
|
+
};
|
|
186
|
+
this.sessions.set(owner, s);
|
|
187
|
+
enterComputerControl(owner, () => this.close(owner));
|
|
188
|
+
}
|
|
189
|
+
if (!s) throw new Error("COMPUTER_OPEN_REQUIRED");
|
|
190
|
+
signal = signal ? AbortSignal.any([signal, s.controller.signal]) : s.controller.signal;
|
|
191
|
+
if (Date.now() - s.createdAt >= config.computer.maxSessionDurationMs) {
|
|
192
|
+
await this.close(owner);
|
|
193
|
+
throw new Error("COMPUTER_SESSION_BUDGET");
|
|
194
|
+
}
|
|
195
|
+
try {
|
|
196
|
+
if (input.op === "open") {
|
|
197
|
+
if (input.appRef !== s.appRef || input.windowRef !== s.windowRef || input.mode !== s.mode || input.prepare !== s.prepare) throw new Error("COMPUTER_CLOSE_BEFORE_TARGET_CHANGE");
|
|
198
|
+
const reply = await this.send(s, {
|
|
199
|
+
op: "open",
|
|
200
|
+
sessionId: s.id,
|
|
201
|
+
owner,
|
|
202
|
+
appRef: s.appRef,
|
|
203
|
+
mode: s.mode,
|
|
204
|
+
prepare: s.prepare,
|
|
205
|
+
...s.windowRef ? { windowRef: s.windowRef } : {},
|
|
206
|
+
model: s.binding
|
|
207
|
+
}, signal);
|
|
208
|
+
if (reply.value.status === "stopped") await this.close(owner);
|
|
209
|
+
return this.present(reply.value);
|
|
210
|
+
}
|
|
211
|
+
const status = await this.send(s, {
|
|
212
|
+
op: "status",
|
|
213
|
+
sessionId: s.id,
|
|
214
|
+
owner
|
|
215
|
+
}, signal);
|
|
216
|
+
if (status.value.status === "stopped") {
|
|
217
|
+
this.sessions.delete(owner);
|
|
218
|
+
leaveComputerControl(owner);
|
|
219
|
+
return this.present(status.value);
|
|
220
|
+
}
|
|
221
|
+
if (input.op === "step" && s.mode === "observe") throw new Error("COMPUTER_READ_ONLY");
|
|
222
|
+
if (s.pending) {
|
|
223
|
+
if (input.op === "observe") return this.present(status.value);
|
|
224
|
+
return await this.dispatchAction(s, s.pending, signal);
|
|
225
|
+
}
|
|
226
|
+
if (status.value.status !== "ready") return this.present(status.value);
|
|
227
|
+
const observed = await this.send(s, {
|
|
228
|
+
op: "observe",
|
|
229
|
+
sessionId: s.id,
|
|
230
|
+
owner
|
|
231
|
+
}, signal);
|
|
232
|
+
try {
|
|
233
|
+
if (input.op === "observe" && !input.question) return this.present(observed.value);
|
|
234
|
+
if (input.op === "step" && s.actions >= config.computer.maxActionsPerSession) throw new Error("COMPUTER_ACTION_BUDGET");
|
|
235
|
+
const o = observed.value.observation;
|
|
236
|
+
if (!o || !observed.frame || !observed.mimeType) throw new Error("COMPUTER_FRAME_REQUIRED");
|
|
237
|
+
const proposal = await predictComputerStep(s.adapter, {
|
|
238
|
+
goal: input.op === "observe" ? input.question : input.goal,
|
|
239
|
+
readOnly: input.op === "observe",
|
|
240
|
+
image: observed.frame,
|
|
241
|
+
mimeType: observed.mimeType,
|
|
242
|
+
width: o.imageWidth,
|
|
243
|
+
height: o.imageHeight,
|
|
244
|
+
summary: o.summary
|
|
245
|
+
}, () => {
|
|
246
|
+
if (++s.modelRequests > config.computer.maxModelRequests) throw new Error("COMPUTER_MODEL_BUDGET");
|
|
247
|
+
}, signal);
|
|
248
|
+
if (proposal.kind === "answer") return {
|
|
249
|
+
...this.present(observed.value),
|
|
250
|
+
summary: proposal.text,
|
|
251
|
+
verified: false
|
|
252
|
+
};
|
|
253
|
+
if (input.op === "observe") throw new Error("COMPUTER_READ_ONLY_MODEL_OUTPUT");
|
|
254
|
+
if (proposal.kind === "finished") return {
|
|
255
|
+
status: "model_finished",
|
|
256
|
+
sessionId: s.id,
|
|
257
|
+
claimedSuccess: proposal.claimedSuccess,
|
|
258
|
+
verified: false
|
|
259
|
+
};
|
|
260
|
+
if (proposal.kind === "takeover") return {
|
|
261
|
+
status: "takeover",
|
|
262
|
+
sessionId: s.id,
|
|
263
|
+
pending: true,
|
|
264
|
+
summary: "The GUI model requests user assistance. Inspect the authorized window locally."
|
|
265
|
+
};
|
|
266
|
+
const e = {
|
|
267
|
+
actionId: randomUUID(),
|
|
268
|
+
sessionId: s.id,
|
|
269
|
+
observationId: o.id,
|
|
270
|
+
brokerEpoch: o.brokerEpoch,
|
|
271
|
+
generation: o.generation,
|
|
272
|
+
grantId: observed.value.grantId,
|
|
273
|
+
deadlineAt: Date.now() + 12e4,
|
|
274
|
+
action: proposal.action
|
|
275
|
+
};
|
|
276
|
+
return await this.dispatchAction(s, e, signal);
|
|
277
|
+
} finally {
|
|
278
|
+
observed.frame?.fill(0);
|
|
279
|
+
}
|
|
280
|
+
} catch (error) {
|
|
281
|
+
await this.close(owner);
|
|
282
|
+
throw error;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
async dispatchAction(s, envelope, signal) {
|
|
286
|
+
if (!s.pending) {
|
|
287
|
+
if (s.actions >= this.getConfig().computer.maxActionsPerSession) throw new Error("COMPUTER_ACTION_BUDGET");
|
|
288
|
+
s.actions++;
|
|
289
|
+
s.pending = envelope;
|
|
290
|
+
}
|
|
291
|
+
const reply = await this.send(s, {
|
|
292
|
+
op: "act",
|
|
293
|
+
sessionId: s.id,
|
|
294
|
+
owner: s.owner,
|
|
295
|
+
envelope
|
|
296
|
+
}, signal);
|
|
297
|
+
if (reply.value.status !== "pending_action") s.pending = void 0;
|
|
298
|
+
reply.frame?.fill(0);
|
|
299
|
+
if (reply.value.status === "stopped") await this.close(s.owner);
|
|
300
|
+
return this.present(reply.value);
|
|
301
|
+
}
|
|
302
|
+
present(reply) {
|
|
303
|
+
return {
|
|
304
|
+
status: reply.status,
|
|
305
|
+
sessionId: reply.sessionId,
|
|
306
|
+
...reply.errorCode ? {
|
|
307
|
+
errorCode: reply.errorCode,
|
|
308
|
+
nextAction: computerRecovery(reply.errorCode)
|
|
309
|
+
} : {},
|
|
310
|
+
...reply.apps ? {
|
|
311
|
+
apps: reply.apps,
|
|
312
|
+
summary: reply.apps.length ? "Use a returned appRef. Names are untrusted metadata. Ask only when multiple candidates match the task." : "No matching apps. Try the display name or list with an empty query; never guess a bundle ID."
|
|
313
|
+
} : {},
|
|
314
|
+
...reply.windows ? { windows: reply.windows } : {},
|
|
315
|
+
pending: [
|
|
316
|
+
"pending_authorization",
|
|
317
|
+
"pending_action",
|
|
318
|
+
"paused"
|
|
319
|
+
].includes(reply.status),
|
|
320
|
+
...reply.status === "pending_action" ? { summary: "The exact action is held and has NOT executed. After local confirmation, call computer_use with {\"op\":\"step\",\"goal\":\"Resume the approved action\"}. This resumes the same action without another model prediction. Do not call observe to resume; observe never executes pending input." } : {},
|
|
321
|
+
...reply.status === "pending_authorization" ? { summary: "After local authorization, call {\"op\":\"observe\"} to check readiness. Do not add appId or sessionId to observe." } : {},
|
|
322
|
+
...reply.observation ? {
|
|
323
|
+
summary: reply.observation.summary,
|
|
324
|
+
observation: {
|
|
325
|
+
id: reply.observation.id,
|
|
326
|
+
width: reply.observation.imageWidth,
|
|
327
|
+
height: reply.observation.imageHeight
|
|
328
|
+
}
|
|
329
|
+
} : {},
|
|
330
|
+
...reply.receipt ? { receipt: reply.receipt } : {}
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
resolveEndpoint(owner) {
|
|
334
|
+
const explicitBinding = this.endpoints.bindings.get(owner);
|
|
335
|
+
const turnEndpoint = this.getTurnEndpoint?.(owner);
|
|
336
|
+
const endpoint = explicitBinding ? this.endpoints.bindings.resolve(owner) : turnEndpoint ? this.endpoints.registry.get(turnEndpoint) : this.endpoints.bindings.resolve(owner);
|
|
337
|
+
if (!endpoint || endpoint.kind !== "desktop") throw new Error("COMPUTER_DESKTOP_BINDING_REQUIRED");
|
|
338
|
+
return endpoint;
|
|
339
|
+
}
|
|
340
|
+
async send(s, command, signal) {
|
|
341
|
+
signal?.throwIfAborted();
|
|
342
|
+
const tool = this.endpoints.registry.getTool(s.endpointId, COMPUTER_CONTROL_TOOL);
|
|
343
|
+
if (!tool) throw new Error("COMPUTER_DESKTOP_UPGRADE_REQUIRED");
|
|
344
|
+
const reply = await this.endpoints.invocations.invoke({
|
|
345
|
+
endpointId: s.endpointId,
|
|
346
|
+
toolCallId: randomUUID(),
|
|
347
|
+
toolName: COMPUTER_CONTROL_TOOL,
|
|
348
|
+
arguments: command,
|
|
349
|
+
descriptorRevision: tool.revision,
|
|
350
|
+
signal
|
|
351
|
+
});
|
|
352
|
+
const json = reply.content.find((item) => item.type === "json");
|
|
353
|
+
const value = Reply.parse(json?.type === "json" ? json.value : void 0);
|
|
354
|
+
if (value.sessionId !== s.id) throw new Error("COMPUTER_SESSION_MISMATCH");
|
|
355
|
+
const file = reply.content.find((item) => item.type === "file");
|
|
356
|
+
let frame;
|
|
357
|
+
if (file?.type === "file" && reply.invocationId) frame = this.endpoints.uploads.takeComputerFrame(file.fileId, reply.invocationId);
|
|
358
|
+
if (signal?.aborted) {
|
|
359
|
+
frame?.fill(0);
|
|
360
|
+
signal.throwIfAborted();
|
|
361
|
+
}
|
|
362
|
+
return {
|
|
363
|
+
value,
|
|
364
|
+
frame,
|
|
365
|
+
mimeType: file?.type === "file" ? file.mimeType : void 0
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
async close(owner) {
|
|
369
|
+
this.operations.get(owner)?.abort();
|
|
370
|
+
const s = this.sessions.get(owner);
|
|
371
|
+
if (!s) return;
|
|
372
|
+
this.sessions.delete(owner);
|
|
373
|
+
leaveComputerControl(owner);
|
|
374
|
+
s.controller.abort();
|
|
375
|
+
try {
|
|
376
|
+
await this.send(s, {
|
|
377
|
+
op: "release",
|
|
378
|
+
sessionId: s.id,
|
|
379
|
+
owner
|
|
380
|
+
});
|
|
381
|
+
} catch {}
|
|
382
|
+
}
|
|
383
|
+
async shutdown() {
|
|
384
|
+
await Promise.all([...new Set([...this.sessions.keys(), ...this.operations.keys()])].map((owner) => this.close(owner)));
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
//#endregion
|
|
388
|
+
export { ComputerRuntime, ComputerUseInputSchema };
|
package/dist/src/config/index.js
CHANGED
|
@@ -2,15 +2,15 @@ import { ENV_VARS, XOPC_DB_FILENAME, resolveHomeDir, resolveStateDir, resolveXop
|
|
|
2
2
|
import { TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema } from "../../extensions/telegram/src/config-schema.js";
|
|
3
3
|
import { WeixinAccountConfigSchema, WeixinConfigSchema } from "../../extensions/weixin/src/config-schema.js";
|
|
4
4
|
import { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, AgentsConfigSchema, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, BrowserConfigSchema, ChannelsConfigSchema, CommandsConfigSchema, ConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GatewayWebchatConfigSchema, HeartbeatConfigSchema, McpConfigSchema, McpOAuthConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelCatalogConfigSchema, ModelsDevConfigSchema, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, RuntimeToolsConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TuiConfigSchema, TunnelConfigSchema, TunnelConsentSchema, UpdateAutoConfigSchema, UpdateConfigSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef } from "./schema.js";
|
|
5
|
-
import {
|
|
5
|
+
import { clearConfigValueCache, getAllowedCommands, getCacheStats, init_resolve_config_value, resolveConfigValue, resolveHeaders, testApiKeyResolution } from "./resolve-config-value.js";
|
|
6
6
|
import { expandWorkspacePathString, init_workspace_path, normalizeWorkspaceDir, resolveWorkspaceRoot } from "./workspace-path.js";
|
|
7
7
|
import { resolveDefaultAgentWorkspaceDir } from "./workspace-defaults.js";
|
|
8
8
|
import { resolveAgentDir as resolveAgentDir$1, resolveAgentHomeDir as resolveAgentHomeDir$1, resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
|
|
9
|
-
import { extractProfileAgentId, resolveEffectiveAgentConfigForAgent, resolveEffectiveAgentConfigForSession, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "./agent-profile.js";
|
|
10
9
|
import { FILENAMES, WORKSPACE_FILES, existsSync, hasBundledExtensionManifest, init_paths, resolveAgentAuthProfilesPath, resolveAgentDir, resolveAgentHomeDir, resolveAgentProfileDir, resolveAgentProfileMarkdownPath, resolveAuthProfilesPath, resolveBinDir, resolveBundledExtensionsDir, resolveBundledSkillsDir, resolveConfigPath, resolveCredentialsDir, resolveExtensionSdkPath, resolveExtensionsDir, resolveExtensionsLockPath, resolveInboxDir, resolveInboxMessagePath, resolveInboxPendingDir, resolveInboxProcessedDir, resolveLogPath, resolveLogsDir, resolveMcpOAuthPath, resolveModelsJsonPath, resolveNodeBinDir, resolveNodeBinPath, resolveNodeToolsDir, resolveNpmBinPath, resolveOAuthPath, resolvePidPath, resolveSkillPath, resolveSkillsCachePath, resolveSkillsDir, resolveSkillsLockPath, resolveSocketPath, resolveStatusPath, resolveToolsDir, resolveWorkspaceExtensionsDir, resolveWorkspaceFile, resolveWorkspaceStateDir, resolveWorkspaceStatePath, resolveXopcBinPath } from "./paths.js";
|
|
11
|
-
import { init_loader, loadConfig, saveConfig } from "./loader.js";
|
|
12
|
-
import { clearConfigValueCache, getAllowedCommands, getCacheStats, init_resolve_config_value, resolveConfigValue, resolveHeaders, testApiKeyResolution } from "./resolve-config-value.js";
|
|
13
10
|
import { CustomModelSchema, ImageGenerationCapabilitiesSchema, ImageGenerationModelSchema, ImageGenerationProviderSchema, ModelOverrideSchema, ModelsJsonSchema, OpenAICompatSchema, OpenAICompletionsCompatSchema, OpenAIResponsesCompatSchema, OpenRouterRoutingSchema, ProviderConfigSchema, VercelGatewayRoutingSchema, getDefaultModelValues, init_models_json, loadModelsJson, modelsJsonExists, saveModelsJson, validateModelsConfig } from "./models-json.js";
|
|
11
|
+
import { init_loader, loadConfig, saveConfig } from "./loader.js";
|
|
12
|
+
import { applyConfigOverrides, getConfigOverrides, resetConfigOverrides, setConfigOverride, unsetConfigOverride } from "./runtime-overrides.js";
|
|
13
|
+
import { extractProfileAgentId, resolveEffectiveAgentConfigForAgent, resolveEffectiveAgentConfigForSession, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "./agent-profile.js";
|
|
14
14
|
import { canonicalizeConfiguredMcpServer, isKnownCliMcpTypeAlias, normalizeConfiguredMcpServers, resolveXopcMcpTransportAlias } from "./mcp-config-normalize.js";
|
|
15
15
|
import { formatThinkingLevels, listThinkingLevels, normalizeElevatedMode, normalizeReasoningLevel, normalizeThinkLevel, normalizeVerboseLevel, thinkLevelToNumber } from "../agent/transcript/thinking-types.js";
|
|
16
16
|
import { getWorkspacePath } from "./workspace-path-helpers.js";
|
|
@@ -2,10 +2,10 @@ import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
|
2
2
|
import { createLogger } from "../utils/logger/index.js";
|
|
3
3
|
import { init_logger } from "../utils/logger.js";
|
|
4
4
|
import { ConfigSchema, init_schema } from "./schema.js";
|
|
5
|
-
import { init_paths, resolveConfigPath } from "./paths.js";
|
|
6
5
|
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
7
|
-
import {
|
|
6
|
+
import { init_paths, resolveConfigPath } from "./paths.js";
|
|
8
7
|
import { init_resolution, setActivePlatformDiscovery } from "../platform/resolution.js";
|
|
8
|
+
import { assertChannelPluginConfigs, init_validate_channel_configs } from "./validate-channel-configs.js";
|
|
9
9
|
import { dirname } from "path";
|
|
10
10
|
import { existsSync, mkdirSync, promises, readFileSync } from "fs";
|
|
11
11
|
import { config } from "dotenv";
|
|
@@ -262,6 +262,12 @@ export declare const ImageGenerationProviderSchema: z.ZodObject<{
|
|
|
262
262
|
}, z.core.$strict>>;
|
|
263
263
|
}, z.core.$strict>;
|
|
264
264
|
export declare const CustomModelSchema: z.ZodObject<{
|
|
265
|
+
computerUse: z.ZodOptional<z.ZodObject<{
|
|
266
|
+
profile: z.ZodEnum<{
|
|
267
|
+
"gui-plus-2026-02-26": "gui-plus-2026-02-26";
|
|
268
|
+
"structured-tools-v1": "structured-tools-v1";
|
|
269
|
+
}>;
|
|
270
|
+
}, z.core.$strict>>;
|
|
265
271
|
id: z.ZodString;
|
|
266
272
|
name: z.ZodOptional<z.ZodString>;
|
|
267
273
|
api: z.ZodOptional<z.ZodEnum<{
|
|
@@ -337,6 +343,12 @@ export declare const CustomModelSchema: z.ZodObject<{
|
|
|
337
343
|
}, z.core.$strip>, z.ZodObject<{}, z.core.$strip>]>>;
|
|
338
344
|
}, z.core.$strip>;
|
|
339
345
|
export declare const ModelOverrideSchema: z.ZodObject<{
|
|
346
|
+
computerUse: z.ZodOptional<z.ZodObject<{
|
|
347
|
+
profile: z.ZodEnum<{
|
|
348
|
+
"gui-plus-2026-02-26": "gui-plus-2026-02-26";
|
|
349
|
+
"structured-tools-v1": "structured-tools-v1";
|
|
350
|
+
}>;
|
|
351
|
+
}, z.core.$strict>>;
|
|
340
352
|
name: z.ZodOptional<z.ZodString>;
|
|
341
353
|
reasoning: z.ZodOptional<z.ZodBoolean>;
|
|
342
354
|
thinkingLevelMap: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
@@ -416,6 +428,12 @@ export declare const ProviderConfigSchema: z.ZodObject<{
|
|
|
416
428
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
417
429
|
authHeader: z.ZodOptional<z.ZodBoolean>;
|
|
418
430
|
models: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
431
|
+
computerUse: z.ZodOptional<z.ZodObject<{
|
|
432
|
+
profile: z.ZodEnum<{
|
|
433
|
+
"gui-plus-2026-02-26": "gui-plus-2026-02-26";
|
|
434
|
+
"structured-tools-v1": "structured-tools-v1";
|
|
435
|
+
}>;
|
|
436
|
+
}, z.core.$strict>>;
|
|
419
437
|
id: z.ZodString;
|
|
420
438
|
name: z.ZodOptional<z.ZodString>;
|
|
421
439
|
api: z.ZodOptional<z.ZodEnum<{
|
|
@@ -491,6 +509,12 @@ export declare const ProviderConfigSchema: z.ZodObject<{
|
|
|
491
509
|
}, z.core.$strip>, z.ZodObject<{}, z.core.$strip>]>>;
|
|
492
510
|
}, z.core.$strip>>>;
|
|
493
511
|
modelOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
512
|
+
computerUse: z.ZodOptional<z.ZodObject<{
|
|
513
|
+
profile: z.ZodEnum<{
|
|
514
|
+
"gui-plus-2026-02-26": "gui-plus-2026-02-26";
|
|
515
|
+
"structured-tools-v1": "structured-tools-v1";
|
|
516
|
+
}>;
|
|
517
|
+
}, z.core.$strict>>;
|
|
494
518
|
name: z.ZodOptional<z.ZodString>;
|
|
495
519
|
reasoning: z.ZodOptional<z.ZodBoolean>;
|
|
496
520
|
thinkingLevelMap: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
@@ -651,6 +675,12 @@ export declare const ModelsJsonSchema: z.ZodObject<{
|
|
|
651
675
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
652
676
|
authHeader: z.ZodOptional<z.ZodBoolean>;
|
|
653
677
|
models: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
678
|
+
computerUse: z.ZodOptional<z.ZodObject<{
|
|
679
|
+
profile: z.ZodEnum<{
|
|
680
|
+
"gui-plus-2026-02-26": "gui-plus-2026-02-26";
|
|
681
|
+
"structured-tools-v1": "structured-tools-v1";
|
|
682
|
+
}>;
|
|
683
|
+
}, z.core.$strict>>;
|
|
654
684
|
id: z.ZodString;
|
|
655
685
|
name: z.ZodOptional<z.ZodString>;
|
|
656
686
|
api: z.ZodOptional<z.ZodEnum<{
|
|
@@ -726,6 +756,12 @@ export declare const ModelsJsonSchema: z.ZodObject<{
|
|
|
726
756
|
}, z.core.$strip>, z.ZodObject<{}, z.core.$strip>]>>;
|
|
727
757
|
}, z.core.$strip>>>;
|
|
728
758
|
modelOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
759
|
+
computerUse: z.ZodOptional<z.ZodObject<{
|
|
760
|
+
profile: z.ZodEnum<{
|
|
761
|
+
"gui-plus-2026-02-26": "gui-plus-2026-02-26";
|
|
762
|
+
"structured-tools-v1": "structured-tools-v1";
|
|
763
|
+
}>;
|
|
764
|
+
}, z.core.$strict>>;
|
|
729
765
|
name: z.ZodOptional<z.ZodString>;
|
|
730
766
|
reasoning: z.ZodOptional<z.ZodBoolean>;
|
|
731
767
|
thinkingLevelMap: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import {
|
|
2
|
+
import { ComputerProfileSchema, init_src } from "../../packages/computer-control-contract/src/index.js";
|
|
3
3
|
import { init_write_file_atomic, writeTextAtomicSync } from "../infra/write-file-atomic.js";
|
|
4
|
+
import { init_paths, resolveModelsJsonPath } from "./paths.js";
|
|
5
|
+
import { init_model_policy, isComputerModel } from "../computer/model-policy.js";
|
|
4
6
|
import { existsSync, readFileSync } from "fs";
|
|
5
7
|
import { z } from "zod";
|
|
6
8
|
//#region src/config/models-json.ts
|
|
@@ -111,6 +113,14 @@ function validateModelsConfig(config) {
|
|
|
111
113
|
});
|
|
112
114
|
if (providerConfig.models) for (let i = 0; i < providerConfig.models.length; i++) {
|
|
113
115
|
const model = providerConfig.models[i];
|
|
116
|
+
if (model.computerUse && !isComputerModel({
|
|
117
|
+
...model,
|
|
118
|
+
api: model.api ?? providerConfig.api
|
|
119
|
+
})) errors.push({
|
|
120
|
+
path: `providers.${providerName}.models[${i}].computerUse`,
|
|
121
|
+
message: "Computer Use requires image input and the openai-completions API",
|
|
122
|
+
severity: "error"
|
|
123
|
+
});
|
|
114
124
|
if (!model.api && !providerConfig.api) errors.push({
|
|
115
125
|
path: `providers.${providerName}.models[${i}].api`,
|
|
116
126
|
message: "api is required when not specified at provider level",
|
|
@@ -216,8 +226,10 @@ function modelsJsonExists(path = resolveModelsJsonPath()) {
|
|
|
216
226
|
}
|
|
217
227
|
var OpenRouterRoutingSchema, VercelGatewayRoutingSchema, OpenAICompletionsCompatSchema, OpenAIResponsesCompatSchema, OpenAICompatSchema, ImageGenerationResolutionSchema, ImageGenerationQualitySchema, ImageGenerationOutputFormatSchema, ImageGenerationBackgroundSchema, ImageGenerationCapabilitiesSchema, ImageGenerationModelSchema, ImageGenerationProviderSchema, CustomModelSchema, ModelOverrideSchema, ProviderConfigSchema, ModelsJsonSchema, PROVIDER_ID_REGEX, RESERVED_PROVIDER_IDS;
|
|
218
228
|
var init_models_json = __esmMin((() => {
|
|
229
|
+
init_src();
|
|
219
230
|
init_write_file_atomic();
|
|
220
231
|
init_paths();
|
|
232
|
+
init_model_policy();
|
|
221
233
|
OpenRouterRoutingSchema = z.object({
|
|
222
234
|
only: z.array(z.string()).optional(),
|
|
223
235
|
order: z.array(z.string()).optional()
|
|
@@ -333,6 +345,7 @@ var init_models_json = __esmMin((() => {
|
|
|
333
345
|
models: z.array(ImageGenerationModelSchema).min(1)
|
|
334
346
|
}).strict();
|
|
335
347
|
CustomModelSchema = z.object({
|
|
348
|
+
computerUse: z.object({ profile: ComputerProfileSchema }).strict().optional(),
|
|
336
349
|
id: z.string().min(1),
|
|
337
350
|
name: z.string().min(1).optional(),
|
|
338
351
|
api: z.enum([
|
|
@@ -369,6 +382,7 @@ var init_models_json = __esmMin((() => {
|
|
|
369
382
|
compat: OpenAICompatSchema.optional()
|
|
370
383
|
});
|
|
371
384
|
ModelOverrideSchema = z.object({
|
|
385
|
+
computerUse: z.object({ profile: ComputerProfileSchema }).strict().optional(),
|
|
372
386
|
name: z.string().min(1).optional(),
|
|
373
387
|
reasoning: z.boolean().optional(),
|
|
374
388
|
thinkingLevelMap: z.partialRecord(z.enum([
|
|
@@ -41,6 +41,10 @@ export declare const AgentModelsSchema: z.ZodObject<{
|
|
|
41
41
|
primary: z.ZodString;
|
|
42
42
|
fallbacks: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
43
43
|
}, z.core.$strict>>>;
|
|
44
|
+
computerUse: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
45
|
+
primary: z.ZodString;
|
|
46
|
+
fallbacks: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
47
|
+
}, z.core.$strict>>>;
|
|
44
48
|
imageGeneration: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
45
49
|
primary: z.ZodString;
|
|
46
50
|
fallbacks: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -72,6 +76,10 @@ export declare const AgentsConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
72
76
|
primary: z.ZodString;
|
|
73
77
|
fallbacks: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
74
78
|
}, z.core.$strict>>;
|
|
79
|
+
computerUse: z.ZodOptional<z.ZodObject<{
|
|
80
|
+
primary: z.ZodString;
|
|
81
|
+
fallbacks: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
82
|
+
}, z.core.$strict>>;
|
|
75
83
|
imageGeneration: z.ZodOptional<z.ZodObject<{
|
|
76
84
|
primary: z.ZodString;
|
|
77
85
|
fallbacks: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -154,6 +162,10 @@ export declare const AgentsConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
154
162
|
primary: z.ZodString;
|
|
155
163
|
fallbacks: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
156
164
|
}, z.core.$strict>>>;
|
|
165
|
+
computerUse: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
166
|
+
primary: z.ZodString;
|
|
167
|
+
fallbacks: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
168
|
+
}, z.core.$strict>>>;
|
|
157
169
|
imageGeneration: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
158
170
|
primary: z.ZodString;
|
|
159
171
|
fallbacks: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -1104,11 +1116,16 @@ export declare const VoiceConfigSchema: z.ZodOptional<z.ZodObject<{
|
|
|
1104
1116
|
maxDictationMs: z.ZodDefault<z.ZodNumber>;
|
|
1105
1117
|
maxConversationMs: z.ZodDefault<z.ZodNumber>;
|
|
1106
1118
|
bargeIn: z.ZodDefault<z.ZodBoolean>;
|
|
1119
|
+
stt: z.ZodOptional<z.ZodObject<{
|
|
1120
|
+
provider: z.ZodLiteral<"xopc-cloud">;
|
|
1121
|
+
model: z.ZodString;
|
|
1122
|
+
}, z.core.$strict>>;
|
|
1107
1123
|
tts: z.ZodOptional<z.ZodObject<{
|
|
1108
1124
|
provider: z.ZodEnum<{
|
|
1109
1125
|
alibaba: "alibaba";
|
|
1110
1126
|
"xopc-cloud": "xopc-cloud";
|
|
1111
1127
|
}>;
|
|
1128
|
+
model: z.ZodOptional<z.ZodString>;
|
|
1112
1129
|
voice: z.ZodOptional<z.ZodString>;
|
|
1113
1130
|
}, z.core.$strict>>;
|
|
1114
1131
|
omni: z.ZodOptional<z.ZodObject<{
|
|
@@ -1556,6 +1573,10 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
1556
1573
|
primary: z.ZodString;
|
|
1557
1574
|
fallbacks: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1558
1575
|
}, z.core.$strict>>;
|
|
1576
|
+
computerUse: z.ZodOptional<z.ZodObject<{
|
|
1577
|
+
primary: z.ZodString;
|
|
1578
|
+
fallbacks: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1579
|
+
}, z.core.$strict>>;
|
|
1559
1580
|
imageGeneration: z.ZodOptional<z.ZodObject<{
|
|
1560
1581
|
primary: z.ZodString;
|
|
1561
1582
|
fallbacks: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -1638,6 +1659,10 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
1638
1659
|
primary: z.ZodString;
|
|
1639
1660
|
fallbacks: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1640
1661
|
}, z.core.$strict>>>;
|
|
1662
|
+
computerUse: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1663
|
+
primary: z.ZodString;
|
|
1664
|
+
fallbacks: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1665
|
+
}, z.core.$strict>>>;
|
|
1641
1666
|
imageGeneration: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1642
1667
|
primary: z.ZodString;
|
|
1643
1668
|
fallbacks: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -1980,6 +2005,13 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
1980
2005
|
}>>;
|
|
1981
2006
|
}, z.core.$strict>>;
|
|
1982
2007
|
}, z.core.$strict>>;
|
|
2008
|
+
computer: z.ZodPrefault<z.ZodObject<{
|
|
2009
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
2010
|
+
maxActionsPerSession: z.ZodDefault<z.ZodNumber>;
|
|
2011
|
+
maxModelRequests: z.ZodDefault<z.ZodNumber>;
|
|
2012
|
+
maxSessionDurationMs: z.ZodDefault<z.ZodNumber>;
|
|
2013
|
+
idleGrantTtlMs: z.ZodDefault<z.ZodNumber>;
|
|
2014
|
+
}, z.core.$strict>>;
|
|
1983
2015
|
tunnel: z.ZodOptional<z.ZodDefault<z.ZodObject<{
|
|
1984
2016
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
1985
2017
|
brokerUrl: z.ZodDefault<z.ZodString>;
|
|
@@ -2308,11 +2340,16 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
2308
2340
|
maxDictationMs: z.ZodDefault<z.ZodNumber>;
|
|
2309
2341
|
maxConversationMs: z.ZodDefault<z.ZodNumber>;
|
|
2310
2342
|
bargeIn: z.ZodDefault<z.ZodBoolean>;
|
|
2343
|
+
stt: z.ZodOptional<z.ZodObject<{
|
|
2344
|
+
provider: z.ZodLiteral<"xopc-cloud">;
|
|
2345
|
+
model: z.ZodString;
|
|
2346
|
+
}, z.core.$strict>>;
|
|
2311
2347
|
tts: z.ZodOptional<z.ZodObject<{
|
|
2312
2348
|
provider: z.ZodEnum<{
|
|
2313
2349
|
alibaba: "alibaba";
|
|
2314
2350
|
"xopc-cloud": "xopc-cloud";
|
|
2315
2351
|
}>;
|
|
2352
|
+
model: z.ZodOptional<z.ZodString>;
|
|
2316
2353
|
voice: z.ZodOptional<z.ZodString>;
|
|
2317
2354
|
}, z.core.$strict>>;
|
|
2318
2355
|
omni: z.ZodOptional<z.ZodObject<{
|