@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,22 +1,13 @@
|
|
|
1
1
|
import { init_public_url, validatePublicUrl } from "../../../config/public-url.js";
|
|
2
|
-
import { resolveGatewayEffectiveHost } from "../../../config/gateway-bind.js";
|
|
3
|
-
import { loadTunnelState } from "../../../tunnel/tunnel-state.js";
|
|
4
|
-
import { resolveReverseProxyPublicUrl } from "../../public-url.js";
|
|
5
2
|
import { extractToken } from "../../auth.js";
|
|
6
|
-
import { TUNNEL_CONSENT_REQUIRED_CODE, TunnelConsentError, assertTunnelMayStart, getTunnelConsentState } from "../../../tunnel/consent.js";
|
|
7
3
|
import { TUNNEL_REGISTRATION_SECRET_REQUIRED_CODE, TunnelRegistrationSecretError, getTunnelRegistrationSecretMeta, readTunnelRegistrationSecretFromConfigOnly, resolveTunnelBrokerUrl } from "../../../tunnel/env.js";
|
|
8
|
-
import { createPairingSecret, exchangePairingSecretOnce, getCachedPairingExchange } from "../../../tunnel/pairing.js";
|
|
9
4
|
import { logTunnelAudit } from "../../../tunnel/tunnel-audit.js";
|
|
10
5
|
import { getTunnelService, hashGatewayToken } from "../../../tunnel/tunnel-service.js";
|
|
6
|
+
import { TUNNEL_CONSENT_REQUIRED_CODE, TunnelConsentError, assertTunnelMayStart, getTunnelConsentState } from "../../../tunnel/consent.js";
|
|
11
7
|
import { configureTunnelFromGatewayConfig } from "../../../tunnel/gateway-lifecycle.js";
|
|
12
8
|
import { applyTunnelConsentToConfig, mergeTunnelConfigPatch, setTunnelEnabledInConfig } from "../../../tunnel/tunnel-config.js";
|
|
13
|
-
import { getClientIpFromHeaders } from "../../security/loopback.js";
|
|
14
|
-
import { applyLanPairingGatewayPatch } from "../../../tunnel/enable-lan-pairing.js";
|
|
15
9
|
import { consumeTunnelMutationLimit } from "../../../tunnel/tunnel-rate-limit.js";
|
|
16
10
|
import "../../../tunnel/index.js";
|
|
17
|
-
import { buildMobileConnectUrlOrder, resolveMobilePairLanUrl, validateMobilePairBaseUrl } from "../../../tunnel/pair-url.js";
|
|
18
|
-
import { buildMobilePairContext } from "../../../tunnel/pair-context.js";
|
|
19
|
-
import { consumePairingExchangeFailLimit } from "../../../tunnel/pairing-rate-limit.js";
|
|
20
11
|
import { provisionTunnelRegistrationKey } from "../../../tunnel/xopc-cloud-registration.js";
|
|
21
12
|
//#region src/gateway/hono/routes/tunnel.ts
|
|
22
13
|
init_public_url();
|
|
@@ -64,188 +55,17 @@ function createTunnelMutationRateLimitMiddleware() {
|
|
|
64
55
|
await next();
|
|
65
56
|
};
|
|
66
57
|
}
|
|
67
|
-
function registerTunnelPublicRoutes(app, service) {
|
|
68
|
-
app.get("/api/tunnel/pair/ping", async (c) => {
|
|
69
|
-
const config = service.currentConfig;
|
|
70
|
-
const status = getTunnelService().getStatus();
|
|
71
|
-
const context = buildMobilePairContext({
|
|
72
|
-
config,
|
|
73
|
-
tunnelPublicUrl: status.publicUrl,
|
|
74
|
-
tunnelConnected: status.state === "connected",
|
|
75
|
-
reverseProxyPublicUrl: resolveReverseProxyPublicUrl(config)
|
|
76
|
-
});
|
|
77
|
-
return c.json({
|
|
78
|
-
ok: true,
|
|
79
|
-
service: "xopc-gateway",
|
|
80
|
-
mobilePairing: true,
|
|
81
|
-
port: context.port,
|
|
82
|
-
bindMode: context.bindMode,
|
|
83
|
-
listenHost: context.listenHost,
|
|
84
|
-
pairingReady: context.pairingReady,
|
|
85
|
-
blockReason: context.blockReason ?? null,
|
|
86
|
-
tunnelConnected: status.state === "connected",
|
|
87
|
-
reverseProxyConfigured: Boolean(resolveReverseProxyPublicUrl(config)),
|
|
88
|
-
connectUrls: context.connectUrls
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
app.post("/api/tunnel/pair/validate-url", async (c) => {
|
|
92
|
-
let body;
|
|
93
|
-
try {
|
|
94
|
-
body = await c.req.json();
|
|
95
|
-
} catch {
|
|
96
|
-
return c.json({ error: "Invalid JSON body" }, 400);
|
|
97
|
-
}
|
|
98
|
-
const result = validateMobilePairBaseUrl(typeof body.baseUrl === "string" ? body.baseUrl : "");
|
|
99
|
-
if (result.ok === false) return c.json({
|
|
100
|
-
ok: false,
|
|
101
|
-
code: result.code,
|
|
102
|
-
message: result.message
|
|
103
|
-
});
|
|
104
|
-
return c.json({
|
|
105
|
-
ok: true,
|
|
106
|
-
url: result.url,
|
|
107
|
-
loopback: false,
|
|
108
|
-
probePath: "/api/tunnel/pair/ping"
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
app.post("/api/tunnel/exchange-token", async (c) => {
|
|
112
|
-
const clientIp = getClientIpFromHeaders({ get: (name) => c.req.header(name) ?? void 0 }) ?? "unknown";
|
|
113
|
-
let body;
|
|
114
|
-
try {
|
|
115
|
-
body = await c.req.json();
|
|
116
|
-
} catch {
|
|
117
|
-
return c.json({ error: "Invalid JSON body" }, 400);
|
|
118
|
-
}
|
|
119
|
-
const pairingSecret = typeof body.pairingSecret === "string" ? body.pairingSecret.trim() : "";
|
|
120
|
-
if (!pairingSecret) return c.json({ error: "pairingSecret required" }, 400);
|
|
121
|
-
const cached = getCachedPairingExchange(pairingSecret);
|
|
122
|
-
if (cached) {
|
|
123
|
-
logTunnelAudit("tunnel.exchange_token", {
|
|
124
|
-
ok: true,
|
|
125
|
-
clientIp,
|
|
126
|
-
phase: "pairing_exchange",
|
|
127
|
-
replay: true
|
|
128
|
-
}, "Pairing secret replayed (duplicate mobile exchange)");
|
|
129
|
-
return c.json(cached);
|
|
130
|
-
}
|
|
131
|
-
const token = service.getAuthToken();
|
|
132
|
-
if (!token) return c.json({ error: "Gateway token not configured" }, 500);
|
|
133
|
-
const persisted = loadTunnelState();
|
|
134
|
-
const config = service.currentConfig;
|
|
135
|
-
const tunnelUrl = persisted?.publicUrl?.trim() || null;
|
|
136
|
-
const reverseProxyUrl = resolveReverseProxyPublicUrl(config);
|
|
137
|
-
const lanUrl = resolveMobilePairLanUrl(config);
|
|
138
|
-
const connectUrls = buildMobileConnectUrlOrder({
|
|
139
|
-
reverseProxyUrl,
|
|
140
|
-
baseUrl: reverseProxyUrl ?? tunnelUrl,
|
|
141
|
-
lanUrl,
|
|
142
|
-
tunnelUrl
|
|
143
|
-
});
|
|
144
|
-
const advertisedBaseUrl = reverseProxyUrl ?? tunnelUrl;
|
|
145
|
-
const payload = await exchangePairingSecretOnce(pairingSecret, () => ({
|
|
146
|
-
token,
|
|
147
|
-
baseUrl: advertisedBaseUrl,
|
|
148
|
-
lanUrl,
|
|
149
|
-
connectUrls
|
|
150
|
-
}));
|
|
151
|
-
if (!payload) {
|
|
152
|
-
const limited = consumePairingExchangeFailLimit(clientIp);
|
|
153
|
-
if (!limited.allowed) c.header("Retry-After", String(Math.ceil(limited.retryAfterMs / 1e3)));
|
|
154
|
-
logTunnelAudit("tunnel.exchange_token", {
|
|
155
|
-
ok: false,
|
|
156
|
-
clientIp,
|
|
157
|
-
phase: "pairing_exchange"
|
|
158
|
-
}, "Pairing exchange denied: invalid or expired secret");
|
|
159
|
-
return c.json({
|
|
160
|
-
error: "Invalid or expired pairing secret",
|
|
161
|
-
code: "PAIRING_INVALID"
|
|
162
|
-
}, 401);
|
|
163
|
-
}
|
|
164
|
-
logTunnelAudit("tunnel.exchange_token", {
|
|
165
|
-
ok: true,
|
|
166
|
-
clientIp,
|
|
167
|
-
subdomain: persisted?.subdomain ?? null,
|
|
168
|
-
phase: "pairing_exchange"
|
|
169
|
-
}, "Pairing secret exchanged for gateway token");
|
|
170
|
-
return c.json(payload);
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
58
|
function registerTunnelRoutes(authenticated, deps) {
|
|
174
59
|
const { strictRateLimitMiddleware } = deps;
|
|
175
60
|
const tunnel = getTunnelService();
|
|
176
61
|
const tunnelMutationLimit = createTunnelMutationRateLimitMiddleware();
|
|
177
|
-
authenticated.get("/api/tunnel/pair/context", async (c) => {
|
|
178
|
-
const config = deps.service.currentConfig;
|
|
179
|
-
const status = tunnel.getStatus();
|
|
180
|
-
const context = buildMobilePairContext({
|
|
181
|
-
config,
|
|
182
|
-
tunnelPublicUrl: status.publicUrl,
|
|
183
|
-
tunnelConnected: status.state === "connected",
|
|
184
|
-
reverseProxyPublicUrl: resolveReverseProxyPublicUrl(config)
|
|
185
|
-
});
|
|
186
|
-
return c.json(context);
|
|
187
|
-
});
|
|
188
|
-
authenticated.post("/api/tunnel/pair/enable-lan", tunnelMutationLimit, async (c) => {
|
|
189
|
-
const token = requireGatewayToken(c);
|
|
190
|
-
if (!token) return c.json({ error: "Gateway token required" }, 401);
|
|
191
|
-
const config = deps.service.currentConfig;
|
|
192
|
-
const patchResult = applyLanPairingGatewayPatch(config);
|
|
193
|
-
if (patchResult.ok === false) return c.json({
|
|
194
|
-
ok: false,
|
|
195
|
-
error: {
|
|
196
|
-
message: patchResult.message,
|
|
197
|
-
code: "LAN_PAIRING_CONFIG"
|
|
198
|
-
}
|
|
199
|
-
}, 400);
|
|
200
|
-
if (patchResult.changed) {
|
|
201
|
-
const saveResult = await deps.service.saveConfig(config);
|
|
202
|
-
if (!saveResult.saved) return c.json({
|
|
203
|
-
ok: false,
|
|
204
|
-
error: {
|
|
205
|
-
message: saveResult.error ?? "Failed to save config",
|
|
206
|
-
code: "SAVE_FAILED"
|
|
207
|
-
}
|
|
208
|
-
}, 500);
|
|
209
|
-
logTunnelAudit("tunnel.enable_lan_pairing", { gatewayTokenHash: hashGatewayToken(token).slice(0, 12) }, "Gateway bind switched to LAN for mobile pairing");
|
|
210
|
-
}
|
|
211
|
-
const status = tunnel.getStatus();
|
|
212
|
-
let context = buildMobilePairContext({
|
|
213
|
-
config: deps.service.currentConfig,
|
|
214
|
-
tunnelPublicUrl: status.publicUrl,
|
|
215
|
-
tunnelConnected: status.state === "connected",
|
|
216
|
-
reverseProxyPublicUrl: resolveReverseProxyPublicUrl(deps.service.currentConfig)
|
|
217
|
-
});
|
|
218
|
-
if (patchResult.changed) context = {
|
|
219
|
-
...context,
|
|
220
|
-
pairingReady: false,
|
|
221
|
-
blockReason: "GATEWAY_LOOPBACK_ONLY"
|
|
222
|
-
};
|
|
223
|
-
return c.json({
|
|
224
|
-
ok: true,
|
|
225
|
-
requiresRestart: patchResult.changed,
|
|
226
|
-
context
|
|
227
|
-
});
|
|
228
|
-
});
|
|
229
|
-
authenticated.post("/api/tunnel/pair", tunnelMutationLimit, async (c) => {
|
|
230
|
-
const token = requireGatewayToken(c);
|
|
231
|
-
if (!token) return c.json({ error: "Gateway token required" }, 401);
|
|
232
|
-
const { secret, expiresAt } = createPairingSecret();
|
|
233
|
-
logTunnelAudit("tunnel.pair", {
|
|
234
|
-
expiresAt: expiresAt.toISOString(),
|
|
235
|
-
gatewayTokenHash: hashGatewayToken(token).slice(0, 12)
|
|
236
|
-
}, "Mobile pairing session created");
|
|
237
|
-
return c.json({
|
|
238
|
-
pairingSecret: secret,
|
|
239
|
-
expiresAt: expiresAt.toISOString()
|
|
240
|
-
});
|
|
241
|
-
});
|
|
242
62
|
/**
|
|
243
63
|
* Probe a candidate reverse-proxy URL before persisting it. The check round-trips
|
|
244
|
-
* a `GET /api/
|
|
64
|
+
* a `GET /api/health` and validates the response identifies as
|
|
245
65
|
* `service: 'xopc-gateway'`. Surface-area errors are mapped to stable codes so
|
|
246
66
|
* the UI can render targeted hints (TLS / DNS / wrong service / blocked path).
|
|
247
67
|
*/
|
|
248
|
-
authenticated.post("/api/tunnel/
|
|
68
|
+
authenticated.post("/api/tunnel/probe-public", tunnelMutationLimit, async (c) => {
|
|
249
69
|
if (!requireGatewayToken(c)) return c.json({ error: "Gateway token required" }, 401);
|
|
250
70
|
let body;
|
|
251
71
|
try {
|
|
@@ -263,7 +83,7 @@ function registerTunnelRoutes(authenticated, deps) {
|
|
|
263
83
|
code: validation.code,
|
|
264
84
|
message: validation.message
|
|
265
85
|
});
|
|
266
|
-
const pingUrl = `${validation.url}/api/
|
|
86
|
+
const pingUrl = `${validation.url}/api/health`;
|
|
267
87
|
const startedAt = Date.now();
|
|
268
88
|
let response;
|
|
269
89
|
try {
|
|
@@ -305,7 +125,7 @@ function registerTunnelRoutes(authenticated, deps) {
|
|
|
305
125
|
message: "Response was not JSON"
|
|
306
126
|
});
|
|
307
127
|
}
|
|
308
|
-
if (!parsed || parsed.
|
|
128
|
+
if (!parsed || parsed.status !== "ok" && parsed.status !== "starting") return c.json({
|
|
309
129
|
ok: false,
|
|
310
130
|
code: "NOT_XOPC_GATEWAY",
|
|
311
131
|
message: "Endpoint did not identify as an xopc gateway"
|
|
@@ -314,7 +134,7 @@ function registerTunnelRoutes(authenticated, deps) {
|
|
|
314
134
|
ok: true,
|
|
315
135
|
url: validation.url,
|
|
316
136
|
latencyMs: Date.now() - startedAt,
|
|
317
|
-
|
|
137
|
+
gatewayReady: true
|
|
318
138
|
});
|
|
319
139
|
});
|
|
320
140
|
authenticated.get("/api/tunnel/status", async (c) => {
|
|
@@ -391,7 +211,7 @@ function registerTunnelRoutes(authenticated, deps) {
|
|
|
391
211
|
}
|
|
392
212
|
const port = config.gateway.port ?? 18790;
|
|
393
213
|
try {
|
|
394
|
-
|
|
214
|
+
await tunnel.start(port, token);
|
|
395
215
|
setTunnelEnabledInConfig(config, true);
|
|
396
216
|
const saved = await deps.service.saveConfig(config);
|
|
397
217
|
if (!saved.saved) {
|
|
@@ -401,10 +221,8 @@ function registerTunnelRoutes(authenticated, deps) {
|
|
|
401
221
|
}
|
|
402
222
|
const status = tunnel.getStatus();
|
|
403
223
|
return c.json({
|
|
404
|
-
publicUrl:
|
|
405
|
-
subdomain: status.subdomain
|
|
406
|
-
qrPayload: qr.qrPayload,
|
|
407
|
-
lanUrl: qr.lanUrl
|
|
224
|
+
publicUrl: status.publicUrl,
|
|
225
|
+
subdomain: status.subdomain
|
|
408
226
|
});
|
|
409
227
|
} catch (err) {
|
|
410
228
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -436,13 +254,6 @@ function registerTunnelRoutes(authenticated, deps) {
|
|
|
436
254
|
released
|
|
437
255
|
});
|
|
438
256
|
});
|
|
439
|
-
authenticated.get("/api/tunnel/qr", async (c) => {
|
|
440
|
-
const port = deps.service.currentConfig.gateway.port ?? 18790;
|
|
441
|
-
const host = resolveGatewayEffectiveHost(deps.service.currentConfig);
|
|
442
|
-
if (!requireGatewayToken(c)) return c.json({ error: "Gateway token required" }, 401);
|
|
443
|
-
const qr = await tunnel.buildQr(port, host);
|
|
444
|
-
return c.json(qr);
|
|
445
|
-
});
|
|
446
257
|
authenticated.get("/api/tunnel/transport-status", async (c) => {
|
|
447
258
|
return c.json({ transport: { tls: "broker_terminated" } });
|
|
448
259
|
});
|
|
@@ -462,4 +273,4 @@ function registerTunnelRoutes(authenticated, deps) {
|
|
|
462
273
|
});
|
|
463
274
|
}
|
|
464
275
|
//#endregion
|
|
465
|
-
export {
|
|
276
|
+
export { registerTunnelRoutes };
|
|
@@ -14,9 +14,9 @@ export declare function getAgentImageGenerationConfig(config: Config, agentIdRaw
|
|
|
14
14
|
agentId: string;
|
|
15
15
|
model: {
|
|
16
16
|
primary: string;
|
|
17
|
-
fallbacks
|
|
17
|
+
fallbacks: string[];
|
|
18
|
+
autoProviderFallback: boolean;
|
|
18
19
|
timeoutMs?: number;
|
|
19
|
-
autoProviderFallback?: boolean;
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
export declare function prepareImageGenerationSetup(config: Config, agentIdRaw: string, input: ImageGenerationSetupInput): {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConfigSchema, init_schema } from "../config/schema.js";
|
|
2
2
|
import { init_agent_scope, normalizeAgentId } from "../agent/agent-scope.js";
|
|
3
|
-
import {
|
|
3
|
+
import { resolveEffectiveAgentConfigForAgent } from "../config/agent-profile.js";
|
|
4
4
|
import { fetchWithTimeoutGuarded } from "../media-shared/http/provider-http.js";
|
|
5
5
|
import "../media-shared/http/index.js";
|
|
6
6
|
import { getImageGenerationProvider, listImageGenerationProvidersSummary } from "../agent/image/generation/provider-registry.js";
|
|
@@ -56,7 +56,7 @@ function getAgentImageGenerationConfig(config, agentIdRaw) {
|
|
|
56
56
|
if (!config.agents.list.some((entry) => entry.enabled !== false && normalizeAgentId(entry.id) === agentId)) throw new Error(`Agent not found: ${agentId}`);
|
|
57
57
|
return {
|
|
58
58
|
agentId,
|
|
59
|
-
model:
|
|
59
|
+
model: resolveEffectiveAgentConfigForAgent(config, agentId).config.models.imageGeneration ?? null
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
function prepareImageGenerationSetup(config, agentIdRaw, input) {
|
|
@@ -96,11 +96,12 @@ function prepareImageGenerationSetup(config, agentIdRaw, input) {
|
|
|
96
96
|
};
|
|
97
97
|
const entry = next.agents.list[index];
|
|
98
98
|
entry.models = {
|
|
99
|
-
...entry.models ?? {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
...entry.models ?? {},
|
|
100
|
+
imageGeneration: {
|
|
101
|
+
primary: `${providerId}/${modelId}`,
|
|
102
|
+
fallbacks: [],
|
|
103
|
+
autoProviderFallback: false
|
|
104
|
+
}
|
|
104
105
|
};
|
|
105
106
|
const parsed = ConfigSchema.safeParse(next);
|
|
106
107
|
if (!parsed.success) return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Runtime accessors for `gateway.publicUrl` (the user-deployed reverse-proxy
|
|
3
3
|
* URL). Centralizes the "is it configured?" + "normalized origin" lookup so
|
|
4
|
-
* callers (
|
|
4
|
+
* callers (device access, CORS allowlist, UI status) all agree
|
|
5
5
|
* on the same value.
|
|
6
6
|
*/
|
|
7
7
|
import type { Config } from '../config/schema.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Context } from 'hono';
|
|
2
|
+
import type { GatewayScope } from './gateway-scopes.js';
|
|
3
|
+
export type GatewayPrincipal = {
|
|
4
|
+
kind: 'owner' | 'device' | 'trusted-proxy';
|
|
5
|
+
principalId: string;
|
|
6
|
+
deviceId?: string;
|
|
7
|
+
accessSessionId?: string;
|
|
8
|
+
scopes: readonly GatewayScope[];
|
|
9
|
+
};
|
|
10
|
+
export declare function setGatewayPrincipal(c: Context, principal: GatewayPrincipal): void;
|
|
11
|
+
export declare function getGatewayPrincipal(c: Context): GatewayPrincipal;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/gateway/security/gateway-principal.ts
|
|
2
|
+
const PRINCIPAL_CONTEXT_KEY = "gatewayPrincipal";
|
|
3
|
+
function setGatewayPrincipal(c, principal) {
|
|
4
|
+
c.set(PRINCIPAL_CONTEXT_KEY, principal);
|
|
5
|
+
}
|
|
6
|
+
function getGatewayPrincipal(c) {
|
|
7
|
+
const principal = c.get(PRINCIPAL_CONTEXT_KEY);
|
|
8
|
+
if (!principal) throw new Error("Gateway principal is unavailable");
|
|
9
|
+
return principal;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { getGatewayPrincipal, setGatewayPrincipal };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const GATEWAY_SCOPES: readonly ["gateway.status", "agents.read", "agents.run", "sessions.read", "sessions.write", "workspace.read", "workspace.write", "tasks.read", "tasks.write", "automations.read", "automations.write", "notifications.self", "device.self", "gateway.admin"];
|
|
2
|
+
export type GatewayScope = typeof GATEWAY_SCOPES[number];
|
|
3
|
+
export declare const DEFAULT_MOBILE_SCOPES: readonly GatewayScope[];
|
|
4
|
+
export declare function isGatewayScope(value: unknown): value is GatewayScope;
|
|
5
|
+
export declare function parseGatewayScopes(value: string): GatewayScope[];
|
|
6
|
+
export declare function requiredGatewayScope(method: string, path: string): GatewayScope;
|
|
7
|
+
export declare function hasGatewayScope(granted: readonly GatewayScope[], required: GatewayScope): boolean;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
//#region src/gateway/security/gateway-scopes.ts
|
|
2
|
+
const GATEWAY_SCOPES = [
|
|
3
|
+
"gateway.status",
|
|
4
|
+
"agents.read",
|
|
5
|
+
"agents.run",
|
|
6
|
+
"sessions.read",
|
|
7
|
+
"sessions.write",
|
|
8
|
+
"workspace.read",
|
|
9
|
+
"workspace.write",
|
|
10
|
+
"tasks.read",
|
|
11
|
+
"tasks.write",
|
|
12
|
+
"automations.read",
|
|
13
|
+
"automations.write",
|
|
14
|
+
"notifications.self",
|
|
15
|
+
"device.self",
|
|
16
|
+
"gateway.admin"
|
|
17
|
+
];
|
|
18
|
+
const KNOWN_GATEWAY_SCOPES = new Set(GATEWAY_SCOPES);
|
|
19
|
+
const DEFAULT_MOBILE_SCOPES = [
|
|
20
|
+
"gateway.status",
|
|
21
|
+
"agents.read",
|
|
22
|
+
"agents.run",
|
|
23
|
+
"sessions.read",
|
|
24
|
+
"sessions.write",
|
|
25
|
+
"workspace.read",
|
|
26
|
+
"workspace.write",
|
|
27
|
+
"tasks.read",
|
|
28
|
+
"tasks.write",
|
|
29
|
+
"automations.read",
|
|
30
|
+
"automations.write",
|
|
31
|
+
"notifications.self",
|
|
32
|
+
"device.self"
|
|
33
|
+
];
|
|
34
|
+
function isGatewayScope(value) {
|
|
35
|
+
return typeof value === "string" && KNOWN_GATEWAY_SCOPES.has(value);
|
|
36
|
+
}
|
|
37
|
+
function parseGatewayScopes(value) {
|
|
38
|
+
const parsed = JSON.parse(value);
|
|
39
|
+
if (!Array.isArray(parsed) || !parsed.every(isGatewayScope)) throw new Error("Stored device scopes are invalid");
|
|
40
|
+
return [...new Set(parsed)];
|
|
41
|
+
}
|
|
42
|
+
function methodScope(method, read, write) {
|
|
43
|
+
return method === "GET" ? read : write;
|
|
44
|
+
}
|
|
45
|
+
function requiredGatewayScope(method, path) {
|
|
46
|
+
if (path === "/api/realtime/tickets" || path.startsWith("/api/status")) return "gateway.status";
|
|
47
|
+
if (path === "/api/device-auth/refresh" || path === "/api/devices/me") return "device.self";
|
|
48
|
+
if (path.startsWith("/api/devices/me/push")) return "notifications.self";
|
|
49
|
+
if (path.startsWith("/api/endpoint-tools")) return "device.self";
|
|
50
|
+
if (path === "/api/agent" || path.startsWith("/api/agent/")) return "agents.run";
|
|
51
|
+
if (path.startsWith("/api/agents") || path.startsWith("/api/models")) return methodScope(method, "agents.read", "gateway.admin");
|
|
52
|
+
if (path.startsWith("/api/sessions") || path.startsWith("/api/side-chats")) return methodScope(method, "sessions.read", "sessions.write");
|
|
53
|
+
if (path.startsWith("/api/tasks")) return methodScope(method, "tasks.read", "tasks.write");
|
|
54
|
+
if (path.startsWith("/api/home") || path.startsWith("/api/inbox")) return methodScope(method, "tasks.read", "tasks.write");
|
|
55
|
+
if (path.startsWith("/api/automations") || path.startsWith("/api/automation-runs")) return methodScope(method, "automations.read", "automations.write");
|
|
56
|
+
if (path.startsWith("/api/workflows")) return methodScope(method, "automations.read", "automations.write");
|
|
57
|
+
if (path.startsWith("/api/voice") || path.startsWith("/api/media") || path.startsWith("/api/clarify")) return "sessions.write";
|
|
58
|
+
if (path.startsWith("/api/commands") || path.startsWith("/api/skills")) return methodScope(method, "agents.read", "gateway.admin");
|
|
59
|
+
if (path.startsWith("/api/workspace") || path.startsWith("/api/files") || path.startsWith("/api/projects") || path.startsWith("/api/notes") || path.startsWith("/api/shares")) return methodScope(method, "workspace.read", "workspace.write");
|
|
60
|
+
return "gateway.admin";
|
|
61
|
+
}
|
|
62
|
+
function hasGatewayScope(granted, required) {
|
|
63
|
+
return granted.includes("gateway.admin") || granted.includes(required);
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
export { DEFAULT_MOBILE_SCOPES, GATEWAY_SCOPES, hasGatewayScope, isGatewayScope, parseGatewayScopes, requiredGatewayScope };
|
|
@@ -2,7 +2,8 @@ export { safeEqualSecret } from './secret-equal.js';
|
|
|
2
2
|
export { assertGatewayAuthNotKnownWeak, KNOWN_WEAK_GATEWAY_TOKEN_PLACEHOLDERS, } from './known-weak-secrets.js';
|
|
3
3
|
export { checkBrowserOrigin } from './origin-check.js';
|
|
4
4
|
export { computeInlineScriptHashes, buildGatewayConsoleCspHeader } from './csp.js';
|
|
5
|
-
export {
|
|
5
|
+
export { GATEWAY_SCOPES, DEFAULT_MOBILE_SCOPES, hasGatewayScope, isGatewayScope, parseGatewayScopes, requiredGatewayScope, type GatewayScope, } from './gateway-scopes.js';
|
|
6
|
+
export { getGatewayPrincipal, setGatewayPrincipal, type GatewayPrincipal, } from './gateway-principal.js';
|
|
6
7
|
export { DEFAULT_GATEWAY_HTTP_TOOL_DENY, isDangerousHttpTool, filterDangerousHttpTools, } from './dangerous-tools.js';
|
|
7
8
|
export { createPreauthConnectionBudget, getMaxPreauthConnectionsPerIp, type PreauthConnectionBudget, } from './preauth-connection-budget.js';
|
|
8
9
|
export { auditGatewayConfig, collectGatewayConfigFindings, collectGatewaySecurityFindings, collectGatewayStartupGuardFindings, type SecurityAuditFinding, } from './audit.js';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DEFAULT_MOBILE_SCOPES, GATEWAY_SCOPES, hasGatewayScope, isGatewayScope, parseGatewayScopes, requiredGatewayScope } from "./gateway-scopes.js";
|
|
1
2
|
import { safeEqualSecret } from "./secret-equal.js";
|
|
2
3
|
import { KNOWN_WEAK_GATEWAY_TOKEN_PLACEHOLDERS, assertGatewayAuthNotKnownWeak } from "./known-weak-secrets.js";
|
|
3
4
|
import { auditGatewayConfig, collectGatewayConfigFindings, collectGatewaySecurityFindings, collectGatewayStartupGuardFindings } from "./audit.js";
|
|
@@ -5,6 +6,6 @@ import { detectSuspiciousPatterns, wrapExternalContent, wrapWebContent } from ".
|
|
|
5
6
|
import { createPreauthConnectionBudget, getMaxPreauthConnectionsPerIp } from "./preauth-connection-budget.js";
|
|
6
7
|
import { buildGatewayConsoleCspHeader, computeInlineScriptHashes } from "./csp.js";
|
|
7
8
|
import { checkBrowserOrigin } from "./origin-check.js";
|
|
8
|
-
import {
|
|
9
|
+
import { getGatewayPrincipal, setGatewayPrincipal } from "./gateway-principal.js";
|
|
9
10
|
import { DEFAULT_GATEWAY_HTTP_TOOL_DENY, filterDangerousHttpTools, isDangerousHttpTool } from "./dangerous-tools.js";
|
|
10
|
-
export {
|
|
11
|
+
export { DEFAULT_GATEWAY_HTTP_TOOL_DENY, DEFAULT_MOBILE_SCOPES, GATEWAY_SCOPES, KNOWN_WEAK_GATEWAY_TOKEN_PLACEHOLDERS, assertGatewayAuthNotKnownWeak, auditGatewayConfig, buildGatewayConsoleCspHeader, checkBrowserOrigin, collectGatewayConfigFindings, collectGatewaySecurityFindings, collectGatewayStartupGuardFindings, computeInlineScriptHashes, createPreauthConnectionBudget, detectSuspiciousPatterns, filterDangerousHttpTools, getGatewayPrincipal, getMaxPreauthConnectionsPerIp, hasGatewayScope, isDangerousHttpTool, isGatewayScope, parseGatewayScopes, requiredGatewayScope, safeEqualSecret, setGatewayPrincipal, wrapExternalContent, wrapWebContent };
|
|
@@ -50,6 +50,12 @@ import { registerClarifyBridge } from "./clarify-runtime.js";
|
|
|
50
50
|
import { ChannelManager } from "../channels/manager.js";
|
|
51
51
|
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
52
52
|
import "../config/index.js";
|
|
53
|
+
import { ManagedComposioEventPoller } from "../connectors/composio-managed-events.js";
|
|
54
|
+
import { startConnectedKnowledgeCoordinator } from "../knowledge/coordinator.js";
|
|
55
|
+
import "../knowledge/index.js";
|
|
56
|
+
import { startConnectorLearningCoordinator } from "../connectors/learning-coordinator.js";
|
|
57
|
+
import { ConnectedSourceChangePublisher } from "../connectors/source-change-publisher.js";
|
|
58
|
+
import { startConnectorSupervisor } from "../connectors/supervisor.js";
|
|
53
59
|
import { DiscussionService } from "../discussions/service.js";
|
|
54
60
|
import { DiscussionOrganizer } from "../discussions/organizer.js";
|
|
55
61
|
import { DiscussionLiveWorker } from "../discussions/live-worker.js";
|
|
@@ -58,14 +64,9 @@ import { DiscussionSealer } from "../discussions/sealer.js";
|
|
|
58
64
|
import "../discussions/index.js";
|
|
59
65
|
import { EndpointToolRuntime } from "../endpoint-tools/runtime.js";
|
|
60
66
|
import "../endpoint-tools/index.js";
|
|
61
|
-
import { ManagedComposioEventPoller } from "../connectors/composio-managed-events.js";
|
|
62
|
-
import { startConnectedKnowledgeCoordinator } from "../knowledge/coordinator.js";
|
|
63
|
-
import "../knowledge/index.js";
|
|
64
|
-
import { startConnectorLearningCoordinator } from "../connectors/learning-coordinator.js";
|
|
65
|
-
import { ConnectedSourceChangePublisher } from "../connectors/source-change-publisher.js";
|
|
66
|
-
import { startConnectorSupervisor } from "../connectors/supervisor.js";
|
|
67
67
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
68
68
|
import { prepareAutomationAgentSession } from "./automation-agent-session.js";
|
|
69
|
+
import { stopTailscaleExposure } from "./tailscale-lifecycle.js";
|
|
69
70
|
import { reconcileDreamingAutomations } from "./dreaming-automation-reconciler.js";
|
|
70
71
|
import { NotesStore } from "../notes/store.js";
|
|
71
72
|
import { buildNoteAgentContext } from "../notes/agent-context.js";
|
|
@@ -80,7 +81,6 @@ import { EphemeralSideChatManager } from "./side-chat/manager.js";
|
|
|
80
81
|
import { SideChatRunService } from "./side-chat/run-service.js";
|
|
81
82
|
import "./side-chat/index.js";
|
|
82
83
|
import { wireTunnelEventsToGateway } from "../tunnel/gateway-lifecycle.js";
|
|
83
|
-
import { stopTailscaleExposure } from "./tailscale-lifecycle.js";
|
|
84
84
|
import { getExposureManager } from "../remote-access/exposure-manager.js";
|
|
85
85
|
import { sanitizeTunnelConfig } from "../tunnel/tunnel-config.js";
|
|
86
86
|
import { assertGatewayAuthNotKnownWeak } from "./security/known-weak-secrets.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getModelCatalogStore, init_model_catalog_store } from "../providers/model-catalog-store.js";
|
|
2
2
|
import { compareCatalogModels } from "../providers/model-catalog-ranking.js";
|
|
3
|
-
import {
|
|
3
|
+
import { prepareUpdateGlobalDefaults } from "./global-defaults-admin.js";
|
|
4
4
|
//#region src/gateway/xopc-cloud-capability-setup.ts
|
|
5
5
|
init_model_catalog_store();
|
|
6
6
|
function supportsCapability(model, capability) {
|
|
@@ -49,27 +49,25 @@ function prepareXopcCloudCapabilitySetup(config, source) {
|
|
|
49
49
|
missing: selected.missing
|
|
50
50
|
};
|
|
51
51
|
const selection = selected.selection;
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
...currentModels
|
|
63
|
-
|
|
52
|
+
const currentModels = config.agents.defaults.models;
|
|
53
|
+
const defaultsUpdate = prepareUpdateGlobalDefaults(config, { defaults: {
|
|
54
|
+
...config.agents.defaults,
|
|
55
|
+
models: {
|
|
56
|
+
...currentModels,
|
|
57
|
+
chat: {
|
|
58
|
+
primary: `xopc-cloud/${selection.chat}`,
|
|
59
|
+
fallbacks: []
|
|
60
|
+
},
|
|
61
|
+
imageUnderstanding: {
|
|
62
|
+
...currentModels.imageUnderstanding,
|
|
63
|
+
primary: `xopc-cloud/${selection.vision}`,
|
|
64
|
+
fallbacks: currentModels.imageUnderstanding?.fallbacks ?? []
|
|
65
|
+
},
|
|
66
|
+
imageGeneration: {
|
|
67
|
+
...currentModels.imageGeneration,
|
|
68
|
+
primary: `xopc-cloud/${selection.imageGeneration}`,
|
|
69
|
+
fallbacks: currentModels.imageGeneration?.fallbacks ?? []
|
|
64
70
|
}
|
|
65
|
-
},
|
|
66
|
-
imageModel: {
|
|
67
|
-
...currentModels?.imageModel,
|
|
68
|
-
primary: `xopc-cloud/${selection.vision}`
|
|
69
|
-
},
|
|
70
|
-
imageGenerationModel: {
|
|
71
|
-
...currentModels?.imageGenerationModel,
|
|
72
|
-
primary: `xopc-cloud/${selection.imageGeneration}`
|
|
73
71
|
}
|
|
74
72
|
} });
|
|
75
73
|
if (defaultsUpdate.ok === false) return {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { listRegisteredMigrations, registerMigration, unregisterMigrationsForSource } from "./registry.js";
|
|
2
|
-
import { DEFAULT_CAPABILITY_PRESET_MIGRATION_ID, createDefaultCapabilityPreset, defaultCapabilityPresetMigration, ensureDefaultCapabilityPresetInitialized } from "./config/default-capability-preset.js";
|
|
3
2
|
import { CORE_MIGRATIONS, applyMigrations, detectMigrations, runBootstrapMigrationsSync } from "./runner.js";
|
|
4
|
-
export { CORE_MIGRATIONS,
|
|
3
|
+
export { CORE_MIGRATIONS, applyMigrations, detectMigrations, listRegisteredMigrations, registerMigration, runBootstrapMigrationsSync, unregisterMigrationsForSource };
|
|
@@ -2,7 +2,6 @@ import { createLogger } from "../utils/logger/index.js";
|
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { ConfigSchema, init_schema } from "../config/schema.js";
|
|
4
4
|
import { listRegisteredMigrations } from "./registry.js";
|
|
5
|
-
import { defaultCapabilityPresetMigration } from "./config/default-capability-preset.js";
|
|
6
5
|
import { dirname, join } from "node:path";
|
|
7
6
|
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
8
7
|
//#region src/migrations/runner.ts
|
|
@@ -11,7 +10,7 @@ init_logger();
|
|
|
11
10
|
const log = createLogger("Migrations");
|
|
12
11
|
const MIGRATION_LEDGER_FILENAME = "migrations.json";
|
|
13
12
|
const CONFIG_BACKUP_COUNT = 10;
|
|
14
|
-
const CORE_MIGRATIONS = [
|
|
13
|
+
const CORE_MIGRATIONS = [];
|
|
15
14
|
function listAllMigrations() {
|
|
16
15
|
return [...CORE_MIGRATIONS, ...listRegisteredMigrations().map((entry) => entry.migration)];
|
|
17
16
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type NotificationDevice, type NotificationDevicePlatform, type NotificationLanguage, type NotificationPermission, type NotificationPreferences } from './types.js';
|
|
2
2
|
export type RegisterNotificationDeviceInput = {
|
|
3
|
-
|
|
3
|
+
deviceId: string;
|
|
4
4
|
platform: NotificationDevicePlatform;
|
|
5
5
|
pushToken: string;
|
|
6
6
|
permissions: NotificationPermission;
|