@xopcai/xopc 0.0.231 → 0.0.232
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 +1 -0
- package/README.zh-CN.md +1 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/schema/config-schema.d.ts +3 -3
- package/dist/extensions/telegram/src/config-schema.d.ts +4 -4
- 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-M0nAY5XB.js → activity-store-VXCWz43N.js} +1 -1
- package/dist/gateway/static/root/assets/agent-avatar-dicebear-BXRaZYW8.js +1 -0
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-dR7HMaRX.js +1 -0
- package/dist/gateway/static/root/assets/agents-Bileycwe.js +1 -0
- package/dist/gateway/static/root/assets/api-wGPgL8xY.js +1 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DP7YVRPn.js → app-management-settings-panel-BJfClfPx.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CVQ5n7y6.js → appearance-settings-C_R0vUAu.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DSCia0DT.js → apps-page-CBow8pBI.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-7_DXaMTP.js → archive-plugin-DnFHkSHE.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-mmr_mHRr.js → attachment-load-DZrEwytM.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DfY-T6Ga.js → automations-page-DpkKajui.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BBntVWgv.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-CO9QMEh2.js → binary-plugins-Ckc_Csue.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CE14CVOy.js → block-editor-DAC6w-iV.js} +4 -4
- package/dist/gateway/static/root/assets/browser-settings-page-DrsMd-Po.js +8 -0
- package/dist/gateway/static/root/assets/browser-workflow-inputs-BGd7R8GO.js +1 -0
- package/dist/gateway/static/root/assets/{browser-workflows-page-1wgXyoSO.js → browser-workflows-page-DUfj7ntM.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-97gkGeSV.js +7 -0
- package/dist/gateway/static/root/assets/channels-settings-CuBsz8UI.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-C5ABr73b.js → channels-status-swr-CfboECLt.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CdRW6Euc.js → chat-terminal-dock-CA9fndbZ.js} +2 -2
- package/dist/gateway/static/root/assets/{code-editor-dFzqyDXS.js → code-editor-D4_k-6QN.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-SuL7td7Z.js +2 -0
- package/dist/gateway/static/root/assets/cron-expression-CqPu7HYJ.js +2 -0
- package/dist/gateway/static/root/assets/date-picker-C8dJsCgk.js +1 -0
- package/dist/gateway/static/root/assets/dependency-picker-Iz2wYimy.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-CMO-J3cG.js → desktop-pet-C3h40FmG.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-MmOR4A3u.js → desktop-pet-settings-YfeVVzLe.js} +1 -1
- package/dist/gateway/static/root/assets/dist-DqPZM2MH2.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DdH0dG2_.js → extension-debug-page-CChgztz_.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Clg-KktN.js → extension-page-DF6ct6_y.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-jgBsjn0F.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-api-DEHnF4Wm.js → gateway-config-api-CVajuIGL.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-config-swr-BGQn8duh.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-BbssNGid.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-B_zrtccP.js → gateway-startup-retry-D2Rnh9fX.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-CJtXu8iD.js +1 -0
- package/dist/gateway/static/root/assets/home-page-Be1o1AXQ.js +1 -0
- package/dist/gateway/static/root/assets/html-workspace-editor-C3DKAkMc.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-YKP2me5Z.js → image-generation-api-D7W2p5_8.js} +1 -1
- package/dist/gateway/static/root/assets/index-B2OJSXX9.js +70 -0
- package/dist/gateway/static/root/assets/index-rHjAElxG.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BvpEeHnm.js → keyboard-shortcuts-settings-BvHYyNus.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-COfelgk7.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-Bzvn99eH.js → local-apps-page-Cb8t2wWM.js} +1 -1
- package/dist/gateway/static/root/assets/locale-store-DLwVxS3V.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-DA8oDjeB.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-B8Jie4-J.js +1 -0
- package/dist/gateway/static/root/assets/markdown-editor-nDLmA_LF.js +2 -0
- package/dist/gateway/static/root/assets/markdown-split-BD1r4o2i.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-RxNHwlNo.js → markdown-view-B-BHEcNd.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-D8I7OGnT.js → media-plugins-BCev8fkW.js} +1 -1
- package/dist/gateway/static/root/assets/messages-Dp1OxSKt.js +3 -0
- package/dist/gateway/static/root/assets/mobile-device-api-DACoHhhk.js +1 -0
- package/dist/gateway/static/root/assets/{models-hub-cache-0RjEwafI.js → models-hub-cache-C8zjqmIv.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-api-EpgG-OQc.js → notes-api-DEdNKw0I.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CCvjGMhN.js → notes-page-BBTLjJwa.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-DICgUGPv.js +4 -0
- package/dist/gateway/static/root/assets/{oauth-api-BwNLwbI8.js → oauth-api-BNCO2YK5.js} +1 -1
- package/dist/gateway/static/root/assets/popover-select-3E24E65N.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-MmMswmOU.js → product-open-page-fEBbRekH.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-CqdkznYJ.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-dHDXpMCg.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BFZrVYfy.js → registry-api-Cvr4Qm7N.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-2feZudJw.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Dx6o7sLu.js → runtime-tools-settings-panel-BT5B74IH.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-Cdd9c4vt.js → schema-form-C4tB34S5.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-CO2JCFdy.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DxMVaqdn.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-D0YxMnhm.js → settings-form-section-D1oXhkgI.js} +1 -1
- package/dist/gateway/static/root/assets/settings-loading-skeleton-CldfX6FJ.js +1 -0
- package/dist/gateway/static/root/assets/settings-page-c3LJnbvE.js +1 -0
- package/dist/gateway/static/root/assets/settings-shell-layer-context-DCp6ykjQ.js +1 -0
- package/dist/gateway/static/root/assets/setup-status-panel-DZNHb6A5.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-DiqBn-oE.js → share-preview-page-DptCK_mk.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DakZ2AGN.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-BOiNkWJC.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-CZwhWiRl.js → skills-page-OHBeBtSg.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-kBGr8opZ.js → skills-page.utils-B9WZbOLC.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CPBs6lWi.js → system-settings-panel-Dj_DpOGw.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-D5Nbe3C8.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-Qgvo0Ga7.js → theme-store-Cpd3Gd5R.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-C4YcEiP9.js → use-autosave-DCl5Yq7N.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-CAPSUK8B.js +1 -0
- package/dist/gateway/static/root/assets/{vendor-codemirror-DRr7hFaD.js → vendor-codemirror--gTq3YAI.js} +16 -16
- package/dist/gateway/static/root/assets/voice-api-key-field-BB_ZQV8F.js +1 -0
- package/dist/gateway/static/root/assets/voice-config-api-BNiYmpl5.js +1 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CKIdPEen.js → work-discovery-overlay-BrIdtdum.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BK44Vm5W.js → workflow-run-setup-panel-hKh-uCLo.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-ahDvypGO.js +5 -0
- package/dist/gateway/static/root/index.html +16 -16
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +1 -2
- package/dist/src/agent/agent-manager.js +29 -44
- package/dist/src/agent/background-review/run-background-review.js +10 -15
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/external-tools/mcp-provider.js +3 -13
- package/dist/src/agent/image/generation/runtime.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +13 -14
- package/dist/src/agent/mcp/bundle-mcp-policy.d.ts +0 -9
- package/dist/src/agent/mcp/bundle-mcp-policy.js +1 -13
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
- package/dist/src/agent/mcp/index.js +2 -2
- package/dist/src/agent/media-generation/runtime-shared.d.ts +1 -1
- package/dist/src/agent/media-generation/runtime-shared.js +1 -1
- package/dist/src/agent/memory/create-memory-manager.js +1 -1
- package/dist/src/agent/memory/manager.d.ts +1 -1
- package/dist/src/{agent-runtime/memory-runtime.d.ts → agent/memory/runtime.d.ts} +1 -1
- package/dist/src/{agent-runtime/memory-runtime.js → agent/memory/runtime.js} +2 -3
- package/dist/src/agent/orchestration/agent-orchestrator.d.ts +0 -3
- package/dist/src/agent/orchestration/agent-orchestrator.js +1 -3
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +2 -2
- package/dist/src/agent/service.js +0 -1
- package/dist/src/agent/starter-agents.js +1 -8
- package/dist/src/agent/tools/executor.d.ts +1 -1
- package/dist/src/agent/tools/workflow-tool.js +1 -5
- package/dist/src/agent-config/index.d.ts +2 -0
- package/dist/src/agent-config/index.js +11 -0
- package/dist/src/agent-config/resolver.d.ts +11 -0
- package/dist/src/agent-config/resolver.js +113 -0
- package/dist/src/agent-config/schema.d.ts +491 -0
- package/dist/src/agent-config/schema.js +172 -0
- package/dist/src/chat-commands/builtins/config.js +2 -2
- package/dist/src/chat-commands/builtins/review.js +1 -1
- package/dist/src/chat-commands/config-paths.js +1 -1
- package/dist/src/cli/commands/agents.js +2 -1
- package/dist/src/cli/commands/config.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 +12 -4
- package/dist/src/cli/commands/image.js +3 -4
- package/dist/src/cli/commands/models.js +9 -3
- package/dist/src/cli/commands/onboard/model.js +12 -11
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/tunnel.js +3 -18
- package/dist/src/cli/utils/init-workspace-core.d.ts +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/commands/agents.config.d.ts +1 -3
- package/dist/src/commands/agents.config.js +9 -26
- package/dist/src/config/agent-model-intents.d.ts +10 -0
- package/dist/src/config/agent-model-intents.js +39 -0
- package/dist/src/config/agent-profile.d.ts +7 -9
- package/dist/src/config/agent-profile.js +30 -28
- package/dist/src/config/default-model.d.ts +1 -11
- package/dist/src/config/default-model.js +3 -11
- package/dist/src/config/index.js +3 -3
- package/dist/src/config/integration.d.ts +1 -1
- package/dist/src/config/reload.js +1 -1
- package/dist/src/config/rules.js +3 -3
- package/dist/src/config/schema.d.ts +187 -452
- package/dist/src/config/schema.js +53 -131
- package/dist/src/extensions/activation-context.js +7 -11
- package/dist/src/gateway/agent-builtin-tools.d.ts +250 -6
- package/dist/src/gateway/agent-builtin-tools.js +284 -46
- package/dist/src/gateway/agents-admin.d.ts +20 -62
- package/dist/src/gateway/agents-admin.js +36 -228
- package/dist/src/gateway/device-routes.d.ts +3 -0
- package/dist/src/gateway/device-routes.js +47 -0
- package/dist/src/gateway/global-defaults-admin.d.ts +6 -20
- package/dist/src/gateway/global-defaults-admin.js +20 -120
- package/dist/src/gateway/hono/app.js +4 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +54 -137
- package/dist/src/gateway/hono/lib/config-payload.js +2 -4
- package/dist/src/gateway/hono/middleware/auth.js +33 -1
- package/dist/src/gateway/hono/middleware/scopes.d.ts +2 -12
- package/dist/src/gateway/hono/middleware/scopes.js +9 -18
- package/dist/src/gateway/hono/routes/agents.js +64 -100
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/device-push.d.ts +2 -0
- package/dist/src/gateway/hono/routes/{mobile.js → device-push.js} +40 -18
- package/dist/src/gateway/hono/routes/devices.d.ts +4 -0
- package/dist/src/gateway/hono/routes/devices.js +214 -0
- package/dist/src/gateway/hono/routes/files.js +5 -1
- package/dist/src/gateway/hono/routes/global-defaults.js +5 -9
- package/dist/src/gateway/hono/routes/index.js +4 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +4 -20
- package/dist/src/gateway/hono/routes/models.js +2 -2
- package/dist/src/gateway/hono/routes/realtime.js +8 -1
- package/dist/src/gateway/hono/routes/status.js +9 -16
- package/dist/src/gateway/hono/routes/tunnel.d.ts +0 -2
- package/dist/src/gateway/hono/routes/tunnel.js +10 -199
- package/dist/src/gateway/image-generation-setup.d.ts +2 -2
- package/dist/src/gateway/image-generation-setup.js +8 -7
- package/dist/src/gateway/public-url.d.ts +1 -1
- package/dist/src/gateway/security/gateway-principal.d.ts +11 -0
- package/dist/src/gateway/security/gateway-principal.js +12 -0
- package/dist/src/gateway/security/gateway-scopes.d.ts +7 -0
- package/dist/src/gateway/security/gateway-scopes.js +66 -0
- package/dist/src/gateway/security/index.d.ts +2 -1
- package/dist/src/gateway/security/index.js +3 -2
- package/dist/src/gateway/service.js +7 -7
- package/dist/src/gateway/xopc-cloud-capability-setup.js +19 -21
- package/dist/src/migrations/index.d.ts +0 -1
- package/dist/src/migrations/index.js +1 -2
- package/dist/src/migrations/runner.js +1 -2
- package/dist/src/notifications/device-store.d.ts +1 -1
- package/dist/src/notifications/device-store.js +11 -11
- package/dist/src/notifications/store.js +3 -3
- package/dist/src/providers/index.js +1 -1
- package/dist/src/providers/model-reference-auditor.js +14 -9
- package/dist/src/realtime/runtime.d.ts +2 -0
- package/dist/src/realtime/runtime.js +27 -3
- package/dist/src/realtime/tickets.d.ts +6 -1
- package/dist/src/realtime/tickets.js +2 -1
- package/dist/src/remote-access/exposure-manager.js +3 -3
- package/dist/src/share/share-url.js +2 -2
- package/dist/src/storage/sqlite/device-access-repository.d.ts +54 -0
- package/dist/src/storage/sqlite/device-access-repository.js +194 -0
- package/dist/src/storage/sqlite/device-pairing-repository.d.ts +22 -0
- package/dist/src/storage/sqlite/device-pairing-repository.js +86 -0
- package/dist/src/storage/sqlite/gateway-identity-repository.d.ts +10 -0
- package/dist/src/storage/sqlite/gateway-identity-repository.js +50 -0
- package/dist/src/storage/sqlite/index.d.ts +3 -0
- package/dist/src/storage/sqlite/index.js +4 -1
- package/dist/src/storage/sqlite/migrations/138_device_access.sql +96 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/tunnel/consent.d.ts +1 -1
- package/dist/src/tunnel/consent.js +1 -1
- package/dist/src/tunnel/gateway-lifecycle.js +1 -1
- package/dist/src/tunnel/index.d.ts +1 -4
- package/dist/src/tunnel/index.js +3 -5
- package/dist/src/tunnel/tunnel-audit.d.ts +1 -1
- package/dist/src/tunnel/tunnel-config.js +1 -1
- package/dist/src/tunnel/tunnel-service.d.ts +2 -3
- package/dist/src/tunnel/tunnel-service.js +1 -20
- package/dist/src/tunnel/tunnel-types.d.ts +0 -6
- package/dist/src/workflows/draft/workflow-draft-service.js +2 -2
- package/dist/src/workflows/service/workflow-run-service.js +3 -3
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agent-avatar-dicebear-CBqUnlvL.js +0 -1
- package/dist/gateway/static/root/assets/agents-7YO6znTT.js +0 -68
- package/dist/gateway/static/root/assets/api-BywYxpaS.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-BpvD54D6.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CeESA4Oj.js +0 -8
- package/dist/gateway/static/root/assets/browser-workflow-inputs-8NC2qDRF.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-B_OXTojB.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-api-o0y9WgAI.js +0 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-D5nZecxV.js +0 -3
- package/dist/gateway/static/root/assets/channels-settings-BzmnWx6X.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-38FsOnR0.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DX6OkwFQ.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-DYSMZsms.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-DGCfX4tK.js +0 -1
- package/dist/gateway/static/root/assets/dependency-picker-DHDa4ht1.js +0 -1
- package/dist/gateway/static/root/assets/directory-picker-path-field-B9qoxDcn.js +0 -1
- package/dist/gateway/static/root/assets/dist-J_ySZvz0.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-eP3fJ2M6.js +0 -1
- package/dist/gateway/static/root/assets/file-code-corner-byQA1VfD.js +0 -1
- package/dist/gateway/static/root/assets/gateway-config-swr-BWGjnmDl.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-DKkEXXj9.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DlBPNubY.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BnOrLRfs.js +0 -1
- package/dist/gateway/static/root/assets/html-workspace-editor-bXK5tq64.js +0 -1
- package/dist/gateway/static/root/assets/index-0xQO5B_Q.js +0 -70
- package/dist/gateway/static/root/assets/index-CCyIdGuQ.css +0 -2
- package/dist/gateway/static/root/assets/local-app-workbench-page-Ch1rdUo8.js +0 -2
- package/dist/gateway/static/root/assets/locale-store-CXhjfe4q.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-zxx2ExlY.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-BQaeyOYm.js +0 -1
- package/dist/gateway/static/root/assets/markdown-editor-TWGaF7Xa.js +0 -2
- package/dist/gateway/static/root/assets/markdown-split-D9tmIiEm.js +0 -1
- package/dist/gateway/static/root/assets/messages-BMdD0LWk.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-9cgh77VH.js +0 -4
- package/dist/gateway/static/root/assets/popover-select-CccGri5Y.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-hf6pmH4p.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-By2U-Wdh.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CUcpp7CQ.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-ByI82xS1.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BCoI5IJ8.js +0 -1
- package/dist/gateway/static/root/assets/settings-loading-skeleton-y53gEKsF.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-BoE_tToG.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BQmyb5KC.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-Bf3VpZ-R.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CXHlbuGS.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-Bo0KSZ2v.js +0 -1
- package/dist/gateway/static/root/assets/typed-models-lib-q5-Vfqd8.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-Cnj7gMX2.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-BML8zCwZ.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-CB98MTwG.js +0 -5
- package/dist/src/agent-manifest/index.d.ts +0 -5
- package/dist/src/agent-manifest/index.js +0 -10
- package/dist/src/agent-manifest/preset-chain.d.ts +0 -10
- package/dist/src/agent-manifest/preset-chain.js +0 -30
- package/dist/src/agent-manifest/prompt.d.ts +0 -2
- package/dist/src/agent-manifest/prompt.js +0 -49
- package/dist/src/agent-manifest/resolver.d.ts +0 -32
- package/dist/src/agent-manifest/resolver.js +0 -114
- package/dist/src/agent-manifest/schema.d.ts +0 -695
- package/dist/src/agent-manifest/schema.js +0 -226
- package/dist/src/agent-manifest/validator.d.ts +0 -25
- package/dist/src/agent-manifest/validator.js +0 -74
- package/dist/src/agent-runtime/boundary-guard.d.ts +0 -12
- package/dist/src/agent-runtime/boundary-guard.js +0 -21
- package/dist/src/agent-runtime/index.d.ts +0 -7
- package/dist/src/agent-runtime/index.js +0 -8
- package/dist/src/agent-runtime/model-router.d.ts +0 -11
- package/dist/src/agent-runtime/model-router.js +0 -14
- package/dist/src/agent-runtime/run-trace.d.ts +0 -27
- package/dist/src/agent-runtime/run-trace.js +0 -51
- package/dist/src/agent-runtime/runtime-profile.d.ts +0 -26
- package/dist/src/agent-runtime/runtime-profile.js +0 -42
- package/dist/src/agent-runtime/tool-registry.d.ts +0 -28
- package/dist/src/agent-runtime/tool-registry.js +0 -50
- package/dist/src/agent-runtime/workflow-runtime.d.ts +0 -31
- package/dist/src/agent-runtime/workflow-runtime.js +0 -32
- package/dist/src/config/agent-typed-models.d.ts +0 -13
- package/dist/src/config/agent-typed-models.js +0 -48
- package/dist/src/gateway/capability-presets-admin.d.ts +0 -88
- package/dist/src/gateway/capability-presets-admin.js +0 -303
- package/dist/src/gateway/hono/lib/agent-model.d.ts +0 -35
- package/dist/src/gateway/hono/lib/agent-model.js +0 -97
- package/dist/src/gateway/hono/routes/capability-presets.d.ts +0 -3
- package/dist/src/gateway/hono/routes/capability-presets.js +0 -187
- package/dist/src/gateway/hono/routes/mobile.d.ts +0 -3
- package/dist/src/gateway/security/operator-scopes.d.ts +0 -37
- package/dist/src/gateway/security/operator-scopes.js +0 -147
- package/dist/src/migrations/config/default-capability-preset.d.ts +0 -10
- package/dist/src/migrations/config/default-capability-preset.js +0 -133
- package/dist/src/tunnel/enable-lan-pairing.d.ts +0 -8
- package/dist/src/tunnel/enable-lan-pairing.js +0 -41
- package/dist/src/tunnel/pair-context.d.ts +0 -36
- package/dist/src/tunnel/pair-context.js +0 -77
- package/dist/src/tunnel/pair-url.d.ts +0 -43
- package/dist/src/tunnel/pair-url.js +0 -117
- package/dist/src/tunnel/pairing-rate-limit.d.ts +0 -12
- package/dist/src/tunnel/pairing-rate-limit.js +0 -28
- package/dist/src/tunnel/pairing.d.ts +0 -21
- package/dist/src/tunnel/pairing.js +0 -103
- package/dist/src/tunnel/tunnel-qr.d.ts +0 -9
- package/dist/src/tunnel/tunnel-qr.js +0 -29
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { registerNotificationDevice, removeNotificationDevice, updateNotificationDevicePreferences } from "../../../notifications/device-store.js";
|
|
2
|
-
|
|
2
|
+
import { getGatewayPrincipal } from "../../security/gateway-principal.js";
|
|
3
|
+
//#region src/gateway/hono/routes/device-push.ts
|
|
3
4
|
function stringField(value, maxLength) {
|
|
4
5
|
return typeof value === "string" && value.trim().length > 0 && value.trim().length <= maxLength ? value.trim() : null;
|
|
5
6
|
}
|
|
@@ -34,22 +35,34 @@ function parsePermission(value) {
|
|
|
34
35
|
function parseLocale(value) {
|
|
35
36
|
return value === "en" || value === "zh" ? value : null;
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
-
|
|
38
|
+
function currentDeviceId(c) {
|
|
39
|
+
const principal = getGatewayPrincipal(c);
|
|
40
|
+
return principal.kind === "device" && principal.deviceId ? principal.deviceId : null;
|
|
41
|
+
}
|
|
42
|
+
function registerDevicePushRoutes(authenticated) {
|
|
43
|
+
authenticated.put("/api/devices/me/push", async (c) => {
|
|
44
|
+
const deviceId = currentDeviceId(c);
|
|
45
|
+
if (!deviceId) return c.json({
|
|
46
|
+
ok: false,
|
|
47
|
+
error: "Device access required"
|
|
48
|
+
}, 403);
|
|
39
49
|
const body = await c.req.json().catch(() => null);
|
|
40
|
-
|
|
50
|
+
if (body && ("id" in body || "deviceId" in body)) return c.json({
|
|
51
|
+
ok: false,
|
|
52
|
+
error: "Device identity must come from authentication"
|
|
53
|
+
}, 400);
|
|
41
54
|
const pushToken = stringField(body?.pushToken, 1024);
|
|
42
55
|
const platform = parsePlatform(body?.platform);
|
|
43
56
|
const permissions = parsePermission(body?.permissions);
|
|
44
57
|
const preferences = parsePreferences(body?.preferences);
|
|
45
58
|
const locale = parseLocale(body?.locale);
|
|
46
59
|
const appVersion = body?.appVersion === void 0 ? void 0 : stringField(body.appVersion, 128);
|
|
47
|
-
if (!
|
|
60
|
+
if (!pushToken || !platform || !permissions || !locale || preferences === null || appVersion === null) return c.json({
|
|
48
61
|
ok: false,
|
|
49
|
-
error: "Invalid
|
|
62
|
+
error: "Invalid push registration"
|
|
50
63
|
}, 400);
|
|
51
64
|
const device = registerNotificationDevice({
|
|
52
|
-
|
|
65
|
+
deviceId,
|
|
53
66
|
pushToken,
|
|
54
67
|
platform,
|
|
55
68
|
permissions,
|
|
@@ -62,28 +75,37 @@ function registerMobileRoutes(authenticated, _deps) {
|
|
|
62
75
|
device
|
|
63
76
|
}, 201);
|
|
64
77
|
});
|
|
65
|
-
authenticated.patch("/api/
|
|
78
|
+
authenticated.patch("/api/devices/me/push/preferences", async (c) => {
|
|
79
|
+
const deviceId = currentDeviceId(c);
|
|
80
|
+
if (!deviceId) return c.json({
|
|
81
|
+
ok: false,
|
|
82
|
+
error: "Device access required"
|
|
83
|
+
}, 403);
|
|
66
84
|
const preferences = parsePreferences(await c.req.json().catch(() => null));
|
|
67
85
|
if (preferences === null || preferences === void 0) return c.json({
|
|
68
86
|
ok: false,
|
|
69
87
|
error: "Invalid notification preferences"
|
|
70
88
|
}, 400);
|
|
71
|
-
const device = updateNotificationDevicePreferences(
|
|
72
|
-
|
|
73
|
-
ok: false,
|
|
74
|
-
error: "Mobile device not found"
|
|
75
|
-
}, 404);
|
|
76
|
-
return c.json({
|
|
89
|
+
const device = updateNotificationDevicePreferences(deviceId, preferences);
|
|
90
|
+
return device ? c.json({
|
|
77
91
|
ok: true,
|
|
78
92
|
device
|
|
79
|
-
})
|
|
93
|
+
}) : c.json({
|
|
94
|
+
ok: false,
|
|
95
|
+
error: "Push registration not found"
|
|
96
|
+
}, 404);
|
|
80
97
|
});
|
|
81
|
-
authenticated.delete("/api/
|
|
98
|
+
authenticated.delete("/api/devices/me/push", (c) => {
|
|
99
|
+
const deviceId = currentDeviceId(c);
|
|
100
|
+
if (!deviceId) return c.json({
|
|
101
|
+
ok: false,
|
|
102
|
+
error: "Device access required"
|
|
103
|
+
}, 403);
|
|
82
104
|
return c.json({
|
|
83
105
|
ok: true,
|
|
84
|
-
removed: removeNotificationDevice(
|
|
106
|
+
removed: removeNotificationDevice(deviceId)
|
|
85
107
|
});
|
|
86
108
|
});
|
|
87
109
|
}
|
|
88
110
|
//#endregion
|
|
89
|
-
export {
|
|
111
|
+
export { registerDevicePushRoutes };
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { runSqliteWriteTransaction } from "../../../storage/sqlite/transaction.js";
|
|
2
|
+
import { DEFAULT_MOBILE_SCOPES } from "../../security/gateway-scopes.js";
|
|
3
|
+
import { createDevice, issueDeviceTokenPair, listDevices, revokeDevice, rotateDeviceRefreshToken } from "../../../storage/sqlite/device-access-repository.js";
|
|
4
|
+
import { getGatewayIdentityPublicKeyRaw, getOrCreateGatewayIdentity, signGatewayPayload } from "../../../storage/sqlite/gateway-identity-repository.js";
|
|
5
|
+
import { consumeDevicePairingToken, createDevicePairingSetup, isDevicePairingSetupActive } from "../../../storage/sqlite/device-pairing-repository.js";
|
|
6
|
+
import { resolveSecureDeviceRoutes } from "../../device-routes.js";
|
|
7
|
+
import { getGatewayPrincipal } from "../../security/gateway-principal.js";
|
|
8
|
+
import os from "node:os";
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
//#region src/gateway/hono/routes/devices.ts
|
|
11
|
+
const refreshRequestSchema = z.strictObject({
|
|
12
|
+
refreshToken: z.string().min(1).max(256),
|
|
13
|
+
timestamp: z.number().int().positive(),
|
|
14
|
+
nonce: z.string().min(16).max(128),
|
|
15
|
+
requestId: z.string().uuid(),
|
|
16
|
+
nextRefreshToken: z.string().min(80).max(256),
|
|
17
|
+
signature: z.string().min(1).max(256)
|
|
18
|
+
});
|
|
19
|
+
const pairingExchangeSchema = z.strictObject({
|
|
20
|
+
pairingToken: z.string().min(1).max(256),
|
|
21
|
+
device: z.strictObject({
|
|
22
|
+
displayName: z.string().trim().min(1).max(80),
|
|
23
|
+
platform: z.enum(["ios", "android"]),
|
|
24
|
+
publicKeyJwk: z.strictObject({
|
|
25
|
+
kty: z.literal("EC"),
|
|
26
|
+
crv: z.literal("P-256"),
|
|
27
|
+
x: z.string().min(40).max(64),
|
|
28
|
+
y: z.string().min(40).max(64)
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
const pairingProbeSchema = z.strictObject({ pairingId: z.string().uuid() });
|
|
33
|
+
function pairingLinkPayload(input) {
|
|
34
|
+
return Buffer.from(JSON.stringify({
|
|
35
|
+
version: 2,
|
|
36
|
+
...input
|
|
37
|
+
})).toString("base64url");
|
|
38
|
+
}
|
|
39
|
+
function registerDeviceAuthPublicRoutes(app) {
|
|
40
|
+
app.post("/api/device-auth/refresh", async (c) => {
|
|
41
|
+
const parsed = refreshRequestSchema.safeParse(await c.req.json().catch(() => null));
|
|
42
|
+
if (!parsed.success) return c.json({
|
|
43
|
+
ok: false,
|
|
44
|
+
error: {
|
|
45
|
+
code: "BAD_REQUEST",
|
|
46
|
+
message: "Invalid refresh request"
|
|
47
|
+
}
|
|
48
|
+
}, 400);
|
|
49
|
+
try {
|
|
50
|
+
return c.json({
|
|
51
|
+
ok: true,
|
|
52
|
+
payload: rotateDeviceRefreshToken(parsed.data)
|
|
53
|
+
});
|
|
54
|
+
} catch (error) {
|
|
55
|
+
return c.json({
|
|
56
|
+
ok: false,
|
|
57
|
+
error: {
|
|
58
|
+
code: "REFRESH_DENIED",
|
|
59
|
+
message: error instanceof Error ? error.message : "Refresh denied"
|
|
60
|
+
}
|
|
61
|
+
}, 401);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
app.post("/api/device-pairing/probe", async (c) => {
|
|
65
|
+
const parsed = pairingProbeSchema.safeParse(await c.req.json().catch(() => null));
|
|
66
|
+
if (!parsed.success || !isDevicePairingSetupActive(parsed.data.pairingId)) return c.json({
|
|
67
|
+
ok: false,
|
|
68
|
+
error: {
|
|
69
|
+
code: "PAIRING_NOT_FOUND",
|
|
70
|
+
message: "Pairing setup not found"
|
|
71
|
+
}
|
|
72
|
+
}, 404);
|
|
73
|
+
const identity = getOrCreateGatewayIdentity();
|
|
74
|
+
const payload = Buffer.from(JSON.stringify({
|
|
75
|
+
gatewayId: identity.id,
|
|
76
|
+
pairingId: parsed.data.pairingId,
|
|
77
|
+
issuedAt: Date.now()
|
|
78
|
+
})).toString("base64url");
|
|
79
|
+
return c.json({
|
|
80
|
+
ok: true,
|
|
81
|
+
signedPayload: payload,
|
|
82
|
+
signature: signGatewayPayload(payload)
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
app.post("/api/device-pairing/exchange", async (c) => {
|
|
86
|
+
const parsed = pairingExchangeSchema.safeParse(await c.req.json().catch(() => null));
|
|
87
|
+
if (!parsed.success) return c.json({
|
|
88
|
+
ok: false,
|
|
89
|
+
error: {
|
|
90
|
+
code: "BAD_REQUEST",
|
|
91
|
+
message: "Invalid pairing request"
|
|
92
|
+
}
|
|
93
|
+
}, 400);
|
|
94
|
+
const completed = runSqliteWriteTransaction(() => {
|
|
95
|
+
const pairing = consumeDevicePairingToken(parsed.data.pairingToken);
|
|
96
|
+
if (!pairing.ok && "reason" in pairing) return {
|
|
97
|
+
success: false,
|
|
98
|
+
reason: pairing.reason
|
|
99
|
+
};
|
|
100
|
+
const device = createDevice({
|
|
101
|
+
displayName: parsed.data.device.displayName,
|
|
102
|
+
platform: parsed.data.device.platform,
|
|
103
|
+
publicKeyJwk: parsed.data.device.publicKeyJwk,
|
|
104
|
+
scopes: DEFAULT_MOBILE_SCOPES
|
|
105
|
+
});
|
|
106
|
+
return {
|
|
107
|
+
success: true,
|
|
108
|
+
device,
|
|
109
|
+
routes: pairing.routes,
|
|
110
|
+
tokens: issueDeviceTokenPair(device.id)
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
if ("reason" in completed) return c.json({
|
|
114
|
+
ok: false,
|
|
115
|
+
error: {
|
|
116
|
+
code: "PAIRING_DENIED",
|
|
117
|
+
message: `Pairing ${completed.reason}`
|
|
118
|
+
}
|
|
119
|
+
}, 401);
|
|
120
|
+
const identity = getOrCreateGatewayIdentity();
|
|
121
|
+
const payload = Buffer.from(JSON.stringify({
|
|
122
|
+
gateway: {
|
|
123
|
+
id: identity.id,
|
|
124
|
+
name: os.hostname()
|
|
125
|
+
},
|
|
126
|
+
device: {
|
|
127
|
+
id: completed.device.id,
|
|
128
|
+
scopes: completed.device.scopes
|
|
129
|
+
},
|
|
130
|
+
routes: completed.routes,
|
|
131
|
+
tokens: completed.tokens
|
|
132
|
+
})).toString("base64url");
|
|
133
|
+
return c.json({
|
|
134
|
+
ok: true,
|
|
135
|
+
signedPayload: payload,
|
|
136
|
+
signature: signGatewayPayload(payload)
|
|
137
|
+
}, 201);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
function registerDeviceRoutes(authenticated, deps) {
|
|
141
|
+
authenticated.get("/api/device-pairing/readiness", (c) => {
|
|
142
|
+
const routes = resolveSecureDeviceRoutes(deps.service.currentConfig);
|
|
143
|
+
return c.json({
|
|
144
|
+
ok: true,
|
|
145
|
+
ready: routes.length > 0,
|
|
146
|
+
routes
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
authenticated.post("/api/device-pairing/setups", (c) => {
|
|
150
|
+
const routes = resolveSecureDeviceRoutes(deps.service.currentConfig);
|
|
151
|
+
if (routes.length === 0) return c.json({
|
|
152
|
+
ok: false,
|
|
153
|
+
error: {
|
|
154
|
+
code: "NO_SECURE_ROUTE",
|
|
155
|
+
message: "Configure XOPC Secure Link, Tailscale Serve, or an HTTPS public URL first"
|
|
156
|
+
}
|
|
157
|
+
}, 409);
|
|
158
|
+
const setup = createDevicePairingSetup(routes);
|
|
159
|
+
const identity = getOrCreateGatewayIdentity();
|
|
160
|
+
const encoded = pairingLinkPayload({
|
|
161
|
+
pairingToken: setup.token,
|
|
162
|
+
gatewayId: identity.id,
|
|
163
|
+
gatewayName: os.hostname(),
|
|
164
|
+
gatewayPublicKey: getGatewayIdentityPublicKeyRaw(identity),
|
|
165
|
+
routes,
|
|
166
|
+
expiresAt: setup.expiresAt
|
|
167
|
+
});
|
|
168
|
+
return c.json({
|
|
169
|
+
ok: true,
|
|
170
|
+
setup: {
|
|
171
|
+
id: setup.id,
|
|
172
|
+
universalLink: `https://link.xopc.ai/connect#p=${encoded}`,
|
|
173
|
+
expiresAt: setup.expiresAt,
|
|
174
|
+
routes
|
|
175
|
+
}
|
|
176
|
+
}, 201);
|
|
177
|
+
});
|
|
178
|
+
authenticated.get("/api/devices", (c) => c.json({
|
|
179
|
+
ok: true,
|
|
180
|
+
devices: listDevices()
|
|
181
|
+
}));
|
|
182
|
+
authenticated.get("/api/devices/me", (c) => {
|
|
183
|
+
const principal = getGatewayPrincipal(c);
|
|
184
|
+
if (principal.kind !== "device" || !principal.deviceId) return c.json({
|
|
185
|
+
ok: false,
|
|
186
|
+
error: {
|
|
187
|
+
code: "DEVICE_REQUIRED",
|
|
188
|
+
message: "Device access required"
|
|
189
|
+
}
|
|
190
|
+
}, 403);
|
|
191
|
+
const device = listDevices().find((candidate) => candidate.id === principal.deviceId);
|
|
192
|
+
return device ? c.json({
|
|
193
|
+
ok: true,
|
|
194
|
+
device
|
|
195
|
+
}) : c.json({
|
|
196
|
+
ok: false,
|
|
197
|
+
error: {
|
|
198
|
+
code: "NOT_FOUND",
|
|
199
|
+
message: "Device not found"
|
|
200
|
+
}
|
|
201
|
+
}, 404);
|
|
202
|
+
});
|
|
203
|
+
authenticated.delete("/api/devices/:deviceId", (c) => {
|
|
204
|
+
const deviceId = c.req.param("deviceId");
|
|
205
|
+
const revoked = revokeDevice(deviceId);
|
|
206
|
+
if (revoked) deps.service.realtime.disconnectPrincipal(deviceId);
|
|
207
|
+
return c.json({
|
|
208
|
+
ok: true,
|
|
209
|
+
revoked
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
//#endregion
|
|
214
|
+
export { registerDeviceAuthPublicRoutes, registerDeviceRoutes };
|
|
@@ -35,6 +35,10 @@ function errorResponse(c, error) {
|
|
|
35
35
|
if (error instanceof FileServiceError) return c.json({ error: { message: error.message } }, error.status);
|
|
36
36
|
throw error;
|
|
37
37
|
}
|
|
38
|
+
function contentDisposition(disposition, fileName) {
|
|
39
|
+
const sanitized = fileName.replace(/[\u0000-\u001f\u007f]/g, "_");
|
|
40
|
+
return `${disposition}; filename="${sanitized.replace(/[^\x20-\x7e]/g, "_").replace(/["\\]/g, "_")}"; filename*=UTF-8''${encodeURIComponent(sanitized).replace(/['()*]/g, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`)}`;
|
|
41
|
+
}
|
|
38
42
|
async function collectFiles(files, spaceId, query, max) {
|
|
39
43
|
const output = [];
|
|
40
44
|
const directories = [""];
|
|
@@ -122,7 +126,7 @@ function registerFilesRoutes(authenticated, deps) {
|
|
|
122
126
|
if (c.req.header("if-none-match") === resource.revision) return c.body(null, 304);
|
|
123
127
|
c.header("Content-Type", resource.mimeType);
|
|
124
128
|
c.header("ETag", resource.revision);
|
|
125
|
-
c.header("Content-Disposition",
|
|
129
|
+
c.header("Content-Disposition", contentDisposition("inline", resource.name));
|
|
126
130
|
return c.body(await readFile(absolutePath));
|
|
127
131
|
} catch (error) {
|
|
128
132
|
return errorResponse(c, error);
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AgentDefaultsSchema } from "../../../agent-config/schema.js";
|
|
2
|
+
import { init_agent_config } from "../../../agent-config/index.js";
|
|
2
3
|
import { listGlobalDefaults, prepareUpdateGlobalDefaults } from "../../global-defaults-admin.js";
|
|
3
4
|
//#region src/gateway/hono/routes/global-defaults.ts
|
|
4
|
-
|
|
5
|
+
init_agent_config();
|
|
5
6
|
function parsePatchBody(raw) {
|
|
6
7
|
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return { error: "body must be an object" };
|
|
7
8
|
const body = raw;
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
const parsed = CapabilityPresetSchema.pick({ models: true }).safeParse({ models: body.models });
|
|
11
|
-
if (!parsed.success) return { error: `models ${parsed.error.issues[0]?.message ?? "is invalid"}` };
|
|
12
|
-
out.models = parsed.data.models;
|
|
13
|
-
}
|
|
14
|
-
return out;
|
|
9
|
+
const parsed = AgentDefaultsSchema.safeParse(body.defaults);
|
|
10
|
+
return parsed.success ? { defaults: parsed.data } : { error: `defaults ${parsed.error.issues[0]?.message ?? "is invalid"}` };
|
|
15
11
|
}
|
|
16
12
|
function isParseError(value) {
|
|
17
13
|
return typeof value === "object" && value !== null && "error" in value && typeof value.error === "string";
|
|
@@ -7,12 +7,13 @@ import { registerStatusRoutes } from "./status.js";
|
|
|
7
7
|
import { registerProjectsRoutes } from "./projects.js";
|
|
8
8
|
import { registerProjectSkillRoutes } from "./project-skills.js";
|
|
9
9
|
import { registerSearchRoutes } from "./search.js";
|
|
10
|
-
import {
|
|
10
|
+
import { registerDevicePushRoutes } from "./device-push.js";
|
|
11
11
|
import { registerNotificationRoutes } from "./notifications.js";
|
|
12
12
|
import { registerInteractionStateRoutes } from "./interaction-state.js";
|
|
13
13
|
import { registerComposerHistoryRoutes } from "./composer-history.js";
|
|
14
14
|
import { registerEndpointToolRoutes } from "./endpoint-tools.js";
|
|
15
15
|
import { registerRealtimeRoutes } from "./realtime.js";
|
|
16
|
+
import { registerDeviceRoutes } from "./devices.js";
|
|
16
17
|
import { registerLocalAppsRoutes } from "./local-apps.js";
|
|
17
18
|
import { registerWorkDiscoveryRoutes } from "./work-discovery.js";
|
|
18
19
|
import { registerUnderstandingSourceRoutes } from "./understanding-sources.js";
|
|
@@ -35,12 +36,13 @@ function registerCoreAuthenticatedRoutes(authenticated, deps) {
|
|
|
35
36
|
registerTaskRoutes(authenticated, deps);
|
|
36
37
|
registerProactiveRoutes(authenticated, deps);
|
|
37
38
|
registerSearchRoutes(authenticated, deps);
|
|
38
|
-
|
|
39
|
+
registerDevicePushRoutes(authenticated);
|
|
39
40
|
registerNotificationRoutes(authenticated, deps);
|
|
40
41
|
registerInteractionStateRoutes(authenticated, deps);
|
|
41
42
|
registerComposerHistoryRoutes(authenticated, deps);
|
|
42
43
|
registerEndpointToolRoutes(authenticated, deps);
|
|
43
44
|
registerRealtimeRoutes(authenticated, deps);
|
|
45
|
+
registerDeviceRoutes(authenticated, deps);
|
|
44
46
|
}
|
|
45
47
|
function registerAuthenticatedRoutes(app, authenticated, deps) {
|
|
46
48
|
registerCoreAuthenticatedRoutes(authenticated, deps);
|
|
@@ -117,15 +117,11 @@ const AUTHENTICATED_LAZY_ROUTE_BUNDLES = [
|
|
|
117
117
|
}
|
|
118
118
|
},
|
|
119
119
|
{
|
|
120
|
-
id: "
|
|
121
|
-
match: (path) => startsWithAny(path, ["/api/
|
|
120
|
+
id: "global-defaults",
|
|
121
|
+
match: (path) => startsWithAny(path, ["/api/global-defaults"]),
|
|
122
122
|
load: async () => {
|
|
123
|
-
const { registerCapabilityPresetsRoutes } = await import("./capability-presets.js");
|
|
124
123
|
const { registerGlobalDefaultsRoutes } = await import("./global-defaults.js");
|
|
125
|
-
return { register:
|
|
126
|
-
registerCapabilityPresetsRoutes(authenticated, deps);
|
|
127
|
-
registerGlobalDefaultsRoutes(authenticated, deps);
|
|
128
|
-
} };
|
|
124
|
+
return { register: registerGlobalDefaultsRoutes };
|
|
129
125
|
}
|
|
130
126
|
},
|
|
131
127
|
{
|
|
@@ -220,7 +216,7 @@ const AUTHENTICATED_LAZY_ROUTE_BUNDLES = [
|
|
|
220
216
|
},
|
|
221
217
|
{
|
|
222
218
|
id: "shares",
|
|
223
|
-
match: (path) => startsWithAny(path, ["/api/shares"]),
|
|
219
|
+
match: (path) => startsWithAny(path, ["/api/shares"]) || /^\/api\/sessions\/[^/]+\/(?:share-preview|shares|hosted-shares)(?:\/.*)?$/.test(path),
|
|
224
220
|
load: async () => {
|
|
225
221
|
const { registerShareRoutes } = await import("./shares.js");
|
|
226
222
|
return { register: registerShareRoutes };
|
|
@@ -323,18 +319,6 @@ const APP_LAZY_ROUTE_BUNDLES = [{
|
|
|
323
319
|
const { registerSharePublicRoutes } = await import("./shares.js");
|
|
324
320
|
return { registerOnApp: registerSharePublicRoutes };
|
|
325
321
|
}
|
|
326
|
-
}, {
|
|
327
|
-
id: "tunnel-public",
|
|
328
|
-
prefixes: [
|
|
329
|
-
"/api/tunnel/pair/ping",
|
|
330
|
-
"/api/tunnel/pair/validate-url",
|
|
331
|
-
"/api/tunnel/exchange-token"
|
|
332
|
-
],
|
|
333
|
-
match: (path) => path === "/api/tunnel/exchange-token" || path === "/api/tunnel/pair/ping" || path === "/api/tunnel/pair/validate-url",
|
|
334
|
-
load: async () => {
|
|
335
|
-
const { registerTunnelPublicRoutes } = await import("./tunnel.js");
|
|
336
|
-
return { registerOnApp: registerTunnelPublicRoutes };
|
|
337
|
-
}
|
|
338
322
|
}];
|
|
339
323
|
function findAuthenticatedLazyRouteBundle(path) {
|
|
340
324
|
return AUTHENTICATED_LAZY_ROUTE_BUNDLES.find((bundle) => bundle.match(path));
|
|
@@ -12,13 +12,13 @@ import "../../../capabilities/readiness/index.js";
|
|
|
12
12
|
import { getImageGenerationProvider, reloadImageGenerationProviders, resolveImageGenerationCredentialMode } from "../../../agent/image/generation/provider-registry.js";
|
|
13
13
|
import { SessionConfigStore } from "../../../session/config-store.js";
|
|
14
14
|
import { deleteCustomImageProvider, listCustomImageProviders, upsertCustomImageProvider } from "../../custom-image-providers.js";
|
|
15
|
-
import { getDomesticProviderPreset, getDomesticProviderPresetIds } from "../../../providers/domestic-presets.js";
|
|
16
|
-
import { getOnboardingFeaturedProviders, getProviderHint, getRecommendedModelsForProvider, isRecommendedModel, sortModelsForPicker, sortProvidersForPicker } from "../../../providers/presentation.js";
|
|
17
15
|
import { getAgentImageGenerationConfig, getImageGenerationCatalog, prepareImageGenerationSetup, verifyImageGenerationCredential } from "../../image-generation-setup.js";
|
|
18
16
|
import { discoverProviderModels, isProviderApiDiscoverable } from "../../../providers/model-discovery.js";
|
|
19
17
|
import { getXopcCloudCatalogCoordinator } from "../../../providers/xopc-cloud-catalog-coordinator.js";
|
|
20
18
|
import { respondStartupUnavailable } from "../lib/startup-unavailable.js";
|
|
19
|
+
import { getDomesticProviderPreset, getDomesticProviderPresetIds } from "../../../providers/domestic-presets.js";
|
|
21
20
|
import { auditModelReferences } from "../../../providers/model-reference-auditor.js";
|
|
21
|
+
import { getOnboardingFeaturedProviders, getProviderHint, getRecommendedModelsForProvider, isRecommendedModel, sortModelsForPicker, sortProvidersForPicker } from "../../../providers/presentation.js";
|
|
22
22
|
import { XopcCloudAccountError, XopcCloudAccountService } from "../../../providers/xopc-cloud-account-service.js";
|
|
23
23
|
//#region src/gateway/hono/routes/models.ts
|
|
24
24
|
init_models_json();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { realtimeClientKindSchema } from "../../../../packages/realtime-protocol/src/index.js";
|
|
2
|
+
import { getGatewayPrincipal } from "../../security/gateway-principal.js";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
//#region src/gateway/hono/routes/realtime.ts
|
|
4
5
|
const ticketRequestSchema = z.strictObject({
|
|
@@ -16,9 +17,15 @@ function registerRealtimeRoutes(authenticated, deps) {
|
|
|
16
17
|
}
|
|
17
18
|
}, 400);
|
|
18
19
|
try {
|
|
20
|
+
const principal = getGatewayPrincipal(c);
|
|
19
21
|
return c.json({
|
|
20
22
|
ok: true,
|
|
21
|
-
payload: deps.service.realtime.tickets.issue(parsed.data.clientId, parsed.data.clientKind
|
|
23
|
+
payload: deps.service.realtime.tickets.issue(parsed.data.clientId, parsed.data.clientKind, {
|
|
24
|
+
principalId: principal.principalId,
|
|
25
|
+
...principal.deviceId ? { deviceId: principal.deviceId } : {},
|
|
26
|
+
...principal.accessSessionId ? { accessSessionId: principal.accessSessionId } : {},
|
|
27
|
+
scopes: principal.scopes
|
|
28
|
+
})
|
|
22
29
|
});
|
|
23
30
|
} catch (error) {
|
|
24
31
|
return c.json({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getDefaultModelSync, init_providers, resolveModel } from "../../../providers/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { getGatewayAgentEffectiveConfig } from "../../agents-admin.js";
|
|
3
3
|
import { isSTTAvailable } from "../../../voice/stt/availability.js";
|
|
4
4
|
import { mergeSttConfigFromAppConfig } from "../../../voice/stt/config.js";
|
|
5
5
|
import "../../../voice/stt/index.js";
|
|
@@ -14,9 +14,6 @@ function stableValue(value) {
|
|
|
14
14
|
function contentHash(value) {
|
|
15
15
|
return createHash("sha256").update(JSON.stringify(stableValue(value))).digest("hex");
|
|
16
16
|
}
|
|
17
|
-
function asRecord(value) {
|
|
18
|
-
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
19
|
-
}
|
|
20
17
|
function buildEvalRuntimeIdentity(service, agentId) {
|
|
21
18
|
const config = service.currentConfig;
|
|
22
19
|
if (!config) return {
|
|
@@ -24,16 +21,13 @@ function buildEvalRuntimeIdentity(service, agentId) {
|
|
|
24
21
|
error: "Gateway configuration is unavailable",
|
|
25
22
|
status: 503
|
|
26
23
|
};
|
|
27
|
-
const effective =
|
|
24
|
+
const effective = getGatewayAgentEffectiveConfig(config, agentId);
|
|
28
25
|
if ("error" in effective) return {
|
|
29
26
|
ok: false,
|
|
30
27
|
error: effective.error,
|
|
31
28
|
status: effective.status ?? 400
|
|
32
29
|
};
|
|
33
|
-
const
|
|
34
|
-
const models = asRecord(manifest.models);
|
|
35
|
-
const tools = asRecord(manifest.tools);
|
|
36
|
-
const skills = manifest.skills ?? [];
|
|
30
|
+
const agentConfig = effective.data.config;
|
|
37
31
|
return {
|
|
38
32
|
ok: true,
|
|
39
33
|
payload: {
|
|
@@ -41,13 +35,12 @@ function buildEvalRuntimeIdentity(service, agentId) {
|
|
|
41
35
|
version: service.getHealth().version,
|
|
42
36
|
buildCommit: process.env.XOPC_BUILD_COMMIT?.trim() || process.env.GITHUB_SHA?.trim() || null,
|
|
43
37
|
agentId,
|
|
44
|
-
modelRef: models.primary
|
|
45
|
-
thinkingLevel:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
presetChain: effective.data.sources
|
|
38
|
+
modelRef: agentConfig.models.chat.primary,
|
|
39
|
+
thinkingLevel: null,
|
|
40
|
+
configHash: contentHash(agentConfig),
|
|
41
|
+
toolPolicyHash: contentHash(agentConfig.tools),
|
|
42
|
+
skillPolicyHash: contentHash(agentConfig.skills),
|
|
43
|
+
sources: effective.data.sources
|
|
51
44
|
}
|
|
52
45
|
};
|
|
53
46
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import type { Hono } from 'hono';
|
|
2
2
|
import type { AuthenticatedRouteDeps } from './deps.js';
|
|
3
|
-
import type { GatewayService } from '../../service.js';
|
|
4
|
-
export declare function registerTunnelPublicRoutes(app: Hono, service: GatewayService): void;
|
|
5
3
|
export declare function registerTunnelRoutes(authenticated: Hono, deps: AuthenticatedRouteDeps): void;
|