@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
|
@@ -1,134 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { getRecommendedModelsForProvider } from "../providers/presentation.js";
|
|
1
|
+
import { AgentDefaultsSchema } from "../agent-config/schema.js";
|
|
2
|
+
import { init_agent_config } from "../agent-config/index.js";
|
|
3
|
+
import { GATEWAY_BUILTIN_TOOLS } from "./agent-builtin-tools.js";
|
|
5
4
|
//#region src/gateway/global-defaults-admin.ts
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
init_providers();
|
|
9
|
-
function defaultPresetId(cfg) {
|
|
10
|
-
return cfg.agents.defaultPreset || "default";
|
|
11
|
-
}
|
|
12
|
-
function emptyGlobalDefaultsPreset(id) {
|
|
13
|
-
return {
|
|
14
|
-
id,
|
|
15
|
-
name: "Global defaults",
|
|
16
|
-
description: "Default capabilities inherited by every agent.",
|
|
17
|
-
version: 1,
|
|
18
|
-
models: DEFAULT_AGENT_MODELS
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
function ensureGlobalDefaultsConfig(cfg) {
|
|
22
|
-
const presetId = defaultPresetId(cfg);
|
|
23
|
-
const current = cfg.agents.capabilityPresets[presetId];
|
|
24
|
-
const preset = current ? {
|
|
25
|
-
...current,
|
|
26
|
-
id: presetId,
|
|
27
|
-
name: current.name || "Global defaults",
|
|
28
|
-
version: current.version || 1,
|
|
29
|
-
models: current.models ?? DEFAULT_AGENT_MODELS
|
|
30
|
-
} : emptyGlobalDefaultsPreset(presetId);
|
|
31
|
-
return {
|
|
32
|
-
...cfg,
|
|
33
|
-
agents: {
|
|
34
|
-
...cfg.agents,
|
|
35
|
-
defaultPreset: presetId,
|
|
36
|
-
capabilityPresets: {
|
|
37
|
-
...cfg.agents.capabilityPresets,
|
|
38
|
-
[presetId]: preset
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
function sourceFromAuthMode(authMode) {
|
|
44
|
-
if (authMode === "gateway") return "config";
|
|
45
|
-
if (authMode === "env") return "env";
|
|
46
|
-
if (authMode === "oauth") return "oauth";
|
|
47
|
-
if (authMode === "extension") return "extension";
|
|
48
|
-
if (authMode === "models_json") return "models_json";
|
|
49
|
-
if (authMode === "agent") return "agent";
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
function recommendedModelForProvider(provider) {
|
|
53
|
-
const recommended = getRecommendedModelsForProvider(provider, 1)[0];
|
|
54
|
-
if (recommended) return recommended.ref;
|
|
55
|
-
const model = getModelsByProvider(provider)[0];
|
|
56
|
-
return model ? `${provider}/${model.id}` : null;
|
|
57
|
-
}
|
|
58
|
-
async function listGlobalDefaults(cfg) {
|
|
59
|
-
const normalized = ensureGlobalDefaultsConfig(cfg);
|
|
60
|
-
const presetId = defaultPresetId(normalized);
|
|
61
|
-
const preset = normalized.agents.capabilityPresets[presetId] ?? emptyGlobalDefaultsPreset(presetId);
|
|
62
|
-
const providers = [];
|
|
63
|
-
const recommendations = [];
|
|
64
|
-
for (const provider of getAllProviders()) {
|
|
65
|
-
const auth = await getProviderAuthState(provider);
|
|
66
|
-
const configured = auth.authStatus === "connected";
|
|
67
|
-
const source = configured ? sourceFromAuthMode(auth.authMode) : null;
|
|
68
|
-
providers.push({
|
|
69
|
-
id: provider,
|
|
70
|
-
name: getProviderDisplayName(provider),
|
|
71
|
-
configured,
|
|
72
|
-
source
|
|
73
|
-
});
|
|
74
|
-
if (configured) {
|
|
75
|
-
const model = recommendedModelForProvider(provider);
|
|
76
|
-
if (model) recommendations.push({
|
|
77
|
-
provider,
|
|
78
|
-
model,
|
|
79
|
-
reason: "configured-provider"
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
providers.sort((a, b) => Number(b.configured) - Number(a.configured) || a.name.localeCompare(b.name));
|
|
5
|
+
init_agent_config();
|
|
6
|
+
function listGlobalDefaults(cfg) {
|
|
84
7
|
return {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
8
|
+
defaults: structuredClone(cfg.agents.defaults),
|
|
9
|
+
builtinTools: GATEWAY_BUILTIN_TOOLS.map((tool) => ({
|
|
10
|
+
id: tool.id,
|
|
11
|
+
description: { ...tool.description }
|
|
12
|
+
}))
|
|
89
13
|
};
|
|
90
14
|
}
|
|
91
15
|
function prepareUpdateGlobalDefaults(cfg, body) {
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
ok: false,
|
|
99
|
-
error: `models ${parsed.error.issues[0]?.message ?? "is invalid"}`,
|
|
100
|
-
status: 400
|
|
101
|
-
};
|
|
102
|
-
const models = parsed.data.models ?? DEFAULT_AGENT_MODELS;
|
|
103
|
-
const roles = models.roles ?? {};
|
|
104
|
-
const defaultRole = models.defaultRole ?? Object.keys(roles)[0] ?? "deep";
|
|
105
|
-
if (Object.keys(roles).length > 0 && !roles[defaultRole]) return {
|
|
106
|
-
ok: false,
|
|
107
|
-
error: "models.defaultRole must reference models.roles",
|
|
108
|
-
status: 400
|
|
109
|
-
};
|
|
110
|
-
nextPreset = {
|
|
111
|
-
...nextPreset,
|
|
112
|
-
models: {
|
|
113
|
-
...models,
|
|
114
|
-
defaultRole,
|
|
115
|
-
roles
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
}
|
|
16
|
+
const parsed = AgentDefaultsSchema.safeParse(body.defaults);
|
|
17
|
+
if (!parsed.success) return {
|
|
18
|
+
ok: false,
|
|
19
|
+
error: `defaults ${parsed.error.issues[0]?.message ?? "is invalid"}`,
|
|
20
|
+
status: 400
|
|
21
|
+
};
|
|
119
22
|
return {
|
|
120
23
|
ok: true,
|
|
121
24
|
data: { nextConfig: {
|
|
122
|
-
...
|
|
25
|
+
...cfg,
|
|
123
26
|
agents: {
|
|
124
|
-
...
|
|
125
|
-
|
|
126
|
-
...normalized.agents.capabilityPresets,
|
|
127
|
-
[presetId]: nextPreset
|
|
128
|
-
}
|
|
27
|
+
...cfg.agents,
|
|
28
|
+
defaults: parsed.data
|
|
129
29
|
}
|
|
130
30
|
} }
|
|
131
31
|
};
|
|
132
32
|
}
|
|
133
33
|
//#endregion
|
|
134
|
-
export {
|
|
34
|
+
export { listGlobalDefaults, prepareUpdateGlobalDefaults };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { shouldSilence, stripHeartbeatToken } from "../../heartbeat/tokens.js";
|
|
4
|
+
import { appendCronEventLines } from "../../heartbeat/event-prompt.js";
|
|
4
5
|
import { isWithinActiveHours } from "../../heartbeat/active-hours.js";
|
|
5
6
|
import { isHeartbeatContentEmpty } from "../../heartbeat/content-check.js";
|
|
6
|
-
import { appendCronEventLines } from "../../heartbeat/event-prompt.js";
|
|
7
7
|
import { createHeartbeatWake } from "../../heartbeat/wake.js";
|
|
8
8
|
import { resolveHeartbeatMdPath } from "../workspace-heartbeat-path.js";
|
|
9
9
|
import { readFile } from "fs/promises";
|
|
@@ -9,12 +9,13 @@ import { isLoopbackIpAddress, isTrustedProxyAddress } from "../client-ip.js";
|
|
|
9
9
|
import { buildGatewayConsoleCspHeader } from "../security/csp.js";
|
|
10
10
|
import { checkBrowserOrigin } from "../security/origin-check.js";
|
|
11
11
|
import { auth } from "./middleware/auth.js";
|
|
12
|
-
import {
|
|
12
|
+
import { gatewayScopes } from "./middleware/scopes.js";
|
|
13
13
|
import { createChannelRateLimitMiddleware, createChatRateLimitMiddleware, createMediaRateLimitMiddleware, createStrictRateLimitMiddleware, createTaskRateLimitMiddleware, createXopcCloudPollRateLimitMiddleware } from "./middleware/strict-rate-limit.js";
|
|
14
14
|
import { logContextMiddleware } from "./middleware/log-context.js";
|
|
15
15
|
import { logger } from "./middleware/logger.js";
|
|
16
16
|
import { routeErrorMiddleware } from "./middleware/route-errors.js";
|
|
17
17
|
import { registerPublicExtensionAssetRoutes } from "./routes/auth-registry-extensions.js";
|
|
18
|
+
import { registerDeviceAuthPublicRoutes } from "./routes/devices.js";
|
|
18
19
|
import { registerPublicLocalAppPreviewRoutes } from "./routes/local-apps.js";
|
|
19
20
|
import { resetLazyRouteBundlesForTests } from "./routes/lazy-fallback.js";
|
|
20
21
|
import { registerAuthenticatedRoutes } from "./routes/index.js";
|
|
@@ -155,7 +156,7 @@ function createHonoApp(config) {
|
|
|
155
156
|
if (/^\/api\/notes\/[^/]+\/media$/.test(path)) return true;
|
|
156
157
|
return path === "/api/notes" && contentType?.includes("multipart/form-data") === true;
|
|
157
158
|
};
|
|
158
|
-
const
|
|
159
|
+
const isFileUploadRequest = (path, method, contentType) => method === "POST" && /^\/api\/files\/spaces\/[^/]+\/upload$/.test(path) && contentType?.includes("multipart/form-data") === true;
|
|
159
160
|
const discussionUploadBodyMax = (path, method, contentType) => {
|
|
160
161
|
if (method !== "PUT" || contentType?.includes("multipart/form-data") !== true) return void 0;
|
|
161
162
|
if (/^\/api\/discussions\/[^/]+\/recording$/.test(path)) return NOTE_MEDIA_BODY_MAX;
|
|
@@ -176,7 +177,7 @@ function createHonoApp(config) {
|
|
|
176
177
|
}));
|
|
177
178
|
app.use("/api/*", async (c, next) => {
|
|
178
179
|
const contentType = c.req.header("content-type");
|
|
179
|
-
const maxSize = c.req.method === "POST" && c.req.path === "/api/tasks" || c.req.method === "POST" && /^\/api\/sessions\/[^/]+\/inputs$/.test(c.req.path) || c.req.method === "POST" && /^\/api\/tasks\/[^/]+\/inputs$/.test(c.req.path) || c.req.method === "PATCH" && /^\/api\/sessions\/[^/]+\/inputs\/[^/]+$/.test(c.req.path) ? SESSION_INPUT_BODY_MAX : c.req.path === "/api/skills/upload" ? SKILL_UPLOAD_BODY_MAX : c.req.path === "/api/voice/transcriptions" ? VOICE_TRANSCRIBE_BODY_MAX : c.req.path === "/api/media" && c.req.method === "POST" ? MEDIA_UPLOAD_BODY_MAX : isNoteMediaUploadRequest(c.req.path, c.req.method, contentType) ? NOTE_MEDIA_BODY_MAX :
|
|
180
|
+
const maxSize = c.req.method === "POST" && c.req.path === "/api/tasks" || c.req.method === "POST" && /^\/api\/sessions\/[^/]+\/inputs$/.test(c.req.path) || c.req.method === "POST" && /^\/api\/tasks\/[^/]+\/inputs$/.test(c.req.path) || c.req.method === "PATCH" && /^\/api\/sessions\/[^/]+\/inputs\/[^/]+$/.test(c.req.path) ? SESSION_INPUT_BODY_MAX : c.req.path === "/api/skills/upload" ? SKILL_UPLOAD_BODY_MAX : c.req.path === "/api/voice/transcriptions" ? VOICE_TRANSCRIBE_BODY_MAX : c.req.path === "/api/media" && c.req.method === "POST" ? MEDIA_UPLOAD_BODY_MAX : isNoteMediaUploadRequest(c.req.path, c.req.method, contentType) ? NOTE_MEDIA_BODY_MAX : isFileUploadRequest(c.req.path, c.req.method, contentType) ? NOTE_MEDIA_BODY_MAX : discussionUploadBodyMax(c.req.path, c.req.method, contentType) ?? DEFAULT_API_BODY_MAX;
|
|
180
181
|
const maxSizeMb = Math.ceil(maxSize / (1024 * 1024));
|
|
181
182
|
return bodyLimit({
|
|
182
183
|
maxSize,
|
|
@@ -193,6 +194,7 @@ function createHonoApp(config) {
|
|
|
193
194
|
})(c, next);
|
|
194
195
|
});
|
|
195
196
|
registerPublicGatewayRoutes(app, service);
|
|
197
|
+
registerDeviceAuthPublicRoutes(app);
|
|
196
198
|
registerPublicExtensionAssetRoutes(app, service);
|
|
197
199
|
registerPublicLocalAppPreviewRoutes(app, service);
|
|
198
200
|
const authenticated = new Hono();
|
|
@@ -205,7 +207,7 @@ function createHonoApp(config) {
|
|
|
205
207
|
allowRealIpFallback: service.currentConfig.gateway?.allowRealIpFallback === true
|
|
206
208
|
})
|
|
207
209
|
}));
|
|
208
|
-
authenticated.use(
|
|
210
|
+
authenticated.use(gatewayScopes());
|
|
209
211
|
const strictRateLimitMiddleware = createStrictRateLimitMiddleware({ getTrustedProxyContext: () => ({
|
|
210
212
|
trustedProxies: service.currentConfig.gateway?.trustedProxies,
|
|
211
213
|
allowRealIpFallback: service.currentConfig.gateway?.allowRealIpFallback === true
|
|
@@ -29,165 +29,83 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
29
29
|
defaultId: string;
|
|
30
30
|
list: {
|
|
31
31
|
id: string;
|
|
32
|
-
|
|
33
|
-
name: string;
|
|
34
|
-
role: string;
|
|
35
|
-
language: string;
|
|
36
|
-
tone: string;
|
|
37
|
-
description?: string;
|
|
38
|
-
avatar?: string;
|
|
39
|
-
};
|
|
40
|
-
workspace: {
|
|
41
|
-
root: string;
|
|
42
|
-
};
|
|
32
|
+
workspace: string;
|
|
43
33
|
models: {
|
|
44
|
-
|
|
45
|
-
roles?: Record<string, {
|
|
46
|
-
model: string;
|
|
47
|
-
fallbacks?: string[];
|
|
48
|
-
description?: string;
|
|
49
|
-
}>;
|
|
50
|
-
imageModel?: {
|
|
34
|
+
chat?: {
|
|
51
35
|
primary: string;
|
|
52
|
-
fallbacks
|
|
53
|
-
timeoutMs?: number;
|
|
54
|
-
autoProviderFallback?: boolean;
|
|
36
|
+
fallbacks: string[];
|
|
55
37
|
};
|
|
56
|
-
|
|
38
|
+
intents?: Partial<Record<"understanding" | "fast" | "reasoning" | "coding" | "review" | "vision", {
|
|
57
39
|
primary: string;
|
|
58
|
-
fallbacks
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
allowFallbacks?: boolean;
|
|
64
|
-
maxCostTier?: "low" | "high" | "medium";
|
|
40
|
+
fallbacks: string[];
|
|
41
|
+
}>>;
|
|
42
|
+
imageUnderstanding?: {
|
|
43
|
+
primary: string;
|
|
44
|
+
fallbacks: string[];
|
|
65
45
|
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
limits?: {
|
|
72
|
-
maxCallsPerTurn?: number;
|
|
73
|
-
timeoutMs?: number;
|
|
74
|
-
};
|
|
75
|
-
}>;
|
|
76
|
-
mcp?: {
|
|
77
|
-
servers?: Record<string, {
|
|
78
|
-
mode: "allow" | "deny" | "confirm";
|
|
79
|
-
scope?: "workspace" | "readonly" | "unrestricted";
|
|
80
|
-
limits?: {
|
|
81
|
-
maxCallsPerTurn?: number;
|
|
82
|
-
timeoutMs?: number;
|
|
83
|
-
};
|
|
84
|
-
}>;
|
|
85
|
-
tools?: Record<string, {
|
|
86
|
-
mode: "allow" | "deny" | "confirm";
|
|
87
|
-
scope?: "workspace" | "readonly" | "unrestricted";
|
|
88
|
-
limits?: {
|
|
89
|
-
maxCallsPerTurn?: number;
|
|
90
|
-
timeoutMs?: number;
|
|
91
|
-
};
|
|
92
|
-
}>;
|
|
46
|
+
imageGeneration?: {
|
|
47
|
+
primary: string;
|
|
48
|
+
fallbacks: string[];
|
|
49
|
+
autoProviderFallback: boolean;
|
|
50
|
+
timeoutMs?: number;
|
|
93
51
|
};
|
|
94
52
|
};
|
|
53
|
+
tools: Record<string, {
|
|
54
|
+
mode: "allow" | "deny" | "ask";
|
|
55
|
+
maxCallsPerTurn?: number;
|
|
56
|
+
timeoutMs?: number;
|
|
57
|
+
}>;
|
|
95
58
|
skills: {
|
|
96
|
-
mode: "
|
|
97
|
-
|
|
98
|
-
|
|
59
|
+
mode: "merge";
|
|
60
|
+
add: string[];
|
|
61
|
+
remove: string[];
|
|
62
|
+
} | {
|
|
63
|
+
mode: "replace";
|
|
64
|
+
include: string[];
|
|
99
65
|
};
|
|
100
66
|
workflows: {
|
|
101
67
|
default?: string;
|
|
102
68
|
allowed?: string[];
|
|
103
|
-
suggested?: {
|
|
104
|
-
intent: string;
|
|
105
|
-
workflow: string;
|
|
106
|
-
}[];
|
|
107
|
-
};
|
|
108
|
-
boundaries: {
|
|
109
|
-
requiresConfirmation?: string[];
|
|
110
|
-
forbidden?: string[];
|
|
111
|
-
escalation?: string[];
|
|
112
69
|
};
|
|
113
70
|
}[];
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
version: number;
|
|
118
|
-
description?: string;
|
|
119
|
-
extends?: string[];
|
|
120
|
-
models?: {
|
|
121
|
-
defaultRole?: string;
|
|
122
|
-
roles?: Record<string, {
|
|
123
|
-
model: string;
|
|
124
|
-
fallbacks?: string[];
|
|
125
|
-
description?: string;
|
|
126
|
-
}>;
|
|
127
|
-
imageModel?: {
|
|
71
|
+
defaults: {
|
|
72
|
+
models: {
|
|
73
|
+
chat: {
|
|
128
74
|
primary: string;
|
|
129
|
-
fallbacks
|
|
130
|
-
timeoutMs?: number;
|
|
131
|
-
autoProviderFallback?: boolean;
|
|
75
|
+
fallbacks: string[];
|
|
132
76
|
};
|
|
133
|
-
|
|
77
|
+
intents: Partial<Record<"understanding" | "fast" | "reasoning" | "coding" | "review" | "vision", {
|
|
134
78
|
primary: string;
|
|
135
|
-
fallbacks
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
allowFallbacks?: boolean;
|
|
141
|
-
maxCostTier?: "low" | "high" | "medium";
|
|
79
|
+
fallbacks: string[];
|
|
80
|
+
}>>;
|
|
81
|
+
imageUnderstanding?: {
|
|
82
|
+
primary: string;
|
|
83
|
+
fallbacks: string[];
|
|
142
84
|
};
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
limits?: {
|
|
149
|
-
maxCallsPerTurn?: number;
|
|
150
|
-
timeoutMs?: number;
|
|
151
|
-
};
|
|
152
|
-
}>;
|
|
153
|
-
mcp?: {
|
|
154
|
-
servers?: Record<string, {
|
|
155
|
-
mode: "allow" | "deny" | "confirm";
|
|
156
|
-
scope?: "workspace" | "readonly" | "unrestricted";
|
|
157
|
-
limits?: {
|
|
158
|
-
maxCallsPerTurn?: number;
|
|
159
|
-
timeoutMs?: number;
|
|
160
|
-
};
|
|
161
|
-
}>;
|
|
162
|
-
tools?: Record<string, {
|
|
163
|
-
mode: "allow" | "deny" | "confirm";
|
|
164
|
-
scope?: "workspace" | "readonly" | "unrestricted";
|
|
165
|
-
limits?: {
|
|
166
|
-
maxCallsPerTurn?: number;
|
|
167
|
-
timeoutMs?: number;
|
|
168
|
-
};
|
|
169
|
-
}>;
|
|
85
|
+
imageGeneration?: {
|
|
86
|
+
primary: string;
|
|
87
|
+
fallbacks: string[];
|
|
88
|
+
autoProviderFallback: boolean;
|
|
89
|
+
timeoutMs?: number;
|
|
170
90
|
};
|
|
171
91
|
};
|
|
172
|
-
skills
|
|
173
|
-
mode: "
|
|
174
|
-
|
|
175
|
-
|
|
92
|
+
skills: {
|
|
93
|
+
mode: "all-enabled";
|
|
94
|
+
exclude: string[];
|
|
95
|
+
} | {
|
|
96
|
+
mode: "selected";
|
|
97
|
+
include: string[];
|
|
176
98
|
};
|
|
177
|
-
|
|
99
|
+
tools: Record<string, {
|
|
100
|
+
mode: "allow" | "deny" | "ask";
|
|
101
|
+
maxCallsPerTurn?: number;
|
|
102
|
+
timeoutMs?: number;
|
|
103
|
+
}>;
|
|
104
|
+
workflows: {
|
|
178
105
|
default?: string;
|
|
179
106
|
allowed?: string[];
|
|
180
|
-
suggested?: {
|
|
181
|
-
intent: string;
|
|
182
|
-
workflow: string;
|
|
183
|
-
}[];
|
|
184
|
-
};
|
|
185
|
-
boundaries?: {
|
|
186
|
-
requiresConfirmation?: string[];
|
|
187
|
-
forbidden?: string[];
|
|
188
|
-
escalation?: string[];
|
|
189
107
|
};
|
|
190
|
-
runtime
|
|
108
|
+
runtime: {
|
|
191
109
|
maxTurns?: number;
|
|
192
110
|
timeoutMs?: number;
|
|
193
111
|
maxToolFailuresPerTurn?: number;
|
|
@@ -196,8 +114,7 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
196
114
|
lifetime: "short" | "long";
|
|
197
115
|
};
|
|
198
116
|
};
|
|
199
|
-
|
|
200
|
-
}>;
|
|
117
|
+
};
|
|
201
118
|
};
|
|
202
119
|
channels: {
|
|
203
120
|
[k: string]: {
|
|
@@ -113,15 +113,13 @@ async function buildSafeWebConfigPayload(service, options = {}) {
|
|
|
113
113
|
defaultId: resolveDefaultAgentId(config),
|
|
114
114
|
list: listAgentEntries(config).filter((e) => e.enabled !== false).map((e) => ({
|
|
115
115
|
id: normalizeAgentId(e.id),
|
|
116
|
-
identity: e.identity,
|
|
117
116
|
workspace: e.workspace,
|
|
118
117
|
models: e.models,
|
|
119
118
|
tools: e.tools,
|
|
120
119
|
skills: e.skills,
|
|
121
|
-
workflows: e.workflows
|
|
122
|
-
boundaries: e.boundaries
|
|
120
|
+
workflows: e.workflows
|
|
123
121
|
})),
|
|
124
|
-
|
|
122
|
+
defaults: config.agents.defaults
|
|
125
123
|
},
|
|
126
124
|
channels: channelsPayload,
|
|
127
125
|
providers: Object.fromEntries(await Promise.all(getAllProviders().map(async (provider) => [provider, await maskLlmProviderApiKeyForWeb(provider)]))),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { logAuthEvent } from "../../../utils/logger/audit.js";
|
|
2
2
|
import { createLogger } from "../../../utils/logger/index.js";
|
|
3
3
|
import { init_logger } from "../../../utils/logger.js";
|
|
4
|
+
import { authenticateDeviceAccessToken } from "../../../storage/sqlite/device-access-repository.js";
|
|
4
5
|
import { safeEqualSecret } from "../../security/secret-equal.js";
|
|
5
6
|
import { resolveClientIpFromRequest } from "../../client-ip.js";
|
|
6
7
|
import { authPolicyConfig, buckets, resolveAuthRateLimit } from "../../rate-limit/buckets.js";
|
|
@@ -9,6 +10,7 @@ import { resolveAuthTracking } from "../../rate-limit/auth-policy.js";
|
|
|
9
10
|
import { isAuthRateLimitGloballyDisabled } from "../../rate-limit/env-flags.js";
|
|
10
11
|
import "../../rate-limit/index.js";
|
|
11
12
|
import { authorizeTrustedProxy } from "../../trusted-proxy.js";
|
|
13
|
+
import { setGatewayPrincipal } from "../../security/gateway-principal.js";
|
|
12
14
|
import { createMiddleware } from "hono/factory";
|
|
13
15
|
import { getConnInfo } from "@hono/node-server/conninfo";
|
|
14
16
|
//#region src/gateway/hono/middleware/auth.ts
|
|
@@ -165,10 +167,22 @@ function auth(config) {
|
|
|
165
167
|
}, 401);
|
|
166
168
|
}
|
|
167
169
|
recordSuccess(rl);
|
|
170
|
+
setGatewayPrincipal(c, {
|
|
171
|
+
kind: "trusted-proxy",
|
|
172
|
+
principalId: result.user,
|
|
173
|
+
scopes: ["gateway.admin"]
|
|
174
|
+
});
|
|
168
175
|
await next();
|
|
169
176
|
return;
|
|
170
177
|
}
|
|
171
|
-
if (authMode === "none")
|
|
178
|
+
if (authMode === "none") {
|
|
179
|
+
setGatewayPrincipal(c, {
|
|
180
|
+
kind: "owner",
|
|
181
|
+
principalId: "gateway-owner",
|
|
182
|
+
scopes: ["gateway.admin"]
|
|
183
|
+
});
|
|
184
|
+
return next();
|
|
185
|
+
}
|
|
172
186
|
const expectedCredential = resolveExpectedCredential(resolvedAuth);
|
|
173
187
|
if (!expectedCredential) {
|
|
174
188
|
log.error({
|
|
@@ -196,6 +210,24 @@ function auth(config) {
|
|
|
196
210
|
const providedCredential = authHeader || queryToken;
|
|
197
211
|
if (providedCredential && validateCredential(providedCredential, expectedCredential)) {
|
|
198
212
|
recordSuccess(rl);
|
|
213
|
+
setGatewayPrincipal(c, {
|
|
214
|
+
kind: "owner",
|
|
215
|
+
principalId: "gateway-owner",
|
|
216
|
+
scopes: ["gateway.admin"]
|
|
217
|
+
});
|
|
218
|
+
await next();
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
const deviceIdentity = providedCredential?.startsWith("xopc_at_") ? authenticateDeviceAccessToken(providedCredential) : void 0;
|
|
222
|
+
if (deviceIdentity) {
|
|
223
|
+
recordSuccess(rl);
|
|
224
|
+
setGatewayPrincipal(c, {
|
|
225
|
+
kind: "device",
|
|
226
|
+
principalId: deviceIdentity.deviceId,
|
|
227
|
+
deviceId: deviceIdentity.deviceId,
|
|
228
|
+
accessSessionId: deviceIdentity.accessSessionId,
|
|
229
|
+
scopes: deviceIdentity.scopes
|
|
230
|
+
});
|
|
199
231
|
await next();
|
|
200
232
|
return;
|
|
201
233
|
}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* This middleware runs AFTER the auth middleware. For authenticated requests,
|
|
5
|
-
* it checks that the declared operator scopes (defaulting to full access for
|
|
6
|
-
* token-authenticated users) satisfy the minimum scope required by the route.
|
|
7
|
-
*
|
|
8
|
-
* The scope system is currently implicit: all authenticated users get
|
|
9
|
-
* DEFAULT_OPERATOR_SCOPES. This lays the groundwork for future per-device
|
|
10
|
-
* or per-token scope restrictions (similar to OpenClaw's device pairing scopes).
|
|
11
|
-
*/
|
|
12
|
-
export declare function operatorScopes(): import("hono/dist/types/types.js").MiddlewareHandler<any, string, {}, Response & import("hono/dist/types/types.js").TypedResponse<{
|
|
1
|
+
/** Enforces fail-closed route scopes after authentication establishes a principal. */
|
|
2
|
+
export declare function gatewayScopes(): import("hono/dist/types/types.js").MiddlewareHandler<any, string, {}, Response & import("hono/dist/types/types.js").TypedResponse<{
|
|
13
3
|
error: string;
|
|
14
4
|
message: string;
|
|
15
5
|
}, 403, "json">>;
|
|
@@ -1,30 +1,21 @@
|
|
|
1
1
|
import { createLogger } from "../../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../../utils/logger.js";
|
|
3
|
-
import {
|
|
3
|
+
import { hasGatewayScope, requiredGatewayScope } from "../../security/gateway-scopes.js";
|
|
4
|
+
import { getGatewayPrincipal } from "../../security/gateway-principal.js";
|
|
4
5
|
import { createMiddleware } from "hono/factory";
|
|
5
6
|
//#region src/gateway/hono/middleware/scopes.ts
|
|
6
7
|
init_logger();
|
|
7
8
|
const log = createLogger("Hono:Scopes");
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
* This middleware runs AFTER the auth middleware. For authenticated requests,
|
|
12
|
-
* it checks that the declared operator scopes (defaulting to full access for
|
|
13
|
-
* token-authenticated users) satisfy the minimum scope required by the route.
|
|
14
|
-
*
|
|
15
|
-
* The scope system is currently implicit: all authenticated users get
|
|
16
|
-
* DEFAULT_OPERATOR_SCOPES. This lays the groundwork for future per-device
|
|
17
|
-
* or per-token scope restrictions (similar to OpenClaw's device pairing scopes).
|
|
18
|
-
*/
|
|
19
|
-
function operatorScopes() {
|
|
9
|
+
/** Enforces fail-closed route scopes after authentication establishes a principal. */
|
|
10
|
+
function gatewayScopes() {
|
|
20
11
|
return createMiddleware(async (c, next) => {
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
if (!
|
|
24
|
-
const { requiredScope } = scopeCheck;
|
|
12
|
+
const principal = getGatewayPrincipal(c);
|
|
13
|
+
const requiredScope = requiredGatewayScope(c.req.method, c.req.path);
|
|
14
|
+
if (!hasGatewayScope(principal.scopes, requiredScope)) {
|
|
25
15
|
log.warn({
|
|
26
16
|
path: c.req.path,
|
|
27
17
|
method: c.req.method,
|
|
18
|
+
principalId: principal.principalId,
|
|
28
19
|
requiredScope
|
|
29
20
|
}, `Scope check failed: missing ${requiredScope}`);
|
|
30
21
|
return c.json({
|
|
@@ -36,4 +27,4 @@ function operatorScopes() {
|
|
|
36
27
|
});
|
|
37
28
|
}
|
|
38
29
|
//#endregion
|
|
39
|
-
export {
|
|
30
|
+
export { gatewayScopes };
|