@xopcai/xopc 0.0.231 → 0.0.232
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/README.zh-CN.md +1 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/schema/config-schema.d.ts +3 -3
- package/dist/extensions/telegram/src/config-schema.d.ts +4 -4
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/config-schema.d.ts +3 -3
- package/dist/gateway/static/root/assets/{activity-store-M0nAY5XB.js → activity-store-VXCWz43N.js} +1 -1
- package/dist/gateway/static/root/assets/agent-avatar-dicebear-BXRaZYW8.js +1 -0
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-dR7HMaRX.js +1 -0
- package/dist/gateway/static/root/assets/agents-Bileycwe.js +1 -0
- package/dist/gateway/static/root/assets/api-wGPgL8xY.js +1 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DP7YVRPn.js → app-management-settings-panel-BJfClfPx.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CVQ5n7y6.js → appearance-settings-C_R0vUAu.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DSCia0DT.js → apps-page-CBow8pBI.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-7_DXaMTP.js → archive-plugin-DnFHkSHE.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-mmr_mHRr.js → attachment-load-DZrEwytM.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DfY-T6Ga.js → automations-page-DpkKajui.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BBntVWgv.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-CO9QMEh2.js → binary-plugins-Ckc_Csue.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CE14CVOy.js → block-editor-DAC6w-iV.js} +4 -4
- package/dist/gateway/static/root/assets/browser-settings-page-DrsMd-Po.js +8 -0
- package/dist/gateway/static/root/assets/browser-workflow-inputs-BGd7R8GO.js +1 -0
- package/dist/gateway/static/root/assets/{browser-workflows-page-1wgXyoSO.js → browser-workflows-page-DUfj7ntM.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-97gkGeSV.js +7 -0
- package/dist/gateway/static/root/assets/channels-settings-CuBsz8UI.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-C5ABr73b.js → channels-status-swr-CfboECLt.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CdRW6Euc.js → chat-terminal-dock-CA9fndbZ.js} +2 -2
- package/dist/gateway/static/root/assets/{code-editor-dFzqyDXS.js → code-editor-D4_k-6QN.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-SuL7td7Z.js +2 -0
- package/dist/gateway/static/root/assets/cron-expression-CqPu7HYJ.js +2 -0
- package/dist/gateway/static/root/assets/date-picker-C8dJsCgk.js +1 -0
- package/dist/gateway/static/root/assets/dependency-picker-Iz2wYimy.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-CMO-J3cG.js → desktop-pet-C3h40FmG.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-MmOR4A3u.js → desktop-pet-settings-YfeVVzLe.js} +1 -1
- package/dist/gateway/static/root/assets/dist-DqPZM2MH2.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DdH0dG2_.js → extension-debug-page-CChgztz_.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Clg-KktN.js → extension-page-DF6ct6_y.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-jgBsjn0F.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-api-DEHnF4Wm.js → gateway-config-api-CVajuIGL.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-config-swr-BGQn8duh.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-BbssNGid.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-B_zrtccP.js → gateway-startup-retry-D2Rnh9fX.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-CJtXu8iD.js +1 -0
- package/dist/gateway/static/root/assets/home-page-Be1o1AXQ.js +1 -0
- package/dist/gateway/static/root/assets/html-workspace-editor-C3DKAkMc.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-YKP2me5Z.js → image-generation-api-D7W2p5_8.js} +1 -1
- package/dist/gateway/static/root/assets/index-B2OJSXX9.js +70 -0
- package/dist/gateway/static/root/assets/index-rHjAElxG.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BvpEeHnm.js → keyboard-shortcuts-settings-BvHYyNus.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-COfelgk7.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-Bzvn99eH.js → local-apps-page-Cb8t2wWM.js} +1 -1
- package/dist/gateway/static/root/assets/locale-store-DLwVxS3V.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-DA8oDjeB.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-B8Jie4-J.js +1 -0
- package/dist/gateway/static/root/assets/markdown-editor-nDLmA_LF.js +2 -0
- package/dist/gateway/static/root/assets/markdown-split-BD1r4o2i.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-RxNHwlNo.js → markdown-view-B-BHEcNd.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-D8I7OGnT.js → media-plugins-BCev8fkW.js} +1 -1
- package/dist/gateway/static/root/assets/messages-Dp1OxSKt.js +3 -0
- package/dist/gateway/static/root/assets/mobile-device-api-DACoHhhk.js +1 -0
- package/dist/gateway/static/root/assets/{models-hub-cache-0RjEwafI.js → models-hub-cache-C8zjqmIv.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-api-EpgG-OQc.js → notes-api-DEdNKw0I.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CCvjGMhN.js → notes-page-BBTLjJwa.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-DICgUGPv.js +4 -0
- package/dist/gateway/static/root/assets/{oauth-api-BwNLwbI8.js → oauth-api-BNCO2YK5.js} +1 -1
- package/dist/gateway/static/root/assets/popover-select-3E24E65N.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-MmMswmOU.js → product-open-page-fEBbRekH.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-CqdkznYJ.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-dHDXpMCg.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BFZrVYfy.js → registry-api-Cvr4Qm7N.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-2feZudJw.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Dx6o7sLu.js → runtime-tools-settings-panel-BT5B74IH.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-Cdd9c4vt.js → schema-form-C4tB34S5.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-CO2JCFdy.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DxMVaqdn.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-D0YxMnhm.js → settings-form-section-D1oXhkgI.js} +1 -1
- package/dist/gateway/static/root/assets/settings-loading-skeleton-CldfX6FJ.js +1 -0
- package/dist/gateway/static/root/assets/settings-page-c3LJnbvE.js +1 -0
- package/dist/gateway/static/root/assets/settings-shell-layer-context-DCp6ykjQ.js +1 -0
- package/dist/gateway/static/root/assets/setup-status-panel-DZNHb6A5.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-DiqBn-oE.js → share-preview-page-DptCK_mk.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DakZ2AGN.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-BOiNkWJC.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-CZwhWiRl.js → skills-page-OHBeBtSg.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-kBGr8opZ.js → skills-page.utils-B9WZbOLC.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CPBs6lWi.js → system-settings-panel-Dj_DpOGw.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-D5Nbe3C8.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-Qgvo0Ga7.js → theme-store-Cpd3Gd5R.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-C4YcEiP9.js → use-autosave-DCl5Yq7N.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-CAPSUK8B.js +1 -0
- package/dist/gateway/static/root/assets/{vendor-codemirror-DRr7hFaD.js → vendor-codemirror--gTq3YAI.js} +16 -16
- package/dist/gateway/static/root/assets/voice-api-key-field-BB_ZQV8F.js +1 -0
- package/dist/gateway/static/root/assets/voice-config-api-BNiYmpl5.js +1 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CKIdPEen.js → work-discovery-overlay-BrIdtdum.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BK44Vm5W.js → workflow-run-setup-panel-hKh-uCLo.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-ahDvypGO.js +5 -0
- package/dist/gateway/static/root/index.html +16 -16
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +1 -2
- package/dist/src/agent/agent-manager.js +29 -44
- package/dist/src/agent/background-review/run-background-review.js +10 -15
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/external-tools/mcp-provider.js +3 -13
- package/dist/src/agent/image/generation/runtime.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +13 -14
- package/dist/src/agent/mcp/bundle-mcp-policy.d.ts +0 -9
- package/dist/src/agent/mcp/bundle-mcp-policy.js +1 -13
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
- package/dist/src/agent/mcp/index.js +2 -2
- package/dist/src/agent/media-generation/runtime-shared.d.ts +1 -1
- package/dist/src/agent/media-generation/runtime-shared.js +1 -1
- package/dist/src/agent/memory/create-memory-manager.js +1 -1
- package/dist/src/agent/memory/manager.d.ts +1 -1
- package/dist/src/{agent-runtime/memory-runtime.d.ts → agent/memory/runtime.d.ts} +1 -1
- package/dist/src/{agent-runtime/memory-runtime.js → agent/memory/runtime.js} +2 -3
- package/dist/src/agent/orchestration/agent-orchestrator.d.ts +0 -3
- package/dist/src/agent/orchestration/agent-orchestrator.js +1 -3
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +2 -2
- package/dist/src/agent/service.js +0 -1
- package/dist/src/agent/starter-agents.js +1 -8
- package/dist/src/agent/tools/executor.d.ts +1 -1
- package/dist/src/agent/tools/workflow-tool.js +1 -5
- package/dist/src/agent-config/index.d.ts +2 -0
- package/dist/src/agent-config/index.js +11 -0
- package/dist/src/agent-config/resolver.d.ts +11 -0
- package/dist/src/agent-config/resolver.js +113 -0
- package/dist/src/agent-config/schema.d.ts +491 -0
- package/dist/src/agent-config/schema.js +172 -0
- package/dist/src/chat-commands/builtins/config.js +2 -2
- package/dist/src/chat-commands/builtins/review.js +1 -1
- package/dist/src/chat-commands/config-paths.js +1 -1
- package/dist/src/cli/commands/agents.js +2 -1
- package/dist/src/cli/commands/config.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +12 -4
- package/dist/src/cli/commands/image.js +3 -4
- package/dist/src/cli/commands/models.js +9 -3
- package/dist/src/cli/commands/onboard/model.js +12 -11
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/tunnel.js +3 -18
- package/dist/src/cli/utils/init-workspace-core.d.ts +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/commands/agents.config.d.ts +1 -3
- package/dist/src/commands/agents.config.js +9 -26
- package/dist/src/config/agent-model-intents.d.ts +10 -0
- package/dist/src/config/agent-model-intents.js +39 -0
- package/dist/src/config/agent-profile.d.ts +7 -9
- package/dist/src/config/agent-profile.js +30 -28
- package/dist/src/config/default-model.d.ts +1 -11
- package/dist/src/config/default-model.js +3 -11
- package/dist/src/config/index.js +3 -3
- package/dist/src/config/integration.d.ts +1 -1
- package/dist/src/config/reload.js +1 -1
- package/dist/src/config/rules.js +3 -3
- package/dist/src/config/schema.d.ts +187 -452
- package/dist/src/config/schema.js +53 -131
- package/dist/src/extensions/activation-context.js +7 -11
- package/dist/src/gateway/agent-builtin-tools.d.ts +250 -6
- package/dist/src/gateway/agent-builtin-tools.js +284 -46
- package/dist/src/gateway/agents-admin.d.ts +20 -62
- package/dist/src/gateway/agents-admin.js +36 -228
- package/dist/src/gateway/device-routes.d.ts +3 -0
- package/dist/src/gateway/device-routes.js +47 -0
- package/dist/src/gateway/global-defaults-admin.d.ts +6 -20
- package/dist/src/gateway/global-defaults-admin.js +20 -120
- package/dist/src/gateway/hono/app.js +4 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +54 -137
- package/dist/src/gateway/hono/lib/config-payload.js +2 -4
- package/dist/src/gateway/hono/middleware/auth.js +33 -1
- package/dist/src/gateway/hono/middleware/scopes.d.ts +2 -12
- package/dist/src/gateway/hono/middleware/scopes.js +9 -18
- package/dist/src/gateway/hono/routes/agents.js +64 -100
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/device-push.d.ts +2 -0
- package/dist/src/gateway/hono/routes/{mobile.js → device-push.js} +40 -18
- package/dist/src/gateway/hono/routes/devices.d.ts +4 -0
- package/dist/src/gateway/hono/routes/devices.js +214 -0
- package/dist/src/gateway/hono/routes/files.js +5 -1
- package/dist/src/gateway/hono/routes/global-defaults.js +5 -9
- package/dist/src/gateway/hono/routes/index.js +4 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +4 -20
- package/dist/src/gateway/hono/routes/models.js +2 -2
- package/dist/src/gateway/hono/routes/realtime.js +8 -1
- package/dist/src/gateway/hono/routes/status.js +9 -16
- package/dist/src/gateway/hono/routes/tunnel.d.ts +0 -2
- package/dist/src/gateway/hono/routes/tunnel.js +10 -199
- package/dist/src/gateway/image-generation-setup.d.ts +2 -2
- package/dist/src/gateway/image-generation-setup.js +8 -7
- package/dist/src/gateway/public-url.d.ts +1 -1
- package/dist/src/gateway/security/gateway-principal.d.ts +11 -0
- package/dist/src/gateway/security/gateway-principal.js +12 -0
- package/dist/src/gateway/security/gateway-scopes.d.ts +7 -0
- package/dist/src/gateway/security/gateway-scopes.js +66 -0
- package/dist/src/gateway/security/index.d.ts +2 -1
- package/dist/src/gateway/security/index.js +3 -2
- package/dist/src/gateway/service.js +7 -7
- package/dist/src/gateway/xopc-cloud-capability-setup.js +19 -21
- package/dist/src/migrations/index.d.ts +0 -1
- package/dist/src/migrations/index.js +1 -2
- package/dist/src/migrations/runner.js +1 -2
- package/dist/src/notifications/device-store.d.ts +1 -1
- package/dist/src/notifications/device-store.js +11 -11
- package/dist/src/notifications/store.js +3 -3
- package/dist/src/providers/index.js +1 -1
- package/dist/src/providers/model-reference-auditor.js +14 -9
- package/dist/src/realtime/runtime.d.ts +2 -0
- package/dist/src/realtime/runtime.js +27 -3
- package/dist/src/realtime/tickets.d.ts +6 -1
- package/dist/src/realtime/tickets.js +2 -1
- package/dist/src/remote-access/exposure-manager.js +3 -3
- package/dist/src/share/share-url.js +2 -2
- package/dist/src/storage/sqlite/device-access-repository.d.ts +54 -0
- package/dist/src/storage/sqlite/device-access-repository.js +194 -0
- package/dist/src/storage/sqlite/device-pairing-repository.d.ts +22 -0
- package/dist/src/storage/sqlite/device-pairing-repository.js +86 -0
- package/dist/src/storage/sqlite/gateway-identity-repository.d.ts +10 -0
- package/dist/src/storage/sqlite/gateway-identity-repository.js +50 -0
- package/dist/src/storage/sqlite/index.d.ts +3 -0
- package/dist/src/storage/sqlite/index.js +4 -1
- package/dist/src/storage/sqlite/migrations/138_device_access.sql +96 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/tunnel/consent.d.ts +1 -1
- package/dist/src/tunnel/consent.js +1 -1
- package/dist/src/tunnel/gateway-lifecycle.js +1 -1
- package/dist/src/tunnel/index.d.ts +1 -4
- package/dist/src/tunnel/index.js +3 -5
- package/dist/src/tunnel/tunnel-audit.d.ts +1 -1
- package/dist/src/tunnel/tunnel-config.js +1 -1
- package/dist/src/tunnel/tunnel-service.d.ts +2 -3
- package/dist/src/tunnel/tunnel-service.js +1 -20
- package/dist/src/tunnel/tunnel-types.d.ts +0 -6
- package/dist/src/workflows/draft/workflow-draft-service.js +2 -2
- package/dist/src/workflows/service/workflow-run-service.js +3 -3
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agent-avatar-dicebear-CBqUnlvL.js +0 -1
- package/dist/gateway/static/root/assets/agents-7YO6znTT.js +0 -68
- package/dist/gateway/static/root/assets/api-BywYxpaS.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-BpvD54D6.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CeESA4Oj.js +0 -8
- package/dist/gateway/static/root/assets/browser-workflow-inputs-8NC2qDRF.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-B_OXTojB.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-api-o0y9WgAI.js +0 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-D5nZecxV.js +0 -3
- package/dist/gateway/static/root/assets/channels-settings-BzmnWx6X.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-38FsOnR0.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DX6OkwFQ.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-DYSMZsms.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-DGCfX4tK.js +0 -1
- package/dist/gateway/static/root/assets/dependency-picker-DHDa4ht1.js +0 -1
- package/dist/gateway/static/root/assets/directory-picker-path-field-B9qoxDcn.js +0 -1
- package/dist/gateway/static/root/assets/dist-J_ySZvz0.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-eP3fJ2M6.js +0 -1
- package/dist/gateway/static/root/assets/file-code-corner-byQA1VfD.js +0 -1
- package/dist/gateway/static/root/assets/gateway-config-swr-BWGjnmDl.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-DKkEXXj9.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DlBPNubY.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BnOrLRfs.js +0 -1
- package/dist/gateway/static/root/assets/html-workspace-editor-bXK5tq64.js +0 -1
- package/dist/gateway/static/root/assets/index-0xQO5B_Q.js +0 -70
- package/dist/gateway/static/root/assets/index-CCyIdGuQ.css +0 -2
- package/dist/gateway/static/root/assets/local-app-workbench-page-Ch1rdUo8.js +0 -2
- package/dist/gateway/static/root/assets/locale-store-CXhjfe4q.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-zxx2ExlY.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-BQaeyOYm.js +0 -1
- package/dist/gateway/static/root/assets/markdown-editor-TWGaF7Xa.js +0 -2
- package/dist/gateway/static/root/assets/markdown-split-D9tmIiEm.js +0 -1
- package/dist/gateway/static/root/assets/messages-BMdD0LWk.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-9cgh77VH.js +0 -4
- package/dist/gateway/static/root/assets/popover-select-CccGri5Y.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-hf6pmH4p.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-By2U-Wdh.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CUcpp7CQ.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-ByI82xS1.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BCoI5IJ8.js +0 -1
- package/dist/gateway/static/root/assets/settings-loading-skeleton-y53gEKsF.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-BoE_tToG.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BQmyb5KC.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-Bf3VpZ-R.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CXHlbuGS.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-Bo0KSZ2v.js +0 -1
- package/dist/gateway/static/root/assets/typed-models-lib-q5-Vfqd8.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-Cnj7gMX2.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-BML8zCwZ.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-CB98MTwG.js +0 -5
- package/dist/src/agent-manifest/index.d.ts +0 -5
- package/dist/src/agent-manifest/index.js +0 -10
- package/dist/src/agent-manifest/preset-chain.d.ts +0 -10
- package/dist/src/agent-manifest/preset-chain.js +0 -30
- package/dist/src/agent-manifest/prompt.d.ts +0 -2
- package/dist/src/agent-manifest/prompt.js +0 -49
- package/dist/src/agent-manifest/resolver.d.ts +0 -32
- package/dist/src/agent-manifest/resolver.js +0 -114
- package/dist/src/agent-manifest/schema.d.ts +0 -695
- package/dist/src/agent-manifest/schema.js +0 -226
- package/dist/src/agent-manifest/validator.d.ts +0 -25
- package/dist/src/agent-manifest/validator.js +0 -74
- package/dist/src/agent-runtime/boundary-guard.d.ts +0 -12
- package/dist/src/agent-runtime/boundary-guard.js +0 -21
- package/dist/src/agent-runtime/index.d.ts +0 -7
- package/dist/src/agent-runtime/index.js +0 -8
- package/dist/src/agent-runtime/model-router.d.ts +0 -11
- package/dist/src/agent-runtime/model-router.js +0 -14
- package/dist/src/agent-runtime/run-trace.d.ts +0 -27
- package/dist/src/agent-runtime/run-trace.js +0 -51
- package/dist/src/agent-runtime/runtime-profile.d.ts +0 -26
- package/dist/src/agent-runtime/runtime-profile.js +0 -42
- package/dist/src/agent-runtime/tool-registry.d.ts +0 -28
- package/dist/src/agent-runtime/tool-registry.js +0 -50
- package/dist/src/agent-runtime/workflow-runtime.d.ts +0 -31
- package/dist/src/agent-runtime/workflow-runtime.js +0 -32
- package/dist/src/config/agent-typed-models.d.ts +0 -13
- package/dist/src/config/agent-typed-models.js +0 -48
- package/dist/src/gateway/capability-presets-admin.d.ts +0 -88
- package/dist/src/gateway/capability-presets-admin.js +0 -303
- package/dist/src/gateway/hono/lib/agent-model.d.ts +0 -35
- package/dist/src/gateway/hono/lib/agent-model.js +0 -97
- package/dist/src/gateway/hono/routes/capability-presets.d.ts +0 -3
- package/dist/src/gateway/hono/routes/capability-presets.js +0 -187
- package/dist/src/gateway/hono/routes/mobile.d.ts +0 -3
- package/dist/src/gateway/security/operator-scopes.d.ts +0 -37
- package/dist/src/gateway/security/operator-scopes.js +0 -147
- package/dist/src/migrations/config/default-capability-preset.d.ts +0 -10
- package/dist/src/migrations/config/default-capability-preset.js +0 -133
- package/dist/src/tunnel/enable-lan-pairing.d.ts +0 -8
- package/dist/src/tunnel/enable-lan-pairing.js +0 -41
- package/dist/src/tunnel/pair-context.d.ts +0 -36
- package/dist/src/tunnel/pair-context.js +0 -77
- package/dist/src/tunnel/pair-url.d.ts +0 -43
- package/dist/src/tunnel/pair-url.js +0 -117
- package/dist/src/tunnel/pairing-rate-limit.d.ts +0 -12
- package/dist/src/tunnel/pairing-rate-limit.js +0 -28
- package/dist/src/tunnel/pairing.d.ts +0 -21
- package/dist/src/tunnel/pairing.js +0 -103
- package/dist/src/tunnel/tunnel-qr.d.ts +0 -9
- package/dist/src/tunnel/tunnel-qr.js +0 -29
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveAgentDir, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId, resolveUserPath, validateAgentIdForNewAgent } from "../agent/agent-scope.js";
|
|
2
|
-
import { resolveCapabilityPresetLayer, resolveEffectiveAgentManifest } from "../agent-manifest/resolver.js";
|
|
3
2
|
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
4
3
|
import { WORKSPACE_FILES, init_paths } from "../config/paths.js";
|
|
5
4
|
import { AGENT_PROFILE_MARKDOWN_SYSTEM_FILES, REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET } from "../agent/context/workspace.js";
|
|
6
5
|
import { isPathUnderWorkspace, resolveWorkspaceSafePath } from "./workspace-editor-path.js";
|
|
7
6
|
import { seedAgentProfileMarkdownFiles } from "../agent/context/workspace-seed.js";
|
|
8
7
|
import { applyAgentConfig, findAgentEntryIndex, getAgentDeleteBlocker, pruneAgentConfig, removeAgentDirsFromDisk } from "../commands/agents.config.js";
|
|
9
|
-
import { resolveEffectiveTypedModels } from "../config/agent-typed-models.js";
|
|
10
8
|
import { GATEWAY_BUILTIN_TOOL_IDS } from "./agent-builtin-tools.js";
|
|
11
9
|
import { join, resolve } from "node:path";
|
|
12
|
-
import {
|
|
10
|
+
import { mkdir, readFile, realpath, stat, unlink, writeFile } from "node:fs/promises";
|
|
13
11
|
//#region src/gateway/agents-admin.ts
|
|
14
12
|
/**
|
|
15
13
|
* Gateway REST helpers for multi-agent management.
|
|
@@ -26,12 +24,6 @@ function collectAgentIdsForList(cfg) {
|
|
|
26
24
|
ids.add(defaultId);
|
|
27
25
|
return [...ids];
|
|
28
26
|
}
|
|
29
|
-
function rolesToTypedModels(roles) {
|
|
30
|
-
return Object.entries(roles ?? {}).map(([id, role]) => ({
|
|
31
|
-
id,
|
|
32
|
-
...role
|
|
33
|
-
})).sort((a, b) => a.id.localeCompare(b.id));
|
|
34
|
-
}
|
|
35
27
|
/** Extract `**Avatar:**` value from profile IDENTITY.md (same line shape as the gateway console parser). */
|
|
36
28
|
function extractAvatarFromIdentityMarkdown(content) {
|
|
37
29
|
return parseIdentityMarkdown(content).avatar || void 0;
|
|
@@ -58,58 +50,23 @@ async function listGatewayAgents(cfg, _options = {}) {
|
|
|
58
50
|
for (const id of collectAgentIdsForList(cfg)) {
|
|
59
51
|
const profile = resolveEffectiveAgentProfile(cfg, id);
|
|
60
52
|
const entry = listAgentEntries(cfg).find((e) => normalizeAgentId(e.id) === id);
|
|
61
|
-
|
|
62
|
-
presetIds: entry?.extends,
|
|
63
|
-
presets: cfg.agents.capabilityPresets,
|
|
64
|
-
defaultPresetId: cfg.agents.defaultPreset
|
|
65
|
-
});
|
|
66
|
-
const presetSkills = presetLayer.patch.skills?.mode === "allowlist" ? presetLayer.patch.skills.allow ?? [] : void 0;
|
|
67
|
-
const presetDenied = Object.entries(presetLayer.patch.tools?.builtin ?? {}).filter(([, policy]) => policy.mode === "deny").map(([name]) => name);
|
|
68
|
-
const presetTypedModels = rolesToTypedModels(presetLayer.patch.models?.roles);
|
|
69
|
-
const model = profile.primaryModelRef || profile.fallbacks.length > 0 ? {
|
|
70
|
-
...profile.primaryModelRef ? { primary: profile.primaryModelRef } : {},
|
|
71
|
-
...profile.fallbacks.length > 0 ? { fallbacks: profile.fallbacks } : {}
|
|
72
|
-
} : void 0;
|
|
73
|
-
const entrySkills = entry?.skills?.mode === "allowlist" ? entry.skills.allow ?? [] : void 0;
|
|
74
|
-
const entryDisable = Object.entries(entry?.tools?.builtin ?? {}).filter(([, policy]) => policy.mode === "deny").map(([name]) => name);
|
|
75
|
-
const entryTypedModels = rolesToTypedModels(entry?.models?.roles);
|
|
76
|
-
const effectiveTypedModels = [...resolveEffectiveTypedModels(cfg, id).values()].sort((a, b) => a.id.localeCompare(b.id));
|
|
53
|
+
if (!entry) continue;
|
|
77
54
|
let identity = {};
|
|
78
55
|
try {
|
|
79
56
|
identity = parseIdentityMarkdown(await readFile(join(resolveAgentProfileDir(cfg, id), WORKSPACE_FILES.IDENTITY), "utf-8"));
|
|
80
57
|
} catch {}
|
|
81
58
|
agents.push({
|
|
82
59
|
id,
|
|
83
|
-
|
|
60
|
+
name: entry.profile?.name ?? identity.name ?? id,
|
|
84
61
|
...identity.description ? { description: identity.description } : {},
|
|
85
62
|
...identity.language ? { language: identity.language } : {},
|
|
86
|
-
...profile.manifest.identity.role ? { role: profile.manifest.identity.role } : {},
|
|
87
|
-
responsibilities: {
|
|
88
|
-
primary: [...profile.manifest.responsibilities.primary],
|
|
89
|
-
...profile.manifest.responsibilities.secondary ? { secondary: [...profile.manifest.responsibilities.secondary] } : {}
|
|
90
|
-
},
|
|
91
63
|
...identity.avatar ? { avatar: identity.avatar } : {},
|
|
92
64
|
workspace: profile.resolvedWorkspacePath,
|
|
93
65
|
profileDir: resolveAgentProfileDir(cfg, id),
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
...entryTypedModels.length > 0 ? { entry: entryTypedModels } : {},
|
|
99
|
-
effective: effectiveTypedModels
|
|
100
|
-
},
|
|
101
|
-
extends: [...entry?.extends ?? []],
|
|
102
|
-
isDefault: id === defaultId,
|
|
103
|
-
skills: {
|
|
104
|
-
preset: presetSkills ? [...presetSkills] : [],
|
|
105
|
-
...entrySkills !== void 0 ? { entry: [...entrySkills] } : {},
|
|
106
|
-
...profile.skillsAllowlist !== void 0 ? { effectiveAllowlist: [...profile.skillsAllowlist] } : {}
|
|
107
|
-
},
|
|
108
|
-
tools: {
|
|
109
|
-
presetDenied: [...presetDenied],
|
|
110
|
-
entryDisable: [...entryDisable],
|
|
111
|
-
effectiveDisable: [...profile.tools.denied].sort((a, b) => a.localeCompare(b))
|
|
112
|
-
}
|
|
66
|
+
override: structuredClone(entry),
|
|
67
|
+
effective: structuredClone(profile.config),
|
|
68
|
+
sources: { ...profile.sources },
|
|
69
|
+
isDefault: id === defaultId
|
|
113
70
|
});
|
|
114
71
|
}
|
|
115
72
|
agents.sort((a, b) => a.id.localeCompare(b.id));
|
|
@@ -119,10 +76,9 @@ async function listGatewayAgents(cfg, _options = {}) {
|
|
|
119
76
|
builtinToolIds: [...GATEWAY_BUILTIN_TOOL_IDS]
|
|
120
77
|
};
|
|
121
78
|
}
|
|
122
|
-
function
|
|
79
|
+
function getGatewayAgentEffectiveConfig(cfg, agentIdRaw) {
|
|
123
80
|
const agentId = normalizeAgentId(agentIdRaw);
|
|
124
|
-
|
|
125
|
-
if (!entry) return {
|
|
81
|
+
if (!listAgentEntries(cfg).find((e) => normalizeAgentId(e.id) === agentId)) return {
|
|
126
82
|
ok: false,
|
|
127
83
|
error: `agent "${agentId}" not found`,
|
|
128
84
|
status: 404
|
|
@@ -130,11 +86,13 @@ function getGatewayAgentEffectiveManifest(cfg, agentIdRaw) {
|
|
|
130
86
|
try {
|
|
131
87
|
return {
|
|
132
88
|
ok: true,
|
|
133
|
-
data:
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
89
|
+
data: (() => {
|
|
90
|
+
const profile = resolveEffectiveAgentProfile(cfg, agentId);
|
|
91
|
+
return {
|
|
92
|
+
config: profile.config,
|
|
93
|
+
sources: profile.sources
|
|
94
|
+
};
|
|
95
|
+
})()
|
|
138
96
|
};
|
|
139
97
|
} catch (err) {
|
|
140
98
|
return {
|
|
@@ -145,35 +103,7 @@ function getGatewayAgentEffectiveManifest(cfg, agentIdRaw) {
|
|
|
145
103
|
}
|
|
146
104
|
}
|
|
147
105
|
function prepareCreateAgent(cfg, body) {
|
|
148
|
-
const
|
|
149
|
-
if (!workspace) return {
|
|
150
|
-
ok: false,
|
|
151
|
-
error: "workspace is required",
|
|
152
|
-
status: 400
|
|
153
|
-
};
|
|
154
|
-
if (body.profileFiles !== void 0) {
|
|
155
|
-
if (typeof body.profileFiles !== "object" || body.profileFiles === null || Array.isArray(body.profileFiles)) return {
|
|
156
|
-
ok: false,
|
|
157
|
-
error: "profileFiles must be an object",
|
|
158
|
-
status: 400
|
|
159
|
-
};
|
|
160
|
-
for (const [name, content] of Object.entries(body.profileFiles)) {
|
|
161
|
-
const bad = assertAllowedFile(name);
|
|
162
|
-
if (bad) return bad;
|
|
163
|
-
if (typeof content !== "string") return {
|
|
164
|
-
ok: false,
|
|
165
|
-
error: `profileFiles["${name}"] must be a string`,
|
|
166
|
-
status: 400
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
if (!body.cloneFrom && typeof body.profileFiles?.[WORKSPACE_FILES.IDENTITY] !== "string") return {
|
|
171
|
-
ok: false,
|
|
172
|
-
error: `profileFiles["${WORKSPACE_FILES.IDENTITY}"] is required`,
|
|
173
|
-
status: 400
|
|
174
|
-
};
|
|
175
|
-
const nameSeed = (body.profileFiles?.[WORKSPACE_FILES.IDENTITY] ? parseIdentityMarkdown(body.profileFiles[WORKSPACE_FILES.IDENTITY]) : {}).name ?? body.id ?? "";
|
|
176
|
-
const idRes = validateAgentIdForNewAgent(body.id, nameSeed);
|
|
106
|
+
const idRes = validateAgentIdForNewAgent(body.id, body.profile.name);
|
|
177
107
|
if (idRes.ok === false) return {
|
|
178
108
|
ok: false,
|
|
179
109
|
error: idRes.error,
|
|
@@ -185,50 +115,21 @@ function prepareCreateAgent(cfg, body) {
|
|
|
185
115
|
error: `agent "${agentId}" already exists`,
|
|
186
116
|
status: 409
|
|
187
117
|
};
|
|
188
|
-
|
|
189
|
-
if (body.cloneFrom) {
|
|
190
|
-
const srcId = normalizeAgentId(body.cloneFrom);
|
|
191
|
-
cloneSourceEntry = listAgentEntries(cfg).find((e) => normalizeAgentId(e.id) === srcId);
|
|
192
|
-
if (!cloneSourceEntry && srcId !== resolveDefaultAgentId(cfg)) return {
|
|
193
|
-
ok: false,
|
|
194
|
-
error: `source agent "${srcId}" not found`,
|
|
195
|
-
status: 404
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
const wsAbs = resolveUserPath(workspace);
|
|
199
|
-
const rawModels = body.models ?? cloneSourceEntry?.models;
|
|
200
|
-
const inheritedPresetIds = body.extends ?? cloneSourceEntry?.extends ?? [];
|
|
201
|
-
for (const presetId of inheritedPresetIds) if (!cfg.agents.capabilityPresets[presetId]) return {
|
|
202
|
-
ok: false,
|
|
203
|
-
error: `capability preset "${presetId}" not found`,
|
|
204
|
-
status: 400
|
|
205
|
-
};
|
|
206
|
-
const effectiveModels = rawModels?.roles ? {
|
|
207
|
-
defaultRole: rawModels.defaultRole ?? Object.keys(rawModels.roles)[0] ?? "deep",
|
|
208
|
-
roles: rawModels.roles
|
|
209
|
-
} : void 0;
|
|
210
|
-
if (effectiveModels && !effectiveModels.roles[effectiveModels.defaultRole]) return {
|
|
211
|
-
ok: false,
|
|
212
|
-
error: "models.defaultRole must reference models.roles",
|
|
213
|
-
status: 400
|
|
214
|
-
};
|
|
118
|
+
const wsAbs = resolveUserPath(body.workspace?.trim() || `~/.xopc/workspace/${agentId}`);
|
|
215
119
|
return {
|
|
216
120
|
ok: true,
|
|
217
121
|
data: {
|
|
218
122
|
nextConfig: applyAgentConfig(cfg, {
|
|
219
123
|
agentId,
|
|
220
|
-
workspace: wsAbs,
|
|
221
|
-
|
|
222
|
-
...effectiveModels ? { models: effectiveModels } : {},
|
|
223
|
-
...body.skills !== void 0 ? { skills: body.skills.map((s) => String(s).trim()).filter(Boolean) } : cloneSourceEntry?.skills?.mode === "allowlist" && body.cloneFrom ? { skills: [...cloneSourceEntry.skills.allow ?? []] } : {},
|
|
224
|
-
...body.tools !== void 0 ? { tools: body.tools } : cloneSourceEntry?.tools && body.cloneFrom ? { tools: cloneSourceEntry.tools } : {}
|
|
124
|
+
...body.workspace?.trim() ? { workspace: wsAbs } : {},
|
|
125
|
+
profile: structuredClone(body.profile)
|
|
225
126
|
}),
|
|
226
127
|
agentId,
|
|
227
128
|
workspace: wsAbs
|
|
228
129
|
}
|
|
229
130
|
};
|
|
230
131
|
}
|
|
231
|
-
async function finalizeCreateAgentDirs(cfg, agentId
|
|
132
|
+
async function finalizeCreateAgentDirs(cfg, agentId) {
|
|
232
133
|
const wsPath = resolveAgentWorkspaceDir(cfg, agentId);
|
|
233
134
|
const profilePath = resolveAgentProfileDir(cfg, agentId);
|
|
234
135
|
const adPath = resolveAgentDir(cfg, agentId);
|
|
@@ -236,29 +137,7 @@ async function finalizeCreateAgentDirs(cfg, agentId, opts) {
|
|
|
236
137
|
await mkdir(profilePath, { recursive: true });
|
|
237
138
|
await mkdir(adPath, { recursive: true });
|
|
238
139
|
const id = normalizeAgentId(agentId);
|
|
239
|
-
|
|
240
|
-
if (opts?.cloneFrom) {
|
|
241
|
-
const srcProfilePath = resolveAgentProfileDir(cfg, normalizeAgentId(opts.cloneFrom));
|
|
242
|
-
try {
|
|
243
|
-
if ((await stat(srcProfilePath)).isDirectory()) {
|
|
244
|
-
const srcFiles = await readdir(srcProfilePath);
|
|
245
|
-
for (const fileName of srcFiles) {
|
|
246
|
-
const srcFile = join(srcProfilePath, fileName);
|
|
247
|
-
const dstFile = join(profilePath, fileName);
|
|
248
|
-
try {
|
|
249
|
-
if ((await stat(srcFile)).isFile()) await cp(srcFile, dstFile);
|
|
250
|
-
} catch {}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
} catch {
|
|
254
|
-
seedAgentProfileMarkdownFiles(profilePath, wsPath, { displayName });
|
|
255
|
-
}
|
|
256
|
-
} else seedAgentProfileMarkdownFiles(profilePath, wsPath, { displayName });
|
|
257
|
-
const profileFiles = opts?.profileFiles;
|
|
258
|
-
if (profileFiles && Object.keys(profileFiles).length > 0) for (const [name, content] of Object.entries(profileFiles)) {
|
|
259
|
-
const written = await writeAgentProfileFile(cfg, agentId, name, content);
|
|
260
|
-
if (written.ok === false) return written;
|
|
261
|
-
}
|
|
140
|
+
seedAgentProfileMarkdownFiles(profilePath, wsPath, { displayName: listAgentEntries(cfg).find((candidate) => normalizeAgentId(candidate.id) === id)?.profile?.name ?? id });
|
|
262
141
|
return {
|
|
263
142
|
ok: true,
|
|
264
143
|
data: void 0
|
|
@@ -266,23 +145,8 @@ async function finalizeCreateAgentDirs(cfg, agentId, opts) {
|
|
|
266
145
|
}
|
|
267
146
|
function prepareUpdateAgent(cfg, agentIdRaw, body) {
|
|
268
147
|
const agentId = normalizeAgentId(agentIdRaw);
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
if (idx < 0 && agentId === resolveDefaultAgentId(cfg)) {
|
|
272
|
-
list = [...list, {
|
|
273
|
-
id: agentId,
|
|
274
|
-
enabled: true,
|
|
275
|
-
identity: {
|
|
276
|
-
name: agentId,
|
|
277
|
-
role: "Agent",
|
|
278
|
-
language: "en",
|
|
279
|
-
tone: "direct"
|
|
280
|
-
},
|
|
281
|
-
responsibilities: { primary: ["Help the user complete tasks"] },
|
|
282
|
-
workspace: { root: `~/.xopc/workspace/${agentId}` }
|
|
283
|
-
}];
|
|
284
|
-
idx = list.length - 1;
|
|
285
|
-
}
|
|
148
|
+
const list = [...listAgentEntries(cfg)];
|
|
149
|
+
const idx = findAgentEntryIndex(list, agentId);
|
|
286
150
|
if (idx < 0) return {
|
|
287
151
|
ok: false,
|
|
288
152
|
error: `agent "${agentId}" not found`,
|
|
@@ -290,78 +154,22 @@ function prepareUpdateAgent(cfg, agentIdRaw, body) {
|
|
|
290
154
|
};
|
|
291
155
|
const entry = { ...list[idx] };
|
|
292
156
|
if (body.workspace !== void 0) {
|
|
293
|
-
const
|
|
294
|
-
if (
|
|
295
|
-
|
|
296
|
-
if (body.extends !== void 0) {
|
|
297
|
-
const nextExtends = Array.from(new Set(body.extends.map((id) => normalizeAgentId(id)).filter(Boolean)));
|
|
298
|
-
for (const presetId of nextExtends) if (!cfg.agents.capabilityPresets[presetId]) return {
|
|
299
|
-
ok: false,
|
|
300
|
-
error: `capability preset "${presetId}" not found`,
|
|
301
|
-
status: 400
|
|
302
|
-
};
|
|
303
|
-
if (nextExtends.length > 0) entry.extends = nextExtends;
|
|
304
|
-
else delete entry.extends;
|
|
157
|
+
const workspace = body.workspace?.trim();
|
|
158
|
+
if (workspace) entry.workspace = resolveUserPath(workspace);
|
|
159
|
+
else delete entry.workspace;
|
|
305
160
|
}
|
|
161
|
+
if (body.profile !== void 0) if (body.profile === null) delete entry.profile;
|
|
162
|
+
else entry.profile = structuredClone(body.profile);
|
|
306
163
|
if (body.models !== void 0) if (body.models === null) delete entry.models;
|
|
307
|
-
else
|
|
308
|
-
if (body.models.defaultRole !== void 0) {
|
|
309
|
-
if (body.models.defaultRole === null || !body.models.defaultRole.trim()) return {
|
|
310
|
-
ok: false,
|
|
311
|
-
error: "models.defaultRole must be a non-empty string",
|
|
312
|
-
status: 400
|
|
313
|
-
};
|
|
314
|
-
entry.models = {
|
|
315
|
-
defaultRole: body.models.defaultRole.trim(),
|
|
316
|
-
roles: entry.models?.roles ?? {},
|
|
317
|
-
...entry.models?.policy ? { policy: entry.models.policy } : {}
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
if (Object.hasOwn(body.models, "roles")) {
|
|
321
|
-
if (body.models.roles !== void 0) {
|
|
322
|
-
const roles = Object.fromEntries(Object.entries(body.models.roles).map(([id, row]) => ({
|
|
323
|
-
id: id.trim(),
|
|
324
|
-
model: row.model.trim(),
|
|
325
|
-
fallbacks: (row.fallbacks ?? []).map((ref) => ref.trim()).filter(Boolean),
|
|
326
|
-
description: row.description?.trim()
|
|
327
|
-
})).filter((row) => row.id && row.model).map((row) => [row.id, {
|
|
328
|
-
model: row.model,
|
|
329
|
-
...row.fallbacks.length > 0 ? { fallbacks: row.fallbacks } : {},
|
|
330
|
-
...row.description ? { description: row.description } : {}
|
|
331
|
-
}]));
|
|
332
|
-
entry.models = {
|
|
333
|
-
defaultRole: entry.models?.defaultRole ?? Object.keys(roles)[0] ?? "deep",
|
|
334
|
-
roles,
|
|
335
|
-
...entry.models?.policy ? { policy: entry.models.policy } : {}
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
const roles = entry.models?.roles ?? {};
|
|
340
|
-
const defaultRole = entry.models?.defaultRole ?? Object.keys(roles)[0];
|
|
341
|
-
if (!defaultRole || !roles[defaultRole]) return {
|
|
342
|
-
ok: false,
|
|
343
|
-
error: "models.defaultRole must reference models.roles",
|
|
344
|
-
status: 400
|
|
345
|
-
};
|
|
346
|
-
entry.models = {
|
|
347
|
-
...entry.models,
|
|
348
|
-
defaultRole
|
|
349
|
-
};
|
|
350
|
-
}
|
|
164
|
+
else entry.models = structuredClone(body.models);
|
|
351
165
|
if (body.skills !== void 0) if (body.skills === null) delete entry.skills;
|
|
352
|
-
else
|
|
353
|
-
const next = body.skills.map((s) => String(s).trim()).filter(Boolean);
|
|
354
|
-
if (next.length === 0) entry.skills = {
|
|
355
|
-
mode: "allowlist",
|
|
356
|
-
allow: []
|
|
357
|
-
};
|
|
358
|
-
else entry.skills = {
|
|
359
|
-
mode: "allowlist",
|
|
360
|
-
allow: next
|
|
361
|
-
};
|
|
362
|
-
}
|
|
166
|
+
else entry.skills = structuredClone(body.skills);
|
|
363
167
|
if (body.tools !== void 0) if (body.tools === null) delete entry.tools;
|
|
364
168
|
else entry.tools = body.tools;
|
|
169
|
+
if (body.workflows !== void 0) if (body.workflows === null) delete entry.workflows;
|
|
170
|
+
else entry.workflows = structuredClone(body.workflows);
|
|
171
|
+
if (body.runtime !== void 0) if (body.runtime === null) delete entry.runtime;
|
|
172
|
+
else entry.runtime = structuredClone(body.runtime);
|
|
365
173
|
list[idx] = entry;
|
|
366
174
|
let next = {
|
|
367
175
|
...cfg,
|
|
@@ -672,4 +480,4 @@ async function deleteAgentAvatarFile(cfg, agentId) {
|
|
|
672
480
|
};
|
|
673
481
|
}
|
|
674
482
|
//#endregion
|
|
675
|
-
export { deleteAgentAvatarFile, extractAvatarFromIdentityMarkdown, finalizeCreateAgentDirs,
|
|
483
|
+
export { deleteAgentAvatarFile, extractAvatarFromIdentityMarkdown, finalizeCreateAgentDirs, getGatewayAgentEffectiveConfig, listAgentProfileFiles, listGatewayAgents, parseIdentityMarkdown, prepareCreateAgent, prepareDeleteAgent, prepareUpdateAgent, readAgentAvatarFile, readAgentProfileFile, runAfterDeletePurge, writeAgentAvatarFromBase64, writeAgentProfileFile };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { resolveReverseProxyPublicUrl } from "./public-url.js";
|
|
2
|
+
import { getTailscaleExposureState } from "./tailscale-lifecycle.js";
|
|
3
|
+
import { getTunnelService } from "../tunnel/tunnel-service.js";
|
|
4
|
+
import crypto from "node:crypto";
|
|
5
|
+
//#region src/gateway/device-routes.ts
|
|
6
|
+
function secureUrl(value) {
|
|
7
|
+
if (!value) return null;
|
|
8
|
+
try {
|
|
9
|
+
const parsed = new URL(value);
|
|
10
|
+
if (parsed.protocol !== "https:" || parsed.username || parsed.password) return null;
|
|
11
|
+
return parsed.origin;
|
|
12
|
+
} catch {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function routeId(kind, url) {
|
|
17
|
+
return `${kind}-${crypto.createHash("sha256").update(url).digest("hex").slice(0, 12)}`;
|
|
18
|
+
}
|
|
19
|
+
function resolveSecureDeviceRoutes(config) {
|
|
20
|
+
const tunnelStatus = getTunnelService().getStatus();
|
|
21
|
+
const candidates = [{
|
|
22
|
+
kind: "custom-https",
|
|
23
|
+
url: secureUrl(resolveReverseProxyPublicUrl(config))
|
|
24
|
+
}, {
|
|
25
|
+
kind: "xopc-secure-link",
|
|
26
|
+
url: tunnelStatus.state === "connected" ? secureUrl(tunnelStatus.publicUrl) : null
|
|
27
|
+
}];
|
|
28
|
+
const tailscale = getTailscaleExposureState();
|
|
29
|
+
if (tailscale.active && tailscale.hostname) candidates.push({
|
|
30
|
+
kind: "tailscale",
|
|
31
|
+
url: secureUrl(`https://${tailscale.hostname}`)
|
|
32
|
+
});
|
|
33
|
+
const seen = /* @__PURE__ */ new Set();
|
|
34
|
+
const routes = [];
|
|
35
|
+
for (const candidate of candidates) {
|
|
36
|
+
if (!candidate.url || seen.has(candidate.url)) continue;
|
|
37
|
+
seen.add(candidate.url);
|
|
38
|
+
routes.push({
|
|
39
|
+
id: routeId(candidate.kind, candidate.url),
|
|
40
|
+
kind: candidate.kind,
|
|
41
|
+
url: candidate.url
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return routes;
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { resolveSecureDeviceRoutes };
|
|
@@ -1,25 +1,12 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type AgentDefaults } from '../agent-config/index.js';
|
|
2
2
|
import type { Config } from '../config/schema.js';
|
|
3
|
-
|
|
4
|
-
export type GlobalDefaultsProviderRow = {
|
|
5
|
-
id: string;
|
|
6
|
-
name: string;
|
|
7
|
-
configured: boolean;
|
|
8
|
-
source: GlobalDefaultsProviderSource;
|
|
9
|
-
};
|
|
10
|
-
export type GlobalDefaultsRecommendation = {
|
|
11
|
-
provider: string;
|
|
12
|
-
model: string;
|
|
13
|
-
reason: 'configured-provider' | 'recommended';
|
|
14
|
-
};
|
|
3
|
+
import { type GatewayBuiltinToolSummary } from './agent-builtin-tools.js';
|
|
15
4
|
export type GlobalDefaultsPayload = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
providers: GlobalDefaultsProviderRow[];
|
|
19
|
-
recommendations: GlobalDefaultsRecommendation[];
|
|
5
|
+
defaults: AgentDefaults;
|
|
6
|
+
builtinTools: GatewayBuiltinToolSummary[];
|
|
20
7
|
};
|
|
21
8
|
export type UpdateGlobalDefaultsBody = {
|
|
22
|
-
|
|
9
|
+
defaults: AgentDefaults;
|
|
23
10
|
};
|
|
24
11
|
export type GlobalDefaultsAdminResult<T> = {
|
|
25
12
|
ok: true;
|
|
@@ -29,8 +16,7 @@ export type GlobalDefaultsAdminResult<T> = {
|
|
|
29
16
|
error: string;
|
|
30
17
|
status?: 400 | 404 | 500;
|
|
31
18
|
};
|
|
32
|
-
export declare function
|
|
33
|
-
export declare function listGlobalDefaults(cfg: Config): Promise<GlobalDefaultsPayload>;
|
|
19
|
+
export declare function listGlobalDefaults(cfg: Config): GlobalDefaultsPayload;
|
|
34
20
|
export declare function prepareUpdateGlobalDefaults(cfg: Config, body: UpdateGlobalDefaultsBody): GlobalDefaultsAdminResult<{
|
|
35
21
|
nextConfig: Config;
|
|
36
22
|
}>;
|
|
@@ -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 };
|
|
@@ -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
|