@xopcai/xopc 0.0.231 → 0.0.232
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/README.zh-CN.md +1 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/schema/config-schema.d.ts +3 -3
- package/dist/extensions/telegram/src/config-schema.d.ts +4 -4
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/config-schema.d.ts +3 -3
- package/dist/gateway/static/root/assets/{activity-store-M0nAY5XB.js → activity-store-VXCWz43N.js} +1 -1
- package/dist/gateway/static/root/assets/agent-avatar-dicebear-BXRaZYW8.js +1 -0
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-dR7HMaRX.js +1 -0
- package/dist/gateway/static/root/assets/agents-Bileycwe.js +1 -0
- package/dist/gateway/static/root/assets/api-wGPgL8xY.js +1 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DP7YVRPn.js → app-management-settings-panel-BJfClfPx.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CVQ5n7y6.js → appearance-settings-C_R0vUAu.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DSCia0DT.js → apps-page-CBow8pBI.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-7_DXaMTP.js → archive-plugin-DnFHkSHE.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-mmr_mHRr.js → attachment-load-DZrEwytM.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DfY-T6Ga.js → automations-page-DpkKajui.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BBntVWgv.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-CO9QMEh2.js → binary-plugins-Ckc_Csue.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CE14CVOy.js → block-editor-DAC6w-iV.js} +4 -4
- package/dist/gateway/static/root/assets/browser-settings-page-DrsMd-Po.js +8 -0
- package/dist/gateway/static/root/assets/browser-workflow-inputs-BGd7R8GO.js +1 -0
- package/dist/gateway/static/root/assets/{browser-workflows-page-1wgXyoSO.js → browser-workflows-page-DUfj7ntM.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-97gkGeSV.js +7 -0
- package/dist/gateway/static/root/assets/channels-settings-CuBsz8UI.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-C5ABr73b.js → channels-status-swr-CfboECLt.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CdRW6Euc.js → chat-terminal-dock-CA9fndbZ.js} +2 -2
- package/dist/gateway/static/root/assets/{code-editor-dFzqyDXS.js → code-editor-D4_k-6QN.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-SuL7td7Z.js +2 -0
- package/dist/gateway/static/root/assets/cron-expression-CqPu7HYJ.js +2 -0
- package/dist/gateway/static/root/assets/date-picker-C8dJsCgk.js +1 -0
- package/dist/gateway/static/root/assets/dependency-picker-Iz2wYimy.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-CMO-J3cG.js → desktop-pet-C3h40FmG.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-MmOR4A3u.js → desktop-pet-settings-YfeVVzLe.js} +1 -1
- package/dist/gateway/static/root/assets/dist-DqPZM2MH2.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DdH0dG2_.js → extension-debug-page-CChgztz_.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Clg-KktN.js → extension-page-DF6ct6_y.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-jgBsjn0F.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-api-DEHnF4Wm.js → gateway-config-api-CVajuIGL.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-config-swr-BGQn8duh.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-BbssNGid.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-B_zrtccP.js → gateway-startup-retry-D2Rnh9fX.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-CJtXu8iD.js +1 -0
- package/dist/gateway/static/root/assets/home-page-Be1o1AXQ.js +1 -0
- package/dist/gateway/static/root/assets/html-workspace-editor-C3DKAkMc.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-YKP2me5Z.js → image-generation-api-D7W2p5_8.js} +1 -1
- package/dist/gateway/static/root/assets/index-B2OJSXX9.js +70 -0
- package/dist/gateway/static/root/assets/index-rHjAElxG.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BvpEeHnm.js → keyboard-shortcuts-settings-BvHYyNus.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-COfelgk7.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-Bzvn99eH.js → local-apps-page-Cb8t2wWM.js} +1 -1
- package/dist/gateway/static/root/assets/locale-store-DLwVxS3V.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-DA8oDjeB.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-B8Jie4-J.js +1 -0
- package/dist/gateway/static/root/assets/markdown-editor-nDLmA_LF.js +2 -0
- package/dist/gateway/static/root/assets/markdown-split-BD1r4o2i.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-RxNHwlNo.js → markdown-view-B-BHEcNd.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-D8I7OGnT.js → media-plugins-BCev8fkW.js} +1 -1
- package/dist/gateway/static/root/assets/messages-Dp1OxSKt.js +3 -0
- package/dist/gateway/static/root/assets/mobile-device-api-DACoHhhk.js +1 -0
- package/dist/gateway/static/root/assets/{models-hub-cache-0RjEwafI.js → models-hub-cache-C8zjqmIv.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-api-EpgG-OQc.js → notes-api-DEdNKw0I.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CCvjGMhN.js → notes-page-BBTLjJwa.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-DICgUGPv.js +4 -0
- package/dist/gateway/static/root/assets/{oauth-api-BwNLwbI8.js → oauth-api-BNCO2YK5.js} +1 -1
- package/dist/gateway/static/root/assets/popover-select-3E24E65N.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-MmMswmOU.js → product-open-page-fEBbRekH.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-CqdkznYJ.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-dHDXpMCg.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BFZrVYfy.js → registry-api-Cvr4Qm7N.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-2feZudJw.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Dx6o7sLu.js → runtime-tools-settings-panel-BT5B74IH.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-Cdd9c4vt.js → schema-form-C4tB34S5.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-CO2JCFdy.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DxMVaqdn.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-D0YxMnhm.js → settings-form-section-D1oXhkgI.js} +1 -1
- package/dist/gateway/static/root/assets/settings-loading-skeleton-CldfX6FJ.js +1 -0
- package/dist/gateway/static/root/assets/settings-page-c3LJnbvE.js +1 -0
- package/dist/gateway/static/root/assets/settings-shell-layer-context-DCp6ykjQ.js +1 -0
- package/dist/gateway/static/root/assets/setup-status-panel-DZNHb6A5.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-DiqBn-oE.js → share-preview-page-DptCK_mk.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DakZ2AGN.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-BOiNkWJC.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-CZwhWiRl.js → skills-page-OHBeBtSg.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-kBGr8opZ.js → skills-page.utils-B9WZbOLC.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CPBs6lWi.js → system-settings-panel-Dj_DpOGw.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-D5Nbe3C8.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-Qgvo0Ga7.js → theme-store-Cpd3Gd5R.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-C4YcEiP9.js → use-autosave-DCl5Yq7N.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-CAPSUK8B.js +1 -0
- package/dist/gateway/static/root/assets/{vendor-codemirror-DRr7hFaD.js → vendor-codemirror--gTq3YAI.js} +16 -16
- package/dist/gateway/static/root/assets/voice-api-key-field-BB_ZQV8F.js +1 -0
- package/dist/gateway/static/root/assets/voice-config-api-BNiYmpl5.js +1 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CKIdPEen.js → work-discovery-overlay-BrIdtdum.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BK44Vm5W.js → workflow-run-setup-panel-hKh-uCLo.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-ahDvypGO.js +5 -0
- package/dist/gateway/static/root/index.html +16 -16
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +1 -2
- package/dist/src/agent/agent-manager.js +29 -44
- package/dist/src/agent/background-review/run-background-review.js +10 -15
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/external-tools/mcp-provider.js +3 -13
- package/dist/src/agent/image/generation/runtime.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +13 -14
- package/dist/src/agent/mcp/bundle-mcp-policy.d.ts +0 -9
- package/dist/src/agent/mcp/bundle-mcp-policy.js +1 -13
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
- package/dist/src/agent/mcp/index.js +2 -2
- package/dist/src/agent/media-generation/runtime-shared.d.ts +1 -1
- package/dist/src/agent/media-generation/runtime-shared.js +1 -1
- package/dist/src/agent/memory/create-memory-manager.js +1 -1
- package/dist/src/agent/memory/manager.d.ts +1 -1
- package/dist/src/{agent-runtime/memory-runtime.d.ts → agent/memory/runtime.d.ts} +1 -1
- package/dist/src/{agent-runtime/memory-runtime.js → agent/memory/runtime.js} +2 -3
- package/dist/src/agent/orchestration/agent-orchestrator.d.ts +0 -3
- package/dist/src/agent/orchestration/agent-orchestrator.js +1 -3
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +2 -2
- package/dist/src/agent/service.js +0 -1
- package/dist/src/agent/starter-agents.js +1 -8
- package/dist/src/agent/tools/executor.d.ts +1 -1
- package/dist/src/agent/tools/workflow-tool.js +1 -5
- package/dist/src/agent-config/index.d.ts +2 -0
- package/dist/src/agent-config/index.js +11 -0
- package/dist/src/agent-config/resolver.d.ts +11 -0
- package/dist/src/agent-config/resolver.js +113 -0
- package/dist/src/agent-config/schema.d.ts +491 -0
- package/dist/src/agent-config/schema.js +172 -0
- package/dist/src/chat-commands/builtins/config.js +2 -2
- package/dist/src/chat-commands/builtins/review.js +1 -1
- package/dist/src/chat-commands/config-paths.js +1 -1
- package/dist/src/cli/commands/agents.js +2 -1
- package/dist/src/cli/commands/config.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +12 -4
- package/dist/src/cli/commands/image.js +3 -4
- package/dist/src/cli/commands/models.js +9 -3
- package/dist/src/cli/commands/onboard/model.js +12 -11
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/tunnel.js +3 -18
- package/dist/src/cli/utils/init-workspace-core.d.ts +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/commands/agents.config.d.ts +1 -3
- package/dist/src/commands/agents.config.js +9 -26
- package/dist/src/config/agent-model-intents.d.ts +10 -0
- package/dist/src/config/agent-model-intents.js +39 -0
- package/dist/src/config/agent-profile.d.ts +7 -9
- package/dist/src/config/agent-profile.js +30 -28
- package/dist/src/config/default-model.d.ts +1 -11
- package/dist/src/config/default-model.js +3 -11
- package/dist/src/config/index.js +3 -3
- package/dist/src/config/integration.d.ts +1 -1
- package/dist/src/config/reload.js +1 -1
- package/dist/src/config/rules.js +3 -3
- package/dist/src/config/schema.d.ts +187 -452
- package/dist/src/config/schema.js +53 -131
- package/dist/src/extensions/activation-context.js +7 -11
- package/dist/src/gateway/agent-builtin-tools.d.ts +250 -6
- package/dist/src/gateway/agent-builtin-tools.js +284 -46
- package/dist/src/gateway/agents-admin.d.ts +20 -62
- package/dist/src/gateway/agents-admin.js +36 -228
- package/dist/src/gateway/device-routes.d.ts +3 -0
- package/dist/src/gateway/device-routes.js +47 -0
- package/dist/src/gateway/global-defaults-admin.d.ts +6 -20
- package/dist/src/gateway/global-defaults-admin.js +20 -120
- package/dist/src/gateway/hono/app.js +4 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +54 -137
- package/dist/src/gateway/hono/lib/config-payload.js +2 -4
- package/dist/src/gateway/hono/middleware/auth.js +33 -1
- package/dist/src/gateway/hono/middleware/scopes.d.ts +2 -12
- package/dist/src/gateway/hono/middleware/scopes.js +9 -18
- package/dist/src/gateway/hono/routes/agents.js +64 -100
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/device-push.d.ts +2 -0
- package/dist/src/gateway/hono/routes/{mobile.js → device-push.js} +40 -18
- package/dist/src/gateway/hono/routes/devices.d.ts +4 -0
- package/dist/src/gateway/hono/routes/devices.js +214 -0
- package/dist/src/gateway/hono/routes/files.js +5 -1
- package/dist/src/gateway/hono/routes/global-defaults.js +5 -9
- package/dist/src/gateway/hono/routes/index.js +4 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +4 -20
- package/dist/src/gateway/hono/routes/models.js +2 -2
- package/dist/src/gateway/hono/routes/realtime.js +8 -1
- package/dist/src/gateway/hono/routes/status.js +9 -16
- package/dist/src/gateway/hono/routes/tunnel.d.ts +0 -2
- package/dist/src/gateway/hono/routes/tunnel.js +10 -199
- package/dist/src/gateway/image-generation-setup.d.ts +2 -2
- package/dist/src/gateway/image-generation-setup.js +8 -7
- package/dist/src/gateway/public-url.d.ts +1 -1
- package/dist/src/gateway/security/gateway-principal.d.ts +11 -0
- package/dist/src/gateway/security/gateway-principal.js +12 -0
- package/dist/src/gateway/security/gateway-scopes.d.ts +7 -0
- package/dist/src/gateway/security/gateway-scopes.js +66 -0
- package/dist/src/gateway/security/index.d.ts +2 -1
- package/dist/src/gateway/security/index.js +3 -2
- package/dist/src/gateway/service.js +7 -7
- package/dist/src/gateway/xopc-cloud-capability-setup.js +19 -21
- package/dist/src/migrations/index.d.ts +0 -1
- package/dist/src/migrations/index.js +1 -2
- package/dist/src/migrations/runner.js +1 -2
- package/dist/src/notifications/device-store.d.ts +1 -1
- package/dist/src/notifications/device-store.js +11 -11
- package/dist/src/notifications/store.js +3 -3
- package/dist/src/providers/index.js +1 -1
- package/dist/src/providers/model-reference-auditor.js +14 -9
- package/dist/src/realtime/runtime.d.ts +2 -0
- package/dist/src/realtime/runtime.js +27 -3
- package/dist/src/realtime/tickets.d.ts +6 -1
- package/dist/src/realtime/tickets.js +2 -1
- package/dist/src/remote-access/exposure-manager.js +3 -3
- package/dist/src/share/share-url.js +2 -2
- package/dist/src/storage/sqlite/device-access-repository.d.ts +54 -0
- package/dist/src/storage/sqlite/device-access-repository.js +194 -0
- package/dist/src/storage/sqlite/device-pairing-repository.d.ts +22 -0
- package/dist/src/storage/sqlite/device-pairing-repository.js +86 -0
- package/dist/src/storage/sqlite/gateway-identity-repository.d.ts +10 -0
- package/dist/src/storage/sqlite/gateway-identity-repository.js +50 -0
- package/dist/src/storage/sqlite/index.d.ts +3 -0
- package/dist/src/storage/sqlite/index.js +4 -1
- package/dist/src/storage/sqlite/migrations/138_device_access.sql +96 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/tunnel/consent.d.ts +1 -1
- package/dist/src/tunnel/consent.js +1 -1
- package/dist/src/tunnel/gateway-lifecycle.js +1 -1
- package/dist/src/tunnel/index.d.ts +1 -4
- package/dist/src/tunnel/index.js +3 -5
- package/dist/src/tunnel/tunnel-audit.d.ts +1 -1
- package/dist/src/tunnel/tunnel-config.js +1 -1
- package/dist/src/tunnel/tunnel-service.d.ts +2 -3
- package/dist/src/tunnel/tunnel-service.js +1 -20
- package/dist/src/tunnel/tunnel-types.d.ts +0 -6
- package/dist/src/workflows/draft/workflow-draft-service.js +2 -2
- package/dist/src/workflows/service/workflow-run-service.js +3 -3
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agent-avatar-dicebear-CBqUnlvL.js +0 -1
- package/dist/gateway/static/root/assets/agents-7YO6znTT.js +0 -68
- package/dist/gateway/static/root/assets/api-BywYxpaS.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-BpvD54D6.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CeESA4Oj.js +0 -8
- package/dist/gateway/static/root/assets/browser-workflow-inputs-8NC2qDRF.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-B_OXTojB.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-api-o0y9WgAI.js +0 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-D5nZecxV.js +0 -3
- package/dist/gateway/static/root/assets/channels-settings-BzmnWx6X.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-38FsOnR0.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DX6OkwFQ.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-DYSMZsms.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-DGCfX4tK.js +0 -1
- package/dist/gateway/static/root/assets/dependency-picker-DHDa4ht1.js +0 -1
- package/dist/gateway/static/root/assets/directory-picker-path-field-B9qoxDcn.js +0 -1
- package/dist/gateway/static/root/assets/dist-J_ySZvz0.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-eP3fJ2M6.js +0 -1
- package/dist/gateway/static/root/assets/file-code-corner-byQA1VfD.js +0 -1
- package/dist/gateway/static/root/assets/gateway-config-swr-BWGjnmDl.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-DKkEXXj9.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DlBPNubY.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BnOrLRfs.js +0 -1
- package/dist/gateway/static/root/assets/html-workspace-editor-bXK5tq64.js +0 -1
- package/dist/gateway/static/root/assets/index-0xQO5B_Q.js +0 -70
- package/dist/gateway/static/root/assets/index-CCyIdGuQ.css +0 -2
- package/dist/gateway/static/root/assets/local-app-workbench-page-Ch1rdUo8.js +0 -2
- package/dist/gateway/static/root/assets/locale-store-CXhjfe4q.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-zxx2ExlY.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-BQaeyOYm.js +0 -1
- package/dist/gateway/static/root/assets/markdown-editor-TWGaF7Xa.js +0 -2
- package/dist/gateway/static/root/assets/markdown-split-D9tmIiEm.js +0 -1
- package/dist/gateway/static/root/assets/messages-BMdD0LWk.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-9cgh77VH.js +0 -4
- package/dist/gateway/static/root/assets/popover-select-CccGri5Y.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-hf6pmH4p.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-By2U-Wdh.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CUcpp7CQ.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-ByI82xS1.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BCoI5IJ8.js +0 -1
- package/dist/gateway/static/root/assets/settings-loading-skeleton-y53gEKsF.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-BoE_tToG.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BQmyb5KC.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-Bf3VpZ-R.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CXHlbuGS.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-Bo0KSZ2v.js +0 -1
- package/dist/gateway/static/root/assets/typed-models-lib-q5-Vfqd8.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-Cnj7gMX2.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-BML8zCwZ.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-CB98MTwG.js +0 -5
- package/dist/src/agent-manifest/index.d.ts +0 -5
- package/dist/src/agent-manifest/index.js +0 -10
- package/dist/src/agent-manifest/preset-chain.d.ts +0 -10
- package/dist/src/agent-manifest/preset-chain.js +0 -30
- package/dist/src/agent-manifest/prompt.d.ts +0 -2
- package/dist/src/agent-manifest/prompt.js +0 -49
- package/dist/src/agent-manifest/resolver.d.ts +0 -32
- package/dist/src/agent-manifest/resolver.js +0 -114
- package/dist/src/agent-manifest/schema.d.ts +0 -695
- package/dist/src/agent-manifest/schema.js +0 -226
- package/dist/src/agent-manifest/validator.d.ts +0 -25
- package/dist/src/agent-manifest/validator.js +0 -74
- package/dist/src/agent-runtime/boundary-guard.d.ts +0 -12
- package/dist/src/agent-runtime/boundary-guard.js +0 -21
- package/dist/src/agent-runtime/index.d.ts +0 -7
- package/dist/src/agent-runtime/index.js +0 -8
- package/dist/src/agent-runtime/model-router.d.ts +0 -11
- package/dist/src/agent-runtime/model-router.js +0 -14
- package/dist/src/agent-runtime/run-trace.d.ts +0 -27
- package/dist/src/agent-runtime/run-trace.js +0 -51
- package/dist/src/agent-runtime/runtime-profile.d.ts +0 -26
- package/dist/src/agent-runtime/runtime-profile.js +0 -42
- package/dist/src/agent-runtime/tool-registry.d.ts +0 -28
- package/dist/src/agent-runtime/tool-registry.js +0 -50
- package/dist/src/agent-runtime/workflow-runtime.d.ts +0 -31
- package/dist/src/agent-runtime/workflow-runtime.js +0 -32
- package/dist/src/config/agent-typed-models.d.ts +0 -13
- package/dist/src/config/agent-typed-models.js +0 -48
- package/dist/src/gateway/capability-presets-admin.d.ts +0 -88
- package/dist/src/gateway/capability-presets-admin.js +0 -303
- package/dist/src/gateway/hono/lib/agent-model.d.ts +0 -35
- package/dist/src/gateway/hono/lib/agent-model.js +0 -97
- package/dist/src/gateway/hono/routes/capability-presets.d.ts +0 -3
- package/dist/src/gateway/hono/routes/capability-presets.js +0 -187
- package/dist/src/gateway/hono/routes/mobile.d.ts +0 -3
- package/dist/src/gateway/security/operator-scopes.d.ts +0 -37
- package/dist/src/gateway/security/operator-scopes.js +0 -147
- package/dist/src/migrations/config/default-capability-preset.d.ts +0 -10
- package/dist/src/migrations/config/default-capability-preset.js +0 -133
- package/dist/src/tunnel/enable-lan-pairing.d.ts +0 -8
- package/dist/src/tunnel/enable-lan-pairing.js +0 -41
- package/dist/src/tunnel/pair-context.d.ts +0 -36
- package/dist/src/tunnel/pair-context.js +0 -77
- package/dist/src/tunnel/pair-url.d.ts +0 -43
- package/dist/src/tunnel/pair-url.js +0 -117
- package/dist/src/tunnel/pairing-rate-limit.d.ts +0 -12
- package/dist/src/tunnel/pairing-rate-limit.js +0 -28
- package/dist/src/tunnel/pairing.d.ts +0 -21
- package/dist/src/tunnel/pairing.js +0 -103
- package/dist/src/tunnel/tunnel-qr.d.ts +0 -9
- package/dist/src/tunnel/tunnel-qr.js +0 -29
|
@@ -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 };
|
|
@@ -1,83 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { AgentModelsOverrideSchema, AgentProfileSchema, RuntimePolicySchema, SkillOverrideSchema, ToolPoliciesSchema, WorkflowPolicySchema } from "../../../agent-config/schema.js";
|
|
2
|
+
import { init_agent_config } from "../../../agent-config/index.js";
|
|
3
3
|
import { init_agent_scope, normalizeAgentId } from "../../../agent/agent-scope.js";
|
|
4
|
-
import { deleteAgentAvatarFile, finalizeCreateAgentDirs,
|
|
4
|
+
import { deleteAgentAvatarFile, finalizeCreateAgentDirs, getGatewayAgentEffectiveConfig, listAgentProfileFiles, listGatewayAgents, prepareCreateAgent, prepareDeleteAgent, prepareUpdateAgent, readAgentAvatarFile, readAgentProfileFile, runAfterDeletePurge, writeAgentAvatarFromBase64, writeAgentProfileFile } from "../../agents-admin.js";
|
|
5
5
|
import { getVoiceModelsConfig } from "../../../config/voice.js";
|
|
6
6
|
//#region src/gateway/hono/routes/agents.ts
|
|
7
|
-
|
|
8
|
-
init_schema();
|
|
7
|
+
init_agent_config();
|
|
9
8
|
init_agent_scope();
|
|
10
|
-
function parseProfileFiles(raw) {
|
|
11
|
-
if (raw === void 0) return;
|
|
12
|
-
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return { error: "profileFiles must be an object" };
|
|
13
|
-
const profileFiles = {};
|
|
14
|
-
for (const [name, content] of Object.entries(raw)) {
|
|
15
|
-
if (typeof content !== "string") return { error: `profileFiles["${name}"] must be a string` };
|
|
16
|
-
profileFiles[name] = content;
|
|
17
|
-
}
|
|
18
|
-
return profileFiles;
|
|
19
|
-
}
|
|
20
9
|
function isParseError(value) {
|
|
21
10
|
return typeof value === "object" && value !== null && "error" in value && typeof value.error === "string";
|
|
22
11
|
}
|
|
23
12
|
function parseCreateAgentBody(raw) {
|
|
24
13
|
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return { error: "each agent must be an object" };
|
|
25
14
|
const body = raw;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
15
|
+
const allowedKeys = new Set([
|
|
16
|
+
"id",
|
|
17
|
+
"workspace",
|
|
18
|
+
"profile"
|
|
19
|
+
]);
|
|
20
|
+
const unknownKey = Object.keys(body).find((key) => !allowedKeys.has(key));
|
|
21
|
+
if (unknownKey) return { error: `unknown create-agent field "${unknownKey}"` };
|
|
22
|
+
const workspace = typeof body.workspace === "string" ? body.workspace : void 0;
|
|
23
|
+
const profile = AgentProfileSchema.safeParse(body.profile);
|
|
24
|
+
if (!profile.success) return { error: `profile ${profile.error.issues[0]?.message ?? "is required"}` };
|
|
35
25
|
const id = typeof body.id === "string" ? body.id : void 0;
|
|
36
|
-
const presetIds = Object.hasOwn(body, "extends") ? Array.isArray(body.extends) ? body.extends.map((x) => normalizeAgentId(String(x))).filter(Boolean) : null : void 0;
|
|
37
|
-
if (presetIds === null) return { error: "extends must be an array" };
|
|
38
|
-
const skills = Object.hasOwn(body, "skills") ? Array.isArray(body.skills) ? body.skills.map((x) => String(x).trim()).filter(Boolean) : null : void 0;
|
|
39
|
-
if (skills === null) return { error: "skills must be an array" };
|
|
40
|
-
const toolsRaw = Object.hasOwn(body, "tools") ? body.tools : void 0;
|
|
41
|
-
let tools;
|
|
42
|
-
if (toolsRaw !== void 0) {
|
|
43
|
-
if (toolsRaw === null || typeof toolsRaw !== "object" || Array.isArray(toolsRaw)) return { error: "tools must be an object" };
|
|
44
|
-
const parsedTools = ToolPolicySetSchema.safeParse(toolsRaw);
|
|
45
|
-
if (!parsedTools.success) return { error: `tools ${parsedTools.error.issues[0]?.message ?? "is invalid"}` };
|
|
46
|
-
tools = parsedTools.data;
|
|
47
|
-
}
|
|
48
|
-
let profileFiles;
|
|
49
|
-
if (Object.hasOwn(body, "profileFiles")) {
|
|
50
|
-
const parsed = parseProfileFiles(body.profileFiles);
|
|
51
|
-
if (isParseError(parsed)) return parsed;
|
|
52
|
-
profileFiles = parsed;
|
|
53
|
-
}
|
|
54
|
-
if (!profileFiles?.["IDENTITY.md"] && typeof body.cloneFrom !== "string") return { error: "profileFiles.IDENTITY.md is required" };
|
|
55
|
-
const cloneFrom = typeof body.cloneFrom === "string" ? body.cloneFrom : void 0;
|
|
56
26
|
return {
|
|
57
27
|
workspace,
|
|
58
|
-
|
|
59
|
-
...id !== void 0 ? { id } : {}
|
|
60
|
-
...presetIds !== void 0 ? { extends: presetIds } : {},
|
|
61
|
-
...skills !== void 0 ? { skills } : {},
|
|
62
|
-
...tools !== void 0 ? { tools } : {},
|
|
63
|
-
...profileFiles !== void 0 ? { profileFiles } : {},
|
|
64
|
-
...cloneFrom !== void 0 ? { cloneFrom } : {}
|
|
28
|
+
profile: profile.data,
|
|
29
|
+
...id !== void 0 ? { id } : {}
|
|
65
30
|
};
|
|
66
31
|
}
|
|
67
32
|
function parsePatchModels(raw) {
|
|
68
33
|
if (raw === void 0) return;
|
|
69
34
|
if (raw === null) return null;
|
|
70
35
|
if (typeof raw !== "object" || Array.isArray(raw)) return { error: "models must be an object or null" };
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
if (Object.hasOwn(body, "defaultRole")) out.defaultRole = body.defaultRole === null ? null : String(body.defaultRole ?? "").trim();
|
|
74
|
-
if (Object.hasOwn(body, "roles")) if (body.roles === null) return { error: "models.roles must be an object" };
|
|
75
|
-
else {
|
|
76
|
-
const parsed = AgentModelsSchema.safeParse({ roles: body.roles });
|
|
77
|
-
if (!parsed.success) return { error: `models.roles ${parsed.error.issues[0]?.message ?? "is invalid"}` };
|
|
78
|
-
out.roles = parsed.data?.roles;
|
|
79
|
-
}
|
|
80
|
-
return out;
|
|
36
|
+
const parsed = AgentModelsOverrideSchema.safeParse(raw);
|
|
37
|
+
return parsed.success ? parsed.data : { error: `models ${parsed.error.issues[0]?.message ?? "is invalid"}` };
|
|
81
38
|
}
|
|
82
39
|
function registerAgentsRoutes(authenticated, deps) {
|
|
83
40
|
const { service, strictRateLimitMiddleware } = deps;
|
|
@@ -115,10 +72,7 @@ function registerAgentsRoutes(authenticated, deps) {
|
|
|
115
72
|
ok: false,
|
|
116
73
|
error: { message: save.error ?? "save failed" }
|
|
117
74
|
}, 500);
|
|
118
|
-
const finalized = await finalizeCreateAgentDirs(service.currentConfig, agentId
|
|
119
|
-
...parsed.profileFiles !== void 0 ? { profileFiles: parsed.profileFiles } : {},
|
|
120
|
-
...parsed.cloneFrom ? { cloneFrom: parsed.cloneFrom } : {}
|
|
121
|
-
});
|
|
75
|
+
const finalized = await finalizeCreateAgentDirs(service.currentConfig, agentId);
|
|
122
76
|
if (finalized.ok === false) return c.json({
|
|
123
77
|
ok: false,
|
|
124
78
|
error: { message: finalized.error }
|
|
@@ -133,9 +87,9 @@ function registerAgentsRoutes(authenticated, deps) {
|
|
|
133
87
|
}
|
|
134
88
|
});
|
|
135
89
|
});
|
|
136
|
-
authenticated.get("/api/agents/:id/effective-
|
|
90
|
+
authenticated.get("/api/agents/:id/effective-config", async (c) => {
|
|
137
91
|
const id = normalizeAgentId(c.req.param("id") ?? "");
|
|
138
|
-
const res =
|
|
92
|
+
const res = getGatewayAgentEffectiveConfig(service.currentConfig, id);
|
|
139
93
|
if (res.ok === false) return c.json({
|
|
140
94
|
ok: false,
|
|
141
95
|
error: { message: res.error }
|
|
@@ -156,40 +110,30 @@ function registerAgentsRoutes(authenticated, deps) {
|
|
|
156
110
|
error: { message: "Invalid JSON" }
|
|
157
111
|
}, 400);
|
|
158
112
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
if (Object.hasOwn(body, "agentDir")) return c.json({
|
|
113
|
+
const allowedPatchKeys = new Set([
|
|
114
|
+
"workspace",
|
|
115
|
+
"profile",
|
|
116
|
+
"models",
|
|
117
|
+
"skills",
|
|
118
|
+
"tools",
|
|
119
|
+
"workflows",
|
|
120
|
+
"runtime",
|
|
121
|
+
"setDefault"
|
|
122
|
+
]);
|
|
123
|
+
const unknownPatchKey = Object.keys(body).find((key) => !allowedPatchKeys.has(key));
|
|
124
|
+
if (unknownPatchKey) return c.json({
|
|
172
125
|
ok: false,
|
|
173
|
-
error: { message:
|
|
126
|
+
error: { message: `unknown agent field "${unknownPatchKey}"` }
|
|
174
127
|
}, 400);
|
|
175
|
-
|
|
128
|
+
const skillsPatch = body.skills === null ? null : Object.hasOwn(body, "skills") ? SkillOverrideSchema.safeParse(body.skills) : void 0;
|
|
129
|
+
if (skillsPatch && skillsPatch !== null && !skillsPatch.success) return c.json({
|
|
176
130
|
ok: false,
|
|
177
|
-
error: { message:
|
|
178
|
-
}, 400);
|
|
179
|
-
if (Object.hasOwn(body, "description")) return c.json({
|
|
180
|
-
ok: false,
|
|
181
|
-
error: { message: "description is not supported; edit IDENTITY.md" }
|
|
182
|
-
}, 400);
|
|
183
|
-
const skillsPatch = body.skills === null ? null : Array.isArray(body.skills) ? body.skills.map((x) => String(x).trim()).filter(Boolean) : void 0;
|
|
184
|
-
const extendsPatch = Object.hasOwn(body, "extends") ? Array.isArray(body.extends) ? body.extends.map((x) => String(x).trim()).filter(Boolean) : void 0 : void 0;
|
|
185
|
-
if (Object.hasOwn(body, "extends") && extendsPatch === void 0) return c.json({
|
|
186
|
-
ok: false,
|
|
187
|
-
error: { message: "extends must be an array" }
|
|
131
|
+
error: { message: `skills ${skillsPatch.error.issues[0]?.message ?? "is invalid"}` }
|
|
188
132
|
}, 400);
|
|
189
133
|
let toolsPatch;
|
|
190
134
|
if (Object.hasOwn(body, "tools")) if (body.tools === null) toolsPatch = null;
|
|
191
135
|
else if (typeof body.tools === "object" && !Array.isArray(body.tools)) {
|
|
192
|
-
const parsedTools =
|
|
136
|
+
const parsedTools = ToolPoliciesSchema.safeParse(body.tools);
|
|
193
137
|
if (!parsedTools.success) return c.json({
|
|
194
138
|
ok: false,
|
|
195
139
|
error: { message: `tools ${parsedTools.error.issues[0]?.message ?? "is invalid"}` }
|
|
@@ -204,17 +148,37 @@ function registerAgentsRoutes(authenticated, deps) {
|
|
|
204
148
|
ok: false,
|
|
205
149
|
error: { message: modelsPatch.error }
|
|
206
150
|
}, 400);
|
|
207
|
-
|
|
151
|
+
const profilePatch = body.profile === null ? null : Object.hasOwn(body, "profile") ? AgentProfileSchema.safeParse(body.profile) : void 0;
|
|
152
|
+
if (profilePatch && profilePatch !== null && !profilePatch.success) return c.json({
|
|
153
|
+
ok: false,
|
|
154
|
+
error: { message: `profile ${profilePatch.error.issues[0]?.message ?? "is invalid"}` }
|
|
155
|
+
}, 400);
|
|
156
|
+
const workflowsPatch = body.workflows === null ? null : Object.hasOwn(body, "workflows") ? WorkflowPolicySchema.safeParse(body.workflows) : void 0;
|
|
157
|
+
if (workflowsPatch && workflowsPatch !== null && !workflowsPatch.success) return c.json({
|
|
158
|
+
ok: false,
|
|
159
|
+
error: { message: `workflows ${workflowsPatch.error.issues[0]?.message ?? "is invalid"}` }
|
|
160
|
+
}, 400);
|
|
161
|
+
const runtimePatch = body.runtime === null ? null : Object.hasOwn(body, "runtime") ? RuntimePolicySchema.safeParse(body.runtime) : void 0;
|
|
162
|
+
if (runtimePatch && runtimePatch !== null && !runtimePatch.success) return c.json({
|
|
163
|
+
ok: false,
|
|
164
|
+
error: { message: `runtime ${runtimePatch.error.issues[0]?.message ?? "is invalid"}` }
|
|
165
|
+
}, 400);
|
|
166
|
+
let workspacePatch;
|
|
167
|
+
if (Object.hasOwn(body, "workspace")) if (body.workspace === null) workspacePatch = null;
|
|
168
|
+
else if (typeof body.workspace === "string") workspacePatch = body.workspace;
|
|
169
|
+
else return c.json({
|
|
208
170
|
ok: false,
|
|
209
|
-
error: { message: "
|
|
171
|
+
error: { message: "workspace must be a string or null" }
|
|
210
172
|
}, 400);
|
|
211
173
|
const prep = prepareUpdateAgent(service.currentConfig, id, {
|
|
212
|
-
|
|
213
|
-
...
|
|
174
|
+
...workspacePatch !== void 0 ? { workspace: workspacePatch } : {},
|
|
175
|
+
...profilePatch !== void 0 ? { profile: profilePatch === null ? null : profilePatch.data } : {},
|
|
214
176
|
...modelsPatch !== void 0 ? { models: modelsPatch } : {},
|
|
215
177
|
setDefault: body.setDefault === true,
|
|
216
|
-
...skillsPatch !== void 0 ? { skills: skillsPatch } : {},
|
|
217
|
-
...toolsPatch !== void 0 ? { tools: toolsPatch } : {}
|
|
178
|
+
...skillsPatch !== void 0 ? { skills: skillsPatch === null ? null : skillsPatch.data } : {},
|
|
179
|
+
...toolsPatch !== void 0 ? { tools: toolsPatch } : {},
|
|
180
|
+
...workflowsPatch !== void 0 ? { workflows: workflowsPatch === null ? null : workflowsPatch.data } : {},
|
|
181
|
+
...runtimePatch !== void 0 ? { runtime: runtimePatch === null ? null : runtimePatch.data } : {}
|
|
218
182
|
});
|
|
219
183
|
if (prep.ok === false) return c.json({
|
|
220
184
|
ok: false,
|
|
@@ -514,7 +514,7 @@ function registerConnectorRoutes(authenticated, deps) {
|
|
|
514
514
|
const policy = getComposioInstallationPolicy(config, c.req.param("toolkit"));
|
|
515
515
|
const agents = config.agents.list.filter((agent) => agent.enabled).map((agent) => ({
|
|
516
516
|
id: agent.id,
|
|
517
|
-
name: agent.
|
|
517
|
+
name: agent.id
|
|
518
518
|
}));
|
|
519
519
|
return c.json({
|
|
520
520
|
ok: true,
|