@xopcai/xopc 0.0.230 → 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-CwAPK4Jm.js → app-management-settings-panel-BJfClfPx.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DsGLvqTb.js → appearance-settings-C_R0vUAu.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-Ee9qOQEx.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-B4qqigAQ.js → attachment-load-DZrEwytM.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-B8ImehSW.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-DaJbyYc2.js → binary-plugins-Ckc_Csue.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Kl25XWJc.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-DjMxs33B.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-BiU_4Rq6.js → chat-terminal-dock-CA9fndbZ.js} +2 -2
- package/dist/gateway/static/root/assets/cloud-C4-yfnnk.js +1 -0
- 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-ux9DxchT.js → desktop-pet-C3h40FmG.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BVVCBgYK.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-Dh6DDuvQ.js → extension-debug-page-CChgztz_.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-8OKQDEat.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/files-Dp8_uGTO.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-api-Dlc6eaTG.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-DqQgiAUv.js → gateway-settings-BbssNGid.js} +1 -1
- 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-BSFNqxzY.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-DzU6yZ9-.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-DvM5PWEH.js → markdown-view-B-BHEcNd.js} +1 -1
- package/dist/gateway/static/root/assets/markdown-view-B1bGSQqt.css +1 -0
- package/dist/gateway/static/root/assets/{media-plugins-B8vMe5VX.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-C8zjqmIv.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-BFsOGYkd.js → notes-api-DEdNKw0I.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-B-YZ7iuK.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-BNCO2YK5.js +1 -0
- package/dist/gateway/static/root/assets/popover-select-3E24E65N.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-DkWcyki5.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-Bq_ETeal.js → runtime-tools-settings-panel-BT5B74IH.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-BogTlrsP.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-Coy1Cbp6.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-DptCK_mk.js +2 -0
- 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-Brxb6QnW.js → skills-page-OHBeBtSg.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-FB5LtEGm.js → skills-page.utils-B9WZbOLC.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-ChosWt8n.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-Cpd3Gd5R.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-2SqnmSKD.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-CK3aZDdE.js → work-discovery-overlay-BrIdtdum.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BjOuddkX.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 +19 -15
- 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.d.ts +1 -0
- package/dist/src/agent/service.js +5 -3
- package/dist/src/agent/skills/skill-manage-ops.js +1 -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/tools/write.js +9 -12
- package/dist/src/agent/tools/xopc-use-tool.js +2 -2
- 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/auth/oauth/index.js +2 -2
- package/dist/src/auth/oauth/registry.d.ts +1 -1
- package/dist/src/auth/oauth/registry.js +5 -1
- package/dist/src/auth/oauth/xopc-cloud.d.ts +1 -0
- package/dist/src/auth/oauth/xopc-cloud.js +8 -2
- 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/files/file-service.d.ts +36 -0
- package/dist/src/files/file-service.js +282 -0
- 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/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/app.js +6 -4
- 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.d.ts +3 -0
- package/dist/src/gateway/hono/routes/files.js +176 -0
- 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 +12 -20
- package/dist/src/gateway/hono/routes/models.js +2 -2
- package/dist/src/gateway/hono/routes/projects.js +0 -508
- package/dist/src/gateway/hono/routes/realtime.js +8 -1
- package/dist/src/gateway/hono/routes/shares.js +410 -21
- 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/hono/routes/voice.js +1 -1
- package/dist/src/gateway/hono/routes/workspace.js +15 -974
- 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 +4 -4
- package/dist/src/gateway/xopc-cloud-capability-setup.js +19 -21
- package/dist/src/heartbeat/index.js +1 -1
- 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/hosted-session-share.d.ts +104 -0
- package/dist/src/share/hosted-session-share.js +276 -0
- package/dist/src/share/note-share-service.js +4 -24
- package/dist/src/share/session-share-projector.d.ts +31 -0
- package/dist/src/share/session-share-projector.js +79 -0
- package/dist/src/share/session-share-service.d.ts +89 -0
- package/dist/src/share/session-share-service.js +325 -0
- package/dist/src/share/share-asset-ticket.d.ts +7 -0
- package/dist/src/share/share-asset-ticket.js +30 -0
- package/dist/src/share/share-landing.d.ts +4 -3
- package/dist/src/share/share-landing.js +5 -5
- package/dist/src/share/share-store.d.ts +27 -2
- package/dist/src/share/share-store.js +71 -8
- package/dist/src/share/share-types.d.ts +17 -2
- 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/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/backends/gateway-realtime-backend.js +11 -3
- 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-Bp_wmuGW.js +0 -1
- package/dist/gateway/static/root/assets/agents-CKG93dlc.js +0 -68
- package/dist/gateway/static/root/assets/api-BywYxpaS.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-BNFAfNwC.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-Cg6NgwE_.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-NvJKgF1u.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-C2uBdALe.js +0 -3
- package/dist/gateway/static/root/assets/channels-settings-CIcYKMEs.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-38FsOnR0.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-CEEcmUiP.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-Cs_5pUPT.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-y1kWrFVU.js +0 -1
- package/dist/gateway/static/root/assets/dependency-picker-skc62zrn.js +0 -1
- package/dist/gateway/static/root/assets/directory-picker-path-field-V8vZP0Dy.js +0 -1
- package/dist/gateway/static/root/assets/dist-J_ySZvz0.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-BgSV0Nny.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/heartbeat-settings-Pxqk5GFH.js +0 -1
- package/dist/gateway/static/root/assets/home-page-1xjo6wE4.js +0 -1
- package/dist/gateway/static/root/assets/html-workspace-editor-bXK5tq64.js +0 -1
- package/dist/gateway/static/root/assets/index-Bbd_dXui.js +0 -70
- package/dist/gateway/static/root/assets/index-D_hrEKXM.css +0 -2
- package/dist/gateway/static/root/assets/local-app-workbench-page-heQ4-PJ7.js +0 -2
- package/dist/gateway/static/root/assets/locale-store-CXhjfe4q.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-BblnS6Jy.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-B8hM56HS.js +0 -1
- package/dist/gateway/static/root/assets/markdown-editor-TWGaF7Xa.js +0 -2
- package/dist/gateway/static/root/assets/markdown-split-DRbZjxMK.js +0 -1
- package/dist/gateway/static/root/assets/markdown-view-CLzTdVLW.css +0 -1
- package/dist/gateway/static/root/assets/messages-BMdD0LWk.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-CAM09C8b.js +0 -4
- package/dist/gateway/static/root/assets/popover-select-CccGri5Y.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-BIPIwgU2.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B_kzTn1K.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CtD8DsD-.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-B8n9HI1y.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-xlhdRTME.js +0 -1
- package/dist/gateway/static/root/assets/settings-loading-skeleton-B5GU7iCG.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-Dd-BRu12.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CwEFAVWx.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-DzXw9UQJ.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-Bk6UQOwS.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DrmQZ3Au.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-CW2sJbdc.js +0 -1
- package/dist/gateway/static/root/assets/theme-store-DOdCjyuw.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-Bq9KB-Oj.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-DtTIF6M8.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-CcbGEQol.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/file-path-classifier.d.ts +0 -30
- package/dist/src/gateway/file-path-classifier.js +0 -105
- package/dist/src/gateway/file-reference-errors.d.ts +0 -6
- package/dist/src/gateway/file-reference-errors.js +0 -21
- package/dist/src/gateway/file-reference-registry.d.ts +0 -34
- package/dist/src/gateway/file-reference-registry.js +0 -45
- 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
|
@@ -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 };
|
|
@@ -21,13 +21,13 @@ import { init_providers, providers_exports } from "../providers/index.js";
|
|
|
21
21
|
import { TaskRepository } from "../tasks/task-repository.js";
|
|
22
22
|
import { TaskConversationRepository } from "../tasks/task-conversation-repository.js";
|
|
23
23
|
import { disposeAllSessionMcpRuntimes } from "../agent/mcp/bundle-mcp-runtime.js";
|
|
24
|
+
import { ProjectService } from "../projects/project-service.js";
|
|
25
|
+
import { resolveProjectAgentId } from "../projects/project-agent.js";
|
|
26
|
+
import "../projects/index.js";
|
|
24
27
|
import { resolveEffectiveGatewayPort } from "./host.js";
|
|
25
28
|
import { AutomationService } from "../automations/service/automation-service.js";
|
|
26
29
|
import { onAutomationProductEvent, publishAutomationProductEvent } from "../automations/product-events.js";
|
|
27
30
|
import "../automations/index.js";
|
|
28
|
-
import { ProjectService } from "../projects/project-service.js";
|
|
29
|
-
import { resolveProjectAgentId } from "../projects/project-agent.js";
|
|
30
|
-
import "../projects/index.js";
|
|
31
31
|
import { TaskApplicationService } from "../tasks/task-application-service.js";
|
|
32
32
|
import { ProactiveScenarioService } from "../proactive/scenarios/service.js";
|
|
33
33
|
import { TaskOutboxDispatcher } from "../tasks/task-outbox-dispatcher.js";
|
|
@@ -66,6 +66,7 @@ import { EndpointToolRuntime } from "../endpoint-tools/runtime.js";
|
|
|
66
66
|
import "../endpoint-tools/index.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,6 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, shouldSilence, stripHeartbeatToken } from "./tokens.js";
|
|
2
|
+
import { appendCronEventLines } from "./event-prompt.js";
|
|
2
3
|
import { isWithinActiveHours } from "./active-hours.js";
|
|
3
4
|
import { isHeartbeatContentEmpty } from "./content-check.js";
|
|
4
|
-
import { appendCronEventLines } from "./event-prompt.js";
|
|
5
5
|
import { createHeartbeatWake } from "./wake.js";
|
|
6
6
|
export { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, appendCronEventLines, createHeartbeatWake, isHeartbeatContentEmpty, isWithinActiveHours, shouldSilence, stripHeartbeatToken };
|
|
@@ -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;
|
|
@@ -41,11 +41,11 @@ function deviceFromRow(row) {
|
|
|
41
41
|
}
|
|
42
42
|
function registerNotificationDevice(input) {
|
|
43
43
|
const now = Date.now();
|
|
44
|
-
const preferences = input.preferences ? normalizePreferences(input.preferences) : getNotificationDevice(input.
|
|
44
|
+
const preferences = input.preferences ? normalizePreferences(input.preferences) : getNotificationDevice(input.deviceId)?.preferences ?? normalizePreferences();
|
|
45
45
|
runSqliteWriteTransaction((db) => {
|
|
46
|
-
db.prepare(`DELETE FROM
|
|
47
|
-
WHERE
|
|
48
|
-
db.prepare(`INSERT INTO
|
|
46
|
+
db.prepare(`DELETE FROM device_push_endpoints
|
|
47
|
+
WHERE push_token = ? AND device_id <> ?`).run(input.pushToken, input.deviceId);
|
|
48
|
+
db.prepare(`INSERT INTO device_push_endpoints (
|
|
49
49
|
device_id, platform, push_token, enabled, permissions, preferences_json,
|
|
50
50
|
locale, app_version, lease_expires_at, last_seen_at, created_at, updated_at
|
|
51
51
|
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
@@ -59,16 +59,16 @@ function registerNotificationDevice(input) {
|
|
|
59
59
|
app_version = excluded.app_version,
|
|
60
60
|
lease_expires_at = excluded.lease_expires_at,
|
|
61
61
|
last_seen_at = excluded.last_seen_at,
|
|
62
|
-
updated_at = excluded.updated_at`).run(input.
|
|
62
|
+
updated_at = excluded.updated_at`).run(input.deviceId, input.platform, input.pushToken, input.permissions === "granted" ? 1 : 0, input.permissions, JSON.stringify(preferences), input.locale, input.appVersion?.trim() || null, now + DEVICE_LEASE_MS, now, now, now);
|
|
63
63
|
});
|
|
64
|
-
return getNotificationDevice(input.
|
|
64
|
+
return getNotificationDevice(input.deviceId);
|
|
65
65
|
}
|
|
66
66
|
function getNotificationDevice(deviceId) {
|
|
67
|
-
const row = getSqliteDatabase().prepare("SELECT * FROM
|
|
67
|
+
const row = getSqliteDatabase().prepare("SELECT * FROM device_push_endpoints WHERE device_id = ?").get(deviceId);
|
|
68
68
|
return row ? deviceFromRow(row) : null;
|
|
69
69
|
}
|
|
70
70
|
function listDeliverableNotificationDevices(now = Date.now()) {
|
|
71
|
-
return getSqliteDatabase().prepare(`SELECT * FROM
|
|
71
|
+
return getSqliteDatabase().prepare(`SELECT * FROM device_push_endpoints
|
|
72
72
|
WHERE enabled = 1 AND permissions = 'granted' AND lease_expires_at > ?
|
|
73
73
|
ORDER BY updated_at DESC`).all(now).map(deviceFromRow);
|
|
74
74
|
}
|
|
@@ -80,16 +80,16 @@ function updateNotificationDevicePreferences(deviceId, patch) {
|
|
|
80
80
|
...patch
|
|
81
81
|
});
|
|
82
82
|
runSqliteWriteTransaction((db) => {
|
|
83
|
-
db.prepare("UPDATE
|
|
83
|
+
db.prepare("UPDATE device_push_endpoints SET preferences_json = ?, updated_at = ? WHERE device_id = ?").run(JSON.stringify(preferences), Date.now(), deviceId);
|
|
84
84
|
});
|
|
85
85
|
return getNotificationDevice(deviceId);
|
|
86
86
|
}
|
|
87
87
|
function removeNotificationDevice(deviceId) {
|
|
88
|
-
return runSqliteWriteTransaction((db) => db.prepare("DELETE FROM
|
|
88
|
+
return runSqliteWriteTransaction((db) => db.prepare("DELETE FROM device_push_endpoints WHERE device_id = ?").run(deviceId).changes > 0);
|
|
89
89
|
}
|
|
90
90
|
function disableNotificationDeviceForPushToken(pushToken) {
|
|
91
91
|
runSqliteWriteTransaction((db) => {
|
|
92
|
-
db.prepare("UPDATE
|
|
92
|
+
db.prepare("UPDATE device_push_endpoints SET enabled = 0, updated_at = ? WHERE push_token = ?").run(Date.now(), pushToken);
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
95
|
//#endregion
|
|
@@ -88,7 +88,7 @@ const DELIVERY_JOIN = `
|
|
|
88
88
|
n.push_token, n.locale
|
|
89
89
|
FROM notification_deliveries d
|
|
90
90
|
JOIN notification_events e ON e.event_id = d.event_id
|
|
91
|
-
JOIN
|
|
91
|
+
JOIN device_push_endpoints n ON n.device_id = d.device_id
|
|
92
92
|
`;
|
|
93
93
|
function listDueNotificationDeliveries(status, now = Date.now(), limit = 100) {
|
|
94
94
|
return getSqliteDatabase().prepare(`${DELIVERY_JOIN}
|
|
@@ -135,7 +135,7 @@ function notificationDeliveryMetrics() {
|
|
|
135
135
|
SUM(CASE WHEN enabled = 1 AND permissions = 'granted' AND lease_expires_at > ? THEN 1 ELSE 0 END) AS deliverable,
|
|
136
136
|
SUM(CASE WHEN enabled = 1 AND lease_expires_at <= ? THEN 1 ELSE 0 END) AS expired,
|
|
137
137
|
SUM(CASE WHEN enabled = 0 OR permissions <> 'granted' THEN 1 ELSE 0 END) AS disabled
|
|
138
|
-
FROM
|
|
138
|
+
FROM device_push_endpoints`).get(now, now);
|
|
139
139
|
const oldest = getSqliteDatabase().prepare(`SELECT MIN(next_attempt_at) AS value FROM notification_deliveries
|
|
140
140
|
WHERE status IN ('pending', 'accepted')`).get();
|
|
141
141
|
const latestError = getSqliteDatabase().prepare(`SELECT event_id, device_id, last_error, updated_at
|
|
@@ -166,7 +166,7 @@ function expireUndeliverableNotificationDeliveries(now = Date.now()) {
|
|
|
166
166
|
SET status = 'dead', last_error = 'Device registration is disabled or expired', updated_at = ?
|
|
167
167
|
WHERE status IN ('pending', 'accepted')
|
|
168
168
|
AND EXISTS (
|
|
169
|
-
SELECT 1 FROM
|
|
169
|
+
SELECT 1 FROM device_push_endpoints n
|
|
170
170
|
WHERE n.device_id = notification_deliveries.device_id
|
|
171
171
|
AND (n.enabled = 0 OR n.permissions <> 'granted' OR n.lease_expires_at <= ?)
|
|
172
172
|
)`).run(now, now).changes));
|
|
@@ -90,7 +90,7 @@ function getApiKeySync(provider) {
|
|
|
90
90
|
*/
|
|
91
91
|
function resolveModel(ref) {
|
|
92
92
|
const trimmedRef = typeof ref === "string" ? ref.trim() : "";
|
|
93
|
-
if (!trimmedRef) throw new Error("No default model configured. Choose a model in onboarding or set agents.
|
|
93
|
+
if (!trimmedRef) throw new Error("No default model configured. Choose a model in onboarding or set agents.defaults.models.chat.primary.");
|
|
94
94
|
const customModel = getModelRegistry().resolve(trimmedRef);
|
|
95
95
|
if (customModel) return normalizeProviderModel(customModel);
|
|
96
96
|
const qualifiedRef = splitProviderModelRef(trimmedRef);
|
|
@@ -24,19 +24,24 @@ function collectToolModel(out, value, location, kind = "text") {
|
|
|
24
24
|
function collectModelPolicy(out, value, location) {
|
|
25
25
|
const policy = asRecord(value);
|
|
26
26
|
if (!policy) return;
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (
|
|
31
|
-
addRef(out, role.model, `${location}.roles.${roleId}.model`);
|
|
32
|
-
if (Array.isArray(role.fallbacks)) role.fallbacks.forEach((ref, index) => addRef(out, ref, `${location}.roles.${roleId}.fallbacks[${index}]`));
|
|
27
|
+
const chat = asRecord(policy.chat);
|
|
28
|
+
if (chat) {
|
|
29
|
+
addRef(out, chat.primary, `${location}.chat.primary`);
|
|
30
|
+
if (Array.isArray(chat.fallbacks)) chat.fallbacks.forEach((ref, index) => addRef(out, ref, `${location}.chat.fallbacks[${index}]`));
|
|
33
31
|
}
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
const intents = asRecord(policy.intents);
|
|
33
|
+
for (const [intent, routeValue] of Object.entries(intents ?? {})) {
|
|
34
|
+
const route = asRecord(routeValue);
|
|
35
|
+
if (!route) continue;
|
|
36
|
+
addRef(out, route.primary, `${location}.intents.${intent}.primary`);
|
|
37
|
+
if (Array.isArray(route.fallbacks)) route.fallbacks.forEach((ref, index) => addRef(out, ref, `${location}.intents.${intent}.fallbacks[${index}]`));
|
|
38
|
+
}
|
|
39
|
+
collectToolModel(out, policy.imageUnderstanding, `${location}.imageUnderstanding`);
|
|
40
|
+
collectToolModel(out, policy.imageGeneration, `${location}.imageGeneration`, "image-generation");
|
|
36
41
|
}
|
|
37
42
|
function collectReferences(config, sessionConfigs) {
|
|
38
43
|
const out = [];
|
|
39
|
-
|
|
44
|
+
collectModelPolicy(out, config.agents.defaults.models, "agents.defaults.models");
|
|
40
45
|
for (const agent of config.agents.list) collectModelPolicy(out, agent.models, `agents.list.${agent.id}.models`);
|
|
41
46
|
for (const [sessionKey, sessionConfig] of sessionConfigs) addRef(out, sessionConfig.modelOverride, `sessions.${sessionKey}.modelOverride`);
|
|
42
47
|
return out;
|
|
@@ -10,10 +10,12 @@ export declare class RealtimeRuntime {
|
|
|
10
10
|
private readonly preauthBudget;
|
|
11
11
|
private readonly wss;
|
|
12
12
|
private readonly topicCleanupTimers;
|
|
13
|
+
private readonly socketsByPrincipal;
|
|
13
14
|
private closed;
|
|
14
15
|
constructor(endpointTools?: EndpointToolRuntime);
|
|
15
16
|
handleUpgrade(req: IncomingMessage, socket: Socket, head: Buffer): boolean;
|
|
16
17
|
close(): void;
|
|
18
|
+
disconnectPrincipal(principalId: string): void;
|
|
17
19
|
completeTopic(topic: string, ttlMs?: number): void;
|
|
18
20
|
private handleConnection;
|
|
19
21
|
private rawDataToText;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
+
import { hasGatewayScope } from "../gateway/security/gateway-scopes.js";
|
|
3
4
|
import { REALTIME_HEARTBEAT_INTERVAL_MS, REALTIME_HEARTBEAT_TIMEOUT_MS, REALTIME_HELLO_TIMEOUT_MS, REALTIME_MAX_CLIENT_FRAME_BYTES, parseClientRealtimeJsonFrame, parseClientRealtimeMessage } from "../../packages/realtime-protocol/src/index.js";
|
|
4
5
|
import { createPreauthConnectionBudget } from "../gateway/security/preauth-connection-budget.js";
|
|
5
6
|
import { RealtimeBroker } from "./broker.js";
|
|
@@ -24,8 +25,13 @@ function serverMessage(kind, payload) {
|
|
|
24
25
|
payload
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
|
-
function isAuthorizedTopic(topic) {
|
|
28
|
-
|
|
28
|
+
function isAuthorizedTopic(topic, scopes) {
|
|
29
|
+
if (topic === "gateway") return hasGatewayScope(scopes, "gateway.status");
|
|
30
|
+
if (topic === "logs") return hasGatewayScope(scopes, "gateway.admin");
|
|
31
|
+
if (topic === "sessions" || topic.startsWith("session:")) return hasGatewayScope(scopes, "sessions.read");
|
|
32
|
+
if (topic.startsWith("run:")) return hasGatewayScope(scopes, "agents.run");
|
|
33
|
+
if (topic.startsWith("workflow:")) return hasGatewayScope(scopes, "automations.read");
|
|
34
|
+
return false;
|
|
29
35
|
}
|
|
30
36
|
var RealtimeRuntime = class {
|
|
31
37
|
broker = new RealtimeBroker(void 0, (error, topic) => {
|
|
@@ -42,6 +48,7 @@ var RealtimeRuntime = class {
|
|
|
42
48
|
perMessageDeflate: false
|
|
43
49
|
});
|
|
44
50
|
topicCleanupTimers = /* @__PURE__ */ new Map();
|
|
51
|
+
socketsByPrincipal = /* @__PURE__ */ new Map();
|
|
45
52
|
closed = false;
|
|
46
53
|
constructor(endpointTools) {
|
|
47
54
|
this.endpointTools = endpointTools;
|
|
@@ -80,6 +87,10 @@ var RealtimeRuntime = class {
|
|
|
80
87
|
for (const timer of this.topicCleanupTimers.values()) clearTimeout(timer);
|
|
81
88
|
this.topicCleanupTimers.clear();
|
|
82
89
|
this.wss.close();
|
|
90
|
+
this.socketsByPrincipal.clear();
|
|
91
|
+
}
|
|
92
|
+
disconnectPrincipal(principalId) {
|
|
93
|
+
for (const socket of this.socketsByPrincipal.get(principalId) ?? []) socket.close(4403, "Device access revoked");
|
|
83
94
|
}
|
|
84
95
|
completeTopic(topic, ttlMs = 5 * 6e4) {
|
|
85
96
|
const existing = this.topicCleanupTimers.get(topic);
|
|
@@ -97,6 +108,8 @@ var RealtimeRuntime = class {
|
|
|
97
108
|
let lastSeenAt = Date.now();
|
|
98
109
|
let connectionId;
|
|
99
110
|
let endpointId;
|
|
111
|
+
let principalId;
|
|
112
|
+
let grantedScopes = [];
|
|
100
113
|
let budgetHeld = true;
|
|
101
114
|
const releaseBudget = () => {
|
|
102
115
|
if (!budgetHeld) return;
|
|
@@ -115,7 +128,7 @@ var RealtimeRuntime = class {
|
|
|
115
128
|
};
|
|
116
129
|
const subscribe = (requested) => {
|
|
117
130
|
const authorized = requested.filter((item) => {
|
|
118
|
-
if (isAuthorizedTopic(item.topic)) return true;
|
|
131
|
+
if (isAuthorizedTopic(item.topic, grantedScopes)) return true;
|
|
119
132
|
sendError("FORBIDDEN_TOPIC", `Topic is not available: ${item.topic}`);
|
|
120
133
|
return false;
|
|
121
134
|
});
|
|
@@ -172,6 +185,11 @@ var RealtimeRuntime = class {
|
|
|
172
185
|
return;
|
|
173
186
|
}
|
|
174
187
|
authenticated = true;
|
|
188
|
+
principalId = claim.principalId;
|
|
189
|
+
grantedScopes = claim.scopes;
|
|
190
|
+
const principalSockets = this.socketsByPrincipal.get(principalId) ?? /* @__PURE__ */ new Set();
|
|
191
|
+
principalSockets.add(socket);
|
|
192
|
+
this.socketsByPrincipal.set(principalId, principalSockets);
|
|
175
193
|
connectionId = crypto.randomUUID();
|
|
176
194
|
let endpointReady;
|
|
177
195
|
if (message.payload.endpoint) {
|
|
@@ -215,6 +233,7 @@ var RealtimeRuntime = class {
|
|
|
215
233
|
subscribe(message.payload.subscriptions);
|
|
216
234
|
log.info({
|
|
217
235
|
connectionId,
|
|
236
|
+
principalId,
|
|
218
237
|
clientId: claim.clientId,
|
|
219
238
|
clientKind: claim.clientKind
|
|
220
239
|
}, "Realtime client connected");
|
|
@@ -249,6 +268,11 @@ var RealtimeRuntime = class {
|
|
|
249
268
|
for (const handle of subscriptions.values()) handle.unsubscribe();
|
|
250
269
|
subscriptions.clear();
|
|
251
270
|
if (endpointId && connectionId) this.endpointTools?.remove(endpointId, connectionId);
|
|
271
|
+
if (principalId) {
|
|
272
|
+
const principalSockets = this.socketsByPrincipal.get(principalId);
|
|
273
|
+
principalSockets?.delete(socket);
|
|
274
|
+
if (principalSockets?.size === 0) this.socketsByPrincipal.delete(principalId);
|
|
275
|
+
}
|
|
252
276
|
if (connectionId) {
|
|
253
277
|
const reason = reasonBuffer.toString();
|
|
254
278
|
log.info({
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { RealtimeClientKind } from '@xopcai/realtime-protocol';
|
|
2
|
+
import type { GatewayScope } from '../gateway/security/gateway-scopes.js';
|
|
2
3
|
export interface RealtimeTicketClaim {
|
|
3
4
|
clientId: string;
|
|
4
5
|
clientKind: RealtimeClientKind;
|
|
6
|
+
principalId: string;
|
|
7
|
+
deviceId?: string;
|
|
8
|
+
accessSessionId?: string;
|
|
9
|
+
scopes: readonly GatewayScope[];
|
|
5
10
|
expiresAt: number;
|
|
6
11
|
}
|
|
7
12
|
export interface IssuedRealtimeTicket extends RealtimeTicketClaim {
|
|
@@ -9,7 +14,7 @@ export interface IssuedRealtimeTicket extends RealtimeTicketClaim {
|
|
|
9
14
|
}
|
|
10
15
|
export declare class RealtimeTicketStore {
|
|
11
16
|
private readonly claims;
|
|
12
|
-
issue(clientId: string, clientKind: RealtimeClientKind, now?: number): IssuedRealtimeTicket;
|
|
17
|
+
issue(clientId: string, clientKind: RealtimeClientKind, principal: Omit<RealtimeTicketClaim, 'clientId' | 'clientKind' | 'expiresAt'>, now?: number): IssuedRealtimeTicket;
|
|
13
18
|
consume(ticket: string, clientId: string, clientKind: RealtimeClientKind, now?: number): RealtimeTicketClaim | undefined;
|
|
14
19
|
private prune;
|
|
15
20
|
}
|
|
@@ -7,13 +7,14 @@ function ticketKey(ticket) {
|
|
|
7
7
|
}
|
|
8
8
|
var RealtimeTicketStore = class {
|
|
9
9
|
claims = /* @__PURE__ */ new Map();
|
|
10
|
-
issue(clientId, clientKind, now = Date.now()) {
|
|
10
|
+
issue(clientId, clientKind, principal, now = Date.now()) {
|
|
11
11
|
this.prune(now);
|
|
12
12
|
if (this.claims.size >= MAX_OUTSTANDING_TICKETS) throw new Error("Too many outstanding realtime tickets");
|
|
13
13
|
const ticket = crypto.randomBytes(32).toString("base64url");
|
|
14
14
|
const claim = {
|
|
15
15
|
clientId,
|
|
16
16
|
clientKind,
|
|
17
|
+
...principal,
|
|
17
18
|
expiresAt: now + TICKET_TTL_MS
|
|
18
19
|
};
|
|
19
20
|
this.claims.set(ticketKey(ticket), claim);
|
|
@@ -2,11 +2,11 @@ import { createLogger } from "../utils/logger/index.js";
|
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { isTailscaleInstalled } from "../infra/tailscale.js";
|
|
4
4
|
import { resolveGatewayBindMode } from "../config/gateway-bind.js";
|
|
5
|
-
import { getTunnelConsentState } from "../tunnel/consent.js";
|
|
6
|
-
import { getTunnelService } from "../tunnel/tunnel-service.js";
|
|
7
|
-
import { maybeAutoStartTunnelFromConfig } from "../tunnel/gateway-lifecycle.js";
|
|
8
5
|
import { collectExposureConflicts } from "./exposure-guards.js";
|
|
9
6
|
import { getTailscaleExposureState, maybeStartTailscaleFromConfig, stopTailscaleExposure } from "../gateway/tailscale-lifecycle.js";
|
|
7
|
+
import { getTunnelService } from "../tunnel/tunnel-service.js";
|
|
8
|
+
import { getTunnelConsentState } from "../tunnel/consent.js";
|
|
9
|
+
import { maybeAutoStartTunnelFromConfig } from "../tunnel/gateway-lifecycle.js";
|
|
10
10
|
//#region src/remote-access/exposure-manager.ts
|
|
11
11
|
init_logger();
|
|
12
12
|
const log = createLogger("ExposureManager");
|