@xopcai/xopc 0.0.235 → 0.0.239
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
- package/dist/extensions/feishu/src/schema/config-schema.d.ts +8 -8
- package/dist/extensions/telegram/src/config-schema.d.ts +8 -8
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/config-schema.d.ts +3 -3
- package/dist/gateway/static/root/assets/{activity-store-BzswYHcj.js → activity-store-DLfkwJzZ.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-dvh9aEm6.js → agent-avatar-dicebear-C1rtpjd7.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-oW6wFuP9.js +1 -0
- package/dist/gateway/static/root/assets/agents-V-nDPOk2.js +1 -0
- package/dist/gateway/static/root/assets/{api-7zOtMbaE.js → api-IUm57Zse.js} +1 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-CRDnRN4G.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-BCYZIKqQ.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-dcvQDCvy.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-DawToDU8.js → archive-plugin-Bha1jUhj.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-DmBAKvsi.js → attachment-load-Bgfh7Ag2.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BGkF6XNH.js → automations-page-BdH131M0.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BtwzQZAR.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-B-6Ski7l.js → binary-plugins-BwXg9na-.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BgeKQN1F.js → block-editor-BngtUSNv.js} +56 -56
- package/dist/gateway/static/root/assets/browser-settings-page-kfNOKQ2x.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-4ooVX-Tx.js → browser-workflow-inputs-CHHw7Ula.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-D92g81lS.js → browser-workflows-page-Ael9sxrp.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DOymgkUM.js +7 -0
- package/dist/gateway/static/root/assets/channels-settings-YscUvFub.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-BDJvMnA_.js → channels-status-swr-CwUSKmeY.js} +1 -1
- package/dist/gateway/static/root/assets/chat-terminal-dock-DI0lYVKk.js +36 -0
- package/dist/gateway/static/root/assets/connectors-page-BtzCRQGz.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-BYmr5ZuN.js → cron-expression-CLuvPZ3b.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-FKL_b_S0.js → date-picker-D4QS8Zzn.js} +1 -1
- package/dist/gateway/static/root/assets/dependency-picker-DZn-RhEm.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-DOXjRTqK.js → desktop-pet-C6KqTQas.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-Bov3XuPO.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-BeJ1-5ID.js → extension-debug-page-DpeeYAjX.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CncDndLS.js → extension-page-Cescx_be.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BxxL0HqU.js → extension-settings-page-C_ubW61U.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-Dc6A6HyJ.js → gateway-config-api-BM79X1jC.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-R702lNJR.js → gateway-config-swr-DfMY-MLf.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-GV5KAj-l.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-2rVSUvyw.js → gateway-startup-retry-S6aB0hVI.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-CZ1KeXXU.js +1 -0
- package/dist/gateway/static/root/assets/home-page-YdVal_8I.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-B28USRCK.js → image-generation-api-DOX5uq-R.js} +1 -1
- package/dist/gateway/static/root/assets/index-7GLgmvAm.css +2 -0
- package/dist/gateway/static/root/assets/index-DKP23eMn.js +70 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Cwinks_5.js → keyboard-shortcuts-settings-Tn7xSeVT.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DCt7cbvK.js +2 -0
- package/dist/gateway/static/root/assets/local-apps-page-Co5_qKEQ.js +1 -0
- package/dist/gateway/static/root/assets/{locale-store-8k4mvYGL.js → locale-store-XDFAPNNu.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-ChfSQQSV.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-DE0o5c7Y.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-split-B6wQhwLV.js → markdown-split-CADkGbQi.js} +1 -1
- package/dist/gateway/static/root/assets/markdown-view-Y68dCxuc.css +1 -0
- package/dist/gateway/static/root/assets/markdown-view-v-O3cOpk.js +201 -0
- package/dist/gateway/static/root/assets/{media-plugins-BSEPuO76.js → media-plugins-mHodPaFz.js} +1 -1
- package/dist/gateway/static/root/assets/messages-B1HDp_j8.js +3 -0
- package/dist/gateway/static/root/assets/mobile-pairing-wizard-43FyMswX.js +1 -0
- package/dist/gateway/static/root/assets/models-hub-cache-Bngs8o1m.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-p2Pncp2B.js → notes-api-BMhFpRmW.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CPgbeO1u.js → notes-page-BMUyJStB.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-DjHIQneE.js +4 -0
- package/dist/gateway/static/root/assets/{oauth-api-DpLONwfK.js → oauth-api-B_pcOUfT.js} +1 -1
- package/dist/gateway/static/root/assets/popover-select-DBrVS3tZ.js +1 -0
- package/dist/gateway/static/root/assets/{product-delivery-tRr-7IxY.js → product-delivery-dUJgmBQZ.js} +1 -1
- package/dist/gateway/static/root/assets/product-open-page-B8cjLdm4.js +1 -0
- package/dist/gateway/static/root/assets/project-detail-page-CXD2pVgQ.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-cqKqkTwG.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-B7b0LJgI.js → registry-api-DeVvBsl4.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-UEinEd7d.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-D3TCJGy3.js → runtime-tools-settings-panel-ClCEmwPY.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DUAlwNoO.js → schema-form-0vcUqeqa.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-Cc6ve-qc.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-_J5FSEYX.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-D7nQ3Lfu.js → settings-form-section-BkdLf_sS.js} +1 -1
- package/dist/gateway/static/root/assets/settings-loading-skeleton-CAmWMaOT.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-CMAkMc3I.js → settings-page-QBTaBpBn.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-bQcSMkVr.js +1 -0
- package/dist/gateway/static/root/assets/share-preview-page-D_OuXnah.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-DJfcpok3.js +1 -0
- package/dist/gateway/static/root/assets/skeleton-BwbyijEw.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-Bbqp5HaH.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-DJRr5HFw.js → skills-page-BNcnmaTg.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-DcrBe39q.js → skills-page.utils-BWWcFShl.js} +1 -1
- package/dist/gateway/static/root/assets/system-settings-panel-BsH7b3B4.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-CcAhyw2Z.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-CpcBI73Q.js → theme-store-5-XHH7F0.js} +1 -1
- package/dist/gateway/static/root/assets/tunnel-api-D5-Hggt3.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-DDEypreQ.js → use-autosave-Dp1ycDa8.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-Dd_oMNie.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-BLa_vdXE.js → voice-api-key-field-DhrQXH3c.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-ynE-vY6I.js → voice-config-api-Bk_bVeGX.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DS3w1Fyq.js → work-discovery-overlay-B7zKAPrb.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-jQl_wmYC.js → workflow-run-setup-panel-Cek9K48F.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-T2q2Mx6H.js +5 -0
- package/dist/gateway/static/root/index.html +18 -17
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/device-pairing.js +39 -0
- package/dist/packages/gateway-contract/src/model-selection.js +7 -0
- package/dist/packages/gateway-contract/src/new-session.js +9 -2
- package/dist/packages/gateway-contract/src/turn-outcome.js +27 -2
- package/dist/src/agent/agent-manager.js +4 -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 +5 -0
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/ipc/inbox.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
- package/dist/src/agent/models/manager.d.ts +3 -0
- package/dist/src/agent/models/manager.js +9 -0
- package/dist/src/agent/prompt/sections/tooling.js +1 -0
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/session/session-config-service.d.ts +6 -2
- package/dist/src/agent/session/session-config-service.js +78 -17
- package/dist/src/agent/session/session-hydrator.d.ts +3 -4
- package/dist/src/agent/session/session-hydrator.js +19 -8
- package/dist/src/agent/session/session-inspector.d.ts +3 -1
- package/dist/src/agent/session/session-inspector.js +8 -4
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/tasks/task-judge-service.js +3 -3
- package/dist/src/agent/tools/exec-command.js +1 -0
- package/dist/src/agent/tools/publish-artifacts.d.ts +1 -0
- package/dist/src/agent/tools/publish-artifacts.js +15 -4
- package/dist/src/agent/tools/xopc-use-tool.js +4 -4
- package/dist/src/agent/transcript/thinking-types.d.ts +1 -1
- package/dist/src/agent/transcript/thinking-types.js +2 -0
- package/dist/src/agent-config/schema.d.ts +16 -16
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/automations/domain/validation.d.ts +62 -62
- package/dist/src/automations/draft/automation-draft-validator.d.ts +10 -10
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/chat-commands/builtins/thinking.js +1 -0
- package/dist/src/cli/commands/channels.js +1 -1
- package/dist/src/cli/commands/connectors.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +2 -2
- package/dist/src/cli/commands/models.js +2 -2
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.d.ts +137 -11
- package/dist/src/config/models-json.js +29 -2
- package/dist/src/config/schema.d.ts +15 -15
- package/dist/src/execution-environments/git.d.ts +27 -0
- package/dist/src/execution-environments/git.js +125 -0
- package/dist/src/execution-environments/index.d.ts +7 -0
- package/dist/src/execution-environments/index.js +8 -0
- package/dist/src/execution-environments/local-worktree-manager.d.ts +37 -0
- package/dist/src/execution-environments/local-worktree-manager.js +322 -0
- package/dist/src/execution-environments/paths.d.ts +2 -0
- package/dist/src/execution-environments/paths.js +18 -0
- package/dist/src/execution-environments/session-environment-service.d.ts +22 -0
- package/dist/src/execution-environments/session-environment-service.js +73 -0
- package/dist/src/execution-environments/store.d.ts +13 -0
- package/dist/src/execution-environments/store.js +183 -0
- package/dist/src/execution-environments/subject.d.ts +2 -0
- package/dist/src/execution-environments/subject.js +12 -0
- package/dist/src/execution-environments/types.d.ts +74 -0
- package/dist/src/execution-environments/types.js +54 -0
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/extensions/sdk/index.js +1 -1
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/custom-image-providers.d.ts +1 -1
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +4 -4
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/chat-model-config.d.ts +34 -0
- package/dist/src/gateway/hono/routes/chat-model-config.js +42 -0
- package/dist/src/gateway/hono/routes/device-pairing-approval.d.ts +3 -0
- package/dist/src/gateway/hono/routes/device-pairing-approval.js +100 -0
- package/dist/src/gateway/hono/routes/devices.js +15 -8
- package/dist/src/gateway/hono/routes/execution-environments.d.ts +3 -0
- package/dist/src/gateway/hono/routes/execution-environments.js +136 -0
- package/dist/src/gateway/hono/routes/index.js +4 -0
- package/dist/src/gateway/hono/routes/mobile-privacy.d.ts +3 -0
- package/dist/src/gateway/hono/routes/mobile-privacy.js +13 -0
- package/dist/src/gateway/hono/routes/models.js +10 -1
- package/dist/src/gateway/hono/routes/projects.js +43 -4
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +15 -1
- package/dist/src/gateway/hono/routes/session-input-handler.js +122 -52
- package/dist/src/gateway/hono/routes/sessions.js +105 -22
- package/dist/src/gateway/hono/routes/tasks.js +4 -12
- package/dist/src/gateway/mobile-privacy.d.ts +7 -0
- package/dist/src/gateway/mobile-privacy.js +102 -0
- package/dist/src/gateway/security/gateway-scopes.js +1 -0
- package/dist/src/gateway/service/agent-runner.d.ts +1 -1
- package/dist/src/gateway/service/config-coordinator.js +2 -2
- package/dist/src/gateway/service/session-input-coordinator.d.ts +2 -1
- package/dist/src/gateway/service/session-input-coordinator.js +14 -5
- package/dist/src/gateway/service/sessions-api.d.ts +4 -12
- package/dist/src/gateway/service/sessions-api.js +13 -0
- package/dist/src/gateway/service.d.ts +1 -1
- package/dist/src/gateway/service.js +8 -8
- package/dist/src/gateway/session-context-summary.d.ts +5 -0
- package/dist/src/gateway/session-context-summary.js +151 -0
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/i18n/response-language.d.ts +1 -1
- package/dist/src/infra/update-runner.js +1 -1
- package/dist/src/projects/index.js +3 -3
- package/dist/src/projects/project-kind.d.ts +7 -0
- package/dist/src/projects/project-kind.js +6 -1
- package/dist/src/projects/project-service.js +10 -2
- package/dist/src/projects/project-store.d.ts +1 -0
- package/dist/src/projects/project-store.js +10 -7
- package/dist/src/projects/types.d.ts +4 -0
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-registry.js +3 -1
- package/dist/src/providers/model-thinking.d.ts +4 -0
- package/dist/src/providers/model-thinking.js +41 -0
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/session/config-types.d.ts +1 -0
- package/dist/src/session/index.js +1 -1
- package/dist/src/session/model-config-lock.d.ts +2 -0
- package/dist/src/session/model-config-lock.js +14 -0
- package/dist/src/session/session-workspace.d.ts +2 -1
- package/dist/src/session/session-workspace.js +5 -1
- package/dist/src/session/store.js +1 -1
- package/dist/src/session/turn-outcome-projector.js +9 -9
- package/dist/src/share/hosted-session-share.js +1 -1
- package/dist/src/storage/sqlite/config-repository.js +6 -5
- package/dist/src/storage/sqlite/device-access-repository.d.ts +2 -0
- package/dist/src/storage/sqlite/device-access-repository.js +12 -2
- package/dist/src/storage/sqlite/device-pairing-approval.d.ts +19 -0
- package/dist/src/storage/sqlite/device-pairing-approval.js +154 -0
- package/dist/src/storage/sqlite/device-pairing-repository.d.ts +1 -1
- package/dist/src/storage/sqlite/device-pairing-repository.js +11 -4
- package/dist/src/storage/sqlite/index.js +2 -2
- package/dist/src/storage/sqlite/migrations/141_device_pairing_approval.sql +17 -0
- package/dist/src/storage/sqlite/migrations/142_session_input_instance.sql +1 -0
- package/dist/src/storage/sqlite/migrations/143_fixed_session_model.sql +1 -0
- package/dist/src/storage/sqlite/migrations/144_execution_environments.sql +59 -0
- package/dist/src/storage/sqlite/migrations/145_project_execution_mode.sql +5 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/row-mappers.d.ts +1 -0
- package/dist/src/storage/sqlite/row-mappers.js +3 -2
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/session-input-repository.d.ts +5 -0
- package/dist/src/storage/sqlite/session-input-repository.js +15 -4
- package/dist/src/storage/sqlite/session-repository.js +1 -1
- package/dist/src/tasks/execution-context.d.ts +3 -1
- package/dist/src/tasks/execution-context.js +7 -2
- package/dist/src/tasks/home-query-service.js +2 -2
- package/dist/src/tui/backends/embedded-backend.js +2 -2
- package/dist/src/tui/components/thinking-selector.js +1 -0
- package/dist/src/tui/tui-settings.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/user-context/config.d.ts +9 -9
- package/dist/src/work-discovery/service.d.ts +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +2 -2
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-B9tkmkUj.js +0 -1
- package/dist/gateway/static/root/assets/agents-DTXYo-7z.js +0 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-DXFTk7x6.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-D-FD5SOq.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-BT102W58.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-BRb45-_R.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-BkRWxC7D.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DfT-vWTA.js +0 -7
- package/dist/gateway/static/root/assets/channels-settings-C9oGpLR0.js +0 -1
- package/dist/gateway/static/root/assets/chat-terminal-dock-C_9LUs7G.js +0 -36
- package/dist/gateway/static/root/assets/connectors-page-SJKV6SHT.js +0 -2
- package/dist/gateway/static/root/assets/dependency-picker-BP68vqBI.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-CuG2qYoY.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-C2XcazGD.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-BjUEqkkC.js +0 -1
- package/dist/gateway/static/root/assets/home-page-DTSjwfAQ.js +0 -1
- package/dist/gateway/static/root/assets/index-BTUuTnc9.css +0 -2
- package/dist/gateway/static/root/assets/index-DFfvY8IN.js +0 -70
- package/dist/gateway/static/root/assets/local-app-workbench-page-0wntj9mK.js +0 -2
- package/dist/gateway/static/root/assets/local-apps-page-WeKm5vZ0.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-DFgJr7Zx.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-8bEvKO0R.js +0 -1
- package/dist/gateway/static/root/assets/markdown-view-B1bGSQqt.css +0 -1
- package/dist/gateway/static/root/assets/markdown-view-D02mJdoU.js +0 -201
- package/dist/gateway/static/root/assets/messages-CoovNoMn.js +0 -3
- package/dist/gateway/static/root/assets/mobile-device-api-CvjVB_TB.js +0 -1
- package/dist/gateway/static/root/assets/models-hub-cache-CYr6LzvY.js +0 -1
- package/dist/gateway/static/root/assets/notes-workbench-DIXCtwhs.js +0 -4
- package/dist/gateway/static/root/assets/popover-select-3E24E65N.js +0 -1
- package/dist/gateway/static/root/assets/product-open-page-DNHWn_26.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-6jgRJg4w.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-Bd4nXs4y.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-C_5-u9U-.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BqYAR86S.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-a146I0uZ.js +0 -1
- package/dist/gateway/static/root/assets/settings-loading-skeleton-CwGM9zKH.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-rhaERxAL.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-BzkXvuH6.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-BvsM3Im5.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-u7E0gqFo.js +0 -1
- package/dist/gateway/static/root/assets/system-settings-panel-BUsykmjx.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-C9QgWfYG.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-Ch0cfQfI.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-DyTwkdzs.js +0 -5
- /package/dist/gateway/static/root/assets/{dist-DqPZM2MH2.js → dist-DqPZM2MH.js} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { isXopcDatabaseOpen } from "../storage/sqlite/connection.js";
|
|
2
|
+
import "../storage/sqlite/index.js";
|
|
3
|
+
import { ExecutionEnvironmentStore } from "./store.js";
|
|
4
|
+
//#region src/execution-environments/subject.ts
|
|
5
|
+
function getExecutionEnvironmentForSession(sessionKey) {
|
|
6
|
+
if (!isXopcDatabaseOpen()) return void 0;
|
|
7
|
+
const store = new ExecutionEnvironmentStore();
|
|
8
|
+
const binding = store.resolveBinding(sessionKey);
|
|
9
|
+
return binding ? store.get(binding.environmentId) : void 0;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { getExecutionEnvironmentForSession };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export declare const EXECUTION_ENVIRONMENT_KINDS: readonly ["local_checkout", "managed_worktree"];
|
|
2
|
+
export type ExecutionEnvironmentKind = (typeof EXECUTION_ENVIRONMENT_KINDS)[number];
|
|
3
|
+
export declare const EXECUTION_ENVIRONMENT_STATUSES: readonly ["requested", "provisioning", "ready", "degraded", "deleting", "deleted", "error"];
|
|
4
|
+
export type ExecutionEnvironmentStatus = (typeof EXECUTION_ENVIRONMENT_STATUSES)[number];
|
|
5
|
+
export interface ExecutionEnvironment {
|
|
6
|
+
id: string;
|
|
7
|
+
projectId?: string;
|
|
8
|
+
kind: ExecutionEnvironmentKind;
|
|
9
|
+
status: ExecutionEnvironmentStatus;
|
|
10
|
+
rootPath: string;
|
|
11
|
+
repositoryRoot?: string;
|
|
12
|
+
gitCommonDir?: string;
|
|
13
|
+
baseRef?: string;
|
|
14
|
+
baseSha?: string;
|
|
15
|
+
branchRef?: string;
|
|
16
|
+
version: number;
|
|
17
|
+
lastError?: string;
|
|
18
|
+
createdAt: number;
|
|
19
|
+
updatedAt: number;
|
|
20
|
+
lastUsedAt?: number;
|
|
21
|
+
deletedAt?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface ExecutionEnvironmentBinding {
|
|
24
|
+
id: string;
|
|
25
|
+
sessionKey: string;
|
|
26
|
+
environmentId: string;
|
|
27
|
+
createdAt: number;
|
|
28
|
+
releasedAt?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface ExecutionEnvironmentEvent {
|
|
31
|
+
id: string;
|
|
32
|
+
environmentId: string;
|
|
33
|
+
fromStatus?: ExecutionEnvironmentStatus;
|
|
34
|
+
toStatus: ExecutionEnvironmentStatus;
|
|
35
|
+
reason: string;
|
|
36
|
+
metadata: Record<string, unknown>;
|
|
37
|
+
createdAt: number;
|
|
38
|
+
}
|
|
39
|
+
export interface CreateExecutionEnvironmentInput {
|
|
40
|
+
id?: string;
|
|
41
|
+
projectId?: string;
|
|
42
|
+
kind: ExecutionEnvironmentKind;
|
|
43
|
+
rootPath: string;
|
|
44
|
+
repositoryRoot?: string;
|
|
45
|
+
gitCommonDir?: string;
|
|
46
|
+
baseRef?: string;
|
|
47
|
+
baseSha?: string;
|
|
48
|
+
branchRef?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface ExecutionEnvironmentListQuery {
|
|
51
|
+
projectId?: string;
|
|
52
|
+
status?: ExecutionEnvironmentStatus;
|
|
53
|
+
includeDeleted?: boolean;
|
|
54
|
+
limit?: number;
|
|
55
|
+
}
|
|
56
|
+
export interface BindExecutionEnvironmentInput {
|
|
57
|
+
sessionKey: string;
|
|
58
|
+
environmentId: string;
|
|
59
|
+
}
|
|
60
|
+
export interface TransitionExecutionEnvironmentInput {
|
|
61
|
+
environmentId: string;
|
|
62
|
+
toStatus: ExecutionEnvironmentStatus;
|
|
63
|
+
expectedVersion: number;
|
|
64
|
+
reason: string;
|
|
65
|
+
error?: string;
|
|
66
|
+
metadata?: Record<string, unknown>;
|
|
67
|
+
}
|
|
68
|
+
export declare class ExecutionEnvironmentConflictError extends Error {
|
|
69
|
+
constructor(message: string);
|
|
70
|
+
}
|
|
71
|
+
export declare class ExecutionEnvironmentNotFoundError extends Error {
|
|
72
|
+
constructor(environmentId: string);
|
|
73
|
+
}
|
|
74
|
+
export declare function canTransitionExecutionEnvironment(fromStatus: ExecutionEnvironmentStatus, toStatus: ExecutionEnvironmentStatus): boolean;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
//#region src/execution-environments/types.ts
|
|
2
|
+
const EXECUTION_ENVIRONMENT_KINDS = ["local_checkout", "managed_worktree"];
|
|
3
|
+
const EXECUTION_ENVIRONMENT_STATUSES = [
|
|
4
|
+
"requested",
|
|
5
|
+
"provisioning",
|
|
6
|
+
"ready",
|
|
7
|
+
"degraded",
|
|
8
|
+
"deleting",
|
|
9
|
+
"deleted",
|
|
10
|
+
"error"
|
|
11
|
+
];
|
|
12
|
+
var ExecutionEnvironmentConflictError = class extends Error {
|
|
13
|
+
constructor(message) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.name = "ExecutionEnvironmentConflictError";
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
var ExecutionEnvironmentNotFoundError = class extends Error {
|
|
19
|
+
constructor(environmentId) {
|
|
20
|
+
super(`Execution environment not found: ${environmentId}`);
|
|
21
|
+
this.name = "ExecutionEnvironmentNotFoundError";
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const STATUS_TRANSITIONS = {
|
|
25
|
+
requested: [
|
|
26
|
+
"provisioning",
|
|
27
|
+
"deleting",
|
|
28
|
+
"error"
|
|
29
|
+
],
|
|
30
|
+
provisioning: [
|
|
31
|
+
"ready",
|
|
32
|
+
"degraded",
|
|
33
|
+
"deleting",
|
|
34
|
+
"error"
|
|
35
|
+
],
|
|
36
|
+
ready: [
|
|
37
|
+
"degraded",
|
|
38
|
+
"deleting",
|
|
39
|
+
"error"
|
|
40
|
+
],
|
|
41
|
+
degraded: [
|
|
42
|
+
"provisioning",
|
|
43
|
+
"deleting",
|
|
44
|
+
"error"
|
|
45
|
+
],
|
|
46
|
+
deleting: ["deleted", "error"],
|
|
47
|
+
deleted: [],
|
|
48
|
+
error: ["provisioning", "deleting"]
|
|
49
|
+
};
|
|
50
|
+
function canTransitionExecutionEnvironment(fromStatus, toStatus) {
|
|
51
|
+
return STATUS_TRANSITIONS[fromStatus].includes(toStatus);
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { EXECUTION_ENVIRONMENT_KINDS, EXECUTION_ENVIRONMENT_STATUSES, ExecutionEnvironmentConflictError, ExecutionEnvironmentNotFoundError, canTransitionExecutionEnvironment };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
-
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
4
3
|
import { init_paths, resolveExtensionsDir, resolveExtensionsLockPath } from "../config/paths.js";
|
|
4
|
+
import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
|
|
5
5
|
import { dirname, join } from "path";
|
|
6
6
|
import { existsSync } from "fs";
|
|
7
7
|
import { mkdir, readFile } from "fs/promises";
|
|
@@ -7,8 +7,8 @@ import { SlotRegistry, getSlotRegistry, registerSlotType } from "../slots.js";
|
|
|
7
7
|
import { ExtensionDiagnostics, ExtensionLoaderCacheImpl, getExtensionCache, getExtensionDiagnostics } from "../diagnostics.js";
|
|
8
8
|
import "../loader.js";
|
|
9
9
|
import { ExtensionHookRunner, createHookContext, isHookEvent } from "../hooks.js";
|
|
10
|
-
import { registerExtensionCliProgram } from "./channel-helpers.js";
|
|
11
10
|
import { defineChannelPluginEntry } from "./channel-entry.js";
|
|
11
|
+
import { registerExtensionCliProgram } from "./channel-helpers.js";
|
|
12
12
|
import { lazyFunction, lazyModule } from "./lazy.js";
|
|
13
13
|
import { createMockExtensionApi, createTestGateway } from "./testing.js";
|
|
14
14
|
//#region src/extensions/sdk/index.ts
|
|
@@ -4,8 +4,8 @@ import { init_paths, resolveBundledExtensionsDir, resolveExtensionsDir } from ".
|
|
|
4
4
|
import { init_loader, loadConfig } from "../config/loader.js";
|
|
5
5
|
import { downloadExtensionStoreZipBuffer, resolveExtensionZipDownloadUrl, resolveExtensionsStoreBaseUrl, verifyStoreArtifactSha256 } from "../agent/skills/marketplace/adapters/store/store-api-client.js";
|
|
6
6
|
import { getExtensionLockfileManager } from "./lockfile.js";
|
|
7
|
-
import { installExtensionFromStoreZip, installFromNpm } from "./install.js";
|
|
8
7
|
import { findExtension } from "./marketplace.js";
|
|
8
|
+
import { installExtensionFromStoreZip, installFromNpm } from "./install.js";
|
|
9
9
|
import { join } from "node:path";
|
|
10
10
|
import { existsSync, readFileSync, readdirSync, rmSync } from "node:fs";
|
|
11
11
|
import semver from "semver";
|
|
@@ -247,4 +247,4 @@ export declare const GATEWAY_BUILTIN_TOOLS: readonly [{
|
|
|
247
247
|
readonly zh: "使用已验证的参数执行选定的外部工具。";
|
|
248
248
|
};
|
|
249
249
|
}];
|
|
250
|
-
export declare const GATEWAY_BUILTIN_TOOL_IDS: ("automation" | "workflow" | "find" | "
|
|
250
|
+
export declare const GATEWAY_BUILTIN_TOOL_IDS: ("automation" | "workflow" | "find" | "image" | "memory_search" | "memory_get" | "web_search" | "web_fetch" | "browser_use" | "grep" | "session_search" | "read_file" | "list_dir" | "write_file" | "apply_patch" | "exec_command" | "update_plan" | "todo" | "clarify" | "dreaming" | "web_extract" | "image_generate" | "skills_list" | "skill_view" | "skill_manage" | "skills_marketplace_search" | "xopc_tool_search" | "xopc_tool_describe" | "xopc_tool_execute" | "send_message" | "send_media" | "read_media" | "create_share" | "session_status" | "tool_manual" | "delegate_task" | "skill_install" | "text_to_speech" | "execute_code" | "create_desktop_pet")[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveAgentDir, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId, resolveUserPath, validateAgentIdForNewAgent } from "../agent/agent-scope.js";
|
|
2
|
-
import { WORKSPACE_FILES, init_paths } from "../config/paths.js";
|
|
3
2
|
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
3
|
+
import { WORKSPACE_FILES, init_paths } from "../config/paths.js";
|
|
4
4
|
import { AGENT_PROFILE_MARKDOWN_SYSTEM_FILES, REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET } from "../agent/context/workspace.js";
|
|
5
5
|
import { isPathUnderWorkspace, resolveWorkspaceSafePath } from "./workspace-editor-path.js";
|
|
6
6
|
import { seedAgentProfileMarkdownFiles } from "../agent/context/workspace-seed.js";
|
|
@@ -53,8 +53,8 @@ export declare const CustomImageProviderInputSchema: z.ZodObject<{
|
|
|
53
53
|
qualities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
54
54
|
low: "low";
|
|
55
55
|
high: "high";
|
|
56
|
-
auto: "auto";
|
|
57
56
|
medium: "medium";
|
|
57
|
+
auto: "auto";
|
|
58
58
|
}>>>;
|
|
59
59
|
formats: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
60
60
|
png: "png";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { init_paths_state, resolveStateDir } from "../config/paths-state.js";
|
|
2
2
|
import { init_agent_scope, resolveAgentProfileDir } from "../agent/agent-scope.js";
|
|
3
|
-
import { init_paths, resolveConfigPath, resolveSkillsDir } from "../config/paths.js";
|
|
4
3
|
import { extractProfileAgentId } from "../config/agent-profile.js";
|
|
4
|
+
import { init_paths, resolveConfigPath, resolveSkillsDir } from "../config/paths.js";
|
|
5
5
|
import { isBareProfileMarkdownFileName, resolveProfileMarkdownPathIfBareName } from "../agent/tools/tool-paths.js";
|
|
6
6
|
import { isPathUnderWorkspace, resolveWorkspaceSafePath } from "./workspace-editor-path.js";
|
|
7
7
|
import { basename, isAbsolute, resolve } from "node:path";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { shouldSilence, stripHeartbeatToken } from "../../heartbeat/tokens.js";
|
|
4
|
+
import { appendCronEventLines } from "../../heartbeat/event-prompt.js";
|
|
4
5
|
import { isWithinActiveHours } from "../../heartbeat/active-hours.js";
|
|
5
6
|
import { isHeartbeatContentEmpty } from "../../heartbeat/content-check.js";
|
|
6
|
-
import { appendCronEventLines } from "../../heartbeat/event-prompt.js";
|
|
7
7
|
import { createHeartbeatWake } from "../../heartbeat/wake.js";
|
|
8
8
|
import { resolveHeartbeatMdPath } from "../workspace-heartbeat-path.js";
|
|
9
9
|
import { readFile } from "fs/promises";
|
|
@@ -35,7 +35,7 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
35
35
|
primary: string;
|
|
36
36
|
fallbacks: string[];
|
|
37
37
|
};
|
|
38
|
-
intents?: Partial<Record<"
|
|
38
|
+
intents?: Partial<Record<"review" | "coding" | "understanding" | "fast" | "reasoning" | "vision", {
|
|
39
39
|
primary: string;
|
|
40
40
|
fallbacks: string[];
|
|
41
41
|
}>>;
|
|
@@ -74,7 +74,7 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
74
74
|
primary: string;
|
|
75
75
|
fallbacks: string[];
|
|
76
76
|
};
|
|
77
|
-
intents: Partial<Record<"
|
|
77
|
+
intents: Partial<Record<"review" | "coding" | "understanding" | "fast" | "reasoning" | "vision", {
|
|
78
78
|
primary: string;
|
|
79
79
|
fallbacks: string[];
|
|
80
80
|
}>>;
|
|
@@ -209,7 +209,7 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
209
209
|
};
|
|
210
210
|
userContext: {
|
|
211
211
|
preferences: {
|
|
212
|
-
responseLanguage: "
|
|
212
|
+
responseLanguage: "en" | "auto" | "zh-CN";
|
|
213
213
|
};
|
|
214
214
|
dreaming: {
|
|
215
215
|
mode: "off" | "review";
|
|
@@ -221,7 +221,7 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
221
221
|
timezone?: string;
|
|
222
222
|
};
|
|
223
223
|
privacy: {
|
|
224
|
-
sensitiveWritePolicy: "allow" | "
|
|
224
|
+
sensitiveWritePolicy: "allow" | "confirm" | "deny";
|
|
225
225
|
};
|
|
226
226
|
memory: {
|
|
227
227
|
retention: {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ContextCompactionPolicySchema, UserContextDreamingSchema, UserContextPrivacySchema, init_config } from "../../../user-context/config.js";
|
|
2
2
|
import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
|
|
3
3
|
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
4
|
+
import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, getChannelSetupStatus, init_channel_catalog_service } from "../../../channels/catalog/channel-catalog-service.js";
|
|
4
5
|
import { init_models_json, loadModelsJson } from "../../../config/models-json.js";
|
|
5
6
|
import { CredentialResolver, init_credentials } from "../../../auth/credentials.js";
|
|
6
|
-
import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, getChannelSetupStatus, init_channel_catalog_service } from "../../../channels/catalog/channel-catalog-service.js";
|
|
7
7
|
import { getProviderRegistry, init_plugin_registry } from "../../../providers/plugin-registry.js";
|
|
8
8
|
import { getAllProviders, init_providers, isProviderConfigured } from "../../../providers/index.js";
|
|
9
9
|
import { normalizeConfiguredMcpServers } from "../../../config/mcp-config-normalize.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getAllModels, getAvailableModels, init_providers } from "../../../providers/index.js";
|
|
2
2
|
import { ActivationPlanner } from "../../../extensions/activation-planner.js";
|
|
3
3
|
import { mergeActivationContext } from "../../../extensions/activation-context.js";
|
|
4
|
-
import { fetchRegistry, listExtensions, searchExtensions } from "../../../extensions/marketplace.js";
|
|
5
4
|
import { buildWhenContextSnapshot } from "../../../extensions/when-context.js";
|
|
5
|
+
import { fetchRegistry, listExtensions, searchExtensions } from "../../../extensions/marketplace.js";
|
|
6
6
|
import { createOAuthAsyncHandler } from "../oauth-async.js";
|
|
7
7
|
import { createOAuthHandler } from "../oauth.js";
|
|
8
8
|
import { extensionAssetMimeType } from "../lib/extension-assets.js";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Context } from 'hono';
|
|
2
|
+
import type { AuthenticatedRouteDeps } from './deps.js';
|
|
3
|
+
export declare function patchChatModelConfig(c: Context, service: AuthenticatedRouteDeps['service'], sessionKey: string, body: Record<string, unknown>): Promise<(Response & import("hono").TypedResponse<{
|
|
4
|
+
ok: false;
|
|
5
|
+
error: string;
|
|
6
|
+
code: string;
|
|
7
|
+
}, 409, "json">) | (Response & import("hono").TypedResponse<{
|
|
8
|
+
ok: false;
|
|
9
|
+
error: string;
|
|
10
|
+
}, 400, "json">) | (Response & import("hono").TypedResponse<{
|
|
11
|
+
ok: false;
|
|
12
|
+
error: string;
|
|
13
|
+
code: "CONFIG_CHANGED" | "INVALID_MODEL" | "INVALID_THINKING";
|
|
14
|
+
}, 400 | 409, "json">) | (Response & import("hono").TypedResponse<{
|
|
15
|
+
ok: true;
|
|
16
|
+
payload: {
|
|
17
|
+
thinkingLevel: import("@earendil-works/pi-agent-core").ThinkingLevel;
|
|
18
|
+
model: string;
|
|
19
|
+
configVersion: number;
|
|
20
|
+
fixedModel: boolean;
|
|
21
|
+
reasoningLevel: import("../../../config/index.js").ReasoningLevel;
|
|
22
|
+
activityDetail: {
|
|
23
|
+
default: import("../../../config/index.js").ReasoningLevel;
|
|
24
|
+
override: import("../../../config/index.js").ReasoningLevel | null;
|
|
25
|
+
effective: import("../../../config/index.js").ReasoningLevel;
|
|
26
|
+
source: "session" | "default";
|
|
27
|
+
};
|
|
28
|
+
verboseLevel: import("../../../config/index.js").VerboseLevel;
|
|
29
|
+
effectiveWorkspacePath: string;
|
|
30
|
+
workingDirectoryLocked: boolean;
|
|
31
|
+
workspaceSource: "execution_environment" | "project" | "session_override" | "agent_default_root" | "agent_workspace";
|
|
32
|
+
userContextMode: "enabled" | "off" | "temporary";
|
|
33
|
+
};
|
|
34
|
+
}, import("hono/dist/types/utils/http-status.js").ContentfulStatusCode, "json">)>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { withModelConfigLock } from "../../../session/model-config-lock.js";
|
|
2
|
+
//#region src/gateway/hono/routes/chat-model-config.ts
|
|
3
|
+
async function patchChatModelConfig(c, service, sessionKey, body) {
|
|
4
|
+
return withModelConfigLock(sessionKey, async () => {
|
|
5
|
+
const changesModel = body.model !== void 0 || body.thinkingLevel !== void 0;
|
|
6
|
+
if (changesModel) {
|
|
7
|
+
const state = service.getSessionInputState(sessionKey);
|
|
8
|
+
if (service.sessions.getActiveRun(sessionKey).active || state.activeRunId || state.inputs.length > 0) return c.json({
|
|
9
|
+
ok: false,
|
|
10
|
+
error: "Wait for the current reply and pending inputs to finish",
|
|
11
|
+
code: "SESSION_BUSY"
|
|
12
|
+
}, 409);
|
|
13
|
+
if (body.thinkingLevel !== void 0 && typeof body.thinkingLevel !== "string") return c.json({
|
|
14
|
+
ok: false,
|
|
15
|
+
error: "Invalid thinking level"
|
|
16
|
+
}, 400);
|
|
17
|
+
if (body.configVersion !== void 0 && (!Number.isSafeInteger(body.configVersion) || Number(body.configVersion) < 0)) return c.json({
|
|
18
|
+
ok: false,
|
|
19
|
+
error: "Invalid configuration version"
|
|
20
|
+
}, 400);
|
|
21
|
+
if (body.model !== void 0 && (typeof body.model !== "string" || !body.model.trim())) return c.json({
|
|
22
|
+
ok: false,
|
|
23
|
+
error: "Select a specific model"
|
|
24
|
+
}, 400);
|
|
25
|
+
}
|
|
26
|
+
const result = await service.sessions.patchAgentConfig(sessionKey, {
|
|
27
|
+
...body,
|
|
28
|
+
...changesModel ? { fixedModel: true } : {}
|
|
29
|
+
});
|
|
30
|
+
if (!result.ok) return c.json({
|
|
31
|
+
ok: false,
|
|
32
|
+
error: result.error,
|
|
33
|
+
code: result.code
|
|
34
|
+
}, result.code === "CONFIG_CHANGED" ? 409 : 400);
|
|
35
|
+
return c.json({
|
|
36
|
+
ok: true,
|
|
37
|
+
payload: await service.sessions.getAgentConfig(sessionKey)
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { patchChatModelConfig };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { devicePairingCompleteSchema, devicePairingProofSchema, devicePairingRequestSchema } from "../../../../packages/gateway-contract/src/device-pairing.js";
|
|
2
|
+
import { getOrCreateGatewayIdentity, signGatewayPayload } from "../../../storage/sqlite/gateway-identity-repository.js";
|
|
3
|
+
import { DevicePairingError, cancelDevicePairingSetup, decideDevicePairingRequest, operateDevicePairingRequest, readDevicePairingSetup, submitDevicePairingRequest } from "../../../storage/sqlite/device-pairing-approval.js";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
//#region src/gateway/hono/routes/device-pairing-approval.ts
|
|
7
|
+
function pairingError(c, error) {
|
|
8
|
+
if (error instanceof DevicePairingError) return c.json({
|
|
9
|
+
ok: false,
|
|
10
|
+
error: {
|
|
11
|
+
code: error.code,
|
|
12
|
+
message: error.code
|
|
13
|
+
}
|
|
14
|
+
}, error.status);
|
|
15
|
+
return c.json({
|
|
16
|
+
ok: false,
|
|
17
|
+
error: {
|
|
18
|
+
code: "PAIRING_FAILED",
|
|
19
|
+
message: "Pairing could not be completed"
|
|
20
|
+
}
|
|
21
|
+
}, 500);
|
|
22
|
+
}
|
|
23
|
+
function registerPairingApprovalPublicRoutes(app) {
|
|
24
|
+
for (const action of [
|
|
25
|
+
"request",
|
|
26
|
+
"status",
|
|
27
|
+
"complete",
|
|
28
|
+
"cancel"
|
|
29
|
+
]) {
|
|
30
|
+
const path = action === "request" ? "/api/device-pairing/requests" : `/api/device-pairing/requests/:id/${action}`;
|
|
31
|
+
app.post(path, async (c) => {
|
|
32
|
+
const parsed = (action === "request" ? devicePairingRequestSchema : action === "complete" ? devicePairingCompleteSchema : devicePairingProofSchema).safeParse(await c.req.json().catch(() => null));
|
|
33
|
+
if (!parsed.success || action !== "request" && parsed.data.requestId !== c.req.param("id")) return c.json({
|
|
34
|
+
ok: false,
|
|
35
|
+
error: {
|
|
36
|
+
code: "BAD_REQUEST",
|
|
37
|
+
message: "Invalid pairing request"
|
|
38
|
+
}
|
|
39
|
+
}, 400);
|
|
40
|
+
try {
|
|
41
|
+
const result = action === "request" ? { request: submitDevicePairingRequest(parsed.data) } : operateDevicePairingRequest(action, parsed.data);
|
|
42
|
+
const signedPayload = Buffer.from(JSON.stringify({
|
|
43
|
+
...result,
|
|
44
|
+
gateway: {
|
|
45
|
+
id: getOrCreateGatewayIdentity().id,
|
|
46
|
+
name: os.hostname()
|
|
47
|
+
},
|
|
48
|
+
nonce: parsed.data.nonce,
|
|
49
|
+
issuedAt: Date.now()
|
|
50
|
+
})).toString("base64url");
|
|
51
|
+
return c.json({
|
|
52
|
+
ok: true,
|
|
53
|
+
signedPayload,
|
|
54
|
+
signature: signGatewayPayload(signedPayload)
|
|
55
|
+
});
|
|
56
|
+
} catch (error) {
|
|
57
|
+
return pairingError(c, error);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function registerPairingApprovalAdminRoutes(app) {
|
|
63
|
+
app.get("/api/device-pairing/setups/:id", (c) => {
|
|
64
|
+
try {
|
|
65
|
+
return c.json({
|
|
66
|
+
ok: true,
|
|
67
|
+
...readDevicePairingSetup(c.req.param("id"))
|
|
68
|
+
});
|
|
69
|
+
} catch (error) {
|
|
70
|
+
return pairingError(c, error);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
app.delete("/api/device-pairing/setups/:id", (c) => {
|
|
74
|
+
cancelDevicePairingSetup(c.req.param("id"));
|
|
75
|
+
return c.json({ ok: true });
|
|
76
|
+
});
|
|
77
|
+
app.post("/api/device-pairing/requests/:id/decision", async (c) => {
|
|
78
|
+
const parsed = z.strictObject({
|
|
79
|
+
decision: z.enum(["approve", "reject"]),
|
|
80
|
+
expectedRevision: z.number().int().positive()
|
|
81
|
+
}).safeParse(await c.req.json().catch(() => null));
|
|
82
|
+
if (!parsed.success) return c.json({
|
|
83
|
+
ok: false,
|
|
84
|
+
error: {
|
|
85
|
+
code: "BAD_REQUEST",
|
|
86
|
+
message: "Invalid decision"
|
|
87
|
+
}
|
|
88
|
+
}, 400);
|
|
89
|
+
try {
|
|
90
|
+
return c.json({
|
|
91
|
+
ok: true,
|
|
92
|
+
request: decideDevicePairingRequest(c.req.param("id"), parsed.data.decision, parsed.data.expectedRevision)
|
|
93
|
+
});
|
|
94
|
+
} catch (error) {
|
|
95
|
+
return pairingError(c, error);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
export { registerPairingApprovalAdminRoutes, registerPairingApprovalPublicRoutes };
|
|
@@ -5,6 +5,7 @@ import { getGatewayIdentityPublicKeyRaw, getOrCreateGatewayIdentity, signGateway
|
|
|
5
5
|
import { consumeDevicePairingToken, createDevicePairingSetup, isDevicePairingSetupActive } from "../../../storage/sqlite/device-pairing-repository.js";
|
|
6
6
|
import { resolveSecureDeviceRoutes } from "../../device-routes.js";
|
|
7
7
|
import { getGatewayPrincipal } from "../../security/gateway-principal.js";
|
|
8
|
+
import { registerPairingApprovalAdminRoutes, registerPairingApprovalPublicRoutes } from "./device-pairing-approval.js";
|
|
8
9
|
import os from "node:os";
|
|
9
10
|
import { z } from "zod";
|
|
10
11
|
//#region src/gateway/hono/routes/devices.ts
|
|
@@ -31,12 +32,10 @@ const pairingExchangeSchema = z.strictObject({
|
|
|
31
32
|
});
|
|
32
33
|
const pairingProbeSchema = z.strictObject({ pairingId: z.string().uuid() });
|
|
33
34
|
function pairingLinkPayload(input) {
|
|
34
|
-
return Buffer.from(JSON.stringify(
|
|
35
|
-
version: 2,
|
|
36
|
-
...input
|
|
37
|
-
})).toString("base64url");
|
|
35
|
+
return Buffer.from(JSON.stringify(input)).toString("base64url");
|
|
38
36
|
}
|
|
39
37
|
function registerDeviceAuthPublicRoutes(app) {
|
|
38
|
+
registerPairingApprovalPublicRoutes(app);
|
|
40
39
|
app.post("/api/device-auth/refresh", async (c) => {
|
|
41
40
|
const parsed = refreshRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
42
41
|
if (!parsed.success) return c.json({
|
|
@@ -138,15 +137,21 @@ function registerDeviceAuthPublicRoutes(app) {
|
|
|
138
137
|
});
|
|
139
138
|
}
|
|
140
139
|
function registerDeviceRoutes(authenticated, deps) {
|
|
140
|
+
registerPairingApprovalAdminRoutes(authenticated);
|
|
141
141
|
authenticated.get("/api/device-pairing/readiness", (c) => {
|
|
142
142
|
const routes = resolveSecureDeviceRoutes(deps.service.currentConfig);
|
|
143
143
|
return c.json({
|
|
144
144
|
ok: true,
|
|
145
145
|
ready: routes.length > 0,
|
|
146
|
-
routes
|
|
146
|
+
routes,
|
|
147
|
+
protocolVersions: [2, 3],
|
|
148
|
+
routeState: routes.length > 0 ? "configured" : "missing",
|
|
149
|
+
nextAction: routes.length > 0 ? "scan" : "configure-route",
|
|
150
|
+
serverTime: Date.now()
|
|
147
151
|
});
|
|
148
152
|
});
|
|
149
|
-
authenticated.post("/api/device-pairing/setups", (c) => {
|
|
153
|
+
authenticated.post("/api/device-pairing/setups", async (c) => {
|
|
154
|
+
const version = (await c.req.json().catch(() => ({}))).protocolVersion === 3 ? 3 : 2;
|
|
150
155
|
const routes = resolveSecureDeviceRoutes(deps.service.currentConfig);
|
|
151
156
|
if (routes.length === 0) return c.json({
|
|
152
157
|
ok: false,
|
|
@@ -155,9 +160,10 @@ function registerDeviceRoutes(authenticated, deps) {
|
|
|
155
160
|
message: "Configure XOPC Secure Link, Tailscale Serve, or an HTTPS public URL first"
|
|
156
161
|
}
|
|
157
162
|
}, 409);
|
|
158
|
-
const setup = createDevicePairingSetup(routes);
|
|
163
|
+
const setup = createDevicePairingSetup(routes, Date.now(), version);
|
|
159
164
|
const identity = getOrCreateGatewayIdentity();
|
|
160
165
|
const encoded = pairingLinkPayload({
|
|
166
|
+
version,
|
|
161
167
|
pairingToken: setup.token,
|
|
162
168
|
gatewayId: identity.id,
|
|
163
169
|
gatewayName: os.hostname(),
|
|
@@ -171,7 +177,8 @@ function registerDeviceRoutes(authenticated, deps) {
|
|
|
171
177
|
id: setup.id,
|
|
172
178
|
universalLink: `https://link.xopc.ai/connect#p=${encoded}`,
|
|
173
179
|
expiresAt: setup.expiresAt,
|
|
174
|
-
routes
|
|
180
|
+
routes,
|
|
181
|
+
protocolVersion: version
|
|
175
182
|
}
|
|
176
183
|
}, 201);
|
|
177
184
|
});
|