@xopcai/xopc 0.0.231 → 0.0.233
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-DQ5L3PTi.js} +1 -1
- package/dist/gateway/static/root/assets/agent-avatar-dicebear-Bps8fvBp.js +1 -0
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-JrK80PvP.js +1 -0
- package/dist/gateway/static/root/assets/agents-CJYEnz94.js +1 -0
- package/dist/gateway/static/root/assets/api-DE6tZKG0.js +1 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DP7YVRPn.js → app-management-settings-panel-BryzDVod.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CVQ5n7y6.js → appearance-settings-BoweLBDm.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-Bt8_sWtU.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-7_DXaMTP.js → archive-plugin-DyujzZNu.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-mmr_mHRr.js → attachment-load-DmXGUWve.js} +1 -1
- package/dist/gateway/static/root/assets/attachment-preview-renderer-BDTD8YUe.js +12 -0
- package/dist/gateway/static/root/assets/{automations-page-DfY-T6Ga.js → automations-page-DrTVSK7o.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-86UTesz3.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-CO9QMEh2.js → binary-plugins-mFyeC74W.js} +2 -2
- package/dist/gateway/static/root/assets/{block-editor-CE14CVOy.js → block-editor-D5yMFrgH.js} +4 -4
- package/dist/gateway/static/root/assets/browser-settings-page-DfMU7yXv.js +8 -0
- package/dist/gateway/static/root/assets/browser-workflow-inputs-B6rLBtua.js +1 -0
- package/dist/gateway/static/root/assets/{browser-workflows-page-1wgXyoSO.js → browser-workflows-page-C74sg50f.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-lsHRuBlX.js +7 -0
- package/dist/gateway/static/root/assets/channels-settings-CxR_clkO.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-C5ABr73b.js → channels-status-swr-DowVNjNw.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CdRW6Euc.js → chat-terminal-dock-BO6_BgjE.js} +2 -2
- package/dist/gateway/static/root/assets/{code-editor-dFzqyDXS.js → code-editor-D4_k-6QN.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-CpNLyKB4.js +2 -0
- package/dist/gateway/static/root/assets/cron-expression-CYMXfk4M.js +2 -0
- package/dist/gateway/static/root/assets/date-picker-DIM_OkQP.js +1 -0
- package/dist/gateway/static/root/assets/dependency-picker-Cp8I6rsL.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-settings-MmOR4A3u.js → desktop-pet-settings-NjPiz3M_.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CMO-J3cG.js → desktop-pet-wzSzZ6S8.js} +1 -1
- package/dist/gateway/static/root/assets/dist-DqPZM2MH2.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DdH0dG2_.js → extension-debug-page-CoMl13ET.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Clg-KktN.js → extension-page-CXc1Lc8x.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-CfEWpgjl.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-api-DEHnF4Wm.js → gateway-config-api-yH4KAEkK.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-config-swr-YyZJKvFf.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-settings-DKkEXXj9.js → gateway-settings-BmjJIiKh.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-B_zrtccP.js → gateway-startup-retry-Dnrl91pU.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DGq9q4b6.js +1 -0
- package/dist/gateway/static/root/assets/home-page-Dj4B1wb3.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-BNzAAw4Y.js} +1 -1
- package/dist/gateway/static/root/assets/index-BGf-TiZj.js +70 -0
- package/dist/gateway/static/root/assets/index-BTUuTnc9.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BvpEeHnm.js → keyboard-shortcuts-settings-CfNV1ysF.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-IJg75WaN.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-Bzvn99eH.js → local-apps-page-MPd4Fl_l.js} +1 -1
- package/dist/gateway/static/root/assets/locale-store-D_dq_0LV.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-NsfoazgK.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-DeIjN4e0.js +1 -0
- package/dist/gateway/static/root/assets/markdown-editor-nDLmA_LF.js +2 -0
- package/dist/gateway/static/root/assets/markdown-split-BUAVv6Gu.js +1 -0
- package/dist/gateway/static/root/assets/markdown-view-CPkBOY3h.js +201 -0
- package/dist/gateway/static/root/assets/{media-plugins-D8I7OGnT.js → media-plugins-DFsVnOY-.js} +1 -1
- package/dist/gateway/static/root/assets/messages-D4qOHT4D.js +3 -0
- package/dist/gateway/static/root/assets/mobile-device-api-D9JevyCE.js +1 -0
- package/dist/gateway/static/root/assets/models-hub-cache-C5y2gzMU.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-EpgG-OQc.js → notes-api-BWSfTP1w.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CCvjGMhN.js → notes-page-CV8UJj7g.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-DrjMVgEI.js +4 -0
- package/dist/gateway/static/root/assets/{oauth-api-BwNLwbI8.js → oauth-api-DnanEBsf.js} +1 -1
- package/dist/gateway/static/root/assets/popover-select-3E24E65N.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-MmMswmOU.js → product-open-page-zNg1KOy2.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-tfcGYL-O.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BkjnXLdJ.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BFZrVYfy.js → registry-api-BeVzfRvs.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BXn-3n2d.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Dx6o7sLu.js → runtime-tools-settings-panel-BxoioSvT.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-Cdd9c4vt.js → schema-form-vzbmscrE.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-MLNjrOkw.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-ByNLBY2q.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-D0YxMnhm.js → settings-form-section-x9k7MWD3.js} +1 -1
- package/dist/gateway/static/root/assets/settings-loading-skeleton-BLFOD9h9.js +1 -0
- package/dist/gateway/static/root/assets/settings-page-CwgTooar.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-bnueBZg8.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-DiqBn-oE.js → share-preview-page-COTrPAd-.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-D-v_psqL.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DJICr4wh.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-CZwhWiRl.js → skills-page-D9wM6_Jn.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-kBGr8opZ.js → skills-page.utils-PtlQLM5a.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CPBs6lWi.js → system-settings-panel-BR74mNEK.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-B-rmeE8t.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-Qgvo0Ga7.js → theme-store-Bud54q9e.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-C4YcEiP9.js → use-autosave-DH47MH7s.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-B6eyxxOT.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-B59GaqRa.js +1 -0
- package/dist/gateway/static/root/assets/voice-config-api-C0ahrZ0e.js +1 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CKIdPEen.js → work-discovery-overlay-DTn4RCcx.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BK44Vm5W.js → workflow-run-setup-panel-yDFoEX06.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-BOwSbfWm.js +5 -0
- package/dist/gateway/static/root/index.html +16 -16
- package/dist/package.js +1 -1
- package/dist/packages/endpoint-tools-protocol/src/index.js +162 -2
- package/dist/packages/gateway-contract/src/product-delivery.js +6 -2
- package/dist/packages/gateway-contract/src/turn-outcome.js +77 -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/capabilities/definitions.d.ts +1 -1
- package/dist/src/agent/capabilities/definitions.js +2 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/external-tools/endpoint-provider.js +5 -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/prompt/sections/tooling.js +5 -0
- package/dist/src/agent/service.js +0 -1
- package/dist/src/agent/starter-agents.js +1 -8
- package/dist/src/agent/tools/create-share-tool.js +2 -1
- package/dist/src/agent/tools/exec-command.js +2 -1
- package/dist/src/agent/tools/executor.d.ts +1 -1
- package/dist/src/agent/tools/factory.js +2 -0
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/agent/tools/publish-artifacts.d.ts +2 -0
- package/dist/src/agent/tools/publish-artifacts.js +82 -0
- package/dist/src/agent/tools/send-media.js +2 -1
- package/dist/src/agent/tools/workflow-tool.js +1 -5
- package/dist/src/agent-config/index.d.ts +2 -0
- package/dist/src/agent-config/index.js +11 -0
- package/dist/src/agent-config/resolver.d.ts +11 -0
- package/dist/src/agent-config/resolver.js +113 -0
- package/dist/src/agent-config/schema.d.ts +491 -0
- package/dist/src/agent-config/schema.js +172 -0
- package/dist/src/chat-commands/builtins/config.js +2 -2
- package/dist/src/chat-commands/builtins/review.js +1 -1
- package/dist/src/chat-commands/config-paths.js +1 -1
- package/dist/src/cli/command-catalog.js +4 -0
- package/dist/src/cli/command-loaders.js +1 -0
- package/dist/src/cli/command-manifest.js +4 -0
- package/dist/src/cli/commands/agents.js +2 -1
- package/dist/src/cli/commands/auth.js +1 -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 +13 -12
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/providers.js +1 -1
- package/dist/src/cli/commands/support.d.ts +1 -0
- package/dist/src/cli/commands/support.js +51 -0
- 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/endpoint-tools/binding-service.d.ts +22 -0
- package/dist/src/endpoint-tools/binding-service.js +45 -0
- package/dist/src/endpoint-tools/index.d.ts +1 -0
- package/dist/src/endpoint-tools/index.js +2 -1
- package/dist/src/endpoint-tools/invocation-service.d.ts +1 -0
- package/dist/src/endpoint-tools/invocation-service.js +8 -0
- package/dist/src/endpoint-tools/policy.d.ts +4 -1
- package/dist/src/endpoint-tools/policy.js +68 -5
- package/dist/src/endpoint-tools/registry.js +1 -1
- package/dist/src/endpoint-tools/runtime.d.ts +2 -0
- package/dist/src/endpoint-tools/runtime.js +8 -0
- package/dist/src/extensions/activation-context.js +7 -11
- package/dist/src/files/file-service.js +14 -5
- 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/chat-stream/turn-outcome-collector.js +41 -6
- 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 +4 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +54 -137
- package/dist/src/gateway/hono/lib/config-payload.js +2 -4
- package/dist/src/gateway/hono/middleware/auth.js +36 -3
- 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/endpoint-tools.js +68 -1
- package/dist/src/gateway/hono/routes/files.js +12 -1
- package/dist/src/gateway/hono/routes/global-defaults.js +5 -9
- package/dist/src/gateway/hono/routes/index.js +4 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +12 -20
- package/dist/src/gateway/hono/routes/media.js +46 -2
- package/dist/src/gateway/hono/routes/models.js +2 -2
- package/dist/src/gateway/hono/routes/realtime.js +8 -1
- package/dist/src/gateway/hono/routes/status.js +9 -16
- package/dist/src/gateway/hono/routes/support.d.ts +3 -0
- package/dist/src/gateway/hono/routes/support.js +28 -0
- 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/you.js +24 -0
- package/dist/src/gateway/image-generation-setup.d.ts +2 -2
- package/dist/src/gateway/image-generation-setup.js +8 -7
- package/dist/src/gateway/public-url.d.ts +1 -1
- package/dist/src/gateway/security/gateway-principal.d.ts +11 -0
- package/dist/src/gateway/security/gateway-principal.js +12 -0
- package/dist/src/gateway/security/gateway-scopes.d.ts +7 -0
- package/dist/src/gateway/security/gateway-scopes.js +66 -0
- package/dist/src/gateway/security/index.d.ts +2 -1
- package/dist/src/gateway/security/index.js +3 -2
- package/dist/src/gateway/service.js +7 -7
- package/dist/src/gateway/xopc-cloud-capability-setup.js +19 -21
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/media/store.js +9 -0
- package/dist/src/migrations/index.d.ts +0 -1
- package/dist/src/migrations/index.js +1 -2
- package/dist/src/migrations/runner.js +1 -2
- package/dist/src/notifications/device-store.d.ts +1 -1
- package/dist/src/notifications/device-store.js +11 -11
- package/dist/src/notifications/store.js +3 -3
- package/dist/src/providers/index.js +1 -1
- package/dist/src/providers/model-reference-auditor.js +14 -9
- package/dist/src/realtime/runtime.d.ts +2 -0
- package/dist/src/realtime/runtime.js +27 -3
- package/dist/src/realtime/tickets.d.ts +6 -1
- package/dist/src/realtime/tickets.js +2 -1
- package/dist/src/remote-access/exposure-manager.js +3 -3
- package/dist/src/share/share-url.js +2 -2
- package/dist/src/storage/sqlite/device-access-repository.d.ts +54 -0
- package/dist/src/storage/sqlite/device-access-repository.js +194 -0
- package/dist/src/storage/sqlite/device-pairing-repository.d.ts +22 -0
- package/dist/src/storage/sqlite/device-pairing-repository.js +86 -0
- package/dist/src/storage/sqlite/endpoint-session-binding-repository.d.ts +8 -0
- package/dist/src/storage/sqlite/endpoint-session-binding-repository.js +32 -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 +4 -0
- package/dist/src/storage/sqlite/index.js +5 -1
- package/dist/src/storage/sqlite/migrations/138_device_access.sql +96 -0
- package/dist/src/storage/sqlite/migrations/139_turn_outcome_artifact_backfill.sql +231 -0
- package/dist/src/storage/sqlite/migrations/140_endpoint_session_bindings.sql +8 -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/support/build-support-investigation-prompt.d.ts +2 -0
- package/dist/src/support/build-support-investigation-prompt.js +29 -0
- package/dist/src/support/collect-support-report.d.ts +16 -0
- package/dist/src/support/collect-support-report.js +216 -0
- package/dist/src/support/redact-support-report.d.ts +16 -0
- package/dist/src/support/redact-support-report.js +89 -0
- package/dist/src/support/types.d.ts +76 -0
- package/dist/src/support/types.js +18 -0
- 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/user-context/user-avatar.d.ts +17 -0
- package/dist/src/user-context/user-avatar.js +116 -0
- 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 +4 -4
- package/dist/gateway/static/root/assets/agent-avatar-dicebear-CBqUnlvL.js +0 -1
- package/dist/gateway/static/root/assets/agents-7YO6znTT.js +0 -68
- package/dist/gateway/static/root/assets/api-BywYxpaS.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-DSCia0DT.js +0 -1
- package/dist/gateway/static/root/assets/attachment-preview-renderer-Cmo-5BP5.js +0 -11
- package/dist/gateway/static/root/assets/automations-workspace-BpvD54D6.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CeESA4Oj.js +0 -8
- package/dist/gateway/static/root/assets/browser-workflow-inputs-8NC2qDRF.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-B_OXTojB.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-api-o0y9WgAI.js +0 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-D5nZecxV.js +0 -3
- package/dist/gateway/static/root/assets/channels-settings-BzmnWx6X.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-38FsOnR0.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DX6OkwFQ.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-DYSMZsms.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-DGCfX4tK.js +0 -1
- package/dist/gateway/static/root/assets/dependency-picker-DHDa4ht1.js +0 -1
- package/dist/gateway/static/root/assets/directory-picker-path-field-B9qoxDcn.js +0 -1
- package/dist/gateway/static/root/assets/dist-J_ySZvz0.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-eP3fJ2M6.js +0 -1
- package/dist/gateway/static/root/assets/file-code-corner-byQA1VfD.js +0 -1
- package/dist/gateway/static/root/assets/gateway-config-swr-BWGjnmDl.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DlBPNubY.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BnOrLRfs.js +0 -1
- package/dist/gateway/static/root/assets/html-workspace-editor-bXK5tq64.js +0 -1
- package/dist/gateway/static/root/assets/index-0xQO5B_Q.js +0 -70
- package/dist/gateway/static/root/assets/index-CCyIdGuQ.css +0 -2
- package/dist/gateway/static/root/assets/local-app-workbench-page-Ch1rdUo8.js +0 -2
- package/dist/gateway/static/root/assets/locale-store-CXhjfe4q.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-zxx2ExlY.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-BQaeyOYm.js +0 -1
- package/dist/gateway/static/root/assets/markdown-editor-TWGaF7Xa.js +0 -2
- package/dist/gateway/static/root/assets/markdown-split-D9tmIiEm.js +0 -1
- package/dist/gateway/static/root/assets/markdown-view-RxNHwlNo.js +0 -201
- package/dist/gateway/static/root/assets/messages-BMdD0LWk.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-cache-0RjEwafI.js +0 -1
- package/dist/gateway/static/root/assets/notes-workbench-9cgh77VH.js +0 -4
- package/dist/gateway/static/root/assets/popover-select-CccGri5Y.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-hf6pmH4p.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-By2U-Wdh.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CUcpp7CQ.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-ByI82xS1.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BCoI5IJ8.js +0 -1
- package/dist/gateway/static/root/assets/settings-loading-skeleton-y53gEKsF.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-BoE_tToG.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BQmyb5KC.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-Bf3VpZ-R.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CXHlbuGS.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-Bo0KSZ2v.js +0 -1
- package/dist/gateway/static/root/assets/typed-models-lib-q5-Vfqd8.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-Cnj7gMX2.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-BML8zCwZ.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-CB98MTwG.js +0 -5
- package/dist/src/agent-manifest/index.d.ts +0 -5
- package/dist/src/agent-manifest/index.js +0 -10
- package/dist/src/agent-manifest/preset-chain.d.ts +0 -10
- package/dist/src/agent-manifest/preset-chain.js +0 -30
- package/dist/src/agent-manifest/prompt.d.ts +0 -2
- package/dist/src/agent-manifest/prompt.js +0 -49
- package/dist/src/agent-manifest/resolver.d.ts +0 -32
- package/dist/src/agent-manifest/resolver.js +0 -114
- package/dist/src/agent-manifest/schema.d.ts +0 -695
- package/dist/src/agent-manifest/schema.js +0 -226
- package/dist/src/agent-manifest/validator.d.ts +0 -25
- package/dist/src/agent-manifest/validator.js +0 -74
- package/dist/src/agent-runtime/boundary-guard.d.ts +0 -12
- package/dist/src/agent-runtime/boundary-guard.js +0 -21
- package/dist/src/agent-runtime/index.d.ts +0 -7
- package/dist/src/agent-runtime/index.js +0 -8
- package/dist/src/agent-runtime/model-router.d.ts +0 -11
- package/dist/src/agent-runtime/model-router.js +0 -14
- package/dist/src/agent-runtime/run-trace.d.ts +0 -27
- package/dist/src/agent-runtime/run-trace.js +0 -51
- package/dist/src/agent-runtime/runtime-profile.d.ts +0 -26
- package/dist/src/agent-runtime/runtime-profile.js +0 -42
- package/dist/src/agent-runtime/tool-registry.d.ts +0 -28
- package/dist/src/agent-runtime/tool-registry.js +0 -50
- package/dist/src/agent-runtime/workflow-runtime.d.ts +0 -31
- package/dist/src/agent-runtime/workflow-runtime.js +0 -32
- package/dist/src/config/agent-typed-models.d.ts +0 -13
- package/dist/src/config/agent-typed-models.js +0 -48
- package/dist/src/gateway/capability-presets-admin.d.ts +0 -88
- package/dist/src/gateway/capability-presets-admin.js +0 -303
- package/dist/src/gateway/hono/lib/agent-model.d.ts +0 -35
- package/dist/src/gateway/hono/lib/agent-model.js +0 -97
- package/dist/src/gateway/hono/routes/capability-presets.d.ts +0 -3
- package/dist/src/gateway/hono/routes/capability-presets.js +0 -187
- package/dist/src/gateway/hono/routes/mobile.d.ts +0 -3
- package/dist/src/gateway/security/operator-scopes.d.ts +0 -37
- package/dist/src/gateway/security/operator-scopes.js +0 -147
- package/dist/src/migrations/config/default-capability-preset.d.ts +0 -10
- package/dist/src/migrations/config/default-capability-preset.js +0 -133
- package/dist/src/tunnel/enable-lan-pairing.d.ts +0 -8
- package/dist/src/tunnel/enable-lan-pairing.js +0 -41
- package/dist/src/tunnel/pair-context.d.ts +0 -36
- package/dist/src/tunnel/pair-context.js +0 -77
- package/dist/src/tunnel/pair-url.d.ts +0 -43
- package/dist/src/tunnel/pair-url.js +0 -117
- package/dist/src/tunnel/pairing-rate-limit.d.ts +0 -12
- package/dist/src/tunnel/pairing-rate-limit.js +0 -28
- package/dist/src/tunnel/pairing.d.ts +0 -21
- package/dist/src/tunnel/pairing.js +0 -103
- package/dist/src/tunnel/tunnel-qr.d.ts +0 -9
- package/dist/src/tunnel/tunnel-qr.js +0 -29
|
@@ -1,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";
|
|
5
4
|
import { isWithinActiveHours } from "../../heartbeat/active-hours.js";
|
|
6
5
|
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";
|
|
@@ -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
|
|
@@ -29,7 +31,7 @@ function extractTokenFromHeader(authHeader) {
|
|
|
29
31
|
}
|
|
30
32
|
/**
|
|
31
33
|
* SECURITY: query-string tokens leak into server logs, Referer headers, and
|
|
32
|
-
* browser history. We accept them only for
|
|
34
|
+
* browser history. We accept them only for avatar `<img>` loads, where an
|
|
33
35
|
* Authorization header cannot be set. Realtime WebSocket authentication uses a
|
|
34
36
|
* one-time ticket acquired over authenticated HTTP.
|
|
35
37
|
*/
|
|
@@ -37,9 +39,10 @@ function extractTokenFromQuery(url) {
|
|
|
37
39
|
return new URL(url).searchParams.get("token");
|
|
38
40
|
}
|
|
39
41
|
const AGENT_AVATAR_GET_PATH = /^\/api\/agents\/[^/]+\/avatar$/;
|
|
42
|
+
const USER_AVATAR_GET_PATH = "/api/you/avatar";
|
|
40
43
|
/** Exported for gateway security tests. */
|
|
41
44
|
function isQueryTokenAllowedPath(path, method) {
|
|
42
|
-
if (method === "GET" && AGENT_AVATAR_GET_PATH.test(path)) return true;
|
|
45
|
+
if (method === "GET" && (AGENT_AVATAR_GET_PATH.test(path) || path === USER_AVATAR_GET_PATH)) return true;
|
|
43
46
|
return false;
|
|
44
47
|
}
|
|
45
48
|
function resolveRemoteAddress(c) {
|
|
@@ -165,10 +168,22 @@ function auth(config) {
|
|
|
165
168
|
}, 401);
|
|
166
169
|
}
|
|
167
170
|
recordSuccess(rl);
|
|
171
|
+
setGatewayPrincipal(c, {
|
|
172
|
+
kind: "trusted-proxy",
|
|
173
|
+
principalId: result.user,
|
|
174
|
+
scopes: ["gateway.admin"]
|
|
175
|
+
});
|
|
168
176
|
await next();
|
|
169
177
|
return;
|
|
170
178
|
}
|
|
171
|
-
if (authMode === "none")
|
|
179
|
+
if (authMode === "none") {
|
|
180
|
+
setGatewayPrincipal(c, {
|
|
181
|
+
kind: "owner",
|
|
182
|
+
principalId: "gateway-owner",
|
|
183
|
+
scopes: ["gateway.admin"]
|
|
184
|
+
});
|
|
185
|
+
return next();
|
|
186
|
+
}
|
|
172
187
|
const expectedCredential = resolveExpectedCredential(resolvedAuth);
|
|
173
188
|
if (!expectedCredential) {
|
|
174
189
|
log.error({
|
|
@@ -196,6 +211,24 @@ function auth(config) {
|
|
|
196
211
|
const providedCredential = authHeader || queryToken;
|
|
197
212
|
if (providedCredential && validateCredential(providedCredential, expectedCredential)) {
|
|
198
213
|
recordSuccess(rl);
|
|
214
|
+
setGatewayPrincipal(c, {
|
|
215
|
+
kind: "owner",
|
|
216
|
+
principalId: "gateway-owner",
|
|
217
|
+
scopes: ["gateway.admin"]
|
|
218
|
+
});
|
|
219
|
+
await next();
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
const deviceIdentity = providedCredential?.startsWith("xopc_at_") ? authenticateDeviceAccessToken(providedCredential) : void 0;
|
|
223
|
+
if (deviceIdentity) {
|
|
224
|
+
recordSuccess(rl);
|
|
225
|
+
setGatewayPrincipal(c, {
|
|
226
|
+
kind: "device",
|
|
227
|
+
principalId: deviceIdentity.deviceId,
|
|
228
|
+
deviceId: deviceIdentity.deviceId,
|
|
229
|
+
accessSessionId: deviceIdentity.accessSessionId,
|
|
230
|
+
scopes: deviceIdentity.scopes
|
|
231
|
+
});
|
|
199
232
|
await next();
|
|
200
233
|
return;
|
|
201
234
|
}
|
|
@@ -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 };
|